aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig1
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/scatterlist.h6
-rw-r--r--arch/arc/boot/dts/angel4.dts2
-rw-r--r--arch/arc/include/asm/arcregs.h2
-rw-r--r--arch/arc/include/asm/irq.h4
-rw-r--r--arch/arc/include/asm/irqflags.h18
-rw-r--r--arch/arc/kernel/irq.c53
-rw-r--r--arch/arc/kernel/signal.c47
-rw-r--r--arch/arc/kernel/smp.c23
-rw-r--r--arch/arc/kernel/time.c28
-rw-r--r--arch/arc/mm/cache_arc700.c168
-rw-r--r--arch/arc/mm/fault.c1
-rw-r--r--arch/arc/mm/tlbex.S4
-rw-r--r--arch/arc/plat-arcfpga/Kconfig7
-rw-r--r--arch/arc/plat-arcfpga/Makefile2
-rw-r--r--arch/arc/plat-arcfpga/include/plat/irq.h2
-rw-r--r--arch/arc/plat-arcfpga/irq.c25
-rw-r--r--arch/arc/plat-arcfpga/platform.c100
-rw-r--r--arch/arm/Kconfig117
-rw-r--r--arch/arm/Kconfig.debug80
-rw-r--r--arch/arm/Makefile13
-rw-r--r--arch/arm/boot/compressed/Makefile5
-rw-r--r--arch/arm/boot/compressed/head.S8
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.S (renamed from arch/arm/boot/compressed/vmlinux.lds.in)17
-rw-r--r--arch/arm/boot/dts/Makefile66
-rw-r--r--arch/arm/boot/dts/aks-cdu.dts6
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts105
-rw-r--r--arch/arm/boot/dts/am335x-pepper.dts653
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi9
-rw-r--r--arch/arm/boot/dts/am4372.dtsi11
-rw-r--r--arch/arm/boot/dts/am437x-gp-evm.dts75
-rw-r--r--arch/arm/boot/dts/am437x-sk-evm.dts613
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts63
-rw-r--r--arch/arm/boot/dts/animeo_ip.dts8
-rw-r--r--arch/arm/boot/dts/armada-375-db.dts26
-rw-r--r--arch/arm/boot/dts/armada-375.dtsi34
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi5
-rw-r--r--arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts284
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi2
-rw-r--r--arch/arm/boot/dts/at91-ariag25.dts8
-rw-r--r--arch/arm/boot/dts/at91-cosino.dtsi8
-rw-r--r--arch/arm/boot/dts/at91-foxg20.dts8
-rw-r--r--arch/arm/boot/dts/at91-qil_a9260.dts8
-rw-r--r--arch/arm/boot/dts/at91-sama5d3_xplained.dts12
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi304
-rw-r--r--arch/arm/boot/dts/at91rm9200ek.dts8
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi314
-rw-r--r--arch/arm/boot/dts/at91sam9261.dtsi20
-rw-r--r--arch/arm/boot/dts/at91sam9261ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi311
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts8
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi24
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi8
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi342
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts8
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi20
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts18
-rw-r--r--arch/arm/boot/dts/at91sam9rl.dtsi32
-rw-r--r--arch/arm/boot/dts/at91sam9rlek.dts17
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi30
-rw-r--r--arch/arm/boot/dts/at91sam9x5cm.dtsi12
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi19
-rw-r--r--arch/arm/boot/dts/bcm21664.dtsi19
-rw-r--r--arch/arm/boot/dts/bcm7445-bcm97445svmb.dts14
-rw-r--r--arch/arm/boot/dts/bcm7445.dtsi111
-rw-r--r--arch/arm/boot/dts/berlin2.dtsi6
-rw-r--r--arch/arm/boot/dts/berlin2q-marvell-dmp.dts8
-rw-r--r--arch/arm/boot/dts/berlin2q.dtsi80
-rw-r--r--arch/arm/boot/dts/cros-ec-keyboard.dtsi105
-rw-r--r--arch/arm/boot/dts/dove-cubox-es.dts12
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts3
-rw-r--r--arch/arm/boot/dts/dove.dtsi14
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts8
-rw-r--r--arch/arm/boot/dts/dra7.dtsi382
-rw-r--r--arch/arm/boot/dts/dra7xx-clocks.dtsi39
-rw-r--r--arch/arm/boot/dts/emev2.dtsi2
-rw-r--r--arch/arm/boot/dts/ethernut5.dts10
-rw-r--r--arch/arm/boot/dts/evk-pro3.dts6
-rw-r--r--arch/arm/boot/dts/exynos3250.dtsi35
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi43
-rw-r--r--arch/arm/boot/dts/exynos4210-smdkv310.dts2
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos4412-odroid-common.dtsi371
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidu3.dts61
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidx.dts279
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidx2.dts32
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts2
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi4
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos5.dtsi16
-rw-r--r--arch/arm/boot/dts/exynos5250-cros-common.dtsi159
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts4
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts259
-rw-r--r--arch/arm/boot/dts/exynos5260.dtsi9
-rw-r--r--arch/arm/boot/dts/exynos5410.dtsi15
-rw-r--r--arch/arm/boot/dts/exynos5420-peach-pit.dts392
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi25
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos5800-peach-pi.dts374
-rw-r--r--arch/arm/boot/dts/ge863-pro3.dtsi4
-rw-r--r--arch/arm/boot/dts/hi3620.dtsi1
-rw-r--r--arch/arm/boot/dts/hisi-x5hd2-dkb.dts53
-rw-r--r--arch/arm/boot/dts/hisi-x5hd2.dtsi170
-rw-r--r--arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts73
-rw-r--r--arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts45
-rw-r--r--arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts45
-rw-r--r--arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts1
-rw-r--r--arch/arm/boot/dts/imx25-pdk.dts8
-rw-r--r--arch/arm/boot/dts/imx25.dtsi8
-rw-r--r--arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi296
-rw-r--r--arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts273
-rw-r--r--arch/arm/boot/dts/imx27-pdk.dts2
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts2
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi3
-rw-r--r--arch/arm/boot/dts/imx27-pinfunc.h46
-rw-r--r--arch/arm/boot/dts/imx27.dtsi115
-rw-r--r--arch/arm/boot/dts/imx28-cfa10036.dts22
-rw-r--r--arch/arm/boot/dts/imx28-m28.dtsi87
-rw-r--r--arch/arm/boot/dts/imx28-m28evk.dts62
-rw-r--r--arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts1
-rw-r--r--arch/arm/boot/dts/imx35.dtsi8
-rw-r--r--arch/arm/boot/dts/imx50.dtsi8
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts2
-rw-r--r--arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts1
-rw-r--r--arch/arm/boot/dts/imx51.dtsi3
-rw-r--r--arch/arm/boot/dts/imx53-m53.dtsi140
-rw-r--r--arch/arm/boot/dts/imx53-m53evk.dts113
-rw-r--r--arch/arm/boot/dts/imx53-mba53.dts1
-rw-r--r--arch/arm/boot/dts/imx53-qsb-common.dtsi1
-rw-r--r--arch/arm/boot/dts/imx53-tx53.dtsi1
-rw-r--r--arch/arm/boot/dts/imx53-voipac-bsb.dts1
-rw-r--r--arch/arm/boot/dts/imx53.dtsi15
-rw-r--r--arch/arm/boot/dts/imx6dl-aristainetos_4.dts85
-rw-r--r--arch/arm/boot/dts/imx6dl-aristainetos_7.dts74
-rw-r--r--arch/arm/boot/dts/imx6dl-gw51xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6dl-gw52xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6dl-gw53xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6dl-gw54xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6dl-rex-basic.dts30
-rw-r--r--arch/arm/boot/dts/imx6dl-riotboard.dts33
-rw-r--r--arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts103
-rw-r--r--arch/arm/boot/dts/imx6dl-tx6u-801x.dts177
-rw-r--r--arch/arm/boot/dts/imx6dl-tx6u-811x.dts150
-rw-r--r--arch/arm/boot/dts/imx6dl-wandboard-revb1.dts22
-rw-r--r--arch/arm/boot/dts/imx6dl-wandboard.dts2
-rw-r--r--arch/arm/boot/dts/imx6dl.dtsi17
-rw-r--r--arch/arm/boot/dts/imx6q-cubox-i.dts4
-rw-r--r--arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts54
-rw-r--r--arch/arm/boot/dts/imx6q-gw51xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6q-gw52xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6q-gw53xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6q-gw5400-a.dts5
-rw-r--r--arch/arm/boot/dts/imx6q-gw54xx.dts2
-rw-r--r--arch/arm/boot/dts/imx6q-rex-pro.dts34
-rw-r--r--arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dts103
-rw-r--r--arch/arm/boot/dts/imx6q-tx6q-1010.dts177
-rw-r--r--arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts136
-rw-r--r--arch/arm/boot/dts/imx6q-tx6q-1020.dts210
-rw-r--r--arch/arm/boot/dts/imx6q-tx6q-1110.dts154
-rw-r--r--arch/arm/boot/dts/imx6q-udoo.dts32
-rw-r--r--arch/arm/boot/dts/imx6q-wandboard-revb1.dts26
-rw-r--r--arch/arm/boot/dts/imx6q-wandboard.dts2
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi35
-rw-r--r--arch/arm/boot/dts/imx6qdl-aristainetos.dtsi418
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw52xx.dtsi5
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw53xx.dtsi5
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw54xx.dtsi6
-rw-r--r--arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-rex.dtsi357
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabrelite.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-tx6.dtsi696
-rw-r--r--arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi42
-rw-r--r--arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi41
-rw-r--r--arch/arm/boot/dts/imx6qdl-wandboard.dtsi22
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi161
-rw-r--r--arch/arm/boot/dts/imx6sl-evk.dts17
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi12
-rw-r--r--arch/arm/boot/dts/imx6sx-pinfunc.h1544
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts479
-rw-r--r--arch/arm/boot/dts/imx6sx.dtsi1208
-rw-r--r--arch/arm/boot/dts/integratorap.dts1
-rw-r--r--arch/arm/boot/dts/k2e-clocks.dtsi2
-rw-r--r--arch/arm/boot/dts/k2hk-clocks.dtsi2
-rw-r--r--arch/arm/boot/dts/k2hk-evm.dts12
-rw-r--r--arch/arm/boot/dts/k2l-clocks.dtsi2
-rw-r--r--arch/arm/boot/dts/keystone-clocks.dtsi2
-rw-r--r--arch/arm/boot/dts/keystone.dtsi11
-rw-r--r--arch/arm/boot/dts/kirkwood-d2net.dts42
-rw-r--r--arch/arm/boot/dts/kirkwood-net2big.dts60
-rw-r--r--arch/arm/boot/dts/kirkwood-net5big.dts111
-rw-r--r--arch/arm/boot/dts/kirkwood-netxbig.dtsi154
-rw-r--r--arch/arm/boot/dts/kizbox.dts4
-rw-r--r--arch/arm/boot/dts/mpa1600.dts8
-rw-r--r--arch/arm/boot/dts/mt6589-aquaris5.dts (renamed from arch/arm/mach-s5pv210/include/mach/dma.h)21
-rw-r--r--arch/arm/boot/dts/mt6589.dtsi94
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi5
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi5
-rw-r--r--arch/arm/boot/dts/omap3.dtsi2
-rw-r--r--arch/arm/boot/dts/omap4.dtsi9
-rw-r--r--arch/arm/boot/dts/omap5-uevm.dts68
-rw-r--r--arch/arm/boot/dts/omap5.dtsi62
-rw-r--r--arch/arm/boot/dts/pm9g45.dts8
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts10
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts14
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi42
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts28
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi63
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw-reference.dts14
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi42
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts121
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen.dts116
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi234
-rw-r--r--arch/arm/boot/dts/r8a7790-lager.dts88
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi207
-rw-r--r--arch/arm/boot/dts/r8a7791-henninger.dts45
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts89
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi218
-rw-r--r--arch/arm/boot/dts/rk3066a-bqcurie2.dts214
-rw-r--r--arch/arm/boot/dts/rk3066a-clocks.dtsi299
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi519
-rw-r--r--arch/arm/boot/dts/rk3188-clocks.dtsi289
-rw-r--r--arch/arm/boot/dts/rk3188-radxarock.dts218
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi446
-rw-r--r--arch/arm/boot/dts/rk3288-evb-act8846.dts134
-rw-r--r--arch/arm/boot/dts/rk3288-evb-rk808.dts (renamed from arch/arm/mach-s5p64x0/include/mach/dma.h)18
-rw-r--r--arch/arm/boot/dts/rk3288-evb.dtsi96
-rw-r--r--arch/arm/boot/dts/rk3288.dtsi595
-rw-r--r--arch/arm/boot/dts/rk3xxx.dtsi356
-rw-r--r--arch/arm/boot/dts/s3c2416.dtsi6
-rw-r--r--arch/arm/boot/dts/s3c24xx.dtsi9
-rw-r--r--arch/arm/boot/dts/s3c64xx.dtsi4
-rw-r--r--arch/arm/boot/dts/s5pv210-aquila.dts392
-rw-r--r--arch/arm/boot/dts/s5pv210-goni.dts449
-rw-r--r--arch/arm/boot/dts/s5pv210-pinctrl.dtsi839
-rw-r--r--arch/arm/boot/dts/s5pv210-smdkc110.dts78
-rw-r--r--arch/arm/boot/dts/s5pv210-smdkv210.dts238
-rw-r--r--arch/arm/boot/dts/s5pv210-torbreck.dts92
-rw-r--r--arch/arm/boot/dts/s5pv210.dtsi633
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi22
-rw-r--r--arch/arm/boot/dts/sama5d3_gmac.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi12
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi2
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts16
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi72
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi5
-rw-r--r--arch/arm/boot/dts/spear1310-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi93
-rw-r--r--arch/arm/boot/dts/spear1340-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi30
-rw-r--r--arch/arm/boot/dts/spear13xx.dtsi9
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi10
-rw-r--r--arch/arm/boot/dts/ste-href-stuib.dtsi2
-rw-r--r--arch/arm/boot/dts/ste-href-tvk1281618.dtsi59
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dtsi24
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts38
-rw-r--r--arch/arm/boot/dts/sun4i-a10-a1000.dts15
-rw-r--r--arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts110
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts15
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts21
-rw-r--r--arch/arm/boot/dts/sun4i-a10-inet97fv2.dts21
-rw-r--r--arch/arm/boot/dts/sun4i-a10-mini-xplus.dts28
-rw-r--r--arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts15
-rw-r--r--arch/arm/boot/dts/sun4i-a10-pcduino.dts9
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi34
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi2
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi2
-rw-r--r--arch/arm/boot/dts/sun6i-a31-hummingbird.dts119
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi92
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubieboard2.dts16
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubietruck.dts16
-rw-r--r--arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts22
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts10
-rw-r--r--arch/arm/boot/dts/sun7i-a20-pcduino3.dts173
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi34
-rw-r--r--arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts30
-rw-r--r--arch/arm/boot/dts/sun8i-a23.dtsi343
-rw-r--r--arch/arm/boot/dts/tegra114-roth.dts32
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi20
-rw-r--r--arch/arm/boot/dts/tegra124-jetson-tk1.dts33
-rw-r--r--arch/arm/boot/dts/tegra124-venice2.dts128
-rw-r--r--arch/arm/boot/dts/tegra124.dtsi62
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts8
-rw-r--r--arch/arm/boot/dts/tegra20-medcom-wide.dts61
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts6
-rw-r--r--arch/arm/boot/dts/tegra20-plutux.dts41
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi17
-rw-r--r--arch/arm/boot/dts/tegra20-tec.dts41
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts8
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi22
-rw-r--r--arch/arm/boot/dts/tegra30-apalis-eval.dts260
-rw-r--r--arch/arm/boot/dts/tegra30-apalis.dtsi678
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts12
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi11
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi22
-rw-r--r--arch/arm/boot/dts/tny_a9260_common.dtsi8
-rw-r--r--arch/arm/boot/dts/tny_a9263.dts8
-rw-r--r--arch/arm/boot/dts/usb_a9260_common.dtsi8
-rw-r--r--arch/arm/boot/dts/usb_a9263.dts8
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts85
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts14
-rw-r--r--arch/arm/boot/dts/vf610.dtsi25
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi90
-rw-r--r--arch/arm/boot/dts/zynq-parallella.dts64
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts4
-rw-r--r--arch/arm/common/bL_switcher.c16
-rw-r--r--arch/arm/common/edma.c31
-rw-r--r--arch/arm/common/mcpm_entry.c52
-rw-r--r--arch/arm/common/timer-sp.c4
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig4
-rw-r--r--arch/arm/configs/bcm_defconfig1
-rw-r--r--arch/arm/configs/exynos_defconfig56
-rw-r--r--arch/arm/configs/genmai_defconfig122
-rw-r--r--arch/arm/configs/hi3xxx_defconfig2
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig5
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig9
-rw-r--r--arch/arm/configs/kirkwood_defconfig181
-rw-r--r--arch/arm/configs/msm_defconfig1
-rw-r--r--arch/arm/configs/multi_v5_defconfig2
-rw-r--r--arch/arm/configs/multi_v7_defconfig23
-rw-r--r--arch/arm/configs/mvebu_v5_defconfig6
-rw-r--r--arch/arm/configs/mvebu_v7_defconfig5
-rw-r--r--arch/arm/configs/mxs_defconfig1
-rw-r--r--arch/arm/configs/omap1_defconfig2
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/configs/s3c2410_defconfig1
-rw-r--r--arch/arm/configs/s5p64x0_defconfig68
-rw-r--r--arch/arm/configs/s5pc100_defconfig49
-rw-r--r--arch/arm/configs/shmobile_defconfig23
-rw-r--r--arch/arm/configs/socfpga_defconfig35
-rw-r--r--arch/arm/configs/spear13xx_defconfig16
-rw-r--r--arch/arm/configs/tegra_defconfig16
-rw-r--r--arch/arm/crypto/Makefile4
-rw-r--r--arch/arm/crypto/aes-armv4.S3
-rw-r--r--arch/arm/crypto/sha1-armv7-neon.S634
-rw-r--r--arch/arm/crypto/sha1_glue.c58
-rw-r--r--arch/arm/crypto/sha1_neon_glue.c197
-rw-r--r--arch/arm/crypto/sha512-armv7-neon.S455
-rw-r--r--arch/arm/crypto/sha512_neon_glue.c305
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/assembler.h29
-rw-r--r--arch/arm/include/asm/cputype.h37
-rw-r--r--arch/arm/include/asm/crypto/sha1.h10
-rw-r--r--arch/arm/include/asm/entry-macro-multi.S2
-rw-r--r--arch/arm/include/asm/glue-proc.h18
-rw-r--r--arch/arm/include/asm/gpio.h7
-rw-r--r--arch/arm/include/asm/kvm_asm.h18
-rw-r--r--arch/arm/include/asm/kvm_emulate.h22
-rw-r--r--arch/arm/include/asm/kvm_host.h8
-rw-r--r--arch/arm/include/asm/kvm_mmu.h12
-rw-r--r--arch/arm/include/asm/mcpm.h16
-rw-r--r--arch/arm/include/asm/mcs_spinlock.h23
-rw-r--r--arch/arm/include/asm/memory.h10
-rw-r--r--arch/arm/include/asm/perf_event.h9
-rw-r--r--arch/arm/include/asm/pgtable-3level-hwdef.h3
-rw-r--r--arch/arm/include/asm/pgtable-3level.h49
-rw-r--r--arch/arm/include/asm/pgtable.h18
-rw-r--r--arch/arm/include/asm/pmu.h19
-rw-r--r--arch/arm/include/asm/ptrace.h6
-rw-r--r--arch/arm/include/asm/scatterlist.h12
-rw-r--r--arch/arm/include/asm/smp_scu.h2
-rw-r--r--arch/arm/include/asm/stacktrace.h15
-rw-r--r--arch/arm/include/asm/thread_info.h3
-rw-r--r--arch/arm/include/asm/uaccess.h22
-rw-r--r--arch/arm/include/asm/unistd.h12
-rw-r--r--arch/arm/include/debug/clps711x.S38
-rw-r--r--arch/arm/include/debug/s5pv210.S (renamed from arch/arm/mach-s5pv210/include/mach/debug-macro.S)23
-rw-r--r--arch/arm/include/uapi/asm/unistd.h14
-rw-r--r--arch/arm/kernel/asm-offsets.c14
-rw-r--r--arch/arm/kernel/calls.S3
-rw-r--r--arch/arm/kernel/debug.S10
-rw-r--r--arch/arm/kernel/entry-armv.S42
-rw-r--r--arch/arm/kernel/entry-common.S13
-rw-r--r--arch/arm/kernel/entry-header.S14
-rw-r--r--arch/arm/kernel/fiqasm.S4
-rw-r--r--arch/arm/kernel/head-common.S7
-rw-r--r--arch/arm/kernel/head-nommu.S8
-rw-r--r--arch/arm/kernel/head.S18
-rw-r--r--arch/arm/kernel/hyp-stub.S10
-rw-r--r--arch/arm/kernel/iwmmxt.S16
-rw-r--r--arch/arm/kernel/perf_event.c18
-rw-r--r--arch/arm/kernel/perf_event_cpu.c66
-rw-r--r--arch/arm/kernel/perf_event_v6.c307
-rw-r--r--arch/arm/kernel/perf_event_v7.c967
-rw-r--r--arch/arm/kernel/perf_event_xscale.c121
-rw-r--r--arch/arm/kernel/relocate_kernel.S3
-rw-r--r--arch/arm/kernel/setup.c29
-rw-r--r--arch/arm/kernel/sleep.S2
-rw-r--r--arch/arm/kernel/smp.c70
-rw-r--r--arch/arm/kernel/smp_scu.c12
-rw-r--r--arch/arm/kernel/smp_tlb.c20
-rw-r--r--arch/arm/kernel/swp_emulate.c4
-rw-r--r--arch/arm/kernel/time.c5
-rw-r--r--arch/arm/kernel/traps.c6
-rw-r--r--arch/arm/kernel/unwind.c8
-rw-r--r--arch/arm/kernel/vmlinux.lds.S1
-rw-r--r--arch/arm/kvm/Kconfig2
-rw-r--r--arch/arm/kvm/Makefile1
-rw-r--r--arch/arm/kvm/arm.c39
-rw-r--r--arch/arm/kvm/coproc.c88
-rw-r--r--arch/arm/kvm/guest.c18
-rw-r--r--arch/arm/kvm/init.S7
-rw-r--r--arch/arm/kvm/interrupts.S9
-rw-r--r--arch/arm/kvm/interrupts_head.S48
-rw-r--r--arch/arm/kvm/mmu.c214
-rw-r--r--arch/arm/lib/ashldi3.S3
-rw-r--r--arch/arm/lib/ashrdi3.S3
-rw-r--r--arch/arm/lib/backtrace.S2
-rw-r--r--arch/arm/lib/bitops.h5
-rw-r--r--arch/arm/lib/bswapsdi2.S5
-rw-r--r--arch/arm/lib/call_with_stack.S4
-rw-r--r--arch/arm/lib/csumpartial.S2
-rw-r--r--arch/arm/lib/csumpartialcopygeneric.S5
-rw-r--r--arch/arm/lib/delay-loop.S18
-rw-r--r--arch/arm/lib/delay.c26
-rw-r--r--arch/arm/lib/div64.S13
-rw-r--r--arch/arm/lib/findbit.S10
-rw-r--r--arch/arm/lib/getuser.S45
-rw-r--r--arch/arm/lib/io-readsb.S2
-rw-r--r--arch/arm/lib/io-readsl.S6
-rw-r--r--arch/arm/lib/io-readsw-armv3.S4
-rw-r--r--arch/arm/lib/io-readsw-armv4.S2
-rw-r--r--arch/arm/lib/io-writesb.S2
-rw-r--r--arch/arm/lib/io-writesl.S10
-rw-r--r--arch/arm/lib/io-writesw-armv3.S4
-rw-r--r--arch/arm/lib/io-writesw-armv4.S4
-rw-r--r--arch/arm/lib/lib1funcs.S26
-rw-r--r--arch/arm/lib/lshrdi3.S3
-rw-r--r--arch/arm/lib/memchr.S2
-rw-r--r--arch/arm/lib/memset.S2
-rw-r--r--arch/arm/lib/memzero.S2
-rw-r--r--arch/arm/lib/muldi3.S3
-rw-r--r--arch/arm/lib/putuser.S10
-rw-r--r--arch/arm/lib/strchr.S2
-rw-r--r--arch/arm/lib/strrchr.S2
-rw-r--r--arch/arm/lib/ucmpdi2.S5
-rw-r--r--arch/arm/mach-at91/Kconfig4
-rw-r--r--arch/arm/mach-at91/at91rm9200.c6
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c6
-rw-r--r--arch/arm/mach-at91/at91sam9263.c7
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c11
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c7
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c11
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c1
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c11
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c55
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c42
-rw-r--r--arch/arm/mach-at91/board.h1
-rw-r--r--arch/arm/mach-at91/leds.c37
-rw-r--r--arch/arm/mach-bcm/Kconfig34
-rw-r--r--arch/arm/mach-bcm/Makefile8
-rw-r--r--arch/arm/mach-bcm/board_bcm21664.c3
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c3
-rw-r--r--arch/arm/mach-bcm/brcmstb.c28
-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/kona_smp.c202
-rw-r--r--arch/arm/mach-bcm/platsmp-brcmstb.c363
-rw-r--r--arch/arm/mach-berlin/Kconfig3
-rw-r--r--arch/arm/mach-berlin/Makefile3
-rw-r--r--arch/arm/mach-berlin/headsmp.S30
-rw-r--r--arch/arm/mach-berlin/platsmp.c99
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c1
-rw-r--r--arch/arm/mach-clps711x/board-cdb89712.c1
-rw-r--r--arch/arm/mach-clps711x/board-clep7312.c3
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c14
-rw-r--r--arch/arm/mach-clps711x/board-p720t.c7
-rw-r--r--arch/arm/mach-clps711x/common.c12
-rw-r--r--arch/arm/mach-clps711x/common.h1
-rw-r--r--arch/arm/mach-clps711x/devices.c10
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-davinci/sleep.S2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/memory.h5
-rw-r--r--arch/arm/mach-ep93xx/crunch-bits.S6
-rw-r--r--arch/arm/mach-ep93xx/include/mach/memory.h22
-rw-r--r--arch/arm/mach-exynos/Kconfig2
-rw-r--r--arch/arm/mach-exynos/common.h27
-rw-r--r--arch/arm/mach-exynos/exynos.c76
-rw-r--r--arch/arm/mach-exynos/headsmp.S1
-rw-r--r--arch/arm/mach-exynos/hotplug.c3
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h6
-rw-r--r--arch/arm/mach-exynos/include/mach/memory.h3
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c123
-rw-r--r--arch/arm/mach-exynos/platsmp.c77
-rw-r--r--arch/arm/mach-exynos/pm.c286
-rw-r--r--arch/arm/mach-exynos/pm_domains.c9
-rw-r--r--arch/arm/mach-exynos/pmu.c41
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h525
-rw-r--r--arch/arm/mach-exynos/regs-sys.h22
-rw-r--r--arch/arm/mach-footbridge/include/mach/memory.h5
-rw-r--r--arch/arm/mach-highbank/Kconfig1
-rw-r--r--arch/arm/mach-hisi/Kconfig30
-rw-r--r--arch/arm/mach-hisi/Makefile2
-rw-r--r--arch/arm/mach-hisi/core.h5
-rw-r--r--arch/arm/mach-hisi/headsmp.S16
-rw-r--r--arch/arm/mach-hisi/hisilicon.c43
-rw-r--r--arch/arm/mach-hisi/hotplug.c58
-rw-r--r--arch/arm/mach-hisi/platsmp.c53
-rw-r--r--arch/arm/mach-imx/Kconfig60
-rw-r--r--arch/arm/mach-imx/Makefile11
-rw-r--r--arch/arm/mach-imx/clk-imx1.c151
-rw-r--r--arch/arm/mach-imx/clk-imx21.c299
-rw-r--r--arch/arm/mach-imx/clk-imx25.c47
-rw-r--r--arch/arm/mach-imx/clk-imx27.c452
-rw-r--r--arch/arm/mach-imx/clk-imx31.c6
-rw-r--r--arch/arm/mach-imx/clk-imx35.c6
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c256
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c540
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c11
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c25
-rw-r--r--arch/arm/mach-imx/clk-vf610.c8
-rw-r--r--arch/arm/mach-imx/clk.c10
-rw-r--r--arch/arm/mach-imx/clk.h9
-rw-r--r--arch/arm/mach-imx/common.h32
-rw-r--r--arch/arm/mach-imx/cpu-imx5.c25
-rw-r--r--arch/arm/mach-imx/cpu.c13
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6q.c6
-rw-r--r--arch/arm/mach-imx/crm-regs-imx5.h600
-rw-r--r--arch/arm/mach-imx/devices-imx51.h66
-rw-r--r--arch/arm/mach-imx/devices/Kconfig9
-rw-r--r--arch/arm/mach-imx/devices/Makefile2
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h26
-rw-r--r--arch/arm/mach-imx/devices/devices.c2
-rw-r--r--arch/arm/mach-imx/devices/platform-fec.c12
-rw-r--r--arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c5
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-i2c.c26
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-keypad.c10
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-ssi.c20
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-uart.c22
-rw-r--r--arch/arm/mach-imx/devices/platform-imx2-wdt.c18
-rw-r--r--arch/arm/mach-imx/devices/platform-imx_udc.c75
-rw-r--r--arch/arm/mach-imx/devices/platform-mx1-camera.c42
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc-ehci.c9
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_nand.c5
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rnga.c5
-rw-r--r--arch/arm/mach-imx/devices/platform-pata_imx.c10
-rw-r--r--arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c24
-rw-r--r--arch/arm/mach-imx/devices/platform-spi_imx.c27
-rw-r--r--arch/arm/mach-imx/ehci-imx25.c1
-rw-r--r--arch/arm/mach-imx/ehci-imx27.c1
-rw-r--r--arch/arm/mach-imx/ehci-imx31.c1
-rw-r--r--arch/arm/mach-imx/ehci-imx35.c1
-rw-r--r--arch/arm/mach-imx/ehci-imx5.c171
-rw-r--r--arch/arm/mach-imx/ehci.h43
-rw-r--r--arch/arm/mach-imx/gpc.c5
-rw-r--r--arch/arm/mach-imx/hardware.h2
-rw-r--r--arch/arm/mach-imx/imx25-dt.c6
-rw-r--r--arch/arm/mach-imx/imx27-dt.c6
-rw-r--r--arch/arm/mach-imx/imx31-dt.c2
-rw-r--r--arch/arm/mach-imx/imx35-dt.c2
-rw-r--r--arch/arm/mach-imx/iomux-mx51.h827
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c1
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27ipcam.c77
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c83
-rw-r--r--arch/arm/mach-imx/mach-imx50.c5
-rw-r--r--arch/arm/mach-imx/mach-imx51.c (renamed from arch/arm/mach-imx/imx51-dt.c)45
-rw-r--r--arch/arm/mach-imx/mach-imx53.c19
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c4
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6sx.c10
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c1
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c5
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c1
-rw-r--r--arch/arm/mach-imx/mach-pca100.c1
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c1
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c1
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c1
-rw-r--r--arch/arm/mach-imx/mach-vf610.c2
-rw-r--r--arch/arm/mach-imx/mach-vpr200.c1
-rw-r--r--arch/arm/mach-imx/mm-imx5.c155
-rw-r--r--arch/arm/mach-imx/mx1-camera-fiq-ksym.c18
-rw-r--r--arch/arm/mach-imx/mx1-camera-fiq.S35
-rw-r--r--arch/arm/mach-imx/mx31moboard-devboard.c5
-rw-r--r--arch/arm/mach-imx/mx31moboard-marxbot.c5
-rw-r--r--arch/arm/mach-imx/mx31moboard-smartbot.c5
-rw-r--r--arch/arm/mach-imx/mx51.h346
-rw-r--r--arch/arm/mach-imx/mx53.h342
-rw-r--r--arch/arm/mach-imx/mxc.h7
-rw-r--r--arch/arm/mach-imx/pm-imx5.c98
-rw-r--r--arch/arm/mach-imx/pm-imx6.c67
-rw-r--r--arch/arm/mach-imx/suspend-imx6.S5
-rw-r--r--arch/arm/mach-imx/system.c24
-rw-r--r--arch/arm/mach-imx/time.c55
-rw-r--r--arch/arm/mach-imx/tzic.c9
-rw-r--r--arch/arm/mach-integrator/Kconfig1
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h34
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c13
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iop13xx.h2
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h5
-rw-r--r--arch/arm/mach-iop13xx/setup.c1
-rw-r--r--arch/arm/mach-kirkwood/Kconfig111
-rw-r--r--arch/arm/mach-kirkwood/Makefile14
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot3
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c223
-rw-r--r--arch/arm/mach-kirkwood/common.c746
-rw-r--r--arch/arm/mach-kirkwood/common.h74
-rw-r--r--arch/arm/mach-kirkwood/d2net_v2-setup.c231
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h86
-rw-r--r--arch/arm/mach-kirkwood/include/mach/entry-macro.S34
-rw-r--r--arch/arm/mach-kirkwood/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h65
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h142
-rw-r--r--arch/arm/mach-kirkwood/include/mach/uncompress.h46
-rw-r--r--arch/arm/mach-kirkwood/irq.c82
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.c114
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.h16
-rw-r--r--arch/arm/mach-kirkwood/mpp.c43
-rw-r--r--arch/arm/mach-kirkwood/mpp.h348
-rw-r--r--arch/arm/mach-kirkwood/netxbig_v2-setup.c422
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c255
-rw-r--r--arch/arm/mach-kirkwood/pcie.c296
-rw-r--r--arch/arm/mach-kirkwood/pm.c76
-rw-r--r--arch/arm/mach-kirkwood/pm.h26
-rw-r--r--arch/arm/mach-kirkwood/rd88f6192-nas-setup.c89
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c128
-rw-r--r--arch/arm/mach-kirkwood/t5325-setup.c216
-rw-r--r--arch/arm/mach-kirkwood/ts219-setup.c142
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c186
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.c113
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.h7
-rw-r--r--arch/arm/mach-ks8695/include/mach/memory.h5
-rw-r--r--arch/arm/mach-mediatek/Kconfig6
-rw-r--r--arch/arm/mach-mediatek/Makefile1
-rw-r--r--arch/arm/mach-mediatek/mediatek.c (renamed from arch/arm/mach-s5pc100/include/mach/dma.h)25
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa910.h1
-rw-r--r--arch/arm/mach-msm/Kconfig3
-rw-r--r--arch/arm/mach-mvebu/Kconfig13
-rw-r--r--arch/arm/mach-mvebu/Makefile4
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h2
-rw-r--r--arch/arm/mach-mvebu/board-v7.c22
-rw-r--r--arch/arm/mach-mvebu/board.h5
-rw-r--r--arch/arm/mach-mvebu/coherency_ll.S10
-rw-r--r--arch/arm/mach-mvebu/common.h3
-rw-r--r--arch/arm/mach-mvebu/cpu-reset.c2
-rw-r--r--arch/arm/mach-mvebu/headsmp-a9.S15
-rw-r--r--arch/arm/mach-mvebu/hotplug.c31
-rw-r--r--arch/arm/mach-mvebu/kirkwood.c3
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c21
-rw-r--r--arch/arm/mach-mvebu/netxbig.c191
-rw-r--r--arch/arm/mach-mvebu/platsmp-a9.c45
-rw-r--r--arch/arm/mach-mvebu/platsmp.c49
-rw-r--r--arch/arm/mach-mvebu/pmsu.c438
-rw-r--r--arch/arm/mach-mvebu/pmsu.h5
-rw-r--r--arch/arm/mach-mvebu/pmsu_ll.S36
-rw-r--r--arch/arm/mach-mvebu/system-controller.c50
-rw-r--r--arch/arm/mach-omap1/include/mach/memory.h5
-rw-r--r--arch/arm/mach-omap1/ocpi.c1
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/Makefile11
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c2
-rw-r--r--arch/arm/mach-omap2/cclock2420_data.c1931
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c2048
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c69
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c47
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c126
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c8
-rw-r--r--arch/arm/mach-omap2/clock.c97
-rw-r--r--arch/arm/mach-omap2/clock.h47
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h2
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h1
-rw-r--r--arch/arm/mach-omap2/cm2_7xx.h4
-rw-r--r--arch/arm/mach-omap2/common.c2
-rw-r--r--arch/arm/mach-omap2/control.c66
-rw-r--r--arch/arm/mach-omap2/control.h40
-rw-r--r--arch/arm/mach-omap2/ctrl_module_core_44xx.h392
-rw-r--r--arch/arm/mach-omap2/ctrl_module_pad_core_44xx.h1409
-rw-r--r--arch/arm/mach-omap2/ctrl_module_pad_wkup_44xx.h236
-rw-r--r--arch/arm/mach-omap2/devices.c2
-rw-r--r--arch/arm/mach-omap2/dma.c3
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c20
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c19
-rw-r--r--arch/arm/mach-omap2/dsp.c134
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c79
-rw-r--r--arch/arm/mach-omap2/io.c9
-rw-r--r--arch/arm/mach-omap2/mux.c22
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c14
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c40
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_43xx_data.c100
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c14
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c574
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_ipblock_data.c55
-rw-r--r--arch/arm/mach-omap2/pm24xx.c35
-rw-r--r--arch/arm/mach-omap2/pm34xx.c218
-rw-r--r--arch/arm/mach-omap2/prcm43xx.h1
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c18
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h1
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c233
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h6
-rw-r--r--arch/arm/mach-omap2/prm7xx.h4
-rw-r--r--arch/arm/mach-omap2/prm_common.c2
-rw-r--r--arch/arm/mach-omap2/sleep44xx.S3
-rw-r--r--arch/arm/mach-omap2/sram242x.S6
-rw-r--r--arch/arm/mach-omap2/sram243x.S6
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c1
-rw-r--r--arch/arm/mach-pxa/Makefile2
-rw-r--r--arch/arm/mach-pxa/balloon3.c2
-rw-r--r--arch/arm/mach-pxa/corgi.c2
-rw-r--r--arch/arm/mach-pxa/generic.c23
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-pxa/mioa701_bootresume.S2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c7
-rw-r--r--arch/arm/mach-pxa/pxa27x.c10
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/sleep.S2
-rw-r--r--arch/arm/mach-pxa/standby.S4
-rw-r--r--arch/arm/mach-pxa/time.c162
-rw-r--r--arch/arm/mach-pxa/viper.c2
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h9
-rw-r--r--arch/arm/mach-rockchip/Kconfig1
-rw-r--r--arch/arm/mach-rockchip/Makefile2
-rw-r--r--arch/arm/mach-rockchip/platsmp.c20
-rw-r--r--arch/arm/mach-rockchip/rockchip.c1
-rw-r--r--arch/arm/mach-rpc/include/mach/memory.h5
-rw-r--r--arch/arm/mach-s3c24xx/common.c2
-rw-r--r--arch/arm/mach-s3c24xx/iotiming-s3c2412.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c5
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c3
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c6
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c6
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c6
-rw-r--r--arch/arm/mach-s3c24xx/sleep-s3c2410.S2
-rw-r--r--arch/arm/mach-s3c24xx/sleep-s3c2412.S2
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-ncp.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6400.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/s3c6400.c1
-rw-r--r--arch/arm/mach-s3c64xx/s3c6410.c1
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig102
-rw-r--r--arch/arm/mach-s5p64x0/Makefile36
-rw-r--r--arch/arm/mach-s5p64x0/Makefile.boot2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c632
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c701
-rw-r--r--arch/arm/mach-s5p64x0/clock.c236
-rw-r--r--arch/arm/mach-s5p64x0/clock.h38
-rw-r--r--arch/arm/mach-s5p64x0/common.c490
-rw-r--r--arch/arm/mach-s5p64x0/common.h56
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c176
-rw-r--r--arch/arm/mach-s5p64x0/dma.c128
-rw-r--r--arch/arm/mach-s5p64x0/i2c.h16
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/debug-macro.S32
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h132
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/irqs.h148
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h96
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/pm-core.h119
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-clock.h98
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-gpio.h68
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-irq.h18
-rw-r--r--arch/arm/mach-s5p64x0/irq-pm.c98
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c280
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c299
-rw-r--r--arch/arm/mach-s5p64x0/pm.c202
-rw-r--r--arch/arm/mach-s5p64x0/setup-fb-24bpp.c29
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c0.c38
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c1.c38
-rw-r--r--arch/arm/mach-s5p64x0/setup-sdhci-gpio.c104
-rw-r--r--arch/arm/mach-s5p64x0/setup-spi.c38
-rw-r--r--arch/arm/mach-s5pc100/Kconfig81
-rw-r--r--arch/arm/mach-s5pc100/Makefile32
-rw-r--r--arch/arm/mach-s5pc100/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pc100/clock.c1361
-rw-r--r--arch/arm/mach-s5pc100/common.c255
-rw-r--r--arch/arm/mach-s5pc100/common.h30
-rw-r--r--arch/arm/mach-s5pc100/dev-audio.c239
-rw-r--r--arch/arm/mach-s5pc100/dma.c130
-rw-r--r--arch/arm/mach-s5pc100/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-s5pc100/include/mach/entry-macro.S19
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h144
-rw-r--r--arch/arm/mach-s5pc100/include/mach/hardware.h14
-rw-r--r--arch/arm/mach-s5pc100/include/mach/irqs.h115
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h137
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-clock.h80
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-gpio.h38
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-irq.h18
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c264
-rw-r--r--arch/arm/mach-s5pc100/setup-fb-24bpp.c35
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c0.c28
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c1.c28
-rw-r--r--arch/arm/mach-s5pc100/setup-ide.c57
-rw-r--r--arch/arm/mach-s5pc100/setup-keypad.c23
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci-gpio.c70
-rw-r--r--arch/arm/mach-s5pc100/setup-spi.c41
-rw-r--r--arch/arm/mach-s5pv210/Kconfig197
-rw-r--r--arch/arm/mach-s5pv210/Makefile29
-rw-r--r--arch/arm/mach-s5pv210/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pv210/clock.c1365
-rw-r--r--arch/arm/mach-s5pv210/common.c279
-rw-r--r--arch/arm/mach-s5pv210/common.h21
-rw-r--r--arch/arm/mach-s5pv210/dev-audio.c246
-rw-r--r--arch/arm/mach-s5pv210/dma.c130
-rw-r--r--arch/arm/mach-s5pv210/include/mach/gpio.h140
-rw-r--r--arch/arm/mach-s5pv210/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-s5pv210/include/mach/irqs.h137
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h158
-rw-r--r--arch/arm/mach-s5pv210/include/mach/memory.h27
-rw-r--r--arch/arm/mach-s5pv210/include/mach/pm-core.h46
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-clock.h2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-gpio.h41
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-irq.h18
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c687
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c916
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c159
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c337
-rw-r--r--arch/arm/mach-s5pv210/mach-torbreck.c135
-rw-r--r--arch/arm/mach-s5pv210/pm.c147
-rw-r--r--arch/arm/mach-s5pv210/s5pv210.c77
-rw-r--r--arch/arm/mach-s5pv210/setup-fb-24bpp.c49
-rw-r--r--arch/arm/mach-s5pv210/setup-fimc.c43
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c0.c28
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c1.c28
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c2.c28
-rw-r--r--arch/arm/mach-s5pv210/setup-ide.c39
-rw-r--r--arch/arm/mach-s5pv210/setup-keypad.c24
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci-gpio.c103
-rw-r--r--arch/arm/mach-s5pv210/setup-spi.c34
-rw-r--r--arch/arm/mach-s5pv210/setup-usb-phy.c95
-rw-r--r--arch/arm/mach-s5pv210/sleep.S (renamed from arch/arm/plat-samsung/s5p-sleep.S)19
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h5
-rw-r--r--arch/arm/mach-shmobile/Kconfig26
-rw-r--r--arch/arm/mach-shmobile/Makefile23
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot1
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c22
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c14
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c47
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c27
-rw-r--r--arch/arm/mach-shmobile/board-genmai-reference.c10
-rw-r--r--arch/arm/mach-shmobile/board-genmai.c15
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c28
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c37
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c6
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c10
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c29
-rw-r--r--arch/arm/mach-shmobile/board-lager.c56
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c16
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c32
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c9
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c5
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c11
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c28
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c12
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c27
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c8
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c6
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c14
-rw-r--r--arch/arm/mach-shmobile/clock.c6
-rw-r--r--arch/arm/mach-shmobile/clock.h (renamed from arch/arm/mach-shmobile/include/mach/clock.h)0
-rw-r--r--arch/arm/mach-shmobile/common.h (renamed from arch/arm/mach-shmobile/include/mach/common.h)9
-rw-r--r--arch/arm/mach-shmobile/console.c2
-rw-r--r--arch/arm/mach-shmobile/cpufreq.c17
-rw-r--r--arch/arm/mach-shmobile/dma-register.h (renamed from arch/arm/mach-shmobile/include/mach/dma-register.h)0
-rw-r--r--arch/arm/mach-shmobile/headsmp.S16
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h16
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c5
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c9
-rw-r--r--arch/arm/mach-shmobile/intc.h (renamed from arch/arm/mach-shmobile/include/mach/intc.h)0
-rw-r--r--arch/arm/mach-shmobile/irqs.h21
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c71
-rw-r--r--arch/arm/mach-shmobile/platsmp-scu.c2
-rw-r--r--arch/arm/mach-shmobile/platsmp.c2
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c4
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c19
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7790.c45
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7791.c73
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.c2
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.h (renamed from arch/arm/mach-shmobile/include/mach/pm-rcar.h)0
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c2
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.h (renamed from arch/arm/mach-shmobile/include/mach/pm-rmobile.h)0
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c8
-rw-r--r--arch/arm/mach-shmobile/pm-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/r7s72100.h (renamed from arch/arm/mach-shmobile/include/mach/r7s72100.h)1
-rw-r--r--arch/arm/mach-shmobile/r8a73a4.h (renamed from arch/arm/mach-shmobile/include/mach/r8a73a4.h)0
-rw-r--r--arch/arm/mach-shmobile/r8a7740.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7740.h)2
-rw-r--r--arch/arm/mach-shmobile/r8a7778.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7778.h)0
-rw-r--r--arch/arm/mach-shmobile/r8a7779.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7779.h)14
-rw-r--r--arch/arm/mach-shmobile/r8a7790.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7790.h)3
-rw-r--r--arch/arm/mach-shmobile/r8a7791.h (renamed from arch/arm/mach-shmobile/include/mach/r8a7791.h)1
-rw-r--r--arch/arm/mach-shmobile/rcar-gen2.h (renamed from arch/arm/mach-shmobile/include/mach/rcar-gen2.h)1
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c19
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c17
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c30
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c20
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c33
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c59
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c32
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c20
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c76
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c12
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c19
-rw-r--r--arch/arm/mach-shmobile/sh7372.h (renamed from arch/arm/mach-shmobile/include/mach/sh7372.h)4
-rw-r--r--arch/arm/mach-shmobile/sh73a0.h (renamed from arch/arm/mach-shmobile/include/mach/sh73a0.h)0
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c2
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c8
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c36
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c30
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c6
-rw-r--r--arch/arm/mach-shmobile/timer.c50
-rw-r--r--arch/arm/mach-spear/Kconfig4
-rw-r--r--arch/arm/mach-spear/include/mach/spear.h4
-rw-r--r--arch/arm/mach-spear/spear1310.c2
-rw-r--r--arch/arm/mach-spear/spear1340.c125
-rw-r--r--arch/arm/mach-spear/spear13xx.c4
-rw-r--r--arch/arm/mach-sti/platsmp.c6
-rw-r--r--arch/arm/mach-sunxi/Kconfig9
-rw-r--r--arch/arm/mach-sunxi/sunxi.c9
-rw-r--r--arch/arm/mach-tegra/Makefile7
-rw-r--r--arch/arm/mach-tegra/apbio.c206
-rw-r--r--arch/arm/mach-tegra/apbio.h22
-rw-r--r--arch/arm/mach-tegra/board-paz00.c3
-rw-r--r--arch/arm/mach-tegra/board.h7
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra114.c10
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c16
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra30.c10
-rw-r--r--arch/arm/mach-tegra/cpuidle.c7
-rw-r--r--arch/arm/mach-tegra/flowctrl.c11
-rw-r--r--arch/arm/mach-tegra/fuse.c252
-rw-r--r--arch/arm/mach-tegra/fuse.h79
-rw-r--r--arch/arm/mach-tegra/hotplug.c30
-rw-r--r--arch/arm/mach-tegra/io.c8
-rw-r--r--arch/arm/mach-tegra/irq.c8
-rw-r--r--arch/arm/mach-tegra/platsmp.c29
-rw-r--r--arch/arm/mach-tegra/pm-tegra20.c1
-rw-r--r--arch/arm/mach-tegra/pm-tegra30.c1
-rw-r--r--arch/arm/mach-tegra/pm.c63
-rw-r--r--arch/arm/mach-tegra/pm.h10
-rw-r--r--arch/arm/mach-tegra/pmc.c413
-rw-r--r--arch/arm/mach-tegra/pmc.h49
-rw-r--r--arch/arm/mach-tegra/powergate.c515
-rw-r--r--arch/arm/mach-tegra/reset-handler.S7
-rw-r--r--arch/arm/mach-tegra/reset.c19
-rw-r--r--arch/arm/mach-tegra/sleep-tegra20.S24
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S21
-rw-r--r--arch/arm/mach-tegra/sleep.S8
-rw-r--r--arch/arm/mach-tegra/sleep.h3
-rw-r--r--arch/arm/mach-tegra/tegra.c37
-rw-r--r--arch/arm/mach-tegra/tegra114_speedo.c104
-rw-r--r--arch/arm/mach-tegra/tegra20_speedo.c109
-rw-r--r--arch/arm/mach-tegra/tegra30_speedo.c292
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c2
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c18
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c8
-rw-r--r--arch/arm/mach-ux500/cpu.c2
-rw-r--r--arch/arm/mach-ux500/timer.c2
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c1
-rw-r--r--arch/arm/mach-vexpress/Kconfig2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c3
-rw-r--r--arch/arm/mach-vexpress/tc2_pm.c19
-rw-r--r--arch/arm/mach-vt8500/vt8500.c6
-rw-r--r--arch/arm/mach-w90x900/cpu.c3
-rw-r--r--arch/arm/mach-zynq/Kconfig1
-rw-r--r--arch/arm/mm/Kconfig11
-rw-r--r--arch/arm/mm/alignment.c4
-rw-r--r--arch/arm/mm/cache-fa.S19
-rw-r--r--arch/arm/mm/cache-l2x0.c2
-rw-r--r--arch/arm/mm/cache-nop.S5
-rw-r--r--arch/arm/mm/cache-v4.S13
-rw-r--r--arch/arm/mm/cache-v4wb.S15
-rw-r--r--arch/arm/mm/cache-v4wt.S13
-rw-r--r--arch/arm/mm/cache-v6.S20
-rw-r--r--arch/arm/mm/cache-v7.S30
-rw-r--r--arch/arm/mm/dma-mapping.c1
-rw-r--r--arch/arm/mm/dump.c4
-rw-r--r--arch/arm/mm/l2c-l2x0-resume.S7
-rw-r--r--arch/arm/mm/mmu.c45
-rw-r--r--arch/arm/mm/proc-arm1020.S34
-rw-r--r--arch/arm/mm/proc-arm1020e.S34
-rw-r--r--arch/arm/mm/proc-arm1022.S34
-rw-r--r--arch/arm/mm/proc-arm1026.S34
-rw-r--r--arch/arm/mm/proc-arm720.S16
-rw-r--r--arch/arm/mm/proc-arm740.S8
-rw-r--r--arch/arm/mm/proc-arm7tdmi.S8
-rw-r--r--arch/arm/mm/proc-arm920.S34
-rw-r--r--arch/arm/mm/proc-arm922.S34
-rw-r--r--arch/arm/mm/proc-arm925.S34
-rw-r--r--arch/arm/mm/proc-arm926.S34
-rw-r--r--arch/arm/mm/proc-arm940.S24
-rw-r--r--arch/arm/mm/proc-arm946.S30
-rw-r--r--arch/arm/mm/proc-arm9tdmi.S8
-rw-r--r--arch/arm/mm/proc-fa526.S16
-rw-r--r--arch/arm/mm/proc-feroceon.S44
-rw-r--r--arch/arm/mm/proc-mohawk.S34
-rw-r--r--arch/arm/mm/proc-sa110.S16
-rw-r--r--arch/arm/mm/proc-sa1100.S16
-rw-r--r--arch/arm/mm/proc-v6.S16
-rw-r--r--arch/arm/mm/proc-v7-2level.S4
-rw-r--r--arch/arm/mm/proc-v7-3level.S21
-rw-r--r--arch/arm/mm/proc-v7.S74
-rw-r--r--arch/arm/mm/proc-v7m.S18
-rw-r--r--arch/arm/mm/proc-xsc3.S32
-rw-r--r--arch/arm/mm/proc-xscale.S34
-rw-r--r--arch/arm/mm/tlb-fa.S7
-rw-r--r--arch/arm/mm/tlb-v4.S5
-rw-r--r--arch/arm/mm/tlb-v4wb.S7
-rw-r--r--arch/arm/mm/tlb-v4wbi.S7
-rw-r--r--arch/arm/mm/tlb-v6.S5
-rw-r--r--arch/arm/mm/tlb-v7.S4
-rw-r--r--arch/arm/net/bpf_jit_32.c8
-rw-r--r--arch/arm/nwfpe/entry.S8
-rw-r--r--arch/arm/oprofile/common.c19
-rw-r--r--arch/arm/plat-omap/dma.c7
-rw-r--r--arch/arm/plat-samsung/Kconfig163
-rw-r--r--arch/arm/plat-samsung/Makefile15
-rw-r--r--arch/arm/plat-samsung/adc.c2
-rw-r--r--arch/arm/plat-samsung/clock-clksrc.c212
-rw-r--r--arch/arm/plat-samsung/clock.c539
-rw-r--r--arch/arm/plat-samsung/cpu.c3
-rw-r--r--arch/arm/plat-samsung/devs.c330
-rw-r--r--arch/arm/plat-samsung/include/plat/camport.h28
-rw-r--r--arch/arm/plat-samsung/include/plat/clock-clksrc.h83
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h152
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu-freq-core.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h42
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h59
-rw-r--r--arch/arm/plat-samsung/include/plat/fb-core.h15
-rw-r--r--arch/arm/plat-samsung/include/plat/fb.h36
-rw-r--r--arch/arm/plat-samsung/include/plat/fimc-core.h51
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h64
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/hdmi.h16
-rw-r--r--arch/arm/plat-samsung/include/plat/irqs.h72
-rw-r--r--arch/arm/plat-samsung/include/plat/map-s5p.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/mfc.h35
-rw-r--r--arch/arm/plat-samsung/include/plat/pll.h323
-rw-r--r--arch/arm/plat-samsung/include/plat/s5p-clock.h65
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h124
-rw-r--r--arch/arm/plat-samsung/include/plat/tv-core.h44
-rw-r--r--arch/arm/plat-samsung/init.c1
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c6
-rw-r--r--arch/arm/plat-samsung/s5p-clock.c294
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c81
-rw-r--r--arch/arm/plat-samsung/s5p-dev-uart.c88
-rw-r--r--arch/arm/plat-samsung/s5p-irq-eint.c221
-rw-r--r--arch/arm/plat-samsung/s5p-irq-gpioint.c218
-rw-r--r--arch/arm/plat-samsung/s5p-irq-pm.c92
-rw-r--r--arch/arm/plat-samsung/s5p-irq.c31
-rw-r--r--arch/arm/plat-samsung/s5p-pm.c40
-rw-r--r--arch/arm/plat-versatile/Kconfig3
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/clcd.c182
-rw-r--r--arch/arm/plat-versatile/include/plat/clcd.h9
-rw-r--r--arch/arm/vfp/entry.S4
-rw-r--r--arch/arm/vfp/vfphw.S26
-rw-r--r--arch/arm/xen/enlighten.c6
-rw-r--r--arch/arm/xen/grant-table.c9
-rw-r--r--arch/arm/xen/hypercall.S6
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts4
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi30
-rw-r--r--arch/arm64/include/asm/debug-monitors.h19
-rw-r--r--arch/arm64/include/asm/kvm_arm.h5
-rw-r--r--arch/arm64/include/asm/kvm_asm.h53
-rw-r--r--arch/arm64/include/asm/kvm_coproc.h3
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h22
-rw-r--r--arch/arm64/include/asm/kvm_host.h48
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h15
-rw-r--r--arch/arm64/include/asm/page.h3
-rw-r--r--arch/arm64/include/asm/signal32.h11
-rw-r--r--arch/arm64/include/asm/virt.h4
-rw-r--r--arch/arm64/kernel/asm-offsets.c26
-rw-r--r--arch/arm64/kernel/debug-monitors.c9
-rw-r--r--arch/arm64/kernel/efi.c2
-rw-r--r--arch/arm64/kernel/signal.c58
-rw-r--r--arch/arm64/kernel/signal32.c24
-rw-r--r--arch/arm64/kernel/smp.c65
-rw-r--r--arch/arm64/kernel/vdso.c29
-rw-r--r--arch/arm64/kvm/Makefile4
-rw-r--r--arch/arm64/kvm/guest.c68
-rw-r--r--arch/arm64/kvm/handle_exit.c4
-rw-r--r--arch/arm64/kvm/hyp.S600
-rw-r--r--arch/arm64/kvm/sys_regs.c546
-rw-r--r--arch/arm64/kvm/vgic-v2-switch.S133
-rw-r--r--arch/arm64/kvm/vgic-v3-switch.S267
-rw-r--r--arch/avr32/boards/atngw100/mrmt.c34
-rw-r--r--arch/avr32/boards/favr-32/setup.c48
-rw-r--r--arch/avr32/boards/hammerhead/flash.c11
-rw-r--r--arch/avr32/boards/merisc/setup.c34
-rw-r--r--arch/avr32/configs/atngw100_mrmt_defconfig5
-rw-r--r--arch/avr32/configs/atstk1002_defconfig5
-rw-r--r--arch/avr32/configs/atstk1003_defconfig5
-rw-r--r--arch/avr32/configs/atstk1004_defconfig5
-rw-r--r--arch/avr32/configs/atstk1006_defconfig5
-rw-r--r--arch/avr32/configs/favr-32_defconfig6
-rw-r--r--arch/avr32/configs/merisc_defconfig5
-rw-r--r--arch/avr32/kernel/signal.c50
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c7
-rw-r--r--arch/blackfin/kernel/signal.c51
-rw-r--r--arch/c6x/kernel/signal.c53
-rw-r--r--arch/cris/arch-v10/kernel/signal.c89
-rw-r--r--arch/cris/arch-v32/kernel/signal.c89
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/scatterlist.h6
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/asm/scatterlist.h6
-rw-r--r--arch/frv/kernel/signal.c112
-rw-r--r--arch/hexagon/Kconfig1
-rw-r--r--arch/hexagon/include/asm/cache.h2
-rw-r--r--arch/hexagon/kernel/signal.c57
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/Makefile2
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/acenv.h4
-rw-r--r--arch/ia64/include/asm/acpi.h5
-rw-r--r--arch/ia64/include/asm/page.h2
-rw-r--r--arch/ia64/include/asm/scatterlist.h7
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/signal.c46
-rw-r--r--arch/ia64/kernel/time.c19
-rw-r--r--arch/ia64/kvm/Kconfig1
-rw-r--r--arch/ia64/kvm/kvm-ia64.c2
-rw-r--r--arch/ia64/mm/init.c34
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/scatterlist.h6
-rw-r--r--arch/m32r/kernel/signal.c57
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/configs/amiga_defconfig1
-rw-r--r--arch/m68k/configs/apollo_defconfig1
-rw-r--r--arch/m68k/configs/atari_defconfig1
-rw-r--r--arch/m68k/configs/bvme6000_defconfig1
-rw-r--r--arch/m68k/configs/hp300_defconfig1
-rw-r--r--arch/m68k/configs/mac_defconfig1
-rw-r--r--arch/m68k/configs/multi_defconfig1
-rw-r--r--arch/m68k/configs/mvme147_defconfig1
-rw-r--r--arch/m68k/configs/mvme16x_defconfig1
-rw-r--r--arch/m68k/configs/q40_defconfig1
-rw-r--r--arch/m68k/configs/sun3_defconfig1
-rw-r--r--arch/m68k/configs/sun3x_defconfig1
-rw-r--r--arch/m68k/include/asm/pgtable_no.h5
-rw-r--r--arch/m68k/include/asm/virtconvert.h6
-rw-r--r--arch/m68k/kernel/signal.c75
-rw-r--r--arch/metag/kernel/cachepart.c4
-rw-r--r--arch/metag/kernel/signal.c10
-rw-r--r--arch/metag/mm/hugetlbpage.c2
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/delay.h28
-rw-r--r--arch/microblaze/include/asm/scatterlist.h1
-rw-r--r--arch/microblaze/include/uapi/asm/unistd.h1
-rw-r--r--arch/microblaze/kernel/signal.c55
-rw-r--r--arch/microblaze/kernel/syscall_table.S3
-rw-r--r--arch/microblaze/lib/Makefile14
-rw-r--r--arch/mips/Kconfig11
-rw-r--r--arch/mips/Makefile4
-rw-r--r--arch/mips/alchemy/board-mtx1.c4
-rw-r--r--arch/mips/alchemy/board-xxs1500.c4
-rw-r--r--arch/mips/alchemy/common/Makefile4
-rw-r--r--arch/mips/alchemy/common/clock.c1094
-rw-r--r--arch/mips/alchemy/common/clocks.c105
-rw-r--r--arch/mips/alchemy/common/dbdma.c22
-rw-r--r--arch/mips/alchemy/common/dma.c15
-rw-r--r--arch/mips/alchemy/common/irq.c5
-rw-r--r--arch/mips/alchemy/common/platform.c15
-rw-r--r--arch/mips/alchemy/common/power.c74
-rw-r--r--arch/mips/alchemy/common/setup.c15
-rw-r--r--arch/mips/alchemy/common/time.c23
-rw-r--r--arch/mips/alchemy/common/usb.c47
-rw-r--r--arch/mips/alchemy/devboards/db1000.c19
-rw-r--r--arch/mips/alchemy/devboards/db1200.c61
-rw-r--r--arch/mips/alchemy/devboards/db1300.c9
-rw-r--r--arch/mips/alchemy/devboards/db1550.c27
-rw-r--r--arch/mips/alchemy/devboards/pm.c39
-rw-r--r--arch/mips/bcm47xx/Kconfig5
-rw-r--r--arch/mips/bcm47xx/bcm47xx_private.h3
-rw-r--r--arch/mips/bcm47xx/board.c26
-rw-r--r--arch/mips/bcm47xx/buttons.c38
-rw-r--r--arch/mips/bcm47xx/leds.c92
-rw-r--r--arch/mips/bcm47xx/prom.c68
-rw-r--r--arch/mips/bcm47xx/setup.c7
-rw-r--r--arch/mips/bcm47xx/sprom.c48
-rw-r--r--arch/mips/bcm63xx/cpu.c11
-rw-r--r--arch/mips/bcm63xx/dev-enet.c4
-rw-r--r--arch/mips/bcm63xx/dev-spi.c4
-rw-r--r--arch/mips/bcm63xx/gpio.c14
-rw-r--r--arch/mips/bcm63xx/irq.c558
-rw-r--r--arch/mips/bcm63xx/reset.c60
-rw-r--r--arch/mips/boot/compressed/decompress.c14
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c22
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c12
-rw-r--r--arch/mips/cavium-octeon/oct_ilm.c3
-rw-r--r--arch/mips/cavium-octeon/smp.c23
-rw-r--r--arch/mips/configs/cavium_octeon_defconfig1
-rw-r--r--arch/mips/configs/db1xxx_defconfig1
-rw-r--r--arch/mips/configs/decstation_defconfig1
-rw-r--r--arch/mips/configs/ip22_defconfig1
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/ip32_defconfig1
-rw-r--r--arch/mips/configs/jazz_defconfig1
-rw-r--r--arch/mips/configs/loongson3_defconfig3
-rw-r--r--arch/mips/configs/malta_defconfig1
-rw-r--r--arch/mips/configs/malta_kvm_defconfig1
-rw-r--r--arch/mips/configs/malta_kvm_guest_defconfig1
-rw-r--r--arch/mips/configs/markeins_defconfig1
-rw-r--r--arch/mips/configs/nlm_xlp_defconfig3
-rw-r--r--arch/mips/configs/nlm_xlr_defconfig3
-rw-r--r--arch/mips/configs/rm200_defconfig1
-rw-r--r--arch/mips/configs/tb0226_defconfig1
-rw-r--r--arch/mips/configs/tb0287_defconfig1
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/abi.h10
-rw-r--r--arch/mips/include/asm/addrspace.h2
-rw-r--r--arch/mips/include/asm/asmmacro.h31
-rw-r--r--arch/mips/include/asm/bitops.h8
-rw-r--r--arch/mips/include/asm/cop2.h8
-rw-r--r--arch/mips/include/asm/cpu-features.h9
-rw-r--r--arch/mips/include/asm/cpu-info.h5
-rw-r--r--arch/mips/include/asm/cpu.h61
-rw-r--r--arch/mips/include/asm/elf.h17
-rw-r--r--arch/mips/include/asm/fpu.h19
-rw-r--r--arch/mips/include/asm/gic.h41
-rw-r--r--arch/mips/include/asm/maar.h109
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000.h1529
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000_dma.h50
-rw-r--r--arch/mips/include/asm/mach-au1x00/gpio-au1000.h56
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h7
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h198
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h46
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h31
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h16
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/mach-loongson/boot_param.h4
-rw-r--r--arch/mips/include/asm/mach-loongson/kernel-entry-init.h52
-rw-r--r--arch/mips/include/asm/mach-loongson/loongson.h11
-rw-r--r--arch/mips/include/asm/mach-loongson/machine.h4
-rw-r--r--arch/mips/include/asm/mach-loongson/mmzone.h53
-rw-r--r--arch/mips/include/asm/mach-loongson/topology.h23
-rw-r--r--arch/mips/include/asm/mach-malta/irq.h1
-rw-r--r--arch/mips/include/asm/mach-sead3/irq.h1
-rw-r--r--arch/mips/include/asm/mips-boards/bonito64.h1
-rw-r--r--arch/mips/include/asm/mipsregs.h58
-rw-r--r--arch/mips/include/asm/mmu_context.h10
-rw-r--r--arch/mips/include/asm/msa.h31
-rw-r--r--arch/mips/include/asm/octeon/cvmx-bootinfo.h2
-rw-r--r--arch/mips/include/asm/pgtable-32.h12
-rw-r--r--arch/mips/include/asm/pgtable.h27
-rw-r--r--arch/mips/include/asm/processor.h10
-rw-r--r--arch/mips/include/asm/ptrace.h8
-rw-r--r--arch/mips/include/asm/reg.h129
-rw-r--r--arch/mips/include/asm/smp-cps.h12
-rw-r--r--arch/mips/include/asm/smp.h6
-rw-r--r--arch/mips/include/asm/sparsemem.h2
-rw-r--r--arch/mips/include/asm/user.h58
-rw-r--r--arch/mips/include/uapi/asm/ptrace.h25
-rw-r--r--arch/mips/include/uapi/asm/reg.h206
-rw-r--r--arch/mips/include/uapi/asm/unistd.h15
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c1
-rw-r--r--arch/mips/jz4740/clock-debugfs.c3
-rw-r--r--arch/mips/jz4740/platform.c2
-rw-r--r--arch/mips/kernel/asm-offsets.c1
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c38
-rw-r--r--arch/mips/kernel/cpu-probe.c45
-rw-r--r--arch/mips/kernel/ftrace.c56
-rw-r--r--arch/mips/kernel/irq-gic.c38
-rw-r--r--arch/mips/kernel/mcount.S13
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c42
-rw-r--r--arch/mips/kernel/pm-cps.c10
-rw-r--r--arch/mips/kernel/proc.c2
-rw-r--r--arch/mips/kernel/process.c60
-rw-r--r--arch/mips/kernel/ptrace.c223
-rw-r--r--arch/mips/kernel/ptrace32.c10
-rw-r--r--arch/mips/kernel/r4k_switch.S9
-rw-r--r--arch/mips/kernel/rtlx-cmp.c3
-rw-r--r--arch/mips/kernel/rtlx-mt.c3
-rw-r--r--arch/mips/kernel/scall32-o32.S7
-rw-r--r--arch/mips/kernel/scall64-64.S5
-rw-r--r--arch/mips/kernel/scall64-n32.S13
-rw-r--r--arch/mips/kernel/scall64-o32.S9
-rw-r--r--arch/mips/kernel/setup.c22
-rw-r--r--arch/mips/kernel/signal-common.h2
-rw-r--r--arch/mips/kernel/signal.c72
-rw-r--r--arch/mips/kernel/signal32.c39
-rw-r--r--arch/mips/kernel/signal_n32.c20
-rw-r--r--arch/mips/kernel/smp-cps.c12
-rw-r--r--arch/mips/kernel/smp-mt.c2
-rw-r--r--arch/mips/kernel/smp.c26
-rw-r--r--arch/mips/kernel/traps.c61
-rw-r--r--arch/mips/kernel/unaligned.c1
-rw-r--r--arch/mips/kvm/mips.c2
-rw-r--r--arch/mips/loongson/Kconfig9
-rw-r--r--arch/mips/loongson/Platform2
-rw-r--r--arch/mips/loongson/common/env.c49
-rw-r--r--arch/mips/loongson/common/init.c4
-rw-r--r--arch/mips/loongson/common/pm.c8
-rw-r--r--arch/mips/loongson/lemote-2f/clock.c4
-rw-r--r--arch/mips/loongson/lemote-2f/reset.c2
-rw-r--r--arch/mips/loongson/loongson-3/Makefile4
-rw-r--r--arch/mips/loongson/loongson-3/cop2-ex.c63
-rw-r--r--arch/mips/loongson/loongson-3/irq.c26
-rw-r--r--arch/mips/loongson/loongson-3/numa.c291
-rw-r--r--arch/mips/loongson/loongson-3/smp.c387
-rw-r--r--arch/mips/loongson/loongson-3/smp.h37
-rw-r--r--arch/mips/math-emu/cp1emu.c2
-rw-r--r--arch/mips/mm/c-r4k.c8
-rw-r--r--arch/mips/mm/init.c33
-rw-r--r--arch/mips/mm/tlb-r3k.c2
-rw-r--r--arch/mips/mm/tlb-r4k.c59
-rw-r--r--arch/mips/mm/tlbex.c98
-rw-r--r--arch/mips/mti-malta/malta-int.c27
-rw-r--r--arch/mips/mti-malta/malta-memory.c26
-rw-r--r--arch/mips/net/bpf_jit.c8
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/ops-tx4927.c2
-rw-r--r--arch/mips/pci/pci-alchemy.c24
-rw-r--r--arch/mips/ralink/of.c2
-rw-r--r--arch/mips/rb532/devices.c28
-rw-r--r--arch/mips/sgi-ip22/ip22-gio.c10
-rw-r--r--arch/mips/txx9/generic/7segled.c14
-rw-r--r--arch/mips/txx9/generic/pci.c4
-rw-r--r--arch/mips/txx9/generic/setup.c29
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/asm/scatterlist.h16
-rw-r--r--arch/mn10300/kernel/signal.c102
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/include/asm/irq.h3
-rw-r--r--arch/openrisc/kernel/irq.c146
-rw-r--r--arch/openrisc/kernel/signal.c20
-rw-r--r--arch/parisc/configs/generic-64bit_defconfig1
-rw-r--r--arch/parisc/kernel/signal.c58
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/Kconfig.debug4
-rw-r--r--arch/powerpc/boot/dts/fsl/p2041si-post.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/t2080si-post.dtsi69
-rw-r--r--arch/powerpc/boot/dts/fsl/t2081si-post.dtsi435
-rw-r--r--arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi99
-rw-r--r--arch/powerpc/boot/dts/fsl/t4240si-post.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi1
-rw-r--r--arch/powerpc/boot/dts/mpc5121.dtsi1
-rw-r--r--arch/powerpc/boot/dts/t2080qds.dts57
-rw-r--r--arch/powerpc/boot/dts/t2080rdb.dts57
-rw-r--r--arch/powerpc/boot/dts/t2081qds.dts46
-rw-r--r--arch/powerpc/boot/dts/t208xqds.dtsi239
-rw-r--r--arch/powerpc/boot/dts/t208xrdb.dtsi184
-rw-r--r--arch/powerpc/boot/dts/t4240rdb.dts186
-rw-r--r--arch/powerpc/boot/gunzip_util.c4
-rw-r--r--arch/powerpc/boot/io.h2
-rw-r--r--arch/powerpc/configs/52xx/motionpro_defconfig1
-rw-r--r--arch/powerpc/configs/85xx/kmp204x_defconfig1
-rw-r--r--arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig1
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig4
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig5
-rw-r--r--arch/powerpc/configs/mpc5200_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig3
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig3
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig1
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig2
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/asm-compat.h4
-rw-r--r--arch/powerpc/include/asm/cache.h7
-rw-r--r--arch/powerpc/include/asm/cputable.h33
-rw-r--r--arch/powerpc/include/asm/eeh.h62
-rw-r--r--arch/powerpc/include/asm/exception-64s.h14
-rw-r--r--arch/powerpc/include/asm/fs_pd.h1
-rw-r--r--arch/powerpc/include/asm/hardirq.h1
-rw-r--r--arch/powerpc/include/asm/hvcall.h6
-rw-r--r--arch/powerpc/include/asm/hw_irq.h1
-rw-r--r--arch/powerpc/include/asm/irqflags.h8
-rw-r--r--arch/powerpc/include/asm/jump_label.h9
-rw-r--r--arch/powerpc/include/asm/kvm_44x.h67
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h3
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h51
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h29
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h15
-rw-r--r--arch/powerpc/include/asm/kvm_host.h28
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h116
-rw-r--r--arch/powerpc/include/asm/machdep.h11
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h8
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h22
-rw-r--r--arch/powerpc/include/asm/mmu.h8
-rw-r--r--arch/powerpc/include/asm/mmu_context.h6
-rw-r--r--arch/powerpc/include/asm/mpc85xx.h2
-rw-r--r--arch/powerpc/include/asm/mpc8xx.h12
-rw-r--r--arch/powerpc/include/asm/opal.h205
-rw-r--r--arch/powerpc/include/asm/oprofile_impl.h1
-rw-r--r--arch/powerpc/include/asm/paca.h5
-rw-r--r--arch/powerpc/include/asm/page.h3
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h5
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h2
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h26
-rw-r--r--arch/powerpc/include/asm/pte-fsl-booke.h2
-rw-r--r--arch/powerpc/include/asm/pte-hash64-64k.h35
-rw-r--r--arch/powerpc/include/asm/reg.h18
-rw-r--r--arch/powerpc/include/asm/reg_booke.h57
-rw-r--r--arch/powerpc/include/asm/scatterlist.h17
-rw-r--r--arch/powerpc/include/asm/spinlock.h1
-rw-r--r--arch/powerpc/include/asm/systbl.h4
-rw-r--r--arch/powerpc/include/asm/time.h9
-rw-r--r--arch/powerpc/include/asm/trace.h45
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c4
-rw-r--r--arch/powerpc/kernel/cputable.c94
-rw-r--r--arch/powerpc/kernel/eeh.c366
-rw-r--r--arch/powerpc/kernel/eeh_cache.c9
-rw-r--r--arch/powerpc/kernel/eeh_dev.c3
-rw-r--r--arch/powerpc/kernel/eeh_driver.c16
-rw-r--r--arch/powerpc/kernel/eeh_pe.c86
-rw-r--r--arch/powerpc/kernel/entry_64.S13
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S359
-rw-r--r--arch/powerpc/kernel/head_44x.S4
-rw-r--r--arch/powerpc/kernel/head_64.S30
-rw-r--r--arch/powerpc/kernel/idle_power7.S69
-rw-r--r--arch/powerpc/kernel/iommu.c42
-rw-r--r--arch/powerpc/kernel/irq.c14
-rw-r--r--arch/powerpc/kernel/process.c34
-rw-r--r--arch/powerpc/kernel/prom.c81
-rw-r--r--arch/powerpc/kernel/setup-common.c6
-rw-r--r--arch/powerpc/kernel/setup_64.c21
-rw-r--r--arch/powerpc/kernel/signal.c41
-rw-r--r--arch/powerpc/kernel/signal.h14
-rw-r--r--arch/powerpc/kernel/signal_32.c36
-rw-r--r--arch/powerpc/kernel/signal_64.c28
-rw-r--r--arch/powerpc/kernel/smp.c11
-rw-r--r--arch/powerpc/kernel/systbl.S3
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/traps.c26
-rw-r--r--arch/powerpc/kernel/vdso.c16
-rw-r--r--arch/powerpc/kernel/vio.c2
-rw-r--r--arch/powerpc/kvm/44x.c237
-rw-r--r--arch/powerpc/kvm/44x_emulate.c194
-rw-r--r--arch/powerpc/kvm/44x_tlb.c528
-rw-r--r--arch/powerpc/kvm/44x_tlb.h86
-rw-r--r--arch/powerpc/kvm/Kconfig20
-rw-r--r--arch/powerpc/kvm/Makefile19
-rw-r--r--arch/powerpc/kvm/book3s.c156
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu.c2
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c7
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c5
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c149
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c28
-rw-r--r--arch/powerpc/kvm/book3s_hv.c271
-rw-r--r--arch/powerpc/kvm/book3s_hv_builtin.c32
-rw-r--r--arch/powerpc/kvm/book3s_hv_cma.c240
-rw-r--r--arch/powerpc/kvm/book3s_hv_cma.h27
-rw-r--r--arch/powerpc/kvm/book3s_hv_ras.c6
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c146
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_xics.c5
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S76
-rw-r--r--arch/powerpc/kvm/book3s_paired_singles.c38
-rw-r--r--arch/powerpc/kvm/book3s_pr.c223
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c92
-rw-r--r--arch/powerpc/kvm/book3s_xics.c55
-rw-r--r--arch/powerpc/kvm/book3s_xics.h2
-rw-r--r--arch/powerpc/kvm/booke.c225
-rw-r--r--arch/powerpc/kvm/booke.h7
-rw-r--r--arch/powerpc/kvm/booke_emulate.c8
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S5
-rw-r--r--arch/powerpc/kvm/bookehv_interrupts.S60
-rw-r--r--arch/powerpc/kvm/e500_emulate.c12
-rw-r--r--arch/powerpc/kvm/e500_mmu_host.c102
-rw-r--r--arch/powerpc/kvm/e500mc.c28
-rw-r--r--arch/powerpc/kvm/emulate.c206
-rw-r--r--arch/powerpc/kvm/emulate_loadstore.c272
-rw-r--r--arch/powerpc/kvm/mpic.c4
-rw-r--r--arch/powerpc/kvm/powerpc.c181
-rw-r--r--arch/powerpc/kvm/timing.c1
-rw-r--r--arch/powerpc/kvm/timing.h3
-rw-r--r--arch/powerpc/lib/copyuser_64.S3
-rw-r--r--arch/powerpc/lib/locks.c4
-rw-r--r--arch/powerpc/mm/Makefile4
-rw-r--r--arch/powerpc/mm/dma-noncoherent.c1
-rw-r--r--arch/powerpc/mm/hash_native_64.c40
-rw-r--r--arch/powerpc/mm/hash_utils_64.c26
-rw-r--r--arch/powerpc/mm/hugepage-hash64.c88
-rw-r--r--arch/powerpc/mm/init_64.c132
-rw-r--r--arch/powerpc/mm/mem.c3
-rw-r--r--arch/powerpc/mm/mmu_context_hash32.c2
-rw-r--r--arch/powerpc/mm/numa.c15
-rw-r--r--arch/powerpc/mm/pgtable_32.c2
-rw-r--r--arch/powerpc/mm/pgtable_64.c46
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c2
-rw-r--r--arch/powerpc/mm/stab.c286
-rw-r--r--arch/powerpc/mm/tlb_hash64.c6
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S69
-rw-r--r--arch/powerpc/mm/tlb_nohash.c111
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c8
-rw-r--r--arch/powerpc/oprofile/Makefile2
-rw-r--r--arch/powerpc/oprofile/common.c3
-rw-r--r--arch/powerpc/oprofile/op_model_rs64.c222
-rw-r--r--arch/powerpc/perf/core-book3s.c73
-rw-r--r--arch/powerpc/perf/hv-24x7.c2
-rw-r--r--arch/powerpc/perf/mpc7450-pmu.c5
-rw-r--r--arch/powerpc/perf/power4-pmu.c2
-rw-r--r--arch/powerpc/perf/power5+-pmu.c2
-rw-r--r--arch/powerpc/perf/power5-pmu.c2
-rw-r--r--arch/powerpc/perf/power6-pmu.c2
-rw-r--r--arch/powerpc/perf/power7-pmu.c2
-rw-r--r--arch/powerpc/perf/power8-pmu.c27
-rw-r--r--arch/powerpc/perf/ppc970-pmu.c2
-rw-r--r--arch/powerpc/platforms/44x/warp.c1
-rw-r--r--arch/powerpc/platforms/52xx/efika.c1
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/85xx/corenet_generic.c53
-rw-r--r--arch/powerpc/platforms/85xx/smp.c44
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c3
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c62
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c1
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype18
-rw-r--r--arch/powerpc/platforms/amigaone/setup.c1
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c11
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c4
-rw-r--r--arch/powerpc/platforms/powermac/Kconfig2
-rw-r--r--arch/powerpc/platforms/powermac/feature.c62
-rw-r--r--arch/powerpc/platforms/powermac/pci.c2
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/powermac/udbg_adb.c2
-rw-r--r--arch/powerpc/platforms/powernv/Makefile3
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c393
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c55
-rw-r--r--arch/powerpc/platforms/powernv/opal-async.c3
-rw-r--r--arch/powerpc/platforms/powernv/opal-dump.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-elog.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-hmi.c188
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-memory-errors.c3
-rw-r--r--arch/powerpc/platforms/powernv/opal-tracepoints.c84
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S119
-rw-r--r--arch/powerpc/platforms/powernv/opal-xscom.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal.c75
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c501
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c3
-rw-r--r--arch/powerpc/platforms/powernv/pci.c169
-rw-r--r--arch/powerpc/platforms/powernv/pci.h25
-rw-r--r--arch/powerpc/platforms/powernv/rng.c2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c4
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c3
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c40
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c4
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S172
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c3
-rw-r--r--arch/powerpc/platforms/pseries/hvcserver.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c20
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c50
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c5
-rw-r--r--arch/powerpc/platforms/pseries/msi.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c4
-rw-r--r--arch/powerpc/platforms/pseries/power.c5
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c5
-rw-r--r--arch/powerpc/platforms/pseries/rng.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c5
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c4
-rw-r--r--arch/powerpc/sysdev/micropatch.c1
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c2
-rw-r--r--arch/powerpc/xmon/xmon.c37
-rw-r--r--arch/s390/Kconfig5
-rw-r--r--arch/s390/configs/default_defconfig2
-rw-r--r--arch/s390/configs/gcov_defconfig2
-rw-r--r--arch/s390/configs/performance_defconfig2
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/page.h2
-rw-r--r--arch/s390/include/asm/pgtable.h197
-rw-r--r--arch/s390/include/asm/qdio.h4
-rw-r--r--arch/s390/include/asm/scatterlist.h3
-rw-r--r--arch/s390/include/asm/syscall.h2
-rw-r--r--arch/s390/kernel/compat_signal.c79
-rw-r--r--arch/s390/kernel/entry.h4
-rw-r--r--arch/s390/kernel/irq.c95
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/kernel/signal.c78
-rw-r--r--arch/s390/kernel/time.c16
-rw-r--r--arch/s390/kernel/vdso.c15
-rw-r--r--arch/s390/kvm/Kconfig1
-rw-r--r--arch/s390/kvm/interrupt.c3
-rw-r--r--arch/s390/kvm/kvm-s390.c2
-rw-r--r--arch/s390/mm/hugetlbpage.c103
-rw-r--r--arch/s390/mm/pgtable.c8
-rw-r--r--arch/s390/net/bpf_jit_comp.c4
-rw-r--r--arch/s390/pci/pci.c4
-rw-r--r--arch/s390/pci/pci_clp.c4
-rw-r--r--arch/s390/pci/pci_debug.c4
-rw-r--r--arch/s390/pci/pci_dma.c50
-rw-r--r--arch/s390/pci/pci_event.c4
-rw-r--r--arch/s390/pci/pci_sysfs.c4
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/scatterlist.h6
-rw-r--r--arch/score/include/uapi/asm/ptrace.h11
-rw-r--r--arch/score/kernel/signal.c43
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/boards/Kconfig2
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c2
-rw-r--r--arch/sh/configs/sh2007_defconfig1
-rw-r--r--arch/sh/drivers/dma/Kconfig5
-rw-r--r--arch/sh/drivers/dma/dma-sh.c2
-rw-r--r--arch/sh/include/asm/dma-register.h36
-rw-r--r--arch/sh/include/asm/io_noioport.h11
-rw-r--r--arch/sh/include/asm/page.h5
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma-register.h1
-rw-r--r--arch/sh/include/cpu-sh4a/cpu/dma.h3
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c4
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c24
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c48
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c64
-rw-r--r--arch/sh/kernel/signal_32.c79
-rw-r--r--arch/sh/kernel/signal_64.c82
-rw-r--r--arch/sh/kernel/time.c4
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c15
-rw-r--r--arch/sh/mm/asids-debugfs.c4
-rw-r--r--arch/sh/mm/init.c5
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/Makefile3
-rw-r--r--arch/sparc/boot/Makefile4
-rw-r--r--arch/sparc/boot/install.sh50
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/io_64.h381
-rw-r--r--arch/sparc/include/asm/scatterlist.h8
-rw-r--r--arch/sparc/include/asm/tlbflush_64.h12
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h5
-rw-r--r--arch/sparc/kernel/ldc.c2
-rw-r--r--arch/sparc/kernel/mdesc.c82
-rw-r--r--arch/sparc/kernel/nmi.c1
-rw-r--r--arch/sparc/kernel/pci.c67
-rw-r--r--arch/sparc/kernel/perf_event.c7
-rw-r--r--arch/sparc/kernel/process_64.c3
-rw-r--r--arch/sparc/kernel/smp_32.c2
-rw-r--r--arch/sparc/kernel/smp_64.c1
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/unaligned_32.c2
-rw-r--r--arch/sparc/lib/PeeCeeI.c36
-rw-r--r--arch/sparc/math-emu/math_32.c2
-rw-r--r--arch/sparc/mm/init_64.c96
-rw-r--r--arch/sparc/net/bpf_jit_comp.c4
-rw-r--r--arch/tile/Kconfig2
-rw-r--r--arch/tile/configs/tilegx_defconfig1
-rw-r--r--arch/tile/configs/tilepro_defconfig1
-rw-r--r--arch/tile/include/asm/compat.h3
-rw-r--r--arch/tile/include/asm/hardwall.h2
-rw-r--r--arch/tile/include/asm/page.h6
-rw-r--r--arch/tile/kernel/compat_signal.c29
-rw-r--r--arch/tile/kernel/hardwall.c6
-rw-r--r--arch/tile/kernel/module.c2
-rw-r--r--arch/tile/kernel/signal.c54
-rw-r--r--arch/tile/kernel/time.c13
-rw-r--r--arch/tile/kernel/vdso.c15
-rw-r--r--arch/tile/kernel/vdso/vgettimeofday.c7
-rw-r--r--arch/um/include/asm/Kbuild1
-rw-r--r--arch/um/include/asm/page.h5
-rw-r--r--arch/um/include/shared/frame_kern.h12
-rw-r--r--arch/um/kernel/signal.c27
-rw-r--r--arch/unicore32/kernel/puv3-core.c2
-rw-r--r--arch/unicore32/kernel/puv3-nb0916.c6
-rw-r--r--arch/unicore32/kernel/signal.c48
-rw-r--r--arch/x86/Kbuild4
-rw-r--r--arch/x86/Kconfig35
-rw-r--r--arch/x86/Makefile8
-rw-r--r--arch/x86/include/asm/Kbuild3
-rw-r--r--arch/x86/include/asm/acenv.h4
-rw-r--r--arch/x86/include/asm/acpi.h5
-rw-r--r--arch/x86/include/asm/alternative.h14
-rw-r--r--arch/x86/include/asm/apic.h46
-rw-r--r--arch/x86/include/asm/crash.h9
-rw-r--r--arch/x86/include/asm/fpu-internal.h9
-rw-r--r--arch/x86/include/asm/hardirq.h3
-rw-r--r--arch/x86/include/asm/i8259.h5
-rw-r--r--arch/x86/include/asm/io_apic.h56
-rw-r--r--arch/x86/include/asm/kexec-bzimage64.h6
-rw-r--r--arch/x86/include/asm/kexec.h45
-rw-r--r--arch/x86/include/asm/mpspec.h15
-rw-r--r--arch/x86/include/asm/page.h1
-rw-r--r--arch/x86/include/asm/page_64.h2
-rw-r--r--arch/x86/include/asm/platform_sst_audio.h78
-rw-r--r--arch/x86/include/asm/processor.h4
-rw-r--r--arch/x86/include/asm/prom.h2
-rw-r--r--arch/x86/include/asm/scatterlist.h8
-rw-r--r--arch/x86/include/asm/smpboot_hooks.h10
-rw-r--r--arch/x86/include/asm/xsave.h223
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h3
-rw-r--r--arch/x86/kernel/Makefile1
-rw-r--r--arch/x86/kernel/acpi/boot.c400
-rw-r--r--arch/x86/kernel/apic/apic.c75
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c16
-rw-r--r--arch/x86/kernel/apic/apic_noop.c23
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c8
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c14
-rw-r--r--arch/x86/kernel/apic/io_apic.c759
-rw-r--r--arch/x86/kernel/apic/probe_32.c33
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c8
-rw-r--r--arch/x86/kernel/apic/x2apic_phys.c8
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c8
-rw-r--r--arch/x86/kernel/cpu/common.c8
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c6
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c18
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c10
-rw-r--r--arch/x86/kernel/crash.c563
-rw-r--r--arch/x86/kernel/devicetree.c207
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/iosf_mbi.c2
-rw-r--r--arch/x86/kernel/irqinit.c12
-rw-r--r--arch/x86/kernel/kexec-bzimage64.c553
-rw-r--r--arch/x86/kernel/machine_kexec_64.c239
-rw-r--r--arch/x86/kernel/mpparse.c111
-rw-r--r--arch/x86/kernel/process.c1
-rw-r--r--arch/x86/kernel/smpboot.c8
-rw-r--r--arch/x86/kernel/tsc.c21
-rw-r--r--arch/x86/kernel/vsmp_64.c4
-rw-r--r--arch/x86/kernel/vsyscall_gtod.c23
-rw-r--r--arch/x86/kernel/xsave.c118
-rw-r--r--arch/x86/kvm/Kconfig1
-rw-r--r--arch/x86/kvm/irq.c2
-rw-r--r--arch/x86/kvm/lapic.c52
-rw-r--r--arch/x86/kvm/mmu_audit.c2
-rw-r--r--arch/x86/kvm/vmx.c4
-rw-r--r--arch/x86/kvm/x86.c64
-rw-r--r--arch/x86/mm/fault.c3
-rw-r--r--arch/x86/mm/init_32.c3
-rw-r--r--arch/x86/mm/init_64.c3
-rw-r--r--arch/x86/net/bpf_jit_comp.c16
-rw-r--r--arch/x86/pci/acpi.c6
-rw-r--r--arch/x86/pci/intel_mid_pci.c27
-rw-r--r--arch/x86/pci/irq.c16
-rw-r--r--arch/x86/pci/xen.c7
-rw-r--r--arch/x86/platform/ce4100/ce4100.c11
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_wdt.c22
-rw-r--r--arch/x86/platform/intel-mid/sfi.c56
-rw-r--r--arch/x86/platform/sfi/sfi.c10
-rw-r--r--arch/x86/platform/uv/tlb_uv.c2
-rw-r--r--arch/x86/purgatory/Makefile30
-rw-r--r--arch/x86/purgatory/entry64.S101
-rw-r--r--arch/x86/purgatory/purgatory.c72
-rw-r--r--arch/x86/purgatory/setup-x86_64.S58
-rw-r--r--arch/x86/purgatory/sha256.c283
-rw-r--r--arch/x86/purgatory/sha256.h22
-rw-r--r--arch/x86/purgatory/stack.S19
-rw-r--r--arch/x86/purgatory/string.c13
-rw-r--r--arch/x86/syscalls/syscall_32.tbl3
-rw-r--r--arch/x86/syscalls/syscall_64.tbl4
-rw-r--r--arch/x86/um/asm/elf.h1
-rw-r--r--arch/x86/um/mem_64.c15
-rw-r--r--arch/x86/um/signal.c45
-rw-r--r--arch/x86/vdso/vdso32-setup.c19
-rw-r--r--arch/x86/xen/enlighten.c13
-rw-r--r--arch/x86/xen/grant-table.c70
-rw-r--r--arch/x86/xen/p2m.c5
-rw-r--r--arch/x86/xen/time.c2
-rw-r--r--arch/xtensa/kernel/signal.c43
1776 files changed, 52196 insertions, 53597 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 97ff872c7acc..0eae9df35b88 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -321,6 +321,7 @@ config HAVE_ARCH_SECCOMP_FILTER
321 - secure_computing is called from a ptrace_event()-safe context 321 - secure_computing is called from a ptrace_event()-safe context
322 - secure_computing return value is checked and a return value of -1 322 - secure_computing return value is checked and a return value of -1
323 results in the system call being skipped immediately. 323 results in the system call being skipped immediately.
324 - seccomp syscall wired up
324 325
325config SECCOMP_FILTER 326config SECCOMP_FILTER
326 def_bool y 327 def_bool y
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 96e54bed5088..e858aa0ad8af 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -6,4 +6,5 @@ generic-y += exec.h
6generic-y += hash.h 6generic-y += hash.h
7generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
8generic-y += preempt.h 8generic-y += preempt.h
9generic-y += scatterlist.h
9generic-y += trace_clock.h 10generic-y += trace_clock.h
diff --git a/arch/alpha/include/asm/scatterlist.h b/arch/alpha/include/asm/scatterlist.h
deleted file mode 100644
index 017d7471c3c4..000000000000
--- a/arch/alpha/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ALPHA_SCATTERLIST_H
2#define _ALPHA_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* !(_ALPHA_SCATTERLIST_H) */
diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts
index 5bb2fdaca02f..6b57475967a6 100644
--- a/arch/arc/boot/dts/angel4.dts
+++ b/arch/arc/boot/dts/angel4.dts
@@ -17,7 +17,7 @@
17 interrupt-parent = <&intc>; 17 interrupt-parent = <&intc>;
18 18
19 chosen { 19 chosen {
20 bootargs = "console=ttyARC0,115200n8 earlyprintk=ttyARC0"; 20 bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8";
21 }; 21 };
22 22
23 aliases { 23 aliases {
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 355cb470c2a4..372466b371bf 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -296,7 +296,7 @@ struct cpuinfo_arc_mmu {
296}; 296};
297 297
298struct cpuinfo_arc_cache { 298struct cpuinfo_arc_cache {
299 unsigned int sz, line_len, assoc, ver; 299 unsigned int sz_k:8, line_len:8, assoc:4, ver:4, alias:1, vipt:1, pad:6;
300}; 300};
301 301
302struct cpuinfo_arc_ccm { 302struct cpuinfo_arc_ccm {
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h
index fb4efb648971..f38652fb2ed7 100644
--- a/arch/arc/include/asm/irq.h
+++ b/arch/arc/include/asm/irq.h
@@ -16,9 +16,13 @@
16#define TIMER0_IRQ 3 16#define TIMER0_IRQ 3
17#define TIMER1_IRQ 4 17#define TIMER1_IRQ 4
18 18
19#include <linux/interrupt.h>
19#include <asm-generic/irq.h> 20#include <asm-generic/irq.h>
20 21
21extern void arc_init_IRQ(void); 22extern void arc_init_IRQ(void);
22void arc_local_timer_setup(void); 23void arc_local_timer_setup(void);
24void arc_request_percpu_irq(int irq, int cpu,
25 irqreturn_t (*isr)(int irq, void *dev),
26 const char *irq_nm, void *percpu_dev);
23 27
24#endif 28#endif
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h
index cb7efc29f16f..587df8236e8b 100644
--- a/arch/arc/include/asm/irqflags.h
+++ b/arch/arc/include/asm/irqflags.h
@@ -131,24 +131,6 @@ static inline int arch_irqs_disabled(void)
131 return arch_irqs_disabled_flags(arch_local_save_flags()); 131 return arch_irqs_disabled_flags(arch_local_save_flags());
132} 132}
133 133
134static inline void arch_mask_irq(unsigned int irq)
135{
136 unsigned int ienb;
137
138 ienb = read_aux_reg(AUX_IENABLE);
139 ienb &= ~(1 << irq);
140 write_aux_reg(AUX_IENABLE, ienb);
141}
142
143static inline void arch_unmask_irq(unsigned int irq)
144{
145 unsigned int ienb;
146
147 ienb = read_aux_reg(AUX_IENABLE);
148 ienb |= (1 << irq);
149 write_aux_reg(AUX_IENABLE, ienb);
150}
151
152#else 134#else
153 135
154#ifdef CONFIG_TRACE_IRQFLAGS 136#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/arc/kernel/irq.c b/arch/arc/kernel/irq.c
index 7d653c0d0773..620ec2fe32a9 100644
--- a/arch/arc/kernel/irq.c
+++ b/arch/arc/kernel/irq.c
@@ -19,21 +19,16 @@
19 19
20/* 20/*
21 * Early Hardware specific Interrupt setup 21 * Early Hardware specific Interrupt setup
22 * -Platform independent, needed for each CPU (not foldable into init_IRQ)
22 * -Called very early (start_kernel -> setup_arch -> setup_processor) 23 * -Called very early (start_kernel -> setup_arch -> setup_processor)
23 * -Platform Independent (must for any ARC700)
24 * -Needed for each CPU (hence not foldable into init_IRQ)
25 * 24 *
26 * what it does ? 25 * what it does ?
27 * -Disable all IRQs (on CPU side)
28 * -Optionally, setup the High priority Interrupts as Level 2 IRQs 26 * -Optionally, setup the High priority Interrupts as Level 2 IRQs
29 */ 27 */
30void arc_init_IRQ(void) 28void arc_init_IRQ(void)
31{ 29{
32 int level_mask = 0; 30 int level_mask = 0;
33 31
34 /* Disable all IRQs: enable them as devices request */
35 write_aux_reg(AUX_IENABLE, 0);
36
37 /* setup any high priority Interrupts (Level2 in ARCompact jargon) */ 32 /* setup any high priority Interrupts (Level2 in ARCompact jargon) */
38 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3; 33 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3;
39 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5; 34 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5;
@@ -60,20 +55,28 @@ void arc_init_IRQ(void)
60 * below, per IRQ. 55 * below, per IRQ.
61 */ 56 */
62 57
63static void arc_mask_irq(struct irq_data *data) 58static void arc_irq_mask(struct irq_data *data)
64{ 59{
65 arch_mask_irq(data->irq); 60 unsigned int ienb;
61
62 ienb = read_aux_reg(AUX_IENABLE);
63 ienb &= ~(1 << data->irq);
64 write_aux_reg(AUX_IENABLE, ienb);
66} 65}
67 66
68static void arc_unmask_irq(struct irq_data *data) 67static void arc_irq_unmask(struct irq_data *data)
69{ 68{
70 arch_unmask_irq(data->irq); 69 unsigned int ienb;
70
71 ienb = read_aux_reg(AUX_IENABLE);
72 ienb |= (1 << data->irq);
73 write_aux_reg(AUX_IENABLE, ienb);
71} 74}
72 75
73static struct irq_chip onchip_intc = { 76static struct irq_chip onchip_intc = {
74 .name = "ARC In-core Intc", 77 .name = "ARC In-core Intc",
75 .irq_mask = arc_mask_irq, 78 .irq_mask = arc_irq_mask,
76 .irq_unmask = arc_unmask_irq, 79 .irq_unmask = arc_irq_unmask,
77}; 80};
78 81
79static int arc_intc_domain_map(struct irq_domain *d, unsigned int irq, 82static int arc_intc_domain_map(struct irq_domain *d, unsigned int irq,
@@ -150,6 +153,32 @@ void arch_do_IRQ(unsigned int irq, struct pt_regs *regs)
150 set_irq_regs(old_regs); 153 set_irq_regs(old_regs);
151} 154}
152 155
156void arc_request_percpu_irq(int irq, int cpu,
157 irqreturn_t (*isr)(int irq, void *dev),
158 const char *irq_nm,
159 void *percpu_dev)
160{
161 /* Boot cpu calls request, all call enable */
162 if (!cpu) {
163 int rc;
164
165 /*
166 * These 2 calls are essential to making percpu IRQ APIs work
167 * Ideally these details could be hidden in irq chip map function
168 * but the issue is IPIs IRQs being static (non-DT) and platform
169 * specific, so we can't identify them there.
170 */
171 irq_set_percpu_devid(irq);
172 irq_modify_status(irq, IRQ_NOAUTOEN, 0); /* @irq, @clr, @set */
173
174 rc = request_percpu_irq(irq, isr, irq_nm, percpu_dev);
175 if (rc)
176 panic("Percpu IRQ request failed for %d\n", irq);
177 }
178
179 enable_percpu_irq(irq, 0);
180}
181
153/* 182/*
154 * arch_local_irq_enable - Enable interrupts. 183 * arch_local_irq_enable - Enable interrupts.
155 * 184 *
diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index 7e95e1a86510..cb3142a2d40b 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -141,17 +141,13 @@ badframe:
141/* 141/*
142 * Determine which stack to use.. 142 * Determine which stack to use..
143 */ 143 */
144static inline void __user *get_sigframe(struct k_sigaction *ka, 144static inline void __user *get_sigframe(struct ksignal *ksig,
145 struct pt_regs *regs, 145 struct pt_regs *regs,
146 unsigned long framesize) 146 unsigned long framesize)
147{ 147{
148 unsigned long sp = regs->sp; 148 unsigned long sp = sigsp(regs->sp, ksig);
149 void __user *frame; 149 void __user *frame;
150 150
151 /* This is the X/Open sanctioned signal stack switching */
152 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
153 sp = current->sas_ss_sp + current->sas_ss_size;
154
155 /* No matter what happens, 'sp' must be word 151 /* No matter what happens, 'sp' must be word
156 * aligned otherwise nasty things could happen 152 * aligned otherwise nasty things could happen
157 */ 153 */
@@ -179,14 +175,13 @@ static inline int map_sig(int sig)
179} 175}
180 176
181static int 177static int
182setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info, 178setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
183 sigset_t *set, struct pt_regs *regs)
184{ 179{
185 struct rt_sigframe __user *sf; 180 struct rt_sigframe __user *sf;
186 unsigned int magic = 0; 181 unsigned int magic = 0;
187 int err = 0; 182 int err = 0;
188 183
189 sf = get_sigframe(ka, regs, sizeof(struct rt_sigframe)); 184 sf = get_sigframe(ksig, regs, sizeof(struct rt_sigframe));
190 if (!sf) 185 if (!sf)
191 return 1; 186 return 1;
192 187
@@ -205,8 +200,8 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
205 * #2: struct siginfo 200 * #2: struct siginfo
206 * #3: struct ucontext (completely populated) 201 * #3: struct ucontext (completely populated)
207 */ 202 */
208 if (unlikely(ka->sa.sa_flags & SA_SIGINFO)) { 203 if (unlikely(ksig->ka.sa.sa_flags & SA_SIGINFO)) {
209 err |= copy_siginfo_to_user(&sf->info, info); 204 err |= copy_siginfo_to_user(&sf->info, &ksig->info);
210 err |= __put_user(0, &sf->uc.uc_flags); 205 err |= __put_user(0, &sf->uc.uc_flags);
211 err |= __put_user(NULL, &sf->uc.uc_link); 206 err |= __put_user(NULL, &sf->uc.uc_link);
212 err |= __save_altstack(&sf->uc.uc_stack, regs->sp); 207 err |= __save_altstack(&sf->uc.uc_stack, regs->sp);
@@ -227,16 +222,16 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info,
227 return err; 222 return err;
228 223
229 /* #1 arg to the user Signal handler */ 224 /* #1 arg to the user Signal handler */
230 regs->r0 = map_sig(signo); 225 regs->r0 = map_sig(ksig->sig);
231 226
232 /* setup PC of user space signal handler */ 227 /* setup PC of user space signal handler */
233 regs->ret = (unsigned long)ka->sa.sa_handler; 228 regs->ret = (unsigned long)ksig->ka.sa.sa_handler;
234 229
235 /* 230 /*
236 * handler returns using sigreturn stub provided already by userpsace 231 * handler returns using sigreturn stub provided already by userpsace
237 */ 232 */
238 BUG_ON(!(ka->sa.sa_flags & SA_RESTORER)); 233 BUG_ON(!(ksig->ka.sa.sa_flags & SA_RESTORER));
239 regs->blink = (unsigned long)ka->sa.sa_restorer; 234 regs->blink = (unsigned long)ksig->ka.sa.sa_restorer;
240 235
241 /* User Stack for signal handler will be above the frame just carved */ 236 /* User Stack for signal handler will be above the frame just carved */
242 regs->sp = (unsigned long)sf; 237 regs->sp = (unsigned long)sf;
@@ -298,38 +293,30 @@ static void arc_restart_syscall(struct k_sigaction *ka, struct pt_regs *regs)
298 * OK, we're invoking a handler 293 * OK, we're invoking a handler
299 */ 294 */
300static void 295static void
301handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 296handle_signal(struct ksignal *ksig, struct pt_regs *regs)
302 struct pt_regs *regs)
303{ 297{
304 sigset_t *oldset = sigmask_to_save(); 298 sigset_t *oldset = sigmask_to_save();
305 int ret; 299 int ret;
306 300
307 /* Set up the stack frame */ 301 /* Set up the stack frame */
308 ret = setup_rt_frame(sig, ka, info, oldset, regs); 302 ret = setup_rt_frame(ksig, oldset, regs);
309 303
310 if (ret) 304 signal_setup_done(ret, ksig, 0);
311 force_sigsegv(sig, current);
312 else
313 signal_delivered(sig, info, ka, regs, 0);
314} 305}
315 306
316void do_signal(struct pt_regs *regs) 307void do_signal(struct pt_regs *regs)
317{ 308{
318 struct k_sigaction ka; 309 struct ksignal ksig;
319 siginfo_t info;
320 int signr;
321 int restart_scall; 310 int restart_scall;
322 311
323 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
324
325 restart_scall = in_syscall(regs) && syscall_restartable(regs); 312 restart_scall = in_syscall(regs) && syscall_restartable(regs);
326 313
327 if (signr > 0) { 314 if (get_signal(&ksig)) {
328 if (restart_scall) { 315 if (restart_scall) {
329 arc_restart_syscall(&ka, regs); 316 arc_restart_syscall(&ksig.ka, regs);
330 syscall_wont_restart(regs); /* No more restarts */ 317 syscall_wont_restart(regs); /* No more restarts */
331 } 318 }
332 handle_signal(signr, &ka, &info, regs); 319 handle_signal(&ksig, regs);
333 return; 320 return;
334 } 321 }
335 322
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index c802bb500602..dcd317c47d09 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -12,23 +12,15 @@
12 * -- Initial Write (Borrowed heavily from ARM) 12 * -- Initial Write (Borrowed heavily from ARM)
13 */ 13 */
14 14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/spinlock.h> 15#include <linux/spinlock.h>
18#include <linux/sched.h> 16#include <linux/sched.h>
19#include <linux/interrupt.h> 17#include <linux/interrupt.h>
20#include <linux/profile.h> 18#include <linux/profile.h>
21#include <linux/errno.h>
22#include <linux/err.h>
23#include <linux/mm.h> 19#include <linux/mm.h>
24#include <linux/cpu.h> 20#include <linux/cpu.h>
25#include <linux/smp.h>
26#include <linux/irq.h> 21#include <linux/irq.h>
27#include <linux/delay.h>
28#include <linux/atomic.h> 22#include <linux/atomic.h>
29#include <linux/percpu.h>
30#include <linux/cpumask.h> 23#include <linux/cpumask.h>
31#include <linux/spinlock_types.h>
32#include <linux/reboot.h> 24#include <linux/reboot.h>
33#include <asm/processor.h> 25#include <asm/processor.h>
34#include <asm/setup.h> 26#include <asm/setup.h>
@@ -136,7 +128,7 @@ void start_kernel_secondary(void)
136 pr_info("## CPU%u LIVE ##: Executing Code...\n", cpu); 128 pr_info("## CPU%u LIVE ##: Executing Code...\n", cpu);
137 129
138 if (machine_desc->init_smp) 130 if (machine_desc->init_smp)
139 machine_desc->init_smp(smp_processor_id()); 131 machine_desc->init_smp(cpu);
140 132
141 arc_local_timer_setup(); 133 arc_local_timer_setup();
142 134
@@ -338,18 +330,11 @@ irqreturn_t do_IPI(int irq, void *dev_id)
338 */ 330 */
339static DEFINE_PER_CPU(int, ipi_dev); 331static DEFINE_PER_CPU(int, ipi_dev);
340 332
341static struct irqaction arc_ipi_irq = {
342 .name = "IPI Interrupt",
343 .flags = IRQF_PERCPU,
344 .handler = do_IPI,
345};
346
347int smp_ipi_irq_setup(int cpu, int irq) 333int smp_ipi_irq_setup(int cpu, int irq)
348{ 334{
349 if (!cpu) 335 int *dev = per_cpu_ptr(&ipi_dev, cpu);
350 return setup_irq(irq, &arc_ipi_irq); 336
351 else 337 arc_request_percpu_irq(irq, cpu, do_IPI, "IPI Interrupt", dev);
352 arch_unmask_irq(irq);
353 338
354 return 0; 339 return 0;
355} 340}
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c
index 36c2aa99436f..dbe74f418019 100644
--- a/arch/arc/kernel/time.c
+++ b/arch/arc/kernel/time.c
@@ -144,12 +144,12 @@ static struct clocksource arc_counter = {
144/********** Clock Event Device *********/ 144/********** Clock Event Device *********/
145 145
146/* 146/*
147 * Arm the timer to interrupt after @limit cycles 147 * Arm the timer to interrupt after @cycles
148 * The distinction for oneshot/periodic is done in arc_event_timer_ack() below 148 * The distinction for oneshot/periodic is done in arc_event_timer_ack() below
149 */ 149 */
150static void arc_timer_event_setup(unsigned int limit) 150static void arc_timer_event_setup(unsigned int cycles)
151{ 151{
152 write_aux_reg(ARC_REG_TIMER0_LIMIT, limit); 152 write_aux_reg(ARC_REG_TIMER0_LIMIT, cycles);
153 write_aux_reg(ARC_REG_TIMER0_CNT, 0); /* start from 0 */ 153 write_aux_reg(ARC_REG_TIMER0_CNT, 0); /* start from 0 */
154 154
155 write_aux_reg(ARC_REG_TIMER0_CTRL, TIMER_CTRL_IE | TIMER_CTRL_NH); 155 write_aux_reg(ARC_REG_TIMER0_CTRL, TIMER_CTRL_IE | TIMER_CTRL_NH);
@@ -168,6 +168,10 @@ static void arc_clkevent_set_mode(enum clock_event_mode mode,
168{ 168{
169 switch (mode) { 169 switch (mode) {
170 case CLOCK_EVT_MODE_PERIODIC: 170 case CLOCK_EVT_MODE_PERIODIC:
171 /*
172 * At X Hz, 1 sec = 1000ms -> X cycles;
173 * 10ms -> X / 100 cycles
174 */
171 arc_timer_event_setup(arc_get_core_freq() / HZ); 175 arc_timer_event_setup(arc_get_core_freq() / HZ);
172 break; 176 break;
173 case CLOCK_EVT_MODE_ONESHOT: 177 case CLOCK_EVT_MODE_ONESHOT:
@@ -210,12 +214,6 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id)
210 return IRQ_HANDLED; 214 return IRQ_HANDLED;
211} 215}
212 216
213static struct irqaction arc_timer_irq = {
214 .name = "Timer0 (clock-evt-dev)",
215 .flags = IRQF_TIMER | IRQF_PERCPU,
216 .handler = timer_irq_handler,
217};
218
219/* 217/*
220 * Setup the local event timer for @cpu 218 * Setup the local event timer for @cpu
221 */ 219 */
@@ -228,15 +226,9 @@ void arc_local_timer_setup()
228 clockevents_config_and_register(evt, arc_get_core_freq(), 226 clockevents_config_and_register(evt, arc_get_core_freq(),
229 0, ARC_TIMER_MAX); 227 0, ARC_TIMER_MAX);
230 228
231 /* 229 /* setup the per-cpu timer IRQ handler - for all cpus */
232 * setup the per-cpu timer IRQ handler - for all cpus 230 arc_request_percpu_irq(TIMER0_IRQ, cpu, timer_irq_handler,
233 * For non boot CPU explicitly unmask at intc 231 "Timer0 (per-cpu-tick)", evt);
234 * setup_irq() -> .. -> irq_startup() already does this on boot-cpu
235 */
236 if (!cpu)
237 setup_irq(TIMER0_IRQ, &arc_timer_irq);
238 else
239 arch_unmask_irq(TIMER0_IRQ);
240} 232}
241 233
242/* 234/*
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 353b202c37c9..4670afc3b971 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -77,21 +77,19 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len)
77{ 77{
78 int n = 0; 78 int n = 0;
79 79
80#define PR_CACHE(p, enb, str) \ 80#define PR_CACHE(p, cfg, str) \
81{ \
82 if (!(p)->ver) \ 81 if (!(p)->ver) \
83 n += scnprintf(buf + n, len - n, str"\t\t: N/A\n"); \ 82 n += scnprintf(buf + n, len - n, str"\t\t: N/A\n"); \
84 else \ 83 else \
85 n += scnprintf(buf + n, len - n, \ 84 n += scnprintf(buf + n, len - n, \
86 str"\t\t: (%uK) VIPT, %dway set-asc, %ub Line %s\n", \ 85 str"\t\t: %uK, %dway/set, %uB Line, %s%s%s\n", \
87 TO_KB((p)->sz), (p)->assoc, (p)->line_len, \ 86 (p)->sz_k, (p)->assoc, (p)->line_len, \
88 enb ? "" : "DISABLED (kernel-build)"); \ 87 (p)->vipt ? "VIPT" : "PIPT", \
89} 88 (p)->alias ? " aliasing" : "", \
89 IS_ENABLED(cfg) ? "" : " (not used)");
90 90
91 PR_CACHE(&cpuinfo_arc700[c].icache, IS_ENABLED(CONFIG_ARC_HAS_ICACHE), 91 PR_CACHE(&cpuinfo_arc700[c].icache, CONFIG_ARC_HAS_ICACHE, "I-Cache");
92 "I-Cache"); 92 PR_CACHE(&cpuinfo_arc700[c].dcache, CONFIG_ARC_HAS_DCACHE, "D-Cache");
93 PR_CACHE(&cpuinfo_arc700[c].dcache, IS_ENABLED(CONFIG_ARC_HAS_DCACHE),
94 "D-Cache");
95 93
96 return buf; 94 return buf;
97} 95}
@@ -116,20 +114,31 @@ void read_decode_cache_bcr(void)
116 p_ic = &cpuinfo_arc700[cpu].icache; 114 p_ic = &cpuinfo_arc700[cpu].icache;
117 READ_BCR(ARC_REG_IC_BCR, ibcr); 115 READ_BCR(ARC_REG_IC_BCR, ibcr);
118 116
117 if (!ibcr.ver)
118 goto dc_chk;
119
119 BUG_ON(ibcr.config != 3); 120 BUG_ON(ibcr.config != 3);
120 p_ic->assoc = 2; /* Fixed to 2w set assoc */ 121 p_ic->assoc = 2; /* Fixed to 2w set assoc */
121 p_ic->line_len = 8 << ibcr.line_len; 122 p_ic->line_len = 8 << ibcr.line_len;
122 p_ic->sz = 0x200 << ibcr.sz; 123 p_ic->sz_k = 1 << (ibcr.sz - 1);
123 p_ic->ver = ibcr.ver; 124 p_ic->ver = ibcr.ver;
125 p_ic->vipt = 1;
126 p_ic->alias = p_ic->sz_k/p_ic->assoc/TO_KB(PAGE_SIZE) > 1;
124 127
128dc_chk:
125 p_dc = &cpuinfo_arc700[cpu].dcache; 129 p_dc = &cpuinfo_arc700[cpu].dcache;
126 READ_BCR(ARC_REG_DC_BCR, dbcr); 130 READ_BCR(ARC_REG_DC_BCR, dbcr);
127 131
132 if (!dbcr.ver)
133 return;
134
128 BUG_ON(dbcr.config != 2); 135 BUG_ON(dbcr.config != 2);
129 p_dc->assoc = 4; /* Fixed to 4w set assoc */ 136 p_dc->assoc = 4; /* Fixed to 4w set assoc */
130 p_dc->line_len = 16 << dbcr.line_len; 137 p_dc->line_len = 16 << dbcr.line_len;
131 p_dc->sz = 0x200 << dbcr.sz; 138 p_dc->sz_k = 1 << (dbcr.sz - 1);
132 p_dc->ver = dbcr.ver; 139 p_dc->ver = dbcr.ver;
140 p_dc->vipt = 1;
141 p_dc->alias = p_dc->sz_k/p_dc->assoc/TO_KB(PAGE_SIZE) > 1;
133} 142}
134 143
135/* 144/*
@@ -142,14 +151,16 @@ void read_decode_cache_bcr(void)
142void arc_cache_init(void) 151void arc_cache_init(void)
143{ 152{
144 unsigned int __maybe_unused cpu = smp_processor_id(); 153 unsigned int __maybe_unused cpu = smp_processor_id();
145 struct cpuinfo_arc_cache __maybe_unused *ic, __maybe_unused *dc;
146 char str[256]; 154 char str[256];
147 155
148 printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 156 printk(arc_cache_mumbojumbo(0, str, sizeof(str)));
149 157
150#ifdef CONFIG_ARC_HAS_ICACHE 158 if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) {
151 ic = &cpuinfo_arc700[cpu].icache; 159 struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
152 if (ic->ver) { 160
161 if (!ic->ver)
162 panic("cache support enabled but non-existent cache\n");
163
153 if (ic->line_len != L1_CACHE_BYTES) 164 if (ic->line_len != L1_CACHE_BYTES)
154 panic("ICache line [%d] != kernel Config [%d]", 165 panic("ICache line [%d] != kernel Config [%d]",
155 ic->line_len, L1_CACHE_BYTES); 166 ic->line_len, L1_CACHE_BYTES);
@@ -158,26 +169,26 @@ void arc_cache_init(void)
158 panic("Cache ver [%d] doesn't match MMU ver [%d]\n", 169 panic("Cache ver [%d] doesn't match MMU ver [%d]\n",
159 ic->ver, CONFIG_ARC_MMU_VER); 170 ic->ver, CONFIG_ARC_MMU_VER);
160 } 171 }
161#endif
162 172
163#ifdef CONFIG_ARC_HAS_DCACHE 173 if (IS_ENABLED(CONFIG_ARC_HAS_DCACHE)) {
164 dc = &cpuinfo_arc700[cpu].dcache; 174 struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache;
165 if (dc->ver) { 175 int handled;
166 unsigned int dcache_does_alias; 176
177 if (!dc->ver)
178 panic("cache support enabled but non-existent cache\n");
167 179
168 if (dc->line_len != L1_CACHE_BYTES) 180 if (dc->line_len != L1_CACHE_BYTES)
169 panic("DCache line [%d] != kernel Config [%d]", 181 panic("DCache line [%d] != kernel Config [%d]",
170 dc->line_len, L1_CACHE_BYTES); 182 dc->line_len, L1_CACHE_BYTES);
171 183
172 /* check for D-Cache aliasing */ 184 /* check for D-Cache aliasing */
173 dcache_does_alias = (dc->sz / dc->assoc) > PAGE_SIZE; 185 handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
174 186
175 if (dcache_does_alias && !cache_is_vipt_aliasing()) 187 if (dc->alias && !handled)
176 panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 188 panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
177 else if (!dcache_does_alias && cache_is_vipt_aliasing()) 189 else if (!dc->alias && handled)
178 panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 190 panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n");
179 } 191 }
180#endif
181} 192}
182 193
183#define OP_INV 0x1 194#define OP_INV 0x1
@@ -255,10 +266,32 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr,
255 * Machine specific helpers for Entire D-Cache or Per Line ops 266 * Machine specific helpers for Entire D-Cache or Per Line ops
256 */ 267 */
257 268
258static inline void wait_for_flush(void) 269static unsigned int __before_dc_op(const int op)
270{
271 unsigned int reg = reg;
272
273 if (op == OP_FLUSH_N_INV) {
274 /* Dcache provides 2 cmd: FLUSH or INV
275 * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE
276 * flush-n-inv is achieved by INV cmd but with IM=1
277 * So toggle INV sub-mode depending on op request and default
278 */
279 reg = read_aux_reg(ARC_REG_DC_CTRL);
280 write_aux_reg(ARC_REG_DC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH)
281 ;
282 }
283
284 return reg;
285}
286
287static void __after_dc_op(const int op, unsigned int reg)
259{ 288{
260 while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS) 289 if (op & OP_FLUSH) /* flush / flush-n-inv both wait */
261 ; 290 while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS);
291
292 /* Switch back to default Invalidate mode */
293 if (op == OP_FLUSH_N_INV)
294 write_aux_reg(ARC_REG_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
262} 295}
263 296
264/* 297/*
@@ -269,18 +302,10 @@ static inline void wait_for_flush(void)
269 */ 302 */
270static inline void __dc_entire_op(const int cacheop) 303static inline void __dc_entire_op(const int cacheop)
271{ 304{
272 unsigned int tmp = tmp; 305 unsigned int ctrl_reg;
273 int aux; 306 int aux;
274 307
275 if (cacheop == OP_FLUSH_N_INV) { 308 ctrl_reg = __before_dc_op(cacheop);
276 /* Dcache provides 2 cmd: FLUSH or INV
277 * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE
278 * flush-n-inv is achieved by INV cmd but with IM=1
279 * Default INV sub-mode is DISCARD, which needs to be toggled
280 */
281 tmp = read_aux_reg(ARC_REG_DC_CTRL);
282 write_aux_reg(ARC_REG_DC_CTRL, tmp | DC_CTRL_INV_MODE_FLUSH);
283 }
284 309
285 if (cacheop & OP_INV) /* Inv or flush-n-inv use same cmd reg */ 310 if (cacheop & OP_INV) /* Inv or flush-n-inv use same cmd reg */
286 aux = ARC_REG_DC_IVDC; 311 aux = ARC_REG_DC_IVDC;
@@ -289,12 +314,7 @@ static inline void __dc_entire_op(const int cacheop)
289 314
290 write_aux_reg(aux, 0x1); 315 write_aux_reg(aux, 0x1);
291 316
292 if (cacheop & OP_FLUSH) /* flush / flush-n-inv both wait */ 317 __after_dc_op(cacheop, ctrl_reg);
293 wait_for_flush();
294
295 /* Switch back the DISCARD ONLY Invalidate mode */
296 if (cacheop == OP_FLUSH_N_INV)
297 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH);
298} 318}
299 319
300/* For kernel mappings cache operation: index is same as paddr */ 320/* For kernel mappings cache operation: index is same as paddr */
@@ -306,29 +326,16 @@ static inline void __dc_entire_op(const int cacheop)
306static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr, 326static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
307 unsigned long sz, const int cacheop) 327 unsigned long sz, const int cacheop)
308{ 328{
309 unsigned long flags, tmp = tmp; 329 unsigned long flags;
330 unsigned int ctrl_reg;
310 331
311 local_irq_save(flags); 332 local_irq_save(flags);
312 333
313 if (cacheop == OP_FLUSH_N_INV) { 334 ctrl_reg = __before_dc_op(cacheop);
314 /*
315 * Dcache provides 2 cmd: FLUSH or INV
316 * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE
317 * flush-n-inv is achieved by INV cmd but with IM=1
318 * Default INV sub-mode is DISCARD, which needs to be toggled
319 */
320 tmp = read_aux_reg(ARC_REG_DC_CTRL);
321 write_aux_reg(ARC_REG_DC_CTRL, tmp | DC_CTRL_INV_MODE_FLUSH);
322 }
323 335
324 __cache_line_loop(paddr, vaddr, sz, cacheop); 336 __cache_line_loop(paddr, vaddr, sz, cacheop);
325 337
326 if (cacheop & OP_FLUSH) /* flush / flush-n-inv both wait */ 338 __after_dc_op(cacheop, ctrl_reg);
327 wait_for_flush();
328
329 /* Switch back the DISCARD ONLY Invalidate mode */
330 if (cacheop == OP_FLUSH_N_INV)
331 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH);
332 339
333 local_irq_restore(flags); 340 local_irq_restore(flags);
334} 341}
@@ -389,8 +396,16 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
389/*********************************************************** 396/***********************************************************
390 * Machine specific helper for per line I-Cache invalidate. 397 * Machine specific helper for per line I-Cache invalidate.
391 */ 398 */
392static void __ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr, 399
393 unsigned long sz) 400static inline void __ic_entire_inv(void)
401{
402 write_aux_reg(ARC_REG_IC_IVIC, 1);
403 read_aux_reg(ARC_REG_IC_CTRL); /* blocks */
404}
405
406static inline void
407__ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr,
408 unsigned long sz)
394{ 409{
395 unsigned long flags; 410 unsigned long flags;
396 411
@@ -399,30 +414,39 @@ static void __ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr,
399 local_irq_restore(flags); 414 local_irq_restore(flags);
400} 415}
401 416
402static inline void __ic_entire_inv(void) 417#ifndef CONFIG_SMP
403{ 418
404 write_aux_reg(ARC_REG_IC_IVIC, 1); 419#define __ic_line_inv_vaddr(p, v, s) __ic_line_inv_vaddr_local(p, v, s)
405 read_aux_reg(ARC_REG_IC_CTRL); /* blocks */
406}
407 420
408struct ic_line_inv_vaddr_ipi { 421#else
422
423struct ic_inv_args {
409 unsigned long paddr, vaddr; 424 unsigned long paddr, vaddr;
410 int sz; 425 int sz;
411}; 426};
412 427
413static void __ic_line_inv_vaddr_helper(void *info) 428static void __ic_line_inv_vaddr_helper(void *info)
414{ 429{
415 struct ic_line_inv_vaddr_ipi *ic_inv = (struct ic_line_inv_vaddr_ipi*) info; 430 struct ic_inv *ic_inv_args = (struct ic_inv_args *) info;
431
416 __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); 432 __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz);
417} 433}
418 434
419static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, 435static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
420 unsigned long sz) 436 unsigned long sz)
421{ 437{
422 struct ic_line_inv_vaddr_ipi ic_inv = { paddr, vaddr , sz}; 438 struct ic_inv_args ic_inv = {
439 .paddr = paddr,
440 .vaddr = vaddr,
441 .sz = sz
442 };
443
423 on_each_cpu(__ic_line_inv_vaddr_helper, &ic_inv, 1); 444 on_each_cpu(__ic_line_inv_vaddr_helper, &ic_inv, 1);
424} 445}
425#else 446
447#endif /* CONFIG_SMP */
448
449#else /* !CONFIG_ARC_HAS_ICACHE */
426 450
427#define __ic_entire_inv() 451#define __ic_entire_inv()
428#define __ic_line_inv_vaddr(pstart, vstart, sz) 452#define __ic_line_inv_vaddr(pstart, vstart, sz)
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 9c69552350c4..6f7e3a68803a 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -159,7 +159,6 @@ good_area:
159 return; 159 return;
160 } 160 }
161 161
162 /* TBD: switch to pagefault_out_of_memory() */
163 if (fault & VM_FAULT_OOM) 162 if (fault & VM_FAULT_OOM)
164 goto out_of_memory; 163 goto out_of_memory;
165 else if (fault & VM_FAULT_SIGBUS) 164 else if (fault & VM_FAULT_SIGBUS)
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index 79bfc81358c9..d572f1c2c724 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -220,9 +220,9 @@ ex_saved_reg1:
220 220
221.macro CONV_PTE_TO_TLB 221.macro CONV_PTE_TO_TLB
222 and r3, r0, PTE_BITS_RWX ; r w x 222 and r3, r0, PTE_BITS_RWX ; r w x
223 lsl r2, r3, 3 ; r w x 0 0 0 223 lsl r2, r3, 3 ; r w x 0 0 0 (GLOBAL, kernel only)
224 and.f 0, r0, _PAGE_GLOBAL 224 and.f 0, r0, _PAGE_GLOBAL
225 or.z r2, r2, r3 ; r w x r w x 225 or.z r2, r2, r3 ; r w x r w x (!GLOBAL, user page)
226 226
227 and r3, r0, PTE_BITS_NON_RWX_IN_PD1 ; Extract PFN+cache bits from PTE 227 and r3, r0, PTE_BITS_NON_RWX_IN_PD1 ; Extract PFN+cache bits from PTE
228 or r3, r3, r2 228 or r3, r3, r2
diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig
index e27bb5cc3c1e..b9f34cf55acf 100644
--- a/arch/arc/plat-arcfpga/Kconfig
+++ b/arch/arc/plat-arcfpga/Kconfig
@@ -41,11 +41,4 @@ config ISS_SMP_EXTN
41 -XTL (To enable CPU start/stop/set-PC for another CPU) 41 -XTL (To enable CPU start/stop/set-PC for another CPU)
42 It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND) 42 It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND)
43 43
44config ARC_SERIAL_BAUD
45 int "UART Baud rate"
46 default "115200"
47 depends on SERIAL_ARC || SERIAL_ARC_CONSOLE
48 help
49 Baud rate for the ARC UART
50
51endif 44endif
diff --git a/arch/arc/plat-arcfpga/Makefile b/arch/arc/plat-arcfpga/Makefile
index 4d1bddc34b5b..66fd0ecd68b3 100644
--- a/arch/arc/plat-arcfpga/Makefile
+++ b/arch/arc/plat-arcfpga/Makefile
@@ -8,5 +8,5 @@
8 8
9KBUILD_CFLAGS += -Iarch/arc/plat-arcfpga/include 9KBUILD_CFLAGS += -Iarch/arc/plat-arcfpga/include
10 10
11obj-y := platform.o irq.o 11obj-y := platform.o
12obj-$(CONFIG_ISS_SMP_EXTN) += smp.o 12obj-$(CONFIG_ISS_SMP_EXTN) += smp.o
diff --git a/arch/arc/plat-arcfpga/include/plat/irq.h b/arch/arc/plat-arcfpga/include/plat/irq.h
index 6adbc53c3a5b..2c9dea690ac4 100644
--- a/arch/arc/plat-arcfpga/include/plat/irq.h
+++ b/arch/arc/plat-arcfpga/include/plat/irq.h
@@ -24,6 +24,4 @@
24#define IDU_INTERRUPT_0 16 24#define IDU_INTERRUPT_0 16
25#endif 25#endif
26 26
27extern void __init plat_fpga_init_IRQ(void);
28
29#endif 27#endif
diff --git a/arch/arc/plat-arcfpga/irq.c b/arch/arc/plat-arcfpga/irq.c
deleted file mode 100644
index d2215fd889c2..000000000000
--- a/arch/arc/plat-arcfpga/irq.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * ARC FPGA Platform IRQ hookups
3 *
4 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/interrupt.h>
12#include <plat/irq.h>
13
14void __init plat_fpga_init_IRQ(void)
15{
16 /*
17 * SMP Hack because UART IRQ hardwired to cpu0 (boot-cpu) but if the
18 * request_irq() comes from any other CPU, the low level IRQ unamsking
19 * essential for getting Interrupts won't be enabled on cpu0, locking
20 * up the UART state machine.
21 */
22#ifdef CONFIG_SMP
23 arch_unmask_irq(UART0_IRQ);
24#endif
25}
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index 61c7e5997387..1038949a99a1 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -22,115 +22,22 @@
22#include <plat/smp.h> 22#include <plat/smp.h>
23#include <plat/irq.h> 23#include <plat/irq.h>
24 24
25/*----------------------- Platform Devices -----------------------------*/
26
27#if IS_ENABLED(CONFIG_SERIAL_ARC)
28static unsigned long arc_uart_info[] = {
29 0, /* uart->is_emulated (runtime @running_on_hw) */
30 0, /* uart->port.uartclk */
31 0, /* uart->baud */
32 0
33};
34
35#if defined(CONFIG_SERIAL_ARC_CONSOLE)
36/*
37 * static platform data - but only for early serial
38 * TBD: derive this from a special DT node
39 */
40static struct resource arc_uart0_res[] = {
41 {
42 .start = UART0_BASE,
43 .end = UART0_BASE + 0xFF,
44 .flags = IORESOURCE_MEM,
45 },
46 {
47 .start = UART0_IRQ,
48 .end = UART0_IRQ,
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53static struct platform_device arc_uart0_dev = {
54 .name = "arc-uart",
55 .id = 0,
56 .num_resources = ARRAY_SIZE(arc_uart0_res),
57 .resource = arc_uart0_res,
58 .dev = {
59 .platform_data = &arc_uart_info,
60 },
61};
62
63static struct platform_device *fpga_early_devs[] __initdata = {
64 &arc_uart0_dev,
65};
66#endif /* CONFIG_SERIAL_ARC_CONSOLE */
67
68static void arc_fpga_serial_init(void)
69{
70 /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */
71 arc_uart_info[0] = !running_on_hw;
72
73 arc_uart_info[1] = arc_get_core_freq();
74
75 arc_uart_info[2] = CONFIG_ARC_SERIAL_BAUD;
76
77#if defined(CONFIG_SERIAL_ARC_CONSOLE)
78 early_platform_add_devices(fpga_early_devs,
79 ARRAY_SIZE(fpga_early_devs));
80
81 /*
82 * ARC console driver registers (build time) as an early platform driver
83 * of class "earlyprintk". However it needs explicit cmdline toggle
84 * "earlyprintk=ttyARC0" to be successfuly runtime registered.
85 * Otherwise the early probe below fails to find the driver
86 */
87 early_platform_driver_probe("earlyprintk", 1, 0);
88
89 /*
90 * This is to make sure that arc uart would be preferred console
91 * despite one/more of following:
92 * -command line lacked "console=ttyARC0" or
93 * -CONFIG_VT_CONSOLE was enabled (for no reason whatsoever)
94 * Note that this needs to be done after above early console is reg,
95 * otherwise the early console never gets a chance to run.
96 */
97 add_preferred_console("ttyARC", 0, "115200");
98#endif /* CONFIG_SERIAL_ARC_CONSOLE */
99}
100#else /* !IS_ENABLED(CONFIG_SERIAL_ARC) */
101static void arc_fpga_serial_init(void)
102{
103}
104#endif
105
106static void __init plat_fpga_early_init(void) 25static void __init plat_fpga_early_init(void)
107{ 26{
108 pr_info("[plat-arcfpga]: registering early dev resources\n"); 27 pr_info("[plat-arcfpga]: registering early dev resources\n");
109 28
110 arc_fpga_serial_init();
111
112#ifdef CONFIG_ISS_SMP_EXTN 29#ifdef CONFIG_ISS_SMP_EXTN
113 iss_model_init_early_smp(); 30 iss_model_init_early_smp();
114#endif 31#endif
115} 32}
116 33
117static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = {
118#if IS_ENABLED(CONFIG_SERIAL_ARC)
119 OF_DEV_AUXDATA("snps,arc-uart", UART0_BASE, "arc-uart", arc_uart_info),
120#endif
121 {}
122};
123
124static void __init plat_fpga_populate_dev(void) 34static void __init plat_fpga_populate_dev(void)
125{ 35{
126 pr_info("[plat-arcfpga]: registering device resources\n");
127
128 /* 36 /*
129 * Traverses flattened DeviceTree - registering platform devices 37 * Traverses flattened DeviceTree - registering platform devices
130 * complete with their resources 38 * (if any) complete with their resources
131 */ 39 */
132 of_platform_populate(NULL, of_default_bus_match_table, 40 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
133 plat_auxdata_lookup, NULL);
134} 41}
135 42
136/*----------------------- Machine Descriptions ------------------------------ 43/*----------------------- Machine Descriptions ------------------------------
@@ -150,7 +57,6 @@ MACHINE_START(ANGEL4, "angel4")
150 .dt_compat = aa4_compat, 57 .dt_compat = aa4_compat,
151 .init_early = plat_fpga_early_init, 58 .init_early = plat_fpga_early_init,
152 .init_machine = plat_fpga_populate_dev, 59 .init_machine = plat_fpga_populate_dev,
153 .init_irq = plat_fpga_init_IRQ,
154#ifdef CONFIG_ISS_SMP_EXTN 60#ifdef CONFIG_ISS_SMP_EXTN
155 .init_smp = iss_model_init_smp, 61 .init_smp = iss_model_init_smp,
156#endif 62#endif
@@ -165,7 +71,6 @@ MACHINE_START(ML509, "ml509")
165 .dt_compat = ml509_compat, 71 .dt_compat = ml509_compat,
166 .init_early = plat_fpga_early_init, 72 .init_early = plat_fpga_early_init,
167 .init_machine = plat_fpga_populate_dev, 73 .init_machine = plat_fpga_populate_dev,
168 .init_irq = plat_fpga_init_IRQ,
169#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
170 .init_smp = iss_model_init_smp, 75 .init_smp = iss_model_init_smp,
171#endif 76#endif
@@ -180,5 +85,4 @@ MACHINE_START(NSIMOSCI, "nsimosci")
180 .dt_compat = nsimosci_compat, 85 .dt_compat = nsimosci_compat,
181 .init_early = NULL, 86 .init_early = NULL,
182 .init_machine = plat_fpga_populate_dev, 87 .init_machine = plat_fpga_populate_dev,
183 .init_irq = NULL,
184MACHINE_END 88MACHINE_END
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 290f02ee0157..c49a775937db 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -65,7 +65,6 @@ config ARM
65 select HAVE_UID16 65 select HAVE_UID16
66 select HAVE_VIRT_CPU_ACCOUNTING_GEN 66 select HAVE_VIRT_CPU_ACCOUNTING_GEN
67 select IRQ_FORCED_THREADING 67 select IRQ_FORCED_THREADING
68 select KTIME_SCALAR
69 select MODULES_USE_ELF_REL 68 select MODULES_USE_ELF_REL
70 select NO_BOOTMEM 69 select NO_BOOTMEM
71 select OLD_SIGACTION 70 select OLD_SIGACTION
@@ -84,6 +83,7 @@ config ARM
84 <http://www.arm.linux.org.uk/>. 83 <http://www.arm.linux.org.uk/>.
85 84
86config ARM_HAS_SG_CHAIN 85config ARM_HAS_SG_CHAIN
86 select ARCH_HAS_SG_CHAIN
87 bool 87 bool
88 88
89config NEED_SG_DMA_LENGTH 89config NEED_SG_DMA_LENGTH
@@ -240,13 +240,6 @@ config ARM_PATCH_PHYS_VIRT
240 this feature (eg, building a kernel for a single machine) and 240 this feature (eg, building a kernel for a single machine) and
241 you need to shrink the kernel to the minimal size. 241 you need to shrink the kernel to the minimal size.
242 242
243config NEED_MACH_GPIO_H
244 bool
245 help
246 Select this when mach/gpio.h is required to provide special
247 definitions for this platform. The need for mach/gpio.h should
248 be avoided when possible.
249
250config NEED_MACH_IO_H 243config NEED_MACH_IO_H
251 bool 244 bool
252 help 245 help
@@ -263,8 +256,22 @@ config NEED_MACH_MEMORY_H
263 256
264config PHYS_OFFSET 257config PHYS_OFFSET
265 hex "Physical address of main memory" if MMU 258 hex "Physical address of main memory" if MMU
266 depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H 259 depends on !ARM_PATCH_PHYS_VIRT
267 default DRAM_BASE if !MMU 260 default DRAM_BASE if !MMU
261 default 0x00000000 if ARCH_EBSA110 || \
262 EP93XX_SDCE3_SYNC_PHYS_OFFSET || \
263 ARCH_FOOTBRIDGE || \
264 ARCH_INTEGRATOR || \
265 ARCH_IOP13XX || \
266 ARCH_KS8695 || \
267 (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET)
268 default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
269 default 0x20000000 if ARCH_S5PV210
270 default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET
271 default 0xc0000000 if EP93XX_SDCE0_PHYS_OFFSET || ARCH_SA1100
272 default 0xd0000000 if EP93XX_SDCE1_PHYS_OFFSET
273 default 0xe0000000 if EP93XX_SDCE2_PHYS_OFFSET
274 default 0xf0000000 if EP93XX_SDCE3_ASYNC_PHYS_OFFSET
268 help 275 help
269 Please provide the physical address corresponding to the 276 Please provide the physical address corresponding to the
270 location of main memory in your system. 277 location of main memory in your system.
@@ -321,7 +328,6 @@ config ARCH_INTEGRATOR
321 select HAVE_TCM 328 select HAVE_TCM
322 select ICST 329 select ICST
323 select MULTI_IRQ_HANDLER 330 select MULTI_IRQ_HANDLER
324 select NEED_MACH_MEMORY_H
325 select PLAT_VERSATILE 331 select PLAT_VERSATILE
326 select SPARSE_IRQ 332 select SPARSE_IRQ
327 select USE_OF 333 select USE_OF
@@ -341,7 +347,6 @@ config ARCH_REALVIEW
341 select ICST 347 select ICST
342 select NEED_MACH_MEMORY_H 348 select NEED_MACH_MEMORY_H
343 select PLAT_VERSATILE 349 select PLAT_VERSATILE
344 select PLAT_VERSATILE_CLCD
345 help 350 help
346 This enables support for ARM Ltd RealView boards. 351 This enables support for ARM Ltd RealView boards.
347 352
@@ -356,7 +361,6 @@ config ARCH_VERSATILE
356 select HAVE_MACH_CLKDEV 361 select HAVE_MACH_CLKDEV
357 select ICST 362 select ICST
358 select PLAT_VERSATILE 363 select PLAT_VERSATILE
359 select PLAT_VERSATILE_CLCD
360 select PLAT_VERSATILE_CLOCK 364 select PLAT_VERSATILE_CLOCK
361 select VERSATILE_FPGA_IRQ 365 select VERSATILE_FPGA_IRQ
362 help 366 help
@@ -436,7 +440,6 @@ config ARCH_EP93XX
436 select ARM_VIC 440 select ARM_VIC
437 select CLKDEV_LOOKUP 441 select CLKDEV_LOOKUP
438 select CPU_ARM920T 442 select CPU_ARM920T
439 select NEED_MACH_MEMORY_H
440 help 443 help
441 This enables support for the Cirrus EP93xx series of CPUs. 444 This enables support for the Cirrus EP93xx series of CPUs.
442 445
@@ -529,21 +532,6 @@ config ARCH_DOVE
529 help 532 help
530 Support for the Marvell Dove SoC 88AP510 533 Support for the Marvell Dove SoC 88AP510
531 534
532config ARCH_KIRKWOOD
533 bool "Marvell Kirkwood"
534 select ARCH_REQUIRE_GPIOLIB
535 select CPU_FEROCEON
536 select GENERIC_CLOCKEVENTS
537 select MVEBU_MBUS
538 select PCI
539 select PCI_QUIRKS
540 select PINCTRL
541 select PINCTRL_KIRKWOOD
542 select PLAT_ORION_LEGACY
543 help
544 Support for the following Marvell Kirkwood series SoCs:
545 88F6180, 88F6192 and 88F6281.
546
547config ARCH_MV78XX0 535config ARCH_MV78XX0
548 bool "Marvell MV78xx0" 536 bool "Marvell MV78xx0"
549 select ARCH_REQUIRE_GPIOLIB 537 select ARCH_REQUIRE_GPIOLIB
@@ -635,6 +623,7 @@ config ARCH_PXA
635 select AUTO_ZRELADDR 623 select AUTO_ZRELADDR
636 select CLKDEV_LOOKUP 624 select CLKDEV_LOOKUP
637 select CLKSRC_MMIO 625 select CLKSRC_MMIO
626 select CLKSRC_OF
638 select GENERIC_CLOCKEVENTS 627 select GENERIC_CLOCKEVENTS
639 select GPIO_PXA 628 select GPIO_PXA
640 select HAVE_IDE 629 select HAVE_IDE
@@ -759,61 +748,6 @@ config ARCH_S3C64XX
759 help 748 help
760 Samsung S3C64XX series based systems 749 Samsung S3C64XX series based systems
761 750
762config ARCH_S5P64X0
763 bool "Samsung S5P6440 S5P6450"
764 select ATAGS
765 select CLKDEV_LOOKUP
766 select CLKSRC_SAMSUNG_PWM
767 select CPU_V6
768 select GENERIC_CLOCKEVENTS
769 select GPIO_SAMSUNG
770 select HAVE_S3C2410_I2C if I2C
771 select HAVE_S3C2410_WATCHDOG if WATCHDOG
772 select HAVE_S3C_RTC if RTC_CLASS
773 select NEED_MACH_GPIO_H
774 select SAMSUNG_ATAGS
775 select SAMSUNG_WDT_RESET
776 help
777 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
778 SMDK6450.
779
780config ARCH_S5PC100
781 bool "Samsung S5PC100"
782 select ARCH_REQUIRE_GPIOLIB
783 select ATAGS
784 select CLKDEV_LOOKUP
785 select CLKSRC_SAMSUNG_PWM
786 select CPU_V7
787 select GENERIC_CLOCKEVENTS
788 select GPIO_SAMSUNG
789 select HAVE_S3C2410_I2C if I2C
790 select HAVE_S3C2410_WATCHDOG if WATCHDOG
791 select HAVE_S3C_RTC if RTC_CLASS
792 select NEED_MACH_GPIO_H
793 select SAMSUNG_ATAGS
794 select SAMSUNG_WDT_RESET
795 help
796 Samsung S5PC100 series based systems
797
798config ARCH_S5PV210
799 bool "Samsung S5PV210/S5PC110"
800 select ARCH_HAS_HOLES_MEMORYMODEL
801 select ARCH_SPARSEMEM_ENABLE
802 select ATAGS
803 select CLKDEV_LOOKUP
804 select CLKSRC_SAMSUNG_PWM
805 select CPU_V7
806 select GENERIC_CLOCKEVENTS
807 select GPIO_SAMSUNG
808 select HAVE_S3C2410_I2C if I2C
809 select HAVE_S3C2410_WATCHDOG if WATCHDOG
810 select HAVE_S3C_RTC if RTC_CLASS
811 select NEED_MACH_GPIO_H
812 select NEED_MACH_MEMORY_H
813 select SAMSUNG_ATAGS
814 help
815 Samsung S5PV210/S5PC110 series based systems
816
817config ARCH_DAVINCI 751config ARCH_DAVINCI
818 bool "TI DaVinci" 752 bool "TI DaVinci"
819 select ARCH_HAS_HOLES_MEMORYMODEL 753 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -952,8 +886,6 @@ source "arch/arm/mach-ixp4xx/Kconfig"
952 886
953source "arch/arm/mach-keystone/Kconfig" 887source "arch/arm/mach-keystone/Kconfig"
954 888
955source "arch/arm/mach-kirkwood/Kconfig"
956
957source "arch/arm/mach-ks8695/Kconfig" 889source "arch/arm/mach-ks8695/Kconfig"
958 890
959source "arch/arm/mach-msm/Kconfig" 891source "arch/arm/mach-msm/Kconfig"
@@ -964,6 +896,8 @@ source "arch/arm/mach-mv78xx0/Kconfig"
964 896
965source "arch/arm/mach-imx/Kconfig" 897source "arch/arm/mach-imx/Kconfig"
966 898
899source "arch/arm/mach-mediatek/Kconfig"
900
967source "arch/arm/mach-mxs/Kconfig" 901source "arch/arm/mach-mxs/Kconfig"
968 902
969source "arch/arm/mach-netx/Kconfig" 903source "arch/arm/mach-netx/Kconfig"
@@ -1005,10 +939,6 @@ source "arch/arm/mach-s3c24xx/Kconfig"
1005 939
1006source "arch/arm/mach-s3c64xx/Kconfig" 940source "arch/arm/mach-s3c64xx/Kconfig"
1007 941
1008source "arch/arm/mach-s5p64x0/Kconfig"
1009
1010source "arch/arm/mach-s5pc100/Kconfig"
1011
1012source "arch/arm/mach-s5pv210/Kconfig" 942source "arch/arm/mach-s5pv210/Kconfig"
1013 943
1014source "arch/arm/mach-exynos/Kconfig" 944source "arch/arm/mach-exynos/Kconfig"
@@ -1555,10 +1485,12 @@ config ARM_PSCI
1555config ARCH_NR_GPIO 1485config ARCH_NR_GPIO
1556 int 1486 int
1557 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1487 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1558 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX 1488 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
1489 SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
1559 default 416 if ARCH_SUNXI 1490 default 416 if ARCH_SUNXI
1560 default 392 if ARCH_U8500 1491 default 392 if ARCH_U8500
1561 default 352 if ARCH_VT8500 1492 default 352 if ARCH_VT8500
1493 default 288 if ARCH_ROCKCHIP
1562 default 264 if MACH_H4700 1494 default 264 if MACH_H4700
1563 default 0 1495 default 0
1564 help 1496 help
@@ -1570,7 +1502,7 @@ source kernel/Kconfig.preempt
1570 1502
1571config HZ_FIXED 1503config HZ_FIXED
1572 int 1504 int
1573 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \ 1505 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || \
1574 ARCH_S5PV210 || ARCH_EXYNOS4 1506 ARCH_S5PV210 || ARCH_EXYNOS4
1575 default AT91_TIMER_HZ if ARCH_AT91 1507 default AT91_TIMER_HZ if ARCH_AT91
1576 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY 1508 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY
@@ -2051,6 +1983,8 @@ config XIP_PHYS_ADDR
2051config KEXEC 1983config KEXEC
2052 bool "Kexec system call (EXPERIMENTAL)" 1984 bool "Kexec system call (EXPERIMENTAL)"
2053 depends on (!SMP || PM_SLEEP_SMP) 1985 depends on (!SMP || PM_SLEEP_SMP)
1986 select CRYPTO
1987 select CRYPTO_SHA256
2054 help 1988 help
2055 kexec is a system call that implements the ability to shutdown your 1989 kexec is a system call that implements the ability to shutdown your
2056 current kernel, and to start another kernel. It is like a reboot 1990 current kernel, and to start another kernel. It is like a reboot
@@ -2195,7 +2129,6 @@ menu "Power management options"
2195source "kernel/power/Kconfig" 2129source "kernel/power/Kconfig"
2196 2130
2197config ARCH_SUSPEND_POSSIBLE 2131config ARCH_SUSPEND_POSSIBLE
2198 depends on !ARCH_S5PC100
2199 depends on CPU_ARM920T || CPU_ARM926T || CPU_FEROCEON || CPU_SA1100 || \ 2132 depends on CPU_ARM920T || CPU_ARM926T || CPU_FEROCEON || CPU_SA1100 || \
2200 CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK 2133 CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
2201 def_bool y 2134 def_bool y
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8f90595069a1..b11ad54f8d17 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -223,6 +223,14 @@ choice
223 Say Y here if you want kernel low-level debugging support 223 Say Y here if you want kernel low-level debugging support
224 on HI3716 UART. 224 on HI3716 UART.
225 225
226 config DEBUG_HIX5HD2_UART
227 bool "Hisilicon Hix5hd2 Debug UART"
228 depends on ARCH_HIX5HD2
229 select DEBUG_UART_PL01X
230 help
231 Say Y here if you want kernel low-level debugging support
232 on Hix5hd2 UART.
233
226 config DEBUG_HIGHBANK_UART 234 config DEBUG_HIGHBANK_UART
227 bool "Kernel low-level debugging messages via Highbank UART" 235 bool "Kernel low-level debugging messages via Highbank UART"
228 depends on ARCH_HIGHBANK 236 depends on ARCH_HIGHBANK
@@ -582,7 +590,7 @@ choice
582 on Rockchip based platforms. 590 on Rockchip based platforms.
583 591
584 config DEBUG_RK3X_UART0 592 config DEBUG_RK3X_UART0
585 bool "Kernel low-level debugging messages via Rockchip RK3X UART0" 593 bool "Kernel low-level debugging messages via Rockchip RK30/RK31 UART0"
586 depends on ARCH_ROCKCHIP 594 depends on ARCH_ROCKCHIP
587 select DEBUG_UART_8250 595 select DEBUG_UART_8250
588 help 596 help
@@ -590,7 +598,7 @@ choice
590 on Rockchip based platforms. 598 on Rockchip based platforms.
591 599
592 config DEBUG_RK3X_UART1 600 config DEBUG_RK3X_UART1
593 bool "Kernel low-level debugging messages via Rockchip RK3X UART1" 601 bool "Kernel low-level debugging messages via Rockchip RK30/RK31 UART1"
594 depends on ARCH_ROCKCHIP 602 depends on ARCH_ROCKCHIP
595 select DEBUG_UART_8250 603 select DEBUG_UART_8250
596 help 604 help
@@ -598,7 +606,7 @@ choice
598 on Rockchip based platforms. 606 on Rockchip based platforms.
599 607
600 config DEBUG_RK3X_UART2 608 config DEBUG_RK3X_UART2
601 bool "Kernel low-level debugging messages via Rockchip RK3X UART2" 609 bool "Kernel low-level debugging messages via Rockchip RK30/RK31 UART2"
602 depends on ARCH_ROCKCHIP 610 depends on ARCH_ROCKCHIP
603 select DEBUG_UART_8250 611 select DEBUG_UART_8250
604 help 612 help
@@ -606,64 +614,64 @@ choice
606 on Rockchip based platforms. 614 on Rockchip based platforms.
607 615
608 config DEBUG_RK3X_UART3 616 config DEBUG_RK3X_UART3
609 bool "Kernel low-level debugging messages via Rockchip RK3X UART3" 617 bool "Kernel low-level debugging messages via Rockchip RK30/RK31 UART3"
610 depends on ARCH_ROCKCHIP 618 depends on ARCH_ROCKCHIP
611 select DEBUG_UART_8250 619 select DEBUG_UART_8250
612 help 620 help
613 Say Y here if you want kernel low-level debugging support 621 Say Y here if you want kernel low-level debugging support
614 on Rockchip based platforms. 622 on Rockchip based platforms.
615 623
624 config DEBUG_RK32_UART2
625 bool "Kernel low-level debugging messages via Rockchip RK32 UART2"
626 depends on ARCH_ROCKCHIP
627 select DEBUG_UART_8250
628 help
629 Say Y here if you want kernel low-level debugging support
630 on Rockchip RK32xx based platforms.
631
616 config DEBUG_S3C_UART0 632 config DEBUG_S3C_UART0
617 depends on PLAT_SAMSUNG 633 depends on PLAT_SAMSUNG
618 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 634 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
619 select DEBUG_S3C24XX_UART if ARCH_S3C24XX 635 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
620 bool "Use S3C UART 0 for low-level debug" 636 select DEBUG_S5PV210_UART if ARCH_S5PV210
637 bool "Use Samsung S3C UART 0 for low-level debug"
621 help 638 help
622 Say Y here if you want the debug print routines to direct 639 Say Y here if you want the debug print routines to direct
623 their output to UART 0. The port must have been initialised 640 their output to UART 0. The port must have been initialised
624 by the boot-loader before use. 641 by the boot-loader before use.
625 642
626 The uncompressor code port configuration is now handled
627 by CONFIG_S3C_LOWLEVEL_UART_PORT.
628
629 config DEBUG_S3C_UART1 643 config DEBUG_S3C_UART1
630 depends on PLAT_SAMSUNG 644 depends on PLAT_SAMSUNG
631 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 645 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
632 select DEBUG_S3C24XX_UART if ARCH_S3C24XX 646 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
633 bool "Use S3C UART 1 for low-level debug" 647 select DEBUG_S5PV210_UART if ARCH_S5PV210
648 bool "Use Samsung S3C UART 1 for low-level debug"
634 help 649 help
635 Say Y here if you want the debug print routines to direct 650 Say Y here if you want the debug print routines to direct
636 their output to UART 1. The port must have been initialised 651 their output to UART 1. The port must have been initialised
637 by the boot-loader before use. 652 by the boot-loader before use.
638 653
639 The uncompressor code port configuration is now handled
640 by CONFIG_S3C_LOWLEVEL_UART_PORT.
641
642 config DEBUG_S3C_UART2 654 config DEBUG_S3C_UART2
643 depends on PLAT_SAMSUNG 655 depends on PLAT_SAMSUNG
644 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 656 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
645 select DEBUG_S3C24XX_UART if ARCH_S3C24XX 657 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
646 bool "Use S3C UART 2 for low-level debug" 658 select DEBUG_S5PV210_UART if ARCH_S5PV210
659 bool "Use Samsung S3C UART 2 for low-level debug"
647 help 660 help
648 Say Y here if you want the debug print routines to direct 661 Say Y here if you want the debug print routines to direct
649 their output to UART 2. The port must have been initialised 662 their output to UART 2. The port must have been initialised
650 by the boot-loader before use. 663 by the boot-loader before use.
651 664
652 The uncompressor code port configuration is now handled
653 by CONFIG_S3C_LOWLEVEL_UART_PORT.
654
655 config DEBUG_S3C_UART3 665 config DEBUG_S3C_UART3
656 depends on PLAT_SAMSUNG && ARCH_EXYNOS 666 depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210)
657 select DEBUG_EXYNOS_UART 667 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
658 bool "Use S3C UART 3 for low-level debug" 668 select DEBUG_S5PV210_UART if ARCH_S5PV210
669 bool "Use Samsung S3C UART 3 for low-level debug"
659 help 670 help
660 Say Y here if you want the debug print routines to direct 671 Say Y here if you want the debug print routines to direct
661 their output to UART 3. The port must have been initialised 672 their output to UART 3. The port must have been initialised
662 by the boot-loader before use. 673 by the boot-loader before use.
663 674
664 The uncompressor code port configuration is now handled
665 by CONFIG_S3C_LOWLEVEL_UART_PORT.
666
667 config DEBUG_S3C2410_UART0 675 config DEBUG_S3C2410_UART0
668 depends on ARCH_S3C24XX 676 depends on ARCH_S3C24XX
669 select DEBUG_S3C2410_UART 677 select DEBUG_S3C2410_UART
@@ -715,6 +723,14 @@ choice
715 Say Y here if you want kernel low-level debugging support 723 Say Y here if you want kernel low-level debugging support
716 on Allwinner A1X based platforms on the UART1. 724 on Allwinner A1X based platforms on the UART1.
717 725
726 config DEBUG_SUNXI_R_UART
727 bool "Kernel low-level debugging messages via sunXi R_UART"
728 depends on MACH_SUN6I || MACH_SUN8I
729 select DEBUG_UART_8250
730 help
731 Say Y here if you want kernel low-level debugging support
732 on Allwinner A31/A23 based platforms on the R_UART.
733
718 config TEGRA_DEBUG_UART_AUTO_ODMDATA 734 config TEGRA_DEBUG_UART_AUTO_ODMDATA
719 bool "Kernel low-level debugging messages via Tegra UART via ODMDATA" 735 bool "Kernel low-level debugging messages via Tegra UART via ODMDATA"
720 depends on ARCH_TEGRA 736 depends on ARCH_TEGRA
@@ -949,6 +965,9 @@ config DEBUG_S3C2410_UART
949config DEBUG_S3C24XX_UART 965config DEBUG_S3C24XX_UART
950 bool 966 bool
951 967
968config DEBUG_S5PV210_UART
969 bool
970
952config DEBUG_OMAP2PLUS_UART 971config DEBUG_OMAP2PLUS_UART
953 bool 972 bool
954 depends on ARCH_OMAP2PLUS 973 depends on ARCH_OMAP2PLUS
@@ -991,6 +1010,7 @@ config DEBUG_STI_UART
991config DEBUG_LL_INCLUDE 1010config DEBUG_LL_INCLUDE
992 string 1011 string
993 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 1012 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
1013 default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2
994 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X 1014 default "debug/pl01x.S" if DEBUG_LL_UART_PL01X || DEBUG_UART_PL01X
995 default "debug/exynos.S" if DEBUG_EXYNOS_UART 1015 default "debug/exynos.S" if DEBUG_EXYNOS_UART
996 default "debug/efm32.S" if DEBUG_LL_UART_EFM32 1016 default "debug/efm32.S" if DEBUG_LL_UART_EFM32
@@ -1009,6 +1029,7 @@ config DEBUG_LL_INCLUDE
1009 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM 1029 default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM
1010 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1030 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1011 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART 1031 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
1032 default "debug/s5pv210.S" if DEBUG_S5PV210_UART
1012 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 1033 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
1013 default "debug/sti.S" if DEBUG_STI_UART 1034 default "debug/sti.S" if DEBUG_STI_UART
1014 default "debug/tegra.S" if DEBUG_TEGRA_UART 1035 default "debug/tegra.S" if DEBUG_TEGRA_UART
@@ -1033,7 +1054,7 @@ config DEBUG_UART_8250
1033 def_bool ARCH_DOVE || ARCH_EBSA110 || \ 1054 def_bool ARCH_DOVE || ARCH_EBSA110 || \
1034 (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \ 1055 (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \
1035 ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \ 1056 ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \
1036 ARCH_IOP33X || ARCH_IXP4XX || ARCH_KIRKWOOD || \ 1057 ARCH_IOP33X || ARCH_IXP4XX || \
1037 ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC 1058 ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC
1038 1059
1039config DEBUG_UART_PHYS 1060config DEBUG_UART_PHYS
@@ -1043,6 +1064,7 @@ config DEBUG_UART_PHYS
1043 default 0x01c28400 if DEBUG_SUNXI_UART1 1064 default 0x01c28400 if DEBUG_SUNXI_UART1
1044 default 0x01d0c000 if DEBUG_DAVINCI_DA8XX_UART1 1065 default 0x01d0c000 if DEBUG_DAVINCI_DA8XX_UART1
1045 default 0x01d0d000 if DEBUG_DAVINCI_DA8XX_UART2 1066 default 0x01d0d000 if DEBUG_DAVINCI_DA8XX_UART2
1067 default 0x01f02800 if DEBUG_SUNXI_R_UART
1046 default 0x02530c00 if DEBUG_KEYSTONE_UART0 1068 default 0x02530c00 if DEBUG_KEYSTONE_UART0
1047 default 0x02531000 if DEBUG_KEYSTONE_UART1 1069 default 0x02531000 if DEBUG_KEYSTONE_UART1
1048 default 0x03010fe0 if ARCH_RPC 1070 default 0x03010fe0 if ARCH_RPC
@@ -1089,13 +1111,14 @@ config DEBUG_UART_PHYS
1089 default 0xe0000000 if ARCH_SPEAR13XX 1111 default 0xe0000000 if ARCH_SPEAR13XX
1090 default 0xf0000be0 if ARCH_EBSA110 1112 default 0xf0000be0 if ARCH_EBSA110
1091 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1113 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
1092 default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \ 1114 default 0xf1012000 if ARCH_DOVE || ARCH_MV78XX0 || \
1093 ARCH_ORION5X 1115 ARCH_ORION5X
1094 default 0xf7fc9000 if DEBUG_BERLIN_UART 1116 default 0xf7fc9000 if DEBUG_BERLIN_UART
1095 default 0xf8b00000 if DEBUG_HI3716_UART 1117 default 0xf8b00000 if DEBUG_HIX5HD2_UART
1096 default 0xf991e000 if DEBUG_QCOM_UARTDM 1118 default 0xf991e000 if DEBUG_QCOM_UARTDM
1097 default 0xfcb00000 if DEBUG_HI3620_UART 1119 default 0xfcb00000 if DEBUG_HI3620_UART
1098 default 0xfe800000 if ARCH_IOP32X 1120 default 0xfe800000 if ARCH_IOP32X
1121 default 0xff690000 if DEBUG_RK32_UART2
1099 default 0xffc02000 if DEBUG_SOCFPGA_UART 1122 default 0xffc02000 if DEBUG_SOCFPGA_UART
1100 default 0xffd82340 if ARCH_IOP13XX 1123 default 0xffd82340 if ARCH_IOP13XX
1101 default 0xfff36000 if DEBUG_HIGHBANK_UART 1124 default 0xfff36000 if DEBUG_HIGHBANK_UART
@@ -1118,6 +1141,7 @@ config DEBUG_UART_VIRT
1118 default 0xf1600000 if ARCH_INTEGRATOR 1141 default 0xf1600000 if ARCH_INTEGRATOR
1119 default 0xf1c28000 if DEBUG_SUNXI_UART0 1142 default 0xf1c28000 if DEBUG_SUNXI_UART0
1120 default 0xf1c28400 if DEBUG_SUNXI_UART1 1143 default 0xf1c28400 if DEBUG_SUNXI_UART1
1144 default 0xf1f02800 if DEBUG_SUNXI_R_UART
1121 default 0xf2100000 if DEBUG_PXA_UART1 1145 default 0xf2100000 if DEBUG_PXA_UART1
1122 default 0xf4090000 if ARCH_LPC32XX 1146 default 0xf4090000 if ARCH_LPC32XX
1123 default 0xf4200000 if ARCH_GEMINI 1147 default 0xf4200000 if ARCH_GEMINI
@@ -1144,7 +1168,7 @@ config DEBUG_UART_VIRT
1144 default 0xfe230000 if DEBUG_PICOXCELL_UART 1168 default 0xfe230000 if DEBUG_PICOXCELL_UART
1145 default 0xfe300000 if DEBUG_BCM_KONA_UART 1169 default 0xfe300000 if DEBUG_BCM_KONA_UART
1146 default 0xfe800000 if ARCH_IOP32X 1170 default 0xfe800000 if ARCH_IOP32X
1147 default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HI3716_UART 1171 default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HIX5HD2_UART
1148 default 0xfeb24000 if DEBUG_RK3X_UART0 1172 default 0xfeb24000 if DEBUG_RK3X_UART0
1149 default 0xfeb26000 if DEBUG_RK3X_UART1 1173 default 0xfeb26000 if DEBUG_RK3X_UART1
1150 default 0xfeb30c00 if DEBUG_KEYSTONE_UART0 1174 default 0xfeb30c00 if DEBUG_KEYSTONE_UART0
@@ -1152,9 +1176,9 @@ config DEBUG_UART_VIRT
1152 default 0xfec02000 if DEBUG_SOCFPGA_UART 1176 default 0xfec02000 if DEBUG_SOCFPGA_UART
1153 default 0xfec12000 if DEBUG_MVEBU_UART || DEBUG_MVEBU_UART_ALTERNATE 1177 default 0xfec12000 if DEBUG_MVEBU_UART || DEBUG_MVEBU_UART_ALTERNATE
1154 default 0xfec20000 if DEBUG_DAVINCI_DMx_UART0 1178 default 0xfec20000 if DEBUG_DAVINCI_DMx_UART0
1179 default 0xfec90000 if DEBUG_RK32_UART2
1155 default 0xfed0c000 if DEBUG_DAVINCI_DA8XX_UART1 1180 default 0xfed0c000 if DEBUG_DAVINCI_DA8XX_UART1
1156 default 0xfed0d000 if DEBUG_DAVINCI_DA8XX_UART2 1181 default 0xfed0d000 if DEBUG_DAVINCI_DA8XX_UART2
1157 default 0xfed12000 if ARCH_KIRKWOOD
1158 default 0xfed60000 if DEBUG_RK29_UART0 1182 default 0xfed60000 if DEBUG_RK29_UART0
1159 default 0xfed64000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 1183 default 0xfed64000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
1160 default 0xfed68000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3 1184 default 0xfed68000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
@@ -1186,7 +1210,7 @@ config DEBUG_UART_8250_WORD
1186 ARCH_KEYSTONE || \ 1210 ARCH_KEYSTONE || \
1187 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ 1211 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
1188 DEBUG_DAVINCI_DA8XX_UART2 || \ 1212 DEBUG_DAVINCI_DA8XX_UART2 || \
1189 DEBUG_BCM_KONA_UART 1213 DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2
1190 1214
1191config DEBUG_UART_8250_FLOW_CONTROL 1215config DEBUG_UART_8250_FLOW_CONTROL
1192 bool "Enable flow control for 8250 UART" 1216 bool "Enable flow control for 8250 UART"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 6721fab13734..0ce9d0f71f2a 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -127,6 +127,9 @@ CHECKFLAGS += -D__arm__
127 127
128#Default value 128#Default value
129head-y := arch/arm/kernel/head$(MMUEXT).o 129head-y := arch/arm/kernel/head$(MMUEXT).o
130
131# Text offset. This list is sorted numerically by address in order to
132# provide a means to avoid/resolve conflicts in multi-arch kernels.
130textofs-y := 0x00008000 133textofs-y := 0x00008000
131textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 134textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
132# We don't want the htc bootloader to corrupt kernel during resume 135# We don't want the htc bootloader to corrupt kernel during resume
@@ -156,14 +159,13 @@ machine-$(CONFIG_ARCH_EP93XX) += ep93xx
156machine-$(CONFIG_ARCH_EXYNOS) += exynos 159machine-$(CONFIG_ARCH_EXYNOS) += exynos
157machine-$(CONFIG_ARCH_GEMINI) += gemini 160machine-$(CONFIG_ARCH_GEMINI) += gemini
158machine-$(CONFIG_ARCH_HIGHBANK) += highbank 161machine-$(CONFIG_ARCH_HIGHBANK) += highbank
159machine-$(CONFIG_ARCH_HI3xxx) += hisi 162machine-$(CONFIG_ARCH_HISI) += hisi
160machine-$(CONFIG_ARCH_INTEGRATOR) += integrator 163machine-$(CONFIG_ARCH_INTEGRATOR) += integrator
161machine-$(CONFIG_ARCH_IOP13XX) += iop13xx 164machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
162machine-$(CONFIG_ARCH_IOP32X) += iop32x 165machine-$(CONFIG_ARCH_IOP32X) += iop32x
163machine-$(CONFIG_ARCH_IOP33X) += iop33x 166machine-$(CONFIG_ARCH_IOP33X) += iop33x
164machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx 167machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx
165machine-$(CONFIG_ARCH_KEYSTONE) += keystone 168machine-$(CONFIG_ARCH_KEYSTONE) += keystone
166machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood
167machine-$(CONFIG_ARCH_KS8695) += ks8695 169machine-$(CONFIG_ARCH_KS8695) += ks8695
168machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx 170machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
169machine-$(CONFIG_ARCH_MMP) += mmp 171machine-$(CONFIG_ARCH_MMP) += mmp
@@ -172,6 +174,7 @@ machine-$(CONFIG_ARCH_MSM) += msm
172machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 174machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0
173machine-$(CONFIG_ARCH_MVEBU) += mvebu 175machine-$(CONFIG_ARCH_MVEBU) += mvebu
174machine-$(CONFIG_ARCH_MXC) += imx 176machine-$(CONFIG_ARCH_MXC) += imx
177machine-$(CONFIG_ARCH_MEDIATEK) += mediatek
175machine-$(CONFIG_ARCH_MXS) += mxs 178machine-$(CONFIG_ARCH_MXS) += mxs
176machine-$(CONFIG_ARCH_NETX) += netx 179machine-$(CONFIG_ARCH_NETX) += netx
177machine-$(CONFIG_ARCH_NOMADIK) += nomadik 180machine-$(CONFIG_ARCH_NOMADIK) += nomadik
@@ -187,8 +190,6 @@ machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip
187machine-$(CONFIG_ARCH_RPC) += rpc 190machine-$(CONFIG_ARCH_RPC) += rpc
188machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx 191machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx
189machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx 192machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
190machine-$(CONFIG_ARCH_S5P64X0) += s5p64x0
191machine-$(CONFIG_ARCH_S5PC100) += s5pc100
192machine-$(CONFIG_ARCH_S5PV210) += s5pv210 193machine-$(CONFIG_ARCH_S5PV210) += s5pv210
193machine-$(CONFIG_ARCH_SA1100) += sa1100 194machine-$(CONFIG_ARCH_SA1100) += sa1100
194machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 195machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
@@ -212,11 +213,11 @@ machine-$(CONFIG_PLAT_SPEAR) += spear
212plat-$(CONFIG_ARCH_EXYNOS) += samsung 213plat-$(CONFIG_ARCH_EXYNOS) += samsung
213plat-$(CONFIG_ARCH_OMAP) += omap 214plat-$(CONFIG_ARCH_OMAP) += omap
214plat-$(CONFIG_ARCH_S3C64XX) += samsung 215plat-$(CONFIG_ARCH_S3C64XX) += samsung
216plat-$(CONFIG_ARCH_S5PV210) += samsung
215plat-$(CONFIG_PLAT_IOP) += iop 217plat-$(CONFIG_PLAT_IOP) += iop
216plat-$(CONFIG_PLAT_ORION) += orion 218plat-$(CONFIG_PLAT_ORION) += orion
217plat-$(CONFIG_PLAT_PXA) += pxa 219plat-$(CONFIG_PLAT_PXA) += pxa
218plat-$(CONFIG_PLAT_S3C24XX) += samsung 220plat-$(CONFIG_PLAT_S3C24XX) += samsung
219plat-$(CONFIG_PLAT_S5P) += samsung
220plat-$(CONFIG_PLAT_VERSATILE) += versatile 221plat-$(CONFIG_PLAT_VERSATILE) += versatile
221 222
222ifeq ($(CONFIG_ARCH_EBSA110),y) 223ifeq ($(CONFIG_ARCH_EBSA110),y)
@@ -240,7 +241,7 @@ MACHINE :=
240endif 241endif
241 242
242machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) 243machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
243platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y)) 244platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y)))
244 245
245ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y) 246ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
246ifeq ($(KBUILD_SRC),) 247ifeq ($(KBUILD_SRC),)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 68c918362b79..76a50ecae1c3 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -81,7 +81,7 @@ ZTEXTADDR := 0
81ZBSSADDR := ALIGN(8) 81ZBSSADDR := ALIGN(8)
82endif 82endif
83 83
84SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 84CPPFLAGS_vmlinux.lds := -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
85 85
86suffix_$(CONFIG_KERNEL_GZIP) = gzip 86suffix_$(CONFIG_KERNEL_GZIP) = gzip
87suffix_$(CONFIG_KERNEL_LZO) = lzo 87suffix_$(CONFIG_KERNEL_LZO) = lzo
@@ -199,8 +199,5 @@ CFLAGS_font.o := -Dstatic=
199$(obj)/font.c: $(FONTC) 199$(obj)/font.c: $(FONTC)
200 $(call cmd,shipped) 200 $(call cmd,shipped)
201 201
202$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
203 @sed "$(SEDFLAGS)" < $< > $@
204
205$(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S 202$(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S
206 $(call cmd,shipped) 203 $(call cmd,shipped)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3a8b32df6b31..413fd94b5301 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -125,9 +125,11 @@ start:
125 THUMB( adr r12, BSYM(1f) ) 125 THUMB( adr r12, BSYM(1f) )
126 THUMB( bx r12 ) 126 THUMB( bx r12 )
127 127
128 .word 0x016f2818 @ Magic numbers to help the loader 128 .word _magic_sig @ Magic numbers to help the loader
129 .word start @ absolute load/run zImage address 129 .word _magic_start @ absolute load/run zImage address
130 .word _edata @ zImage end address 130 .word _magic_end @ zImage end address
131 .word 0x04030201 @ endianness flag
132
131 THUMB( .thumb ) 133 THUMB( .thumb )
1321: 1341:
133 ARM_BE8( setend be ) @ go BE8 if compiled for BE8 135 ARM_BE8( setend be ) @ go BE8 if compiled for BE8
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.S
index 4919f2ac8b89..2b60b843ac5e 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -1,12 +1,20 @@
1/* 1/*
2 * linux/arch/arm/boot/compressed/vmlinux.lds.in
3 *
4 * Copyright (C) 2000 Russell King 2 * Copyright (C) 2000 Russell King
5 * 3 *
6 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
7 * 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
8 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
9 */ 7 */
8
9#ifdef CONFIG_CPU_ENDIAN_BE8
10#define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
11 (((x) >> 8) & 0x0000ff00) | \
12 (((x) << 8) & 0x00ff0000) | \
13 (((x) << 24) & 0xff000000) )
14#else
15#define ZIMAGE_MAGIC(x) (x)
16#endif
17
10OUTPUT_ARCH(arm) 18OUTPUT_ARCH(arm)
11ENTRY(_start) 19ENTRY(_start)
12SECTIONS 20SECTIONS
@@ -57,6 +65,10 @@ SECTIONS
57 .pad : { BYTE(0); . = ALIGN(8); } 65 .pad : { BYTE(0); . = ALIGN(8); }
58 _edata = .; 66 _edata = .;
59 67
68 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
69 _magic_start = ZIMAGE_MAGIC(_start);
70 _magic_end = ZIMAGE_MAGIC(_edata);
71
60 . = BSS_START; 72 . = BSS_START;
61 __bss_start = .; 73 __bss_start = .;
62 .bss : { *(.bss) } 74 .bss : { *(.bss) }
@@ -73,4 +85,3 @@ SECTIONS
73 .stab.indexstr 0 : { *(.stab.indexstr) } 85 .stab.indexstr 0 : { *(.stab.indexstr) }
74 .comment 0 : { *(.comment) } 86 .comment 0 : { *(.comment) }
75} 87}
76
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index adb5ed9e269e..b8c5cd3ddeb9 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -59,6 +59,8 @@ dtb-$(CONFIG_ARCH_BERLIN) += \
59 berlin2-sony-nsz-gs7.dtb \ 59 berlin2-sony-nsz-gs7.dtb \
60 berlin2cd-google-chromecast.dtb \ 60 berlin2cd-google-chromecast.dtb \
61 berlin2q-marvell-dmp.dtb 61 berlin2q-marvell-dmp.dtb
62dtb-$(CONFIG_ARCH_BRCMSTB) += \
63 bcm7445-bcm97445svmb.dtb
62dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 64dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
63 da850-evm.dtb 65 da850-evm.dtb
64dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb 66dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb
@@ -66,7 +68,9 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
66 exynos4210-smdkv310.dtb \ 68 exynos4210-smdkv310.dtb \
67 exynos4210-trats.dtb \ 69 exynos4210-trats.dtb \
68 exynos4210-universal_c210.dtb \ 70 exynos4210-universal_c210.dtb \
71 exynos4412-odroidu3.dtb \
69 exynos4412-odroidx.dtb \ 72 exynos4412-odroidx.dtb \
73 exynos4412-odroidx2.dtb \
70 exynos4412-origen.dtb \ 74 exynos4412-origen.dtb \
71 exynos4412-smdk4412.dtb \ 75 exynos4412-smdk4412.dtb \
72 exynos4412-tiny4412.dtb \ 76 exynos4412-tiny4412.dtb \
@@ -83,6 +87,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
83 exynos5440-ssdk5440.dtb \ 87 exynos5440-ssdk5440.dtb \
84 exynos5800-peach-pi.dtb 88 exynos5800-peach-pi.dtb
85dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb 89dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
90dtb-$(CONFIG_ARCH_HIX5HD2) += hisi-x5hd2-dkb.dtb
86dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ 91dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
87 ecx-2000.dtb 92 ecx-2000.dtb
88dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 93dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
@@ -90,9 +95,9 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
90dtb-$(CONFIG_ARCH_KEYSTONE) += k2hk-evm.dtb \ 95dtb-$(CONFIG_ARCH_KEYSTONE) += k2hk-evm.dtb \
91 k2l-evm.dtb \ 96 k2l-evm.dtb \
92 k2e-evm.dtb 97 k2e-evm.dtb
93kirkwood := \ 98dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood-b3.dtb \
94 kirkwood-b3.dtb \
95 kirkwood-cloudbox.dtb \ 99 kirkwood-cloudbox.dtb \
100 kirkwood-d2net.dtb \
96 kirkwood-db-88f6281.dtb \ 101 kirkwood-db-88f6281.dtb \
97 kirkwood-db-88f6282.dtb \ 102 kirkwood-db-88f6282.dtb \
98 kirkwood-dns320.dtb \ 103 kirkwood-dns320.dtb \
@@ -123,6 +128,8 @@ kirkwood := \
123 kirkwood-lsxhl.dtb \ 128 kirkwood-lsxhl.dtb \
124 kirkwood-mplcec4.dtb \ 129 kirkwood-mplcec4.dtb \
125 kirkwood-mv88f6281gtw-ge.dtb \ 130 kirkwood-mv88f6281gtw-ge.dtb \
131 kirkwood-net2big.dtb \
132 kirkwood-net5big.dtb \
126 kirkwood-netgear_readynas_duo_v2.dtb \ 133 kirkwood-netgear_readynas_duo_v2.dtb \
127 kirkwood-netgear_readynas_nv+_v2.dtb \ 134 kirkwood-netgear_readynas_nv+_v2.dtb \
128 kirkwood-ns2.dtb \ 135 kirkwood-ns2.dtb \
@@ -150,17 +157,19 @@ kirkwood := \
150 kirkwood-ts219-6282.dtb \ 157 kirkwood-ts219-6282.dtb \
151 kirkwood-ts419-6281.dtb \ 158 kirkwood-ts419-6281.dtb \
152 kirkwood-ts419-6282.dtb 159 kirkwood-ts419-6282.dtb
153dtb-$(CONFIG_ARCH_KIRKWOOD) += $(kirkwood)
154dtb-$(CONFIG_MACH_KIRKWOOD) += $(kirkwood)
155dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 160dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
156dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb 161dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
157dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb 162dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
158dtb-$(CONFIG_ARCH_MXC) += \ 163dtb-$(CONFIG_ARCH_MXC) += \
159 imx25-eukrea-mbimxsd25-baseboard.dtb \ 164 imx25-eukrea-mbimxsd25-baseboard.dtb \
165 imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dtb \
166 imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dtb \
167 imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dtb \
160 imx25-karo-tx25.dtb \ 168 imx25-karo-tx25.dtb \
161 imx25-pdk.dtb \ 169 imx25-pdk.dtb \
162 imx27-apf27.dtb \ 170 imx27-apf27.dtb \
163 imx27-apf27dev.dtb \ 171 imx27-apf27dev.dtb \
172 imx27-eukrea-mbimxsd27-baseboard.dtb \
164 imx27-pdk.dtb \ 173 imx27-pdk.dtb \
165 imx27-phytec-phycore-rdk.dtb \ 174 imx27-phytec-phycore-rdk.dtb \
166 imx27-phytec-phycard-s-rdk.dtb \ 175 imx27-phytec-phycard-s-rdk.dtb \
@@ -182,6 +191,8 @@ dtb-$(CONFIG_ARCH_MXC) += \
182 imx53-tx53-x03x.dtb \ 191 imx53-tx53-x03x.dtb \
183 imx53-tx53-x13x.dtb \ 192 imx53-tx53-x13x.dtb \
184 imx53-voipac-bsb.dtb \ 193 imx53-voipac-bsb.dtb \
194 imx6dl-aristainetos_4.dtb \
195 imx6dl-aristainetos_7.dtb \
185 imx6dl-cubox-i.dtb \ 196 imx6dl-cubox-i.dtb \
186 imx6dl-dfi-fs700-m60.dtb \ 197 imx6dl-dfi-fs700-m60.dtb \
187 imx6dl-gw51xx.dtb \ 198 imx6dl-gw51xx.dtb \
@@ -191,11 +202,16 @@ dtb-$(CONFIG_ARCH_MXC) += \
191 imx6dl-hummingboard.dtb \ 202 imx6dl-hummingboard.dtb \
192 imx6dl-nitrogen6x.dtb \ 203 imx6dl-nitrogen6x.dtb \
193 imx6dl-phytec-pbab01.dtb \ 204 imx6dl-phytec-pbab01.dtb \
205 imx6dl-rex-basic.dtb \
194 imx6dl-riotboard.dtb \ 206 imx6dl-riotboard.dtb \
195 imx6dl-sabreauto.dtb \ 207 imx6dl-sabreauto.dtb \
196 imx6dl-sabrelite.dtb \ 208 imx6dl-sabrelite.dtb \
197 imx6dl-sabresd.dtb \ 209 imx6dl-sabresd.dtb \
210 imx6dl-tx6dl-comtft.dtb \
211 imx6dl-tx6u-801x.dtb \
212 imx6dl-tx6u-811x.dtb \
198 imx6dl-wandboard.dtb \ 213 imx6dl-wandboard.dtb \
214 imx6dl-wandboard-revb1.dtb \
199 imx6q-arm2.dtb \ 215 imx6q-arm2.dtb \
200 imx6q-cm-fx6.dtb \ 216 imx6q-cm-fx6.dtb \
201 imx6q-cubox-i.dtb \ 217 imx6q-cubox-i.dtb \
@@ -209,13 +225,21 @@ dtb-$(CONFIG_ARCH_MXC) += \
209 imx6q-gw54xx.dtb \ 225 imx6q-gw54xx.dtb \
210 imx6q-nitrogen6x.dtb \ 226 imx6q-nitrogen6x.dtb \
211 imx6q-phytec-pbab01.dtb \ 227 imx6q-phytec-pbab01.dtb \
228 imx6q-rex-pro.dtb \
212 imx6q-sabreauto.dtb \ 229 imx6q-sabreauto.dtb \
213 imx6q-sabrelite.dtb \ 230 imx6q-sabrelite.dtb \
214 imx6q-sabresd.dtb \ 231 imx6q-sabresd.dtb \
215 imx6q-sbc6x.dtb \ 232 imx6q-sbc6x.dtb \
216 imx6q-udoo.dtb \ 233 imx6q-udoo.dtb \
217 imx6q-wandboard.dtb \ 234 imx6q-wandboard.dtb \
235 imx6q-wandboard-revb1.dtb \
236 imx6q-tx6q-1010.dtb \
237 imx6q-tx6q-1010-comtft.dtb \
238 imx6q-tx6q-1020.dtb \
239 imx6q-tx6q-1020-comtft.dtb \
240 imx6q-tx6q-1110.dtb \
218 imx6sl-evk.dtb \ 241 imx6sl-evk.dtb \
242 imx6sx-sdb.dtb \
219 vf610-colibri.dtb \ 243 vf610-colibri.dtb \
220 vf610-cosmic.dtb \ 244 vf610-cosmic.dtb \
221 vf610-twr.dtb 245 vf610-twr.dtb
@@ -291,7 +315,8 @@ dtb-$(CONFIG_SOC_AM33XX) += am335x-base0033.dtb \
291 am335x-boneblack.dtb \ 315 am335x-boneblack.dtb \
292 am335x-evm.dtb \ 316 am335x-evm.dtb \
293 am335x-evmsk.dtb \ 317 am335x-evmsk.dtb \
294 am335x-nano.dtb 318 am335x-nano.dtb \
319 am335x-pepper.dtb
295dtb-$(CONFIG_ARCH_OMAP4) += omap4-duovero-parlor.dtb \ 320dtb-$(CONFIG_ARCH_OMAP4) += omap4-duovero-parlor.dtb \
296 omap4-panda.dtb \ 321 omap4-panda.dtb \
297 omap4-panda-a4.dtb \ 322 omap4-panda-a4.dtb \
@@ -301,6 +326,7 @@ dtb-$(CONFIG_ARCH_OMAP4) += omap4-duovero-parlor.dtb \
301 omap4-var-dvk-om44.dtb \ 326 omap4-var-dvk-om44.dtb \
302 omap4-var-stk-om44.dtb 327 omap4-var-stk-om44.dtb
303dtb-$(CONFIG_SOC_AM43XX) += am43x-epos-evm.dtb \ 328dtb-$(CONFIG_SOC_AM43XX) += am43x-epos-evm.dtb \
329 am437x-sk-evm.dtb \
304 am437x-gp-evm.dtb 330 am437x-gp-evm.dtb
305dtb-$(CONFIG_SOC_OMAP5) += omap5-cm-t54.dtb \ 331dtb-$(CONFIG_SOC_OMAP5) += omap5-cm-t54.dtb \
306 omap5-sbc-t54.dtb \ 332 omap5-sbc-t54.dtb \
@@ -318,16 +344,25 @@ dtb-$(CONFIG_ARCH_QCOM) += \
318 qcom-apq8084-mtp.dtb \ 344 qcom-apq8084-mtp.dtb \
319 qcom-msm8660-surf.dtb \ 345 qcom-msm8660-surf.dtb \
320 qcom-msm8960-cdp.dtb 346 qcom-msm8960-cdp.dtb
347dtb-$(CONFIG_ARCH_ROCKCHIP) += \
348 rk3066a-bqcurie2.dtb \
349 rk3188-radxarock.dtb \
350 rk3288-evb-act8846.dtb \
351 rk3288-evb-rk808.dtb
321dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb 352dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
322dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \ 353dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
323 s3c6410-smdk6410.dtb 354 s3c6410-smdk6410.dtb
355dtb-$(CONFIG_ARCH_S5PV210) += s5pv210-aquila.dtb \
356 s5pv210-goni.dtb \
357 s5pv210-smdkc110.dtb \
358 s5pv210-smdkv210.dtb \
359 s5pv210-torbreck.dtb
324dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \ 360dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
325 r8a7740-armadillo800eva.dtb \ 361 r8a7740-armadillo800eva.dtb \
326 r8a7778-bockw.dtb \ 362 r8a7778-bockw.dtb \
327 r8a7778-bockw-reference.dtb \ 363 r8a7778-bockw-reference.dtb \
328 r8a7740-armadillo800eva-reference.dtb \ 364 r8a7740-armadillo800eva-reference.dtb \
329 r8a7779-marzen.dtb \ 365 r8a7779-marzen.dtb \
330 r8a7779-marzen-reference.dtb \
331 r8a7791-koelsch.dtb \ 366 r8a7791-koelsch.dtb \
332 r8a7790-lager.dtb \ 367 r8a7790-lager.dtb \
333 sh73a0-kzm9g.dtb \ 368 sh73a0-kzm9g.dtb \
@@ -339,7 +374,8 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
339 r7s72100-genmai.dtb \ 374 r7s72100-genmai.dtb \
340 r8a7791-henninger.dtb \ 375 r8a7791-henninger.dtb \
341 r8a7791-koelsch.dtb \ 376 r8a7791-koelsch.dtb \
342 r8a7790-lager.dtb 377 r8a7790-lager.dtb \
378 r8a7779-marzen.dtb
343dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \ 379dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
344 socfpga_cyclone5_socdk.dtb \ 380 socfpga_cyclone5_socdk.dtb \
345 socfpga_cyclone5_sockit.dtb \ 381 socfpga_cyclone5_sockit.dtb \
@@ -360,6 +396,7 @@ dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \
360 stih416-b2020e.dtb 396 stih416-b2020e.dtb
361dtb-$(CONFIG_MACH_SUN4I) += \ 397dtb-$(CONFIG_MACH_SUN4I) += \
362 sun4i-a10-a1000.dtb \ 398 sun4i-a10-a1000.dtb \
399 sun4i-a10-ba10-tvbox.dtb \
363 sun4i-a10-cubieboard.dtb \ 400 sun4i-a10-cubieboard.dtb \
364 sun4i-a10-mini-xplus.dtb \ 401 sun4i-a10-mini-xplus.dtb \
365 sun4i-a10-hackberry.dtb \ 402 sun4i-a10-hackberry.dtb \
@@ -374,12 +411,16 @@ dtb-$(CONFIG_MACH_SUN5I) += \
374dtb-$(CONFIG_MACH_SUN6I) += \ 411dtb-$(CONFIG_MACH_SUN6I) += \
375 sun6i-a31-app4-evb1.dtb \ 412 sun6i-a31-app4-evb1.dtb \
376 sun6i-a31-colombus.dtb \ 413 sun6i-a31-colombus.dtb \
414 sun6i-a31-hummingbird.dtb \
377 sun6i-a31-m9.dtb 415 sun6i-a31-m9.dtb
378dtb-$(CONFIG_MACH_SUN7I) += \ 416dtb-$(CONFIG_MACH_SUN7I) += \
379 sun7i-a20-cubieboard2.dtb \ 417 sun7i-a20-cubieboard2.dtb \
380 sun7i-a20-cubietruck.dtb \ 418 sun7i-a20-cubietruck.dtb \
381 sun7i-a20-i12-tvbox.dtb \ 419 sun7i-a20-i12-tvbox.dtb \
382 sun7i-a20-olinuxino-micro.dtb 420 sun7i-a20-olinuxino-micro.dtb \
421 sun7i-a20-pcduino3.dtb
422dtb-$(CONFIG_MACH_SUN8I) += \
423 sun8i-a23-ippo-q8h-v5.dtb
383dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 424dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
384 tegra20-iris-512.dtb \ 425 tegra20-iris-512.dtb \
385 tegra20-medcom-wide.dtb \ 426 tegra20-medcom-wide.dtb \
@@ -390,6 +431,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
390 tegra20-trimslice.dtb \ 431 tegra20-trimslice.dtb \
391 tegra20-ventana.dtb \ 432 tegra20-ventana.dtb \
392 tegra20-whistler.dtb \ 433 tegra20-whistler.dtb \
434 tegra30-apalis-eval.dtb \
393 tegra30-beaver.dtb \ 435 tegra30-beaver.dtb \
394 tegra30-cardhu-a02.dtb \ 436 tegra30-cardhu-a02.dtb \
395 tegra30-cardhu-a04.dtb \ 437 tegra30-cardhu-a04.dtb \
@@ -419,7 +461,9 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
419 wm8650-mid.dtb \ 461 wm8650-mid.dtb \
420 wm8750-apc8750.dtb \ 462 wm8750-apc8750.dtb \
421 wm8850-w70v2.dtb 463 wm8850-w70v2.dtb
422dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \ 464dtb-$(CONFIG_ARCH_ZYNQ) += \
465 zynq-parallella.dtb \
466 zynq-zc702.dtb \
423 zynq-zc706.dtb \ 467 zynq-zc706.dtb \
424 zynq-zed.dtb 468 zynq-zed.dtb
425dtb-$(CONFIG_MACH_ARMADA_370) += \ 469dtb-$(CONFIG_MACH_ARMADA_370) += \
@@ -437,11 +481,13 @@ dtb-$(CONFIG_MACH_ARMADA_XP) += \
437 armada-xp-axpwifiap.dtb \ 481 armada-xp-axpwifiap.dtb \
438 armada-xp-db.dtb \ 482 armada-xp-db.dtb \
439 armada-xp-gp.dtb \ 483 armada-xp-gp.dtb \
440 armada-xp-netgear-rn2120.dtb \ 484 armada-xp-lenovo-ix4-300d.dtb \
441 armada-xp-matrix.dtb \ 485 armada-xp-matrix.dtb \
486 armada-xp-netgear-rn2120.dtb \
442 armada-xp-openblocks-ax3-4.dtb 487 armada-xp-openblocks-ax3-4.dtb
443dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ 488dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \
444 dove-cubox.dtb \ 489 dove-cubox.dtb \
490 dove-cubox-es.dtb \
445 dove-d2plug.dtb \ 491 dove-d2plug.dtb \
446 dove-d3plug.dtb \ 492 dove-d3plug.dtb \
447 dove-dove-db.dtb 493 dove-dove-db.dtb
diff --git a/arch/arm/boot/dts/aks-cdu.dts b/arch/arm/boot/dts/aks-cdu.dts
index 54cb5cf8604a..d9c50fbb49d2 100644
--- a/arch/arm/boot/dts/aks-cdu.dts
+++ b/arch/arm/boot/dts/aks-cdu.dts
@@ -16,6 +16,12 @@
16 bootargs = "console=ttyS0,115200 ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs"; 16 bootargs = "console=ttyS0,115200 ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs";
17 }; 17 };
18 18
19 clocks {
20 slow_xtal {
21 clock-frequency = <32768>;
22 };
23 };
24
19 ahb { 25 ahb {
20 apb { 26 apb {
21 usart0: serial@fffb0000 { 27 usart0: serial@fffb0000 {
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 80a3b215e7d6..df5fee6b6b4b 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -149,12 +149,113 @@
149 "Headphone Jack", "HPLOUT", 149 "Headphone Jack", "HPLOUT",
150 "Headphone Jack", "HPROUT"; 150 "Headphone Jack", "HPROUT";
151 }; 151 };
152
153 panel {
154 compatible = "ti,tilcdc,panel";
155 pinctrl-names = "default", "sleep";
156 pinctrl-0 = <&lcd_pins_default>;
157 pinctrl-1 = <&lcd_pins_sleep>;
158 status = "okay";
159 panel-info {
160 ac-bias = <255>;
161 ac-bias-intrpt = <0>;
162 dma-burst-sz = <16>;
163 bpp = <32>;
164 fdd = <0x80>;
165 sync-edge = <0>;
166 sync-ctrl = <1>;
167 raster-order = <0>;
168 fifo-th = <0>;
169 };
170 display-timings {
171 480x272 {
172 hactive = <480>;
173 vactive = <272>;
174 hback-porch = <43>;
175 hfront-porch = <8>;
176 hsync-len = <4>;
177 vback-porch = <12>;
178 vfront-porch = <4>;
179 vsync-len = <10>;
180 clock-frequency = <9000000>;
181 hsync-active = <0>;
182 vsync-active = <0>;
183 };
184 };
185 };
152}; 186};
153 187
154&am33xx_pinmux { 188&am33xx_pinmux {
155 pinctrl-names = "default"; 189 pinctrl-names = "default";
156 pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>; 190 pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
157 191
192 lcd_pins_default: lcd_pins_default {
193 pinctrl-single,pins = <
194 0x20 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad8.lcd_data23 */
195 0x24 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad9.lcd_data22 */
196 0x28 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad10.lcd_data21 */
197 0x2c (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad11.lcd_data20 */
198 0x30 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad12.lcd_data19 */
199 0x34 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad13.lcd_data18 */
200 0x38 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad14.lcd_data17 */
201 0x3c (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad15.lcd_data16 */
202 0xa0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0.lcd_data0 */
203 0xa4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1.lcd_data1 */
204 0xa8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2.lcd_data2 */
205 0xac (PIN_OUTPUT | MUX_MODE0) /* lcd_data3.lcd_data3 */
206 0xb0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4.lcd_data4 */
207 0xb4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5.lcd_data5 */
208 0xb8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6.lcd_data6 */
209 0xbc (PIN_OUTPUT | MUX_MODE0) /* lcd_data7.lcd_data7 */
210 0xc0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data8.lcd_data8 */
211 0xc4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data9.lcd_data9 */
212 0xc8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data10.lcd_data10 */
213 0xcc (PIN_OUTPUT | MUX_MODE0) /* lcd_data11.lcd_data11 */
214 0xd0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data12.lcd_data12 */
215 0xd4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data13.lcd_data13 */
216 0xd8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data14.lcd_data14 */
217 0xdc (PIN_OUTPUT | MUX_MODE0) /* lcd_data15.lcd_data15 */
218 0xe0 (PIN_OUTPUT | MUX_MODE0) /* lcd_vsync.lcd_vsync */
219 0xe4 (PIN_OUTPUT | MUX_MODE0) /* lcd_hsync.lcd_hsync */
220 0xe8 (PIN_OUTPUT | MUX_MODE0) /* lcd_pclk.lcd_pclk */
221 0xec (PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en.lcd_ac_bias_en */
222 >;
223 };
224
225 lcd_pins_sleep: lcd_pins_sleep {
226 pinctrl-single,pins = <
227 0x20 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad8.lcd_data23 */
228 0x24 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad9.lcd_data22 */
229 0x28 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad10.lcd_data21 */
230 0x2c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad11.lcd_data20 */
231 0x30 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad12.lcd_data19 */
232 0x34 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad13.lcd_data18 */
233 0x38 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad14.lcd_data17 */
234 0x3c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad15.lcd_data16 */
235 0xa0 (PULL_DISABLE | MUX_MODE7) /* lcd_data0.lcd_data0 */
236 0xa4 (PULL_DISABLE | MUX_MODE7) /* lcd_data1.lcd_data1 */
237 0xa8 (PULL_DISABLE | MUX_MODE7) /* lcd_data2.lcd_data2 */
238 0xac (PULL_DISABLE | MUX_MODE7) /* lcd_data3.lcd_data3 */
239 0xb0 (PULL_DISABLE | MUX_MODE7) /* lcd_data4.lcd_data4 */
240 0xb4 (PULL_DISABLE | MUX_MODE7) /* lcd_data5.lcd_data5 */
241 0xb8 (PULL_DISABLE | MUX_MODE7) /* lcd_data6.lcd_data6 */
242 0xbc (PULL_DISABLE | MUX_MODE7) /* lcd_data7.lcd_data7 */
243 0xc0 (PULL_DISABLE | MUX_MODE7) /* lcd_data8.lcd_data8 */
244 0xc4 (PULL_DISABLE | MUX_MODE7) /* lcd_data9.lcd_data9 */
245 0xc8 (PULL_DISABLE | MUX_MODE7) /* lcd_data10.lcd_data10 */
246 0xcc (PULL_DISABLE | MUX_MODE7) /* lcd_data11.lcd_data11 */
247 0xd0 (PULL_DISABLE | MUX_MODE7) /* lcd_data12.lcd_data12 */
248 0xd4 (PULL_DISABLE | MUX_MODE7) /* lcd_data13.lcd_data13 */
249 0xd8 (PULL_DISABLE | MUX_MODE7) /* lcd_data14.lcd_data14 */
250 0xdc (PULL_DISABLE | MUX_MODE7) /* lcd_data15.lcd_data15 */
251 0xe0 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* lcd_vsync.lcd_vsync */
252 0xe4 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* lcd_hsync.lcd_hsync */
253 0xe8 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* lcd_pclk.lcd_pclk */
254 0xec (PIN_INPUT_PULLDOWN | MUX_MODE7) /* lcd_ac_bias_en.lcd_ac_bias_en */
255 >;
256 };
257
258
158 user_leds_s0: user_leds_s0 { 259 user_leds_s0: user_leds_s0 {
159 pinctrl-single,pins = < 260 pinctrl-single,pins = <
160 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */ 261 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */
@@ -573,3 +674,7 @@
573 ti,wire-config = <0x00 0x11 0x22 0x33>; 674 ti,wire-config = <0x00 0x11 0x22 0x33>;
574 }; 675 };
575}; 676};
677
678&lcdc {
679 status = "okay";
680};
diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts
new file mode 100644
index 000000000000..0d35ab64641c
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-pepper.dts
@@ -0,0 +1,653 @@
1/*
2 * Copyright (C) 2014 Gumstix, Inc. - https://www.gumstix.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 <dt-bindings/input/input.h>
11#include "am33xx.dtsi"
12
13/ {
14 model = "Gumstix Pepper";
15 compatible = "gumstix,am335x-pepper", "ti,am33xx";
16
17 cpus {
18 cpu@0 {
19 cpu0-supply = <&dcdc3_reg>;
20 };
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x80000000 0x20000000>; /* 512 MB */
26 };
27
28 buttons: user_buttons {
29 compatible = "gpio-keys";
30 };
31
32 leds: user_leds {
33 compatible = "gpio-leds";
34 };
35
36 panel: lcd_panel {
37 compatible = "ti,tilcdc,panel";
38 };
39
40 sound: sound_iface {
41 compatible = "ti,da830-evm-audio";
42 };
43
44 vbat: fixedregulator@0 {
45 compatible = "regulator-fixed";
46 };
47
48 v3v3c_reg: fixedregulator@1 {
49 compatible = "regulator-fixed";
50 };
51
52 vdd5_reg: fixedregulator@2 {
53 compatible = "regulator-fixed";
54 };
55};
56
57/* I2C Busses */
58&i2c0 {
59 status = "okay";
60 pinctrl-names = "default";
61 pinctrl-0 = <&i2c0_pins>;
62
63 clock-frequency = <400000>;
64
65 tps: tps@24 {
66 reg = <0x24>;
67 };
68
69 eeprom: eeprom@50 {
70 compatible = "at,24c256";
71 reg = <0x50>;
72 };
73
74 audio_codec: tlv320aic3106@1b {
75 compatible = "ti,tlv320aic3106";
76 reg = <0x1b>;
77 };
78
79 accel: lis331dlh@1d {
80 compatible = "st,lis3lv02d";
81 reg = <0x1d>;
82 };
83};
84
85&i2c1 {
86 status = "okay";
87 pinctrl-names = "default";
88 pinctrl-0 = <&i2c1_pins>;
89 clock-frequency = <400000>;
90};
91
92&am33xx_pinmux {
93 i2c0_pins: pinmux_i2c0 {
94 pinctrl-single,pins = <
95 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
96 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
97 >;
98 };
99 i2c1_pins: pinmux_i2c1 {
100 pinctrl-single,pins = <
101 0x10C (PIN_INPUT_PULLUP | MUX_MODE3) /* mii1_crs,i2c1_sda */
102 0x110 (PIN_INPUT_PULLUP | MUX_MODE3) /* mii1_rxerr,i2c1_scl */
103 >;
104 };
105};
106
107/* Accelerometer */
108&accel {
109 pinctrl-names = "default";
110 pinctrl-0 = <&accel_pins>;
111
112 Vdd-supply = <&ldo3_reg>;
113 Vdd_IO-supply = <&ldo3_reg>;
114 st,irq1-click;
115 st,wakeup-x-lo;
116 st,wakeup-x-hi;
117 st,wakeup-y-lo;
118 st,wakeup-y-hi;
119 st,wakeup-z-lo;
120 st,wakeup-z-hi;
121 st,min-limit-x = <92>;
122 st,max-limit-x = <14>;
123 st,min-limit-y = <14>;
124 st,max-limit-y = <92>;
125 st,min-limit-z = <92>;
126 st,max-limit-z = <14>;
127};
128
129&am33xx_pinmux {
130 accel_pins: pinmux_accel {
131 pinctrl-single,pins = <
132 0x98 (PIN_INPUT | MUX_MODE7) /* gpmc_wen.gpio2_4 */
133 >;
134 };
135};
136
137/* Audio */
138&audio_codec {
139 status = "okay";
140
141 gpio-reset = <&gpio1 16 GPIO_ACTIVE_LOW>;
142 AVDD-supply = <&ldo3_reg>;
143 IOVDD-supply = <&ldo3_reg>;
144 DRVDD-supply = <&ldo3_reg>;
145 DVDD-supply = <&dcdc1_reg>;
146};
147
148&sound {
149 ti,model = "AM335x-EVM";
150 ti,audio-codec = <&audio_codec>;
151 ti,mcasp-controller = <&mcasp0>;
152 ti,codec-clock-rate = <12000000>;
153 ti,audio-routing =
154 "Headphone Jack", "HPLOUT",
155 "Headphone Jack", "HPROUT",
156 "LINE1L", "Line In";
157};
158
159&mcasp0 {
160 status = "okay";
161 pinctrl-names = "default";
162 pinctrl-0 = <&audio_pins>;
163
164 op-mode = <0>; /* MCASP_ISS_MODE */
165 tdm-slots = <2>;
166 serial-dir = <
167 1 2 0 0
168 0 0 0 0
169 0 0 0 0
170 0 0 0 0
171 >;
172 tx-num-evt = <1>;
173 rx-num-evt = <1>;
174};
175
176&am33xx_pinmux {
177 audio_pins: pinmux_audio {
178 pinctrl-single,pins = <
179 0x1AC (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
180 0x194 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */
181 0x190 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
182 0x198 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr0.mcasp0_axr0 */
183 0x1A8 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr1.mcasp0_axr1 */
184 0x40 (PIN_OUTPUT | MUX_MODE7) /* gpmc_a0.gpio1_16 */
185 >;
186 };
187};
188
189/* Display: 24-bit LCD Screen */
190&panel {
191 status = "okay";
192 pinctrl-names = "default";
193 pinctrl-0 = <&lcd_pins>;
194 panel-info {
195 ac-bias = <255>;
196 ac-bias-intrpt = <0>;
197 dma-burst-sz = <16>;
198 bpp = <32>;
199 fdd = <0x80>;
200 sync-edge = <0>;
201 sync-ctrl = <1>;
202 raster-order = <0>;
203 fifo-th = <0>;
204 };
205 display-timings {
206 native-mode = <&timing0>;
207 timing0: 480x272 {
208 clock-frequency = <18400000>;
209 hactive = <480>;
210 vactive = <272>;
211 hfront-porch = <8>;
212 hback-porch = <4>;
213 hsync-len = <41>;
214 vfront-porch = <4>;
215 vback-porch = <2>;
216 vsync-len = <10>;
217 hsync-active = <1>;
218 vsync-active = <1>;
219 };
220 };
221};
222
223&lcdc {
224 status = "okay";
225};
226
227&am33xx_pinmux {
228 lcd_pins: pinmux_lcd {
229 pinctrl-single,pins = <
230 0xa0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0.lcd_data0 */
231 0xa4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1.lcd_data1 */
232 0xa8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2.lcd_data2 */
233 0xac (PIN_OUTPUT | MUX_MODE0) /* lcd_data3.lcd_data3 */
234 0xb0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4.lcd_data4 */
235 0xb4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5.lcd_data5 */
236 0xb8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6.lcd_data6 */
237 0xbc (PIN_OUTPUT | MUX_MODE0) /* lcd_data7.lcd_data7 */
238 0xc0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data8.lcd_data8 */
239 0xc4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data9.lcd_data9 */
240 0xc8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data10.lcd_data10 */
241 0xcc (PIN_OUTPUT | MUX_MODE0) /* lcd_data11.lcd_data11 */
242 0xd0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data12.lcd_data12 */
243 0xd4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data13.lcd_data13 */
244 0xd8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data14.lcd_data14 */
245 0xdc (PIN_OUTPUT | MUX_MODE0) /* lcd_data15.lcd_data15 */
246 0x20 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad8.lcd_data16 */
247 0x24 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad9.lcd_data17 */
248 0x28 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad10.lcd_data18 */
249 0x2c (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad11.lcd_data19 */
250 0x30 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad12.lcd_data20 */
251 0x34 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad13.lcd_data21 */
252 0x38 (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad14.lcd_data22 */
253 0x3c (PIN_OUTPUT | MUX_MODE1) /* gpmc_ad15.lcd_data23 */
254 0xe0 (PIN_OUTPUT | MUX_MODE0) /* lcd_vsync.lcd_vsync */
255 0xe4 (PIN_OUTPUT | MUX_MODE0) /* lcd_hsync.lcd_hsync */
256 0xe8 (PIN_OUTPUT | MUX_MODE0) /* lcd_pclk.lcd_pclk */
257 0xec (PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en.lcd_ac_bias_en */
258 /* Display Enable */
259 0x6c (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a11.gpio1_27 */
260 >;
261 };
262};
263
264/* Ethernet */
265&cpsw_emac0 {
266 status = "okay";
267 phy_id = <&davinci_mdio>, <0>;
268 phy-mode = "rgmii";
269};
270
271&cpsw_emac1 {
272 status = "okay";
273 phy_id = <&davinci_mdio>, <1>;
274 phy-mode = "rgmii";
275};
276
277&davinci_mdio {
278 status = "okay";
279 pinctrl-names = "default";
280 pinctrl-0 = <&mdio_pins>;
281};
282
283&mac {
284 status = "okay";
285 pinctrl-names = "default";
286 pinctrl-0 = <&ethernet_pins>;
287};
288
289
290&am33xx_pinmux {
291 ethernet_pins: pinmux_ethernet {
292 pinctrl-single,pins = <
293 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
294 0x118 (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
295 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
296 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
297 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
298 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
299 0x12c (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
300 0x130 (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
301 0x134 (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd3.rgmii1_rxd3 */
302 0x138 (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd2.rgmii1_rxd2 */
303 0x13c (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd1.rgmii1_rxd1 */
304 0x140 (PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd0.rgmii1_rxd0 */
305 /* ethernet interrupt */
306 0x144 (PIN_INPUT_PULLUP | MUX_MODE7) /* rmii2_refclk.gpio0_29 */
307 /* ethernet PHY nReset */
308 0x108 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* mii1_col.gpio3_0 */
309 >;
310 };
311
312 mdio_pins: pinmux_mdio {
313 pinctrl-single,pins = <
314 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
315 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
316 >;
317 };
318};
319
320/* MMC */
321&mmc1 {
322 /* Bootable SD card slot */
323 status = "okay";
324 vmmc-supply = <&ldo3_reg>;
325 bus-width = <4>;
326 pinctrl-names = "default";
327 pinctrl-0 = <&sd_pins>;
328 cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
329};
330
331&mmc2 {
332 /* eMMC (not populated) on MMC #2 */
333 status = "disabled";
334 pinctrl-names = "default";
335 pinctrl-0 = <&emmc_pins>;
336 vmmc-supply = <&ldo3_reg>;
337 bus-width = <8>;
338 ti,non-removable;
339};
340
341&edma {
342 /* Map eDMA MMC2 Events from Crossbar */
343 ti,edma-xbar-event-map = /bits/ 16 <1 12
344 2 13>;
345};
346
347
348&mmc3 {
349 /* Wifi & Bluetooth on MMC #3 */
350 status = "okay";
351 pinctrl-names = "default";
352 pinctrl-0 = <&wireless_pins>;
353 vmmmc-supply = <&v3v3c_reg>;
354 bus-width = <4>;
355 ti,non-removable;
356 dmas = <&edma 12
357 &edma 13>;
358 dma-names = "tx", "rx";
359};
360
361
362&am33xx_pinmux {
363 sd_pins: pinmux_sd_card {
364 pinctrl-single,pins = <
365 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */
366 0xf4 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */
367 0xf8 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */
368 0xfc (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */
369 0x100 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */
370 0x104 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */
371 0x160 (PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
372 >;
373 };
374 emmc_pins: pinmux_emmc {
375 pinctrl-single,pins = <
376 0x80 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
377 0x84 (PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
378 0x00 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
379 0x04 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
380 0x08 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
381 0x0c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
382 0x10 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
383 0x14 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
384 0x18 (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
385 0x1c (PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
386 /* EMMC nReset */
387 0x74 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_31 */
388 >;
389 };
390 wireless_pins: pinmux_wireless {
391 pinctrl-single,pins = <
392 0x44 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_a1.mmc2_dat0 */
393 0x48 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_a2.mmc2_dat1 */
394 0x4c (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_a3.mmc2_dat2 */
395 0x78 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_ben1.mmc2_dat3 */
396 0x88 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_csn3.mmc2_cmd */
397 0x8c (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_clk.mmc1_clk */
398 /* WLAN nReset */
399 0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1_24 */
400 /* WLAN nPower down */
401 0x70 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_wait0.gpio0_30 */
402 /* 32kHz Clock */
403 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
404 >;
405 };
406};
407
408/* Power */
409&vbat {
410 regulator-name = "vbat";
411 regulator-min-microvolt = <5000000>;
412 regulator-max-microvolt = <5000000>;
413};
414
415&v3v3c_reg {
416 regulator-name = "v3v3c_reg";
417 regulator-min-microvolt = <3300000>;
418 regulator-max-microvolt = <3300000>;
419 vin-supply = <&vbat>;
420};
421
422&vdd5_reg {
423 regulator-name = "vdd5_reg";
424 regulator-min-microvolt = <5000000>;
425 regulator-max-microvolt = <5000000>;
426 vin-supply = <&vbat>;
427};
428
429/include/ "tps65217.dtsi"
430
431&tps {
432 backlight {
433 isel = <1>; /* ISET1 */
434 fdim = <200>; /* TPS65217_BL_FDIM_200HZ */
435 default-brightness = <80>;
436 };
437
438 regulators {
439 dcdc1_reg: regulator@0 {
440 /* VDD_1V8 system supply */
441 };
442
443 dcdc2_reg: regulator@1 {
444 /* VDD_CORE voltage limits 0.95V - 1.26V with +/-4% tolerance */
445 regulator-name = "vdd_core";
446 regulator-min-microvolt = <925000>;
447 regulator-max-microvolt = <1325000>;
448 regulator-boot-on;
449 };
450
451 dcdc3_reg: regulator@2 {
452 /* VDD_MPU voltage limits 0.95V - 1.1V with +/-4% tolerance */
453 regulator-name = "vdd_mpu";
454 regulator-min-microvolt = <925000>;
455 regulator-max-microvolt = <1150000>;
456 regulator-boot-on;
457 };
458
459 ldo1_reg: regulator@3 {
460 /* VRTC 1.8V always-on supply */
461 regulator-always-on;
462 };
463
464 ldo2_reg: regulator@4 {
465 /* 3.3V rail */
466 };
467
468 ldo3_reg: regulator@5 {
469 /* VDD_3V3A 3.3V rail */
470 regulator-min-microvolt = <3300000>;
471 regulator-max-microvolt = <3300000>;
472 };
473
474 ldo4_reg: regulator@6 {
475 /* VDD_3V3B 3.3V rail */
476 };
477 };
478};
479
480/* SPI Busses */
481&spi0 {
482 status = "okay";
483 pinctrl-names = "default";
484 pinctrl-0 = <&spi0_pins>;
485};
486
487&am33xx_pinmux {
488 spi0_pins: pinmux_spi0 {
489 pinctrl-single,pins = <
490 0x150 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_sclk.spi0_sclk */
491 0x15C (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */
492 0x154 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d0.spi0_d0 */
493 0x158 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_d1 */
494 >;
495 };
496};
497
498/* Touch Screen */
499&tscadc {
500 status = "okay";
501 tsc {
502 ti,wires = <4>;
503 ti,x-plate-resistance = <200>;
504 ti,coordinate-readouts = <5>;
505 ti,wire-config = <0x00 0x11 0x22 0x33>;
506 };
507
508 adc {
509 ti,adc-channels = <4 5 6 7>;
510 };
511};
512
513/* UARTs */
514&uart0 {
515 /* Serial Console */
516 status = "okay";
517 pinctrl-names = "default";
518 pinctrl-0 = <&uart0_pins>;
519};
520
521&uart1 {
522 /* Broken out to J6 header */
523 status = "okay";
524 pinctrl-names = "default";
525 pinctrl-0 = <&uart1_pins>;
526};
527
528&am33xx_pinmux {
529 uart0_pins: pinmux_uart0 {
530 pinctrl-single,pins = <
531 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
532 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
533 >;
534 };
535 uart1_pins: pinmux_uart1 {
536 pinctrl-single,pins = <
537 0x178 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_ctsn.uart1_ctsn */
538 0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_rtsn.uart1_rtsn */
539 0x180 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_rxd.uart1_rxd */
540 0x184 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_txd.uart1_txd */
541 >;
542 };
543};
544
545/* USB */
546&usb {
547 status = "okay";
548
549 pinctrl-names = "default";
550 pinctrl-0 = <&usb_pins>;
551};
552
553&usb_ctrl_mod {
554 status = "okay";
555};
556
557&usb0_phy {
558 status = "okay";
559};
560
561&usb1_phy {
562 status = "okay";
563};
564
565&usb0 {
566 status = "okay";
567 dr_mode = "host";
568};
569
570&usb1 {
571 status = "okay";
572 dr_mode = "host";
573};
574
575&cppi41dma {
576 status = "okay";
577};
578
579&am33xx_pinmux {
580 usb_pins: pinmux_usb {
581 pinctrl-single,pins = <
582 /* USB0 Over-Current (active low) */
583 0x64 (PIN_INPUT | MUX_MODE7) /* gpmc_a9.gpio1_25 */
584 /* USB1 Over-Current (active low) */
585 0x68 (PIN_INPUT | MUX_MODE7) /* gpmc_a10.gpio1_26 */
586 >;
587 };
588};
589
590/* User IO */
591&leds {
592 pinctrl-names = "default";
593 pinctrl-0 = <&user_leds_pins>;
594
595 led@0 {
596 label = "pepper:user0:blue";
597 gpios = <&gpio1 20 GPIO_ACTIVE_HIGH>;
598 linux,default-trigger = "none";
599 default-state = "off";
600 };
601
602 led@1 {
603 label = "pepper:user1:red";
604 gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
605 linux,default-trigger = "none";
606 default-state = "off";
607 };
608};
609
610&buttons {
611 pinctrl-names = "default";
612 pinctrl-0 = <&user_buttons_pins>;
613 #address-cells = <1>;
614 #size-cells = <0>;
615
616 button@0 {
617 label = "home";
618 linux,code = <KEY_HOME>;
619 gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
620 gpio-key,wakeup;
621 };
622
623 button@1 {
624 label = "menu";
625 linux,code = <KEY_MENU>;
626 gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
627 gpio-key,wakeup;
628 };
629
630 buttons@2 {
631 label = "power";
632 linux,code = <KEY_POWER>;
633 gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
634 gpio-key,wakeup;
635 };
636};
637
638&am33xx_pinmux {
639 user_leds_pins: pinmux_user_leds {
640 pinctrl-single,pins = <
641 0x50 (PIN_OUTPUT | MUX_MODE7) /* gpmc_a4.gpio1_20 */
642 0x54 (PIN_OUTPUT | MUX_MODE7) /* gpmc_a5.gpio1_21 */
643 >;
644 };
645
646 user_buttons_pins: pinmux_user_buttons {
647 pinctrl-single,pins = <
648 0x58 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */
649 0x5C (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a7.gpio1_21 */
650 0x164 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio0_7 */
651 >;
652 };
653};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 4a4e02d0ce9e..3a0a161342ba 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -347,6 +347,15 @@
347 status = "disabled"; 347 status = "disabled";
348 }; 348 };
349 349
350 mailbox: mailbox@480C8000 {
351 compatible = "ti,omap4-mailbox";
352 reg = <0x480C8000 0x200>;
353 interrupts = <77>;
354 ti,hwmods = "mailbox";
355 ti,mbox-num-users = <4>;
356 ti,mbox-num-fifos = <8>;
357 };
358
350 timer1: timer@44e31000 { 359 timer1: timer@44e31000 {
351 compatible = "ti,am335x-timer-1ms"; 360 compatible = "ti,am335x-timer-1ms";
352 reg = <0x44e31000 0x400>; 361 reg = <0x44e31000 0x400>;
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 49fa59622254..9b3d2ba82f13 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -30,7 +30,7 @@
30 cpus { 30 cpus {
31 #address-cells = <1>; 31 #address-cells = <1>;
32 #size-cells = <0>; 32 #size-cells = <0>;
33 cpu@0 { 33 cpu: cpu@0 {
34 compatible = "arm,cortex-a9"; 34 compatible = "arm,cortex-a9";
35 device_type = "cpu"; 35 device_type = "cpu";
36 reg = <0>; 36 reg = <0>;
@@ -168,9 +168,6 @@
168 ti,hwmods = "mailbox"; 168 ti,hwmods = "mailbox";
169 ti,mbox-num-users = <4>; 169 ti,mbox-num-users = <4>;
170 ti,mbox-num-fifos = <8>; 170 ti,mbox-num-fifos = <8>;
171 ti,mbox-names = "wkup_m3";
172 ti,mbox-data = <0 0 0 0>;
173 status = "disabled";
174 }; 171 };
175 172
176 timer1: timer@44e31000 { 173 timer1: timer@44e31000 {
@@ -270,7 +267,7 @@
270 ti,hwmods = "counter_32k"; 267 ti,hwmods = "counter_32k";
271 }; 268 };
272 269
273 rtc@44e3e000 { 270 rtc: rtc@44e3e000 {
274 compatible = "ti,am4372-rtc","ti,da830-rtc"; 271 compatible = "ti,am4372-rtc","ti,da830-rtc";
275 reg = <0x44e3e000 0x1000>; 272 reg = <0x44e3e000 0x1000>;
276 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH 273 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH
@@ -279,7 +276,7 @@
279 status = "disabled"; 276 status = "disabled";
280 }; 277 };
281 278
282 wdt@44e35000 { 279 wdt: wdt@44e35000 {
283 compatible = "ti,am4372-wdt","ti,omap3-wdt"; 280 compatible = "ti,am4372-wdt","ti,omap3-wdt";
284 reg = <0x44e35000 0x1000>; 281 reg = <0x44e35000 0x1000>;
285 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; 282 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
@@ -871,7 +868,7 @@
871 #size-cells = <1>; 868 #size-cells = <1>;
872 ranges; 869 ranges;
873 870
874 dispc@4832a400 { 871 dispc: dispc@4832a400 {
875 compatible = "ti,omap3-dispc"; 872 compatible = "ti,omap3-dispc";
876 reg = <0x4832a400 0x400>; 873 reg = <0x4832a400 0x400>;
877 interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>; 874 interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts
index 003766c47bbf..646a6eade788 100644
--- a/arch/arm/boot/dts/am437x-gp-evm.dts
+++ b/arch/arm/boot/dts/am437x-gp-evm.dts
@@ -257,16 +257,73 @@
257}; 257};
258 258
259&i2c0 { 259&i2c0 {
260 status = "okay"; 260 status = "okay";
261 pinctrl-names = "default"; 261 pinctrl-names = "default";
262 pinctrl-0 = <&i2c0_pins>; 262 pinctrl-0 = <&i2c0_pins>;
263 clock-frequency = <400000>;
264
265 tps65218: tps65218@24 {
266 reg = <0x24>;
267 compatible = "ti,tps65218";
268 interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* NMIn */
269 interrupt-parent = <&gic>;
270 interrupt-controller;
271 #interrupt-cells = <2>;
272
273 dcdc1: regulator-dcdc1 {
274 compatible = "ti,tps65218-dcdc1";
275 regulator-name = "vdd_core";
276 regulator-min-microvolt = <912000>;
277 regulator-max-microvolt = <1144000>;
278 regulator-boot-on;
279 regulator-always-on;
280 };
281
282 dcdc2: regulator-dcdc2 {
283 compatible = "ti,tps65218-dcdc2";
284 regulator-name = "vdd_mpu";
285 regulator-min-microvolt = <912000>;
286 regulator-max-microvolt = <1378000>;
287 regulator-boot-on;
288 regulator-always-on;
289 };
290
291 dcdc3: regulator-dcdc3 {
292 compatible = "ti,tps65218-dcdc3";
293 regulator-name = "vdcdc3";
294 regulator-min-microvolt = <1350000>;
295 regulator-max-microvolt = <1350000>;
296 regulator-boot-on;
297 regulator-always-on;
298 };
299 dcdc5: regulator-dcdc5 {
300 compatible = "ti,tps65218-dcdc5";
301 regulator-name = "v1_0bat";
302 regulator-min-microvolt = <1000000>;
303 regulator-max-microvolt = <1000000>;
304 };
305
306 dcdc6: regulator-dcdc6 {
307 compatible = "ti,tps65218-dcdc6";
308 regulator-name = "v1_8bat";
309 regulator-min-microvolt = <1800000>;
310 regulator-max-microvolt = <1800000>;
311 };
312
313 ldo1: regulator-ldo1 {
314 compatible = "ti,tps65218-ldo1";
315 regulator-min-microvolt = <1800000>;
316 regulator-max-microvolt = <1800000>;
317 regulator-boot-on;
318 regulator-always-on;
319 };
320 };
263}; 321};
264 322
265&i2c1 { 323&i2c1 {
266 status = "okay"; 324 status = "okay";
267 pinctrl-names = "default"; 325 pinctrl-names = "default";
268 pinctrl-0 = <&i2c1_pins>; 326 pinctrl-0 = <&i2c1_pins>;
269
270 pixcir_ts@5c { 327 pixcir_ts@5c {
271 compatible = "pixcir,pixcir_tangoc"; 328 compatible = "pixcir,pixcir_tangoc";
272 pinctrl-names = "default"; 329 pinctrl-names = "default";
@@ -277,8 +334,8 @@
277 334
278 attb-gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>; 335 attb-gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
279 336
280 x-size = <1024>; 337 touchscreen-size-x = <1024>;
281 y-size = <600>; 338 touchscreen-size-y = <600>;
282 }; 339 };
283}; 340};
284 341
diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts
new file mode 100644
index 000000000000..859ff3d620ee
--- /dev/null
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -0,0 +1,613 @@
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
9/* AM437x SK EVM */
10
11/dts-v1/;
12
13#include "am4372.dtsi"
14#include <dt-bindings/pinctrl/am43xx.h>
15#include <dt-bindings/pwm/pwm.h>
16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/input/input.h>
18
19/ {
20 model = "TI AM437x SK EVM";
21 compatible = "ti,am437x-sk-evm","ti,am4372","ti,am43";
22
23 aliases {
24 display0 = &lcd0;
25 };
26
27 backlight {
28 compatible = "pwm-backlight";
29 pwms = <&ecap0 0 50000 PWM_POLARITY_INVERTED>;
30 brightness-levels = <0 51 53 56 62 75 101 152 255>;
31 default-brightness-level = <8>;
32 };
33
34 sound {
35 compatible = "ti,da830-evm-audio";
36 ti,model = "AM437x-SK-EVM";
37 ti,audio-codec = <&tlv320aic3106>;
38 ti,mcasp-controller = <&mcasp1>;
39 ti,codec-clock-rate = <24000000>;
40 ti,audio-routing =
41 "Headphone Jack", "HPLOUT",
42 "Headphone Jack", "HPROUT";
43 };
44
45 matrix_keypad: matrix_keypad@0 {
46 compatible = "gpio-matrix-keypad";
47
48 pinctrl-names = "default";
49 pinctrl-0 = <&matrix_keypad_pins>;
50
51 debounce-delay-ms = <5>;
52 col-scan-delay-us = <1500>;
53
54 row-gpios = <&gpio5 5 GPIO_ACTIVE_HIGH /* Bank5, pin5 */
55 &gpio5 6 GPIO_ACTIVE_HIGH>; /* Bank5, pin6 */
56
57 col-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH /* Bank5, pin13 */
58 &gpio5 4 GPIO_ACTIVE_HIGH>; /* Bank5, pin4 */
59
60 linux,keymap = <
61 MATRIX_KEY(0, 0, KEY_DOWN)
62 MATRIX_KEY(0, 1, KEY_RIGHT)
63 MATRIX_KEY(1, 0, KEY_LEFT)
64 MATRIX_KEY(1, 1, KEY_UP)
65 >;
66 };
67
68 leds {
69 compatible = "gpio-leds";
70
71 pinctrl-names = "default";
72 pinctrl-0 = <&leds_pins>;
73
74 led@0 {
75 label = "am437x-sk:red:heartbeat";
76 gpios = <&gpio5 0 GPIO_ACTIVE_HIGH>; /* Bank 5, pin 0 */
77 linux,default-trigger = "heartbeat";
78 default-state = "off";
79 };
80
81 led@1 {
82 label = "am437x-sk:green:mmc1";
83 gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; /* Bank 5, pin 1 */
84 linux,default-trigger = "mmc0";
85 default-state = "off";
86 };
87
88 led@2 {
89 label = "am437x-sk:blue:cpu0";
90 gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>; /* Bank 5, pin 2 */
91 linux,default-trigger = "cpu0";
92 default-state = "off";
93 };
94
95 led@3 {
96 label = "am437x-sk:blue:usr3";
97 gpios = <&gpio5 3 GPIO_ACTIVE_HIGH>; /* Bank 5, pin 3 */
98 default-state = "off";
99 };
100 };
101
102 lcd0: display {
103 compatible = "osddisplays,osd057T0559-34ts", "panel-dpi";
104 label = "lcd";
105
106 pinctrl-names = "default";
107 pinctrl-0 = <&lcd_pins>;
108
109 enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
110
111 panel-timing {
112 clock-frequency = <9000000>;
113 hactive = <480>;
114 vactive = <272>;
115 hfront-porch = <8>;
116 hback-porch = <43>;
117 hsync-len = <4>;
118 vback-porch = <12>;
119 vfront-porch = <4>;
120 vsync-len = <10>;
121 hsync-active = <0>;
122 vsync-active = <0>;
123 de-active = <1>;
124 pixelclk-active = <1>;
125 };
126
127 port {
128 lcd_in: endpoint {
129 remote-endpoint = <&dpi_out>;
130 };
131 };
132 };
133};
134
135&am43xx_pinmux {
136 matrix_keypad_pins: matrix_keypad_pins {
137 pinctrl-single,pins = <
138 0x24c (PIN_OUTPUT | MUX_MODE7) /* gpio5_13.gpio5_13 */
139 0x250 (PIN_OUTPUT | MUX_MODE7) /* spi4_sclk.gpio5_4 */
140 0x254 (PIN_INPUT | MUX_MODE7) /* spi4_d0.gpio5_5 */
141 0x258 (PIN_INPUT | MUX_MODE7) /* spi4_d1.gpio5_5 */
142 >;
143 };
144
145 leds_pins: leds_pins {
146 pinctrl-single,pins = <
147 0x228 (PIN_OUTPUT | MUX_MODE7) /* uart3_rxd.gpio5_2 */
148 0x22c (PIN_OUTPUT | MUX_MODE7) /* uart3_txd.gpio5_3 */
149 0x230 (PIN_OUTPUT | MUX_MODE7) /* uart3_ctsn.gpio5_0 */
150 0x234 (PIN_OUTPUT | MUX_MODE7) /* uart3_rtsn.gpio5_1 */
151 >;
152 };
153
154 i2c0_pins: i2c0_pins {
155 pinctrl-single,pins = <
156 0x188 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_sda.i2c0_sda */
157 0x18c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_scl.i2c0_scl */
158 >;
159 };
160
161 i2c1_pins: i2c1_pins {
162 pinctrl-single,pins = <
163 0x15c (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2) /* spi0_cs0.i2c1_scl */
164 0x158 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE2) /* spi0_d1.i2c1_sda */
165 >;
166 };
167
168 mmc1_pins: pinmux_mmc1_pins {
169 pinctrl-single,pins = <
170 0x160 (PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
171 >;
172 };
173
174 ecap0_pins: backlight_pins {
175 pinctrl-single,pins = <
176 0x164 (PIN_OUTPUT | MUX_MODE0) /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out */
177 >;
178 };
179
180 edt_ft5306_ts_pins: edt_ft5306_ts_pins {
181 pinctrl-single,pins = <
182 0x74 (PIN_INPUT | MUX_MODE7) /* gpmc_wpn.gpio0_31 */
183 0x78 (PIN_OUTPUT | MUX_MODE7) /* gpmc_be1n.gpio1_28 */
184 >;
185 };
186
187 cpsw_default: cpsw_default {
188 pinctrl-single,pins = <
189 /* Slave 1 */
190 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rmii1_tclk */
191 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
192 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
193 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
194 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td2 */
195 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td3 */
196 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rmii1_rclk */
197 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
198 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
199 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
200 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd2 */
201 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd3 */
202
203 /* Slave 2 */
204 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a6.rgmii2_tclk */
205 0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a0.rgmii2_tctl */
206 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a5.rgmii2_td0 */
207 0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a4.rgmii2_td1 */
208 0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a3.rgmii2_td2 */
209 0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a2.rgmii2_td3 */
210 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a7.rgmii2_rclk */
211 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a1.rgmii2_rtcl */
212 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a11.rgmii2_rd0 */
213 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a10.rgmii2_rd1 */
214 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a9.rgmii2_rd2 */
215 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a8.rgmii2_rd3 */
216 >;
217 };
218
219 cpsw_sleep: cpsw_sleep {
220 pinctrl-single,pins = <
221 /* Slave 1 reset value */
222 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
223 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
224 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
225 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
226 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
227 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
228 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
229 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
230 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
231 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
232 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
233 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
234
235 /* Slave 2 reset value */
236 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
237 0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
238 0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
239 0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
240 0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
241 0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
242 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
243 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
244 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
245 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
246 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
247 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
248 >;
249 };
250
251 davinci_mdio_default: davinci_mdio_default {
252 pinctrl-single,pins = <
253 /* MDIO */
254 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
255 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
256 >;
257 };
258
259 davinci_mdio_sleep: davinci_mdio_sleep {
260 pinctrl-single,pins = <
261 /* MDIO reset value */
262 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
263 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
264 >;
265 };
266
267 dss_pins: dss_pins {
268 pinctrl-single,pins = <
269 0x020 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* gpmc ad 8 -> DSS DATA 23 */
270 0x024 (PIN_OUTPUT_PULLUP | MUX_MODE1)
271 0x028 (PIN_OUTPUT_PULLUP | MUX_MODE1)
272 0x02c (PIN_OUTPUT_PULLUP | MUX_MODE1)
273 0x030 (PIN_OUTPUT_PULLUP | MUX_MODE1)
274 0x034 (PIN_OUTPUT_PULLUP | MUX_MODE1)
275 0x038 (PIN_OUTPUT_PULLUP | MUX_MODE1)
276 0x03c (PIN_OUTPUT_PULLUP | MUX_MODE1) /* gpmc ad 15 -> DSS DATA 16 */
277 0x0a0 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS DATA 0 */
278 0x0a4 (PIN_OUTPUT_PULLUP | MUX_MODE0)
279 0x0a8 (PIN_OUTPUT_PULLUP | MUX_MODE0)
280 0x0ac (PIN_OUTPUT_PULLUP | MUX_MODE0)
281 0x0b0 (PIN_OUTPUT_PULLUP | MUX_MODE0)
282 0x0b4 (PIN_OUTPUT_PULLUP | MUX_MODE0)
283 0x0b8 (PIN_OUTPUT_PULLUP | MUX_MODE0)
284 0x0bc (PIN_OUTPUT_PULLUP | MUX_MODE0)
285 0x0c0 (PIN_OUTPUT_PULLUP | MUX_MODE0)
286 0x0c4 (PIN_OUTPUT_PULLUP | MUX_MODE0)
287 0x0c8 (PIN_OUTPUT_PULLUP | MUX_MODE0)
288 0x0cc (PIN_OUTPUT_PULLUP | MUX_MODE0)
289 0x0d0 (PIN_OUTPUT_PULLUP | MUX_MODE0)
290 0x0d4 (PIN_OUTPUT_PULLUP | MUX_MODE0)
291 0x0d8 (PIN_OUTPUT_PULLUP | MUX_MODE0)
292 0x0dc (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS DATA 15 */
293 0x0e0 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS VSYNC */
294 0x0e4 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS HSYNC */
295 0x0e8 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS PCLK */
296 0x0ec (PIN_OUTPUT_PULLUP | MUX_MODE0) /* DSS AC BIAS EN */
297
298 >;
299 };
300
301 qspi_pins: qspi_pins {
302 pinctrl-single,pins = <
303 0x7c (PIN_OUTPUT_PULLUP | MUX_MODE3) /* gpmc_csn0.qspi_csn */
304 0x88 (PIN_OUTPUT | MUX_MODE2) /* gpmc_csn3.qspi_clk */
305 0x90 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_advn_ale.qspi_d0 */
306 0x94 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_oen_ren.qspi_d1 */
307 0x98 (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_wen.qspi_d2 */
308 0x9c (PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_be0n_cle.qspi_d3 */
309 >;
310 };
311
312 mcasp1_pins: mcasp1_pins {
313 pinctrl-single,pins = <
314 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
315 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
316 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
317 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
318 >;
319 };
320
321 lcd_pins: lcd_pins {
322 pinctrl-single,pins = <
323 /* GPIO 5_8 to select LCD / HDMI */
324 0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7)
325 >;
326 };
327};
328
329&i2c0 {
330 status = "okay";
331 pinctrl-names = "default";
332 pinctrl-0 = <&i2c0_pins>;
333 clock-frequency = <400000>;
334
335 tps@24 {
336 compatible = "ti,tps65218";
337 reg = <0x24>;
338 interrupt-parent = <&gic>;
339 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
340 interrupt-controller;
341 #interrupt-cells = <2>;
342
343 dcdc1: regulator-dcdc1 {
344 compatible = "ti,tps65218-dcdc1";
345 /* VDD_CORE limits min of OPP50 and max of OPP100 */
346 regulator-name = "vdd_core";
347 regulator-min-microvolt = <912000>;
348 regulator-max-microvolt = <1144000>;
349 regulator-boot-on;
350 regulator-always-on;
351 };
352
353 dcdc2: regulator-dcdc2 {
354 compatible = "ti,tps65218-dcdc2";
355 /* VDD_MPU limits min of OPP50 and max of OPP_NITRO */
356 regulator-name = "vdd_mpu";
357 regulator-min-microvolt = <912000>;
358 regulator-max-microvolt = <1378000>;
359 regulator-boot-on;
360 regulator-always-on;
361 };
362
363 dcdc3: regulator-dcdc3 {
364 compatible = "ti,tps65218-dcdc3";
365 regulator-name = "vdds_ddr";
366 regulator-min-microvolt = <1350000>;
367 regulator-max-microvolt = <1350000>;
368 regulator-boot-on;
369 regulator-always-on;
370 };
371
372 dcdc4: regulator-dcdc4 {
373 compatible = "ti,tps65218-dcdc4";
374 regulator-name = "v3_3d";
375 regulator-min-microvolt = <3300000>;
376 regulator-max-microvolt = <3300000>;
377 regulator-boot-on;
378 regulator-always-on;
379 };
380
381 ldo1: regulator-ldo1 {
382 compatible = "ti,tps65218-ldo1";
383 regulator-name = "v1_8d";
384 regulator-min-microvolt = <1800000>;
385 regulator-max-microvolt = <1800000>;
386 regulator-boot-on;
387 regulator-always-on;
388 };
389
390 };
391
392 at24@50 {
393 compatible = "at24,24c256";
394 pagesize = <64>;
395 reg = <0x50>;
396 };
397};
398
399&i2c1 {
400 status = "okay";
401 pinctrl-names = "default";
402 pinctrl-0 = <&i2c1_pins>;
403 clock-frequency = <400000>;
404
405 edt-ft5306@38 {
406 status = "okay";
407 compatible = "edt,edt-ft5306", "edt,edt-ft5x06";
408 pinctrl-names = "default";
409 pinctrl-0 = <&edt_ft5306_ts_pins>;
410
411 reg = <0x38>;
412 interrupt-parent = <&gpio0>;
413 interrupts = <31 0>;
414
415 wake-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
416
417 touchscreen-size-x = <480>;
418 touchscreen-size-y = <272>;
419 };
420
421 tlv320aic3106: tlv320aic3106@1b {
422 compatible = "ti,tlv320aic3106";
423 reg = <0x1b>;
424 status = "okay";
425
426 /* Regulators */
427 AVDD-supply = <&dcdc4>;
428 IOVDD-supply = <&dcdc4>;
429 DRVDD-supply = <&dcdc4>;
430 DVDD-supply = <&ldo1>;
431 };
432
433 lis331dlh@18 {
434 compatible = "st,lis331dlh";
435 reg = <0x18>;
436 status = "okay";
437
438 Vdd-supply = <&dcdc4>;
439 Vdd_IO-supply = <&dcdc4>;
440 interrupts-extended = <&gpio1 6 0>, <&gpio2 1 0>;
441 };
442};
443
444&epwmss0 {
445 status = "okay";
446};
447
448&ecap0 {
449 status = "okay";
450 pinctrl-names = "default";
451 pinctrl-0 = <&ecap0_pins>;
452};
453
454&gpio0 {
455 status = "okay";
456};
457
458&gpio1 {
459 status = "okay";
460};
461
462&gpio5 {
463 status = "okay";
464};
465
466&mmc1 {
467 status = "okay";
468 pinctrl-names = "default";
469 pinctrl-0 = <&mmc1_pins>;
470
471 vmmc-supply = <&dcdc4>;
472 bus-width = <4>;
473 cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
474};
475
476&usb2_phy1 {
477 status = "okay";
478};
479
480&usb1 {
481 dr_mode = "peripheral";
482 status = "okay";
483};
484
485&usb2_phy2 {
486 status = "okay";
487};
488
489&usb2 {
490 dr_mode = "host";
491 status = "okay";
492};
493
494&qspi {
495 status = "okay";
496 pinctrl-names = "default";
497 pinctrl-0 = <&qspi_pins>;
498
499 spi-max-frequency = <48000000>;
500 m25p80@0 {
501 compatible = "mx66l51235l";
502 spi-max-frequency = <48000000>;
503 reg = <0>;
504 spi-cpol;
505 spi-cpha;
506 spi-tx-bus-width = <1>;
507 spi-rx-bus-width = <4>;
508 #address-cells = <1>;
509 #size-cells = <1>;
510
511 /* MTD partition table.
512 * The ROM checks the first 512KiB
513 * for a valid file to boot(XIP).
514 */
515 partition@0 {
516 label = "QSPI.U_BOOT";
517 reg = <0x00000000 0x000080000>;
518 };
519 partition@1 {
520 label = "QSPI.U_BOOT.backup";
521 reg = <0x00080000 0x00080000>;
522 };
523 partition@2 {
524 label = "QSPI.U-BOOT-SPL_OS";
525 reg = <0x00100000 0x00010000>;
526 };
527 partition@3 {
528 label = "QSPI.U_BOOT_ENV";
529 reg = <0x00110000 0x00010000>;
530 };
531 partition@4 {
532 label = "QSPI.U-BOOT-ENV.backup";
533 reg = <0x00120000 0x00010000>;
534 };
535 partition@5 {
536 label = "QSPI.KERNEL";
537 reg = <0x00130000 0x0800000>;
538 };
539 partition@6 {
540 label = "QSPI.FILESYSTEM";
541 reg = <0x00930000 0x36D0000>;
542 };
543 };
544};
545
546&mac {
547 pinctrl-names = "default", "sleep";
548 pinctrl-0 = <&cpsw_default>;
549 pinctrl-1 = <&cpsw_sleep>;
550 dual_emac = <1>;
551 status = "okay";
552};
553
554&davinci_mdio {
555 pinctrl-names = "default", "sleep";
556 pinctrl-0 = <&davinci_mdio_default>;
557 pinctrl-1 = <&davinci_mdio_sleep>;
558 status = "okay";
559};
560
561&cpsw_emac0 {
562 phy_id = <&davinci_mdio>, <4>;
563 phy-mode = "rgmii";
564 dual_emac_res_vlan = <1>;
565};
566
567&cpsw_emac1 {
568 phy_id = <&davinci_mdio>, <5>;
569 phy-mode = "rgmii";
570 dual_emac_res_vlan = <2>;
571};
572
573&elm {
574 status = "okay";
575};
576
577&mcasp1 {
578 pinctrl-names = "default";
579 pinctrl-0 = <&mcasp1_pins>;
580
581 status = "okay";
582
583 op-mode = <0>;
584 tdm-slots = <2>;
585 serial-dir = <
586 0 0 1 2
587 >;
588
589 tx-num-evt = <1>;
590 rx-num-evt = <1>;
591};
592
593&dss {
594 status = "okay";
595
596 pinctrl-names = "default";
597 pinctrl-0 = <&dss_pins>;
598
599 port {
600 dpi_out: endpoint@0 {
601 remote-endpoint = <&lcd_in>;
602 data-lines = <24>;
603 };
604 };
605};
606
607&rtc {
608 status = "okay";
609};
610
611&wdt {
612 status = "okay";
613};
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
index 90098f98a5c8..ed7dd2395915 100644
--- a/arch/arm/boot/dts/am43x-epos-evm.dts
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -327,6 +327,65 @@
327 status = "okay"; 327 status = "okay";
328 pinctrl-names = "default"; 328 pinctrl-names = "default";
329 pinctrl-0 = <&i2c0_pins>; 329 pinctrl-0 = <&i2c0_pins>;
330 clock-frequency = <400000>;
331
332 tps65218: tps65218@24 {
333 reg = <0x24>;
334 compatible = "ti,tps65218";
335 interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* NMIn */
336 interrupt-parent = <&gic>;
337 interrupt-controller;
338 #interrupt-cells = <2>;
339
340 dcdc1: regulator-dcdc1 {
341 compatible = "ti,tps65218-dcdc1";
342 regulator-name = "vdd_core";
343 regulator-min-microvolt = <912000>;
344 regulator-max-microvolt = <1144000>;
345 regulator-boot-on;
346 regulator-always-on;
347 };
348
349 dcdc2: regulator-dcdc2 {
350 compatible = "ti,tps65218-dcdc2";
351 regulator-name = "vdd_mpu";
352 regulator-min-microvolt = <912000>;
353 regulator-max-microvolt = <1378000>;
354 regulator-boot-on;
355 regulator-always-on;
356 };
357
358 dcdc3: regulator-dcdc3 {
359 compatible = "ti,tps65218-dcdc3";
360 regulator-name = "vdcdc3";
361 regulator-min-microvolt = <1350000>;
362 regulator-max-microvolt = <1350000>;
363 regulator-boot-on;
364 regulator-always-on;
365 };
366
367 dcdc5: regulator-dcdc5 {
368 compatible = "ti,tps65218-dcdc5";
369 regulator-name = "v1_0bat";
370 regulator-min-microvolt = <1000000>;
371 regulator-max-microvolt = <1000000>;
372 };
373
374 dcdc6: regulator-dcdc6 {
375 compatible = "ti,tps65218-dcdc6";
376 regulator-name = "v1_8bat";
377 regulator-min-microvolt = <1800000>;
378 regulator-max-microvolt = <1800000>;
379 };
380
381 ldo1: regulator-ldo1 {
382 compatible = "ti,tps65218-ldo1";
383 regulator-min-microvolt = <1800000>;
384 regulator-max-microvolt = <1800000>;
385 regulator-boot-on;
386 regulator-always-on;
387 };
388 };
330 389
331 at24@50 { 390 at24@50 {
332 compatible = "at24,24c256"; 391 compatible = "at24,24c256";
@@ -344,8 +403,8 @@
344 403
345 attb-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>; 404 attb-gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>;
346 405
347 x-size = <1024>; 406 touchscreen-size-x = <1024>;
348 y-size = <600>; 407 touchscreen-size-y = <600>;
349 }; 408 };
350}; 409};
351 410
diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts
index 3c4f6d983cbd..4e0ad3b82796 100644
--- a/arch/arm/boot/dts/animeo_ip.dts
+++ b/arch/arm/boot/dts/animeo_ip.dts
@@ -40,6 +40,14 @@
40 compatible = "atmel,osc", "fixed-clock"; 40 compatible = "atmel,osc", "fixed-clock";
41 clock-frequency = <18432000>; 41 clock-frequency = <18432000>;
42 }; 42 };
43
44 slow_xtal {
45 clock-frequency = <32768>;
46 };
47
48 main_xtal {
49 clock-frequency = <18432000>;
50 };
43 }; 51 };
44 52
45 ahb { 53 ahb {
diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts
index 1e2919d43d78..929ae00b4063 100644
--- a/arch/arm/boot/dts/armada-375-db.dts
+++ b/arch/arm/boot/dts/armada-375-db.dts
@@ -123,6 +123,32 @@
123 cd-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; 123 cd-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
124 wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; 124 wp-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
125 }; 125 };
126
127 mdio {
128 phy0: ethernet-phy@0 {
129 reg = <0>;
130 };
131
132 phy3: ethernet-phy@3 {
133 reg = <3>;
134 };
135 };
136
137 ethernet@f0000 {
138 status = "okay";
139
140 eth0@c4000 {
141 status = "okay";
142 phy = <&phy0>;
143 phy-mode = "rgmii-id";
144 };
145
146 eth1@c5000 {
147 status = "okay";
148 phy = <&phy3>;
149 phy-mode = "gmii";
150 };
151 };
126 }; 152 };
127 153
128 pcie-controller { 154 pcie-controller {
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index fb92551a1e71..c1e49e7bf0fa 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -25,6 +25,8 @@
25 gpio0 = &gpio0; 25 gpio0 = &gpio0;
26 gpio1 = &gpio1; 26 gpio1 = &gpio1;
27 gpio2 = &gpio2; 27 gpio2 = &gpio2;
28 ethernet0 = &eth0;
29 ethernet1 = &eth1;
28 }; 30 };
29 31
30 clocks { 32 clocks {
@@ -151,6 +153,38 @@
151 <0xc100 0x100>; 153 <0xc100 0x100>;
152 }; 154 };
153 155
156 mdio {
157 #address-cells = <1>;
158 #size-cells = <0>;
159 compatible = "marvell,orion-mdio";
160 reg = <0xc0054 0x4>;
161 clocks = <&gateclk 19>;
162 };
163
164 /* Network controller */
165 ethernet@f0000 {
166 compatible = "marvell,armada-375-pp2";
167 reg = <0xf0000 0xa000>, /* Packet Processor regs */
168 <0xc0000 0x3060>, /* LMS regs */
169 <0xc4000 0x100>, /* eth0 regs */
170 <0xc5000 0x100>; /* eth1 regs */
171 clocks = <&gateclk 3>, <&gateclk 19>;
172 clock-names = "pp_clk", "gop_clk";
173 status = "disabled";
174
175 eth0: eth0@c4000 {
176 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
177 port-id = <0>;
178 status = "disabled";
179 };
180
181 eth1: eth1@c5000 {
182 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
183 port-id = <1>;
184 status = "disabled";
185 };
186 };
187
154 spi0: spi@10600 { 188 spi0: spi@10600 {
155 compatible = "marvell,orion-spi"; 189 compatible = "marvell,orion-spi";
156 reg = <0x10600 0x50>; 190 reg = <0x10600 0x50>;
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 689fa1a46728..242d0ecc99f3 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -286,6 +286,11 @@
286 reg = <0x20800 0x10>; 286 reg = <0x20800 0x10>;
287 }; 287 };
288 288
289 mpcore-soc-ctrl@20d20 {
290 compatible = "marvell,armada-380-mpcore-soc-ctrl";
291 reg = <0x20d20 0x6c>;
292 };
293
289 coherency-fabric@21010 { 294 coherency-fabric@21010 {
290 compatible = "marvell,armada-380-coherency-fabric"; 295 compatible = "marvell,armada-380-coherency-fabric";
291 reg = <0x21010 0x1c>; 296 reg = <0x21010 0x1c>;
diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
new file mode 100644
index 000000000000..469cf7137595
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
@@ -0,0 +1,284 @@
1/*
2 * Device Tree file for Lenovo Iomega ix4-300d
3 *
4 * Copyright (C) 2014, Benoit Masson <yahoo@perenite.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
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/dts-v1/;
13
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/gpio/gpio.h>
16#include "armada-xp-mv78230.dtsi"
17
18/ {
19 model = "Lenovo Iomega ix4-300d";
20 compatible = "lenovo,ix4-300d", "marvell,armadaxp-mv78230",
21 "marvell,armadaxp", "marvell,armada-370-xp";
22
23 chosen {
24 bootargs = "console=ttyS0,115200 earlyprintk";
25 stdout-path = "/soc/internal-regs/serial@12000";
26 };
27
28 memory {
29 device_type = "memory";
30 reg = <0 0x00000000 0 0x20000000>; /* 512MB */
31 };
32
33 soc {
34 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
35 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
36
37 pcie-controller {
38 status = "okay";
39
40 /* Quad port sata: Marvell 88SX7042 */
41 pcie@1,0 {
42 /* Port 0, Lane 0 */
43 status = "okay";
44 };
45
46 /* USB 3.0 xHCI controller: NEC D720200F1 */
47 pcie@5,0 {
48 /* Port 1, Lane 0 */
49 status = "okay";
50 };
51 };
52
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 {
86 status = "okay";
87 };
88
89 mdio {
90 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
91 reg = <0>;
92 };
93
94 phy1: ethernet-phy@1 { /* Marvell 88E1318 */
95 reg = <1>;
96 };
97 };
98
99 ethernet@70000 {
100 status = "okay";
101 phy = <&phy0>;
102 phy-mode = "rgmii-id";
103 };
104
105 ethernet@74000 {
106 status = "okay";
107 phy = <&phy1>;
108 phy-mode = "rgmii-id";
109 };
110
111 usb@50000 {
112 status = "okay";
113 };
114
115 usb@51000 {
116 status = "okay";
117 };
118
119 i2c@11000 {
120 clock-frequency = <400000>;
121 status = "okay";
122
123 adt7473@2e {
124 compatible = "adi,adt7473";
125 reg = <0x2e>;
126 };
127
128 pcf8563@51 {
129 compatible = "nxp,pcf8563";
130 reg = <0x51>;
131 };
132
133 };
134
135 nand@d0000 {
136 status = "okay";
137 num-cs = <1>;
138 marvell,nand-keep-config;
139 marvell,nand-enable-arbiter;
140 nand-on-flash-bbt;
141
142 partition@0 {
143 label = "u-boot";
144 reg = <0x0000000 0xe0000>;
145 read-only;
146 };
147
148 partition@e0000 {
149 label = "u-boot-env";
150 reg = <0xe0000 0x20000>;
151 read-only;
152 };
153
154 partition@100000 {
155 label = "u-boot-env2";
156 reg = <0x100000 0x20000>;
157 read-only;
158 };
159
160 partition@120000 {
161 label = "zImage";
162 reg = <0x120000 0x400000>;
163 };
164
165 partition@520000 {
166 label = "initrd";
167 reg = <0x520000 0x400000>;
168 };
169
170 partition@xE00000 {
171 label = "boot";
172 reg = <0xE00000 0x3F200000>;
173 };
174
175 partition@flash {
176 label = "flash";
177 reg = <0x0 0x40000000>;
178 };
179 };
180 };
181 };
182
183 gpio-keys {
184 compatible = "gpio-keys";
185 pinctrl-0 = <&power_button_pin &reset_button_pin
186 &select_button_pin &scroll_button_pin>;
187 pinctrl-names = "default";
188
189 power-button {
190 label = "Power Button";
191 linux,code = <KEY_POWER>;
192 gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
193 };
194
195 reset-button {
196 label = "Reset Button";
197 linux,code = <KEY_RESTART>;
198 gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
199 };
200
201 select-button {
202 label = "Select Button";
203 linux,code = <BTN_SELECT>;
204 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
205 };
206
207 scroll-button {
208 label = "Scroll Button";
209 linux,code = <KEY_SCROLLDOWN>;
210 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
211 };
212 };
213
214 spi3 {
215 compatible = "spi-gpio";
216 status = "okay";
217 gpio-sck = <&gpio0 25 GPIO_ACTIVE_LOW>;
218 gpio-mosi = <&gpio1 15 GPIO_ACTIVE_LOW>; /*gpio 47*/
219 cs-gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
220 num-chipselects = <1>;
221 #address-cells = <1>;
222 #size-cells = <0>;
223
224 gpio_spi: gpio_spi@0 {
225 compatible = "fairchild,74hc595";
226 gpio-controller;
227 #gpio-cells = <2>;
228 reg = <0>;
229 registers-number = <2>;
230 spi-max-frequency = <100000>;
231 };
232 };
233
234 gpio-leds {
235 compatible = "gpio-leds";
236 pinctrl-0 = <&hdd_led_pin>;
237 pinctrl-names = "default";
238
239 hdd-led {
240 label = "ix4-300d:hdd:blue";
241 gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
242 default-state = "off";
243 };
244
245 power-led {
246 label = "ix4-300d:power:white";
247 gpios = <&gpio_spi 1 GPIO_ACTIVE_LOW>;
248 /* init blinking while booting */
249 linux,default-trigger = "timer";
250 default-state = "on";
251 };
252
253 sysfail-led {
254 label = "ix4-300d:sysfail:red";
255 gpios = <&gpio_spi 2 GPIO_ACTIVE_HIGH>;
256 default-state = "off";
257 };
258
259 sys-led {
260 label = "ix4-300d:sys:blue";
261 gpios = <&gpio_spi 3 GPIO_ACTIVE_HIGH>;
262 default-state = "off";
263 };
264
265 hddfail-led {
266 label = "ix4-300d:hddfail:red";
267 gpios = <&gpio_spi 4 GPIO_ACTIVE_HIGH>;
268 default-state = "off";
269 };
270
271 };
272
273 /*
274 * Warning: you need both eth1 & 0 PHY initialized (i.e having
275 * them up does the tweak) for poweroff to shutdown otherwise it
276 * reboots
277 */
278 gpio-poweroff {
279 compatible = "gpio-poweroff";
280 pinctrl-0 = <&poweroff_pin>;
281 pinctrl-names = "default";
282 gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
283 };
284};
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
index 1257ff1ed278..2592e1c13560 100644
--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -34,6 +34,7 @@
34 compatible = "marvell,sheeva-v7"; 34 compatible = "marvell,sheeva-v7";
35 reg = <0>; 35 reg = <0>;
36 clocks = <&cpuclk 0>; 36 clocks = <&cpuclk 0>;
37 clock-latency = <1000000>;
37 }; 38 };
38 39
39 cpu@1 { 40 cpu@1 {
@@ -41,6 +42,7 @@
41 compatible = "marvell,sheeva-v7"; 42 compatible = "marvell,sheeva-v7";
42 reg = <1>; 43 reg = <1>;
43 clocks = <&cpuclk 1>; 44 clocks = <&cpuclk 1>;
45 clock-latency = <1000000>;
44 }; 46 };
45 }; 47 };
46 48
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index 3396b25b39e1..480e237a870f 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -36,6 +36,7 @@
36 compatible = "marvell,sheeva-v7"; 36 compatible = "marvell,sheeva-v7";
37 reg = <0>; 37 reg = <0>;
38 clocks = <&cpuclk 0>; 38 clocks = <&cpuclk 0>;
39 clock-latency = <1000000>;
39 }; 40 };
40 41
41 cpu@1 { 42 cpu@1 {
@@ -43,6 +44,7 @@
43 compatible = "marvell,sheeva-v7"; 44 compatible = "marvell,sheeva-v7";
44 reg = <1>; 45 reg = <1>;
45 clocks = <&cpuclk 1>; 46 clocks = <&cpuclk 1>;
47 clock-latency = <1000000>;
46 }; 48 };
47 }; 49 };
48 50
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index 6da84bf40aaf..2c7b1fef4703 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -37,6 +37,7 @@
37 compatible = "marvell,sheeva-v7"; 37 compatible = "marvell,sheeva-v7";
38 reg = <0>; 38 reg = <0>;
39 clocks = <&cpuclk 0>; 39 clocks = <&cpuclk 0>;
40 clock-latency = <1000000>;
40 }; 41 };
41 42
42 cpu@1 { 43 cpu@1 {
@@ -44,6 +45,7 @@
44 compatible = "marvell,sheeva-v7"; 45 compatible = "marvell,sheeva-v7";
45 reg = <1>; 46 reg = <1>;
46 clocks = <&cpuclk 1>; 47 clocks = <&cpuclk 1>;
48 clock-latency = <1000000>;
47 }; 49 };
48 50
49 cpu@2 { 51 cpu@2 {
@@ -51,6 +53,7 @@
51 compatible = "marvell,sheeva-v7"; 53 compatible = "marvell,sheeva-v7";
52 reg = <2>; 54 reg = <2>;
53 clocks = <&cpuclk 2>; 55 clocks = <&cpuclk 2>;
56 clock-latency = <1000000>;
54 }; 57 };
55 58
56 cpu@3 { 59 cpu@3 {
@@ -58,6 +61,7 @@
58 compatible = "marvell,sheeva-v7"; 61 compatible = "marvell,sheeva-v7";
59 reg = <3>; 62 reg = <3>;
60 clocks = <&cpuclk 3>; 63 clocks = <&cpuclk 3>;
64 clock-latency = <1000000>;
61 }; 65 };
62 }; 66 };
63 67
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index 5902e8359c91..bff9f6c18db1 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -99,7 +99,7 @@
99 cpuclk: clock-complex@18700 { 99 cpuclk: clock-complex@18700 {
100 #clock-cells = <1>; 100 #clock-cells = <1>;
101 compatible = "marvell,armada-xp-cpu-clock"; 101 compatible = "marvell,armada-xp-cpu-clock";
102 reg = <0x18700 0xA0>; 102 reg = <0x18700 0xA0>, <0x1c054 0x10>;
103 clocks = <&coreclk 1>; 103 clocks = <&coreclk 1>;
104 }; 104 };
105 105
diff --git a/arch/arm/boot/dts/at91-ariag25.dts b/arch/arm/boot/dts/at91-ariag25.dts
index 55ab6180e350..e9ced30159a7 100644
--- a/arch/arm/boot/dts/at91-ariag25.dts
+++ b/arch/arm/boot/dts/at91-ariag25.dts
@@ -42,6 +42,14 @@
42 compatible = "atmel,osc", "fixed-clock"; 42 compatible = "atmel,osc", "fixed-clock";
43 clock-frequency = <12000000>; 43 clock-frequency = <12000000>;
44 }; 44 };
45
46 slow_xtal {
47 clock-frequency = <32768>;
48 };
49
50 main_xtal {
51 clock-frequency = <12000000>;
52 };
45 }; 53 };
46 54
47 ahb { 55 ahb {
diff --git a/arch/arm/boot/dts/at91-cosino.dtsi b/arch/arm/boot/dts/at91-cosino.dtsi
index df4b78695695..b6ea3f4a7206 100644
--- a/arch/arm/boot/dts/at91-cosino.dtsi
+++ b/arch/arm/boot/dts/at91-cosino.dtsi
@@ -34,6 +34,14 @@
34 compatible = "atmel,osc", "fixed-clock"; 34 compatible = "atmel,osc", "fixed-clock";
35 clock-frequency = <12000000>; 35 clock-frequency = <12000000>;
36 }; 36 };
37
38 slow_xtal {
39 clock-frequency = <32768>;
40 };
41
42 main_xtal {
43 clock-frequency = <12000000>;
44 };
37 }; 45 };
38 46
39 ahb { 47 ahb {
diff --git a/arch/arm/boot/dts/at91-foxg20.dts b/arch/arm/boot/dts/at91-foxg20.dts
index cbe967343997..f89598af4c2b 100644
--- a/arch/arm/boot/dts/at91-foxg20.dts
+++ b/arch/arm/boot/dts/at91-foxg20.dts
@@ -31,6 +31,14 @@
31 compatible = "atmel,osc", "fixed-clock"; 31 compatible = "atmel,osc", "fixed-clock";
32 clock-frequency = <18432000>; 32 clock-frequency = <18432000>;
33 }; 33 };
34
35 slow_xtal {
36 clock-frequency = <32768>;
37 };
38
39 main_xtal {
40 clock-frequency = <18432000>;
41 };
34 }; 42 };
35 43
36 ahb { 44 ahb {
diff --git a/arch/arm/boot/dts/at91-qil_a9260.dts b/arch/arm/boot/dts/at91-qil_a9260.dts
index 5576ae8786c0..a9aef53ab764 100644
--- a/arch/arm/boot/dts/at91-qil_a9260.dts
+++ b/arch/arm/boot/dts/at91-qil_a9260.dts
@@ -28,6 +28,14 @@
28 compatible = "atmel,osc", "fixed-clock"; 28 compatible = "atmel,osc", "fixed-clock";
29 clock-frequency = <12000000>; 29 clock-frequency = <12000000>;
30 }; 30 };
31
32 slow_xtal {
33 clock-frequency = <32768>;
34 };
35
36 main_xtal {
37 clock-frequency = <12000000>;
38 };
31 }; 39 };
32 40
33 ahb { 41 ahb {
diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
index 5b8e40400bec..fec1fca2ad66 100644
--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
@@ -21,12 +21,14 @@
21 reg = <0x20000000 0x10000000>; 21 reg = <0x20000000 0x10000000>;
22 }; 22 };
23 23
24 slow_xtal { 24 clocks {
25 clock-frequency = <32768>; 25 slow_xtal {
26 }; 26 clock-frequency = <32768>;
27 };
27 28
28 main_xtal { 29 main_xtal {
29 clock-frequency = <12000000>; 30 clock-frequency = <12000000>;
31 };
30 }; 32 };
31 33
32 ahb { 34 ahb {
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index c61b16fba79b..65ccf564b9a5 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -14,6 +14,7 @@
14#include <dt-bindings/pinctrl/at91.h> 14#include <dt-bindings/pinctrl/at91.h>
15#include <dt-bindings/interrupt-controller/irq.h> 15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/clock/at91.h>
17 18
18/ { 19/ {
19 model = "Atmel AT91RM9200 family SoC"; 20 model = "Atmel AT91RM9200 family SoC";
@@ -51,6 +52,20 @@
51 reg = <0x20000000 0x04000000>; 52 reg = <0x20000000 0x04000000>;
52 }; 53 };
53 54
55 clocks {
56 slow_xtal: slow_xtal {
57 compatible = "fixed-clock";
58 #clock-cells = <0>;
59 clock-frequency = <0>;
60 };
61
62 main_xtal: main_xtal {
63 compatible = "fixed-clock";
64 #clock-cells = <0>;
65 clock-frequency = <0>;
66 };
67 };
68
54 ahb { 69 ahb {
55 compatible = "simple-bus"; 70 compatible = "simple-bus";
56 #address-cells = <1>; 71 #address-cells = <1>;
@@ -79,6 +94,260 @@
79 pmc: pmc@fffffc00 { 94 pmc: pmc@fffffc00 {
80 compatible = "atmel,at91rm9200-pmc"; 95 compatible = "atmel,at91rm9200-pmc";
81 reg = <0xfffffc00 0x100>; 96 reg = <0xfffffc00 0x100>;
97 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
98 interrupt-controller;
99 #address-cells = <1>;
100 #size-cells = <0>;
101 #interrupt-cells = <1>;
102
103 main_osc: main_osc {
104 compatible = "atmel,at91rm9200-clk-main-osc";
105 #clock-cells = <0>;
106 interrupts-extended = <&pmc AT91_PMC_MOSCS>;
107 clocks = <&main_xtal>;
108 };
109
110 main: mainck {
111 compatible = "atmel,at91rm9200-clk-main";
112 #clock-cells = <0>;
113 clocks = <&main_osc>;
114 };
115
116 plla: pllack {
117 compatible = "atmel,at91rm9200-clk-pll";
118 #clock-cells = <0>;
119 interrupts-extended = <&pmc AT91_PMC_LOCKA>;
120 clocks = <&main>;
121 reg = <0>;
122 atmel,clk-input-range = <1000000 32000000>;
123 #atmel,pll-clk-output-range-cells = <3>;
124 atmel,pll-clk-output-ranges = <80000000 160000000 0>,
125 <150000000 180000000 2>;
126 };
127
128 pllb: pllbck {
129 compatible = "atmel,at91rm9200-clk-pll";
130 #clock-cells = <0>;
131 interrupts-extended = <&pmc AT91_PMC_LOCKB>;
132 clocks = <&main>;
133 reg = <1>;
134 atmel,clk-input-range = <1000000 32000000>;
135 #atmel,pll-clk-output-range-cells = <3>;
136 atmel,pll-clk-output-ranges = <80000000 160000000 0>,
137 <150000000 180000000 2>;
138 };
139
140 mck: masterck {
141 compatible = "atmel,at91rm9200-clk-master";
142 #clock-cells = <0>;
143 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
144 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
145 atmel,clk-output-range = <0 80000000>;
146 atmel,clk-divisors = <1 2 3 4>;
147 };
148
149 usb: usbck {
150 compatible = "atmel,at91rm9200-clk-usb";
151 #clock-cells = <0>;
152 atmel,clk-divisors = <1 2>;
153 clocks = <&pllb>;
154 };
155
156 prog: progck {
157 compatible = "atmel,at91rm9200-clk-programmable";
158 #address-cells = <1>;
159 #size-cells = <0>;
160 interrupt-parent = <&pmc>;
161 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
162
163 prog0: prog0 {
164 #clock-cells = <0>;
165 reg = <0>;
166 interrupts = <AT91_PMC_PCKRDY(0)>;
167 };
168
169 prog1: prog1 {
170 #clock-cells = <0>;
171 reg = <1>;
172 interrupts = <AT91_PMC_PCKRDY(1)>;
173 };
174
175 prog2: prog2 {
176 #clock-cells = <0>;
177 reg = <2>;
178 interrupts = <AT91_PMC_PCKRDY(2)>;
179 };
180
181 prog3: prog3 {
182 #clock-cells = <0>;
183 reg = <3>;
184 interrupts = <AT91_PMC_PCKRDY(3)>;
185 };
186 };
187
188 systemck {
189 compatible = "atmel,at91rm9200-clk-system";
190 #address-cells = <1>;
191 #size-cells = <0>;
192
193 udpck: udpck {
194 #clock-cells = <0>;
195 reg = <2>;
196 clocks = <&usb>;
197 };
198
199 uhpck: uhpck {
200 #clock-cells = <0>;
201 reg = <4>;
202 clocks = <&usb>;
203 };
204
205 pck0: pck0 {
206 #clock-cells = <0>;
207 reg = <8>;
208 clocks = <&prog0>;
209 };
210
211 pck1: pck1 {
212 #clock-cells = <0>;
213 reg = <9>;
214 clocks = <&prog1>;
215 };
216
217 pck2: pck2 {
218 #clock-cells = <0>;
219 reg = <10>;
220 clocks = <&prog2>;
221 };
222
223 pck3: pck3 {
224 #clock-cells = <0>;
225 reg = <11>;
226 clocks = <&prog3>;
227 };
228 };
229
230 periphck {
231 compatible = "atmel,at91rm9200-clk-peripheral";
232 #address-cells = <1>;
233 #size-cells = <0>;
234 clocks = <&mck>;
235
236 pioA_clk: pioA_clk {
237 #clock-cells = <0>;
238 reg = <2>;
239 };
240
241 pioB_clk: pioB_clk {
242 #clock-cells = <0>;
243 reg = <3>;
244 };
245
246 pioC_clk: pioC_clk {
247 #clock-cells = <0>;
248 reg = <4>;
249 };
250
251 pioD_clk: pioD_clk {
252 #clock-cells = <0>;
253 reg = <5>;
254 };
255
256 usart0_clk: usart0_clk {
257 #clock-cells = <0>;
258 reg = <6>;
259 };
260
261 usart1_clk: usart1_clk {
262 #clock-cells = <0>;
263 reg = <7>;
264 };
265
266 usart2_clk: usart2_clk {
267 #clock-cells = <0>;
268 reg = <8>;
269 };
270
271 usart3_clk: usart3_clk {
272 #clock-cells = <0>;
273 reg = <9>;
274 };
275
276 mci0_clk: mci0_clk {
277 #clock-cells = <0>;
278 reg = <10>;
279 };
280
281 udc_clk: udc_clk {
282 #clock-cells = <0>;
283 reg = <11>;
284 };
285
286 twi0_clk: twi0_clk {
287 reg = <12>;
288 #clock-cells = <0>;
289 };
290
291 spi0_clk: spi0_clk {
292 #clock-cells = <0>;
293 reg = <13>;
294 };
295
296 ssc0_clk: ssc0_clk {
297 #clock-cells = <0>;
298 reg = <14>;
299 };
300
301 ssc1_clk: ssc1_clk {
302 #clock-cells = <0>;
303 reg = <15>;
304 };
305
306 ssc2_clk: ssc2_clk {
307 #clock-cells = <0>;
308 reg = <16>;
309 };
310
311 tc0_clk: tc0_clk {
312 #clock-cells = <0>;
313 reg = <17>;
314 };
315
316 tc1_clk: tc1_clk {
317 #clock-cells = <0>;
318 reg = <18>;
319 };
320
321 tc2_clk: tc2_clk {
322 #clock-cells = <0>;
323 reg = <19>;
324 };
325
326 tc3_clk: tc3_clk {
327 #clock-cells = <0>;
328 reg = <20>;
329 };
330
331 tc4_clk: tc4_clk {
332 #clock-cells = <0>;
333 reg = <21>;
334 };
335
336 tc5_clk: tc5_clk {
337 #clock-cells = <0>;
338 reg = <22>;
339 };
340
341 ohci_clk: ohci_clk {
342 #clock-cells = <0>;
343 reg = <23>;
344 };
345
346 macb0_clk: macb0_clk {
347 #clock-cells = <0>;
348 reg = <24>;
349 };
350 };
82 }; 351 };
83 352
84 st: timer@fffffd00 { 353 st: timer@fffffd00 {
@@ -93,6 +362,8 @@
93 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0 362 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
94 18 IRQ_TYPE_LEVEL_HIGH 0 363 18 IRQ_TYPE_LEVEL_HIGH 0
95 19 IRQ_TYPE_LEVEL_HIGH 0>; 364 19 IRQ_TYPE_LEVEL_HIGH 0>;
365 clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
366 clock-names = "t0_clk", "t1_clk", "t2_clk";
96 }; 367 };
97 368
98 tcb1: timer@fffa4000 { 369 tcb1: timer@fffa4000 {
@@ -101,6 +372,8 @@
101 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0 372 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0
102 21 IRQ_TYPE_LEVEL_HIGH 0 373 21 IRQ_TYPE_LEVEL_HIGH 0
103 22 IRQ_TYPE_LEVEL_HIGH 0>; 374 22 IRQ_TYPE_LEVEL_HIGH 0>;
375 clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
376 clock-names = "t0_clk", "t1_clk", "t2_clk";
104 }; 377 };
105 378
106 i2c0: i2c@fffb8000 { 379 i2c0: i2c@fffb8000 {
@@ -109,6 +382,7 @@
109 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>; 382 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>;
110 pinctrl-names = "default"; 383 pinctrl-names = "default";
111 pinctrl-0 = <&pinctrl_twi>; 384 pinctrl-0 = <&pinctrl_twi>;
385 clocks = <&twi0_clk>;
112 #address-cells = <1>; 386 #address-cells = <1>;
113 #size-cells = <0>; 387 #size-cells = <0>;
114 status = "disabled"; 388 status = "disabled";
@@ -118,6 +392,8 @@
118 compatible = "atmel,hsmci"; 392 compatible = "atmel,hsmci";
119 reg = <0xfffb4000 0x4000>; 393 reg = <0xfffb4000 0x4000>;
120 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>; 394 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
395 clocks = <&mci0_clk>;
396 clock-names = "mci_clk";
121 #address-cells = <1>; 397 #address-cells = <1>;
122 #size-cells = <0>; 398 #size-cells = <0>;
123 pinctrl-names = "default"; 399 pinctrl-names = "default";
@@ -130,6 +406,8 @@
130 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 406 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
131 pinctrl-names = "default"; 407 pinctrl-names = "default";
132 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 408 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
409 clocks = <&ssc0_clk>;
410 clock-names = "pclk";
133 status = "disable"; 411 status = "disable";
134 }; 412 };
135 413
@@ -139,6 +417,8 @@
139 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; 417 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
140 pinctrl-names = "default"; 418 pinctrl-names = "default";
141 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 419 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
420 clocks = <&ssc1_clk>;
421 clock-names = "pclk";
142 status = "disable"; 422 status = "disable";
143 }; 423 };
144 424
@@ -148,6 +428,8 @@
148 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; 428 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
149 pinctrl-names = "default"; 429 pinctrl-names = "default";
150 pinctrl-0 = <&pinctrl_ssc2_tx &pinctrl_ssc2_rx>; 430 pinctrl-0 = <&pinctrl_ssc2_tx &pinctrl_ssc2_rx>;
431 clocks = <&ssc2_clk>;
432 clock-names = "pclk";
151 status = "disable"; 433 status = "disable";
152 }; 434 };
153 435
@@ -158,6 +440,8 @@
158 phy-mode = "rmii"; 440 phy-mode = "rmii";
159 pinctrl-names = "default"; 441 pinctrl-names = "default";
160 pinctrl-0 = <&pinctrl_macb_rmii>; 442 pinctrl-0 = <&pinctrl_macb_rmii>;
443 clocks = <&macb0_clk>;
444 clock-names = "ether_clk";
161 status = "disabled"; 445 status = "disabled";
162 }; 446 };
163 447
@@ -496,6 +780,7 @@
496 gpio-controller; 780 gpio-controller;
497 interrupt-controller; 781 interrupt-controller;
498 #interrupt-cells = <2>; 782 #interrupt-cells = <2>;
783 clocks = <&pioA_clk>;
499 }; 784 };
500 785
501 pioB: gpio@fffff600 { 786 pioB: gpio@fffff600 {
@@ -506,6 +791,7 @@
506 gpio-controller; 791 gpio-controller;
507 interrupt-controller; 792 interrupt-controller;
508 #interrupt-cells = <2>; 793 #interrupt-cells = <2>;
794 clocks = <&pioB_clk>;
509 }; 795 };
510 796
511 pioC: gpio@fffff800 { 797 pioC: gpio@fffff800 {
@@ -516,6 +802,7 @@
516 gpio-controller; 802 gpio-controller;
517 interrupt-controller; 803 interrupt-controller;
518 #interrupt-cells = <2>; 804 #interrupt-cells = <2>;
805 clocks = <&pioC_clk>;
519 }; 806 };
520 807
521 pioD: gpio@fffffa00 { 808 pioD: gpio@fffffa00 {
@@ -526,6 +813,7 @@
526 gpio-controller; 813 gpio-controller;
527 interrupt-controller; 814 interrupt-controller;
528 #interrupt-cells = <2>; 815 #interrupt-cells = <2>;
816 clocks = <&pioD_clk>;
529 }; 817 };
530 }; 818 };
531 819
@@ -535,6 +823,8 @@
535 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 823 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
536 pinctrl-names = "default"; 824 pinctrl-names = "default";
537 pinctrl-0 = <&pinctrl_dbgu>; 825 pinctrl-0 = <&pinctrl_dbgu>;
826 clocks = <&mck>;
827 clock-names = "usart";
538 status = "disabled"; 828 status = "disabled";
539 }; 829 };
540 830
@@ -546,6 +836,8 @@
546 atmel,use-dma-tx; 836 atmel,use-dma-tx;
547 pinctrl-names = "default"; 837 pinctrl-names = "default";
548 pinctrl-0 = <&pinctrl_uart0>; 838 pinctrl-0 = <&pinctrl_uart0>;
839 clocks = <&usart0_clk>;
840 clock-names = "usart";
549 status = "disabled"; 841 status = "disabled";
550 }; 842 };
551 843
@@ -557,6 +849,8 @@
557 atmel,use-dma-tx; 849 atmel,use-dma-tx;
558 pinctrl-names = "default"; 850 pinctrl-names = "default";
559 pinctrl-0 = <&pinctrl_uart1>; 851 pinctrl-0 = <&pinctrl_uart1>;
852 clocks = <&usart1_clk>;
853 clock-names = "usart";
560 status = "disabled"; 854 status = "disabled";
561 }; 855 };
562 856
@@ -568,6 +862,8 @@
568 atmel,use-dma-tx; 862 atmel,use-dma-tx;
569 pinctrl-names = "default"; 863 pinctrl-names = "default";
570 pinctrl-0 = <&pinctrl_uart2>; 864 pinctrl-0 = <&pinctrl_uart2>;
865 clocks = <&usart2_clk>;
866 clock-names = "usart";
571 status = "disabled"; 867 status = "disabled";
572 }; 868 };
573 869
@@ -579,6 +875,8 @@
579 atmel,use-dma-tx; 875 atmel,use-dma-tx;
580 pinctrl-names = "default"; 876 pinctrl-names = "default";
581 pinctrl-0 = <&pinctrl_uart3>; 877 pinctrl-0 = <&pinctrl_uart3>;
878 clocks = <&usart3_clk>;
879 clock-names = "usart";
582 status = "disabled"; 880 status = "disabled";
583 }; 881 };
584 882
@@ -586,6 +884,8 @@
586 compatible = "atmel,at91rm9200-udc"; 884 compatible = "atmel,at91rm9200-udc";
587 reg = <0xfffb0000 0x4000>; 885 reg = <0xfffb0000 0x4000>;
588 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 2>; 886 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 2>;
887 clocks = <&udc_clk>, <&udpck>;
888 clock-names = "pclk", "hclk";
589 status = "disabled"; 889 status = "disabled";
590 }; 890 };
591 891
@@ -597,6 +897,8 @@
597 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>; 897 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
598 pinctrl-names = "default"; 898 pinctrl-names = "default";
599 pinctrl-0 = <&pinctrl_spi0>; 899 pinctrl-0 = <&pinctrl_spi0>;
900 clocks = <&spi0_clk>;
901 clock-names = "spi_clk";
600 status = "disabled"; 902 status = "disabled";
601 }; 903 };
602 }; 904 };
@@ -622,6 +924,8 @@
622 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 924 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
623 reg = <0x00300000 0x100000>; 925 reg = <0x00300000 0x100000>;
624 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>; 926 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>;
927 clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>;
928 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
625 status = "disabled"; 929 status = "disabled";
626 }; 930 };
627 }; 931 };
diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts
index df6b0aa0e4dd..43eb779dd6f6 100644
--- a/arch/arm/boot/dts/at91rm9200ek.dts
+++ b/arch/arm/boot/dts/at91rm9200ek.dts
@@ -25,6 +25,14 @@
25 compatible = "atmel,osc", "fixed-clock"; 25 compatible = "atmel,osc", "fixed-clock";
26 clock-frequency = <18432000>; 26 clock-frequency = <18432000>;
27 }; 27 };
28
29 slow_xtal {
30 clock-frequency = <32768>;
31 };
32
33 main_xtal {
34 clock-frequency = <18432000>;
35 };
28 }; 36 };
29 37
30 ahb { 38 ahb {
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index c0e0eae16a27..cb100b03a362 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -12,6 +12,7 @@
12#include <dt-bindings/pinctrl/at91.h> 12#include <dt-bindings/pinctrl/at91.h>
13#include <dt-bindings/interrupt-controller/irq.h> 13#include <dt-bindings/interrupt-controller/irq.h>
14#include <dt-bindings/gpio/gpio.h> 14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/clock/at91.h>
15 16
16/ { 17/ {
17 model = "Atmel AT91SAM9260 family SoC"; 18 model = "Atmel AT91SAM9260 family SoC";
@@ -48,6 +49,26 @@
48 reg = <0x20000000 0x04000000>; 49 reg = <0x20000000 0x04000000>;
49 }; 50 };
50 51
52 clocks {
53 slow_xtal: slow_xtal {
54 compatible = "fixed-clock";
55 #clock-cells = <0>;
56 clock-frequency = <0>;
57 };
58
59 main_xtal: main_xtal {
60 compatible = "fixed-clock";
61 #clock-cells = <0>;
62 clock-frequency = <0>;
63 };
64
65 adc_op_clk: adc_op_clk{
66 compatible = "fixed-clock";
67 #clock-cells = <0>;
68 clock-frequency = <5000000>;
69 };
70 };
71
51 ahb { 72 ahb {
52 compatible = "simple-bus"; 73 compatible = "simple-bus";
53 #address-cells = <1>; 74 #address-cells = <1>;
@@ -74,8 +95,260 @@
74 }; 95 };
75 96
76 pmc: pmc@fffffc00 { 97 pmc: pmc@fffffc00 {
77 compatible = "atmel,at91rm9200-pmc"; 98 compatible = "atmel,at91sam9260-pmc";
78 reg = <0xfffffc00 0x100>; 99 reg = <0xfffffc00 0x100>;
100 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
101 interrupt-controller;
102 #address-cells = <1>;
103 #size-cells = <0>;
104 #interrupt-cells = <1>;
105
106 main_osc: main_osc {
107 compatible = "atmel,at91rm9200-clk-main-osc";
108 #clock-cells = <0>;
109 interrupts-extended = <&pmc AT91_PMC_MOSCS>;
110 clocks = <&main_xtal>;
111 };
112
113 main: mainck {
114 compatible = "atmel,at91rm9200-clk-main";
115 #clock-cells = <0>;
116 clocks = <&main_osc>;
117 };
118
119 slow_rc_osc: slow_rc_osc {
120 compatible = "fixed-clock";
121 #clock-cells = <0>;
122 clock-frequency = <32768>;
123 clock-accuracy = <50000000>;
124 };
125
126 clk32k: slck {
127 compatible = "atmel,at91sam9260-clk-slow";
128 #clock-cells = <0>;
129 clocks = <&slow_rc_osc>, <&slow_xtal>;
130 };
131
132 plla: pllack {
133 compatible = "atmel,at91rm9200-clk-pll";
134 #clock-cells = <0>;
135 interrupts-extended = <&pmc AT91_PMC_LOCKA>;
136 clocks = <&main>;
137 reg = <0>;
138 atmel,clk-input-range = <1000000 32000000>;
139 #atmel,pll-clk-output-range-cells = <4>;
140 atmel,pll-clk-output-ranges = <80000000 160000000 0 1>,
141 <150000000 240000000 2 1>;
142 };
143
144 pllb: pllbck {
145 compatible = "atmel,at91rm9200-clk-pll";
146 #clock-cells = <0>;
147 interrupts-extended = <&pmc AT91_PMC_LOCKB>;
148 clocks = <&main>;
149 reg = <1>;
150 atmel,clk-input-range = <1000000 5000000>;
151 #atmel,pll-clk-output-range-cells = <4>;
152 atmel,pll-clk-output-ranges = <70000000 130000000 1 1>;
153 };
154
155 mck: masterck {
156 compatible = "atmel,at91rm9200-clk-master";
157 #clock-cells = <0>;
158 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
159 clocks = <&clk32k>, <&main>, <&plla>, <&pllb>;
160 atmel,clk-output-range = <0 105000000>;
161 atmel,clk-divisors = <1 2 4 0>;
162 };
163
164 usb: usbck {
165 compatible = "atmel,at91rm9200-clk-usb";
166 #clock-cells = <0>;
167 atmel,clk-divisors = <1 2 4 0>;
168 clocks = <&pllb>;
169 };
170
171 prog: progck {
172 compatible = "atmel,at91rm9200-clk-programmable";
173 #address-cells = <1>;
174 #size-cells = <0>;
175 interrupt-parent = <&pmc>;
176 clocks = <&clk32k>, <&main>, <&plla>, <&pllb>;
177
178 prog0: prog0 {
179 #clock-cells = <0>;
180 reg = <0>;
181 interrupts = <AT91_PMC_PCKRDY(0)>;
182 };
183
184 prog1: prog1 {
185 #clock-cells = <0>;
186 reg = <1>;
187 interrupts = <AT91_PMC_PCKRDY(1)>;
188 };
189 };
190
191 systemck {
192 compatible = "atmel,at91rm9200-clk-system";
193 #address-cells = <1>;
194 #size-cells = <0>;
195
196 uhpck: uhpck {
197 #clock-cells = <0>;
198 reg = <6>;
199 clocks = <&usb>;
200 };
201
202 udpck: udpck {
203 #clock-cells = <0>;
204 reg = <7>;
205 clocks = <&usb>;
206 };
207
208 pck0: pck0 {
209 #clock-cells = <0>;
210 reg = <8>;
211 clocks = <&prog0>;
212 };
213
214 pck1: pck1 {
215 #clock-cells = <0>;
216 reg = <9>;
217 clocks = <&prog1>;
218 };
219 };
220
221 periphck {
222 compatible = "atmel,at91rm9200-clk-peripheral";
223 #address-cells = <1>;
224 #size-cells = <0>;
225 clocks = <&mck>;
226
227 pioA_clk: pioA_clk {
228 #clock-cells = <0>;
229 reg = <2>;
230 };
231
232 pioB_clk: pioB_clk {
233 #clock-cells = <0>;
234 reg = <3>;
235 };
236
237 pioC_clk: pioC_clk {
238 #clock-cells = <0>;
239 reg = <4>;
240 };
241
242 adc_clk: adc_clk {
243 #clock-cells = <0>;
244 reg = <5>;
245 };
246
247 usart0_clk: usart0_clk {
248 #clock-cells = <0>;
249 reg = <6>;
250 };
251
252 usart1_clk: usart1_clk {
253 #clock-cells = <0>;
254 reg = <7>;
255 };
256
257 usart2_clk: usart2_clk {
258 #clock-cells = <0>;
259 reg = <8>;
260 };
261
262 mci0_clk: mci0_clk {
263 #clock-cells = <0>;
264 reg = <9>;
265 };
266
267 udc_clk: udc_clk {
268 #clock-cells = <0>;
269 reg = <10>;
270 };
271
272 twi0_clk: twi0_clk {
273 reg = <11>;
274 #clock-cells = <0>;
275 };
276
277 spi0_clk: spi0_clk {
278 #clock-cells = <0>;
279 reg = <12>;
280 };
281
282 spi1_clk: spi1_clk {
283 #clock-cells = <0>;
284 reg = <13>;
285 };
286
287 ssc0_clk: ssc0_clk {
288 #clock-cells = <0>;
289 reg = <14>;
290 };
291
292 tc0_clk: tc0_clk {
293 #clock-cells = <0>;
294 reg = <17>;
295 };
296
297 tc1_clk: tc1_clk {
298 #clock-cells = <0>;
299 reg = <18>;
300 };
301
302 tc2_clk: tc2_clk {
303 #clock-cells = <0>;
304 reg = <19>;
305 };
306
307 ohci_clk: ohci_clk {
308 #clock-cells = <0>;
309 reg = <20>;
310 };
311
312 macb0_clk: macb0_clk {
313 #clock-cells = <0>;
314 reg = <21>;
315 };
316
317 isi_clk: isi_clk {
318 #clock-cells = <0>;
319 reg = <22>;
320 };
321
322 usart3_clk: usart3_clk {
323 #clock-cells = <0>;
324 reg = <23>;
325 };
326
327 uart0_clk: uart0_clk {
328 #clock-cells = <0>;
329 reg = <24>;
330 };
331
332 uart1_clk: uart1_clk {
333 #clock-cells = <0>;
334 reg = <25>;
335 };
336
337 tc3_clk: tc3_clk {
338 #clock-cells = <0>;
339 reg = <26>;
340 };
341
342 tc4_clk: tc4_clk {
343 #clock-cells = <0>;
344 reg = <27>;
345 };
346
347 tc5_clk: tc5_clk {
348 #clock-cells = <0>;
349 reg = <28>;
350 };
351 };
79 }; 352 };
80 353
81 rstc@fffffd00 { 354 rstc@fffffd00 {
@@ -92,6 +365,7 @@
92 compatible = "atmel,at91sam9260-pit"; 365 compatible = "atmel,at91sam9260-pit";
93 reg = <0xfffffd30 0xf>; 366 reg = <0xfffffd30 0xf>;
94 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 367 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
368 clocks = <&mck>;
95 }; 369 };
96 370
97 tcb0: timer@fffa0000 { 371 tcb0: timer@fffa0000 {
@@ -100,6 +374,8 @@
100 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0 374 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
101 18 IRQ_TYPE_LEVEL_HIGH 0 375 18 IRQ_TYPE_LEVEL_HIGH 0
102 19 IRQ_TYPE_LEVEL_HIGH 0>; 376 19 IRQ_TYPE_LEVEL_HIGH 0>;
377 clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
378 clock-names = "t0_clk", "t1_clk", "t2_clk";
103 }; 379 };
104 380
105 tcb1: timer@fffdc000 { 381 tcb1: timer@fffdc000 {
@@ -108,6 +384,8 @@
108 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0 384 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0
109 27 IRQ_TYPE_LEVEL_HIGH 0 385 27 IRQ_TYPE_LEVEL_HIGH 0
110 28 IRQ_TYPE_LEVEL_HIGH 0>; 386 28 IRQ_TYPE_LEVEL_HIGH 0>;
387 clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
388 clock-names = "t0_clk", "t1_clk", "t2_clk";
111 }; 389 };
112 390
113 pinctrl@fffff400 { 391 pinctrl@fffff400 {
@@ -443,6 +721,7 @@
443 gpio-controller; 721 gpio-controller;
444 interrupt-controller; 722 interrupt-controller;
445 #interrupt-cells = <2>; 723 #interrupt-cells = <2>;
724 clocks = <&pioA_clk>;
446 }; 725 };
447 726
448 pioB: gpio@fffff600 { 727 pioB: gpio@fffff600 {
@@ -453,6 +732,7 @@
453 gpio-controller; 732 gpio-controller;
454 interrupt-controller; 733 interrupt-controller;
455 #interrupt-cells = <2>; 734 #interrupt-cells = <2>;
735 clocks = <&pioB_clk>;
456 }; 736 };
457 737
458 pioC: gpio@fffff800 { 738 pioC: gpio@fffff800 {
@@ -463,6 +743,7 @@
463 gpio-controller; 743 gpio-controller;
464 interrupt-controller; 744 interrupt-controller;
465 #interrupt-cells = <2>; 745 #interrupt-cells = <2>;
746 clocks = <&pioC_clk>;
466 }; 747 };
467 }; 748 };
468 749
@@ -472,6 +753,8 @@
472 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 753 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
473 pinctrl-names = "default"; 754 pinctrl-names = "default";
474 pinctrl-0 = <&pinctrl_dbgu>; 755 pinctrl-0 = <&pinctrl_dbgu>;
756 clocks = <&mck>;
757 clock-names = "usart";
475 status = "disabled"; 758 status = "disabled";
476 }; 759 };
477 760
@@ -483,6 +766,8 @@
483 atmel,use-dma-tx; 766 atmel,use-dma-tx;
484 pinctrl-names = "default"; 767 pinctrl-names = "default";
485 pinctrl-0 = <&pinctrl_usart0>; 768 pinctrl-0 = <&pinctrl_usart0>;
769 clocks = <&usart0_clk>;
770 clock-names = "usart";
486 status = "disabled"; 771 status = "disabled";
487 }; 772 };
488 773
@@ -494,6 +779,8 @@
494 atmel,use-dma-tx; 779 atmel,use-dma-tx;
495 pinctrl-names = "default"; 780 pinctrl-names = "default";
496 pinctrl-0 = <&pinctrl_usart1>; 781 pinctrl-0 = <&pinctrl_usart1>;
782 clocks = <&usart1_clk>;
783 clock-names = "usart";
497 status = "disabled"; 784 status = "disabled";
498 }; 785 };
499 786
@@ -505,6 +792,8 @@
505 atmel,use-dma-tx; 792 atmel,use-dma-tx;
506 pinctrl-names = "default"; 793 pinctrl-names = "default";
507 pinctrl-0 = <&pinctrl_usart2>; 794 pinctrl-0 = <&pinctrl_usart2>;
795 clocks = <&usart2_clk>;
796 clock-names = "usart";
508 status = "disabled"; 797 status = "disabled";
509 }; 798 };
510 799
@@ -516,6 +805,8 @@
516 atmel,use-dma-tx; 805 atmel,use-dma-tx;
517 pinctrl-names = "default"; 806 pinctrl-names = "default";
518 pinctrl-0 = <&pinctrl_usart3>; 807 pinctrl-0 = <&pinctrl_usart3>;
808 clocks = <&usart3_clk>;
809 clock-names = "usart";
519 status = "disabled"; 810 status = "disabled";
520 }; 811 };
521 812
@@ -527,6 +818,8 @@
527 atmel,use-dma-tx; 818 atmel,use-dma-tx;
528 pinctrl-names = "default"; 819 pinctrl-names = "default";
529 pinctrl-0 = <&pinctrl_uart0>; 820 pinctrl-0 = <&pinctrl_uart0>;
821 clocks = <&uart0_clk>;
822 clock-names = "usart";
530 status = "disabled"; 823 status = "disabled";
531 }; 824 };
532 825
@@ -538,6 +831,8 @@
538 atmel,use-dma-tx; 831 atmel,use-dma-tx;
539 pinctrl-names = "default"; 832 pinctrl-names = "default";
540 pinctrl-0 = <&pinctrl_uart1>; 833 pinctrl-0 = <&pinctrl_uart1>;
834 clocks = <&uart1_clk>;
835 clock-names = "usart";
541 status = "disabled"; 836 status = "disabled";
542 }; 837 };
543 838
@@ -547,6 +842,8 @@
547 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>; 842 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
548 pinctrl-names = "default"; 843 pinctrl-names = "default";
549 pinctrl-0 = <&pinctrl_macb_rmii>; 844 pinctrl-0 = <&pinctrl_macb_rmii>;
845 clocks = <&macb0_clk>, <&macb0_clk>;
846 clock-names = "hclk", "pclk";
550 status = "disabled"; 847 status = "disabled";
551 }; 848 };
552 849
@@ -554,6 +851,8 @@
554 compatible = "atmel,at91rm9200-udc"; 851 compatible = "atmel,at91rm9200-udc";
555 reg = <0xfffa4000 0x4000>; 852 reg = <0xfffa4000 0x4000>;
556 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 2>; 853 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 2>;
854 clocks = <&udc_clk>, <&udpck>;
855 clock-names = "pclk", "hclk";
557 status = "disabled"; 856 status = "disabled";
558 }; 857 };
559 858
@@ -563,6 +862,7 @@
563 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 6>; 862 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 6>;
564 #address-cells = <1>; 863 #address-cells = <1>;
565 #size-cells = <0>; 864 #size-cells = <0>;
865 clocks = <&twi0_clk>;
566 status = "disabled"; 866 status = "disabled";
567 }; 867 };
568 868
@@ -573,6 +873,8 @@
573 #address-cells = <1>; 873 #address-cells = <1>;
574 #size-cells = <0>; 874 #size-cells = <0>;
575 pinctrl-names = "default"; 875 pinctrl-names = "default";
876 clocks = <&mci0_clk>;
877 clock-names = "mci_clk";
576 status = "disabled"; 878 status = "disabled";
577 }; 879 };
578 880
@@ -582,6 +884,8 @@
582 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 884 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
583 pinctrl-names = "default"; 885 pinctrl-names = "default";
584 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 886 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
887 clocks = <&ssc0_clk>;
888 clock-names = "pclk";
585 status = "disabled"; 889 status = "disabled";
586 }; 890 };
587 891
@@ -593,6 +897,8 @@
593 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 3>; 897 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 3>;
594 pinctrl-names = "default"; 898 pinctrl-names = "default";
595 pinctrl-0 = <&pinctrl_spi0>; 899 pinctrl-0 = <&pinctrl_spi0>;
900 clocks = <&spi0_clk>;
901 clock-names = "spi_clk";
596 status = "disabled"; 902 status = "disabled";
597 }; 903 };
598 904
@@ -604,6 +910,8 @@
604 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>; 910 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
605 pinctrl-names = "default"; 911 pinctrl-names = "default";
606 pinctrl-0 = <&pinctrl_spi1>; 912 pinctrl-0 = <&pinctrl_spi1>;
913 clocks = <&spi1_clk>;
914 clock-names = "spi_clk";
607 status = "disabled"; 915 status = "disabled";
608 }; 916 };
609 917
@@ -613,6 +921,8 @@
613 compatible = "atmel,at91sam9260-adc"; 921 compatible = "atmel,at91sam9260-adc";
614 reg = <0xfffe0000 0x100>; 922 reg = <0xfffe0000 0x100>;
615 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 0>; 923 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 0>;
924 clocks = <&adc_clk>, <&adc_op_clk>;
925 clock-names = "adc_clk", "adc_op_clk";
616 atmel,adc-use-external-triggers; 926 atmel,adc-use-external-triggers;
617 atmel,adc-channels-used = <0xf>; 927 atmel,adc-channels-used = <0xf>;
618 atmel,adc-vref = <3300>; 928 atmel,adc-vref = <3300>;
@@ -680,6 +990,8 @@
680 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 990 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
681 reg = <0x00500000 0x100000>; 991 reg = <0x00500000 0x100000>;
682 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 2>; 992 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 2>;
993 clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>;
994 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
683 status = "disabled"; 995 status = "disabled";
684 }; 996 };
685 }; 997 };
diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
index 04927db1d6bf..a81aab4281a7 100644
--- a/arch/arm/boot/dts/at91sam9261.dtsi
+++ b/arch/arm/boot/dts/at91sam9261.dtsi
@@ -46,16 +46,18 @@
46 reg = <0x20000000 0x08000000>; 46 reg = <0x20000000 0x08000000>;
47 }; 47 };
48 48
49 main_xtal: main_xtal { 49 clocks {
50 compatible = "fixed-clock"; 50 main_xtal: main_xtal {
51 #clock-cells = <0>; 51 compatible = "fixed-clock";
52 clock-frequency = <0>; 52 #clock-cells = <0>;
53 }; 53 clock-frequency = <0>;
54 };
54 55
55 slow_xtal: slow_xtal { 56 slow_xtal: slow_xtal {
56 compatible = "fixed-clock"; 57 compatible = "fixed-clock";
57 #clock-cells = <0>; 58 #clock-cells = <0>;
58 clock-frequency = <0>; 59 clock-frequency = <0>;
60 };
59 }; 61 };
60 62
61 ahb { 63 ahb {
diff --git a/arch/arm/boot/dts/at91sam9261ek.dts b/arch/arm/boot/dts/at91sam9261ek.dts
index aa35a7aec9a8..f4a765729c7a 100644
--- a/arch/arm/boot/dts/at91sam9261ek.dts
+++ b/arch/arm/boot/dts/at91sam9261ek.dts
@@ -20,14 +20,6 @@
20 reg = <0x20000000 0x4000000>; 20 reg = <0x20000000 0x4000000>;
21 }; 21 };
22 22
23 slow_xtal {
24 clock-frequency = <32768>;
25 };
26
27 main_xtal {
28 clock-frequency = <18432000>;
29 };
30
31 clocks { 23 clocks {
32 #address-cells = <1>; 24 #address-cells = <1>;
33 #size-cells = <1>; 25 #size-cells = <1>;
@@ -37,6 +29,14 @@
37 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
38 clock-frequency = <18432000>; 30 clock-frequency = <18432000>;
39 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <18432000>;
39 };
40 }; 40 };
41 41
42 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index fece8665fb63..bb23c2d33cf8 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -10,6 +10,7 @@
10#include <dt-bindings/pinctrl/at91.h> 10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h> 11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/gpio/gpio.h> 12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/clock/at91.h>
13 14
14/ { 15/ {
15 model = "Atmel AT91SAM9263 family SoC"; 16 model = "Atmel AT91SAM9263 family SoC";
@@ -32,6 +33,7 @@
32 ssc1 = &ssc1; 33 ssc1 = &ssc1;
33 pwm0 = &pwm0; 34 pwm0 = &pwm0;
34 }; 35 };
36
35 cpus { 37 cpus {
36 #address-cells = <0>; 38 #address-cells = <0>;
37 #size-cells = <0>; 39 #size-cells = <0>;
@@ -46,6 +48,20 @@
46 reg = <0x20000000 0x08000000>; 48 reg = <0x20000000 0x08000000>;
47 }; 49 };
48 50
51 clocks {
52 main_xtal: main_xtal {
53 compatible = "fixed-clock";
54 #clock-cells = <0>;
55 clock-frequency = <0>;
56 };
57
58 slow_xtal: slow_xtal {
59 compatible = "fixed-clock";
60 #clock-cells = <0>;
61 clock-frequency = <0>;
62 };
63 };
64
49 ahb { 65 ahb {
50 compatible = "simple-bus"; 66 compatible = "simple-bus";
51 #address-cells = <1>; 67 #address-cells = <1>;
@@ -69,6 +85,264 @@
69 pmc: pmc@fffffc00 { 85 pmc: pmc@fffffc00 {
70 compatible = "atmel,at91rm9200-pmc"; 86 compatible = "atmel,at91rm9200-pmc";
71 reg = <0xfffffc00 0x100>; 87 reg = <0xfffffc00 0x100>;
88 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
89 interrupt-controller;
90 #address-cells = <1>;
91 #size-cells = <0>;
92 #interrupt-cells = <1>;
93
94 main_osc: main_osc {
95 compatible = "atmel,at91rm9200-clk-main-osc";
96 #clock-cells = <0>;
97 interrupts-extended = <&pmc AT91_PMC_MOSCS>;
98 clocks = <&main_xtal>;
99 };
100
101 main: mainck {
102 compatible = "atmel,at91rm9200-clk-main";
103 #clock-cells = <0>;
104 clocks = <&main_osc>;
105 };
106
107 plla: pllack {
108 compatible = "atmel,at91rm9200-clk-pll";
109 #clock-cells = <0>;
110 interrupts-extended = <&pmc AT91_PMC_LOCKA>;
111 clocks = <&main>;
112 reg = <0>;
113 atmel,clk-input-range = <1000000 32000000>;
114 #atmel,pll-clk-output-range-cells = <4>;
115 atmel,pll-clk-output-ranges = <80000000 200000000 0 1>,
116 <190000000 240000000 2 1>;
117 };
118
119 pllb: pllbck {
120 compatible = "atmel,at91rm9200-clk-pll";
121 #clock-cells = <0>;
122 interrupts-extended = <&pmc AT91_PMC_LOCKB>;
123 clocks = <&main>;
124 reg = <1>;
125 atmel,clk-input-range = <1000000 5000000>;
126 #atmel,pll-clk-output-range-cells = <4>;
127 atmel,pll-clk-output-ranges = <70000000 130000000 1 1>;
128 };
129
130 mck: masterck {
131 compatible = "atmel,at91rm9200-clk-master";
132 #clock-cells = <0>;
133 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
134 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
135 atmel,clk-output-range = <0 120000000>;
136 atmel,clk-divisors = <1 2 4 0>;
137 };
138
139 usb: usbck {
140 compatible = "atmel,at91rm9200-clk-usb";
141 #clock-cells = <0>;
142 atmel,clk-divisors = <1 2 4 0>;
143 clocks = <&pllb>;
144 };
145
146 prog: progck {
147 compatible = "atmel,at91rm9200-clk-programmable";
148 #address-cells = <1>;
149 #size-cells = <0>;
150 interrupt-parent = <&pmc>;
151 clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>;
152
153 prog0: prog0 {
154 #clock-cells = <0>;
155 reg = <0>;
156 interrupts = <AT91_PMC_PCKRDY(0)>;
157 };
158
159 prog1: prog1 {
160 #clock-cells = <0>;
161 reg = <1>;
162 interrupts = <AT91_PMC_PCKRDY(1)>;
163 };
164
165 prog2: prog2 {
166 #clock-cells = <0>;
167 reg = <2>;
168 interrupts = <AT91_PMC_PCKRDY(2)>;
169 };
170
171 prog3: prog3 {
172 #clock-cells = <0>;
173 reg = <3>;
174 interrupts = <AT91_PMC_PCKRDY(3)>;
175 };
176 };
177
178 systemck {
179 compatible = "atmel,at91rm9200-clk-system";
180 #address-cells = <1>;
181 #size-cells = <0>;
182
183 uhpck: uhpck {
184 #clock-cells = <0>;
185 reg = <6>;
186 clocks = <&usb>;
187 };
188
189 udpck: udpck {
190 #clock-cells = <0>;
191 reg = <7>;
192 clocks = <&usb>;
193 };
194
195 pck0: pck0 {
196 #clock-cells = <0>;
197 reg = <8>;
198 clocks = <&prog0>;
199 };
200
201 pck1: pck1 {
202 #clock-cells = <0>;
203 reg = <9>;
204 clocks = <&prog1>;
205 };
206
207 pck2: pck2 {
208 #clock-cells = <0>;
209 reg = <10>;
210 clocks = <&prog2>;
211 };
212
213 pck3: pck3 {
214 #clock-cells = <0>;
215 reg = <11>;
216 clocks = <&prog3>;
217 };
218 };
219
220 periphck {
221 compatible = "atmel,at91rm9200-clk-peripheral";
222 #address-cells = <1>;
223 #size-cells = <0>;
224 clocks = <&mck>;
225
226 pioA_clk: pioA_clk {
227 #clock-cells = <0>;
228 reg = <2>;
229 };
230
231 pioB_clk: pioB_clk {
232 #clock-cells = <0>;
233 reg = <3>;
234 };
235
236 pioCDE_clk: pioCDE_clk {
237 #clock-cells = <0>;
238 reg = <4>;
239 };
240
241 usart0_clk: usart0_clk {
242 #clock-cells = <0>;
243 reg = <7>;
244 };
245
246 usart1_clk: usart1_clk {
247 #clock-cells = <0>;
248 reg = <8>;
249 };
250
251 usart2_clk: usart2_clk {
252 #clock-cells = <0>;
253 reg = <9>;
254 };
255
256 mci0_clk: mci0_clk {
257 #clock-cells = <0>;
258 reg = <10>;
259 };
260
261 mci1_clk: mci1_clk {
262 #clock-cells = <0>;
263 reg = <11>;
264 };
265
266 can_clk: can_clk {
267 #clock-cells = <0>;
268 reg = <12>;
269 };
270
271 twi0_clk: twi0_clk {
272 #clock-cells = <0>;
273 reg = <13>;
274 };
275
276 spi0_clk: spi0_clk {
277 #clock-cells = <0>;
278 reg = <14>;
279 };
280
281 spi1_clk: spi1_clk {
282 #clock-cells = <0>;
283 reg = <15>;
284 };
285
286 ssc0_clk: ssc0_clk {
287 #clock-cells = <0>;
288 reg = <16>;
289 };
290
291 ssc1_clk: ssc1_clk {
292 #clock-cells = <0>;
293 reg = <17>;
294 };
295
296 ac91_clk: ac97_clk {
297 #clock-cells = <0>;
298 reg = <18>;
299 };
300
301 tcb_clk: tcb_clk {
302 #clock-cells = <0>;
303 reg = <19>;
304 };
305
306 pwm_clk: pwm_clk {
307 #clock-cells = <0>;
308 reg = <20>;
309 };
310
311 macb0_clk: macb0_clk {
312 #clock-cells = <0>;
313 reg = <21>;
314 };
315
316 g2de_clk: g2de_clk {
317 #clock-cells = <0>;
318 reg = <23>;
319 };
320
321 udc_clk: udc_clk {
322 #clock-cells = <0>;
323 reg = <24>;
324 };
325
326 isi_clk: isi_clk {
327 #clock-cells = <0>;
328 reg = <25>;
329 };
330
331 lcd_clk: lcd_clk {
332 #clock-cells = <0>;
333 reg = <26>;
334 };
335
336 dma_clk: dma_clk {
337 #clock-cells = <0>;
338 reg = <27>;
339 };
340
341 ohci_clk: ohci_clk {
342 #clock-cells = <0>;
343 reg = <29>;
344 };
345 };
72 }; 346 };
73 347
74 ramc: ramc@ffffe200 { 348 ramc: ramc@ffffe200 {
@@ -81,12 +355,15 @@
81 compatible = "atmel,at91sam9260-pit"; 355 compatible = "atmel,at91sam9260-pit";
82 reg = <0xfffffd30 0xf>; 356 reg = <0xfffffd30 0xf>;
83 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 357 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
358 clocks = <&mck>;
84 }; 359 };
85 360
86 tcb0: timer@fff7c000 { 361 tcb0: timer@fff7c000 {
87 compatible = "atmel,at91rm9200-tcb"; 362 compatible = "atmel,at91rm9200-tcb";
88 reg = <0xfff7c000 0x100>; 363 reg = <0xfff7c000 0x100>;
89 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>; 364 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
365 clocks = <&tcb_clk>;
366 clock-names = "t0_clk";
90 }; 367 };
91 368
92 rstc@fffffd00 { 369 rstc@fffffd00 {
@@ -403,6 +680,7 @@
403 gpio-controller; 680 gpio-controller;
404 interrupt-controller; 681 interrupt-controller;
405 #interrupt-cells = <2>; 682 #interrupt-cells = <2>;
683 clocks = <&pioA_clk>;
406 }; 684 };
407 685
408 pioB: gpio@fffff400 { 686 pioB: gpio@fffff400 {
@@ -413,6 +691,7 @@
413 gpio-controller; 691 gpio-controller;
414 interrupt-controller; 692 interrupt-controller;
415 #interrupt-cells = <2>; 693 #interrupt-cells = <2>;
694 clocks = <&pioB_clk>;
416 }; 695 };
417 696
418 pioC: gpio@fffff600 { 697 pioC: gpio@fffff600 {
@@ -423,6 +702,7 @@
423 gpio-controller; 702 gpio-controller;
424 interrupt-controller; 703 interrupt-controller;
425 #interrupt-cells = <2>; 704 #interrupt-cells = <2>;
705 clocks = <&pioCDE_clk>;
426 }; 706 };
427 707
428 pioD: gpio@fffff800 { 708 pioD: gpio@fffff800 {
@@ -433,6 +713,7 @@
433 gpio-controller; 713 gpio-controller;
434 interrupt-controller; 714 interrupt-controller;
435 #interrupt-cells = <2>; 715 #interrupt-cells = <2>;
716 clocks = <&pioCDE_clk>;
436 }; 717 };
437 718
438 pioE: gpio@fffffa00 { 719 pioE: gpio@fffffa00 {
@@ -443,6 +724,7 @@
443 gpio-controller; 724 gpio-controller;
444 interrupt-controller; 725 interrupt-controller;
445 #interrupt-cells = <2>; 726 #interrupt-cells = <2>;
727 clocks = <&pioCDE_clk>;
446 }; 728 };
447 }; 729 };
448 730
@@ -452,6 +734,8 @@
452 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 734 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
453 pinctrl-names = "default"; 735 pinctrl-names = "default";
454 pinctrl-0 = <&pinctrl_dbgu>; 736 pinctrl-0 = <&pinctrl_dbgu>;
737 clocks = <&mck>;
738 clock-names = "usart";
455 status = "disabled"; 739 status = "disabled";
456 }; 740 };
457 741
@@ -463,6 +747,8 @@
463 atmel,use-dma-tx; 747 atmel,use-dma-tx;
464 pinctrl-names = "default"; 748 pinctrl-names = "default";
465 pinctrl-0 = <&pinctrl_usart0>; 749 pinctrl-0 = <&pinctrl_usart0>;
750 clocks = <&usart0_clk>;
751 clock-names = "usart";
466 status = "disabled"; 752 status = "disabled";
467 }; 753 };
468 754
@@ -474,6 +760,8 @@
474 atmel,use-dma-tx; 760 atmel,use-dma-tx;
475 pinctrl-names = "default"; 761 pinctrl-names = "default";
476 pinctrl-0 = <&pinctrl_usart1>; 762 pinctrl-0 = <&pinctrl_usart1>;
763 clocks = <&usart1_clk>;
764 clock-names = "usart";
477 status = "disabled"; 765 status = "disabled";
478 }; 766 };
479 767
@@ -485,6 +773,8 @@
485 atmel,use-dma-tx; 773 atmel,use-dma-tx;
486 pinctrl-names = "default"; 774 pinctrl-names = "default";
487 pinctrl-0 = <&pinctrl_usart2>; 775 pinctrl-0 = <&pinctrl_usart2>;
776 clocks = <&usart2_clk>;
777 clock-names = "usart";
488 status = "disabled"; 778 status = "disabled";
489 }; 779 };
490 780
@@ -494,6 +784,8 @@
494 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; 784 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
495 pinctrl-names = "default"; 785 pinctrl-names = "default";
496 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 786 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
787 clocks = <&ssc0_clk>;
788 clock-names = "pclk";
497 status = "disabled"; 789 status = "disabled";
498 }; 790 };
499 791
@@ -503,6 +795,8 @@
503 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; 795 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
504 pinctrl-names = "default"; 796 pinctrl-names = "default";
505 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 797 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
798 clocks = <&ssc1_clk>;
799 clock-names = "pclk";
506 status = "disabled"; 800 status = "disabled";
507 }; 801 };
508 802
@@ -512,6 +806,8 @@
512 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>; 806 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
513 pinctrl-names = "default"; 807 pinctrl-names = "default";
514 pinctrl-0 = <&pinctrl_macb_rmii>; 808 pinctrl-0 = <&pinctrl_macb_rmii>;
809 clocks = <&macb0_clk>, <&macb0_clk>;
810 clock-names = "hclk", "pclk";
515 status = "disabled"; 811 status = "disabled";
516 }; 812 };
517 813
@@ -519,6 +815,8 @@
519 compatible = "atmel,at91rm9200-udc"; 815 compatible = "atmel,at91rm9200-udc";
520 reg = <0xfff78000 0x4000>; 816 reg = <0xfff78000 0x4000>;
521 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 2>; 817 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 2>;
818 clocks = <&udc_clk>, <&udpck>;
819 clock-names = "pclk", "hclk";
522 status = "disabled"; 820 status = "disabled";
523 }; 821 };
524 822
@@ -528,6 +826,7 @@
528 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>; 826 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>;
529 #address-cells = <1>; 827 #address-cells = <1>;
530 #size-cells = <0>; 828 #size-cells = <0>;
829 clocks = <&twi0_clk>;
531 status = "disabled"; 830 status = "disabled";
532 }; 831 };
533 832
@@ -537,6 +836,8 @@
537 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>; 836 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
538 #address-cells = <1>; 837 #address-cells = <1>;
539 #size-cells = <0>; 838 #size-cells = <0>;
839 clocks = <&mci0_clk>;
840 clock-names = "mci_clk";
540 status = "disabled"; 841 status = "disabled";
541 }; 842 };
542 843
@@ -546,6 +847,8 @@
546 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>; 847 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
547 #address-cells = <1>; 848 #address-cells = <1>;
548 #size-cells = <0>; 849 #size-cells = <0>;
850 clocks = <&mci1_clk>;
851 clock-names = "mci_clk";
549 status = "disabled"; 852 status = "disabled";
550 }; 853 };
551 854
@@ -568,6 +871,8 @@
568 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 3>; 871 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 3>;
569 pinctrl-names = "default"; 872 pinctrl-names = "default";
570 pinctrl-0 = <&pinctrl_spi0>; 873 pinctrl-0 = <&pinctrl_spi0>;
874 clocks = <&spi0_clk>;
875 clock-names = "spi_clk";
571 status = "disabled"; 876 status = "disabled";
572 }; 877 };
573 878
@@ -579,6 +884,8 @@
579 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 3>; 884 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 3>;
580 pinctrl-names = "default"; 885 pinctrl-names = "default";
581 pinctrl-0 = <&pinctrl_spi1>; 886 pinctrl-0 = <&pinctrl_spi1>;
887 clocks = <&spi1_clk>;
888 clock-names = "spi_clk";
582 status = "disabled"; 889 status = "disabled";
583 }; 890 };
584 891
@@ -587,6 +894,8 @@
587 reg = <0xfffb8000 0x300>; 894 reg = <0xfffb8000 0x300>;
588 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 4>; 895 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 4>;
589 #pwm-cells = <3>; 896 #pwm-cells = <3>;
897 clocks = <&pwm_clk>;
898 clock-names = "pwm_clk";
590 status = "disabled"; 899 status = "disabled";
591 }; 900 };
592 }; 901 };
@@ -622,6 +931,8 @@
622 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 931 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
623 reg = <0x00a00000 0x100000>; 932 reg = <0x00a00000 0x100000>;
624 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 2>; 933 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 2>;
934 clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>;
935 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
625 status = "disabled"; 936 status = "disabled";
626 }; 937 };
627 }; 938 };
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index 15009c9f2293..5cf93eecd8f1 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -29,6 +29,14 @@
29 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <16367660>; 30 clock-frequency = <16367660>;
31 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <16367660>;
39 };
32 }; 40 };
33 41
34 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index b8e79466014f..31f7652612fc 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -25,6 +25,30 @@
25 adc0: adc@fffe0000 { 25 adc0: adc@fffe0000 {
26 atmel,adc-startup-time = <40>; 26 atmel,adc-startup-time = <40>;
27 }; 27 };
28
29 pmc: pmc@fffffc00 {
30 plla: pllack {
31 atmel,clk-input-range = <2000000 32000000>;
32 atmel,pll-clk-output-ranges = <745000000 800000000 0 0>,
33 <695000000 750000000 1 0>,
34 <645000000 700000000 2 0>,
35 <595000000 650000000 3 0>,
36 <545000000 600000000 0 1>,
37 <495000000 550000000 1 1>,
38 <445000000 500000000 2 1>,
39 <400000000 450000000 3 1>;
40 };
41
42 pllb: pllbck {
43 atmel,clk-input-range = <2000000 32000000>;
44 atmel,pll-clk-output-ranges = <30000000 100000000 0 0>;
45 };
46
47 mck: masterck {
48 atmel,clk-output-range = <0 133000000>;
49 atmel,clk-divisors = <1 2 4 6>;
50 };
51 };
28 }; 52 };
29 }; 53 };
30}; 54};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index cb2c010e08e2..d2919108e92d 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -26,6 +26,14 @@
26 compatible = "atmel,osc", "fixed-clock"; 26 compatible = "atmel,osc", "fixed-clock";
27 clock-frequency = <18432000>; 27 clock-frequency = <18432000>;
28 }; 28 };
29
30 slow_xtal {
31 clock-frequency = <32768>;
32 };
33
34 main_xtal {
35 clock-frequency = <18432000>;
36 };
29 }; 37 };
30 38
31 ahb { 39 ahb {
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index ace6bf197b70..932a669156af 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -14,6 +14,7 @@
14#include <dt-bindings/pinctrl/at91.h> 14#include <dt-bindings/pinctrl/at91.h>
15#include <dt-bindings/interrupt-controller/irq.h> 15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/clock/at91.h>
17 18
18/ { 19/ {
19 model = "Atmel AT91SAM9G45 family SoC"; 20 model = "Atmel AT91SAM9G45 family SoC";
@@ -53,6 +54,26 @@
53 reg = <0x70000000 0x10000000>; 54 reg = <0x70000000 0x10000000>;
54 }; 55 };
55 56
57 clocks {
58 slow_xtal: slow_xtal {
59 compatible = "fixed-clock";
60 #clock-cells = <0>;
61 clock-frequency = <0>;
62 };
63
64 main_xtal: main_xtal {
65 compatible = "fixed-clock";
66 #clock-cells = <0>;
67 clock-frequency = <0>;
68 };
69
70 adc_op_clk: adc_op_clk{
71 compatible = "fixed-clock";
72 #clock-cells = <0>;
73 clock-frequency = <300000>;
74 };
75 };
76
56 ahb { 77 ahb {
57 compatible = "simple-bus"; 78 compatible = "simple-bus";
58 #address-cells = <1>; 79 #address-cells = <1>;
@@ -77,11 +98,279 @@
77 compatible = "atmel,at91sam9g45-ddramc"; 98 compatible = "atmel,at91sam9g45-ddramc";
78 reg = <0xffffe400 0x200 99 reg = <0xffffe400 0x200
79 0xffffe600 0x200>; 100 0xffffe600 0x200>;
101 clocks = <&ddrck>;
102 clock-names = "ddrck";
80 }; 103 };
81 104
82 pmc: pmc@fffffc00 { 105 pmc: pmc@fffffc00 {
83 compatible = "atmel,at91rm9200-pmc"; 106 compatible = "atmel,at91sam9g45-pmc";
84 reg = <0xfffffc00 0x100>; 107 reg = <0xfffffc00 0x100>;
108 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
109 interrupt-controller;
110 #address-cells = <1>;
111 #size-cells = <0>;
112 #interrupt-cells = <1>;
113
114 main_osc: main_osc {
115 compatible = "atmel,at91rm9200-clk-main-osc";
116 #clock-cells = <0>;
117 interrupts-extended = <&pmc AT91_PMC_MOSCS>;
118 clocks = <&main_xtal>;
119 };
120
121 main: mainck {
122 compatible = "atmel,at91rm9200-clk-main";
123 #clock-cells = <0>;
124 clocks = <&main_osc>;
125 };
126
127 plla: pllack {
128 compatible = "atmel,at91rm9200-clk-pll";
129 #clock-cells = <0>;
130 interrupts-extended = <&pmc AT91_PMC_LOCKA>;
131 clocks = <&main>;
132 reg = <0>;
133 atmel,clk-input-range = <2000000 32000000>;
134 #atmel,pll-clk-output-range-cells = <4>;
135 atmel,pll-clk-output-ranges = <745000000 800000000 0 0
136 695000000 750000000 1 0
137 645000000 700000000 2 0
138 595000000 650000000 3 0
139 545000000 600000000 0 1
140 495000000 555000000 1 1
141 445000000 500000000 2 1
142 400000000 450000000 3 1>;
143 };
144
145 plladiv: plladivck {
146 compatible = "atmel,at91sam9x5-clk-plldiv";
147 #clock-cells = <0>;
148 clocks = <&plla>;
149 };
150
151 utmi: utmick {
152 compatible = "atmel,at91sam9x5-clk-utmi";
153 #clock-cells = <0>;
154 interrupts-extended = <&pmc AT91_PMC_LOCKU>;
155 clocks = <&main>;
156 };
157
158 mck: masterck {
159 compatible = "atmel,at91rm9200-clk-master";
160 #clock-cells = <0>;
161 interrupts-extended = <&pmc AT91_PMC_MCKRDY>;
162 clocks = <&slow_xtal>, <&main>, <&plladiv>, <&utmi>;
163 atmel,clk-output-range = <0 133333333>;
164 atmel,clk-divisors = <1 2 4 3>;
165 };
166
167 usb: usbck {
168 compatible = "atmel,at91sam9x5-clk-usb";
169 #clock-cells = <0>;
170 clocks = <&plladiv>, <&utmi>;
171 };
172
173 prog: progck {
174 compatible = "atmel,at91sam9g45-clk-programmable";
175 #address-cells = <1>;
176 #size-cells = <0>;
177 interrupt-parent = <&pmc>;
178 clocks = <&slow_xtal>, <&main>, <&plladiv>, <&utmi>, <&mck>;
179
180 prog0: prog0 {
181 #clock-cells = <0>;
182 reg = <0>;
183 interrupts = <AT91_PMC_PCKRDY(0)>;
184 };
185
186 prog1: prog1 {
187 #clock-cells = <0>;
188 reg = <1>;
189 interrupts = <AT91_PMC_PCKRDY(1)>;
190 };
191 };
192
193 systemck {
194 compatible = "atmel,at91rm9200-clk-system";
195 #address-cells = <1>;
196 #size-cells = <0>;
197
198 ddrck: ddrck {
199 #clock-cells = <0>;
200 reg = <2>;
201 clocks = <&mck>;
202 };
203
204 uhpck: uhpck {
205 #clock-cells = <0>;
206 reg = <6>;
207 clocks = <&usb>;
208 };
209
210 pck0: pck0 {
211 #clock-cells = <0>;
212 reg = <8>;
213 clocks = <&prog0>;
214 };
215
216 pck1: pck1 {
217 #clock-cells = <0>;
218 reg = <9>;
219 clocks = <&prog1>;
220 };
221 };
222
223 periphck {
224 compatible = "atmel,at91rm9200-clk-peripheral";
225 #address-cells = <1>;
226 #size-cells = <0>;
227 clocks = <&mck>;
228
229 pioA_clk: pioA_clk {
230 #clock-cells = <0>;
231 reg = <2>;
232 };
233
234 pioB_clk: pioB_clk {
235 #clock-cells = <0>;
236 reg = <3>;
237 };
238
239 pioC_clk: pioC_clk {
240 #clock-cells = <0>;
241 reg = <4>;
242 };
243
244 pioDE_clk: pioDE_clk {
245 #clock-cells = <0>;
246 reg = <5>;
247 };
248
249 trng_clk: trng_clk {
250 #clock-cells = <0>;
251 reg = <6>;
252 };
253
254 usart0_clk: usart0_clk {
255 #clock-cells = <0>;
256 reg = <7>;
257 };
258
259 usart1_clk: usart1_clk {
260 #clock-cells = <0>;
261 reg = <8>;
262 };
263
264 usart2_clk: usart2_clk {
265 #clock-cells = <0>;
266 reg = <9>;
267 };
268
269 usart3_clk: usart3_clk {
270 #clock-cells = <0>;
271 reg = <10>;
272 };
273
274 mci0_clk: mci0_clk {
275 #clock-cells = <0>;
276 reg = <11>;
277 };
278
279 twi0_clk: twi0_clk {
280 #clock-cells = <0>;
281 reg = <12>;
282 };
283
284 twi1_clk: twi1_clk {
285 #clock-cells = <0>;
286 reg = <13>;
287 };
288
289 spi0_clk: spi0_clk {
290 #clock-cells = <0>;
291 reg = <14>;
292 };
293
294 spi1_clk: spi1_clk {
295 #clock-cells = <0>;
296 reg = <15>;
297 };
298
299 ssc0_clk: ssc0_clk {
300 #clock-cells = <0>;
301 reg = <16>;
302 };
303
304 ssc1_clk: ssc1_clk {
305 #clock-cells = <0>;
306 reg = <17>;
307 };
308
309 tcb0_clk: tcb0_clk {
310 #clock-cells = <0>;
311 reg = <18>;
312 };
313
314 pwm_clk: pwm_clk {
315 #clock-cells = <0>;
316 reg = <19>;
317 };
318
319 adc_clk: adc_clk {
320 #clock-cells = <0>;
321 reg = <20>;
322 };
323
324 dma0_clk: dma0_clk {
325 #clock-cells = <0>;
326 reg = <21>;
327 };
328
329 uhphs_clk: uhphs_clk {
330 #clock-cells = <0>;
331 reg = <22>;
332 };
333
334 lcd_clk: lcd_clk {
335 #clock-cells = <0>;
336 reg = <23>;
337 };
338
339 ac97_clk: ac97_clk {
340 #clock-cells = <0>;
341 reg = <24>;
342 };
343
344 macb0_clk: macb0_clk {
345 #clock-cells = <0>;
346 reg = <25>;
347 };
348
349 isi_clk: isi_clk {
350 #clock-cells = <0>;
351 reg = <26>;
352 };
353
354 udphs_clk: udphs_clk {
355 #clock-cells = <0>;
356 reg = <27>;
357 };
358
359 aestdessha_clk: aestdessha_clk {
360 #clock-cells = <0>;
361 reg = <28>;
362 };
363
364 mci1_clk: mci1_clk {
365 #clock-cells = <0>;
366 reg = <29>;
367 };
368
369 vdec_clk: vdec_clk {
370 #clock-cells = <0>;
371 reg = <30>;
372 };
373 };
85 }; 374 };
86 375
87 rstc@fffffd00 { 376 rstc@fffffd00 {
@@ -93,6 +382,7 @@
93 compatible = "atmel,at91sam9260-pit"; 382 compatible = "atmel,at91sam9260-pit";
94 reg = <0xfffffd30 0xf>; 383 reg = <0xfffffd30 0xf>;
95 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 384 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
385 clocks = <&mck>;
96 }; 386 };
97 387
98 388
@@ -105,12 +395,16 @@
105 compatible = "atmel,at91rm9200-tcb"; 395 compatible = "atmel,at91rm9200-tcb";
106 reg = <0xfff7c000 0x100>; 396 reg = <0xfff7c000 0x100>;
107 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>; 397 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
398 clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
399 clock-names = "t0_clk", "t1_clk", "t2_clk";
108 }; 400 };
109 401
110 tcb1: timer@fffd4000 { 402 tcb1: timer@fffd4000 {
111 compatible = "atmel,at91rm9200-tcb"; 403 compatible = "atmel,at91rm9200-tcb";
112 reg = <0xfffd4000 0x100>; 404 reg = <0xfffd4000 0x100>;
113 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>; 405 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
406 clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
407 clock-names = "t0_clk", "t1_clk", "t2_clk";
114 }; 408 };
115 409
116 dma: dma-controller@ffffec00 { 410 dma: dma-controller@ffffec00 {
@@ -118,6 +412,8 @@
118 reg = <0xffffec00 0x200>; 412 reg = <0xffffec00 0x200>;
119 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>; 413 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>;
120 #dma-cells = <2>; 414 #dma-cells = <2>;
415 clocks = <&dma0_clk>;
416 clock-names = "dma_clk";
121 }; 417 };
122 418
123 pinctrl@fffff200 { 419 pinctrl@fffff200 {
@@ -516,6 +812,7 @@
516 gpio-controller; 812 gpio-controller;
517 interrupt-controller; 813 interrupt-controller;
518 #interrupt-cells = <2>; 814 #interrupt-cells = <2>;
815 clocks = <&pioA_clk>;
519 }; 816 };
520 817
521 pioB: gpio@fffff400 { 818 pioB: gpio@fffff400 {
@@ -526,6 +823,7 @@
526 gpio-controller; 823 gpio-controller;
527 interrupt-controller; 824 interrupt-controller;
528 #interrupt-cells = <2>; 825 #interrupt-cells = <2>;
826 clocks = <&pioB_clk>;
529 }; 827 };
530 828
531 pioC: gpio@fffff600 { 829 pioC: gpio@fffff600 {
@@ -536,6 +834,7 @@
536 gpio-controller; 834 gpio-controller;
537 interrupt-controller; 835 interrupt-controller;
538 #interrupt-cells = <2>; 836 #interrupt-cells = <2>;
837 clocks = <&pioC_clk>;
539 }; 838 };
540 839
541 pioD: gpio@fffff800 { 840 pioD: gpio@fffff800 {
@@ -546,6 +845,7 @@
546 gpio-controller; 845 gpio-controller;
547 interrupt-controller; 846 interrupt-controller;
548 #interrupt-cells = <2>; 847 #interrupt-cells = <2>;
848 clocks = <&pioDE_clk>;
549 }; 849 };
550 850
551 pioE: gpio@fffffa00 { 851 pioE: gpio@fffffa00 {
@@ -556,6 +856,7 @@
556 gpio-controller; 856 gpio-controller;
557 interrupt-controller; 857 interrupt-controller;
558 #interrupt-cells = <2>; 858 #interrupt-cells = <2>;
859 clocks = <&pioDE_clk>;
559 }; 860 };
560 }; 861 };
561 862
@@ -565,6 +866,8 @@
565 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 866 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
566 pinctrl-names = "default"; 867 pinctrl-names = "default";
567 pinctrl-0 = <&pinctrl_dbgu>; 868 pinctrl-0 = <&pinctrl_dbgu>;
869 clocks = <&mck>;
870 clock-names = "usart";
568 status = "disabled"; 871 status = "disabled";
569 }; 872 };
570 873
@@ -576,6 +879,8 @@
576 atmel,use-dma-tx; 879 atmel,use-dma-tx;
577 pinctrl-names = "default"; 880 pinctrl-names = "default";
578 pinctrl-0 = <&pinctrl_usart0>; 881 pinctrl-0 = <&pinctrl_usart0>;
882 clocks = <&usart0_clk>;
883 clock-names = "usart";
579 status = "disabled"; 884 status = "disabled";
580 }; 885 };
581 886
@@ -587,6 +892,8 @@
587 atmel,use-dma-tx; 892 atmel,use-dma-tx;
588 pinctrl-names = "default"; 893 pinctrl-names = "default";
589 pinctrl-0 = <&pinctrl_usart1>; 894 pinctrl-0 = <&pinctrl_usart1>;
895 clocks = <&usart1_clk>;
896 clock-names = "usart";
590 status = "disabled"; 897 status = "disabled";
591 }; 898 };
592 899
@@ -598,6 +905,8 @@
598 atmel,use-dma-tx; 905 atmel,use-dma-tx;
599 pinctrl-names = "default"; 906 pinctrl-names = "default";
600 pinctrl-0 = <&pinctrl_usart2>; 907 pinctrl-0 = <&pinctrl_usart2>;
908 clocks = <&usart2_clk>;
909 clock-names = "usart";
601 status = "disabled"; 910 status = "disabled";
602 }; 911 };
603 912
@@ -609,6 +918,8 @@
609 atmel,use-dma-tx; 918 atmel,use-dma-tx;
610 pinctrl-names = "default"; 919 pinctrl-names = "default";
611 pinctrl-0 = <&pinctrl_usart3>; 920 pinctrl-0 = <&pinctrl_usart3>;
921 clocks = <&usart3_clk>;
922 clock-names = "usart";
612 status = "disabled"; 923 status = "disabled";
613 }; 924 };
614 925
@@ -618,6 +929,8 @@
618 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>; 929 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
619 pinctrl-names = "default"; 930 pinctrl-names = "default";
620 pinctrl-0 = <&pinctrl_macb_rmii>; 931 pinctrl-0 = <&pinctrl_macb_rmii>;
932 clocks = <&macb0_clk>, <&macb0_clk>;
933 clock-names = "hclk", "pclk";
621 status = "disabled"; 934 status = "disabled";
622 }; 935 };
623 936
@@ -629,6 +942,7 @@
629 pinctrl-0 = <&pinctrl_i2c0>; 942 pinctrl-0 = <&pinctrl_i2c0>;
630 #address-cells = <1>; 943 #address-cells = <1>;
631 #size-cells = <0>; 944 #size-cells = <0>;
945 clocks = <&twi0_clk>;
632 status = "disabled"; 946 status = "disabled";
633 }; 947 };
634 948
@@ -640,6 +954,7 @@
640 pinctrl-0 = <&pinctrl_i2c1>; 954 pinctrl-0 = <&pinctrl_i2c1>;
641 #address-cells = <1>; 955 #address-cells = <1>;
642 #size-cells = <0>; 956 #size-cells = <0>;
957 clocks = <&twi1_clk>;
643 status = "disabled"; 958 status = "disabled";
644 }; 959 };
645 960
@@ -649,6 +964,8 @@
649 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; 964 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
650 pinctrl-names = "default"; 965 pinctrl-names = "default";
651 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 966 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
967 clocks = <&ssc0_clk>;
968 clock-names = "pclk";
652 status = "disabled"; 969 status = "disabled";
653 }; 970 };
654 971
@@ -658,6 +975,8 @@
658 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; 975 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
659 pinctrl-names = "default"; 976 pinctrl-names = "default";
660 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 977 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
978 clocks = <&ssc1_clk>;
979 clock-names = "pclk";
661 status = "disabled"; 980 status = "disabled";
662 }; 981 };
663 982
@@ -667,6 +986,8 @@
667 compatible = "atmel,at91sam9g45-adc"; 986 compatible = "atmel,at91sam9g45-adc";
668 reg = <0xfffb0000 0x100>; 987 reg = <0xfffb0000 0x100>;
669 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0>; 988 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0>;
989 clocks = <&adc_clk>, <&adc_op_clk>;
990 clock-names = "adc_clk", "adc_op_clk";
670 atmel,adc-channels-used = <0xff>; 991 atmel,adc-channels-used = <0xff>;
671 atmel,adc-vref = <3300>; 992 atmel,adc-vref = <3300>;
672 atmel,adc-startup-time = <40>; 993 atmel,adc-startup-time = <40>;
@@ -706,6 +1027,7 @@
706 reg = <0xfffb8000 0x300>; 1027 reg = <0xfffb8000 0x300>;
707 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 4>; 1028 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 4>;
708 #pwm-cells = <3>; 1029 #pwm-cells = <3>;
1030 clocks = <&pwm_clk>;
709 status = "disabled"; 1031 status = "disabled";
710 }; 1032 };
711 1033
@@ -718,6 +1040,8 @@
718 dma-names = "rxtx"; 1040 dma-names = "rxtx";
719 #address-cells = <1>; 1041 #address-cells = <1>;
720 #size-cells = <0>; 1042 #size-cells = <0>;
1043 clocks = <&mci0_clk>;
1044 clock-names = "mci_clk";
721 status = "disabled"; 1045 status = "disabled";
722 }; 1046 };
723 1047
@@ -730,6 +1054,8 @@
730 dma-names = "rxtx"; 1054 dma-names = "rxtx";
731 #address-cells = <1>; 1055 #address-cells = <1>;
732 #size-cells = <0>; 1056 #size-cells = <0>;
1057 clocks = <&mci1_clk>;
1058 clock-names = "mci_clk";
733 status = "disabled"; 1059 status = "disabled";
734 }; 1060 };
735 1061
@@ -752,6 +1078,8 @@
752 interrupts = <14 4 3>; 1078 interrupts = <14 4 3>;
753 pinctrl-names = "default"; 1079 pinctrl-names = "default";
754 pinctrl-0 = <&pinctrl_spi0>; 1080 pinctrl-0 = <&pinctrl_spi0>;
1081 clocks = <&spi0_clk>;
1082 clock-names = "spi_clk";
755 status = "disabled"; 1083 status = "disabled";
756 }; 1084 };
757 1085
@@ -763,6 +1091,8 @@
763 interrupts = <15 4 3>; 1091 interrupts = <15 4 3>;
764 pinctrl-names = "default"; 1092 pinctrl-names = "default";
765 pinctrl-0 = <&pinctrl_spi1>; 1093 pinctrl-0 = <&pinctrl_spi1>;
1094 clocks = <&spi1_clk>;
1095 clock-names = "spi_clk";
766 status = "disabled"; 1096 status = "disabled";
767 }; 1097 };
768 1098
@@ -773,6 +1103,8 @@
773 reg = <0x00600000 0x80000 1103 reg = <0x00600000 0x80000
774 0xfff78000 0x400>; 1104 0xfff78000 0x400>;
775 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; 1105 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
1106 clocks = <&udphs_clk>, <&utmi>;
1107 clock-names = "pclk", "hclk";
776 status = "disabled"; 1108 status = "disabled";
777 1109
778 ep0 { 1110 ep0 {
@@ -835,6 +1167,8 @@
835 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 3>; 1167 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 3>;
836 pinctrl-names = "default"; 1168 pinctrl-names = "default";
837 pinctrl-0 = <&pinctrl_fb>; 1169 pinctrl-0 = <&pinctrl_fb>;
1170 clocks = <&lcd_clk>, <&lcd_clk>;
1171 clock-names = "hclk", "lcdc_clk";
838 status = "disabled"; 1172 status = "disabled";
839 }; 1173 };
840 1174
@@ -861,6 +1195,9 @@
861 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 1195 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
862 reg = <0x00700000 0x100000>; 1196 reg = <0x00700000 0x100000>;
863 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; 1197 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
1198 //TODO
1199 clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>;
1200 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
864 status = "disabled"; 1201 status = "disabled";
865 }; 1202 };
866 1203
@@ -868,6 +1205,9 @@
868 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 1205 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
869 reg = <0x00800000 0x100000>; 1206 reg = <0x00800000 0x100000>;
870 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; 1207 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
1208 //TODO
1209 clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>;
1210 clock-names = "usb_clk", "ehci_clk", "hclk", "uhpck";
871 status = "disabled"; 1211 status = "disabled";
872 }; 1212 };
873 }; 1213 };
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 9f5b0a674995..96ccc7de4f0a 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -31,6 +31,14 @@
31 compatible = "atmel,osc", "fixed-clock"; 31 compatible = "atmel,osc", "fixed-clock";
32 clock-frequency = <12000000>; 32 clock-frequency = <12000000>;
33 }; 33 };
34
35 slow_xtal {
36 clock-frequency = <32768>;
37 };
38
39 main_xtal {
40 clock-frequency = <12000000>;
41 };
34 }; 42 };
35 43
36 ahb { 44 ahb {
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index b84bac5bada4..2bfac310dbec 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -50,16 +50,18 @@
50 reg = <0x20000000 0x10000000>; 50 reg = <0x20000000 0x10000000>;
51 }; 51 };
52 52
53 slow_xtal: slow_xtal { 53 clocks {
54 compatible = "fixed-clock"; 54 slow_xtal: slow_xtal {
55 #clock-cells = <0>; 55 compatible = "fixed-clock";
56 clock-frequency = <0>; 56 #clock-cells = <0>;
57 }; 57 clock-frequency = <0>;
58 };
58 59
59 main_xtal: main_xtal { 60 main_xtal: main_xtal {
60 compatible = "fixed-clock"; 61 compatible = "fixed-clock";
61 #clock-cells = <0>; 62 #clock-cells = <0>;
62 clock-frequency = <0>; 63 clock-frequency = <0>;
64 };
63 }; 65 };
64 66
65 ahb { 67 ahb {
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 64bbe46e4f90..83d723711ae1 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -21,14 +21,6 @@
21 reg = <0x20000000 0x8000000>; 21 reg = <0x20000000 0x8000000>;
22 }; 22 };
23 23
24 slow_xtal {
25 clock-frequency = <32768>;
26 };
27
28 main_xtal {
29 clock-frequency = <16000000>;
30 };
31
32 clocks { 24 clocks {
33 #address-cells = <1>; 25 #address-cells = <1>;
34 #size-cells = <1>; 26 #size-cells = <1>;
@@ -38,6 +30,14 @@
38 compatible = "atmel,osc", "fixed-clock"; 30 compatible = "atmel,osc", "fixed-clock";
39 clock-frequency = <16000000>; 31 clock-frequency = <16000000>;
40 }; 32 };
33
34 slow_xtal {
35 clock-frequency = <32768>;
36 };
37
38 main_xtal {
39 clock-frequency = <16000000>;
40 };
41 }; 41 };
42 42
43 ahb { 43 ahb {
@@ -56,6 +56,8 @@
56 wm8904: codec@1a { 56 wm8904: codec@1a {
57 compatible = "wm8904"; 57 compatible = "wm8904";
58 reg = <0x1a>; 58 reg = <0x1a>;
59 clocks = <&pck0>;
60 clock-names = "mclk";
59 }; 61 };
60 62
61 qt1070: keyboard@1b { 63 qt1070: keyboard@1b {
diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
index 1da183155eee..ab56c8b81dfa 100644
--- a/arch/arm/boot/dts/at91sam9rl.dtsi
+++ b/arch/arm/boot/dts/at91sam9rl.dtsi
@@ -50,19 +50,19 @@
50 reg = <0x20000000 0x04000000>; 50 reg = <0x20000000 0x04000000>;
51 }; 51 };
52 52
53 slow_xtal: slow_xtal { 53 clocks {
54 compatible = "fixed-clock"; 54 slow_xtal: slow_xtal {
55 #clock-cells = <0>; 55 compatible = "fixed-clock";
56 clock-frequency = <0>; 56 #clock-cells = <0>;
57 }; 57 clock-frequency = <0>;
58 };
58 59
59 main_xtal: main_xtal { 60 main_xtal: main_xtal {
60 compatible = "fixed-clock"; 61 compatible = "fixed-clock";
61 #clock-cells = <0>; 62 #clock-cells = <0>;
62 clock-frequency = <0>; 63 clock-frequency = <0>;
63 }; 64 };
64 65
65 clocks {
66 adc_op_clk: adc_op_clk{ 66 adc_op_clk: adc_op_clk{
67 compatible = "fixed-clock"; 67 compatible = "fixed-clock";
68 #clock-cells = <0>; 68 #clock-cells = <0>;
@@ -95,6 +95,7 @@
95 <0xffffe800 0x200>; 95 <0xffffe800 0x200>;
96 atmel,nand-addr-offset = <21>; 96 atmel,nand-addr-offset = <21>;
97 atmel,nand-cmd-offset = <22>; 97 atmel,nand-cmd-offset = <22>;
98 atmel,nand-has-dma;
98 pinctrl-names = "default"; 99 pinctrl-names = "default";
99 pinctrl-0 = <&pinctrl_nand>; 100 pinctrl-0 = <&pinctrl_nand>;
100 gpios = <&pioD 17 GPIO_ACTIVE_HIGH>, 101 gpios = <&pioD 17 GPIO_ACTIVE_HIGH>,
@@ -348,6 +349,15 @@
348 }; 349 };
349 }; 350 };
350 351
352 dma0: dma-controller@ffffe600 {
353 compatible = "atmel,at91sam9rl-dma";
354 reg = <0xffffe600 0x200>;
355 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>;
356 #dma-cells = <2>;
357 clocks = <&dma0_clk>;
358 clock-names = "dma_clk";
359 };
360
351 ramc0: ramc@ffffea00 { 361 ramc0: ramc@ffffea00 {
352 compatible = "atmel,at91sam9260-sdramc"; 362 compatible = "atmel,at91sam9260-sdramc";
353 reg = <0xffffea00 0x200>; 363 reg = <0xffffea00 0x200>;
diff --git a/arch/arm/boot/dts/at91sam9rlek.dts b/arch/arm/boot/dts/at91sam9rlek.dts
index d4a010e40fe3..9be5b540eebf 100644
--- a/arch/arm/boot/dts/at91sam9rlek.dts
+++ b/arch/arm/boot/dts/at91sam9rlek.dts
@@ -20,15 +20,6 @@
20 reg = <0x20000000 0x4000000>; 20 reg = <0x20000000 0x4000000>;
21 }; 21 };
22 22
23
24 slow_xtal {
25 clock-frequency = <32768>;
26 };
27
28 main_xtal {
29 clock-frequency = <12000000>;
30 };
31
32 clocks { 23 clocks {
33 #address-cells = <1>; 24 #address-cells = <1>;
34 #size-cells = <1>; 25 #size-cells = <1>;
@@ -38,6 +29,14 @@
38 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
39 clock-frequency = <12000000>; 30 clock-frequency = <12000000>;
40 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <12000000>;
39 };
41 }; 40 };
42 41
43 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 2c0d6ea3ab41..e1a5c70b885c 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -52,22 +52,24 @@
52 reg = <0x20000000 0x10000000>; 52 reg = <0x20000000 0x10000000>;
53 }; 53 };
54 54
55 slow_xtal: slow_xtal { 55 clocks {
56 compatible = "fixed-clock"; 56 slow_xtal: slow_xtal {
57 #clock-cells = <0>; 57 compatible = "fixed-clock";
58 clock-frequency = <0>; 58 #clock-cells = <0>;
59 }; 59 clock-frequency = <0>;
60 };
60 61
61 main_xtal: main_xtal { 62 main_xtal: main_xtal {
62 compatible = "fixed-clock"; 63 compatible = "fixed-clock";
63 #clock-cells = <0>; 64 #clock-cells = <0>;
64 clock-frequency = <0>; 65 clock-frequency = <0>;
65 }; 66 };
66 67
67 adc_op_clk: adc_op_clk{ 68 adc_op_clk: adc_op_clk{
68 compatible = "fixed-clock"; 69 compatible = "fixed-clock";
69 #clock-cells = <0>; 70 #clock-cells = <0>;
70 clock-frequency = <5000000>; 71 clock-frequency = <5000000>;
72 };
71 }; 73 };
72 74
73 ahb { 75 ahb {
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index 8413e21192eb..229d6c24a9c4 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -23,12 +23,14 @@
23 }; 23 };
24 }; 24 };
25 25
26 slow_xtal { 26 clocks {
27 clock-frequency = <32768>; 27 slow_xtal {
28 }; 28 clock-frequency = <32768>;
29 };
29 30
30 main_xtal { 31 main_xtal {
31 clock-frequency = <12000000>; 32 clock-frequency = <12000000>;
33 };
32 }; 34 };
33 35
34 ahb { 36 ahb {
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index 6b05ae6d476f..2ddaa5136611 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -27,6 +27,25 @@
27 bootargs = "console=ttyS0,115200n8"; 27 bootargs = "console=ttyS0,115200n8";
28 }; 28 };
29 29
30 cpus {
31 #address-cells = <1>;
32 #size-cells = <0>;
33 enable-method = "brcm,bcm11351-cpu-method";
34 secondary-boot-reg = <0x3500417c>;
35
36 cpu0: cpu@0 {
37 device_type = "cpu";
38 compatible = "arm,cortex-a9";
39 reg = <0>;
40 };
41
42 cpu1: cpu@1 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a9";
45 reg = <1>;
46 };
47 };
48
30 gic: interrupt-controller@3ff00100 { 49 gic: interrupt-controller@3ff00100 {
31 compatible = "arm,cortex-a9-gic"; 50 compatible = "arm,cortex-a9-gic";
32 #interrupt-cells = <3>; 51 #interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/bcm21664.dtsi b/arch/arm/boot/dts/bcm21664.dtsi
index 8b366822bb43..2016b72a8fb7 100644
--- a/arch/arm/boot/dts/bcm21664.dtsi
+++ b/arch/arm/boot/dts/bcm21664.dtsi
@@ -27,6 +27,25 @@
27 bootargs = "console=ttyS0,115200n8"; 27 bootargs = "console=ttyS0,115200n8";
28 }; 28 };
29 29
30 cpus {
31 #address-cells = <1>;
32 #size-cells = <0>;
33 enable-method = "brcm,bcm11351-cpu-method";
34 secondary-boot-reg = <0x35004178>;
35
36 cpu0: cpu@0 {
37 device_type = "cpu";
38 compatible = "arm,cortex-a9";
39 reg = <0>;
40 };
41
42 cpu1: cpu@1 {
43 device_type = "cpu";
44 compatible = "arm,cortex-a9";
45 reg = <1>;
46 };
47 };
48
30 gic: interrupt-controller@3ff00100 { 49 gic: interrupt-controller@3ff00100 {
31 compatible = "arm,cortex-a9-gic"; 50 compatible = "arm,cortex-a9-gic";
32 #interrupt-cells = <3>; 51 #interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts
new file mode 100644
index 000000000000..9eec2ac1112f
--- /dev/null
+++ b/arch/arm/boot/dts/bcm7445-bcm97445svmb.dts
@@ -0,0 +1,14 @@
1/dts-v1/;
2#include "bcm7445.dtsi"
3
4/ {
5 model = "Broadcom STB (bcm7445), SVMB reference board";
6 compatible = "brcm,bcm7445", "brcm,brcmstb";
7
8 memory {
9 device_type = "memory";
10 reg = <0x00 0x00000000 0x00 0x40000000>,
11 <0x00 0x40000000 0x00 0x40000000>,
12 <0x00 0x80000000 0x00 0x40000000>;
13 };
14};
diff --git a/arch/arm/boot/dts/bcm7445.dtsi b/arch/arm/boot/dts/bcm7445.dtsi
new file mode 100644
index 000000000000..0ca0f4e523d0
--- /dev/null
+++ b/arch/arm/boot/dts/bcm7445.dtsi
@@ -0,0 +1,111 @@
1#include <dt-bindings/interrupt-controller/arm-gic.h>
2
3#include "skeleton.dtsi"
4
5/ {
6 #address-cells = <2>;
7 #size-cells = <2>;
8 model = "Broadcom STB (bcm7445)";
9 compatible = "brcm,bcm7445", "brcm,brcmstb";
10 interrupt-parent = <&gic>;
11
12 chosen {
13 bootargs = "console=ttyS0,115200 earlyprintk";
14 };
15
16 cpus {
17 #address-cells = <1>;
18 #size-cells = <0>;
19
20 cpu@0 {
21 compatible = "brcm,brahma-b15";
22 device_type = "cpu";
23 enable-method = "brcm,brahma-b15";
24 reg = <0>;
25 };
26
27 cpu@1 {
28 compatible = "brcm,brahma-b15";
29 device_type = "cpu";
30 enable-method = "brcm,brahma-b15";
31 reg = <1>;
32 };
33
34 cpu@2 {
35 compatible = "brcm,brahma-b15";
36 device_type = "cpu";
37 enable-method = "brcm,brahma-b15";
38 reg = <2>;
39 };
40
41 cpu@3 {
42 compatible = "brcm,brahma-b15";
43 device_type = "cpu";
44 enable-method = "brcm,brahma-b15";
45 reg = <3>;
46 };
47 };
48
49 gic: interrupt-controller@ffd00000 {
50 compatible = "brcm,brahma-b15-gic", "arm,cortex-a15-gic";
51 reg = <0x00 0xffd01000 0x00 0x1000>,
52 <0x00 0xffd02000 0x00 0x2000>,
53 <0x00 0xffd04000 0x00 0x2000>,
54 <0x00 0xffd06000 0x00 0x2000>;
55 interrupt-controller;
56 #interrupt-cells = <3>;
57 };
58
59 timer {
60 compatible = "arm,armv7-timer";
61 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(15) | IRQ_TYPE_LEVEL_LOW)>,
62 <GIC_PPI 14 (GIC_CPU_MASK_RAW(15) | IRQ_TYPE_LEVEL_LOW)>,
63 <GIC_PPI 11 (GIC_CPU_MASK_RAW(15) | IRQ_TYPE_LEVEL_LOW)>,
64 <GIC_PPI 10 (GIC_CPU_MASK_RAW(15) | IRQ_TYPE_LEVEL_LOW)>;
65 };
66
67 rdb {
68 #address-cells = <1>;
69 #size-cells = <1>;
70 compatible = "simple-bus";
71 ranges = <0 0x00 0xf0000000 0x1000000>;
72
73 serial@40ab00 {
74 compatible = "ns16550a";
75 reg = <0x40ab00 0x20>;
76 reg-shift = <2>;
77 reg-io-width = <4>;
78 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
79 clock-frequency = <0x4d3f640>;
80 };
81
82 sun_top_ctrl: syscon@404000 {
83 compatible = "brcm,bcm7445-sun-top-ctrl",
84 "syscon";
85 reg = <0x404000 0x51c>;
86 };
87
88 hif_cpubiuctrl: syscon@3e2400 {
89 compatible = "brcm,bcm7445-hif-cpubiuctrl",
90 "syscon";
91 reg = <0x3e2400 0x5b4>;
92 };
93
94 hif_continuation: syscon@452000 {
95 compatible = "brcm,bcm7445-hif-continuation",
96 "syscon";
97 reg = <0x452000 0x100>;
98 };
99 };
100
101 smpboot {
102 compatible = "brcm,brcmstb-smpboot";
103 syscon-cpu = <&hif_cpubiuctrl 0x88 0x178>;
104 syscon-cont = <&hif_continuation>;
105 };
106
107 reboot {
108 compatible = "brcm,brcmstb-reboot";
109 syscon = <&sun_top_ctrl 0x304 0x308>;
110 };
111};
diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
index 2477dac4d643..9d7c810ebd0b 100644
--- a/arch/arm/boot/dts/berlin2.dtsi
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -22,6 +22,7 @@
22 cpus { 22 cpus {
23 #address-cells = <1>; 23 #address-cells = <1>;
24 #size-cells = <0>; 24 #size-cells = <0>;
25 enable-method = "marvell,berlin-smp";
25 26
26 cpu@0 { 27 cpu@0 {
27 compatible = "marvell,pj4b"; 28 compatible = "marvell,pj4b";
@@ -78,6 +79,11 @@
78 clocks = <&chip CLKID_TWD>; 79 clocks = <&chip CLKID_TWD>;
79 }; 80 };
80 81
82 cpu-ctrl@dd0000 {
83 compatible = "marvell,berlin-cpu-ctrl";
84 reg = <0xdd0000 0x10000>;
85 };
86
81 apb@e80000 { 87 apb@e80000 {
82 compatible = "simple-bus"; 88 compatible = "simple-bus";
83 #address-cells = <1>; 89 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index 995150f93795..a357ce02a64e 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -34,6 +34,14 @@
34 status = "okay"; 34 status = "okay";
35}; 35};
36 36
37&i2c0 {
38 status = "okay";
39};
40
41&i2c2 {
42 status = "okay";
43};
44
37&uart0 { 45&uart0 {
38 status = "okay"; 46 status = "okay";
39}; 47};
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 635a16a64cb4..400c40fceccc 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -18,6 +18,7 @@
18 cpus { 18 cpus {
19 #address-cells = <1>; 19 #address-cells = <1>;
20 #size-cells = <0>; 20 #size-cells = <0>;
21 enable-method = "marvell,berlin-smp";
21 22
22 cpu@0 { 23 cpu@0 {
23 compatible = "arm,cortex-a9"; 24 compatible = "arm,cortex-a9";
@@ -90,6 +91,8 @@
90 compatible = "arm,pl310-cache"; 91 compatible = "arm,pl310-cache";
91 reg = <0xac0000 0x1000>; 92 reg = <0xac0000 0x1000>;
92 cache-level = <2>; 93 cache-level = <2>;
94 arm,data-latency = <2 2 2>;
95 arm,tag-latency = <2 2 2>;
93 }; 96 };
94 97
95 scu: snoop-control-unit@ad0000 { 98 scu: snoop-control-unit@ad0000 {
@@ -111,6 +114,11 @@
111 #interrupt-cells = <3>; 114 #interrupt-cells = <3>;
112 }; 115 };
113 116
117 cpu-ctrl@dd0000 {
118 compatible = "marvell,berlin-cpu-ctrl";
119 reg = <0xdd0000 0x10000>;
120 };
121
114 apb@e80000 { 122 apb@e80000 {
115 compatible = "simple-bus"; 123 compatible = "simple-bus";
116 #address-cells = <1>; 124 #address-cells = <1>;
@@ -191,6 +199,32 @@
191 }; 199 };
192 }; 200 };
193 201
202 i2c0: i2c@1400 {
203 compatible = "snps,designware-i2c";
204 #address-cells = <1>;
205 #size-cells = <0>;
206 reg = <0x1400 0x100>;
207 interrupt-parent = <&aic>;
208 interrupts = <4>;
209 clocks = <&chip CLKID_CFG>;
210 pinctrl-0 = <&twsi0_pmux>;
211 pinctrl-names = "default";
212 status = "disabled";
213 };
214
215 i2c1: i2c@1800 {
216 compatible = "snps,designware-i2c";
217 #address-cells = <1>;
218 #size-cells = <0>;
219 reg = <0x1800 0x100>;
220 interrupt-parent = <&aic>;
221 interrupts = <5>;
222 clocks = <&chip CLKID_CFG>;
223 pinctrl-0 = <&twsi1_pmux>;
224 pinctrl-names = "default";
225 status = "disabled";
226 };
227
194 timer0: timer@2c00 { 228 timer0: timer@2c00 {
195 compatible = "snps,dw-apb-timer"; 229 compatible = "snps,dw-apb-timer";
196 reg = <0x2c00 0x14>; 230 reg = <0x2c00 0x14>;
@@ -301,6 +335,16 @@
301 reg = <0xea0000 0x400>, <0xdd0170 0x10>; 335 reg = <0xea0000 0x400>, <0xdd0170 0x10>;
302 clocks = <&refclk>; 336 clocks = <&refclk>;
303 clock-names = "refclk"; 337 clock-names = "refclk";
338
339 twsi0_pmux: twsi0-pmux {
340 groups = "G6";
341 function = "twsi0";
342 };
343
344 twsi1_pmux: twsi1-pmux {
345 groups = "G7";
346 function = "twsi1";
347 };
304 }; 348 };
305 349
306 apb@fc0000 { 350 apb@fc0000 {
@@ -311,6 +355,32 @@
311 ranges = <0 0xfc0000 0x10000>; 355 ranges = <0 0xfc0000 0x10000>;
312 interrupt-parent = <&sic>; 356 interrupt-parent = <&sic>;
313 357
358 i2c2: i2c@7000 {
359 compatible = "snps,designware-i2c";
360 #address-cells = <1>;
361 #size-cells = <0>;
362 reg = <0x7000 0x100>;
363 interrupt-parent = <&sic>;
364 interrupts = <6>;
365 clocks = <&refclk>;
366 pinctrl-0 = <&twsi2_pmux>;
367 pinctrl-names = "default";
368 status = "disabled";
369 };
370
371 i2c3: i2c@8000 {
372 compatible = "snps,designware-i2c";
373 #address-cells = <1>;
374 #size-cells = <0>;
375 reg = <0x8000 0x100>;
376 interrupt-parent = <&sic>;
377 interrupts = <7>;
378 clocks = <&refclk>;
379 pinctrl-0 = <&twsi3_pmux>;
380 pinctrl-names = "default";
381 status = "disabled";
382 };
383
314 uart0: uart@9000 { 384 uart0: uart@9000 {
315 compatible = "snps,dw-apb-uart"; 385 compatible = "snps,dw-apb-uart";
316 reg = <0x9000 0x100>; 386 reg = <0x9000 0x100>;
@@ -348,6 +418,16 @@
348 groups = "GSM14"; 418 groups = "GSM14";
349 function = "uart1"; 419 function = "uart1";
350 }; 420 };
421
422 twsi2_pmux: twsi2-pmux {
423 groups = "GSM13";
424 function = "twsi2";
425 };
426
427 twsi3_pmux: twsi3-pmux {
428 groups = "GSM14";
429 function = "twsi3";
430 };
351 }; 431 };
352 432
353 sic: interrupt-controller@e000 { 433 sic: interrupt-controller@e000 {
diff --git a/arch/arm/boot/dts/cros-ec-keyboard.dtsi b/arch/arm/boot/dts/cros-ec-keyboard.dtsi
new file mode 100644
index 000000000000..9c7fb0acae79
--- /dev/null
+++ b/arch/arm/boot/dts/cros-ec-keyboard.dtsi
@@ -0,0 +1,105 @@
1/*
2 * Keyboard dts fragment for devices that use cros-ec-keyboard
3 *
4 * Copyright (c) 2014 Google, Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <dt-bindings/input/input.h>
12
13&cros_ec {
14 keyboard-controller {
15 compatible = "google,cros-ec-keyb";
16 keypad,num-rows = <8>;
17 keypad,num-columns = <13>;
18 google,needs-ghost-filter;
19
20 linux,keymap = <
21 MATRIX_KEY(0x00, 0x01, KEY_LEFTMETA)
22 MATRIX_KEY(0x00, 0x02, KEY_F1)
23 MATRIX_KEY(0x00, 0x03, KEY_B)
24 MATRIX_KEY(0x00, 0x04, KEY_F10)
25 MATRIX_KEY(0x00, 0x06, KEY_N)
26 MATRIX_KEY(0x00, 0x08, KEY_EQUAL)
27 MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT)
28
29 MATRIX_KEY(0x01, 0x01, KEY_ESC)
30 MATRIX_KEY(0x01, 0x02, KEY_F4)
31 MATRIX_KEY(0x01, 0x03, KEY_G)
32 MATRIX_KEY(0x01, 0x04, KEY_F7)
33 MATRIX_KEY(0x01, 0x06, KEY_H)
34 MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE)
35 MATRIX_KEY(0x01, 0x09, KEY_F9)
36 MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE)
37
38 MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
39 MATRIX_KEY(0x02, 0x01, KEY_TAB)
40 MATRIX_KEY(0x02, 0x02, KEY_F3)
41 MATRIX_KEY(0x02, 0x03, KEY_T)
42 MATRIX_KEY(0x02, 0x04, KEY_F6)
43 MATRIX_KEY(0x02, 0x05, KEY_RIGHTBRACE)
44 MATRIX_KEY(0x02, 0x06, KEY_Y)
45 MATRIX_KEY(0x02, 0x07, KEY_102ND)
46 MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
47 MATRIX_KEY(0x02, 0x09, KEY_F8)
48
49 MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
50 MATRIX_KEY(0x03, 0x02, KEY_F2)
51 MATRIX_KEY(0x03, 0x03, KEY_5)
52 MATRIX_KEY(0x03, 0x04, KEY_F5)
53 MATRIX_KEY(0x03, 0x06, KEY_6)
54 MATRIX_KEY(0x03, 0x08, KEY_MINUS)
55 MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
56
57 MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
58 MATRIX_KEY(0x04, 0x01, KEY_A)
59 MATRIX_KEY(0x04, 0x02, KEY_D)
60 MATRIX_KEY(0x04, 0x03, KEY_F)
61 MATRIX_KEY(0x04, 0x04, KEY_S)
62 MATRIX_KEY(0x04, 0x05, KEY_K)
63 MATRIX_KEY(0x04, 0x06, KEY_J)
64 MATRIX_KEY(0x04, 0x08, KEY_SEMICOLON)
65 MATRIX_KEY(0x04, 0x09, KEY_L)
66 MATRIX_KEY(0x04, 0x0a, KEY_BACKSLASH)
67 MATRIX_KEY(0x04, 0x0b, KEY_ENTER)
68
69 MATRIX_KEY(0x05, 0x01, KEY_Z)
70 MATRIX_KEY(0x05, 0x02, KEY_C)
71 MATRIX_KEY(0x05, 0x03, KEY_V)
72 MATRIX_KEY(0x05, 0x04, KEY_X)
73 MATRIX_KEY(0x05, 0x05, KEY_COMMA)
74 MATRIX_KEY(0x05, 0x06, KEY_M)
75 MATRIX_KEY(0x05, 0x07, KEY_LEFTSHIFT)
76 MATRIX_KEY(0x05, 0x08, KEY_SLASH)
77 MATRIX_KEY(0x05, 0x09, KEY_DOT)
78 MATRIX_KEY(0x05, 0x0b, KEY_SPACE)
79
80 MATRIX_KEY(0x06, 0x01, KEY_1)
81 MATRIX_KEY(0x06, 0x02, KEY_3)
82 MATRIX_KEY(0x06, 0x03, KEY_4)
83 MATRIX_KEY(0x06, 0x04, KEY_2)
84 MATRIX_KEY(0x06, 0x05, KEY_8)
85 MATRIX_KEY(0x06, 0x06, KEY_7)
86 MATRIX_KEY(0x06, 0x08, KEY_0)
87 MATRIX_KEY(0x06, 0x09, KEY_9)
88 MATRIX_KEY(0x06, 0x0a, KEY_LEFTALT)
89 MATRIX_KEY(0x06, 0x0b, KEY_DOWN)
90 MATRIX_KEY(0x06, 0x0c, KEY_RIGHT)
91
92 MATRIX_KEY(0x07, 0x01, KEY_Q)
93 MATRIX_KEY(0x07, 0x02, KEY_E)
94 MATRIX_KEY(0x07, 0x03, KEY_R)
95 MATRIX_KEY(0x07, 0x04, KEY_W)
96 MATRIX_KEY(0x07, 0x05, KEY_I)
97 MATRIX_KEY(0x07, 0x06, KEY_U)
98 MATRIX_KEY(0x07, 0x07, KEY_RIGHTSHIFT)
99 MATRIX_KEY(0x07, 0x08, KEY_P)
100 MATRIX_KEY(0x07, 0x09, KEY_O)
101 MATRIX_KEY(0x07, 0x0b, KEY_UP)
102 MATRIX_KEY(0x07, 0x0c, KEY_LEFT)
103 >;
104 };
105};
diff --git a/arch/arm/boot/dts/dove-cubox-es.dts b/arch/arm/boot/dts/dove-cubox-es.dts
new file mode 100644
index 000000000000..e28ef056dd17
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cubox-es.dts
@@ -0,0 +1,12 @@
1#include "dove-cubox.dts"
2
3/ {
4 model = "SolidRun CuBox (Engineering Sample)";
5 compatible = "solidrun,cubox-es", "solidrun,cubox", "marvell,dove";
6};
7
8&sdio0 {
9 /* sdio0 card detect is connected to wrong pin on CuBox ES */
10 cd-gpios = <&gpio0 12 1>;
11 pinctrl-0 = <&pmx_sdio0 &pmx_gpio_12>;
12};
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 7a70f4ca502a..aae7efc09b0b 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -111,9 +111,6 @@
111 111
112&sdio0 { 112&sdio0 {
113 status = "okay"; 113 status = "okay";
114 /* sdio0 card detect is connected to wrong pin on CuBox */
115 cd-gpios = <&gpio0 12 1>;
116 pinctrl-0 = <&pmx_sdio0 &pmx_gpio_12>;
117}; 114};
118 115
119&spi0 { 116&spi0 {
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 3b891dd20993..a5441d5482a6 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -630,6 +630,20 @@
630 reg = <0xe8400 0x0c>; 630 reg = <0xe8400 0x0c>;
631 ngpios = <8>; 631 ngpios = <8>;
632 }; 632 };
633
634 lcd1: lcd-controller@810000 {
635 compatible = "marvell,dove-lcd";
636 reg = <0x810000 0x1000>;
637 interrupts = <46>;
638 status = "disabled";
639 };
640
641 lcd0: lcd-controller@820000 {
642 compatible = "marvell,dove-lcd";
643 reg = <0x820000 0x1000>;
644 interrupts = <47>;
645 status = "disabled";
646 };
633 }; 647 };
634 }; 648 };
635}; 649};
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 83089540e324..50f8022905a1 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -496,3 +496,11 @@
496 }; 496 };
497 }; 497 };
498}; 498};
499
500&usb2_phy1 {
501 phy-supply = <&ldousb_reg>;
502};
503
504&usb2_phy2 {
505 phy-supply = <&ldousb_reg>;
506};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 80127638b379..97f603c4483d 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -12,6 +12,9 @@
12 12
13#include "skeleton.dtsi" 13#include "skeleton.dtsi"
14 14
15#define MAX_SOURCES 400
16#define DIRECT_IRQ(irq) (MAX_SOURCES + irq)
17
15/ { 18/ {
16 #address-cells = <1>; 19 #address-cells = <1>;
17 #size-cells = <1>; 20 #size-cells = <1>;
@@ -45,6 +48,7 @@
45 compatible = "arm,cortex-a15-gic"; 48 compatible = "arm,cortex-a15-gic";
46 interrupt-controller; 49 interrupt-controller;
47 #interrupt-cells = <3>; 50 #interrupt-cells = <3>;
51 arm,routable-irqs = <192>;
48 reg = <0x48211000 0x1000>, 52 reg = <0x48211000 0x1000>,
49 <0x48212000 0x1000>, 53 <0x48212000 0x1000>,
50 <0x48214000 0x2000>, 54 <0x48214000 0x2000>,
@@ -79,8 +83,8 @@
79 ti,hwmods = "l3_main_1", "l3_main_2"; 83 ti,hwmods = "l3_main_1", "l3_main_2";
80 reg = <0x44000000 0x1000000>, 84 reg = <0x44000000 0x1000000>,
81 <0x45000000 0x1000>; 85 <0x45000000 0x1000>;
82 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, 86 interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
83 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; 87 <GIC_SPI DIRECT_IRQ(10) IRQ_TYPE_LEVEL_HIGH>;
84 88
85 prm: prm@4ae06000 { 89 prm: prm@4ae06000 {
86 compatible = "ti,dra7-prm"; 90 compatible = "ti,dra7-prm";
@@ -95,6 +99,75 @@
95 }; 99 };
96 }; 100 };
97 101
102 axi@0 {
103 compatible = "simple-bus";
104 #size-cells = <1>;
105 #address-cells = <1>;
106 ranges = <0x51000000 0x51000000 0x3000
107 0x0 0x20000000 0x10000000>;
108 pcie@51000000 {
109 compatible = "ti,dra7-pcie";
110 reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>;
111 reg-names = "rc_dbics", "ti_conf", "config";
112 interrupts = <0 232 0x4>, <0 233 0x4>;
113 #address-cells = <3>;
114 #size-cells = <2>;
115 device_type = "pci";
116 ranges = <0x81000000 0 0 0x03000 0 0x00010000
117 0x82000000 0 0x20013000 0x13000 0 0xffed000>;
118 #interrupt-cells = <1>;
119 num-lanes = <1>;
120 ti,hwmods = "pcie1";
121 phys = <&pcie1_phy>;
122 phy-names = "pcie-phy0";
123 interrupt-map-mask = <0 0 0 7>;
124 interrupt-map = <0 0 0 1 &pcie1_intc 1>,
125 <0 0 0 2 &pcie1_intc 2>,
126 <0 0 0 3 &pcie1_intc 3>,
127 <0 0 0 4 &pcie1_intc 4>;
128 pcie1_intc: interrupt-controller {
129 interrupt-controller;
130 #address-cells = <0>;
131 #interrupt-cells = <1>;
132 };
133 };
134 };
135
136 axi@1 {
137 compatible = "simple-bus";
138 #size-cells = <1>;
139 #address-cells = <1>;
140 ranges = <0x51800000 0x51800000 0x3000
141 0x0 0x30000000 0x10000000>;
142 status = "disabled";
143 pcie@51000000 {
144 compatible = "ti,dra7-pcie";
145 reg = <0x51800000 0x2000>, <0x51802000 0x14c>, <0x1000 0x2000>;
146 reg-names = "rc_dbics", "ti_conf", "config";
147 interrupts = <0 355 0x4>, <0 356 0x4>;
148 #address-cells = <3>;
149 #size-cells = <2>;
150 device_type = "pci";
151 ranges = <0x81000000 0 0 0x03000 0 0x00010000
152 0x82000000 0 0x30013000 0x13000 0 0xffed000>;
153 #interrupt-cells = <1>;
154 num-lanes = <1>;
155 ti,hwmods = "pcie2";
156 phys = <&pcie2_phy>;
157 phy-names = "pcie-phy0";
158 interrupt-map-mask = <0 0 0 7>;
159 interrupt-map = <0 0 0 1 &pcie2_intc 1>,
160 <0 0 0 2 &pcie2_intc 2>,
161 <0 0 0 3 &pcie2_intc 3>,
162 <0 0 0 4 &pcie2_intc 4>;
163 pcie2_intc: interrupt-controller {
164 interrupt-controller;
165 #address-cells = <0>;
166 #interrupt-cells = <1>;
167 };
168 };
169 };
170
98 cm_core_aon: cm_core_aon@4a005000 { 171 cm_core_aon: cm_core_aon@4a005000 {
99 compatible = "ti,dra7-cm-core-aon"; 172 compatible = "ti,dra7-cm-core-aon";
100 reg = <0x4a005000 0x2000>; 173 reg = <0x4a005000 0x2000>;
@@ -155,10 +228,10 @@
155 sdma: dma-controller@4a056000 { 228 sdma: dma-controller@4a056000 {
156 compatible = "ti,omap4430-sdma"; 229 compatible = "ti,omap4430-sdma";
157 reg = <0x4a056000 0x1000>; 230 reg = <0x4a056000 0x1000>;
158 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, 231 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
159 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, 232 <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
160 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, 233 <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
161 <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 234 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
162 #dma-cells = <1>; 235 #dma-cells = <1>;
163 #dma-channels = <32>; 236 #dma-channels = <32>;
164 #dma-requests = <127>; 237 #dma-requests = <127>;
@@ -167,7 +240,7 @@
167 gpio1: gpio@4ae10000 { 240 gpio1: gpio@4ae10000 {
168 compatible = "ti,omap4-gpio"; 241 compatible = "ti,omap4-gpio";
169 reg = <0x4ae10000 0x200>; 242 reg = <0x4ae10000 0x200>;
170 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; 243 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
171 ti,hwmods = "gpio1"; 244 ti,hwmods = "gpio1";
172 gpio-controller; 245 gpio-controller;
173 #gpio-cells = <2>; 246 #gpio-cells = <2>;
@@ -178,7 +251,7 @@
178 gpio2: gpio@48055000 { 251 gpio2: gpio@48055000 {
179 compatible = "ti,omap4-gpio"; 252 compatible = "ti,omap4-gpio";
180 reg = <0x48055000 0x200>; 253 reg = <0x48055000 0x200>;
181 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; 254 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
182 ti,hwmods = "gpio2"; 255 ti,hwmods = "gpio2";
183 gpio-controller; 256 gpio-controller;
184 #gpio-cells = <2>; 257 #gpio-cells = <2>;
@@ -189,7 +262,7 @@
189 gpio3: gpio@48057000 { 262 gpio3: gpio@48057000 {
190 compatible = "ti,omap4-gpio"; 263 compatible = "ti,omap4-gpio";
191 reg = <0x48057000 0x200>; 264 reg = <0x48057000 0x200>;
192 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 265 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
193 ti,hwmods = "gpio3"; 266 ti,hwmods = "gpio3";
194 gpio-controller; 267 gpio-controller;
195 #gpio-cells = <2>; 268 #gpio-cells = <2>;
@@ -200,7 +273,7 @@
200 gpio4: gpio@48059000 { 273 gpio4: gpio@48059000 {
201 compatible = "ti,omap4-gpio"; 274 compatible = "ti,omap4-gpio";
202 reg = <0x48059000 0x200>; 275 reg = <0x48059000 0x200>;
203 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; 276 interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
204 ti,hwmods = "gpio4"; 277 ti,hwmods = "gpio4";
205 gpio-controller; 278 gpio-controller;
206 #gpio-cells = <2>; 279 #gpio-cells = <2>;
@@ -211,7 +284,7 @@
211 gpio5: gpio@4805b000 { 284 gpio5: gpio@4805b000 {
212 compatible = "ti,omap4-gpio"; 285 compatible = "ti,omap4-gpio";
213 reg = <0x4805b000 0x200>; 286 reg = <0x4805b000 0x200>;
214 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; 287 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
215 ti,hwmods = "gpio5"; 288 ti,hwmods = "gpio5";
216 gpio-controller; 289 gpio-controller;
217 #gpio-cells = <2>; 290 #gpio-cells = <2>;
@@ -222,7 +295,7 @@
222 gpio6: gpio@4805d000 { 295 gpio6: gpio@4805d000 {
223 compatible = "ti,omap4-gpio"; 296 compatible = "ti,omap4-gpio";
224 reg = <0x4805d000 0x200>; 297 reg = <0x4805d000 0x200>;
225 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; 298 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
226 ti,hwmods = "gpio6"; 299 ti,hwmods = "gpio6";
227 gpio-controller; 300 gpio-controller;
228 #gpio-cells = <2>; 301 #gpio-cells = <2>;
@@ -233,7 +306,7 @@
233 gpio7: gpio@48051000 { 306 gpio7: gpio@48051000 {
234 compatible = "ti,omap4-gpio"; 307 compatible = "ti,omap4-gpio";
235 reg = <0x48051000 0x200>; 308 reg = <0x48051000 0x200>;
236 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; 309 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
237 ti,hwmods = "gpio7"; 310 ti,hwmods = "gpio7";
238 gpio-controller; 311 gpio-controller;
239 #gpio-cells = <2>; 312 #gpio-cells = <2>;
@@ -244,7 +317,7 @@
244 gpio8: gpio@48053000 { 317 gpio8: gpio@48053000 {
245 compatible = "ti,omap4-gpio"; 318 compatible = "ti,omap4-gpio";
246 reg = <0x48053000 0x200>; 319 reg = <0x48053000 0x200>;
247 interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>; 320 interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
248 ti,hwmods = "gpio8"; 321 ti,hwmods = "gpio8";
249 gpio-controller; 322 gpio-controller;
250 #gpio-cells = <2>; 323 #gpio-cells = <2>;
@@ -255,7 +328,7 @@
255 uart1: serial@4806a000 { 328 uart1: serial@4806a000 {
256 compatible = "ti,omap4-uart"; 329 compatible = "ti,omap4-uart";
257 reg = <0x4806a000 0x100>; 330 reg = <0x4806a000 0x100>;
258 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; 331 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
259 ti,hwmods = "uart1"; 332 ti,hwmods = "uart1";
260 clock-frequency = <48000000>; 333 clock-frequency = <48000000>;
261 status = "disabled"; 334 status = "disabled";
@@ -264,7 +337,7 @@
264 uart2: serial@4806c000 { 337 uart2: serial@4806c000 {
265 compatible = "ti,omap4-uart"; 338 compatible = "ti,omap4-uart";
266 reg = <0x4806c000 0x100>; 339 reg = <0x4806c000 0x100>;
267 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 340 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
268 ti,hwmods = "uart2"; 341 ti,hwmods = "uart2";
269 clock-frequency = <48000000>; 342 clock-frequency = <48000000>;
270 status = "disabled"; 343 status = "disabled";
@@ -273,7 +346,7 @@
273 uart3: serial@48020000 { 346 uart3: serial@48020000 {
274 compatible = "ti,omap4-uart"; 347 compatible = "ti,omap4-uart";
275 reg = <0x48020000 0x100>; 348 reg = <0x48020000 0x100>;
276 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 349 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
277 ti,hwmods = "uart3"; 350 ti,hwmods = "uart3";
278 clock-frequency = <48000000>; 351 clock-frequency = <48000000>;
279 status = "disabled"; 352 status = "disabled";
@@ -282,7 +355,7 @@
282 uart4: serial@4806e000 { 355 uart4: serial@4806e000 {
283 compatible = "ti,omap4-uart"; 356 compatible = "ti,omap4-uart";
284 reg = <0x4806e000 0x100>; 357 reg = <0x4806e000 0x100>;
285 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; 358 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
286 ti,hwmods = "uart4"; 359 ti,hwmods = "uart4";
287 clock-frequency = <48000000>; 360 clock-frequency = <48000000>;
288 status = "disabled"; 361 status = "disabled";
@@ -291,7 +364,7 @@
291 uart5: serial@48066000 { 364 uart5: serial@48066000 {
292 compatible = "ti,omap4-uart"; 365 compatible = "ti,omap4-uart";
293 reg = <0x48066000 0x100>; 366 reg = <0x48066000 0x100>;
294 interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>; 367 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
295 ti,hwmods = "uart5"; 368 ti,hwmods = "uart5";
296 clock-frequency = <48000000>; 369 clock-frequency = <48000000>;
297 status = "disabled"; 370 status = "disabled";
@@ -300,7 +373,7 @@
300 uart6: serial@48068000 { 373 uart6: serial@48068000 {
301 compatible = "ti,omap4-uart"; 374 compatible = "ti,omap4-uart";
302 reg = <0x48068000 0x100>; 375 reg = <0x48068000 0x100>;
303 interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; 376 interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
304 ti,hwmods = "uart6"; 377 ti,hwmods = "uart6";
305 clock-frequency = <48000000>; 378 clock-frequency = <48000000>;
306 status = "disabled"; 379 status = "disabled";
@@ -309,6 +382,7 @@
309 uart7: serial@48420000 { 382 uart7: serial@48420000 {
310 compatible = "ti,omap4-uart"; 383 compatible = "ti,omap4-uart";
311 reg = <0x48420000 0x100>; 384 reg = <0x48420000 0x100>;
385 interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>;
312 ti,hwmods = "uart7"; 386 ti,hwmods = "uart7";
313 clock-frequency = <48000000>; 387 clock-frequency = <48000000>;
314 status = "disabled"; 388 status = "disabled";
@@ -317,6 +391,7 @@
317 uart8: serial@48422000 { 391 uart8: serial@48422000 {
318 compatible = "ti,omap4-uart"; 392 compatible = "ti,omap4-uart";
319 reg = <0x48422000 0x100>; 393 reg = <0x48422000 0x100>;
394 interrupts = <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>;
320 ti,hwmods = "uart8"; 395 ti,hwmods = "uart8";
321 clock-frequency = <48000000>; 396 clock-frequency = <48000000>;
322 status = "disabled"; 397 status = "disabled";
@@ -325,6 +400,7 @@
325 uart9: serial@48424000 { 400 uart9: serial@48424000 {
326 compatible = "ti,omap4-uart"; 401 compatible = "ti,omap4-uart";
327 reg = <0x48424000 0x100>; 402 reg = <0x48424000 0x100>;
403 interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
328 ti,hwmods = "uart9"; 404 ti,hwmods = "uart9";
329 clock-frequency = <48000000>; 405 clock-frequency = <48000000>;
330 status = "disabled"; 406 status = "disabled";
@@ -333,15 +409,133 @@
333 uart10: serial@4ae2b000 { 409 uart10: serial@4ae2b000 {
334 compatible = "ti,omap4-uart"; 410 compatible = "ti,omap4-uart";
335 reg = <0x4ae2b000 0x100>; 411 reg = <0x4ae2b000 0x100>;
412 interrupts = <GIC_SPI 221 IRQ_TYPE_LEVEL_HIGH>;
336 ti,hwmods = "uart10"; 413 ti,hwmods = "uart10";
337 clock-frequency = <48000000>; 414 clock-frequency = <48000000>;
338 status = "disabled"; 415 status = "disabled";
339 }; 416 };
340 417
418 mailbox1: mailbox@4a0f4000 {
419 compatible = "ti,omap4-mailbox";
420 reg = <0x4a0f4000 0x200>;
421 ti,hwmods = "mailbox1";
422 ti,mbox-num-users = <3>;
423 ti,mbox-num-fifos = <8>;
424 status = "disabled";
425 };
426
427 mailbox2: mailbox@4883a000 {
428 compatible = "ti,omap4-mailbox";
429 reg = <0x4883a000 0x200>;
430 ti,hwmods = "mailbox2";
431 ti,mbox-num-users = <4>;
432 ti,mbox-num-fifos = <12>;
433 status = "disabled";
434 };
435
436 mailbox3: mailbox@4883c000 {
437 compatible = "ti,omap4-mailbox";
438 reg = <0x4883c000 0x200>;
439 ti,hwmods = "mailbox3";
440 ti,mbox-num-users = <4>;
441 ti,mbox-num-fifos = <12>;
442 status = "disabled";
443 };
444
445 mailbox4: mailbox@4883e000 {
446 compatible = "ti,omap4-mailbox";
447 reg = <0x4883e000 0x200>;
448 ti,hwmods = "mailbox4";
449 ti,mbox-num-users = <4>;
450 ti,mbox-num-fifos = <12>;
451 status = "disabled";
452 };
453
454 mailbox5: mailbox@48840000 {
455 compatible = "ti,omap4-mailbox";
456 reg = <0x48840000 0x200>;
457 ti,hwmods = "mailbox5";
458 ti,mbox-num-users = <4>;
459 ti,mbox-num-fifos = <12>;
460 status = "disabled";
461 };
462
463 mailbox6: mailbox@48842000 {
464 compatible = "ti,omap4-mailbox";
465 reg = <0x48842000 0x200>;
466 ti,hwmods = "mailbox6";
467 ti,mbox-num-users = <4>;
468 ti,mbox-num-fifos = <12>;
469 status = "disabled";
470 };
471
472 mailbox7: mailbox@48844000 {
473 compatible = "ti,omap4-mailbox";
474 reg = <0x48844000 0x200>;
475 ti,hwmods = "mailbox7";
476 ti,mbox-num-users = <4>;
477 ti,mbox-num-fifos = <12>;
478 status = "disabled";
479 };
480
481 mailbox8: mailbox@48846000 {
482 compatible = "ti,omap4-mailbox";
483 reg = <0x48846000 0x200>;
484 ti,hwmods = "mailbox8";
485 ti,mbox-num-users = <4>;
486 ti,mbox-num-fifos = <12>;
487 status = "disabled";
488 };
489
490 mailbox9: mailbox@4885e000 {
491 compatible = "ti,omap4-mailbox";
492 reg = <0x4885e000 0x200>;
493 ti,hwmods = "mailbox9";
494 ti,mbox-num-users = <4>;
495 ti,mbox-num-fifos = <12>;
496 status = "disabled";
497 };
498
499 mailbox10: mailbox@48860000 {
500 compatible = "ti,omap4-mailbox";
501 reg = <0x48860000 0x200>;
502 ti,hwmods = "mailbox10";
503 ti,mbox-num-users = <4>;
504 ti,mbox-num-fifos = <12>;
505 status = "disabled";
506 };
507
508 mailbox11: mailbox@48862000 {
509 compatible = "ti,omap4-mailbox";
510 reg = <0x48862000 0x200>;
511 ti,hwmods = "mailbox11";
512 ti,mbox-num-users = <4>;
513 ti,mbox-num-fifos = <12>;
514 status = "disabled";
515 };
516
517 mailbox12: mailbox@48864000 {
518 compatible = "ti,omap4-mailbox";
519 reg = <0x48864000 0x200>;
520 ti,hwmods = "mailbox12";
521 ti,mbox-num-users = <4>;
522 ti,mbox-num-fifos = <12>;
523 status = "disabled";
524 };
525
526 mailbox13: mailbox@48802000 {
527 compatible = "ti,omap4-mailbox";
528 reg = <0x48802000 0x200>;
529 ti,hwmods = "mailbox13";
530 ti,mbox-num-users = <4>;
531 ti,mbox-num-fifos = <12>;
532 status = "disabled";
533 };
534
341 timer1: timer@4ae18000 { 535 timer1: timer@4ae18000 {
342 compatible = "ti,omap5430-timer"; 536 compatible = "ti,omap5430-timer";
343 reg = <0x4ae18000 0x80>; 537 reg = <0x4ae18000 0x80>;
344 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 538 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
345 ti,hwmods = "timer1"; 539 ti,hwmods = "timer1";
346 ti,timer-alwon; 540 ti,timer-alwon;
347 }; 541 };
@@ -349,28 +543,28 @@
349 timer2: timer@48032000 { 543 timer2: timer@48032000 {
350 compatible = "ti,omap5430-timer"; 544 compatible = "ti,omap5430-timer";
351 reg = <0x48032000 0x80>; 545 reg = <0x48032000 0x80>;
352 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>; 546 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
353 ti,hwmods = "timer2"; 547 ti,hwmods = "timer2";
354 }; 548 };
355 549
356 timer3: timer@48034000 { 550 timer3: timer@48034000 {
357 compatible = "ti,omap5430-timer"; 551 compatible = "ti,omap5430-timer";
358 reg = <0x48034000 0x80>; 552 reg = <0x48034000 0x80>;
359 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; 553 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
360 ti,hwmods = "timer3"; 554 ti,hwmods = "timer3";
361 }; 555 };
362 556
363 timer4: timer@48036000 { 557 timer4: timer@48036000 {
364 compatible = "ti,omap5430-timer"; 558 compatible = "ti,omap5430-timer";
365 reg = <0x48036000 0x80>; 559 reg = <0x48036000 0x80>;
366 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; 560 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
367 ti,hwmods = "timer4"; 561 ti,hwmods = "timer4";
368 }; 562 };
369 563
370 timer5: timer@48820000 { 564 timer5: timer@48820000 {
371 compatible = "ti,omap5430-timer"; 565 compatible = "ti,omap5430-timer";
372 reg = <0x48820000 0x80>; 566 reg = <0x48820000 0x80>;
373 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; 567 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
374 ti,hwmods = "timer5"; 568 ti,hwmods = "timer5";
375 ti,timer-dsp; 569 ti,timer-dsp;
376 }; 570 };
@@ -378,7 +572,7 @@
378 timer6: timer@48822000 { 572 timer6: timer@48822000 {
379 compatible = "ti,omap5430-timer"; 573 compatible = "ti,omap5430-timer";
380 reg = <0x48822000 0x80>; 574 reg = <0x48822000 0x80>;
381 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; 575 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
382 ti,hwmods = "timer6"; 576 ti,hwmods = "timer6";
383 ti,timer-dsp; 577 ti,timer-dsp;
384 ti,timer-pwm; 578 ti,timer-pwm;
@@ -387,7 +581,7 @@
387 timer7: timer@48824000 { 581 timer7: timer@48824000 {
388 compatible = "ti,omap5430-timer"; 582 compatible = "ti,omap5430-timer";
389 reg = <0x48824000 0x80>; 583 reg = <0x48824000 0x80>;
390 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; 584 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
391 ti,hwmods = "timer7"; 585 ti,hwmods = "timer7";
392 ti,timer-dsp; 586 ti,timer-dsp;
393 }; 587 };
@@ -395,7 +589,7 @@
395 timer8: timer@48826000 { 589 timer8: timer@48826000 {
396 compatible = "ti,omap5430-timer"; 590 compatible = "ti,omap5430-timer";
397 reg = <0x48826000 0x80>; 591 reg = <0x48826000 0x80>;
398 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; 592 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
399 ti,hwmods = "timer8"; 593 ti,hwmods = "timer8";
400 ti,timer-dsp; 594 ti,timer-dsp;
401 ti,timer-pwm; 595 ti,timer-pwm;
@@ -404,21 +598,21 @@
404 timer9: timer@4803e000 { 598 timer9: timer@4803e000 {
405 compatible = "ti,omap5430-timer"; 599 compatible = "ti,omap5430-timer";
406 reg = <0x4803e000 0x80>; 600 reg = <0x4803e000 0x80>;
407 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; 601 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
408 ti,hwmods = "timer9"; 602 ti,hwmods = "timer9";
409 }; 603 };
410 604
411 timer10: timer@48086000 { 605 timer10: timer@48086000 {
412 compatible = "ti,omap5430-timer"; 606 compatible = "ti,omap5430-timer";
413 reg = <0x48086000 0x80>; 607 reg = <0x48086000 0x80>;
414 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 608 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
415 ti,hwmods = "timer10"; 609 ti,hwmods = "timer10";
416 }; 610 };
417 611
418 timer11: timer@48088000 { 612 timer11: timer@48088000 {
419 compatible = "ti,omap5430-timer"; 613 compatible = "ti,omap5430-timer";
420 reg = <0x48088000 0x80>; 614 reg = <0x48088000 0x80>;
421 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; 615 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
422 ti,hwmods = "timer11"; 616 ti,hwmods = "timer11";
423 ti,timer-pwm; 617 ti,timer-pwm;
424 }; 618 };
@@ -426,6 +620,7 @@
426 timer13: timer@48828000 { 620 timer13: timer@48828000 {
427 compatible = "ti,omap5430-timer"; 621 compatible = "ti,omap5430-timer";
428 reg = <0x48828000 0x80>; 622 reg = <0x48828000 0x80>;
623 interrupts = <GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH>;
429 ti,hwmods = "timer13"; 624 ti,hwmods = "timer13";
430 status = "disabled"; 625 status = "disabled";
431 }; 626 };
@@ -433,6 +628,7 @@
433 timer14: timer@4882a000 { 628 timer14: timer@4882a000 {
434 compatible = "ti,omap5430-timer"; 629 compatible = "ti,omap5430-timer";
435 reg = <0x4882a000 0x80>; 630 reg = <0x4882a000 0x80>;
631 interrupts = <GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH>;
436 ti,hwmods = "timer14"; 632 ti,hwmods = "timer14";
437 status = "disabled"; 633 status = "disabled";
438 }; 634 };
@@ -440,6 +636,7 @@
440 timer15: timer@4882c000 { 636 timer15: timer@4882c000 {
441 compatible = "ti,omap5430-timer"; 637 compatible = "ti,omap5430-timer";
442 reg = <0x4882c000 0x80>; 638 reg = <0x4882c000 0x80>;
639 interrupts = <GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>;
443 ti,hwmods = "timer15"; 640 ti,hwmods = "timer15";
444 status = "disabled"; 641 status = "disabled";
445 }; 642 };
@@ -447,6 +644,7 @@
447 timer16: timer@4882e000 { 644 timer16: timer@4882e000 {
448 compatible = "ti,omap5430-timer"; 645 compatible = "ti,omap5430-timer";
449 reg = <0x4882e000 0x80>; 646 reg = <0x4882e000 0x80>;
647 interrupts = <GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH>;
450 ti,hwmods = "timer16"; 648 ti,hwmods = "timer16";
451 status = "disabled"; 649 status = "disabled";
452 }; 650 };
@@ -454,7 +652,7 @@
454 wdt2: wdt@4ae14000 { 652 wdt2: wdt@4ae14000 {
455 compatible = "ti,omap4-wdt"; 653 compatible = "ti,omap4-wdt";
456 reg = <0x4ae14000 0x80>; 654 reg = <0x4ae14000 0x80>;
457 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; 655 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
458 ti,hwmods = "wd_timer2"; 656 ti,hwmods = "wd_timer2";
459 }; 657 };
460 658
@@ -468,14 +666,14 @@
468 dmm@4e000000 { 666 dmm@4e000000 {
469 compatible = "ti,omap5-dmm"; 667 compatible = "ti,omap5-dmm";
470 reg = <0x4e000000 0x800>; 668 reg = <0x4e000000 0x800>;
471 interrupts = <0 113 0x4>; 669 interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
472 ti,hwmods = "dmm"; 670 ti,hwmods = "dmm";
473 }; 671 };
474 672
475 i2c1: i2c@48070000 { 673 i2c1: i2c@48070000 {
476 compatible = "ti,omap4-i2c"; 674 compatible = "ti,omap4-i2c";
477 reg = <0x48070000 0x100>; 675 reg = <0x48070000 0x100>;
478 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; 676 interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
479 #address-cells = <1>; 677 #address-cells = <1>;
480 #size-cells = <0>; 678 #size-cells = <0>;
481 ti,hwmods = "i2c1"; 679 ti,hwmods = "i2c1";
@@ -485,7 +683,7 @@
485 i2c2: i2c@48072000 { 683 i2c2: i2c@48072000 {
486 compatible = "ti,omap4-i2c"; 684 compatible = "ti,omap4-i2c";
487 reg = <0x48072000 0x100>; 685 reg = <0x48072000 0x100>;
488 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; 686 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
489 #address-cells = <1>; 687 #address-cells = <1>;
490 #size-cells = <0>; 688 #size-cells = <0>;
491 ti,hwmods = "i2c2"; 689 ti,hwmods = "i2c2";
@@ -495,7 +693,7 @@
495 i2c3: i2c@48060000 { 693 i2c3: i2c@48060000 {
496 compatible = "ti,omap4-i2c"; 694 compatible = "ti,omap4-i2c";
497 reg = <0x48060000 0x100>; 695 reg = <0x48060000 0x100>;
498 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>; 696 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
499 #address-cells = <1>; 697 #address-cells = <1>;
500 #size-cells = <0>; 698 #size-cells = <0>;
501 ti,hwmods = "i2c3"; 699 ti,hwmods = "i2c3";
@@ -505,7 +703,7 @@
505 i2c4: i2c@4807a000 { 703 i2c4: i2c@4807a000 {
506 compatible = "ti,omap4-i2c"; 704 compatible = "ti,omap4-i2c";
507 reg = <0x4807a000 0x100>; 705 reg = <0x4807a000 0x100>;
508 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; 706 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
509 #address-cells = <1>; 707 #address-cells = <1>;
510 #size-cells = <0>; 708 #size-cells = <0>;
511 ti,hwmods = "i2c4"; 709 ti,hwmods = "i2c4";
@@ -515,7 +713,7 @@
515 i2c5: i2c@4807c000 { 713 i2c5: i2c@4807c000 {
516 compatible = "ti,omap4-i2c"; 714 compatible = "ti,omap4-i2c";
517 reg = <0x4807c000 0x100>; 715 reg = <0x4807c000 0x100>;
518 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; 716 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
519 #address-cells = <1>; 717 #address-cells = <1>;
520 #size-cells = <0>; 718 #size-cells = <0>;
521 ti,hwmods = "i2c5"; 719 ti,hwmods = "i2c5";
@@ -525,7 +723,7 @@
525 mmc1: mmc@4809c000 { 723 mmc1: mmc@4809c000 {
526 compatible = "ti,omap4-hsmmc"; 724 compatible = "ti,omap4-hsmmc";
527 reg = <0x4809c000 0x400>; 725 reg = <0x4809c000 0x400>;
528 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; 726 interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
529 ti,hwmods = "mmc1"; 727 ti,hwmods = "mmc1";
530 ti,dual-volt; 728 ti,dual-volt;
531 ti,needs-special-reset; 729 ti,needs-special-reset;
@@ -538,7 +736,7 @@
538 mmc2: mmc@480b4000 { 736 mmc2: mmc@480b4000 {
539 compatible = "ti,omap4-hsmmc"; 737 compatible = "ti,omap4-hsmmc";
540 reg = <0x480b4000 0x400>; 738 reg = <0x480b4000 0x400>;
541 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; 739 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
542 ti,hwmods = "mmc2"; 740 ti,hwmods = "mmc2";
543 ti,needs-special-reset; 741 ti,needs-special-reset;
544 dmas = <&sdma 47>, <&sdma 48>; 742 dmas = <&sdma 47>, <&sdma 48>;
@@ -549,7 +747,7 @@
549 mmc3: mmc@480ad000 { 747 mmc3: mmc@480ad000 {
550 compatible = "ti,omap4-hsmmc"; 748 compatible = "ti,omap4-hsmmc";
551 reg = <0x480ad000 0x400>; 749 reg = <0x480ad000 0x400>;
552 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; 750 interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
553 ti,hwmods = "mmc3"; 751 ti,hwmods = "mmc3";
554 ti,needs-special-reset; 752 ti,needs-special-reset;
555 dmas = <&sdma 77>, <&sdma 78>; 753 dmas = <&sdma 77>, <&sdma 78>;
@@ -560,7 +758,7 @@
560 mmc4: mmc@480d1000 { 758 mmc4: mmc@480d1000 {
561 compatible = "ti,omap4-hsmmc"; 759 compatible = "ti,omap4-hsmmc";
562 reg = <0x480d1000 0x400>; 760 reg = <0x480d1000 0x400>;
563 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>; 761 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
564 ti,hwmods = "mmc4"; 762 ti,hwmods = "mmc4";
565 ti,needs-special-reset; 763 ti,needs-special-reset;
566 dmas = <&sdma 57>, <&sdma 58>; 764 dmas = <&sdma 57>, <&sdma 58>;
@@ -703,7 +901,7 @@
703 mcspi1: spi@48098000 { 901 mcspi1: spi@48098000 {
704 compatible = "ti,omap4-mcspi"; 902 compatible = "ti,omap4-mcspi";
705 reg = <0x48098000 0x200>; 903 reg = <0x48098000 0x200>;
706 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 904 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
707 #address-cells = <1>; 905 #address-cells = <1>;
708 #size-cells = <0>; 906 #size-cells = <0>;
709 ti,hwmods = "mcspi1"; 907 ti,hwmods = "mcspi1";
@@ -724,7 +922,7 @@
724 mcspi2: spi@4809a000 { 922 mcspi2: spi@4809a000 {
725 compatible = "ti,omap4-mcspi"; 923 compatible = "ti,omap4-mcspi";
726 reg = <0x4809a000 0x200>; 924 reg = <0x4809a000 0x200>;
727 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>; 925 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
728 #address-cells = <1>; 926 #address-cells = <1>;
729 #size-cells = <0>; 927 #size-cells = <0>;
730 ti,hwmods = "mcspi2"; 928 ti,hwmods = "mcspi2";
@@ -740,7 +938,7 @@
740 mcspi3: spi@480b8000 { 938 mcspi3: spi@480b8000 {
741 compatible = "ti,omap4-mcspi"; 939 compatible = "ti,omap4-mcspi";
742 reg = <0x480b8000 0x200>; 940 reg = <0x480b8000 0x200>;
743 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; 941 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
744 #address-cells = <1>; 942 #address-cells = <1>;
745 #size-cells = <0>; 943 #size-cells = <0>;
746 ti,hwmods = "mcspi3"; 944 ti,hwmods = "mcspi3";
@@ -753,7 +951,7 @@
753 mcspi4: spi@480ba000 { 951 mcspi4: spi@480ba000 {
754 compatible = "ti,omap4-mcspi"; 952 compatible = "ti,omap4-mcspi";
755 reg = <0x480ba000 0x200>; 953 reg = <0x480ba000 0x200>;
756 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; 954 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
757 #address-cells = <1>; 955 #address-cells = <1>;
758 #size-cells = <0>; 956 #size-cells = <0>;
759 ti,hwmods = "mcspi4"; 957 ti,hwmods = "mcspi4";
@@ -773,6 +971,7 @@
773 clocks = <&qspi_gfclk_div>; 971 clocks = <&qspi_gfclk_div>;
774 clock-names = "fck"; 972 clock-names = "fck";
775 num-cs = <4>; 973 num-cs = <4>;
974 interrupts = <GIC_SPI 343 IRQ_TYPE_LEVEL_HIGH>;
776 status = "disabled"; 975 status = "disabled";
777 }; 976 };
778 977
@@ -803,18 +1002,76 @@
803 clock-names = "sysclk"; 1002 clock-names = "sysclk";
804 #phy-cells = <0>; 1003 #phy-cells = <0>;
805 }; 1004 };
1005
1006 pcie1_phy: pciephy@4a094000 {
1007 compatible = "ti,phy-pipe3-pcie";
1008 reg = <0x4a094000 0x80>, /* phy_rx */
1009 <0x4a094400 0x64>; /* phy_tx */
1010 reg-names = "phy_rx", "phy_tx";
1011 ctrl-module = <&omap_control_pcie1phy>;
1012 clocks = <&dpll_pcie_ref_ck>,
1013 <&dpll_pcie_ref_m2ldo_ck>,
1014 <&optfclk_pciephy1_32khz>,
1015 <&optfclk_pciephy1_clk>,
1016 <&optfclk_pciephy1_div_clk>,
1017 <&optfclk_pciephy_div>;
1018 clock-names = "dpll_ref", "dpll_ref_m2",
1019 "wkupclk", "refclk",
1020 "div-clk", "phy-div";
1021 #phy-cells = <0>;
1022 id = <1>;
1023 ti,hwmods = "pcie1-phy";
1024 };
1025
1026 pcie2_phy: pciephy@4a095000 {
1027 compatible = "ti,phy-pipe3-pcie";
1028 reg = <0x4a095000 0x80>, /* phy_rx */
1029 <0x4a095400 0x64>; /* phy_tx */
1030 reg-names = "phy_rx", "phy_tx";
1031 ctrl-module = <&omap_control_pcie2phy>;
1032 clocks = <&dpll_pcie_ref_ck>,
1033 <&dpll_pcie_ref_m2ldo_ck>,
1034 <&optfclk_pciephy2_32khz>,
1035 <&optfclk_pciephy2_clk>,
1036 <&optfclk_pciephy2_div_clk>,
1037 <&optfclk_pciephy_div>;
1038 clock-names = "dpll_ref", "dpll_ref_m2",
1039 "wkupclk", "refclk",
1040 "div-clk", "phy-div";
1041 #phy-cells = <0>;
1042 ti,hwmods = "pcie2-phy";
1043 id = <2>;
1044 status = "disabled";
1045 };
806 }; 1046 };
807 1047
808 sata: sata@4a141100 { 1048 sata: sata@4a141100 {
809 compatible = "snps,dwc-ahci"; 1049 compatible = "snps,dwc-ahci";
810 reg = <0x4a140000 0x1100>, <0x4a141100 0x7>; 1050 reg = <0x4a140000 0x1100>, <0x4a141100 0x7>;
811 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; 1051 interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
812 phys = <&sata_phy>; 1052 phys = <&sata_phy>;
813 phy-names = "sata-phy"; 1053 phy-names = "sata-phy";
814 clocks = <&sata_ref_clk>; 1054 clocks = <&sata_ref_clk>;
815 ti,hwmods = "sata"; 1055 ti,hwmods = "sata";
816 }; 1056 };
817 1057
1058 omap_control_pcie1phy: control-phy@0x4a003c40 {
1059 compatible = "ti,control-phy-pcie";
1060 reg = <0x4a003c40 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
1061 reg-names = "power", "control_sma", "pcie_pcs";
1062 clocks = <&sys_clkin1>;
1063 clock-names = "sysclk";
1064 };
1065
1066 omap_control_pcie2phy: control-pcie@0x4a003c44 {
1067 compatible = "ti,control-phy-pcie";
1068 reg = <0x4a003c44 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
1069 reg-names = "power", "control_sma", "pcie_pcs";
1070 clocks = <&sys_clkin1>;
1071 clock-names = "sysclk";
1072 status = "disabled";
1073 };
1074
818 omap_control_usb2phy1: control-phy@4a002300 { 1075 omap_control_usb2phy1: control-phy@4a002300 {
819 compatible = "ti,control-phy-usb2"; 1076 compatible = "ti,control-phy-usb2";
820 reg = <0x4a002300 0x4>; 1077 reg = <0x4a002300 0x4>;
@@ -885,7 +1142,7 @@
885 compatible = "ti,dwc3"; 1142 compatible = "ti,dwc3";
886 ti,hwmods = "usb_otg_ss1"; 1143 ti,hwmods = "usb_otg_ss1";
887 reg = <0x48880000 0x10000>; 1144 reg = <0x48880000 0x10000>;
888 interrupts = <0 77 4>; 1145 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
889 #address-cells = <1>; 1146 #address-cells = <1>;
890 #size-cells = <1>; 1147 #size-cells = <1>;
891 utmi-mode = <2>; 1148 utmi-mode = <2>;
@@ -893,7 +1150,7 @@
893 usb1: usb@48890000 { 1150 usb1: usb@48890000 {
894 compatible = "snps,dwc3"; 1151 compatible = "snps,dwc3";
895 reg = <0x48890000 0x17000>; 1152 reg = <0x48890000 0x17000>;
896 interrupts = <0 76 4>; 1153 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
897 phys = <&usb2_phy1>, <&usb3_phy1>; 1154 phys = <&usb2_phy1>, <&usb3_phy1>;
898 phy-names = "usb2-phy", "usb3-phy"; 1155 phy-names = "usb2-phy", "usb3-phy";
899 tx-fifo-resize; 1156 tx-fifo-resize;
@@ -906,7 +1163,7 @@
906 compatible = "ti,dwc3"; 1163 compatible = "ti,dwc3";
907 ti,hwmods = "usb_otg_ss2"; 1164 ti,hwmods = "usb_otg_ss2";
908 reg = <0x488c0000 0x10000>; 1165 reg = <0x488c0000 0x10000>;
909 interrupts = <0 92 4>; 1166 interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
910 #address-cells = <1>; 1167 #address-cells = <1>;
911 #size-cells = <1>; 1168 #size-cells = <1>;
912 utmi-mode = <2>; 1169 utmi-mode = <2>;
@@ -914,7 +1171,7 @@
914 usb2: usb@488d0000 { 1171 usb2: usb@488d0000 {
915 compatible = "snps,dwc3"; 1172 compatible = "snps,dwc3";
916 reg = <0x488d0000 0x17000>; 1173 reg = <0x488d0000 0x17000>;
917 interrupts = <0 78 4>; 1174 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
918 phys = <&usb2_phy2>; 1175 phys = <&usb2_phy2>;
919 phy-names = "usb2-phy"; 1176 phy-names = "usb2-phy";
920 tx-fifo-resize; 1177 tx-fifo-resize;
@@ -928,7 +1185,7 @@
928 compatible = "ti,dwc3"; 1185 compatible = "ti,dwc3";
929 ti,hwmods = "usb_otg_ss3"; 1186 ti,hwmods = "usb_otg_ss3";
930 reg = <0x48900000 0x10000>; 1187 reg = <0x48900000 0x10000>;
931 /* interrupts = <0 TBD 4>; */ 1188 interrupts = <GIC_SPI 344 IRQ_TYPE_LEVEL_HIGH>;
932 #address-cells = <1>; 1189 #address-cells = <1>;
933 #size-cells = <1>; 1190 #size-cells = <1>;
934 utmi-mode = <2>; 1191 utmi-mode = <2>;
@@ -937,7 +1194,7 @@
937 usb3: usb@48910000 { 1194 usb3: usb@48910000 {
938 compatible = "snps,dwc3"; 1195 compatible = "snps,dwc3";
939 reg = <0x48910000 0x17000>; 1196 reg = <0x48910000 0x17000>;
940 /* interrupts = <0 93 4>; */ 1197 interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
941 tx-fifo-resize; 1198 tx-fifo-resize;
942 maximum-speed = "high-speed"; 1199 maximum-speed = "high-speed";
943 dr_mode = "otg"; 1200 dr_mode = "otg";
@@ -948,7 +1205,7 @@
948 compatible = "ti,dwc3"; 1205 compatible = "ti,dwc3";
949 ti,hwmods = "usb_otg_ss4"; 1206 ti,hwmods = "usb_otg_ss4";
950 reg = <0x48940000 0x10000>; 1207 reg = <0x48940000 0x10000>;
951 /* interrupts = <0 TBD 4>; */ 1208 interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>;
952 #address-cells = <1>; 1209 #address-cells = <1>;
953 #size-cells = <1>; 1210 #size-cells = <1>;
954 utmi-mode = <2>; 1211 utmi-mode = <2>;
@@ -957,7 +1214,7 @@
957 usb4: usb@48950000 { 1214 usb4: usb@48950000 {
958 compatible = "snps,dwc3"; 1215 compatible = "snps,dwc3";
959 reg = <0x48950000 0x17000>; 1216 reg = <0x48950000 0x17000>;
960 /* interrupts = <0 TBD 4>; */ 1217 interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>;
961 tx-fifo-resize; 1218 tx-fifo-resize;
962 maximum-speed = "high-speed"; 1219 maximum-speed = "high-speed";
963 dr_mode = "otg"; 1220 dr_mode = "otg";
@@ -967,7 +1224,7 @@
967 elm: elm@48078000 { 1224 elm: elm@48078000 {
968 compatible = "ti,am3352-elm"; 1225 compatible = "ti,am3352-elm";
969 reg = <0x48078000 0xfc0>; /* device IO registers */ 1226 reg = <0x48078000 0xfc0>; /* device IO registers */
970 interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; 1227 interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
971 ti,hwmods = "elm"; 1228 ti,hwmods = "elm";
972 status = "disabled"; 1229 status = "disabled";
973 }; 1230 };
@@ -976,7 +1233,7 @@
976 compatible = "ti,am3352-gpmc"; 1233 compatible = "ti,am3352-gpmc";
977 ti,hwmods = "gpmc"; 1234 ti,hwmods = "gpmc";
978 reg = <0x50000000 0x37c>; /* device IO registers */ 1235 reg = <0x50000000 0x37c>; /* device IO registers */
979 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; 1236 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
980 gpmc,num-cs = <8>; 1237 gpmc,num-cs = <8>;
981 gpmc,num-waitpins = <2>; 1238 gpmc,num-waitpins = <2>;
982 #address-cells = <2>; 1239 #address-cells = <2>;
@@ -994,6 +1251,17 @@
994 clock-names = "fck"; 1251 clock-names = "fck";
995 status = "disabled"; 1252 status = "disabled";
996 }; 1253 };
1254
1255 crossbar_mpu: crossbar@4a020000 {
1256 compatible = "ti,irq-crossbar";
1257 reg = <0x4a002a48 0x130>;
1258 ti,max-irqs = <160>;
1259 ti,max-crossbar-sources = <MAX_SOURCES>;
1260 ti,reg-size = <2>;
1261 ti,irqs-reserved = <0 1 2 3 5 6 131 132>;
1262 ti,irqs-skip = <10 133 139 140>;
1263 ti,irqs-safe-map = <0>;
1264 };
997 }; 1265 };
998}; 1266};
999 1267
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index dc7a292fe939..2c05b3f017fa 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -1154,7 +1154,7 @@
1154 1154
1155 apll_pcie_in_clk_mux: apll_pcie_in_clk_mux@4ae06118 { 1155 apll_pcie_in_clk_mux: apll_pcie_in_clk_mux@4ae06118 {
1156 compatible = "ti,mux-clock"; 1156 compatible = "ti,mux-clock";
1157 clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>; 1157 clocks = <&dpll_pcie_ref_m2ldo_ck>, <&pciesref_acs_clk_ck>;
1158 #clock-cells = <0>; 1158 #clock-cells = <0>;
1159 reg = <0x021c 0x4>; 1159 reg = <0x021c 0x4>;
1160 ti,bit-shift = <7>; 1160 ti,bit-shift = <7>;
@@ -1167,16 +1167,33 @@
1167 reg = <0x021c>, <0x0220>; 1167 reg = <0x021c>, <0x0220>;
1168 }; 1168 };
1169 1169
1170 optfclk_pciephy1_32khz: optfclk_pciephy1_32khz@4a0093b0 {
1171 compatible = "ti,gate-clock";
1172 clocks = <&sys_32k_ck>;
1173 #clock-cells = <0>;
1174 reg = <0x13b0>;
1175 ti,bit-shift = <8>;
1176 };
1177
1178 optfclk_pciephy2_32khz: optfclk_pciephy2_32khz@4a0093b8 {
1179 compatible = "ti,gate-clock";
1180 clocks = <&sys_32k_ck>;
1181 #clock-cells = <0>;
1182 reg = <0x13b8>;
1183 ti,bit-shift = <8>;
1184 };
1185
1170 optfclk_pciephy_div: optfclk_pciephy_div@4a00821c { 1186 optfclk_pciephy_div: optfclk_pciephy_div@4a00821c {
1171 compatible = "ti,divider-clock"; 1187 compatible = "ti,divider-clock";
1172 clocks = <&apll_pcie_ck>; 1188 clocks = <&apll_pcie_ck>;
1173 #clock-cells = <0>; 1189 #clock-cells = <0>;
1174 reg = <0x021c>; 1190 reg = <0x021c>;
1191 ti,dividers = <2>, <1>;
1175 ti,bit-shift = <8>; 1192 ti,bit-shift = <8>;
1176 ti,max-div = <2>; 1193 ti,max-div = <2>;
1177 }; 1194 };
1178 1195
1179 optfclk_pciephy_clk: optfclk_pciephy_clk@4a0093b0 { 1196 optfclk_pciephy1_clk: optfclk_pciephy1_clk@4a0093b0 {
1180 compatible = "ti,gate-clock"; 1197 compatible = "ti,gate-clock";
1181 clocks = <&apll_pcie_ck>; 1198 clocks = <&apll_pcie_ck>;
1182 #clock-cells = <0>; 1199 #clock-cells = <0>;
@@ -1184,7 +1201,15 @@
1184 ti,bit-shift = <9>; 1201 ti,bit-shift = <9>;
1185 }; 1202 };
1186 1203
1187 optfclk_pciephy_div_clk: optfclk_pciephy_div_clk@4a0093b0 { 1204 optfclk_pciephy2_clk: optfclk_pciephy2_clk@4a0093b8 {
1205 compatible = "ti,gate-clock";
1206 clocks = <&apll_pcie_ck>;
1207 #clock-cells = <0>;
1208 reg = <0x13b8>;
1209 ti,bit-shift = <9>;
1210 };
1211
1212 optfclk_pciephy1_div_clk: optfclk_pciephy1_div_clk@4a0093b0 {
1188 compatible = "ti,gate-clock"; 1213 compatible = "ti,gate-clock";
1189 clocks = <&optfclk_pciephy_div>; 1214 clocks = <&optfclk_pciephy_div>;
1190 #clock-cells = <0>; 1215 #clock-cells = <0>;
@@ -1192,6 +1217,14 @@
1192 ti,bit-shift = <10>; 1217 ti,bit-shift = <10>;
1193 }; 1218 };
1194 1219
1220 optfclk_pciephy2_div_clk: optfclk_pciephy2_div_clk@4a0093b8 {
1221 compatible = "ti,gate-clock";
1222 clocks = <&optfclk_pciephy_div>;
1223 #clock-cells = <0>;
1224 reg = <0x13b8>;
1225 ti,bit-shift = <10>;
1226 };
1227
1195 apll_pcie_clkvcoldo: apll_pcie_clkvcoldo { 1228 apll_pcie_clkvcoldo: apll_pcie_clkvcoldo {
1196 #clock-cells = <0>; 1229 #clock-cells = <0>;
1197 compatible = "fixed-factor-clock"; 1230 compatible = "fixed-factor-clock";
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index e37985fa10e2..00eeed3721b6 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -31,11 +31,13 @@
31 device_type = "cpu"; 31 device_type = "cpu";
32 compatible = "arm,cortex-a9"; 32 compatible = "arm,cortex-a9";
33 reg = <0>; 33 reg = <0>;
34 clock-frequency = <533000000>;
34 }; 35 };
35 cpu@1 { 36 cpu@1 {
36 device_type = "cpu"; 37 device_type = "cpu";
37 compatible = "arm,cortex-a9"; 38 compatible = "arm,cortex-a9";
38 reg = <1>; 39 reg = <1>;
40 clock-frequency = <533000000>;
39 }; 41 };
40 }; 42 };
41 43
diff --git a/arch/arm/boot/dts/ethernut5.dts b/arch/arm/boot/dts/ethernut5.dts
index 143b6d25bc80..8f941c2db7c6 100644
--- a/arch/arm/boot/dts/ethernut5.dts
+++ b/arch/arm/boot/dts/ethernut5.dts
@@ -20,6 +20,16 @@
20 reg = <0x20000000 0x08000000>; 20 reg = <0x20000000 0x08000000>;
21 }; 21 };
22 22
23 clocks {
24 slow_xtal {
25 clock-frequency = <32768>;
26 };
27
28 main_xtal {
29 clock-frequency = <18432000>;
30 };
31 };
32
23 ahb { 33 ahb {
24 apb { 34 apb {
25 dbgu: serial@fffff200 { 35 dbgu: serial@fffff200 {
diff --git a/arch/arm/boot/dts/evk-pro3.dts b/arch/arm/boot/dts/evk-pro3.dts
index 4d829685fdfb..f72969efe6d7 100644
--- a/arch/arm/boot/dts/evk-pro3.dts
+++ b/arch/arm/boot/dts/evk-pro3.dts
@@ -15,6 +15,12 @@
15 model = "Telit EVK-PRO3 for Telit GE863-PRO3"; 15 model = "Telit EVK-PRO3 for Telit GE863-PRO3";
16 compatible = "telit,evk-pro3", "atmel,at91sam9260", "atmel,at91sam9"; 16 compatible = "telit,evk-pro3", "atmel,at91sam9260", "atmel,at91sam9";
17 17
18 clocks {
19 slow_xtal {
20 clock-frequency = <32768>;
21 };
22 };
23
18 ahb { 24 ahb {
19 apb { 25 apb {
20 macb0: ethernet@fffc4000 { 26 macb0: ethernet@fffc4000 {
diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi
index 3e678fa335bf..1d52de6370d5 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -39,6 +39,8 @@
39 i2c5 = &i2c_5; 39 i2c5 = &i2c_5;
40 i2c6 = &i2c_6; 40 i2c6 = &i2c_6;
41 i2c7 = &i2c_7; 41 i2c7 = &i2c_7;
42 serial0 = &serial_0;
43 serial1 = &serial_1;
42 }; 44 };
43 45
44 cpus { 46 cpus {
@@ -168,6 +170,15 @@
168 status = "disabled"; 170 status = "disabled";
169 }; 171 };
170 172
173 tmu: tmu@100C0000 {
174 compatible = "samsung,exynos3250-tmu";
175 reg = <0x100C0000 0x100>;
176 interrupts = <0 216 0>;
177 clocks = <&cmu CLK_TMU_APBIF>;
178 clock-names = "tmu_apbif";
179 status = "disabled";
180 };
181
171 gic: interrupt-controller@10481000 { 182 gic: interrupt-controller@10481000 {
172 compatible = "arm,cortex-a15-gic"; 183 compatible = "arm,cortex-a15-gic";
173 #interrupt-cells = <3>; 184 #interrupt-cells = <3>;
@@ -195,7 +206,6 @@
195 206
196 wakeup-interrupt-controller { 207 wakeup-interrupt-controller {
197 compatible = "samsung,exynos4210-wakeup-eint"; 208 compatible = "samsung,exynos4210-wakeup-eint";
198 interrupt-parent = <&gic>;
199 interrupts = <0 48 0>; 209 interrupts = <0 48 0>;
200 }; 210 };
201 }; 211 };
@@ -234,7 +244,6 @@
234 compatible = "arm,amba-bus"; 244 compatible = "arm,amba-bus";
235 #address-cells = <1>; 245 #address-cells = <1>;
236 #size-cells = <1>; 246 #size-cells = <1>;
237 interrupt-parent = <&gic>;
238 ranges; 247 ranges;
239 248
240 pdma0: pdma@12680000 { 249 pdma0: pdma@12680000 {
@@ -261,10 +270,11 @@
261 }; 270 };
262 271
263 adc: adc@126C0000 { 272 adc: adc@126C0000 {
264 compatible = "samsung,exynos-adc-v3"; 273 compatible = "samsung,exynos3250-adc",
274 "samsung,exynos-adc-v2";
265 reg = <0x126C0000 0x100>, <0x10020718 0x4>; 275 reg = <0x126C0000 0x100>, <0x10020718 0x4>;
266 interrupts = <0 137 0>; 276 interrupts = <0 137 0>;
267 clock-names = "adc", "sclk_tsadc"; 277 clock-names = "adc", "sclk";
268 clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>; 278 clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>;
269 #io-channel-cells = <1>; 279 #io-channel-cells = <1>;
270 io-channel-ranges; 280 io-channel-ranges;
@@ -277,6 +287,8 @@
277 interrupts = <0 109 0>; 287 interrupts = <0 109 0>;
278 clocks = <&cmu CLK_UART0>, <&cmu CLK_SCLK_UART0>; 288 clocks = <&cmu CLK_UART0>, <&cmu CLK_SCLK_UART0>;
279 clock-names = "uart", "clk_uart_baud0"; 289 clock-names = "uart", "clk_uart_baud0";
290 pinctrl-names = "default";
291 pinctrl-0 = <&uart0_data &uart0_fctl>;
280 status = "disabled"; 292 status = "disabled";
281 }; 293 };
282 294
@@ -286,6 +298,8 @@
286 interrupts = <0 110 0>; 298 interrupts = <0 110 0>;
287 clocks = <&cmu CLK_UART1>, <&cmu CLK_SCLK_UART1>; 299 clocks = <&cmu CLK_UART1>, <&cmu CLK_SCLK_UART1>;
288 clock-names = "uart", "clk_uart_baud0"; 300 clock-names = "uart", "clk_uart_baud0";
301 pinctrl-names = "default";
302 pinctrl-0 = <&uart1_data>;
289 status = "disabled"; 303 status = "disabled";
290 }; 304 };
291 305
@@ -425,6 +439,19 @@
425 status = "disabled"; 439 status = "disabled";
426 }; 440 };
427 441
442 i2s2: i2s@13970000 {
443 compatible = "samsung,s3c6410-i2s";
444 reg = <0x13970000 0x100>;
445 interrupts = <0 126 0>;
446 clocks = <&cmu CLK_I2S>, <&cmu CLK_SCLK_I2S>;
447 clock-names = "iis", "i2s_opclk0";
448 dmas = <&pdma0 14>, <&pdma0 13>;
449 dma-names = "tx", "rx";
450 pinctrl-0 = <&i2s2_bus>;
451 pinctrl-names = "default";
452 status = "disabled";
453 };
454
428 pwm: pwm@139D0000 { 455 pwm: pwm@139D0000 {
429 compatible = "samsung,exynos4210-pwm"; 456 compatible = "samsung,exynos4210-pwm";
430 reg = <0x139D0000 0x1000>; 457 reg = <0x139D0000 0x1000>;
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 17b22e9cc2aa..e0278ecbc816 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -44,6 +44,10 @@
44 fimc1 = &fimc_1; 44 fimc1 = &fimc_1;
45 fimc2 = &fimc_2; 45 fimc2 = &fimc_2;
46 fimc3 = &fimc_3; 46 fimc3 = &fimc_3;
47 serial0 = &serial_0;
48 serial1 = &serial_1;
49 serial2 = &serial_2;
50 serial3 = &serial_3;
47 }; 51 };
48 52
49 clock_audss: clock-controller@03810000 { 53 clock_audss: clock-controller@03810000 {
@@ -123,6 +127,12 @@
123 reg = <0x10440000 0x1000>; 127 reg = <0x10440000 0x1000>;
124 }; 128 };
125 129
130 pmu {
131 compatible = "arm,cortex-a9-pmu";
132 interrupt-parent = <&combiner>;
133 interrupts = <2 2>, <3 2>;
134 };
135
126 sys_reg: syscon@10010000 { 136 sys_reg: syscon@10010000 {
127 compatible = "samsung,exynos4-sysreg", "syscon"; 137 compatible = "samsung,exynos4-sysreg", "syscon";
128 reg = <0x10010000 0x400>; 138 reg = <0x10010000 0x400>;
@@ -322,6 +332,23 @@
322 clocks = <&clock CLK_USB_HOST>; 332 clocks = <&clock CLK_USB_HOST>;
323 clock-names = "usbhost"; 333 clock-names = "usbhost";
324 status = "disabled"; 334 status = "disabled";
335 #address-cells = <1>;
336 #size-cells = <0>;
337 port@0 {
338 reg = <0>;
339 phys = <&exynos_usbphy 1>;
340 status = "disabled";
341 };
342 port@1 {
343 reg = <1>;
344 phys = <&exynos_usbphy 2>;
345 status = "disabled";
346 };
347 port@2 {
348 reg = <2>;
349 phys = <&exynos_usbphy 3>;
350 status = "disabled";
351 };
325 }; 352 };
326 353
327 ohci@12590000 { 354 ohci@12590000 {
@@ -331,6 +358,13 @@
331 clocks = <&clock CLK_USB_HOST>; 358 clocks = <&clock CLK_USB_HOST>;
332 clock-names = "usbhost"; 359 clock-names = "usbhost";
333 status = "disabled"; 360 status = "disabled";
361 #address-cells = <1>;
362 #size-cells = <0>;
363 port@0 {
364 reg = <0>;
365 phys = <&exynos_usbphy 1>;
366 status = "disabled";
367 };
334 }; 368 };
335 369
336 i2s1: i2s@13960000 { 370 i2s1: i2s@13960000 {
@@ -363,7 +397,7 @@
363 status = "disabled"; 397 status = "disabled";
364 }; 398 };
365 399
366 serial@13800000 { 400 serial_0: serial@13800000 {
367 compatible = "samsung,exynos4210-uart"; 401 compatible = "samsung,exynos4210-uart";
368 reg = <0x13800000 0x100>; 402 reg = <0x13800000 0x100>;
369 interrupts = <0 52 0>; 403 interrupts = <0 52 0>;
@@ -372,7 +406,7 @@
372 status = "disabled"; 406 status = "disabled";
373 }; 407 };
374 408
375 serial@13810000 { 409 serial_1: serial@13810000 {
376 compatible = "samsung,exynos4210-uart"; 410 compatible = "samsung,exynos4210-uart";
377 reg = <0x13810000 0x100>; 411 reg = <0x13810000 0x100>;
378 interrupts = <0 53 0>; 412 interrupts = <0 53 0>;
@@ -381,7 +415,7 @@
381 status = "disabled"; 415 status = "disabled";
382 }; 416 };
383 417
384 serial@13820000 { 418 serial_2: serial@13820000 {
385 compatible = "samsung,exynos4210-uart"; 419 compatible = "samsung,exynos4210-uart";
386 reg = <0x13820000 0x100>; 420 reg = <0x13820000 0x100>;
387 interrupts = <0 54 0>; 421 interrupts = <0 54 0>;
@@ -390,7 +424,7 @@
390 status = "disabled"; 424 status = "disabled";
391 }; 425 };
392 426
393 serial@13830000 { 427 serial_3: serial@13830000 {
394 compatible = "samsung,exynos4210-uart"; 428 compatible = "samsung,exynos4210-uart";
395 reg = <0x13830000 0x100>; 429 reg = <0x13830000 0x100>;
396 interrupts = <0 55 0>; 430 interrupts = <0 55 0>;
@@ -608,6 +642,7 @@
608 clocks = <&clock CLK_SCLK_FIMD0>, <&clock CLK_FIMD0>; 642 clocks = <&clock CLK_SCLK_FIMD0>, <&clock CLK_FIMD0>;
609 clock-names = "sclk_fimd", "fimd"; 643 clock-names = "sclk_fimd", "fimd";
610 samsung,power-domain = <&pd_lcd0>; 644 samsung,power-domain = <&pd_lcd0>;
645 samsung,sysreg = <&sys_reg>;
611 status = "disabled"; 646 status = "disabled";
612 }; 647 };
613}; 648};
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 636d16684750..676e6e0c8cf3 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -168,6 +168,7 @@
168 }; 168 };
169 169
170 spi_2: spi@13940000 { 170 spi_2: spi@13940000 {
171 cs-gpios = <&gpc1 2 0>;
171 status = "okay"; 172 status = "okay";
172 173
173 w25x80@0 { 174 w25x80@0 {
@@ -178,7 +179,6 @@
178 spi-max-frequency = <1000000>; 179 spi-max-frequency = <1000000>;
179 180
180 controller-data { 181 controller-data {
181 cs-gpio = <&gpc1 2 0>;
182 samsung,spi-feedback-delay = <0>; 182 samsung,spi-feedback-delay = <0>;
183 }; 183 };
184 184
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 97ea7a9b1f62..807bb5bf91fc 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -103,12 +103,6 @@
103 #clock-cells = <1>; 103 #clock-cells = <1>;
104 }; 104 };
105 105
106 pmu {
107 compatible = "arm,cortex-a9-pmu";
108 interrupt-parent = <&combiner>;
109 interrupts = <2 2>, <3 2>;
110 };
111
112 pinctrl_0: pinctrl@11400000 { 106 pinctrl_0: pinctrl@11400000 {
113 compatible = "samsung,exynos4210-pinctrl"; 107 compatible = "samsung,exynos4210-pinctrl";
114 reg = <0x11400000 0x1000>; 108 reg = <0x11400000 0x1000>;
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
new file mode 100644
index 000000000000..6d6d23c83d30
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -0,0 +1,371 @@
1/*
2 * Common definition for Hardkernel's Exynos4412 based ODROID-X/X2/U2/U3 boards
3 * device tree source
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
10#include <dt-bindings/input/input.h>
11#include "exynos4412.dtsi"
12
13/ {
14 firmware@0204F000 {
15 compatible = "samsung,secure-firmware";
16 reg = <0x0204F000 0x1000>;
17 };
18
19 gpio_keys {
20 compatible = "gpio-keys";
21 pinctrl-names = "default";
22 pinctrl-0 = <&gpio_power_key>;
23
24 power_key {
25 interrupt-parent = <&gpx1>;
26 interrupts = <3 0>;
27 gpios = <&gpx1 3 1>;
28 linux,code = <KEY_POWER>;
29 label = "power key";
30 debounce-interval = <10>;
31 gpio-key,wakeup;
32 };
33 };
34
35 i2s0: i2s@03830000 {
36 pinctrl-0 = <&i2s0_bus>;
37 pinctrl-names = "default";
38 status = "okay";
39 clocks = <&clock_audss EXYNOS_I2S_BUS>,
40 <&clock_audss EXYNOS_DOUT_AUD_BUS>;
41 clock-names = "iis", "i2s_opclk0";
42 };
43
44 sound: sound {
45 compatible = "samsung,odroidx2-audio";
46 samsung,i2s-controller = <&i2s0>;
47 samsung,audio-codec = <&max98090>;
48 };
49
50 mmc@12550000 {
51 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
52 pinctrl-names = "default";
53 vmmc-supply = <&ldo20_reg &buck8_reg>;
54 status = "okay";
55
56 num-slots = <1>;
57 supports-highspeed;
58 broken-cd;
59 card-detect-delay = <200>;
60 samsung,dw-mshc-ciu-div = <3>;
61 samsung,dw-mshc-sdr-timing = <2 3>;
62 samsung,dw-mshc-ddr-timing = <1 2>;
63
64 slot@0 {
65 reg = <0>;
66 bus-width = <8>;
67 };
68 };
69
70 watchdog@10060000 {
71 status = "okay";
72 };
73
74 rtc@10070000 {
75 status = "okay";
76 };
77
78 g2d@10800000 {
79 status = "okay";
80 };
81
82 camera {
83 status = "okay";
84 pinctrl-names = "default";
85 pinctrl-0 = <>;
86
87 fimc_0: fimc@11800000 {
88 status = "okay";
89 };
90
91 fimc_1: fimc@11810000 {
92 status = "okay";
93 };
94
95 fimc_2: fimc@11820000 {
96 status = "okay";
97 };
98
99 fimc_3: fimc@11830000 {
100 status = "okay";
101 };
102 };
103
104 sdhci@12530000 {
105 bus-width = <4>;
106 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
107 pinctrl-names = "default";
108 vmmc-supply = <&ldo4_reg &ldo21_reg>;
109 cd-gpios = <&gpk2 2 0>;
110 cd-inverted;
111 status = "okay";
112 };
113
114 serial@13800000 {
115 status = "okay";
116 };
117
118 serial@13810000 {
119 status = "okay";
120 };
121
122 fixed-rate-clocks {
123 xxti {
124 compatible = "samsung,clock-xxti";
125 clock-frequency = <0>;
126 };
127
128 xusbxti {
129 compatible = "samsung,clock-xusbxti";
130 clock-frequency = <24000000>;
131 };
132 };
133
134 i2c@13860000 {
135 pinctrl-0 = <&i2c0_bus>;
136 pinctrl-names = "default";
137 status = "okay";
138
139 usb3503: usb3503@08 {
140 compatible = "smsc,usb3503";
141 reg = <0x08>;
142
143 intn-gpios = <&gpx3 0 0>;
144 connect-gpios = <&gpx3 4 0>;
145 reset-gpios = <&gpx3 5 0>;
146 initial-mode = <1>;
147 };
148
149 max77686: pmic@09 {
150 compatible = "maxim,max77686";
151 reg = <0x09>;
152 #clock-cells = <1>;
153
154 voltage-regulators {
155 ldo1_reg: LDO1 {
156 regulator-name = "VDD_ALIVE_1.0V";
157 regulator-min-microvolt = <1000000>;
158 regulator-max-microvolt = <1000000>;
159 regulator-always-on;
160 };
161
162 ldo2_reg: LDO2 {
163 regulator-name = "VDDQ_M1_2_1.8V";
164 regulator-min-microvolt = <1800000>;
165 regulator-max-microvolt = <1800000>;
166 regulator-always-on;
167 };
168
169 ldo3_reg: LDO3 {
170 regulator-name = "VDDQ_EXT_1.8V";
171 regulator-min-microvolt = <1800000>;
172 regulator-max-microvolt = <1800000>;
173 regulator-always-on;
174 };
175
176 ldo4_reg: LDO4 {
177 regulator-name = "VDDQ_MMC2_2.8V";
178 regulator-min-microvolt = <2800000>;
179 regulator-max-microvolt = <2800000>;
180 regulator-always-on;
181 regulator-boot-on;
182 };
183
184 ldo5_reg: LDO5 {
185 regulator-name = "VDDQ_MMC1_3_1.8V";
186 regulator-min-microvolt = <1800000>;
187 regulator-max-microvolt = <1800000>;
188 regulator-always-on;
189 regulator-boot-on;
190 };
191
192 ldo6_reg: LDO6 {
193 regulator-name = "VDD10_MPLL_1.0V";
194 regulator-min-microvolt = <1000000>;
195 regulator-max-microvolt = <1000000>;
196 regulator-always-on;
197 };
198
199 ldo7_reg: LDO7 {
200 regulator-name = "VDD10_XPLL_1.0V";
201 regulator-min-microvolt = <1000000>;
202 regulator-max-microvolt = <1000000>;
203 regulator-always-on;
204 };
205
206 ldo11_reg: LDO11 {
207 regulator-name = "VDD18_ABB1_1.8V";
208 regulator-min-microvolt = <1800000>;
209 regulator-max-microvolt = <1800000>;
210 regulator-always-on;
211 };
212
213 ldo12_reg: LDO12 {
214 regulator-name = "VDD33_USB_3.3V";
215 regulator-min-microvolt = <3300000>;
216 regulator-max-microvolt = <3300000>;
217 regulator-always-on;
218 regulator-boot-on;
219 };
220
221 ldo13_reg: LDO13 {
222 regulator-name = "VDDQ_C2C_W_1.8V";
223 regulator-min-microvolt = <1800000>;
224 regulator-max-microvolt = <1800000>;
225 regulator-always-on;
226 regulator-boot-on;
227 };
228
229 ldo14_reg: LDO14 {
230 regulator-name = "VDD18_ABB0_2_1.8V";
231 regulator-min-microvolt = <1800000>;
232 regulator-max-microvolt = <1800000>;
233 regulator-always-on;
234 regulator-boot-on;
235 };
236
237 ldo15_reg: LDO15 {
238 regulator-name = "VDD10_HSIC_1.0V";
239 regulator-min-microvolt = <1000000>;
240 regulator-max-microvolt = <1000000>;
241 regulator-always-on;
242 regulator-boot-on;
243 };
244
245 ldo16_reg: LDO16 {
246 regulator-name = "VDD18_HSIC_1.8V";
247 regulator-min-microvolt = <1800000>;
248 regulator-max-microvolt = <1800000>;
249 regulator-always-on;
250 regulator-boot-on;
251 };
252
253 ldo20_reg: LDO20 {
254 regulator-name = "LDO20_1.8V";
255 regulator-min-microvolt = <1800000>;
256 regulator-max-microvolt = <1800000>;
257 regulator-boot-on;
258 };
259
260 ldo21_reg: LDO21 {
261 regulator-name = "LDO21_3.3V";
262 regulator-min-microvolt = <3300000>;
263 regulator-max-microvolt = <3300000>;
264 regulator-always-on;
265 regulator-boot-on;
266 };
267
268 ldo25_reg: LDO25 {
269 regulator-name = "VDDQ_LCD_1.8V";
270 regulator-min-microvolt = <1800000>;
271 regulator-max-microvolt = <1800000>;
272 regulator-always-on;
273 regulator-boot-on;
274 };
275
276 buck1_reg: BUCK1 {
277 regulator-name = "vdd_mif";
278 regulator-min-microvolt = <1000000>;
279 regulator-max-microvolt = <1000000>;
280 regulator-always-on;
281 regulator-boot-on;
282 };
283
284 buck2_reg: BUCK2 {
285 regulator-name = "vdd_arm";
286 regulator-min-microvolt = <900000>;
287 regulator-max-microvolt = <1350000>;
288 regulator-always-on;
289 regulator-boot-on;
290 };
291
292 buck3_reg: BUCK3 {
293 regulator-name = "vdd_int";
294 regulator-min-microvolt = <1000000>;
295 regulator-max-microvolt = <1000000>;
296 regulator-always-on;
297 regulator-boot-on;
298 };
299
300 buck4_reg: BUCK4 {
301 regulator-name = "vdd_g3d";
302 regulator-min-microvolt = <900000>;
303 regulator-max-microvolt = <1100000>;
304 regulator-microvolt-offset = <50000>;
305 };
306
307 buck5_reg: BUCK5 {
308 regulator-name = "VDDQ_CKEM1_2_1.2V";
309 regulator-min-microvolt = <1200000>;
310 regulator-max-microvolt = <1200000>;
311 regulator-always-on;
312 regulator-boot-on;
313 };
314
315 buck6_reg: BUCK6 {
316 regulator-name = "BUCK6_1.35V";
317 regulator-min-microvolt = <1350000>;
318 regulator-max-microvolt = <1350000>;
319 regulator-always-on;
320 regulator-boot-on;
321 };
322
323 buck7_reg: BUCK7 {
324 regulator-name = "BUCK7_2.0V";
325 regulator-min-microvolt = <2000000>;
326 regulator-max-microvolt = <2000000>;
327 regulator-always-on;
328 };
329
330 buck8_reg: BUCK8 {
331 regulator-name = "BUCK8_2.8V";
332 regulator-min-microvolt = <2800000>;
333 regulator-max-microvolt = <2800000>;
334 };
335 };
336 };
337 };
338
339 i2c@13870000 {
340 pinctrl-names = "default";
341 pinctrl-0 = <&i2c1_bus>;
342 status = "okay";
343 max98090: max98090@10 {
344 compatible = "maxim,max98090";
345 reg = <0x10>;
346 interrupt-parent = <&gpx0>;
347 interrupts = <0 0>;
348 };
349 };
350
351 exynos-usbphy@125B0000 {
352 status = "okay";
353 };
354
355 hsotg@12480000 {
356 status = "okay";
357 vusb_d-supply = <&ldo15_reg>;
358 vusb_a-supply = <&ldo12_reg>;
359 };
360
361 ehci: ehci@12580000 {
362 status = "okay";
363 };
364};
365
366&pinctrl_1 {
367 gpio_power_key: power_key {
368 samsung,pins = "gpx1-3";
369 samsung,pin-pud = <0>;
370 };
371};
diff --git a/arch/arm/boot/dts/exynos4412-odroidu3.dts b/arch/arm/boot/dts/exynos4412-odroidu3.dts
new file mode 100644
index 000000000000..c8a64be55d07
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-odroidu3.dts
@@ -0,0 +1,61 @@
1/*
2 * Hardkernel's Exynos4412 based ODROID-U3 board device tree source
3 *
4 * Copyright (c) 2014 Marek Szyprowski <m.szyprowski@samsung.com>
5 *
6 * Device tree source file for Hardkernel's ODROID-U3 board which is based
7 * on Samsung's Exynos4412 SoC.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/dts-v1/;
15#include "exynos4412-odroid-common.dtsi"
16
17/ {
18 model = "Hardkernel ODROID-U3 board based on Exynos4412";
19 compatible = "hardkernel,odroid-u3", "samsung,exynos4412", "samsung,exynos4";
20
21 memory {
22 reg = <0x40000000 0x7FF00000>;
23 };
24
25 leds {
26 compatible = "gpio-leds";
27 led1 {
28 label = "led1:heart";
29 gpios = <&gpc1 0 1>;
30 default-state = "on";
31 linux,default-trigger = "heartbeat";
32 };
33 };
34};
35
36&usb3503 {
37 clock-names = "refclk";
38 clocks = <&pmu_system_controller 0>;
39 refclk-frequency = <24000000>;
40};
41
42&ehci {
43 port@1 {
44 status = "okay";
45 };
46 port@2 {
47 status = "okay";
48 };
49};
50
51&sound {
52 compatible = "samsung,odroidu3-audio";
53 samsung,model = "Odroid-U3";
54 samsung,audio-routing =
55 "Headphone Jack", "HPL",
56 "Headphone Jack", "HPR",
57 "Headphone Jack", "MICBIAS",
58 "IN1", "Headphone Jack",
59 "Speakers", "SPKL",
60 "Speakers", "SPKR";
61};
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 31db28a4bb33..cb1cfe7239c4 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -3,8 +3,8 @@
3 * 3 *
4 * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com> 4 * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com>
5 * 5 *
6 * Device tree source file for Hardkernel's ODROID-X board which is based on 6 * Device tree source file for Hardkernel's ODROID-X board which is based
7 * Samsung's Exynos4412 SoC. 7 * on Samsung's Exynos4412 SoC.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -12,14 +12,14 @@
12*/ 12*/
13 13
14/dts-v1/; 14/dts-v1/;
15#include "exynos4412.dtsi" 15#include "exynos4412-odroid-common.dtsi"
16 16
17/ { 17/ {
18 model = "Hardkernel ODROID-X board based on Exynos4412"; 18 model = "Hardkernel ODROID-X board based on Exynos4412";
19 compatible = "hardkernel,odroid-x", "samsung,exynos4412", "samsung,exynos4"; 19 compatible = "hardkernel,odroid-x", "samsung,exynos4412", "samsung,exynos4";
20 20
21 memory { 21 memory {
22 reg = <0x40000000 0x40000000>; 22 reg = <0x40000000 0x3FF00000>;
23 }; 23 };
24 24
25 leds { 25 leds {
@@ -38,23 +38,25 @@
38 }; 38 };
39 }; 39 };
40 40
41 mmc@12550000 { 41 serial@13820000 {
42 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
43 pinctrl-names = "default";
44 vmmc-supply = <&ldo20_reg &buck8_reg>;
45 status = "okay"; 42 status = "okay";
43 };
46 44
47 num-slots = <1>; 45 serial@13830000 {
48 supports-highspeed; 46 status = "okay";
49 broken-cd; 47 };
50 card-detect-delay = <200>;
51 samsung,dw-mshc-ciu-div = <3>;
52 samsung,dw-mshc-sdr-timing = <2 3>;
53 samsung,dw-mshc-ddr-timing = <1 2>;
54 48
55 slot@0 { 49 gpio_keys {
56 reg = <0>; 50 pinctrl-0 = <&gpio_power_key &gpio_home_key>;
57 bus-width = <8>; 51
52 home_key {
53 interrupt-parent = <&gpx2>;
54 interrupts = <2 0>;
55 gpios = <&gpx2 2 0>;
56 linux,code = <KEY_HOME>;
57 label = "home key";
58 debounce-interval = <10>;
59 gpio-key,wakeup;
58 }; 60 };
59 }; 61 };
60 62
@@ -65,242 +67,19 @@
65 regulator-max-microvolt = <3300000>; 67 regulator-max-microvolt = <3300000>;
66 gpio = <&gpa1 1 1>; 68 gpio = <&gpa1 1 1>;
67 enable-active-high; 69 enable-active-high;
68 regulator-boot-on; 70 regulator-always-on;
69 };
70
71 rtc@10070000 {
72 status = "okay";
73 };
74
75 sdhci@12530000 {
76 bus-width = <4>;
77 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
78 pinctrl-names = "default";
79 vmmc-supply = <&ldo4_reg &ldo21_reg>;
80 status = "okay";
81 };
82
83 serial@13800000 {
84 status = "okay";
85 };
86
87 serial@13810000 {
88 status = "okay";
89 };
90
91 serial@13820000 {
92 status = "okay";
93 }; 71 };
72};
94 73
95 serial@13830000 { 74&ehci {
75 port@1 {
96 status = "okay"; 76 status = "okay";
97 }; 77 };
78};
98 79
99 fixed-rate-clocks { 80&pinctrl_1 {
100 xxti { 81 gpio_home_key: home_key {
101 compatible = "samsung,clock-xxti"; 82 samsung,pins = "gpx2-2";
102 clock-frequency = <0>; 83 samsung,pin-pud = <0>;
103 };
104
105 xusbxti {
106 compatible = "samsung,clock-xusbxti";
107 clock-frequency = <24000000>;
108 };
109 };
110
111 i2c@13860000 {
112 pinctrl-0 = <&i2c0_bus>;
113 pinctrl-names = "default";
114 status = "okay";
115
116 max77686: pmic@09 {
117 compatible = "maxim,max77686";
118 reg = <0x09>;
119 #clock-cells = <1>;
120
121 voltage-regulators {
122 ldo1_reg: LDO1 {
123 regulator-name = "VDD_ALIVE_1.0V";
124 regulator-min-microvolt = <1000000>;
125 regulator-max-microvolt = <1000000>;
126 regulator-always-on;
127 };
128
129 ldo2_reg: LDO2 {
130 regulator-name = "VDDQ_M1_2_1.8V";
131 regulator-min-microvolt = <1800000>;
132 regulator-max-microvolt = <1800000>;
133 regulator-always-on;
134 };
135
136 ldo3_reg: LDO3 {
137 regulator-name = "VDDQ_EXT_1.8V";
138 regulator-min-microvolt = <1800000>;
139 regulator-max-microvolt = <1800000>;
140 regulator-always-on;
141 };
142
143 ldo4_reg: LDO4 {
144 regulator-name = "VDDQ_MMC2_2.8V";
145 regulator-min-microvolt = <2800000>;
146 regulator-max-microvolt = <2800000>;
147 regulator-always-on;
148 regulator-boot-on;
149 };
150
151 ldo5_reg: LDO5 {
152 regulator-name = "VDDQ_MMC1_3_1.8V";
153 regulator-min-microvolt = <1800000>;
154 regulator-max-microvolt = <1800000>;
155 regulator-always-on;
156 regulator-boot-on;
157 };
158
159 ldo6_reg: LDO6 {
160 regulator-name = "VDD10_MPLL_1.0V";
161 regulator-min-microvolt = <1000000>;
162 regulator-max-microvolt = <1000000>;
163 regulator-always-on;
164 };
165
166 ldo7_reg: LDO7 {
167 regulator-name = "VDD10_XPLL_1.0V";
168 regulator-min-microvolt = <1000000>;
169 regulator-max-microvolt = <1000000>;
170 regulator-always-on;
171 };
172
173 ldo11_reg: LDO11 {
174 regulator-name = "VDD18_ABB1_1.8V";
175 regulator-min-microvolt = <1800000>;
176 regulator-max-microvolt = <1800000>;
177 regulator-always-on;
178 };
179
180 ldo12_reg: LDO12 {
181 regulator-name = "VDD33_USB_3.3V";
182 regulator-min-microvolt = <3300000>;
183 regulator-max-microvolt = <3300000>;
184 regulator-always-on;
185 regulator-boot-on;
186 };
187
188 ldo13_reg: LDO13 {
189 regulator-name = "VDDQ_C2C_W_1.8V";
190 regulator-min-microvolt = <1800000>;
191 regulator-max-microvolt = <1800000>;
192 regulator-always-on;
193 regulator-boot-on;
194 };
195
196 ldo14_reg: LDO14 {
197 regulator-name = "VDD18_ABB0_2_1.8V";
198 regulator-min-microvolt = <1800000>;
199 regulator-max-microvolt = <1800000>;
200 regulator-always-on;
201 regulator-boot-on;
202 };
203
204 ldo15_reg: LDO15 {
205 regulator-name = "VDD10_HSIC_1.0V";
206 regulator-min-microvolt = <1000000>;
207 regulator-max-microvolt = <1000000>;
208 regulator-always-on;
209 regulator-boot-on;
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 };
219
220 ldo20_reg: LDO20 {
221 regulator-name = "LDO20_1.8V";
222 regulator-min-microvolt = <1800000>;
223 regulator-max-microvolt = <1800000>;
224 regulator-boot-on;
225 };
226
227 ldo21_reg: LDO21 {
228 regulator-name = "LDO21_3.3V";
229 regulator-min-microvolt = <3300000>;
230 regulator-max-microvolt = <3300000>;
231 regulator-always-on;
232 regulator-boot-on;
233 };
234
235 ldo25_reg: LDO25 {
236 regulator-name = "VDDQ_LCD_1.8V";
237 regulator-min-microvolt = <1800000>;
238 regulator-max-microvolt = <1800000>;
239 regulator-always-on;
240 regulator-boot-on;
241 };
242
243 buck1_reg: BUCK1 {
244 regulator-name = "vdd_mif";
245 regulator-min-microvolt = <1000000>;
246 regulator-max-microvolt = <1000000>;
247 regulator-always-on;
248 regulator-boot-on;
249 };
250
251 buck2_reg: BUCK2 {
252 regulator-name = "vdd_arm";
253 regulator-min-microvolt = <900000>;
254 regulator-max-microvolt = <1350000>;
255 regulator-always-on;
256 regulator-boot-on;
257 };
258
259 buck3_reg: BUCK3 {
260 regulator-name = "vdd_int";
261 regulator-min-microvolt = <1000000>;
262 regulator-max-microvolt = <1000000>;
263 regulator-always-on;
264 regulator-boot-on;
265 };
266
267 buck4_reg: BUCK4 {
268 regulator-name = "vdd_g3d";
269 regulator-min-microvolt = <900000>;
270 regulator-max-microvolt = <1100000>;
271 regulator-microvolt-offset = <50000>;
272 };
273
274 buck5_reg: BUCK5 {
275 regulator-name = "VDDQ_CKEM1_2_1.2V";
276 regulator-min-microvolt = <1200000>;
277 regulator-max-microvolt = <1200000>;
278 regulator-always-on;
279 regulator-boot-on;
280 };
281
282 buck6_reg: BUCK6 {
283 regulator-name = "BUCK6_1.35V";
284 regulator-min-microvolt = <1350000>;
285 regulator-max-microvolt = <1350000>;
286 regulator-always-on;
287 regulator-boot-on;
288 };
289
290 buck7_reg: BUCK7 {
291 regulator-name = "BUCK7_2.0V";
292 regulator-min-microvolt = <2000000>;
293 regulator-max-microvolt = <2000000>;
294 regulator-always-on;
295 };
296
297 buck8_reg: BUCK8 {
298 regulator-name = "BUCK8_2.8V";
299 regulator-min-microvolt = <2800000>;
300 regulator-max-microvolt = <2800000>;
301 regulator-always-on;
302 };
303 };
304 };
305 }; 84 };
306}; 85};
diff --git a/arch/arm/boot/dts/exynos4412-odroidx2.dts b/arch/arm/boot/dts/exynos4412-odroidx2.dts
new file mode 100644
index 000000000000..96b43f4497cc
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-odroidx2.dts
@@ -0,0 +1,32 @@
1/*
2 * Hardkernel's Exynos4412 based ODROID-X2 board device tree source
3 *
4 * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com>
5 *
6 * Device tree source file for Hardkernel's ODROID-X2 board which is based
7 * on Samsung's Exynos4412 SoC.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include "exynos4412-odroidx.dts"
15
16/ {
17 model = "Hardkernel ODROID-X2 board based on Exynos4412";
18 compatible = "hardkernel,odroid-x2", "samsung,exynos4412", "samsung,exynos4";
19
20 memory {
21 reg = <0x40000000 0x7FF00000>;
22 };
23};
24
25&sound {
26 samsung,model = "Odroid-X2";
27 samsung,audio-routing =
28 "Headphone Jack", "HPL",
29 "Headphone Jack", "HPR",
30 "IN1", "Mic Jack",
31 "Mic Jack", "MICBIAS";
32};
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 77878447b312..11967f4561e0 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -589,6 +589,7 @@
589 spi_1: spi@13930000 { 589 spi_1: spi@13930000 {
590 pinctrl-names = "default"; 590 pinctrl-names = "default";
591 pinctrl-0 = <&spi1_bus>; 591 pinctrl-0 = <&spi1_bus>;
592 cs-gpios = <&gpb 5 0>;
592 status = "okay"; 593 status = "okay";
593 594
594 s5c73m3_spi: s5c73m3 { 595 s5c73m3_spi: s5c73m3 {
@@ -596,7 +597,6 @@
596 spi-max-frequency = <50000000>; 597 spi-max-frequency = <50000000>;
597 reg = <0>; 598 reg = <0>;
598 controller-data { 599 controller-data {
599 cs-gpio = <&gpb 5 0>;
600 samsung,spi-feedback-delay = <2>; 600 samsung,spi-feedback-delay = <2>;
601 }; 601 };
602 }; 602 };
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index c42a3e196cd5..d8bc059e172f 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -26,6 +26,10 @@
26 samsung,combiner-nr = <20>; 26 samsung,combiner-nr = <20>;
27 }; 27 };
28 28
29 pmu {
30 interrupts = <2 2>, <3 2>, <18 2>, <19 2>;
31 };
32
29 gic: interrupt-controller@10490000 { 33 gic: interrupt-controller@10490000 {
30 cpu-offset = <0x4000>; 34 cpu-offset = <0x4000>;
31 }; 35 };
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index de1f9c77b589..861bb919f6d3 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -31,12 +31,6 @@
31 mshc0 = &mshc_0; 31 mshc0 = &mshc_0;
32 }; 32 };
33 33
34 pmu {
35 compatible = "arm,cortex-a9-pmu";
36 interrupt-parent = <&combiner>;
37 interrupts = <2 2>, <3 2>, <18 2>, <19 2>;
38 };
39
40 sysram@02020000 { 34 sysram@02020000 {
41 compatible = "mmio-sram"; 35 compatible = "mmio-sram";
42 reg = <0x02020000 0x40000>; 36 reg = <0x02020000 0x40000>;
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 79d0608d6dcc..a0cc0b6f8f96 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -18,6 +18,13 @@
18/ { 18/ {
19 interrupt-parent = <&gic>; 19 interrupt-parent = <&gic>;
20 20
21 aliases {
22 serial0 = &serial_0;
23 serial1 = &serial_1;
24 serial2 = &serial_2;
25 serial3 = &serial_3;
26 };
27
21 chipid@10000000 { 28 chipid@10000000 {
22 compatible = "samsung,exynos4210-chipid"; 29 compatible = "samsung,exynos4210-chipid";
23 reg = <0x10000000 0x100>; 30 reg = <0x10000000 0x100>;
@@ -50,25 +57,25 @@
50 interrupts = <1 9 0xf04>; 57 interrupts = <1 9 0xf04>;
51 }; 58 };
52 59
53 serial@12C00000 { 60 serial_0: serial@12C00000 {
54 compatible = "samsung,exynos4210-uart"; 61 compatible = "samsung,exynos4210-uart";
55 reg = <0x12C00000 0x100>; 62 reg = <0x12C00000 0x100>;
56 interrupts = <0 51 0>; 63 interrupts = <0 51 0>;
57 }; 64 };
58 65
59 serial@12C10000 { 66 serial_1: serial@12C10000 {
60 compatible = "samsung,exynos4210-uart"; 67 compatible = "samsung,exynos4210-uart";
61 reg = <0x12C10000 0x100>; 68 reg = <0x12C10000 0x100>;
62 interrupts = <0 52 0>; 69 interrupts = <0 52 0>;
63 }; 70 };
64 71
65 serial@12C20000 { 72 serial_2: serial@12C20000 {
66 compatible = "samsung,exynos4210-uart"; 73 compatible = "samsung,exynos4210-uart";
67 reg = <0x12C20000 0x100>; 74 reg = <0x12C20000 0x100>;
68 interrupts = <0 53 0>; 75 interrupts = <0 53 0>;
69 }; 76 };
70 77
71 serial@12C30000 { 78 serial_3: serial@12C30000 {
72 compatible = "samsung,exynos4210-uart"; 79 compatible = "samsung,exynos4210-uart";
73 reg = <0x12C30000 0x100>; 80 reg = <0x12C30000 0x100>;
74 interrupts = <0 54 0>; 81 interrupts = <0 54 0>;
@@ -87,6 +94,7 @@
87 reg = <0x14400000 0x40000>; 94 reg = <0x14400000 0x40000>;
88 interrupt-names = "fifo", "vsync", "lcd_sys"; 95 interrupt-names = "fifo", "vsync", "lcd_sys";
89 interrupts = <18 4>, <18 5>, <18 6>; 96 interrupts = <18 4>, <18 5>, <18 6>;
97 samsung,sysreg = <&sysreg_system_controller>;
90 status = "disabled"; 98 status = "disabled";
91 }; 99 };
92 100
diff --git a/arch/arm/boot/dts/exynos5250-cros-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
index 89ac90f59e2e..e603e9c70142 100644
--- a/arch/arm/boot/dts/exynos5250-cros-common.dtsi
+++ b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
@@ -27,177 +27,18 @@
27 i2c2_bus: i2c2-bus { 27 i2c2_bus: i2c2-bus {
28 samsung,pin-pud = <0>; 28 samsung,pin-pud = <0>;
29 }; 29 };
30
31 max77686_irq: max77686-irq {
32 samsung,pins = "gpx3-2";
33 samsung,pin-function = <0>;
34 samsung,pin-pud = <0>;
35 samsung,pin-drv = <0>;
36 };
37 }; 30 };
38 31
39 i2c@12C60000 { 32 i2c@12C60000 {
40 status = "okay"; 33 status = "okay";
41 samsung,i2c-sda-delay = <100>; 34 samsung,i2c-sda-delay = <100>;
42 samsung,i2c-max-bus-freq = <378000>; 35 samsung,i2c-max-bus-freq = <378000>;
43
44 max77686@09 {
45 compatible = "maxim,max77686";
46 interrupt-parent = <&gpx3>;
47 interrupts = <2 0>;
48 pinctrl-names = "default";
49 pinctrl-0 = <&max77686_irq>;
50 wakeup-source;
51 reg = <0x09>;
52 #clock-cells = <1>;
53
54 voltage-regulators {
55 ldo1_reg: LDO1 {
56 regulator-name = "P1.0V_LDO_OUT1";
57 regulator-min-microvolt = <1000000>;
58 regulator-max-microvolt = <1000000>;
59 regulator-always-on;
60 };
61
62 ldo2_reg: LDO2 {
63 regulator-name = "P1.8V_LDO_OUT2";
64 regulator-min-microvolt = <1800000>;
65 regulator-max-microvolt = <1800000>;
66 regulator-always-on;
67 };
68
69 ldo3_reg: LDO3 {
70 regulator-name = "P1.8V_LDO_OUT3";
71 regulator-min-microvolt = <1800000>;
72 regulator-max-microvolt = <1800000>;
73 regulator-always-on;
74 };
75
76 ldo7_reg: LDO7 {
77 regulator-name = "P1.1V_LDO_OUT7";
78 regulator-min-microvolt = <1100000>;
79 regulator-max-microvolt = <1100000>;
80 regulator-always-on;
81 };
82
83 ldo8_reg: LDO8 {
84 regulator-name = "P1.0V_LDO_OUT8";
85 regulator-min-microvolt = <1000000>;
86 regulator-max-microvolt = <1000000>;
87 regulator-always-on;
88 };
89
90 ldo10_reg: LDO10 {
91 regulator-name = "P1.8V_LDO_OUT10";
92 regulator-min-microvolt = <1800000>;
93 regulator-max-microvolt = <1800000>;
94 regulator-always-on;
95 };
96
97 ldo12_reg: LDO12 {
98 regulator-name = "P3.0V_LDO_OUT12";
99 regulator-min-microvolt = <3000000>;
100 regulator-max-microvolt = <3000000>;
101 regulator-always-on;
102 };
103
104 ldo14_reg: LDO14 {
105 regulator-name = "P1.8V_LDO_OUT14";
106 regulator-min-microvolt = <1800000>;
107 regulator-max-microvolt = <1800000>;
108 regulator-always-on;
109 };
110
111 ldo15_reg: LDO15 {
112 regulator-name = "P1.0V_LDO_OUT15";
113 regulator-min-microvolt = <1000000>;
114 regulator-max-microvolt = <1000000>;
115 regulator-always-on;
116 };
117
118 ldo16_reg: LDO16 {
119 regulator-name = "P1.8V_LDO_OUT16";
120 regulator-min-microvolt = <1800000>;
121 regulator-max-microvolt = <1800000>;
122 regulator-always-on;
123 };
124
125 buck1_reg: BUCK1 {
126 regulator-name = "vdd_mif";
127 regulator-min-microvolt = <950000>;
128 regulator-max-microvolt = <1300000>;
129 regulator-always-on;
130 regulator-boot-on;
131 };
132
133 buck2_reg: BUCK2 {
134 regulator-name = "vdd_arm";
135 regulator-min-microvolt = <850000>;
136 regulator-max-microvolt = <1350000>;
137 regulator-always-on;
138 regulator-boot-on;
139 };
140
141 buck3_reg: BUCK3 {
142 regulator-name = "vdd_int";
143 regulator-min-microvolt = <900000>;
144 regulator-max-microvolt = <1200000>;
145 regulator-always-on;
146 regulator-boot-on;
147 };
148
149 buck4_reg: BUCK4 {
150 regulator-name = "vdd_g3d";
151 regulator-min-microvolt = <850000>;
152 regulator-max-microvolt = <1300000>;
153 regulator-always-on;
154 regulator-boot-on;
155 };
156
157 buck5_reg: BUCK5 {
158 regulator-name = "P1.8V_BUCK_OUT5";
159 regulator-min-microvolt = <1800000>;
160 regulator-max-microvolt = <1800000>;
161 regulator-always-on;
162 regulator-boot-on;
163 };
164
165 buck6_reg: BUCK6 {
166 regulator-name = "P1.35V_BUCK_OUT6";
167 regulator-min-microvolt = <1350000>;
168 regulator-max-microvolt = <1350000>;
169 regulator-always-on;
170 };
171
172 buck7_reg: BUCK7 {
173 regulator-name = "P2.0V_BUCK_OUT7";
174 regulator-min-microvolt = <2000000>;
175 regulator-max-microvolt = <2000000>;
176 regulator-always-on;
177 };
178
179 buck8_reg: BUCK8 {
180 regulator-name = "P2.85V_BUCK_OUT8";
181 regulator-min-microvolt = <2850000>;
182 regulator-max-microvolt = <2850000>;
183 regulator-always-on;
184 };
185 };
186 };
187 }; 36 };
188 37
189 i2c@12C70000 { 38 i2c@12C70000 {
190 status = "okay"; 39 status = "okay";
191 samsung,i2c-sda-delay = <100>; 40 samsung,i2c-sda-delay = <100>;
192 samsung,i2c-max-bus-freq = <378000>; 41 samsung,i2c-max-bus-freq = <378000>;
193
194 trackpad {
195 reg = <0x67>;
196 compatible = "cypress,cyapa";
197 interrupts = <2 0>;
198 interrupt-parent = <&gpx1>;
199 wakeup-source;
200 };
201 }; 42 };
202 43
203 i2c@12C80000 { 44 i2c@12C80000 {
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a794a705d404..b4b35adae565 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -44,6 +44,8 @@
44 max77686@09 { 44 max77686@09 {
45 compatible = "maxim,max77686"; 45 compatible = "maxim,max77686";
46 reg = <0x09>; 46 reg = <0x09>;
47 interrupt-parent = <&gpx3>;
48 interrupts = <2 0>;
47 49
48 voltage-regulators { 50 voltage-regulators {
49 ldo1_reg: LDO1 { 51 ldo1_reg: LDO1 {
@@ -316,6 +318,7 @@
316 }; 318 };
317 319
318 spi_1: spi@12d30000 { 320 spi_1: spi@12d30000 {
321 cs-gpios = <&gpa2 5 0>;
319 status = "okay"; 322 status = "okay";
320 323
321 w25q80bw@0 { 324 w25q80bw@0 {
@@ -326,7 +329,6 @@
326 spi-max-frequency = <1000000>; 329 spi-max-frequency = <1000000>;
327 330
328 controller-data { 331 controller-data {
329 cs-gpio = <&gpa2 5 0>;
330 samsung,spi-feedback-delay = <0>; 332 samsung,spi-feedback-delay = <0>;
331 }; 333 };
332 334
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index 079fdf9e3f18..f2b8c4116541 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -137,7 +137,7 @@
137 sbs,poll-retry-count = <1>; 137 sbs,poll-retry-count = <1>;
138 }; 138 };
139 139
140 ec: embedded-controller { 140 cros_ec: embedded-controller {
141 compatible = "google,cros-ec-i2c"; 141 compatible = "google,cros-ec-i2c";
142 reg = <0x1e>; 142 reg = <0x1e>;
143 interrupts = <6 0>; 143 interrupts = <6 0>;
@@ -145,95 +145,6 @@
145 pinctrl-names = "default"; 145 pinctrl-names = "default";
146 pinctrl-0 = <&ec_irq>; 146 pinctrl-0 = <&ec_irq>;
147 wakeup-source; 147 wakeup-source;
148
149 keyboard-controller {
150 compatible = "google,cros-ec-keyb";
151 keypad,num-rows = <8>;
152 keypad,num-columns = <13>;
153 google,needs-ghost-filter;
154 linux,keymap = <0x0001007d /* L_META */
155 0x0002003b /* F1 */
156 0x00030030 /* B */
157 0x00040044 /* F10 */
158 0x00060031 /* N */
159 0x0008000d /* = */
160 0x000a0064 /* R_ALT */
161
162 0x01010001 /* ESC */
163 0x0102003e /* F4 */
164 0x01030022 /* G */
165 0x01040041 /* F7 */
166 0x01060023 /* H */
167 0x01080028 /* ' */
168 0x01090043 /* F9 */
169 0x010b000e /* BKSPACE */
170
171 0x0200001d /* L_CTRL */
172 0x0201000f /* TAB */
173 0x0202003d /* F3 */
174 0x02030014 /* T */
175 0x02040040 /* F6 */
176 0x0205001b /* ] */
177 0x02060015 /* Y */
178 0x02070056 /* 102ND */
179 0x0208001a /* [ */
180 0x02090042 /* F8 */
181
182 0x03010029 /* GRAVE */
183 0x0302003c /* F2 */
184 0x03030006 /* 5 */
185 0x0304003f /* F5 */
186 0x03060007 /* 6 */
187 0x0308000c /* - */
188 0x030b002b /* \ */
189
190 0x04000061 /* R_CTRL */
191 0x0401001e /* A */
192 0x04020020 /* D */
193 0x04030021 /* F */
194 0x0404001f /* S */
195 0x04050025 /* K */
196 0x04060024 /* J */
197 0x04080027 /* ; */
198 0x04090026 /* L */
199 0x040a002b /* \ */
200 0x040b001c /* ENTER */
201
202 0x0501002c /* Z */
203 0x0502002e /* C */
204 0x0503002f /* V */
205 0x0504002d /* X */
206 0x05050033 /* , */
207 0x05060032 /* M */
208 0x0507002a /* L_SHIFT */
209 0x05080035 /* / */
210 0x05090034 /* . */
211 0x050B0039 /* SPACE */
212
213 0x06010002 /* 1 */
214 0x06020004 /* 3 */
215 0x06030005 /* 4 */
216 0x06040003 /* 2 */
217 0x06050009 /* 8 */
218 0x06060008 /* 7 */
219 0x0608000b /* 0 */
220 0x0609000a /* 9 */
221 0x060a0038 /* L_ALT */
222 0x060b006c /* DOWN */
223 0x060c006a /* RIGHT */
224
225 0x07010010 /* Q */
226 0x07020012 /* E */
227 0x07030013 /* R */
228 0x07040011 /* W */
229 0x07050017 /* I */
230 0x07060016 /* U */
231 0x07070036 /* R_SHIFT */
232 0x07080019 /* P */
233 0x07090018 /* O */
234 0x070b0067 /* UP */
235 0x070c0069>; /* LEFT */
236 };
237 }; 148 };
238 149
239 power-regulator { 150 power-regulator {
@@ -351,6 +262,7 @@
351 sound { 262 sound {
352 compatible = "google,snow-audio-max98095"; 263 compatible = "google,snow-audio-max98095";
353 264
265 samsung,model = "Snow-I2S-MAX98095";
354 samsung,i2s-controller = <&i2s0>; 266 samsung,i2s-controller = <&i2s0>;
355 samsung,audio-codec = <&max98095>; 267 samsung,audio-codec = <&max98095>;
356 }; 268 };
@@ -431,3 +343,170 @@
431 }; 343 };
432 }; 344 };
433}; 345};
346
347&i2c_0 {
348 max77686@09 {
349 compatible = "maxim,max77686";
350 interrupt-parent = <&gpx3>;
351 interrupts = <2 0>;
352 pinctrl-names = "default";
353 pinctrl-0 = <&max77686_irq>;
354 wakeup-source;
355 reg = <0x09>;
356 #clock-cells = <1>;
357
358 voltage-regulators {
359 ldo1_reg: LDO1 {
360 regulator-name = "P1.0V_LDO_OUT1";
361 regulator-min-microvolt = <1000000>;
362 regulator-max-microvolt = <1000000>;
363 regulator-always-on;
364 };
365
366 ldo2_reg: LDO2 {
367 regulator-name = "P1.8V_LDO_OUT2";
368 regulator-min-microvolt = <1800000>;
369 regulator-max-microvolt = <1800000>;
370 regulator-always-on;
371 };
372
373 ldo3_reg: LDO3 {
374 regulator-name = "P1.8V_LDO_OUT3";
375 regulator-min-microvolt = <1800000>;
376 regulator-max-microvolt = <1800000>;
377 regulator-always-on;
378 };
379
380 ldo7_reg: LDO7 {
381 regulator-name = "P1.1V_LDO_OUT7";
382 regulator-min-microvolt = <1100000>;
383 regulator-max-microvolt = <1100000>;
384 regulator-always-on;
385 };
386
387 ldo8_reg: LDO8 {
388 regulator-name = "P1.0V_LDO_OUT8";
389 regulator-min-microvolt = <1000000>;
390 regulator-max-microvolt = <1000000>;
391 regulator-always-on;
392 };
393
394 ldo10_reg: LDO10 {
395 regulator-name = "P1.8V_LDO_OUT10";
396 regulator-min-microvolt = <1800000>;
397 regulator-max-microvolt = <1800000>;
398 regulator-always-on;
399 };
400
401 ldo12_reg: LDO12 {
402 regulator-name = "P3.0V_LDO_OUT12";
403 regulator-min-microvolt = <3000000>;
404 regulator-max-microvolt = <3000000>;
405 regulator-always-on;
406 };
407
408 ldo14_reg: LDO14 {
409 regulator-name = "P1.8V_LDO_OUT14";
410 regulator-min-microvolt = <1800000>;
411 regulator-max-microvolt = <1800000>;
412 regulator-always-on;
413 };
414
415 ldo15_reg: LDO15 {
416 regulator-name = "P1.0V_LDO_OUT15";
417 regulator-min-microvolt = <1000000>;
418 regulator-max-microvolt = <1000000>;
419 regulator-always-on;
420 };
421
422 ldo16_reg: LDO16 {
423 regulator-name = "P1.8V_LDO_OUT16";
424 regulator-min-microvolt = <1800000>;
425 regulator-max-microvolt = <1800000>;
426 regulator-always-on;
427 };
428
429 buck1_reg: BUCK1 {
430 regulator-name = "vdd_mif";
431 regulator-min-microvolt = <950000>;
432 regulator-max-microvolt = <1300000>;
433 regulator-always-on;
434 regulator-boot-on;
435 };
436
437 buck2_reg: BUCK2 {
438 regulator-name = "vdd_arm";
439 regulator-min-microvolt = <850000>;
440 regulator-max-microvolt = <1350000>;
441 regulator-always-on;
442 regulator-boot-on;
443 };
444
445 buck3_reg: BUCK3 {
446 regulator-name = "vdd_int";
447 regulator-min-microvolt = <900000>;
448 regulator-max-microvolt = <1200000>;
449 regulator-always-on;
450 regulator-boot-on;
451 };
452
453 buck4_reg: BUCK4 {
454 regulator-name = "vdd_g3d";
455 regulator-min-microvolt = <850000>;
456 regulator-max-microvolt = <1300000>;
457 regulator-always-on;
458 regulator-boot-on;
459 };
460
461 buck5_reg: BUCK5 {
462 regulator-name = "P1.8V_BUCK_OUT5";
463 regulator-min-microvolt = <1800000>;
464 regulator-max-microvolt = <1800000>;
465 regulator-always-on;
466 regulator-boot-on;
467 };
468
469 buck6_reg: BUCK6 {
470 regulator-name = "P1.35V_BUCK_OUT6";
471 regulator-min-microvolt = <1350000>;
472 regulator-max-microvolt = <1350000>;
473 regulator-always-on;
474 };
475
476 buck7_reg: BUCK7 {
477 regulator-name = "P2.0V_BUCK_OUT7";
478 regulator-min-microvolt = <2000000>;
479 regulator-max-microvolt = <2000000>;
480 regulator-always-on;
481 };
482
483 buck8_reg: BUCK8 {
484 regulator-name = "P2.85V_BUCK_OUT8";
485 regulator-min-microvolt = <2850000>;
486 regulator-max-microvolt = <2850000>;
487 regulator-always-on;
488 };
489 };
490 };
491};
492
493&i2c_1 {
494 trackpad {
495 reg = <0x67>;
496 compatible = "cypress,cyapa";
497 interrupts = <2 0>;
498 interrupt-parent = <&gpx1>;
499 wakeup-source;
500 };
501};
502
503&pinctrl_0 {
504 max77686_irq: max77686-irq {
505 samsung,pins = "gpx3-2";
506 samsung,pin-function = <0>;
507 samsung,pin-pud = <0>;
508 samsung,pin-drv = <0>;
509 };
510};
511
512#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/exynos5260.dtsi b/arch/arm/boot/dts/exynos5260.dtsi
index 5398a60207ca..36da38e29000 100644
--- a/arch/arm/boot/dts/exynos5260.dtsi
+++ b/arch/arm/boot/dts/exynos5260.dtsi
@@ -21,6 +21,10 @@
21 pinctrl0 = &pinctrl_0; 21 pinctrl0 = &pinctrl_0;
22 pinctrl1 = &pinctrl_1; 22 pinctrl1 = &pinctrl_1;
23 pinctrl2 = &pinctrl_2; 23 pinctrl2 = &pinctrl_2;
24 serial0 = &uart0;
25 serial1 = &uart1;
26 serial2 = &uart2;
27 serial3 = &uart3;
24 }; 28 };
25 29
26 cpus { 30 cpus {
@@ -227,6 +231,11 @@
227 interrupts = <0 243 0>; 231 interrupts = <0 243 0>;
228 }; 232 };
229 233
234 pmu_system_controller: system-controller@10D50000 {
235 compatible = "samsung,exynos5260-pmu", "syscon";
236 reg = <0x10D50000 0x10000>;
237 };
238
230 uart0: serial@12C00000 { 239 uart0: serial@12C00000 {
231 compatible = "samsung,exynos4210-uart"; 240 compatible = "samsung,exynos4210-uart";
232 reg = <0x12C00000 0x100>; 241 reg = <0x12C00000 0x100>;
diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi
index 3839c26f467f..731eefd23fa9 100644
--- a/arch/arm/boot/dts/exynos5410.dtsi
+++ b/arch/arm/boot/dts/exynos5410.dtsi
@@ -20,6 +20,12 @@
20 compatible = "samsung,exynos5410", "samsung,exynos5"; 20 compatible = "samsung,exynos5410", "samsung,exynos5";
21 interrupt-parent = <&gic>; 21 interrupt-parent = <&gic>;
22 22
23 aliases {
24 serial0 = &uart0;
25 serial1 = &uart1;
26 serial2 = &uart2;
27 };
28
23 cpus { 29 cpus {
24 #address-cells = <1>; 30 #address-cells = <1>;
25 #size-cells = <0>; 31 #size-cells = <0>;
@@ -28,24 +34,28 @@
28 device_type = "cpu"; 34 device_type = "cpu";
29 compatible = "arm,cortex-a15"; 35 compatible = "arm,cortex-a15";
30 reg = <0x0>; 36 reg = <0x0>;
37 clock-frequency = <1600000000>;
31 }; 38 };
32 39
33 CPU1: cpu@1 { 40 CPU1: cpu@1 {
34 device_type = "cpu"; 41 device_type = "cpu";
35 compatible = "arm,cortex-a15"; 42 compatible = "arm,cortex-a15";
36 reg = <0x1>; 43 reg = <0x1>;
44 clock-frequency = <1600000000>;
37 }; 45 };
38 46
39 CPU2: cpu@2 { 47 CPU2: cpu@2 {
40 device_type = "cpu"; 48 device_type = "cpu";
41 compatible = "arm,cortex-a15"; 49 compatible = "arm,cortex-a15";
42 reg = <0x2>; 50 reg = <0x2>;
51 clock-frequency = <1600000000>;
43 }; 52 };
44 53
45 CPU3: cpu@3 { 54 CPU3: cpu@3 {
46 device_type = "cpu"; 55 device_type = "cpu";
47 compatible = "arm,cortex-a15"; 56 compatible = "arm,cortex-a15";
48 reg = <0x3>; 57 reg = <0x3>;
58 clock-frequency = <1600000000>;
49 }; 59 };
50 }; 60 };
51 61
@@ -87,6 +97,11 @@
87 reg = <0x10000000 0x100>; 97 reg = <0x10000000 0x100>;
88 }; 98 };
89 99
100 pmu_system_controller: system-controller@10040000 {
101 compatible = "samsung,exynos5410-pmu", "syscon";
102 reg = <0x10040000 0x5000>;
103 };
104
90 mct: mct@101C0000 { 105 mct: mct@101C0000 {
91 compatible = "samsung,exynos4210-mct"; 106 compatible = "samsung,exynos4210-mct";
92 reg = <0x101C0000 0xB00>; 107 reg = <0x101C0000 0xB00>;
diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 1c5b8f9f4a36..228a6b1e0aa1 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -25,8 +25,18 @@
25 "google,pit", "google,peach","samsung,exynos5420", 25 "google,pit", "google,peach","samsung,exynos5420",
26 "samsung,exynos5"; 26 "samsung,exynos5";
27 27
28 memory { 28 aliases {
29 reg = <0x20000000 0x80000000>; 29 /* Assign 20 so we don't get confused w/ builtin ones */
30 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel";
31 };
32
33 backlight {
34 compatible = "pwm-backlight";
35 pwms = <&pwm 0 1000000 0>;
36 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
37 default-brightness-level = <7>;
38 pinctrl-0 = <&pwm0_out>;
39 pinctrl-names = "default";
30 }; 40 };
31 41
32 fixed-rate-clocks { 42 fixed-rate-clocks {
@@ -50,18 +60,14 @@
50 }; 60 };
51 }; 61 };
52 62
53 backlight { 63 memory {
54 compatible = "pwm-backlight"; 64 reg = <0x20000000 0x80000000>;
55 pwms = <&pwm 0 1000000 0>;
56 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
57 default-brightness-level = <7>;
58 pinctrl-0 = <&pwm0_out>;
59 pinctrl-names = "default";
60 }; 65 };
61 66
62 sound { 67 sound {
63 compatible = "google,snow-audio-max98090"; 68 compatible = "google,snow-audio-max98090";
64 69
70 samsung,model = "Peach-Pit-I2S-MAX98090";
65 samsung,i2s-controller = <&i2s0>; 71 samsung,i2s-controller = <&i2s0>;
66 samsung,audio-codec = <&max98090>; 72 samsung,audio-codec = <&max98090>;
67 }; 73 };
@@ -87,66 +93,92 @@
87 pinctrl-0 = <&usb301_vbus_en>; 93 pinctrl-0 = <&usb301_vbus_en>;
88 enable-active-high; 94 enable-active-high;
89 }; 95 };
90};
91 96
92&pinctrl_0 { 97 vbat: fixed-regulator {
93 max98090_irq: max98090-irq { 98 compatible = "regulator-fixed";
94 samsung,pins = "gpx0-2"; 99 regulator-name = "vbat-supply";
95 samsung,pin-function = <0>; 100 regulator-boot-on;
96 samsung,pin-pud = <0>; 101 regulator-always-on;
97 samsung,pin-drv = <0>;
98 }; 102 };
103};
99 104
100 tpm_irq: tpm-irq { 105&dp {
101 samsung,pins = "gpx1-0"; 106 status = "okay";
102 samsung,pin-function = <0>; 107 pinctrl-names = "default";
103 samsung,pin-pud = <0>; 108 pinctrl-0 = <&dp_hpd_gpio>;
104 samsung,pin-drv = <0>; 109 samsung,color-space = <0>;
105 }; 110 samsung,dynamic-range = <0>;
111 samsung,ycbcr-coeff = <0>;
112 samsung,color-depth = <1>;
113 samsung,link-rate = <0x06>;
114 samsung,lane-count = <2>;
115 samsung,hpd-gpio = <&gpx2 6 0>;
106 116
107 power_key_irq: power-key-irq { 117 display-timings {
108 samsung,pins = "gpx1-2"; 118 native-mode = <&timing1>;
109 samsung,pin-function = <0>;
110 samsung,pin-pud = <0>;
111 samsung,pin-drv = <0>;
112 };
113 119
114 hdmi_hpd_irq: hdmi-hpd-irq { 120 timing1: timing@1 {
115 samsung,pins = "gpx3-7"; 121 clock-frequency = <70589280>;
116 samsung,pin-function = <0>; 122 hactive = <1366>;
117 samsung,pin-pud = <1>; 123 vactive = <768>;
118 samsung,pin-drv = <0>; 124 hfront-porch = <40>;
125 hback-porch = <40>;
126 hsync-len = <32>;
127 vback-porch = <10>;
128 vfront-porch = <12>;
129 vsync-len = <6>;
130 };
119 }; 131 };
132};
120 133
121 dp_hpd_gpio: dp_hpd_gpio { 134&fimd {
122 samsung,pins = "gpx2-6"; 135 status = "okay";
123 samsung,pin-function = <0>; 136 samsung,invert-vclk;
124 samsung,pin-pud = <3>;
125 samsung,pin-drv = <0>;
126 };
127}; 137};
128 138
129&pinctrl_3 { 139&hdmi {
130 usb300_vbus_en: usb300-vbus-en { 140 status = "okay";
131 samsung,pins = "gph0-0"; 141 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
132 samsung,pin-function = <1>; 142 pinctrl-names = "default";
133 samsung,pin-pud = <0>; 143 pinctrl-0 = <&hdmi_hpd_irq>;
134 samsung,pin-drv = <0>; 144 ddc = <&i2c_2>;
145};
146
147&hsi2c_7 {
148 status = "okay";
149
150 max98090: codec@10 {
151 compatible = "maxim,max98090";
152 reg = <0x10>;
153 interrupts = <2 0>;
154 interrupt-parent = <&gpx0>;
155 pinctrl-names = "default";
156 pinctrl-0 = <&max98090_irq>;
135 }; 157 };
158};
136 159
137 usb301_vbus_en: usb301-vbus-en { 160&hsi2c_9 {
138 samsung,pins = "gph0-1"; 161 status = "okay";
139 samsung,pin-function = <1>; 162 clock-frequency = <400000>;
140 samsung,pin-pud = <0>; 163
141 samsung,pin-drv = <0>; 164 tpm@20 {
165 compatible = "infineon,slb9645tt";
166 reg = <0x20>;
167
168 /* Unused irq; but still need to configure the pins */
169 pinctrl-names = "default";
170 pinctrl-0 = <&tpm_irq>;
142 }; 171 };
143}; 172};
144 173
145&rtc { 174&i2c_2 {
146 status = "okay"; 175 status = "okay";
176 samsung,i2c-sda-delay = <100>;
177 samsung,i2c-max-bus-freq = <66000>;
178 samsung,i2c-slave-addr = <0x50>;
147}; 179};
148 180
149&uart_3 { 181&i2s0 {
150 status = "okay"; 182 status = "okay";
151}; 183};
152 184
@@ -189,46 +221,210 @@
189 }; 221 };
190}; 222};
191 223
192&hsi2c_7 {
193 status = "okay";
194 224
195 max98090: codec@10 { 225&pinctrl_0 {
196 compatible = "maxim,max98090"; 226 pinctrl-names = "default";
197 reg = <0x10>; 227 pinctrl-0 = <&mask_tpm_reset>;
198 interrupts = <2 0>; 228
199 interrupt-parent = <&gpx0>; 229 max98090_irq: max98090-irq {
200 pinctrl-names = "default"; 230 samsung,pins = "gpx0-2";
201 pinctrl-0 = <&max98090_irq>; 231 samsung,pin-function = <0>;
232 samsung,pin-pud = <0>;
233 samsung,pin-drv = <0>;
234 };
235
236 /* We need GPX0_6 to be low at sleep time; just keep it low always */
237 mask_tpm_reset: mask-tpm-reset {
238 samsung,pins = "gpx0-6";
239 samsung,pin-function = <1>;
240 samsung,pin-pud = <0>;
241 samsung,pin-drv = <0>;
242 samsung,pin-val = <0>;
243 };
244
245 tpm_irq: tpm-irq {
246 samsung,pins = "gpx1-0";
247 samsung,pin-function = <0>;
248 samsung,pin-pud = <0>;
249 samsung,pin-drv = <0>;
250 };
251
252 power_key_irq: power-key-irq {
253 samsung,pins = "gpx1-2";
254 samsung,pin-function = <0>;
255 samsung,pin-pud = <0>;
256 samsung,pin-drv = <0>;
257 };
258
259 ec_irq: ec-irq {
260 samsung,pins = "gpx1-5";
261 samsung,pin-function = <0>;
262 samsung,pin-pud = <0>;
263 samsung,pin-drv = <0>;
264 };
265
266 tps65090_irq: tps65090-irq {
267 samsung,pins = "gpx2-5";
268 samsung,pin-function = <0>;
269 samsung,pin-pud = <0>;
270 samsung,pin-drv = <0>;
271 };
272
273 dp_hpd_gpio: dp_hpd_gpio {
274 samsung,pins = "gpx2-6";
275 samsung,pin-function = <0>;
276 samsung,pin-pud = <3>;
277 samsung,pin-drv = <0>;
278 };
279
280 hdmi_hpd_irq: hdmi-hpd-irq {
281 samsung,pins = "gpx3-7";
282 samsung,pin-function = <0>;
283 samsung,pin-pud = <1>;
284 samsung,pin-drv = <0>;
202 }; 285 };
203}; 286};
204 287
205&hsi2c_9 { 288&pinctrl_3 {
206 status = "okay"; 289 /* Drive SPI lines at x2 for better integrity */
207 clock-frequency = <400000>; 290 spi2-bus {
291 samsung,pin-drv = <2>;
292 };
208 293
209 tpm@20 { 294 /* Drive SPI chip select at x2 for better integrity */
210 compatible = "infineon,slb9645tt"; 295 ec_spi_cs: ec-spi-cs {
211 reg = <0x20>; 296 samsung,pins = "gpb1-2";
297 samsung,pin-function = <1>;
298 samsung,pin-pud = <0>;
299 samsung,pin-drv = <2>;
300 };
212 301
213 /* Unused irq; but still need to configure the pins */ 302 usb300_vbus_en: usb300-vbus-en {
214 pinctrl-names = "default"; 303 samsung,pins = "gph0-0";
215 pinctrl-0 = <&tpm_irq>; 304 samsung,pin-function = <1>;
305 samsung,pin-pud = <0>;
306 samsung,pin-drv = <0>;
307 };
308
309 usb301_vbus_en: usb301-vbus-en {
310 samsung,pins = "gph0-1";
311 samsung,pin-function = <1>;
312 samsung,pin-pud = <0>;
313 samsung,pin-drv = <0>;
216 }; 314 };
217}; 315};
218 316
219&i2c_2 { 317&rtc {
220 status = "okay"; 318 status = "okay";
221 samsung,i2c-sda-delay = <100>;
222 samsung,i2c-max-bus-freq = <66000>;
223 samsung,i2c-slave-addr = <0x50>;
224}; 319};
225 320
226&hdmi { 321&spi_2 {
322 status = "okay";
323 num-cs = <1>;
324 samsung,spi-src-clk = <0>;
325 cs-gpios = <&gpb1 2 0>;
326
327 cros_ec: cros-ec@0 {
328 compatible = "google,cros-ec-spi";
329 interrupt-parent = <&gpx1>;
330 interrupts = <5 0>;
331 pinctrl-names = "default";
332 pinctrl-0 = <&ec_spi_cs &ec_irq>;
333 reg = <0>;
334 spi-max-frequency = <3125000>;
335
336 controller-data {
337 samsung,spi-feedback-delay = <1>;
338 };
339
340 i2c-tunnel {
341 compatible = "google,cros-ec-i2c-tunnel";
342 #address-cells = <1>;
343 #size-cells = <0>;
344 google,remote-bus = <0>;
345
346 battery: sbs-battery@b {
347 compatible = "sbs,sbs-battery";
348 reg = <0xb>;
349 sbs,poll-retry-count = <1>;
350 sbs,i2c-retry-count = <2>;
351 };
352
353 power-regulator@48 {
354 compatible = "ti,tps65090";
355 reg = <0x48>;
356
357 /*
358 * Config irq to disable internal pulls
359 * even though we run in polling mode.
360 */
361 pinctrl-names = "default";
362 pinctrl-0 = <&tps65090_irq>;
363
364 vsys1-supply = <&vbat>;
365 vsys2-supply = <&vbat>;
366 vsys3-supply = <&vbat>;
367 infet1-supply = <&vbat>;
368 infet2-supply = <&vbat>;
369 infet3-supply = <&vbat>;
370 infet4-supply = <&vbat>;
371 infet5-supply = <&vbat>;
372 infet6-supply = <&vbat>;
373 infet7-supply = <&vbat>;
374 vsys-l1-supply = <&vbat>;
375 vsys-l2-supply = <&vbat>;
376
377 regulators {
378 tps65090_dcdc1: dcdc1 {
379 ti,enable-ext-control;
380 };
381 tps65090_dcdc2: dcdc2 {
382 ti,enable-ext-control;
383 };
384 tps65090_dcdc3: dcdc3 {
385 ti,enable-ext-control;
386 };
387 tps65090_fet1: fet1 {
388 regulator-name = "vcd_led";
389 };
390 tps65090_fet2: fet2 {
391 regulator-name = "video_mid";
392 regulator-always-on;
393 };
394 tps65090_fet3: fet3 {
395 regulator-name = "wwan_r";
396 regulator-always-on;
397 };
398 tps65090_fet4: fet4 {
399 regulator-name = "sdcard";
400 regulator-always-on;
401 };
402 tps65090_fet5: fet5 {
403 regulator-name = "camout";
404 };
405 tps65090_fet6: fet6 {
406 regulator-name = "lcd_vdd";
407 };
408 tps65090_fet7: fet7 {
409 regulator-name = "video_mid_1a";
410 regulator-always-on;
411 };
412 tps65090_ldo1: ldo1 {
413 };
414 tps65090_ldo2: ldo2 {
415 };
416 };
417
418 charger {
419 compatible = "ti,tps65090-charger";
420 };
421 };
422 };
423 };
424};
425
426&uart_3 {
227 status = "okay"; 427 status = "okay";
228 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
229 pinctrl-names = "default";
230 pinctrl-0 = <&hdmi_hpd_irq>;
231 ddc = <&i2c_2>;
232}; 428};
233 429
234&usbdrd_phy0 { 430&usbdrd_phy0 {
@@ -248,40 +444,4 @@
248 timeout-sec = <32>; 444 timeout-sec = <32>;
249}; 445};
250 446
251&i2s0 { 447#include "cros-ec-keyboard.dtsi"
252 status = "okay";
253};
254
255&fimd {
256 status = "okay";
257 samsung,invert-vclk;
258};
259
260&dp {
261 status = "okay";
262 pinctrl-names = "default";
263 pinctrl-0 = <&dp_hpd_gpio>;
264 samsung,color-space = <0>;
265 samsung,dynamic-range = <0>;
266 samsung,ycbcr-coeff = <0>;
267 samsung,color-depth = <1>;
268 samsung,link-rate = <0x06>;
269 samsung,lane-count = <2>;
270 samsung,hpd-gpio = <&gpx2 6 0>;
271
272 display-timings {
273 native-mode = <&timing1>;
274
275 timing1: timing@1 {
276 clock-frequency = <70589280>;
277 hactive = <1366>;
278 vactive = <768>;
279 hfront-porch = <40>;
280 hback-porch = <40>;
281 hsync-len = <32>;
282 vback-porch = <10>;
283 vfront-porch = <12>;
284 vsync-len = <6>;
285 };
286 };
287};
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index a40a5c2b5a4f..bfe056d9148c 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -265,11 +265,6 @@
265 clock-names = "oscclk", "pclk0", "clk0"; 265 clock-names = "oscclk", "pclk0", "clk0";
266 }; 266 };
267 267
268 disp_pd: power-domain@100440C0 {
269 compatible = "samsung,exynos4210-pd";
270 reg = <0x100440C0 0x20>;
271 };
272
273 msc_pd: power-domain@10044120 { 268 msc_pd: power-domain@10044120 {
274 compatible = "samsung,exynos4210-pd"; 269 compatible = "samsung,exynos4210-pd";
275 reg = <0x10044120 0x20>; 270 reg = <0x10044120 0x20>;
@@ -520,8 +515,26 @@
520 phy-names = "dp"; 515 phy-names = "dp";
521 }; 516 };
522 517
518 mipi_phy: video-phy@10040714 {
519 compatible = "samsung,s5pv210-mipi-video-phy";
520 reg = <0x10040714 12>;
521 #phy-cells = <1>;
522 };
523
524 dsi@14500000 {
525 compatible = "samsung,exynos5410-mipi-dsi";
526 reg = <0x14500000 0x10000>;
527 interrupts = <0 82 0>;
528 phys = <&mipi_phy 1>;
529 phy-names = "dsim";
530 clocks = <&clock CLK_DSIM1>, <&clock CLK_SCLK_MIPI1>;
531 clock-names = "bus_clk", "pll_clk";
532 #address-cells = <1>;
533 #size-cells = <0>;
534 status = "disabled";
535 };
536
523 fimd: fimd@14400000 { 537 fimd: fimd@14400000 {
524 samsung,power-domain = <&disp_pd>;
525 clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>; 538 clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>;
526 clock-names = "sclk_fimd", "fimd"; 539 clock-names = "sclk_fimd", "fimd";
527 }; 540 };
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index ae3a17c791f6..8f3373cd7b87 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -18,6 +18,8 @@
18 interrupt-parent = <&gic>; 18 interrupt-parent = <&gic>;
19 19
20 aliases { 20 aliases {
21 serial0 = &serial_0;
22 serial1 = &serial_1;
21 spi0 = &spi_0; 23 spi0 = &spi_0;
22 tmuctrl0 = &tmuctrl_0; 24 tmuctrl0 = &tmuctrl_0;
23 tmuctrl1 = &tmuctrl_1; 25 tmuctrl1 = &tmuctrl_1;
@@ -102,7 +104,7 @@
102 >; 104 >;
103 }; 105 };
104 106
105 serial@B0000 { 107 serial_0: serial@B0000 {
106 compatible = "samsung,exynos4210-uart"; 108 compatible = "samsung,exynos4210-uart";
107 reg = <0xB0000 0x1000>; 109 reg = <0xB0000 0x1000>;
108 interrupts = <0 2 0>; 110 interrupts = <0 2 0>;
@@ -110,7 +112,7 @@
110 clock-names = "uart", "clk_uart_baud0"; 112 clock-names = "uart", "clk_uart_baud0";
111 }; 113 };
112 114
113 serial@C0000 { 115 serial_1: serial@C0000 {
114 compatible = "samsung,exynos4210-uart"; 116 compatible = "samsung,exynos4210-uart";
115 reg = <0xC0000 0x1000>; 117 reg = <0xC0000 0x1000>;
116 interrupts = <0 3 0>; 118 interrupts = <0 3 0>;
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index f3af2079a063..f3ee48bbe05f 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -23,8 +23,18 @@
23 "google,pi", "google,peach", "samsung,exynos5800", 23 "google,pi", "google,peach", "samsung,exynos5800",
24 "samsung,exynos5"; 24 "samsung,exynos5";
25 25
26 memory { 26 aliases {
27 reg = <0x20000000 0x80000000>; 27 /* Assign 20 so we don't get confused w/ builtin ones */
28 i2c20 = "/spi@12d40000/cros-ec@0/i2c-tunnel";
29 };
30
31 backlight {
32 compatible = "pwm-backlight";
33 pwms = <&pwm 0 1000000 0>;
34 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
35 default-brightness-level = <7>;
36 pinctrl-0 = <&pwm0_out>;
37 pinctrl-names = "default";
28 }; 38 };
29 39
30 fixed-rate-clocks { 40 fixed-rate-clocks {
@@ -48,13 +58,16 @@
48 }; 58 };
49 }; 59 };
50 60
51 backlight { 61 memory {
52 compatible = "pwm-backlight"; 62 reg = <0x20000000 0x80000000>;
53 pwms = <&pwm 0 1000000 0>; 63 };
54 brightness-levels = <0 100 500 1000 1500 2000 2500 2800>; 64
55 default-brightness-level = <7>; 65 sound {
56 pinctrl-0 = <&pwm0_out>; 66 compatible = "google,snow-audio-max98091";
57 pinctrl-names = "default"; 67
68 samsung,model = "Peach-Pi-I2S-MAX98091";
69 samsung,i2s-controller = <&i2s0>;
70 samsung,audio-codec = <&max98091>;
58 }; 71 };
59 72
60 usb300_vbus_reg: regulator-usb300 { 73 usb300_vbus_reg: regulator-usb300 {
@@ -78,59 +91,92 @@
78 pinctrl-0 = <&usb301_vbus_en>; 91 pinctrl-0 = <&usb301_vbus_en>;
79 enable-active-high; 92 enable-active-high;
80 }; 93 };
81};
82 94
83&pinctrl_0 { 95 vbat: fixed-regulator {
84 tpm_irq: tpm-irq { 96 compatible = "regulator-fixed";
85 samsung,pins = "gpx1-0"; 97 regulator-name = "vbat-supply";
86 samsung,pin-function = <0>; 98 regulator-boot-on;
87 samsung,pin-pud = <0>; 99 regulator-always-on;
88 samsung,pin-drv = <0>;
89 }; 100 };
101};
90 102
91 power_key_irq: power-key-irq { 103&dp {
92 samsung,pins = "gpx1-2"; 104 status = "okay";
93 samsung,pin-function = <0>; 105 pinctrl-names = "default";
94 samsung,pin-pud = <0>; 106 pinctrl-0 = <&dp_hpd_gpio>;
95 samsung,pin-drv = <0>; 107 samsung,color-space = <0>;
96 }; 108 samsung,dynamic-range = <0>;
109 samsung,ycbcr-coeff = <0>;
110 samsung,color-depth = <1>;
111 samsung,link-rate = <0x0a>;
112 samsung,lane-count = <2>;
113 samsung,hpd-gpio = <&gpx2 6 0>;
97 114
98 dp_hpd_gpio: dp_hpd_gpio { 115 display-timings {
99 samsung,pins = "gpx2-6"; 116 native-mode = <&timing1>;
100 samsung,pin-function = <0>;
101 samsung,pin-pud = <3>;
102 samsung,pin-drv = <0>;
103 };
104 117
105 hdmi_hpd_irq: hdmi-hpd-irq { 118 timing1: timing@1 {
106 samsung,pins = "gpx3-7"; 119 clock-frequency = <150660000>;
107 samsung,pin-function = <0>; 120 hactive = <1920>;
108 samsung,pin-pud = <1>; 121 vactive = <1080>;
109 samsung,pin-drv = <0>; 122 hfront-porch = <60>;
123 hback-porch = <172>;
124 hsync-len = <80>;
125 vback-porch = <25>;
126 vfront-porch = <10>;
127 vsync-len = <10>;
128 };
110 }; 129 };
111}; 130};
112 131
113&pinctrl_3 { 132&fimd {
114 usb300_vbus_en: usb300-vbus-en { 133 status = "okay";
115 samsung,pins = "gph0-0"; 134 samsung,invert-vclk;
116 samsung,pin-function = <1>; 135};
117 samsung,pin-pud = <0>; 136
118 samsung,pin-drv = <0>; 137&hdmi {
138 status = "okay";
139 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
140 pinctrl-names = "default";
141 pinctrl-0 = <&hdmi_hpd_irq>;
142 ddc = <&i2c_2>;
143};
144
145&hsi2c_7 {
146 status = "okay";
147
148 max98091: codec@10 {
149 compatible = "maxim,max98091";
150 reg = <0x10>;
151 interrupts = <2 0>;
152 interrupt-parent = <&gpx0>;
153 pinctrl-names = "default";
154 pinctrl-0 = <&max98091_irq>;
119 }; 155 };
156};
120 157
121 usb301_vbus_en: usb301-vbus-en { 158&hsi2c_9 {
122 samsung,pins = "gph0-1"; 159 status = "okay";
123 samsung,pin-function = <1>; 160 clock-frequency = <400000>;
124 samsung,pin-pud = <0>; 161
125 samsung,pin-drv = <0>; 162 tpm@20 {
163 compatible = "infineon,slb9645tt";
164 reg = <0x20>;
165
166 /* Unused irq; but still need to configure the pins */
167 pinctrl-names = "default";
168 pinctrl-0 = <&tpm_irq>;
126 }; 169 };
127}; 170};
128 171
129&rtc { 172&i2c_2 {
130 status = "okay"; 173 status = "okay";
174 samsung,i2c-sda-delay = <100>;
175 samsung,i2c-max-bus-freq = <66000>;
176 samsung,i2c-slave-addr = <0x50>;
131}; 177};
132 178
133&uart_3 { 179&i2s0 {
134 status = "okay"; 180 status = "okay";
135}; 181};
136 182
@@ -173,66 +219,210 @@
173 }; 219 };
174}; 220};
175 221
176&dp { 222
177 status = "okay"; 223&pinctrl_0 {
178 pinctrl-names = "default"; 224 pinctrl-names = "default";
179 pinctrl-0 = <&dp_hpd_gpio>; 225 pinctrl-0 = <&mask_tpm_reset>;
180 samsung,color-space = <0>;
181 samsung,dynamic-range = <0>;
182 samsung,ycbcr-coeff = <0>;
183 samsung,color-depth = <1>;
184 samsung,link-rate = <0x0a>;
185 samsung,lane-count = <2>;
186 samsung,hpd-gpio = <&gpx2 6 0>;
187 226
188 display-timings { 227 max98091_irq: max98091-irq {
189 native-mode = <&timing1>; 228 samsung,pins = "gpx0-2";
229 samsung,pin-function = <0>;
230 samsung,pin-pud = <0>;
231 samsung,pin-drv = <0>;
232 };
190 233
191 timing1: timing@1 { 234 /* We need GPX0_6 to be low at sleep time; just keep it low always */
192 clock-frequency = <150660000>; 235 mask_tpm_reset: mask-tpm-reset {
193 hactive = <1920>; 236 samsung,pins = "gpx0-6";
194 vactive = <1080>; 237 samsung,pin-function = <1>;
195 hfront-porch = <60>; 238 samsung,pin-pud = <0>;
196 hback-porch = <172>; 239 samsung,pin-drv = <0>;
197 hsync-len = <80>; 240 samsung,pin-val = <0>;
198 vback-porch = <25>;
199 vfront-porch = <10>;
200 vsync-len = <10>;
201 };
202 }; 241 };
203};
204 242
205&fimd { 243 tpm_irq: tpm-irq {
206 status = "okay"; 244 samsung,pins = "gpx1-0";
207 samsung,invert-vclk; 245 samsung,pin-function = <0>;
246 samsung,pin-pud = <0>;
247 samsung,pin-drv = <0>;
248 };
249
250 power_key_irq: power-key-irq {
251 samsung,pins = "gpx1-2";
252 samsung,pin-function = <0>;
253 samsung,pin-pud = <0>;
254 samsung,pin-drv = <0>;
255 };
256
257 ec_irq: ec-irq {
258 samsung,pins = "gpx1-5";
259 samsung,pin-function = <0>;
260 samsung,pin-pud = <0>;
261 samsung,pin-drv = <0>;
262 };
263
264 tps65090_irq: tps65090-irq {
265 samsung,pins = "gpx2-5";
266 samsung,pin-function = <0>;
267 samsung,pin-pud = <0>;
268 samsung,pin-drv = <0>;
269 };
270
271 dp_hpd_gpio: dp_hpd_gpio {
272 samsung,pins = "gpx2-6";
273 samsung,pin-function = <0>;
274 samsung,pin-pud = <3>;
275 samsung,pin-drv = <0>;
276 };
277
278 hdmi_hpd_irq: hdmi-hpd-irq {
279 samsung,pins = "gpx3-7";
280 samsung,pin-function = <0>;
281 samsung,pin-pud = <1>;
282 samsung,pin-drv = <0>;
283 };
208}; 284};
209 285
210&hsi2c_9 { 286&pinctrl_3 {
211 status = "okay"; 287 /* Drive SPI lines at x2 for better integrity */
212 clock-frequency = <400000>; 288 spi2-bus {
289 samsung,pin-drv = <2>;
290 };
213 291
214 tpm@20 { 292 /* Drive SPI chip select at x2 for better integrity */
215 compatible = "infineon,slb9645tt"; 293 ec_spi_cs: ec-spi-cs {
216 reg = <0x20>; 294 samsung,pins = "gpb1-2";
217 /* Unused irq; but still need to configure the pins */ 295 samsung,pin-function = <1>;
218 pinctrl-names = "default"; 296 samsung,pin-pud = <0>;
219 pinctrl-0 = <&tpm_irq>; 297 samsung,pin-drv = <2>;
298 };
299
300 usb300_vbus_en: usb300-vbus-en {
301 samsung,pins = "gph0-0";
302 samsung,pin-function = <1>;
303 samsung,pin-pud = <0>;
304 samsung,pin-drv = <0>;
305 };
306
307 usb301_vbus_en: usb301-vbus-en {
308 samsung,pins = "gph0-1";
309 samsung,pin-function = <1>;
310 samsung,pin-pud = <0>;
311 samsung,pin-drv = <0>;
220 }; 312 };
221}; 313};
222 314
223&i2c_2 { 315&rtc {
224 status = "okay"; 316 status = "okay";
225 samsung,i2c-sda-delay = <100>;
226 samsung,i2c-max-bus-freq = <66000>;
227 samsung,i2c-slave-addr = <0x50>;
228}; 317};
229 318
230&hdmi { 319&spi_2 {
320 status = "okay";
321 num-cs = <1>;
322 samsung,spi-src-clk = <0>;
323 cs-gpios = <&gpb1 2 0>;
324
325 cros_ec: cros-ec@0 {
326 compatible = "google,cros-ec-spi";
327 interrupt-parent = <&gpx1>;
328 interrupts = <5 0>;
329 pinctrl-names = "default";
330 pinctrl-0 = <&ec_spi_cs &ec_irq>;
331 reg = <0>;
332 spi-max-frequency = <3125000>;
333
334 controller-data {
335 samsung,spi-feedback-delay = <1>;
336 };
337
338 i2c-tunnel {
339 compatible = "google,cros-ec-i2c-tunnel";
340 #address-cells = <1>;
341 #size-cells = <0>;
342 google,remote-bus = <0>;
343
344 battery: sbs-battery@b {
345 compatible = "sbs,sbs-battery";
346 reg = <0xb>;
347 sbs,poll-retry-count = <1>;
348 sbs,i2c-retry-count = <2>;
349 };
350
351 power-regulator@48 {
352 compatible = "ti,tps65090";
353 reg = <0x48>;
354
355 /*
356 * Config irq to disable internal pulls
357 * even though we run in polling mode.
358 */
359 pinctrl-names = "default";
360 pinctrl-0 = <&tps65090_irq>;
361
362 vsys1-supply = <&vbat>;
363 vsys2-supply = <&vbat>;
364 vsys3-supply = <&vbat>;
365 infet1-supply = <&vbat>;
366 infet2-supply = <&vbat>;
367 infet3-supply = <&vbat>;
368 infet4-supply = <&vbat>;
369 infet5-supply = <&vbat>;
370 infet6-supply = <&vbat>;
371 infet7-supply = <&vbat>;
372 vsys-l1-supply = <&vbat>;
373 vsys-l2-supply = <&vbat>;
374
375 regulators {
376 tps65090_dcdc1: dcdc1 {
377 ti,enable-ext-control;
378 };
379 tps65090_dcdc2: dcdc2 {
380 ti,enable-ext-control;
381 };
382 tps65090_dcdc3: dcdc3 {
383 ti,enable-ext-control;
384 };
385 tps65090_fet1: fet1 {
386 regulator-name = "vcd_led";
387 };
388 tps65090_fet2: fet2 {
389 regulator-name = "video_mid";
390 regulator-always-on;
391 };
392 tps65090_fet3: fet3 {
393 regulator-name = "wwan_r";
394 regulator-always-on;
395 };
396 tps65090_fet4: fet4 {
397 regulator-name = "sdcard";
398 regulator-always-on;
399 };
400 tps65090_fet5: fet5 {
401 regulator-name = "camout";
402 };
403 tps65090_fet6: fet6 {
404 regulator-name = "lcd_vdd";
405 };
406 tps65090_fet7: fet7 {
407 regulator-name = "video_mid_1a";
408 regulator-always-on;
409 };
410 tps65090_ldo1: ldo1 {
411 };
412 tps65090_ldo2: ldo2 {
413 };
414 };
415
416 charger {
417 compatible = "ti,tps65090-charger";
418 };
419 };
420 };
421 };
422};
423
424&uart_3 {
231 status = "okay"; 425 status = "okay";
232 hpd-gpio = <&gpx3 7 GPIO_ACTIVE_HIGH>;
233 pinctrl-names = "default";
234 pinctrl-0 = <&hdmi_hpd_irq>;
235 ddc = <&i2c_2>;
236}; 426};
237 427
238&usbdrd_phy0 { 428&usbdrd_phy0 {
@@ -251,3 +441,5 @@
251&watchdog { 441&watchdog {
252 timeout-sec = <32>; 442 timeout-sec = <32>;
253}; 443};
444
445#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/ge863-pro3.dtsi b/arch/arm/boot/dts/ge863-pro3.dtsi
index 230099bb31c8..0d0e62489d93 100644
--- a/arch/arm/boot/dts/ge863-pro3.dtsi
+++ b/arch/arm/boot/dts/ge863-pro3.dtsi
@@ -19,6 +19,10 @@
19 compatible = "atmel,osc", "fixed-clock"; 19 compatible = "atmel,osc", "fixed-clock";
20 clock-frequency = <6000000>; 20 clock-frequency = <6000000>;
21 }; 21 };
22
23 main_xtal {
24 clock-frequency = <6000000>;
25 };
22 }; 26 };
23 27
24 ahb { 28 ahb {
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
index 83a5b8685bd9..6cbb62e5c6a9 100644
--- a/arch/arm/boot/dts/hi3620.dtsi
+++ b/arch/arm/boot/dts/hi3620.dtsi
@@ -33,6 +33,7 @@
33 cpus { 33 cpus {
34 #address-cells = <1>; 34 #address-cells = <1>;
35 #size-cells = <0>; 35 #size-cells = <0>;
36 enable-method = "hisilicon,hi3620-smp";
36 37
37 cpu@0 { 38 cpu@0 {
38 device_type = "cpu"; 39 device_type = "cpu";
diff --git a/arch/arm/boot/dts/hisi-x5hd2-dkb.dts b/arch/arm/boot/dts/hisi-x5hd2-dkb.dts
new file mode 100644
index 000000000000..05b44c272c9a
--- /dev/null
+++ b/arch/arm/boot/dts/hisi-x5hd2-dkb.dts
@@ -0,0 +1,53 @@
1/*
2 * Copyright (c) 2013-2014 Linaro Ltd.
3 * Copyright (c) 2013-2014 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11#include "hisi-x5hd2.dtsi"
12
13/ {
14 model = "Hisilicon HIX5HD2 Development Board";
15 compatible = "hisilicon,hix5hd2";
16
17 chosen {
18 bootargs = "console=ttyAMA0,115200 earlyprintk";
19 };
20
21 cpus {
22 #address-cells = <1>;
23 #size-cells = <0>;
24 enable-method = "hisilicon,hix5hd2-smp";
25
26 cpu@0 {
27 compatible = "arm,cortex-a9";
28 device_type = "cpu";
29 reg = <0>;
30 next-level-cache = <&l2>;
31 };
32
33 cpu@1 {
34 compatible = "arm,cortex-a9";
35 device_type = "cpu";
36 reg = <1>;
37 next-level-cache = <&l2>;
38 };
39 };
40
41 memory {
42 device_type = "memory";
43 reg = <0x00000000 0x80000000>;
44 };
45};
46
47&timer0 {
48 status = "okay";
49};
50
51&uart0 {
52 status = "okay";
53};
diff --git a/arch/arm/boot/dts/hisi-x5hd2.dtsi b/arch/arm/boot/dts/hisi-x5hd2.dtsi
new file mode 100644
index 000000000000..f85ba2924ff7
--- /dev/null
+++ b/arch/arm/boot/dts/hisi-x5hd2.dtsi
@@ -0,0 +1,170 @@
1/*
2 * Copyright (c) 2013-2014 Linaro Ltd.
3 * Copyright (c) 2013-2014 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10#include "skeleton.dtsi"
11#include <dt-bindings/clock/hix5hd2-clock.h>
12
13/ {
14 aliases {
15 serial0 = &uart0;
16 };
17
18 gic: interrupt-controller@f8a01000 {
19 compatible = "arm,cortex-a9-gic";
20 #interrupt-cells = <3>;
21 #address-cells = <0>;
22 interrupt-controller;
23 /* gic dist base, gic cpu base */
24 reg = <0xf8a01000 0x1000>, <0xf8a00100 0x100>;
25 };
26
27 soc {
28 #address-cells = <1>;
29 #size-cells = <1>;
30 compatible = "simple-bus";
31 interrupt-parent = <&gic>;
32 ranges = <0 0xf8000000 0x8000000>;
33
34 amba {
35 #address-cells = <1>;
36 #size-cells = <1>;
37 compatible = "arm,amba-bus";
38 ranges;
39
40 timer0: timer@00002000 {
41 compatible = "arm,sp804", "arm,primecell";
42 reg = <0x00002000 0x1000>;
43 /* timer00 & timer01 */
44 interrupts = <0 24 4>;
45 clocks = <&clock HIX5HD2_FIXED_24M>;
46 status = "disabled";
47 };
48
49 timer1: timer@00a29000 {
50 /*
51 * Only used in NORMAL state, not available ins
52 * SLOW or DOZE state.
53 * The rate is fixed in 24MHz.
54 */
55 compatible = "arm,sp804", "arm,primecell";
56 reg = <0x00a29000 0x1000>;
57 /* timer10 & timer11 */
58 interrupts = <0 25 4>;
59 clocks = <&clock HIX5HD2_FIXED_24M>;
60 status = "disabled";
61 };
62
63 timer2: timer@00a2a000 {
64 compatible = "arm,sp804", "arm,primecell";
65 reg = <0x00a2a000 0x1000>;
66 /* timer20 & timer21 */
67 interrupts = <0 26 4>;
68 clocks = <&clock HIX5HD2_FIXED_24M>;
69 status = "disabled";
70 };
71
72 timer3: timer@00a2b000 {
73 compatible = "arm,sp804", "arm,primecell";
74 reg = <0x00a2b000 0x1000>;
75 /* timer30 & timer31 */
76 interrupts = <0 27 4>;
77 clocks = <&clock HIX5HD2_FIXED_24M>;
78 status = "disabled";
79 };
80
81 timer4: timer@00a81000 {
82 compatible = "arm,sp804", "arm,primecell";
83 reg = <0x00a81000 0x1000>;
84 /* timer30 & timer31 */
85 interrupts = <0 28 4>;
86 clocks = <&clock HIX5HD2_FIXED_24M>;
87 status = "disabled";
88 };
89
90 uart0: uart@00b00000 {
91 compatible = "arm,pl011", "arm,primecell";
92 reg = <0x00b00000 0x1000>;
93 interrupts = <0 49 4>;
94 clocks = <&clock HIX5HD2_FIXED_83M>;
95 clock-names = "apb_pclk";
96 status = "disabled";
97 };
98
99 uart1: uart@00006000 {
100 compatible = "arm,pl011", "arm,primecell";
101 reg = <0x00006000 0x1000>;
102 interrupts = <0 50 4>;
103 clocks = <&clock HIX5HD2_FIXED_83M>;
104 clock-names = "apb_pclk";
105 status = "disabled";
106 };
107
108 uart2: uart@00b02000 {
109 compatible = "arm,pl011", "arm,primecell";
110 reg = <0x00b02000 0x1000>;
111 interrupts = <0 51 4>;
112 clocks = <&clock HIX5HD2_FIXED_83M>;
113 clock-names = "apb_pclk";
114 status = "disabled";
115 };
116
117 uart3: uart@00b03000 {
118 compatible = "arm,pl011", "arm,primecell";
119 reg = <0x00b03000 0x1000>;
120 interrupts = <0 52 4>;
121 clocks = <&clock HIX5HD2_FIXED_83M>;
122 clock-names = "apb_pclk";
123 status = "disabled";
124 };
125
126 uart4: uart@00b04000 {
127 compatible = "arm,pl011", "arm,primecell";
128 reg = <0xb04000 0x1000>;
129 interrupts = <0 53 4>;
130 clocks = <&clock HIX5HD2_FIXED_83M>;
131 clock-names = "apb_pclk";
132 status = "disabled";
133 };
134 };
135
136 local_timer@00a00600 {
137 compatible = "arm,cortex-a9-twd-timer";
138 reg = <0x00a00600 0x20>;
139 interrupts = <1 13 0xf01>;
140 };
141
142 l2: l2-cache {
143 compatible = "arm,pl310-cache";
144 reg = <0x00a10000 0x100000>;
145 interrupts = <0 15 4>;
146 cache-unified;
147 cache-level = <2>;
148 };
149
150 sysctrl: system-controller@00000000 {
151 compatible = "hisilicon,sysctrl";
152 reg = <0x00000000 0x1000>;
153 reboot-offset = <0x4>;
154 };
155
156 cpuctrl@00a22000 {
157 compatible = "hisilicon,cpuctrl";
158 #address-cells = <1>;
159 #size-cells = <1>;
160 reg = <0x00a22000 0x2000>;
161 ranges = <0 0x00a22000 0x2000>;
162
163 clock: clock@0 {
164 compatible = "hisilicon,hix5hd2-clock";
165 reg = <0 0x2000>;
166 #clock-cells = <1>;
167 };
168 };
169 };
170};
diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts
new file mode 100644
index 000000000000..68d0834a2d1e
--- /dev/null
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts
@@ -0,0 +1,73 @@
1/*
2 * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include "imx25-eukrea-mbimxsd25-baseboard.dts"
15
16/ {
17 model = "Eukrea MBIMXSD25 with the CMO-QVGA Display";
18 compatible = "eukrea,mbimxsd25-baseboard-cmo-qvga", "eukrea,mbimxsd25-baseboard", "eukrea,cpuimx25", "fsl,imx25";
19
20 cmo_qvga: display {
21 model = "CMO-QVGA";
22 bits-per-pixel = <16>;
23 fsl,pcr = <0xcad08b80>;
24 bus-width = <18>;
25 native-mode = <&qvga_timings>;
26 display-timings {
27 qvga_timings: 320x240 {
28 clock-frequency = <6500000>;
29 hactive = <320>;
30 vactive = <240>;
31 hback-porch = <30>;
32 hfront-porch = <38>;
33 vback-porch = <20>;
34 vfront-porch = <3>;
35 hsync-len = <15>;
36 vsync-len = <4>;
37 };
38 };
39 };
40
41 regulators {
42 compatible = "simple-bus";
43 #address-cells = <1>;
44 #size-cells = <0>;
45
46 reg_lcd_3v3: regulator@0 {
47 compatible = "regulator-fixed";
48 reg = <0>;
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_reg_lcd_3v3>;
51 regulator-name = "lcd-3v3";
52 regulator-min-microvolt = <3300000>;
53 regulator-max-microvolt = <3300000>;
54 gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
55 enable-active-high;
56 };
57 };
58};
59
60&iomuxc {
61 imx25-eukrea-mbimxsd25-baseboard-cmo-qvga {
62 pinctrl_reg_lcd_3v3: reg_lcd_3v3 {
63 fsl,pins = <MX25_PAD_PWM__GPIO_1_26 0x80000000>;
64 };
65 };
66};
67
68&lcdc {
69 display = <&cmo_qvga>;
70 fsl,lpccr = <0x00a903ff>;
71 lcd-supply = <&reg_lcd_3v3>;
72 status = "okay";
73};
diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts
new file mode 100644
index 000000000000..8eee2f65fe00
--- /dev/null
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include "imx25-eukrea-mbimxsd25-baseboard.dts"
15
16/ {
17 model = "Eukrea MBIMXSD25 with the DVI-SVGA Display";
18 compatible = "eukrea,mbimxsd25-baseboard-dvi-svga", "eukrea,mbimxsd25-baseboard", "eukrea,cpuimx25", "fsl,imx25";
19
20 dvi_svga: display {
21 model = "DVI-SVGA";
22 bits-per-pixel = <16>;
23 fsl,pcr = <0xfa208b80>;
24 bus-width = <18>;
25 native-mode = <&dvi_svga_timings>;
26 display-timings {
27 dvi_svga_timings: 800x600 {
28 clock-frequency = <40000000>;
29 hactive = <800>;
30 vactive = <600>;
31 hback-porch = <75>;
32 hfront-porch = <75>;
33 vback-porch = <7>;
34 vfront-porch = <75>;
35 hsync-len = <7>;
36 vsync-len = <7>;
37 };
38 };
39 };
40};
41
42&lcdc {
43 display = <&dvi_svga>;
44 status = "okay";
45};
diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts
new file mode 100644
index 000000000000..447da6263169
--- /dev/null
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include "imx25-eukrea-mbimxsd25-baseboard.dts"
15
16/ {
17 model = "Eukrea MBIMXSD25 with the DVI-VGA Display";
18 compatible = "eukrea,mbimxsd25-baseboard-dvi-vga", "eukrea,mbimxsd25-baseboard", "eukrea,cpuimx25", "fsl,imx25";
19
20 dvi_vga: display {
21 model = "DVI-VGA";
22 bits-per-pixel = <16>;
23 fsl,pcr = <0xfa208b80>;
24 bus-width = <18>;
25 native-mode = <&dvi_vga_timings>;
26 display-timings {
27 dvi_vga_timings: 640x480 {
28 clock-frequency = <31250000>;
29 hactive = <640>;
30 vactive = <480>;
31 hback-porch = <100>;
32 hfront-porch = <100>;
33 vback-porch = <7>;
34 vfront-porch = <100>;
35 hsync-len = <7>;
36 vsync-len = <7>;
37 };
38 };
39 };
40};
41
42&lcdc {
43 display = <&dvi_vga>;
44 status = "okay";
45};
diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
index ad12da38fc92..ed1d0b4578ef 100644
--- a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
+++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
@@ -155,7 +155,6 @@
155 155
156&ssi1 { 156&ssi1 {
157 codec-handle = <&tlv320aic23>; 157 codec-handle = <&tlv320aic23>;
158 fsl,mode = "i2s-slave";
159 status = "okay"; 158 status = "okay";
160}; 159};
161 160
diff --git a/arch/arm/boot/dts/imx25-pdk.dts b/arch/arm/boot/dts/imx25-pdk.dts
index c608942b8a3b..9c21b1583762 100644
--- a/arch/arm/boot/dts/imx25-pdk.dts
+++ b/arch/arm/boot/dts/imx25-pdk.dts
@@ -233,7 +233,6 @@
233 233
234&ssi1 { 234&ssi1 {
235 codec-handle = <&codec>; 235 codec-handle = <&codec>;
236 fsl,mode = "i2s-slave";
237 status = "okay"; 236 status = "okay";
238}; 237};
239 238
@@ -249,3 +248,10 @@
249 dr_mode = "host"; 248 dr_mode = "host";
250 status = "okay"; 249 status = "okay";
251}; 250};
251
252&usbotg {
253 phy_type = "utmi";
254 dr_mode = "otg";
255 external-vbus-divider;
256 status = "okay";
257};
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index bb74d9582b7e..c1740396b2c9 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -312,7 +312,7 @@
312 gpt4: timer@53f84000 { 312 gpt4: timer@53f84000 {
313 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt"; 313 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
314 reg = <0x53f84000 0x4000>; 314 reg = <0x53f84000 0x4000>;
315 clocks = <&clks 9>, <&clks 45>; 315 clocks = <&clks 95>, <&clks 47>;
316 clock-names = "ipg", "per"; 316 clock-names = "ipg", "per";
317 interrupts = <1>; 317 interrupts = <1>;
318 }; 318 };
@@ -320,7 +320,7 @@
320 gpt3: timer@53f88000 { 320 gpt3: timer@53f88000 {
321 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt"; 321 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
322 reg = <0x53f88000 0x4000>; 322 reg = <0x53f88000 0x4000>;
323 clocks = <&clks 9>, <&clks 47>; 323 clocks = <&clks 94>, <&clks 47>;
324 clock-names = "ipg", "per"; 324 clock-names = "ipg", "per";
325 interrupts = <29>; 325 interrupts = <29>;
326 }; 326 };
@@ -328,7 +328,7 @@
328 gpt2: timer@53f8c000 { 328 gpt2: timer@53f8c000 {
329 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt"; 329 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
330 reg = <0x53f8c000 0x4000>; 330 reg = <0x53f8c000 0x4000>;
331 clocks = <&clks 9>, <&clks 47>; 331 clocks = <&clks 93>, <&clks 47>;
332 clock-names = "ipg", "per"; 332 clock-names = "ipg", "per";
333 interrupts = <53>; 333 interrupts = <53>;
334 }; 334 };
@@ -336,7 +336,7 @@
336 gpt1: timer@53f90000 { 336 gpt1: timer@53f90000 {
337 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt"; 337 compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
338 reg = <0x53f90000 0x4000>; 338 reg = <0x53f90000 0x4000>;
339 clocks = <&clks 9>, <&clks 47>; 339 clocks = <&clks 92>, <&clks 47>;
340 clock-names = "ipg", "per"; 340 clock-names = "ipg", "per";
341 interrupts = <54>; 341 interrupts = <54>;
342 }; 342 };
diff --git a/arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi b/arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi
new file mode 100644
index 000000000000..e2242638ea0b
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi
@@ -0,0 +1,296 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx27.dtsi"
14
15/ {
16 model = "Eukrea CPUIMX27";
17 compatible = "eukrea,cpuimx27", "fsl,imx27";
18
19 memory {
20 reg = <0xa0000000 0x04000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <0>;
26 compatible = "simple-bus";
27
28 clk14745600: clock@0 {
29 #clock-cells = <0>;
30 compatible = "fixed-clock";
31 clock-frequency = <14745600>;
32 reg = <0>;
33 };
34 };
35};
36
37&fec {
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_fec>;
40 status = "okay";
41};
42
43&i2c1 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_i2c1>;
46 status = "okay";
47
48 pcf8563@51 {
49 compatible = "nxp,pcf8563";
50 reg = <0x51>;
51 };
52};
53
54&nfc {
55 pinctrl-names = "default";
56 pinctrl-0 = <&pinctrl_nfc>;
57 nand-bus-width = <8>;
58 nand-ecc-mode = "hw";
59 nand-on-flash-bbt;
60 status = "okay";
61};
62
63&owire {
64 pinctrl-names = "default";
65 pinctrl-0 = <&pinctrl_owire>;
66 status = "okay";
67};
68
69&sdhci2 {
70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_sdhc2>;
72 bus-width = <4>;
73 non-removable;
74 status = "okay";
75};
76
77&uart4 {
78 pinctrl-names = "default";
79 pinctrl-0 = <&pinctrl_uart4>;
80 fsl,uart-has-rtscts;
81 status = "okay";
82};
83
84&usbh2 {
85 pinctrl-names = "default";
86 pinctrl-0 = <&pinctrl_usbh2>;
87 dr_mode = "host";
88 phy_type = "ulpi";
89 disable-over-current;
90 status = "okay";
91};
92
93&usbotg {
94 pinctrl-names = "default";
95 pinctrl-0 = <&pinctrl_usbotg>;
96 dr_mode = "otg";
97 phy_type = "ulpi";
98 disable-over-current;
99 status = "okay";
100};
101
102&weim {
103 status = "okay";
104
105 nor: nor@0,0 {
106 #address-cells = <1>;
107 #size-cells = <1>;
108 compatible = "cfi-flash";
109 reg = <0 0x00000000 0x04000000>;
110 bank-width = <2>;
111 linux,mtd-name = "physmap-flash.0";
112 fsl,weim-cs-timing = <0x00008f03 0xa0330d01 0x002208c0>;
113 };
114
115 uart8250@3,200000 {
116 pinctrl-names = "default";
117 pinctrl-0 = <&pinctrl_uart8250_1>;
118 compatible = "ns8250";
119 clocks = <&clk14745600>;
120 fsl,weim-cs-timing = <0x0000d603 0x0d1d0d01 0x00d20000>;
121 interrupts = <&gpio2 23 IRQ_TYPE_LEVEL_LOW>;
122 reg = <3 0x200000 0x1000>;
123 reg-shift = <1>;
124 reg-io-width = <1>;
125 no-loopback-test;
126 };
127
128 uart8250@3,400000 {
129 pinctrl-names = "default";
130 pinctrl-0 = <&pinctrl_uart8250_2>;
131 compatible = "ns8250";
132 clocks = <&clk14745600>;
133 fsl,weim-cs-timing = <0x0000d603 0x0d1d0d01 0x00d20000>;
134 interrupts = <&gpio2 22 IRQ_TYPE_LEVEL_LOW>;
135 reg = <3 0x400000 0x1000>;
136 reg-shift = <1>;
137 reg-io-width = <1>;
138 no-loopback-test;
139 };
140
141 uart8250@3,800000 {
142 pinctrl-names = "default";
143 pinctrl-0 = <&pinctrl_uart8250_3>;
144 compatible = "ns8250";
145 clocks = <&clk14745600>;
146 fsl,weim-cs-timing = <0x0000d603 0x0d1d0d01 0x00d20000>;
147 interrupts = <&gpio2 27 IRQ_TYPE_LEVEL_LOW>;
148 reg = <3 0x800000 0x1000>;
149 reg-shift = <1>;
150 reg-io-width = <1>;
151 no-loopback-test;
152 };
153
154 uart8250@3,1000000 {
155 pinctrl-names = "default";
156 pinctrl-0 = <&pinctrl_uart8250_4>;
157 compatible = "ns8250";
158 clocks = <&clk14745600>;
159 fsl,weim-cs-timing = <0x0000d603 0x0d1d0d01 0x00d20000>;
160 interrupts = <&gpio2 30 IRQ_TYPE_LEVEL_LOW>;
161 reg = <3 0x1000000 0x1000>;
162 reg-shift = <1>;
163 reg-io-width = <1>;
164 no-loopback-test;
165 };
166};
167
168&iomuxc {
169 imx27-eukrea-cpuimx27 {
170 pinctrl_fec: fecgrp {
171 fsl,pins = <
172 MX27_PAD_SD3_CMD__FEC_TXD0 0x0
173 MX27_PAD_SD3_CLK__FEC_TXD1 0x0
174 MX27_PAD_ATA_DATA0__FEC_TXD2 0x0
175 MX27_PAD_ATA_DATA1__FEC_TXD3 0x0
176 MX27_PAD_ATA_DATA2__FEC_RX_ER 0x0
177 MX27_PAD_ATA_DATA3__FEC_RXD1 0x0
178 MX27_PAD_ATA_DATA4__FEC_RXD2 0x0
179 MX27_PAD_ATA_DATA5__FEC_RXD3 0x0
180 MX27_PAD_ATA_DATA6__FEC_MDIO 0x0
181 MX27_PAD_ATA_DATA7__FEC_MDC 0x0
182 MX27_PAD_ATA_DATA8__FEC_CRS 0x0
183 MX27_PAD_ATA_DATA9__FEC_TX_CLK 0x0
184 MX27_PAD_ATA_DATA10__FEC_RXD0 0x0
185 MX27_PAD_ATA_DATA11__FEC_RX_DV 0x0
186 MX27_PAD_ATA_DATA12__FEC_RX_CLK 0x0
187 MX27_PAD_ATA_DATA13__FEC_COL 0x0
188 MX27_PAD_ATA_DATA14__FEC_TX_ER 0x0
189 MX27_PAD_ATA_DATA15__FEC_TX_EN 0x0
190 >;
191 };
192
193 pinctrl_i2c1: i2c1grp {
194 fsl,pins = <
195 MX27_PAD_I2C_DATA__I2C_DATA 0x0
196 MX27_PAD_I2C_CLK__I2C_CLK 0x0
197 >;
198 };
199
200 pinctrl_nfc: nfcgrp {
201 fsl,pins = <
202 MX27_PAD_NFRB__NFRB 0x0
203 MX27_PAD_NFCLE__NFCLE 0x0
204 MX27_PAD_NFWP_B__NFWP_B 0x0
205 MX27_PAD_NFCE_B__NFCE_B 0x0
206 MX27_PAD_NFALE__NFALE 0x0
207 MX27_PAD_NFRE_B__NFRE_B 0x0
208 MX27_PAD_NFWE_B__NFWE_B 0x0
209 >;
210 };
211
212 pinctrl_owire: owiregrp {
213 fsl,pins = <
214 MX27_PAD_RTCK__OWIRE 0x0
215 >;
216 };
217
218 pinctrl_sdhc2: sdhc2grp {
219 fsl,pins = <
220 MX27_PAD_SD2_CLK__SD2_CLK 0x0
221 MX27_PAD_SD2_CMD__SD2_CMD 0x0
222 MX27_PAD_SD2_D0__SD2_D0 0x0
223 MX27_PAD_SD2_D1__SD2_D1 0x0
224 MX27_PAD_SD2_D2__SD2_D2 0x0
225 MX27_PAD_SD2_D3__SD2_D3 0x0
226 >;
227 };
228
229 pinctrl_uart4: uart4grp {
230 fsl,pins = <
231 MX27_PAD_USBH1_TXDM__UART4_TXD 0x0
232 MX27_PAD_USBH1_RXDP__UART4_RXD 0x0
233 MX27_PAD_USBH1_TXDP__UART4_CTS 0x0
234 MX27_PAD_USBH1_FS__UART4_RTS 0x0
235 >;
236 };
237
238 pinctrl_uart8250_1: uart82501grp {
239 fsl,pins = <
240 MX27_PAD_USB_PWR__GPIO2_23 0x0
241 >;
242 };
243
244 pinctrl_uart8250_2: uart82502grp {
245 fsl,pins = <
246 MX27_PAD_USBH1_SUSP__GPIO2_22 0x0
247 >;
248 };
249
250 pinctrl_uart8250_3: uart82503grp {
251 fsl,pins = <
252 MX27_PAD_USBH1_OE_B__GPIO2_27 0x0
253 >;
254 };
255
256 pinctrl_uart8250_4: uart82504grp {
257 fsl,pins = <
258 MX27_PAD_USBH1_RXDM__GPIO2_30 0x0
259 >;
260 };
261
262 pinctrl_usbh2: usbh2grp {
263 fsl,pins = <
264 MX27_PAD_USBH2_CLK__USBH2_CLK 0x0
265 MX27_PAD_USBH2_DIR__USBH2_DIR 0x0
266 MX27_PAD_USBH2_NXT__USBH2_NXT 0x0
267 MX27_PAD_USBH2_STP__USBH2_STP 0x0
268 MX27_PAD_CSPI2_SCLK__USBH2_DATA0 0x0
269 MX27_PAD_CSPI2_MOSI__USBH2_DATA1 0x0
270 MX27_PAD_CSPI2_MISO__USBH2_DATA2 0x0
271 MX27_PAD_CSPI2_SS1__USBH2_DATA3 0x0
272 MX27_PAD_CSPI2_SS2__USBH2_DATA4 0x0
273 MX27_PAD_CSPI1_SS2__USBH2_DATA5 0x0
274 MX27_PAD_CSPI2_SS0__USBH2_DATA6 0x0
275 MX27_PAD_USBH2_DATA7__USBH2_DATA7 0x0
276 >;
277 };
278
279 pinctrl_usbotg: usbotggrp {
280 fsl,pins = <
281 MX27_PAD_USBOTG_CLK__USBOTG_CLK 0x0
282 MX27_PAD_USBOTG_DIR__USBOTG_DIR 0x0
283 MX27_PAD_USBOTG_NXT__USBOTG_NXT 0x0
284 MX27_PAD_USBOTG_STP__USBOTG_STP 0x0
285 MX27_PAD_USBOTG_DATA0__USBOTG_DATA0 0x0
286 MX27_PAD_USBOTG_DATA1__USBOTG_DATA1 0x0
287 MX27_PAD_USBOTG_DATA2__USBOTG_DATA2 0x0
288 MX27_PAD_USBOTG_DATA3__USBOTG_DATA3 0x0
289 MX27_PAD_USBOTG_DATA4__USBOTG_DATA4 0x0
290 MX27_PAD_USBOTG_DATA5__USBOTG_DATA5 0x0
291 MX27_PAD_USBOTG_DATA6__USBOTG_DATA6 0x0
292 MX27_PAD_USBOTG_DATA7__USBOTG_DATA7 0x0
293 >;
294 };
295 };
296};
diff --git a/arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts b/arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts
new file mode 100644
index 000000000000..2ab65fc4c1e1
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts
@@ -0,0 +1,273 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include "imx27-eukrea-cpuimx27.dtsi"
13
14/ {
15 model = "Eukrea MBIMXSD27";
16 compatible = "eukrea,mbimxsd27-baseboard", "eukrea,cpuimx27", "fsl,imx27";
17
18 display0: CMO-QVGA {
19 model = "CMO-QVGA";
20 native-mode = <&timing0>;
21 bits-per-pixel = <16>;
22 fsl,pcr = <0xfad08b80>;
23
24 display-timings {
25 timing0: 320x240 {
26 clock-frequency = <6500000>;
27 hactive = <320>;
28 vactive = <240>;
29 hback-porch = <20>;
30 hsync-len = <30>;
31 hfront-porch = <38>;
32 vback-porch = <4>;
33 vsync-len = <3>;
34 vfront-porch = <15>;
35 };
36 };
37 };
38
39 backlight {
40 compatible = "gpio-backlight";
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_backlight>;
43 gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>;
44 };
45
46 leds {
47 compatible = "gpio-leds";
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_gpioleds>;
50
51 led1 {
52 label = "system::live";
53 gpios = <&gpio6 16 GPIO_ACTIVE_LOW>;
54 linux,default-trigger = "heartbeat";
55 };
56
57 led2 {
58 label = "system::user";
59 gpios = <&gpio6 19 GPIO_ACTIVE_LOW>;
60 };
61 };
62
63 regulators {
64 #address-cells = <1>;
65 #size-cells = <0>;
66 compatible = "simple-bus";
67
68 reg_lcd: regulator@0 {
69 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_lcdreg>;
71 compatible = "regulator-fixed";
72 reg = <0>;
73 regulator-name = "LCD";
74 regulator-min-microvolt = <5000000>;
75 regulator-max-microvolt = <5000000>;
76 gpio = <&gpio1 25 GPIO_ACTIVE_HIGH>;
77 enable-active-high;
78 };
79 };
80};
81
82&cspi1 {
83 pinctrl-0 = <&pinctrl_cspi1>;
84 fsl,spi-num-chipselects = <1>;
85 cs-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
86 status = "okay";
87
88 ads7846 {
89 compatible = "ti,ads7846";
90 pinctrl-names = "default";
91 pinctrl-0 = <&pinctrl_touch>;
92 reg = <0>;
93 interrupts = <&gpio4 25 IRQ_TYPE_LEVEL_LOW>;
94 spi-cpol;
95 spi-max-frequency = <1500000>;
96 ti,keep-vref-on;
97 };
98};
99
100&fb {
101 pinctrl-names = "default";
102 pinctrl-0 = <&pinctrl_imxfb>;
103 display = <&display0>;
104 lcd-supply = <&reg_lcd>;
105 fsl,dmacr = <0x00040060>;
106 fsl,lscr1 = <0x00120300>;
107 fsl,lpccr = <0x00a903ff>;
108 status = "okay";
109};
110
111&i2c1 {
112 codec: codec@1a {
113 compatible = "ti,tlv320aic23";
114 reg = <0x1a>;
115 };
116};
117
118&kpp {
119 linux,keymap = <
120 MATRIX_KEY(0, 0, KEY_UP)
121 MATRIX_KEY(0, 1, KEY_DOWN)
122 MATRIX_KEY(1, 0, KEY_RIGHT)
123 MATRIX_KEY(1, 1, KEY_LEFT)
124 >;
125 status = "okay";
126};
127
128&sdhci1 {
129 pinctrl-names = "default";
130 pinctrl-0 = <&pinctrl_sdhc1>;
131 bus-width = <4>;
132 status = "okay";
133};
134
135&ssi1 {
136 pinctrl-names = "default";
137 pinctrl-0 = <&pinctrl_ssi1>;
138 codec-handle = <&codec>;
139 status = "okay";
140};
141
142&uart1 {
143 fsl,uart-has-rtscts;
144 pinctrl-names = "default";
145 pinctrl-0 = <&pinctrl_uart1>;
146 status = "okay";
147};
148
149&uart2 {
150 fsl,uart-has-rtscts;
151 pinctrl-names = "default";
152 pinctrl-0 = <&pinctrl_uart2>;
153 status = "okay";
154};
155
156&uart3 {
157 fsl,uart-has-rtscts;
158 pinctrl-names = "default";
159 pinctrl-0 = <&pinctrl_uart3>;
160 status = "okay";
161};
162
163&iomuxc {
164 imx27-eukrea-cpuimx27-baseboard {
165 pinctrl_cspi1: cspi1grp {
166 fsl,pins = <
167 MX27_PAD_CSPI1_MISO__CSPI1_MISO 0x0
168 MX27_PAD_CSPI1_MOSI__CSPI1_MOSI 0x0
169 MX27_PAD_CSPI1_SCLK__CSPI1_SCLK 0x0
170 MX27_PAD_CSPI1_SS0__GPIO4_28 0x0 /* CS0 */
171 >;
172 };
173
174 pinctrl_backlight: backlightgrp {
175 fsl,pins = <
176 MX27_PAD_PWMO__GPIO5_5 0x0
177 >;
178 };
179
180 pinctrl_gpioleds: gpioledsgrp {
181 fsl,pins = <
182 MX27_PAD_PC_PWRON__GPIO6_16 0x0
183 MX27_PAD_PC_CD2_B__GPIO6_19 0x0
184 >;
185 };
186
187 pinctrl_imxfb: imxfbgrp {
188 fsl,pins = <
189 MX27_PAD_LD0__LD0 0x0
190 MX27_PAD_LD1__LD1 0x0
191 MX27_PAD_LD2__LD2 0x0
192 MX27_PAD_LD3__LD3 0x0
193 MX27_PAD_LD4__LD4 0x0
194 MX27_PAD_LD5__LD5 0x0
195 MX27_PAD_LD6__LD6 0x0
196 MX27_PAD_LD7__LD7 0x0
197 MX27_PAD_LD8__LD8 0x0
198 MX27_PAD_LD9__LD9 0x0
199 MX27_PAD_LD10__LD10 0x0
200 MX27_PAD_LD11__LD11 0x0
201 MX27_PAD_LD12__LD12 0x0
202 MX27_PAD_LD13__LD13 0x0
203 MX27_PAD_LD14__LD14 0x0
204 MX27_PAD_LD15__LD15 0x0
205 MX27_PAD_LD16__LD16 0x0
206 MX27_PAD_LD17__LD17 0x0
207 MX27_PAD_CONTRAST__CONTRAST 0x0
208 MX27_PAD_OE_ACD__OE_ACD 0x0
209 MX27_PAD_HSYNC__HSYNC 0x0
210 MX27_PAD_VSYNC__VSYNC 0x0
211 >;
212 };
213
214 pinctrl_lcdreg: lcdreggrp {
215 fsl,pins = <
216 MX27_PAD_CLS__GPIO1_25 0x0
217 >;
218 };
219
220 pinctrl_sdhc1: sdhc1grp {
221 fsl,pins = <
222 MX27_PAD_SD1_CLK__SD1_CLK 0x0
223 MX27_PAD_SD1_CMD__SD1_CMD 0x0
224 MX27_PAD_SD1_D0__SD1_D0 0x0
225 MX27_PAD_SD1_D1__SD1_D1 0x0
226 MX27_PAD_SD1_D2__SD1_D2 0x0
227 MX27_PAD_SD1_D3__SD1_D3 0x0
228 >;
229 };
230
231 pinctrl_ssi1: ssi1grp {
232 fsl,pins = <
233 MX27_PAD_SSI4_CLK__SSI4_CLK 0x0
234 MX27_PAD_SSI4_FS__SSI4_FS 0x0
235 MX27_PAD_SSI4_RXDAT__SSI4_RXDAT 0x1
236 MX27_PAD_SSI4_TXDAT__SSI4_TXDAT 0x1
237 >;
238 };
239
240 pinctrl_touch: touchgrp {
241 fsl,pins = <
242 MX27_PAD_CSPI1_RDY__GPIO4_25 0x0 /* IRQ */
243 >;
244 };
245
246 pinctrl_uart1: uart1grp {
247 fsl,pins = <
248 MX27_PAD_UART1_TXD__UART1_TXD 0x0
249 MX27_PAD_UART1_RXD__UART1_RXD 0x0
250 MX27_PAD_UART1_CTS__UART1_CTS 0x0
251 MX27_PAD_UART1_RTS__UART1_RTS 0x0
252 >;
253 };
254
255 pinctrl_uart2: uart2grp {
256 fsl,pins = <
257 MX27_PAD_UART2_TXD__UART2_TXD 0x0
258 MX27_PAD_UART2_RXD__UART2_RXD 0x0
259 MX27_PAD_UART2_CTS__UART2_CTS 0x0
260 MX27_PAD_UART2_RTS__UART2_RTS 0x0
261 >;
262 };
263
264 pinctrl_uart3: uart3grp {
265 fsl,pins = <
266 MX27_PAD_UART3_TXD__UART3_TXD 0x0
267 MX27_PAD_UART3_RXD__UART3_RXD 0x0
268 MX27_PAD_UART3_CTS__UART3_CTS 0x0
269 MX27_PAD_UART3_RTS__UART3_RTS 0x0
270 >;
271 };
272 };
273};
diff --git a/arch/arm/boot/dts/imx27-pdk.dts b/arch/arm/boot/dts/imx27-pdk.dts
index 4c317716b510..49450dbbcab8 100644
--- a/arch/arm/boot/dts/imx27-pdk.dts
+++ b/arch/arm/boot/dts/imx27-pdk.dts
@@ -28,7 +28,7 @@
28 usbphy0: usbphy@0 { 28 usbphy0: usbphy@0 {
29 compatible = "usb-nop-xceiv"; 29 compatible = "usb-nop-xceiv";
30 reg = <0>; 30 reg = <0>;
31 clocks = <&clks 0>; 31 clocks = <&clks IMX27_CLK_DUMMY>;
32 clock-names = "main_clk"; 32 clock-names = "main_clk";
33 }; 33 };
34 }; 34 };
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts b/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
index fe02bc7a24fd..538568b0de26 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
@@ -61,7 +61,7 @@
61 compatible = "usb-nop-xceiv"; 61 compatible = "usb-nop-xceiv";
62 reg = <2>; 62 reg = <2>;
63 vcc-supply = <&reg_5v0>; 63 vcc-supply = <&reg_5v0>;
64 clocks = <&clks 0>; 64 clocks = <&clks IMX27_CLK_DUMMY>;
65 clock-names = "main_clk"; 65 clock-names = "main_clk";
66 }; 66 };
67 }; 67 };
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi
index 31e9f7049f73..b4e955e3be8d 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi
+++ b/arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi
@@ -51,7 +51,7 @@
51 compatible = "usb-nop-xceiv"; 51 compatible = "usb-nop-xceiv";
52 reg = <0>; 52 reg = <0>;
53 vcc-supply = <&sw3_reg>; 53 vcc-supply = <&sw3_reg>;
54 clocks = <&clks 0>; 54 clocks = <&clks IMX27_CLK_DUMMY>;
55 clock-names = "main_clk"; 55 clock-names = "main_clk";
56 }; 56 };
57 }; 57 };
@@ -310,7 +310,6 @@
310&ssi1 { 310&ssi1 {
311 pinctrl-names = "default"; 311 pinctrl-names = "default";
312 pinctrl-0 = <&pinctrl_ssi1>; 312 pinctrl-0 = <&pinctrl_ssi1>;
313 fsl,mode = "i2s-slave";
314 status = "okay"; 313 status = "okay";
315}; 314};
316 315
diff --git a/arch/arm/boot/dts/imx27-pinfunc.h b/arch/arm/boot/dts/imx27-pinfunc.h
index f5387b4de577..597bb5f74dcc 100644
--- a/arch/arm/boot/dts/imx27-pinfunc.h
+++ b/arch/arm/boot/dts/imx27-pinfunc.h
@@ -101,14 +101,6 @@
101#define MX27_PAD_CONTRAST__GPIO1_30 0x1e 0x032 101#define MX27_PAD_CONTRAST__GPIO1_30 0x1e 0x032
102#define MX27_PAD_OE_ACD__OE_ACD 0x1f 0x004 102#define MX27_PAD_OE_ACD__OE_ACD 0x1f 0x004
103#define MX27_PAD_OE_ACD__GPIO1_31 0x1f 0x032 103#define MX27_PAD_OE_ACD__GPIO1_31 0x1f 0x032
104#define MX27_PAD_UNUSED0__UNUSED0 0x20 0x004
105#define MX27_PAD_UNUSED0__GPIO2_0 0x20 0x032
106#define MX27_PAD_UNUSED1__UNUSED1 0x21 0x004
107#define MX27_PAD_UNUSED1__GPIO2_1 0x21 0x032
108#define MX27_PAD_UNUSED2__UNUSED2 0x22 0x004
109#define MX27_PAD_UNUSED2__GPIO2_2 0x22 0x032
110#define MX27_PAD_UNUSED3__UNUSED3 0x23 0x004
111#define MX27_PAD_UNUSED3__GPIO2_3 0x23 0x032
112#define MX27_PAD_SD2_D0__SD2_D0 0x24 0x004 104#define MX27_PAD_SD2_D0__SD2_D0 0x24 0x004
113#define MX27_PAD_SD2_D0__MSHC_DATA0 0x24 0x005 105#define MX27_PAD_SD2_D0__MSHC_DATA0 0x24 0x005
114#define MX27_PAD_SD2_D0__GPIO2_4 0x24 0x032 106#define MX27_PAD_SD2_D0__GPIO2_4 0x24 0x032
@@ -183,16 +175,6 @@
183#define MX27_PAD_USBH1_RXDP__USBH1_RXDP 0x3f 0x004 175#define MX27_PAD_USBH1_RXDP__USBH1_RXDP 0x3f 0x004
184#define MX27_PAD_USBH1_RXDP__UART4_RXD 0x3f 0x001 176#define MX27_PAD_USBH1_RXDP__UART4_RXD 0x3f 0x001
185#define MX27_PAD_USBH1_RXDP__GPIO2_31 0x3f 0x032 177#define MX27_PAD_USBH1_RXDP__GPIO2_31 0x3f 0x032
186#define MX27_PAD_UNUSED4__UNUSED4 0x40 0x004
187#define MX27_PAD_UNUSED4__GPIO3_0 0x40 0x032
188#define MX27_PAD_UNUSED5__UNUSED5 0x41 0x004
189#define MX27_PAD_UNUSED5__GPIO3_1 0x41 0x032
190#define MX27_PAD_UNUSED6__UNUSED6 0x42 0x004
191#define MX27_PAD_UNUSED6__GPIO3_2 0x42 0x032
192#define MX27_PAD_UNUSED7__UNUSED7 0x43 0x004
193#define MX27_PAD_UNUSED7__GPIO3_3 0x43 0x032
194#define MX27_PAD_UNUSED8__UNUSED8 0x44 0x004
195#define MX27_PAD_UNUSED8__GPIO3_4 0x44 0x032
196#define MX27_PAD_I2C2_SDA__I2C2_SDA 0x45 0x004 178#define MX27_PAD_I2C2_SDA__I2C2_SDA 0x45 0x004
197#define MX27_PAD_I2C2_SDA__GPIO3_5 0x45 0x032 179#define MX27_PAD_I2C2_SDA__GPIO3_5 0x45 0x032
198#define MX27_PAD_I2C2_SCL__I2C2_SCL 0x46 0x004 180#define MX27_PAD_I2C2_SCL__I2C2_SCL 0x46 0x004
@@ -422,18 +404,6 @@
422#define MX27_PAD_USBOTG_CLK__GPIO5_24 0x98 0x032 404#define MX27_PAD_USBOTG_CLK__GPIO5_24 0x98 0x032
423#define MX27_PAD_USBOTG_DATA7__USBOTG_DATA7 0x99 0x004 405#define MX27_PAD_USBOTG_DATA7__USBOTG_DATA7 0x99 0x004
424#define MX27_PAD_USBOTG_DATA7__GPIO5_25 0x99 0x032 406#define MX27_PAD_USBOTG_DATA7__GPIO5_25 0x99 0x032
425#define MX27_PAD_UNUSED9__UNUSED9 0x9a 0x004
426#define MX27_PAD_UNUSED9__GPIO5_26 0x9a 0x032
427#define MX27_PAD_UNUSED10__UNUSED10 0x9b 0x004
428#define MX27_PAD_UNUSED10__GPIO5_27 0x9b 0x032
429#define MX27_PAD_UNUSED11__UNUSED11 0x9c 0x004
430#define MX27_PAD_UNUSED11__GPIO5_28 0x9c 0x032
431#define MX27_PAD_UNUSED12__UNUSED12 0x9d 0x004
432#define MX27_PAD_UNUSED12__GPIO5_29 0x9d 0x032
433#define MX27_PAD_UNUSED13__UNUSED13 0x9e 0x004
434#define MX27_PAD_UNUSED13__GPIO5_30 0x9e 0x032
435#define MX27_PAD_UNUSED14__UNUSED14 0x9f 0x004
436#define MX27_PAD_UNUSED14__GPIO5_31 0x9f 0x032
437#define MX27_PAD_NFRB__NFRB 0xa0 0x000 407#define MX27_PAD_NFRB__NFRB 0xa0 0x000
438#define MX27_PAD_NFRB__ETMTRACEPKT3 0xa0 0x005 408#define MX27_PAD_NFRB__ETMTRACEPKT3 0xa0 0x005
439#define MX27_PAD_NFRB__GPIO6_0 0xa0 0x032 409#define MX27_PAD_NFRB__GPIO6_0 0xa0 0x032
@@ -506,21 +476,5 @@
506#define MX27_PAD_ATA_DATA15__ETMTRACEPKT4 0xb7 0x005 476#define MX27_PAD_ATA_DATA15__ETMTRACEPKT4 0xb7 0x005
507#define MX27_PAD_ATA_DATA15__FEC_TX_EN 0xb7 0x006 477#define MX27_PAD_ATA_DATA15__FEC_TX_EN 0xb7 0x006
508#define MX27_PAD_ATA_DATA15__GPIO6_23 0xb7 0x032 478#define MX27_PAD_ATA_DATA15__GPIO6_23 0xb7 0x032
509#define MX27_PAD_UNUSED15__UNUSED15 0xb8 0x004
510#define MX27_PAD_UNUSED15__GPIO6_24 0xb8 0x032
511#define MX27_PAD_UNUSED16__UNUSED16 0xb9 0x004
512#define MX27_PAD_UNUSED16__GPIO6_25 0xb9 0x032
513#define MX27_PAD_UNUSED17__UNUSED17 0xba 0x004
514#define MX27_PAD_UNUSED17__GPIO6_26 0xba 0x032
515#define MX27_PAD_UNUSED18__UNUSED18 0xbb 0x004
516#define MX27_PAD_UNUSED18__GPIO6_27 0xbb 0x032
517#define MX27_PAD_UNUSED19__UNUSED19 0xbc 0x004
518#define MX27_PAD_UNUSED19__GPIO6_28 0xbc 0x032
519#define MX27_PAD_UNUSED20__UNUSED20 0xbd 0x004
520#define MX27_PAD_UNUSED20__GPIO6_29 0xbd 0x032
521#define MX27_PAD_UNUSED21__UNUSED21 0xbe 0x004
522#define MX27_PAD_UNUSED21__GPIO6_30 0xbe 0x032
523#define MX27_PAD_UNUSED22__UNUSED22 0xbf 0x004
524#define MX27_PAD_UNUSED22__GPIO6_31 0xbf 0x032
525 479
526#endif /* __DTS_IMX27_PINFUNC_H */ 480#endif /* __DTS_IMX27_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index a75555c39533..107d713e1cbe 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -11,9 +11,11 @@
11 11
12#include "skeleton.dtsi" 12#include "skeleton.dtsi"
13#include "imx27-pinfunc.h" 13#include "imx27-pinfunc.h"
14
15#include <dt-bindings/clock/imx27-clock.h>
16#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h> 17#include <dt-bindings/input/input.h>
15#include <dt-bindings/interrupt-controller/irq.h> 18#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h>
17 19
18/ { 20/ {
19 aliases { 21 aliases {
@@ -68,7 +70,7 @@
68 399000 1450000 70 399000 1450000
69 >; 71 >;
70 clock-latency = <62500>; 72 clock-latency = <62500>;
71 clocks = <&clks 18>; 73 clocks = <&clks IMX27_CLK_CPU_DIV>;
72 voltage-tolerance = <5>; 74 voltage-tolerance = <5>;
73 }; 75 };
74 }; 76 };
@@ -91,7 +93,8 @@
91 compatible = "fsl,imx27-dma"; 93 compatible = "fsl,imx27-dma";
92 reg = <0x10001000 0x1000>; 94 reg = <0x10001000 0x1000>;
93 interrupts = <32>; 95 interrupts = <32>;
94 clocks = <&clks 50>, <&clks 70>; 96 clocks = <&clks IMX27_CLK_DMA_IPG_GATE>,
97 <&clks IMX27_CLK_DMA_AHB_GATE>;
95 clock-names = "ipg", "ahb"; 98 clock-names = "ipg", "ahb";
96 #dma-cells = <1>; 99 #dma-cells = <1>;
97 #dma-channels = <16>; 100 #dma-channels = <16>;
@@ -101,14 +104,15 @@
101 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; 104 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt";
102 reg = <0x10002000 0x1000>; 105 reg = <0x10002000 0x1000>;
103 interrupts = <27>; 106 interrupts = <27>;
104 clocks = <&clks 74>; 107 clocks = <&clks IMX27_CLK_WDOG_IPG_GATE>;
105 }; 108 };
106 109
107 gpt1: timer@10003000 { 110 gpt1: timer@10003000 {
108 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 111 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
109 reg = <0x10003000 0x1000>; 112 reg = <0x10003000 0x1000>;
110 interrupts = <26>; 113 interrupts = <26>;
111 clocks = <&clks 46>, <&clks 61>; 114 clocks = <&clks IMX27_CLK_GPT1_IPG_GATE>,
115 <&clks IMX27_CLK_PER1_GATE>;
112 clock-names = "ipg", "per"; 116 clock-names = "ipg", "per";
113 }; 117 };
114 118
@@ -116,7 +120,8 @@
116 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 120 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
117 reg = <0x10004000 0x1000>; 121 reg = <0x10004000 0x1000>;
118 interrupts = <25>; 122 interrupts = <25>;
119 clocks = <&clks 45>, <&clks 61>; 123 clocks = <&clks IMX27_CLK_GPT2_IPG_GATE>,
124 <&clks IMX27_CLK_PER1_GATE>;
120 clock-names = "ipg", "per"; 125 clock-names = "ipg", "per";
121 }; 126 };
122 127
@@ -124,7 +129,8 @@
124 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 129 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
125 reg = <0x10005000 0x1000>; 130 reg = <0x10005000 0x1000>;
126 interrupts = <24>; 131 interrupts = <24>;
127 clocks = <&clks 44>, <&clks 61>; 132 clocks = <&clks IMX27_CLK_GPT3_IPG_GATE>,
133 <&clks IMX27_CLK_PER1_GATE>;
128 clock-names = "ipg", "per"; 134 clock-names = "ipg", "per";
129 }; 135 };
130 136
@@ -133,7 +139,8 @@
133 compatible = "fsl,imx27-pwm"; 139 compatible = "fsl,imx27-pwm";
134 reg = <0x10006000 0x1000>; 140 reg = <0x10006000 0x1000>;
135 interrupts = <23>; 141 interrupts = <23>;
136 clocks = <&clks 34>, <&clks 61>; 142 clocks = <&clks IMX27_CLK_PWM_IPG_GATE>,
143 <&clks IMX27_CLK_PER1_GATE>;
137 clock-names = "ipg", "per"; 144 clock-names = "ipg", "per";
138 }; 145 };
139 146
@@ -141,14 +148,14 @@
141 compatible = "fsl,imx27-kpp", "fsl,imx21-kpp"; 148 compatible = "fsl,imx27-kpp", "fsl,imx21-kpp";
142 reg = <0x10008000 0x1000>; 149 reg = <0x10008000 0x1000>;
143 interrupts = <21>; 150 interrupts = <21>;
144 clocks = <&clks 37>; 151 clocks = <&clks IMX27_CLK_KPP_IPG_GATE>;
145 status = "disabled"; 152 status = "disabled";
146 }; 153 };
147 154
148 owire: owire@10009000 { 155 owire: owire@10009000 {
149 compatible = "fsl,imx27-owire", "fsl,imx21-owire"; 156 compatible = "fsl,imx27-owire", "fsl,imx21-owire";
150 reg = <0x10009000 0x1000>; 157 reg = <0x10009000 0x1000>;
151 clocks = <&clks 35>; 158 clocks = <&clks IMX27_CLK_OWIRE_IPG_GATE>;
152 status = "disabled"; 159 status = "disabled";
153 }; 160 };
154 161
@@ -156,7 +163,8 @@
156 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 163 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
157 reg = <0x1000a000 0x1000>; 164 reg = <0x1000a000 0x1000>;
158 interrupts = <20>; 165 interrupts = <20>;
159 clocks = <&clks 81>, <&clks 61>; 166 clocks = <&clks IMX27_CLK_UART1_IPG_GATE>,
167 <&clks IMX27_CLK_PER1_GATE>;
160 clock-names = "ipg", "per"; 168 clock-names = "ipg", "per";
161 status = "disabled"; 169 status = "disabled";
162 }; 170 };
@@ -165,7 +173,8 @@
165 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 173 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
166 reg = <0x1000b000 0x1000>; 174 reg = <0x1000b000 0x1000>;
167 interrupts = <19>; 175 interrupts = <19>;
168 clocks = <&clks 80>, <&clks 61>; 176 clocks = <&clks IMX27_CLK_UART2_IPG_GATE>,
177 <&clks IMX27_CLK_PER1_GATE>;
169 clock-names = "ipg", "per"; 178 clock-names = "ipg", "per";
170 status = "disabled"; 179 status = "disabled";
171 }; 180 };
@@ -174,7 +183,8 @@
174 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 183 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
175 reg = <0x1000c000 0x1000>; 184 reg = <0x1000c000 0x1000>;
176 interrupts = <18>; 185 interrupts = <18>;
177 clocks = <&clks 79>, <&clks 61>; 186 clocks = <&clks IMX27_CLK_UART3_IPG_GATE>,
187 <&clks IMX27_CLK_PER1_GATE>;
178 clock-names = "ipg", "per"; 188 clock-names = "ipg", "per";
179 status = "disabled"; 189 status = "disabled";
180 }; 190 };
@@ -183,7 +193,8 @@
183 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 193 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
184 reg = <0x1000d000 0x1000>; 194 reg = <0x1000d000 0x1000>;
185 interrupts = <17>; 195 interrupts = <17>;
186 clocks = <&clks 78>, <&clks 61>; 196 clocks = <&clks IMX27_CLK_UART4_IPG_GATE>,
197 <&clks IMX27_CLK_PER1_GATE>;
187 clock-names = "ipg", "per"; 198 clock-names = "ipg", "per";
188 status = "disabled"; 199 status = "disabled";
189 }; 200 };
@@ -194,7 +205,8 @@
194 compatible = "fsl,imx27-cspi"; 205 compatible = "fsl,imx27-cspi";
195 reg = <0x1000e000 0x1000>; 206 reg = <0x1000e000 0x1000>;
196 interrupts = <16>; 207 interrupts = <16>;
197 clocks = <&clks 53>, <&clks 60>; 208 clocks = <&clks IMX27_CLK_CSPI1_IPG_GATE>,
209 <&clks IMX27_CLK_PER2_GATE>;
198 clock-names = "ipg", "per"; 210 clock-names = "ipg", "per";
199 status = "disabled"; 211 status = "disabled";
200 }; 212 };
@@ -205,7 +217,8 @@
205 compatible = "fsl,imx27-cspi"; 217 compatible = "fsl,imx27-cspi";
206 reg = <0x1000f000 0x1000>; 218 reg = <0x1000f000 0x1000>;
207 interrupts = <15>; 219 interrupts = <15>;
208 clocks = <&clks 52>, <&clks 60>; 220 clocks = <&clks IMX27_CLK_CSPI2_IPG_GATE>,
221 <&clks IMX27_CLK_PER2_GATE>;
209 clock-names = "ipg", "per"; 222 clock-names = "ipg", "per";
210 status = "disabled"; 223 status = "disabled";
211 }; 224 };
@@ -215,7 +228,7 @@
215 compatible = "fsl,imx27-ssi", "fsl,imx21-ssi"; 228 compatible = "fsl,imx27-ssi", "fsl,imx21-ssi";
216 reg = <0x10010000 0x1000>; 229 reg = <0x10010000 0x1000>;
217 interrupts = <14>; 230 interrupts = <14>;
218 clocks = <&clks 26>; 231 clocks = <&clks IMX27_CLK_SSI1_IPG_GATE>;
219 dmas = <&dma 12>, <&dma 13>, <&dma 14>, <&dma 15>; 232 dmas = <&dma 12>, <&dma 13>, <&dma 14>, <&dma 15>;
220 dma-names = "rx0", "tx0", "rx1", "tx1"; 233 dma-names = "rx0", "tx0", "rx1", "tx1";
221 fsl,fifo-depth = <8>; 234 fsl,fifo-depth = <8>;
@@ -227,7 +240,7 @@
227 compatible = "fsl,imx27-ssi", "fsl,imx21-ssi"; 240 compatible = "fsl,imx27-ssi", "fsl,imx21-ssi";
228 reg = <0x10011000 0x1000>; 241 reg = <0x10011000 0x1000>;
229 interrupts = <13>; 242 interrupts = <13>;
230 clocks = <&clks 25>; 243 clocks = <&clks IMX27_CLK_SSI2_IPG_GATE>;
231 dmas = <&dma 8>, <&dma 9>, <&dma 10>, <&dma 11>; 244 dmas = <&dma 8>, <&dma 9>, <&dma 10>, <&dma 11>;
232 dma-names = "rx0", "tx0", "rx1", "tx1"; 245 dma-names = "rx0", "tx0", "rx1", "tx1";
233 fsl,fifo-depth = <8>; 246 fsl,fifo-depth = <8>;
@@ -240,7 +253,7 @@
240 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; 253 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
241 reg = <0x10012000 0x1000>; 254 reg = <0x10012000 0x1000>;
242 interrupts = <12>; 255 interrupts = <12>;
243 clocks = <&clks 40>; 256 clocks = <&clks IMX27_CLK_I2C1_IPG_GATE>;
244 status = "disabled"; 257 status = "disabled";
245 }; 258 };
246 259
@@ -248,7 +261,8 @@
248 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc"; 261 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
249 reg = <0x10013000 0x1000>; 262 reg = <0x10013000 0x1000>;
250 interrupts = <11>; 263 interrupts = <11>;
251 clocks = <&clks 30>, <&clks 60>; 264 clocks = <&clks IMX27_CLK_SDHC1_IPG_GATE>,
265 <&clks IMX27_CLK_PER2_GATE>;
252 clock-names = "ipg", "per"; 266 clock-names = "ipg", "per";
253 dmas = <&dma 7>; 267 dmas = <&dma 7>;
254 dma-names = "rx-tx"; 268 dma-names = "rx-tx";
@@ -259,7 +273,8 @@
259 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc"; 273 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
260 reg = <0x10014000 0x1000>; 274 reg = <0x10014000 0x1000>;
261 interrupts = <10>; 275 interrupts = <10>;
262 clocks = <&clks 29>, <&clks 60>; 276 clocks = <&clks IMX27_CLK_SDHC2_IPG_GATE>,
277 <&clks IMX27_CLK_PER2_GATE>;
263 clock-names = "ipg", "per"; 278 clock-names = "ipg", "per";
264 dmas = <&dma 6>; 279 dmas = <&dma 6>;
265 dma-names = "rx-tx"; 280 dma-names = "rx-tx";
@@ -276,6 +291,7 @@
276 gpio1: gpio@10015000 { 291 gpio1: gpio@10015000 {
277 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 292 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
278 reg = <0x10015000 0x100>; 293 reg = <0x10015000 0x100>;
294 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
279 interrupts = <8>; 295 interrupts = <8>;
280 gpio-controller; 296 gpio-controller;
281 #gpio-cells = <2>; 297 #gpio-cells = <2>;
@@ -286,6 +302,7 @@
286 gpio2: gpio@10015100 { 302 gpio2: gpio@10015100 {
287 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 303 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
288 reg = <0x10015100 0x100>; 304 reg = <0x10015100 0x100>;
305 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
289 interrupts = <8>; 306 interrupts = <8>;
290 gpio-controller; 307 gpio-controller;
291 #gpio-cells = <2>; 308 #gpio-cells = <2>;
@@ -296,6 +313,7 @@
296 gpio3: gpio@10015200 { 313 gpio3: gpio@10015200 {
297 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 314 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
298 reg = <0x10015200 0x100>; 315 reg = <0x10015200 0x100>;
316 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
299 interrupts = <8>; 317 interrupts = <8>;
300 gpio-controller; 318 gpio-controller;
301 #gpio-cells = <2>; 319 #gpio-cells = <2>;
@@ -306,6 +324,7 @@
306 gpio4: gpio@10015300 { 324 gpio4: gpio@10015300 {
307 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 325 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
308 reg = <0x10015300 0x100>; 326 reg = <0x10015300 0x100>;
327 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
309 interrupts = <8>; 328 interrupts = <8>;
310 gpio-controller; 329 gpio-controller;
311 #gpio-cells = <2>; 330 #gpio-cells = <2>;
@@ -316,6 +335,7 @@
316 gpio5: gpio@10015400 { 335 gpio5: gpio@10015400 {
317 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 336 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
318 reg = <0x10015400 0x100>; 337 reg = <0x10015400 0x100>;
338 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
319 interrupts = <8>; 339 interrupts = <8>;
320 gpio-controller; 340 gpio-controller;
321 #gpio-cells = <2>; 341 #gpio-cells = <2>;
@@ -326,6 +346,7 @@
326 gpio6: gpio@10015500 { 346 gpio6: gpio@10015500 {
327 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 347 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
328 reg = <0x10015500 0x100>; 348 reg = <0x10015500 0x100>;
349 clocks = <&clks IMX27_CLK_GPIO_IPG_GATE>;
329 interrupts = <8>; 350 interrupts = <8>;
330 gpio-controller; 351 gpio-controller;
331 #gpio-cells = <2>; 352 #gpio-cells = <2>;
@@ -337,7 +358,7 @@
337 audmux: audmux@10016000 { 358 audmux: audmux@10016000 {
338 compatible = "fsl,imx27-audmux", "fsl,imx21-audmux"; 359 compatible = "fsl,imx27-audmux", "fsl,imx21-audmux";
339 reg = <0x10016000 0x1000>; 360 reg = <0x10016000 0x1000>;
340 clocks = <&clks 0>; 361 clocks = <&clks IMX27_CLK_DUMMY>;
341 clock-names = "audmux"; 362 clock-names = "audmux";
342 status = "disabled"; 363 status = "disabled";
343 }; 364 };
@@ -348,7 +369,8 @@
348 compatible = "fsl,imx27-cspi"; 369 compatible = "fsl,imx27-cspi";
349 reg = <0x10017000 0x1000>; 370 reg = <0x10017000 0x1000>;
350 interrupts = <6>; 371 interrupts = <6>;
351 clocks = <&clks 51>, <&clks 60>; 372 clocks = <&clks IMX27_CLK_CSPI3_IPG_GATE>,
373 <&clks IMX27_CLK_PER2_GATE>;
352 clock-names = "ipg", "per"; 374 clock-names = "ipg", "per";
353 status = "disabled"; 375 status = "disabled";
354 }; 376 };
@@ -357,7 +379,8 @@
357 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 379 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
358 reg = <0x10019000 0x1000>; 380 reg = <0x10019000 0x1000>;
359 interrupts = <4>; 381 interrupts = <4>;
360 clocks = <&clks 43>, <&clks 61>; 382 clocks = <&clks IMX27_CLK_GPT4_IPG_GATE>,
383 <&clks IMX27_CLK_PER1_GATE>;
361 clock-names = "ipg", "per"; 384 clock-names = "ipg", "per";
362 }; 385 };
363 386
@@ -365,7 +388,8 @@
365 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 388 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
366 reg = <0x1001a000 0x1000>; 389 reg = <0x1001a000 0x1000>;
367 interrupts = <3>; 390 interrupts = <3>;
368 clocks = <&clks 42>, <&clks 61>; 391 clocks = <&clks IMX27_CLK_GPT5_IPG_GATE>,
392 <&clks IMX27_CLK_PER1_GATE>;
369 clock-names = "ipg", "per"; 393 clock-names = "ipg", "per";
370 }; 394 };
371 395
@@ -373,7 +397,8 @@
373 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 397 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
374 reg = <0x1001b000 0x1000>; 398 reg = <0x1001b000 0x1000>;
375 interrupts = <49>; 399 interrupts = <49>;
376 clocks = <&clks 77>, <&clks 61>; 400 clocks = <&clks IMX27_CLK_UART5_IPG_GATE>,
401 <&clks IMX27_CLK_PER1_GATE>;
377 clock-names = "ipg", "per"; 402 clock-names = "ipg", "per";
378 status = "disabled"; 403 status = "disabled";
379 }; 404 };
@@ -382,7 +407,8 @@
382 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 407 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
383 reg = <0x1001c000 0x1000>; 408 reg = <0x1001c000 0x1000>;
384 interrupts = <48>; 409 interrupts = <48>;
385 clocks = <&clks 78>, <&clks 61>; 410 clocks = <&clks IMX27_CLK_UART6_IPG_GATE>,
411 <&clks IMX27_CLK_PER1_GATE>;
386 clock-names = "ipg", "per"; 412 clock-names = "ipg", "per";
387 status = "disabled"; 413 status = "disabled";
388 }; 414 };
@@ -393,7 +419,7 @@
393 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; 419 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
394 reg = <0x1001d000 0x1000>; 420 reg = <0x1001d000 0x1000>;
395 interrupts = <1>; 421 interrupts = <1>;
396 clocks = <&clks 39>; 422 clocks = <&clks IMX27_CLK_I2C2_IPG_GATE>;
397 status = "disabled"; 423 status = "disabled";
398 }; 424 };
399 425
@@ -401,7 +427,8 @@
401 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc"; 427 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
402 reg = <0x1001e000 0x1000>; 428 reg = <0x1001e000 0x1000>;
403 interrupts = <9>; 429 interrupts = <9>;
404 clocks = <&clks 28>, <&clks 60>; 430 clocks = <&clks IMX27_CLK_SDHC3_IPG_GATE>,
431 <&clks IMX27_CLK_PER2_GATE>;
405 clock-names = "ipg", "per"; 432 clock-names = "ipg", "per";
406 dmas = <&dma 36>; 433 dmas = <&dma 36>;
407 dma-names = "rx-tx"; 434 dma-names = "rx-tx";
@@ -412,7 +439,8 @@
412 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 439 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
413 reg = <0x1001f000 0x1000>; 440 reg = <0x1001f000 0x1000>;
414 interrupts = <2>; 441 interrupts = <2>;
415 clocks = <&clks 41>, <&clks 61>; 442 clocks = <&clks IMX27_CLK_GPT6_IPG_GATE>,
443 <&clks IMX27_CLK_PER1_GATE>;
416 clock-names = "ipg", "per"; 444 clock-names = "ipg", "per";
417 }; 445 };
418 }; 446 };
@@ -428,7 +456,9 @@
428 compatible = "fsl,imx27-fb", "fsl,imx21-fb"; 456 compatible = "fsl,imx27-fb", "fsl,imx21-fb";
429 interrupts = <61>; 457 interrupts = <61>;
430 reg = <0x10021000 0x1000>; 458 reg = <0x10021000 0x1000>;
431 clocks = <&clks 36>, <&clks 65>, <&clks 59>; 459 clocks = <&clks IMX27_CLK_LCDC_IPG_GATE>,
460 <&clks IMX27_CLK_LCDC_AHB_GATE>,
461 <&clks IMX27_CLK_PER3_GATE>;
432 clock-names = "ipg", "ahb", "per"; 462 clock-names = "ipg", "ahb", "per";
433 status = "disabled"; 463 status = "disabled";
434 }; 464 };
@@ -437,7 +467,8 @@
437 compatible = "fsl,imx27-vpu"; 467 compatible = "fsl,imx27-vpu";
438 reg = <0x10023000 0x0200>; 468 reg = <0x10023000 0x0200>;
439 interrupts = <53>; 469 interrupts = <53>;
440 clocks = <&clks 57>, <&clks 66>; 470 clocks = <&clks IMX27_CLK_VPU_BAUD_GATE>,
471 <&clks IMX27_CLK_VPU_AHB_GATE>;
441 clock-names = "per", "ahb"; 472 clock-names = "per", "ahb";
442 iram = <&iram>; 473 iram = <&iram>;
443 }; 474 };
@@ -446,7 +477,7 @@
446 compatible = "fsl,imx27-usb"; 477 compatible = "fsl,imx27-usb";
447 reg = <0x10024000 0x200>; 478 reg = <0x10024000 0x200>;
448 interrupts = <56>; 479 interrupts = <56>;
449 clocks = <&clks 75>; 480 clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
450 fsl,usbmisc = <&usbmisc 0>; 481 fsl,usbmisc = <&usbmisc 0>;
451 status = "disabled"; 482 status = "disabled";
452 }; 483 };
@@ -455,7 +486,7 @@
455 compatible = "fsl,imx27-usb"; 486 compatible = "fsl,imx27-usb";
456 reg = <0x10024200 0x200>; 487 reg = <0x10024200 0x200>;
457 interrupts = <54>; 488 interrupts = <54>;
458 clocks = <&clks 75>; 489 clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
459 fsl,usbmisc = <&usbmisc 1>; 490 fsl,usbmisc = <&usbmisc 1>;
460 status = "disabled"; 491 status = "disabled";
461 }; 492 };
@@ -464,7 +495,7 @@
464 compatible = "fsl,imx27-usb"; 495 compatible = "fsl,imx27-usb";
465 reg = <0x10024400 0x200>; 496 reg = <0x10024400 0x200>;
466 interrupts = <55>; 497 interrupts = <55>;
467 clocks = <&clks 75>; 498 clocks = <&clks IMX27_CLK_USB_IPG_GATE>;
468 fsl,usbmisc = <&usbmisc 2>; 499 fsl,usbmisc = <&usbmisc 2>;
469 status = "disabled"; 500 status = "disabled";
470 }; 501 };
@@ -473,14 +504,15 @@
473 #index-cells = <1>; 504 #index-cells = <1>;
474 compatible = "fsl,imx27-usbmisc"; 505 compatible = "fsl,imx27-usbmisc";
475 reg = <0x10024600 0x200>; 506 reg = <0x10024600 0x200>;
476 clocks = <&clks 62>; 507 clocks = <&clks IMX27_CLK_USB_AHB_GATE>;
477 }; 508 };
478 509
479 sahara2: sahara@10025000 { 510 sahara2: sahara@10025000 {
480 compatible = "fsl,imx27-sahara"; 511 compatible = "fsl,imx27-sahara";
481 reg = <0x10025000 0x1000>; 512 reg = <0x10025000 0x1000>;
482 interrupts = <59>; 513 interrupts = <59>;
483 clocks = <&clks 32>, <&clks 64>; 514 clocks = <&clks IMX27_CLK_SAHARA_IPG_GATE>,
515 <&clks IMX27_CLK_SAHARA_AHB_GATE>;
484 clock-names = "ipg", "ahb"; 516 clock-names = "ipg", "ahb";
485 }; 517 };
486 518
@@ -494,14 +526,15 @@
494 compatible = "fsl,imx27-iim"; 526 compatible = "fsl,imx27-iim";
495 reg = <0x10028000 0x1000>; 527 reg = <0x10028000 0x1000>;
496 interrupts = <62>; 528 interrupts = <62>;
497 clocks = <&clks 38>; 529 clocks = <&clks IMX27_CLK_IIM_IPG_GATE>;
498 }; 530 };
499 531
500 fec: ethernet@1002b000 { 532 fec: ethernet@1002b000 {
501 compatible = "fsl,imx27-fec"; 533 compatible = "fsl,imx27-fec";
502 reg = <0x1002b000 0x4000>; 534 reg = <0x1002b000 0x4000>;
503 interrupts = <50>; 535 interrupts = <50>;
504 clocks = <&clks 48>, <&clks 67>; 536 clocks = <&clks IMX27_CLK_FEC_IPG_GATE>,
537 <&clks IMX27_CLK_FEC_AHB_GATE>;
505 clock-names = "ipg", "ahb"; 538 clock-names = "ipg", "ahb";
506 status = "disabled"; 539 status = "disabled";
507 }; 540 };
@@ -513,7 +546,7 @@
513 compatible = "fsl,imx27-nand"; 546 compatible = "fsl,imx27-nand";
514 reg = <0xd8000000 0x1000>; 547 reg = <0xd8000000 0x1000>;
515 interrupts = <29>; 548 interrupts = <29>;
516 clocks = <&clks 54>; 549 clocks = <&clks IMX27_CLK_NFC_BAUD_GATE>;
517 status = "disabled"; 550 status = "disabled";
518 }; 551 };
519 552
@@ -522,7 +555,7 @@
522 #size-cells = <1>; 555 #size-cells = <1>;
523 compatible = "fsl,imx27-weim"; 556 compatible = "fsl,imx27-weim";
524 reg = <0xd8002000 0x1000>; 557 reg = <0xd8002000 0x1000>;
525 clocks = <&clks 0>; 558 clocks = <&clks IMX27_CLK_EMI_AHB_GATE>;
526 ranges = < 559 ranges = <
527 0 0 0xc0000000 0x08000000 560 0 0 0xc0000000 0x08000000
528 1 0 0xc8000000 0x08000000 561 1 0 0xc8000000 0x08000000
diff --git a/arch/arm/boot/dts/imx28-cfa10036.dts b/arch/arm/boot/dts/imx28-cfa10036.dts
index ae7c3390e65a..b04b6b8850a7 100644
--- a/arch/arm/boot/dts/imx28-cfa10036.dts
+++ b/arch/arm/boot/dts/imx28-cfa10036.dts
@@ -53,6 +53,17 @@
53 fsl,pull-up = <MXS_PULL_DISABLE>; 53 fsl,pull-up = <MXS_PULL_DISABLE>;
54 }; 54 };
55 55
56 mmc_pwr_cfa10036: mmc_pwr_cfa10036@0 {
57 reg = <0>;
58 fsl,pinmux-ids = <
59 0x31c3 /*
60 MX28_PAD_PWM3__GPIO_3_28 */
61 >;
62 fsl,drive-strength = <0>;
63 fsl,voltage = <1>;
64 fsl,pull-up = <0>;
65 };
66
56 }; 67 };
57 68
58 ssp0: ssp@80010000 { 69 ssp0: ssp@80010000 {
@@ -60,6 +71,7 @@
60 pinctrl-names = "default"; 71 pinctrl-names = "default";
61 pinctrl-0 = <&mmc0_4bit_pins_a 72 pinctrl-0 = <&mmc0_4bit_pins_a
62 &mmc0_cd_cfg &mmc0_sck_cfg>; 73 &mmc0_cd_cfg &mmc0_sck_cfg>;
74 vmmc-supply = <&reg_vddio_sd0>;
63 bus-width = <4>; 75 bus-width = <4>;
64 status = "okay"; 76 status = "okay";
65 }; 77 };
@@ -116,4 +128,14 @@
116 default-state = "on"; 128 default-state = "on";
117 }; 129 };
118 }; 130 };
131
132 reg_vddio_sd0: vddio-sd0 {
133 compatible = "regulator-fixed";
134 pinctrl-names = "default";
135 pinctrl-0 = <&mmc_pwr_cfa10036>;
136 regulator-name = "vddio-sd0";
137 regulator-min-microvolt = <3300000>;
138 regulator-max-microvolt = <3300000>;
139 gpio = <&gpio3 28 0>;
140 };
119}; 141};
diff --git a/arch/arm/boot/dts/imx28-m28.dtsi b/arch/arm/boot/dts/imx28-m28.dtsi
new file mode 100644
index 000000000000..759cc56253dd
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-m28.dtsi
@@ -0,0 +1,87 @@
1/*
2 * Copyright (C) 2014 Marek Vasut <marex@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include "imx28.dtsi"
13
14/ {
15 model = "DENX M28";
16 compatible = "denx,m28", "fsl,imx28";
17
18 memory {
19 reg = <0x40000000 0x08000000>;
20 };
21
22 apb@80000000 {
23 apbh@80000000 {
24 gpmi-nand@8000c000 {
25 #address-cells = <1>;
26 #size-cells = <1>;
27 pinctrl-names = "default";
28 pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
29 status = "okay";
30
31 partition@0 {
32 label = "bootloader";
33 reg = <0x00000000 0x00300000>;
34 read-only;
35 };
36
37 partition@1 {
38 label = "environment";
39 reg = <0x00300000 0x00080000>;
40 };
41
42 partition@2 {
43 label = "redundant-environment";
44 reg = <0x00380000 0x00080000>;
45 };
46
47 partition@3 {
48 label = "kernel";
49 reg = <0x00400000 0x00400000>;
50 };
51
52 partition@4 {
53 label = "filesystem";
54 reg = <0x00800000 0x0f800000>;
55 };
56 };
57 };
58
59 apbx@80040000 {
60 i2c0: i2c@80058000 {
61 pinctrl-names = "default";
62 pinctrl-0 = <&i2c0_pins_a>;
63 status = "okay";
64
65 rtc: rtc@68 {
66 compatible = "stm,m41t62";
67 reg = <0x68>;
68 };
69 };
70 };
71 };
72
73 regulators {
74 compatible = "simple-bus";
75 #address-cells = <1>;
76 #size-cells = <0>;
77
78 reg_3p3v: regulator@0 {
79 compatible = "regulator-fixed";
80 reg = <0>;
81 regulator-name = "3P3V";
82 regulator-min-microvolt = <3300000>;
83 regulator-max-microvolt = <3300000>;
84 regulator-always-on;
85 };
86 };
87};
diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts
index f0ad7b9b9d9a..b3c09ae3b928 100644
--- a/arch/arm/boot/dts/imx28-m28evk.dts
+++ b/arch/arm/boot/dts/imx28-m28evk.dts
@@ -10,52 +10,14 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "imx28.dtsi" 13#include "imx28-m28.dtsi"
14 14
15/ { 15/ {
16 model = "DENX M28EVK"; 16 model = "DENX M28EVK";
17 compatible = "denx,m28evk", "fsl,imx28"; 17 compatible = "denx,m28evk", "fsl,imx28";
18 18
19 memory {
20 reg = <0x40000000 0x08000000>;
21 };
22
23 apb@80000000 { 19 apb@80000000 {
24 apbh@80000000 { 20 apbh@80000000 {
25 gpmi-nand@8000c000 {
26 #address-cells = <1>;
27 #size-cells = <1>;
28 pinctrl-names = "default";
29 pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>;
30 status = "okay";
31
32 partition@0 {
33 label = "bootloader";
34 reg = <0x00000000 0x00300000>;
35 read-only;
36 };
37
38 partition@1 {
39 label = "environment";
40 reg = <0x00300000 0x00080000>;
41 };
42
43 partition@2 {
44 label = "redundant-environment";
45 reg = <0x00380000 0x00080000>;
46 };
47
48 partition@3 {
49 label = "kernel";
50 reg = <0x00400000 0x00400000>;
51 };
52
53 partition@4 {
54 label = "filesystem";
55 reg = <0x00800000 0x0f800000>;
56 };
57 };
58
59 ssp0: ssp@80010000 { 21 ssp0: ssp@80010000 {
60 compatible = "fsl,imx28-mmc"; 22 compatible = "fsl,imx28-mmc";
61 pinctrl-names = "default"; 23 pinctrl-names = "default";
@@ -175,10 +137,6 @@
175 }; 137 };
176 138
177 i2c0: i2c@80058000 { 139 i2c0: i2c@80058000 {
178 pinctrl-names = "default";
179 pinctrl-0 = <&i2c0_pins_a>;
180 status = "okay";
181
182 sgtl5000: codec@0a { 140 sgtl5000: codec@0a {
183 compatible = "fsl,sgtl5000"; 141 compatible = "fsl,sgtl5000";
184 reg = <0x0a>; 142 reg = <0x0a>;
@@ -192,11 +150,6 @@
192 reg = <0x51>; 150 reg = <0x51>;
193 pagesize = <32>; 151 pagesize = <32>;
194 }; 152 };
195
196 rtc: rtc@68 {
197 compatible = "stm,m41t62";
198 reg = <0x68>;
199 };
200 }; 153 };
201 154
202 lradc@80050000 { 155 lradc@80050000 {
@@ -284,19 +237,6 @@
284 }; 237 };
285 238
286 regulators { 239 regulators {
287 compatible = "simple-bus";
288 #address-cells = <1>;
289 #size-cells = <0>;
290
291 reg_3p3v: regulator@0 {
292 compatible = "regulator-fixed";
293 reg = <0>;
294 regulator-name = "3P3V";
295 regulator-min-microvolt = <3300000>;
296 regulator-max-microvolt = <3300000>;
297 regulator-always-on;
298 };
299
300 reg_vddio_sd0: regulator@1 { 240 reg_vddio_sd0: regulator@1 {
301 compatible = "regulator-fixed"; 241 compatible = "regulator-fixed";
302 reg = <1>; 242 reg = <1>;
diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
index f04ae91eea89..75b036700d31 100644
--- a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
+++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts
@@ -133,7 +133,6 @@
133 133
134&ssi1 { 134&ssi1 {
135 codec-handle = <&tlv320aic23>; 135 codec-handle = <&tlv320aic23>;
136 fsl,mode = "i2s-slave";
137 status = "okay"; 136 status = "okay";
138}; 137};
139 138
diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index 4759abb49436..442e216ca9d9 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -193,6 +193,14 @@
193 #clock-cells = <1>; 193 #clock-cells = <1>;
194 }; 194 };
195 195
196 gpt: timer@53f90000 {
197 compatible = "fsl,imx35-gpt", "fsl,imx31-gpt";
198 reg = <0x53f90000 0x4000>;
199 interrupts = <29>;
200 clocks = <&clks 9>, <&clks 50>;
201 clock-names = "ipg", "per";
202 };
203
196 gpio3: gpio@53fa4000 { 204 gpio3: gpio@53fa4000 {
197 compatible = "fsl,imx35-gpio", "fsl,imx31-gpio"; 205 compatible = "fsl,imx35-gpio", "fsl,imx31-gpio";
198 reg = <0x53fa4000 0x4000>; 206 reg = <0x53fa4000 0x4000>;
diff --git a/arch/arm/boot/dts/imx50.dtsi b/arch/arm/boot/dts/imx50.dtsi
index 6a201cf54366..c0e0f60ab6b2 100644
--- a/arch/arm/boot/dts/imx50.dtsi
+++ b/arch/arm/boot/dts/imx50.dtsi
@@ -151,8 +151,10 @@
151 reg = <0x50014000 0x4000>; 151 reg = <0x50014000 0x4000>;
152 interrupts = <30>; 152 interrupts = <30>;
153 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>; 153 clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>;
154 dmas = <&sdma 24 1 0>,
155 <&sdma 25 1 0>;
156 dma-names = "rx", "tx";
154 fsl,fifo-depth = <15>; 157 fsl,fifo-depth = <15>;
155 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
156 status = "disabled"; 158 status = "disabled";
157 }; 159 };
158 160
@@ -457,8 +459,10 @@
457 reg = <0x63fcc000 0x4000>; 459 reg = <0x63fcc000 0x4000>;
458 interrupts = <29>; 460 interrupts = <29>;
459 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>; 461 clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>;
462 dmas = <&sdma 28 0 0>,
463 <&sdma 29 0 0>;
464 dma-names = "rx", "tx";
460 fsl,fifo-depth = <15>; 465 fsl,fifo-depth = <15>;
461 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
462 status = "disabled"; 466 status = "disabled";
463 }; 467 };
464 468
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 181d77fa2fa6..56569cecaa78 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -203,6 +203,7 @@
203 reg = <0>; 203 reg = <0>;
204 interrupt-parent = <&gpio1>; 204 interrupt-parent = <&gpio1>;
205 interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; 205 interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
206 fsl,mc13xxx-uses-rtc;
206 207
207 regulators { 208 regulators {
208 sw1_reg: sw1 { 209 sw1_reg: sw1 {
@@ -392,7 +393,6 @@
392}; 393};
393 394
394&ssi2 { 395&ssi2 {
395 fsl,mode = "i2s-slave";
396 status = "okay"; 396 status = "okay";
397}; 397};
398 398
diff --git a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
index 31cfb7f2b02e..34599c547459 100644
--- a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
+++ b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
@@ -255,7 +255,6 @@
255 255
256&ssi2 { 256&ssi2 {
257 codec-handle = <&tlv320aic23>; 257 codec-handle = <&tlv320aic23>;
258 fsl,mode = "i2s-slave";
259 status = "okay"; 258 status = "okay";
260}; 259};
261 260
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index bebbf3ba0d5e..17c05a6fa776 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -218,7 +218,6 @@
218 <&sdma 25 1 0>; 218 <&sdma 25 1 0>;
219 dma-names = "rx", "tx"; 219 dma-names = "rx", "tx";
220 fsl,fifo-depth = <15>; 220 fsl,fifo-depth = <15>;
221 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
222 status = "disabled"; 221 status = "disabled";
223 }; 222 };
224 223
@@ -508,7 +507,6 @@
508 <&sdma 29 0 0>; 507 <&sdma 29 0 0>;
509 dma-names = "rx", "tx"; 508 dma-names = "rx", "tx";
510 fsl,fifo-depth = <15>; 509 fsl,fifo-depth = <15>;
511 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
512 status = "disabled"; 510 status = "disabled";
513 }; 511 };
514 512
@@ -564,7 +562,6 @@
564 <&sdma 47 0 0>; 562 <&sdma 47 0 0>;
565 dma-names = "rx", "tx"; 563 dma-names = "rx", "tx";
566 fsl,fifo-depth = <15>; 564 fsl,fifo-depth = <15>;
567 fsl,ssi-dma-events = <47 46 37 35>; /* TX0 RX0 TX1 RX1 */
568 status = "disabled"; 565 status = "disabled";
569 }; 566 };
570 567
diff --git a/arch/arm/boot/dts/imx53-m53.dtsi b/arch/arm/boot/dts/imx53-m53.dtsi
new file mode 100644
index 000000000000..87a7fc709c2d
--- /dev/null
+++ b/arch/arm/boot/dts/imx53-m53.dtsi
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) 2014 Marek Vasut <marex@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include "imx53.dtsi"
13
14/ {
15 model = "DENX M53";
16 compatible = "denx,imx53-m53", "fsl,imx53";
17
18 memory {
19 reg = <0x70000000 0x20000000>,
20 <0xb0000000 0x20000000>;
21 };
22
23 regulators {
24 compatible = "simple-bus";
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 reg_3p2v: regulator@0 {
29 compatible = "regulator-fixed";
30 reg = <0>;
31 regulator-name = "3P2V";
32 regulator-min-microvolt = <3200000>;
33 regulator-max-microvolt = <3200000>;
34 regulator-always-on;
35 };
36
37 reg_backlight: regulator@1 {
38 compatible = "regulator-fixed";
39 reg = <1>;
40 regulator-name = "lcd-supply";
41 regulator-min-microvolt = <3200000>;
42 regulator-max-microvolt = <3200000>;
43 regulator-always-on;
44 };
45 };
46};
47
48&i2c2 {
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_i2c2>;
51 clock-frequency = <400000>;
52 status = "okay";
53
54 stmpe610@41 {
55 compatible = "st,stmpe610";
56 #address-cells = <1>;
57 #size-cells = <0>;
58 reg = <0x41>;
59 id = <0>;
60 blocks = <0x5>;
61 interrupts = <6 0x0>;
62 interrupt-parent = <&gpio7>;
63 irq-trigger = <0x1>;
64
65 stmpe_touchscreen {
66 compatible = "st,stmpe-ts";
67 reg = <0>;
68 st,sample-time = <4>;
69 st,mod-12b = <1>;
70 st,ref-sel = <0>;
71 st,adc-freq = <1>;
72 st,ave-ctrl = <3>;
73 st,touch-det-delay = <3>;
74 st,settling = <4>;
75 st,fraction-z = <7>;
76 st,i-drive = <1>;
77 };
78 };
79
80 eeprom: eeprom@50 {
81 compatible = "atmel,24c128";
82 reg = <0x50>;
83 pagesize = <32>;
84 };
85
86 rtc: rtc@68 {
87 compatible = "stm,m41t62";
88 reg = <0x68>;
89 };
90};
91
92&iomuxc {
93 pinctrl-names = "default";
94 pinctrl-0 = <&pinctrl_hog>;
95
96 imx53-m53evk {
97 pinctrl_hog: hoggrp {
98 fsl,pins = <
99 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000
100 MX53_PAD_EIM_EB3__GPIO2_31 0x80000000
101 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
102 >;
103 };
104
105 pinctrl_i2c2: i2c2grp {
106 fsl,pins = <
107 MX53_PAD_EIM_D16__I2C2_SDA 0xc0000000
108 MX53_PAD_EIM_EB2__I2C2_SCL 0xc0000000
109 >;
110 };
111
112 pinctrl_nand: nandgrp {
113 fsl,pins = <
114 MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B 0x4
115 MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B 0x4
116 MX53_PAD_NANDF_CLE__EMI_NANDF_CLE 0x4
117 MX53_PAD_NANDF_ALE__EMI_NANDF_ALE 0x4
118 MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B 0xe0
119 MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0 0xe0
120 MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0 0x4
121 MX53_PAD_PATA_DATA0__EMI_NANDF_D_0 0xa4
122 MX53_PAD_PATA_DATA1__EMI_NANDF_D_1 0xa4
123 MX53_PAD_PATA_DATA2__EMI_NANDF_D_2 0xa4
124 MX53_PAD_PATA_DATA3__EMI_NANDF_D_3 0xa4
125 MX53_PAD_PATA_DATA4__EMI_NANDF_D_4 0xa4
126 MX53_PAD_PATA_DATA5__EMI_NANDF_D_5 0xa4
127 MX53_PAD_PATA_DATA6__EMI_NANDF_D_6 0xa4
128 MX53_PAD_PATA_DATA7__EMI_NANDF_D_7 0xa4
129 >;
130 };
131 };
132};
133
134&nfc {
135 pinctrl-names = "default";
136 pinctrl-0 = <&pinctrl_nand>;
137 nand-bus-width = <8>;
138 nand-ecc-mode = "hw";
139 status = "okay";
140};
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts
index c4956b0ffb35..d0e0f57eb432 100644
--- a/arch/arm/boot/dts/imx53-m53evk.dts
+++ b/arch/arm/boot/dts/imx53-m53evk.dts
@@ -10,17 +10,12 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13#include "imx53.dtsi" 13#include "imx53-m53.dtsi"
14 14
15/ { 15/ {
16 model = "DENX M53EVK"; 16 model = "DENX M53EVK";
17 compatible = "denx,imx53-m53evk", "fsl,imx53"; 17 compatible = "denx,imx53-m53evk", "fsl,imx53";
18 18
19 memory {
20 reg = <0x70000000 0x20000000>,
21 <0xb0000000 0x20000000>;
22 };
23
24 display1: display@di1 { 19 display1: display@di1 {
25 compatible = "fsl,imx-parallel-display"; 20 compatible = "fsl,imx-parallel-display";
26 interface-pix-fmt = "bgr666"; 21 interface-pix-fmt = "bgr666";
@@ -81,25 +76,6 @@
81 #address-cells = <1>; 76 #address-cells = <1>;
82 #size-cells = <0>; 77 #size-cells = <0>;
83 78
84 reg_3p2v: regulator@0 {
85 compatible = "regulator-fixed";
86 reg = <0>;
87 regulator-name = "3P2V";
88 regulator-min-microvolt = <3200000>;
89 regulator-max-microvolt = <3200000>;
90 regulator-always-on;
91 };
92
93
94 reg_backlight: regulator@1 {
95 compatible = "regulator-fixed";
96 reg = <1>;
97 regulator-name = "lcd-supply";
98 regulator-min-microvolt = <3200000>;
99 regulator-max-microvolt = <3200000>;
100 regulator-always-on;
101 };
102
103 reg_usbh1_vbus: regulator@3 { 79 reg_usbh1_vbus: regulator@3 {
104 compatible = "regulator-fixed"; 80 compatible = "regulator-fixed";
105 reg = <3>; 81 reg = <3>;
@@ -174,50 +150,6 @@
174 }; 150 };
175}; 151};
176 152
177&i2c2 {
178 pinctrl-names = "default";
179 pinctrl-0 = <&pinctrl_i2c2>;
180 clock-frequency = <400000>;
181 status = "okay";
182
183 stmpe610@41 {
184 compatible = "st,stmpe610";
185 #address-cells = <1>;
186 #size-cells = <0>;
187 reg = <0x41>;
188 id = <0>;
189 blocks = <0x5>;
190 interrupts = <6 0x0>;
191 interrupt-parent = <&gpio7>;
192 irq-trigger = <0x1>;
193
194 stmpe_touchscreen {
195 compatible = "st,stmpe-ts";
196 reg = <0>;
197 st,sample-time = <4>;
198 st,mod-12b = <1>;
199 st,ref-sel = <0>;
200 st,adc-freq = <1>;
201 st,ave-ctrl = <3>;
202 st,touch-det-delay = <3>;
203 st,settling = <4>;
204 st,fraction-z = <7>;
205 st,i-drive = <1>;
206 };
207 };
208
209 eeprom: eeprom@50 {
210 compatible = "atmel,24c128";
211 reg = <0x50>;
212 pagesize = <32>;
213 };
214
215 rtc: rtc@68 {
216 compatible = "stm,m41t62";
217 reg = <0x68>;
218 };
219};
220
221&i2c3 { 153&i2c3 {
222 pinctrl-names = "default"; 154 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_i2c3>; 155 pinctrl-0 = <&pinctrl_i2c3>;
@@ -229,11 +161,8 @@
229 pinctrl-0 = <&pinctrl_hog>; 161 pinctrl-0 = <&pinctrl_hog>;
230 162
231 imx53-m53evk { 163 imx53-m53evk {
232 pinctrl_hog: hoggrp { 164 pinctrl_usb: usbgrp {
233 fsl,pins = < 165 fsl,pins = <
234 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000
235 MX53_PAD_EIM_EB3__GPIO2_31 0x80000000
236 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
237 MX53_PAD_GPIO_2__GPIO1_2 0x80000000 166 MX53_PAD_GPIO_2__GPIO1_2 0x80000000
238 MX53_PAD_GPIO_3__USBOH3_USBH1_OC 0x80000000 167 MX53_PAD_GPIO_3__USBOH3_USBH1_OC 0x80000000
239 >; 168 >;
@@ -302,13 +231,6 @@
302 >; 231 >;
303 }; 232 };
304 233
305 pinctrl_i2c2: i2c2grp {
306 fsl,pins = <
307 MX53_PAD_EIM_D16__I2C2_SDA 0xc0000000
308 MX53_PAD_EIM_EB2__I2C2_SCL 0xc0000000
309 >;
310 };
311
312 pinctrl_i2c3: i2c3grp { 234 pinctrl_i2c3: i2c3grp {
313 fsl,pins = < 235 fsl,pins = <
314 MX53_PAD_GPIO_6__I2C3_SDA 0xc0000000 236 MX53_PAD_GPIO_6__I2C3_SDA 0xc0000000
@@ -353,26 +275,6 @@
353 >; 275 >;
354 }; 276 };
355 277
356 pinctrl_nand: nandgrp {
357 fsl,pins = <
358 MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B 0x4
359 MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B 0x4
360 MX53_PAD_NANDF_CLE__EMI_NANDF_CLE 0x4
361 MX53_PAD_NANDF_ALE__EMI_NANDF_ALE 0x4
362 MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B 0xe0
363 MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0 0xe0
364 MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0 0x4
365 MX53_PAD_PATA_DATA0__EMI_NANDF_D_0 0xa4
366 MX53_PAD_PATA_DATA1__EMI_NANDF_D_1 0xa4
367 MX53_PAD_PATA_DATA2__EMI_NANDF_D_2 0xa4
368 MX53_PAD_PATA_DATA3__EMI_NANDF_D_3 0xa4
369 MX53_PAD_PATA_DATA4__EMI_NANDF_D_4 0xa4
370 MX53_PAD_PATA_DATA5__EMI_NANDF_D_5 0xa4
371 MX53_PAD_PATA_DATA6__EMI_NANDF_D_6 0xa4
372 MX53_PAD_PATA_DATA7__EMI_NANDF_D_7 0xa4
373 >;
374 };
375
376 pinctrl_pwm1: pwm1grp { 278 pinctrl_pwm1: pwm1grp {
377 fsl,pins = < 279 fsl,pins = <
378 MX53_PAD_DISP0_DAT8__PWM1_PWMO 0x5 280 MX53_PAD_DISP0_DAT8__PWM1_PWMO 0x5
@@ -408,14 +310,6 @@
408 remote-endpoint = <&display1_in>; 310 remote-endpoint = <&display1_in>;
409}; 311};
410 312
411&nfc {
412 pinctrl-names = "default";
413 pinctrl-0 = <&pinctrl_nand>;
414 nand-bus-width = <8>;
415 nand-ecc-mode = "hw";
416 status = "okay";
417};
418
419&pwm1 { 313&pwm1 {
420 pinctrl-names = "default"; 314 pinctrl-names = "default";
421 pinctrl-0 = <&pinctrl_pwm1>; 315 pinctrl-0 = <&pinctrl_pwm1>;
@@ -427,7 +321,6 @@
427}; 321};
428 322
429&ssi2 { 323&ssi2 {
430 fsl,mode = "i2s-slave";
431 status = "okay"; 324 status = "okay";
432}; 325};
433 326
@@ -450,6 +343,8 @@
450}; 343};
451 344
452&usbh1 { 345&usbh1 {
346 pinctrl-names = "default";
347 pinctrl-0 = <&pinctrl_usb>;
453 vbus-supply = <&reg_usbh1_vbus>; 348 vbus-supply = <&reg_usbh1_vbus>;
454 phy_type = "utmi"; 349 phy_type = "utmi";
455 status = "okay"; 350 status = "okay";
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts
index 3e3f17aa93a1..2e44d2aba14e 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dts
@@ -225,7 +225,6 @@
225}; 225};
226 226
227&ssi2 { 227&ssi2 {
228 fsl,mode = "i2s-slave";
229 status = "okay"; 228 status = "okay";
230}; 229};
231 230
diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi
index fd8c60dde7de..181ae5ebf23f 100644
--- a/arch/arm/boot/dts/imx53-qsb-common.dtsi
+++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi
@@ -141,7 +141,6 @@
141}; 141};
142 142
143&ssi2 { 143&ssi2 {
144 fsl,mode = "i2s-slave";
145 status = "okay"; 144 status = "okay";
146}; 145};
147 146
diff --git a/arch/arm/boot/dts/imx53-tx53.dtsi b/arch/arm/boot/dts/imx53-tx53.dtsi
index e348796ba689..704bd72cbfec 100644
--- a/arch/arm/boot/dts/imx53-tx53.dtsi
+++ b/arch/arm/boot/dts/imx53-tx53.dtsi
@@ -502,7 +502,6 @@
502}; 502};
503 503
504&ssi1 { 504&ssi1 {
505 fsl,mode = "i2s-slave";
506 codec-handle = <&sgtl5000>; 505 codec-handle = <&sgtl5000>;
507 status = "okay"; 506 status = "okay";
508}; 507};
diff --git a/arch/arm/boot/dts/imx53-voipac-bsb.dts b/arch/arm/boot/dts/imx53-voipac-bsb.dts
index 7f6711a48615..c17d3ad6dba5 100644
--- a/arch/arm/boot/dts/imx53-voipac-bsb.dts
+++ b/arch/arm/boot/dts/imx53-voipac-bsb.dts
@@ -154,6 +154,5 @@
154}; 154};
155 155
156&ssi2 { 156&ssi2 {
157 fsl,mode = "i2s-slave";
158 status = "okay"; 157 status = "okay";
159}; 158};
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 6456a0084388..64fa27b36be0 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -108,7 +108,7 @@
108 clocks = <&clks IMX5_CLK_SATA_GATE>, 108 clocks = <&clks IMX5_CLK_SATA_GATE>,
109 <&clks IMX5_CLK_SATA_REF>, 109 <&clks IMX5_CLK_SATA_REF>,
110 <&clks IMX5_CLK_AHB>; 110 <&clks IMX5_CLK_AHB>;
111 clock-names = "sata_gate", "sata_ref", "ahb"; 111 clock-names = "sata", "sata_ref", "ahb";
112 status = "disabled"; 112 status = "disabled";
113 }; 113 };
114 114
@@ -231,7 +231,6 @@
231 <&sdma 25 1 0>; 231 <&sdma 25 1 0>;
232 dma-names = "rx", "tx"; 232 dma-names = "rx", "tx";
233 fsl,fifo-depth = <15>; 233 fsl,fifo-depth = <15>;
234 fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
235 status = "disabled"; 234 status = "disabled";
236 }; 235 };
237 236
@@ -260,6 +259,11 @@
260 }; 259 };
261 }; 260 };
262 261
262 aipstz1: bridge@53f00000 {
263 compatible = "fsl,imx53-aipstz";
264 reg = <0x53f00000 0x60>;
265 };
266
263 usbphy0: usbphy@0 { 267 usbphy0: usbphy@0 {
264 compatible = "usb-nop-xceiv"; 268 compatible = "usb-nop-xceiv";
265 clocks = <&clks IMX5_CLK_USB_PHY1_GATE>; 269 clocks = <&clks IMX5_CLK_USB_PHY1_GATE>;
@@ -572,6 +576,11 @@
572 reg = <0x60000000 0x10000000>; 576 reg = <0x60000000 0x10000000>;
573 ranges; 577 ranges;
574 578
579 aipstz2: bridge@63f00000 {
580 compatible = "fsl,imx53-aipstz";
581 reg = <0x63f00000 0x60>;
582 };
583
575 iim: iim@63f98000 { 584 iim: iim@63f98000 {
576 compatible = "fsl,imx53-iim", "fsl,imx27-iim"; 585 compatible = "fsl,imx53-iim", "fsl,imx27-iim";
577 reg = <0x63f98000 0x4000>; 586 reg = <0x63f98000 0x4000>;
@@ -661,7 +670,6 @@
661 <&sdma 29 0 0>; 670 <&sdma 29 0 0>;
662 dma-names = "rx", "tx"; 671 dma-names = "rx", "tx";
663 fsl,fifo-depth = <15>; 672 fsl,fifo-depth = <15>;
664 fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
665 status = "disabled"; 673 status = "disabled";
666 }; 674 };
667 675
@@ -689,7 +697,6 @@
689 <&sdma 47 0 0>; 697 <&sdma 47 0 0>;
690 dma-names = "rx", "tx"; 698 dma-names = "rx", "tx";
691 fsl,fifo-depth = <15>; 699 fsl,fifo-depth = <15>;
692 fsl,ssi-dma-events = <47 46 45 44>; /* TX0 RX0 TX1 RX1 */
693 status = "disabled"; 700 status = "disabled";
694 }; 701 };
695 702
diff --git a/arch/arm/boot/dts/imx6dl-aristainetos_4.dts b/arch/arm/boot/dts/imx6dl-aristainetos_4.dts
new file mode 100644
index 000000000000..9cd06e5e59f0
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-aristainetos_4.dts
@@ -0,0 +1,85 @@
1/*
2 * support fot the imx6 based aristainetos board
3 *
4 * Copyright (C) 2014 Heiko Schocher <hs@denx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6dl.dtsi"
13#include "imx6qdl-aristainetos.dtsi"
14
15/ {
16 model = "aristainetos i.MX6 Dual Lite Board 4";
17 compatible = "fsl,imx6dl";
18
19 backlight {
20 compatible = "pwm-backlight";
21 pwms = <&pwm1 0 5000000>;
22 brightness-levels = <0 4 8 16 32 64 128 255>;
23 default-brightness-level = <7>;
24 enable-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
25 pinctrl-names = "default";
26 pinctrl-0 = <&pinctrl_backlight>;
27 status = "okay";
28 };
29
30 memory {
31 reg = <0x10000000 0x40000000>;
32 };
33
34 soc {
35 display0: display@di0 {
36 compatible = "fsl,imx-parallel-display";
37 interface-pix-fmt = "rgb24";
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_ipu_disp>;
40 status = "okay";
41
42 display-timings {
43 480x800p60 {
44 native-mode;
45 clock-frequency = <30000000>;
46 hactive = <480>;
47 vactive = <800>;
48 hfront-porch = <59>;
49 hback-porch = <10>;
50 hsync-len = <10>;
51 vback-porch = <15>;
52 vfront-porch = <15>;
53 vsync-len = <15>;
54 hsync-active = <1>;
55 vsync-active = <1>;
56 };
57 };
58
59 port {
60 display0_in: endpoint {
61 remote-endpoint = <&ipu1_di0_disp0>;
62 };
63 };
64 };
65 };
66};
67
68&ecspi2 {
69 fsl,spi-num-chipselects = <1>;
70 cs-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>;
71 pinctrl-names = "default";
72 pinctrl-0 = <&pinctrl_ecspi2>;
73 status = "okay";
74};
75
76&i2c2 {
77 clock-frequency = <100000>;
78 pinctrl-names = "default";
79 pinctrl-0 = <&pinctrl_i2c2>;
80 status = "okay";
81};
82
83&ipu1_di0_disp0 {
84 remote-endpoint = <&display0_in>;
85};
diff --git a/arch/arm/boot/dts/imx6dl-aristainetos_7.dts b/arch/arm/boot/dts/imx6dl-aristainetos_7.dts
new file mode 100644
index 000000000000..b413e24288dc
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-aristainetos_7.dts
@@ -0,0 +1,74 @@
1/*
2 * support fot the imx6 based aristainetos board
3 *
4 * Copyright (C) 2014 Heiko Schocher <hs@denx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6dl.dtsi"
13#include "imx6qdl-aristainetos.dtsi"
14
15/ {
16 model = "aristainetos i.MX6 Dual Lite Board 7";
17 compatible = "fsl,imx6dl";
18
19 memory {
20 reg = <0x10000000 0x40000000>;
21 };
22
23 soc {
24 display0: display@di0 {
25 compatible = "fsl,imx-parallel-display";
26 interface-pix-fmt = "rgb24";
27 pinctrl-names = "default";
28 pinctrl-0 = <&pinctrl_ipu_disp>;
29 status = "okay";
30
31 display-timings {
32 800x480p60 {
33 native-mode;
34 clock-frequency = <33246000>;
35 hactive = <800>;
36 vactive = <480>;
37 hfront-porch = <88>;
38 hback-porch = <88>;
39 hsync-len = <80>;
40 vback-porch = <10>;
41 vfront-porch = <10>;
42 vsync-len = <25>;
43 vsync-active = <1>;
44 };
45 };
46
47 port {
48 display0_in: endpoint {
49 remote-endpoint = <&ipu1_di0_disp0>;
50 };
51 };
52 };
53 };
54
55 backlight {
56 compatible = "pwm-backlight";
57 pwms = <&pwm3 0 3000>;
58 brightness-levels = <0 4 8 16 32 64 128 255>;
59 default-brightness-level = <6>;
60 pinctrl-names = "default";
61 pinctrl-0 = <&pinctrl_backlight>;
62 };
63};
64
65&i2c2 {
66 clock-frequency = <100000>;
67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_i2c2>;
69 status = "okay";
70};
71
72&ipu1_di0_disp0 {
73 remote-endpoint = <&display0_in>;
74};
diff --git a/arch/arm/boot/dts/imx6dl-gw51xx.dts b/arch/arm/boot/dts/imx6dl-gw51xx.dts
index 4bd055f4c930..b2bd022fc6be 100644
--- a/arch/arm/boot/dts/imx6dl-gw51xx.dts
+++ b/arch/arm/boot/dts/imx6dl-gw51xx.dts
@@ -14,6 +14,6 @@
14#include "imx6qdl-gw51xx.dtsi" 14#include "imx6qdl-gw51xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 DualLite GW51XX"; 17 model = "Gateworks Ventana i.MX6 DualLite/Solo GW51XX";
18 compatible = "gw,imx6dl-gw51xx", "gw,ventana", "fsl,imx6dl"; 18 compatible = "gw,imx6dl-gw51xx", "gw,ventana", "fsl,imx6dl";
19}; 19};
diff --git a/arch/arm/boot/dts/imx6dl-gw52xx.dts b/arch/arm/boot/dts/imx6dl-gw52xx.dts
index c9136058f15e..a2e0b73fdd4a 100644
--- a/arch/arm/boot/dts/imx6dl-gw52xx.dts
+++ b/arch/arm/boot/dts/imx6dl-gw52xx.dts
@@ -14,6 +14,6 @@
14#include "imx6qdl-gw52xx.dtsi" 14#include "imx6qdl-gw52xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 DualLite GW52XX"; 17 model = "Gateworks Ventana i.MX6 DualLite/Solo GW52XX";
18 compatible = "gw,imx6dl-gw52xx", "gw,ventana", "fsl,imx6dl"; 18 compatible = "gw,imx6dl-gw52xx", "gw,ventana", "fsl,imx6dl";
19}; 19};
diff --git a/arch/arm/boot/dts/imx6dl-gw53xx.dts b/arch/arm/boot/dts/imx6dl-gw53xx.dts
index 61818a14fde6..6844b708d2f8 100644
--- a/arch/arm/boot/dts/imx6dl-gw53xx.dts
+++ b/arch/arm/boot/dts/imx6dl-gw53xx.dts
@@ -14,6 +14,6 @@
14#include "imx6qdl-gw53xx.dtsi" 14#include "imx6qdl-gw53xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 DualLite GW53XX"; 17 model = "Gateworks Ventana i.MX6 DualLite/Solo GW53XX";
18 compatible = "gw,imx6dl-gw53xx", "gw,ventana", "fsl,imx6dl"; 18 compatible = "gw,imx6dl-gw53xx", "gw,ventana", "fsl,imx6dl";
19}; 19};
diff --git a/arch/arm/boot/dts/imx6dl-gw54xx.dts b/arch/arm/boot/dts/imx6dl-gw54xx.dts
index ab38b6770a06..be915412f852 100644
--- a/arch/arm/boot/dts/imx6dl-gw54xx.dts
+++ b/arch/arm/boot/dts/imx6dl-gw54xx.dts
@@ -14,6 +14,6 @@
14#include "imx6qdl-gw54xx.dtsi" 14#include "imx6qdl-gw54xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 DualLite GW54XX"; 17 model = "Gateworks Ventana i.MX6 DualLite/Solo GW54XX";
18 compatible = "gw,imx6dl-gw54xx", "gw,ventana", "fsl,imx6dl"; 18 compatible = "gw,imx6dl-gw54xx", "gw,ventana", "fsl,imx6dl";
19}; 19};
diff --git a/arch/arm/boot/dts/imx6dl-rex-basic.dts b/arch/arm/boot/dts/imx6dl-rex-basic.dts
new file mode 100644
index 000000000000..b13845c2823b
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-rex-basic.dts
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2014 FEDEVEL, Inc.
3 *
4 * Author: Robert Nelson <robertcnelson@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6dl.dtsi"
13#include "imx6qdl-rex.dtsi"
14
15/ {
16 model = "Rex Basic i.MX6 Dual Lite Board";
17 compatible = "rex,imx6dl-rex-basic", "fsl,imx6dl";
18
19 memory {
20 reg = <0x10000000 0x20000000>;
21 };
22};
23
24&ecspi3 {
25 flash: m25p80@0 {
26 compatible = "sst,sst25vf016b";
27 spi-max-frequency = <20000000>;
28 reg = <0>;
29 };
30};
diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts
index 909fafc0b650..43cb3fd76be7 100644
--- a/arch/arm/boot/dts/imx6dl-riotboard.dts
+++ b/arch/arm/boot/dts/imx6dl-riotboard.dts
@@ -254,7 +254,6 @@
254}; 254};
255 255
256&ssi1 { 256&ssi1 {
257 fsl,mode = "i2s-slave";
258 status = "okay"; 257 status = "okay";
259}; 258};
260 259
@@ -335,10 +334,10 @@
335 imx6-riotboard { 334 imx6-riotboard {
336 pinctrl_audmux: audmuxgrp { 335 pinctrl_audmux: audmuxgrp {
337 fsl,pins = < 336 fsl,pins = <
338 MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x8000000 337 MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
339 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x8000000 338 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
340 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x8000000 339 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
341 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x8000000 340 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
342 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* CAM_MCLK */ 341 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* CAM_MCLK */
343 >; 342 >;
344 }; 343 };
@@ -376,7 +375,7 @@
376 fsl,pins = < 375 fsl,pins = <
377 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 376 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
378 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 377 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
379 MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x80000000 378 MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
380 MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 379 MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
381 MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 380 MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
382 MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 381 MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
@@ -389,9 +388,9 @@
389 MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 /* AR8035 pin strapping: MODE#1: pull up */ 388 MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 /* AR8035 pin strapping: MODE#1: pull up */
390 MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 /* AR8035 pin strapping: MODE#3: pull up */ 389 MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 /* AR8035 pin strapping: MODE#3: pull up */
391 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x130b0 /* AR8035 pin strapping: MODE#0: pull down */ 390 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x130b0 /* AR8035 pin strapping: MODE#0: pull down */
392 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0xc0000000 /* GPIO16 -> AR8035 25MHz */ 391 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 /* GPIO16 -> AR8035 25MHz */
393 MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x130b0 /* RGMII_nRST */ 392 MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x130b0 /* RGMII_nRST */
394 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* AR8035 interrupt */ 393 MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x180b0 /* AR8035 interrupt */
395 MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1 394 MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1
396 >; 395 >;
397 }; 396 };
@@ -426,8 +425,8 @@
426 425
427 pinctrl_led: ledgrp { 426 pinctrl_led: ledgrp {
428 fsl,pins = < 427 fsl,pins = <
429 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x80000000 /* user led0 */ 428 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x1b0b1 /* user led0 */
430 MX6QDL_PAD_EIM_D28__GPIO3_IO28 0x80000000 /* user led1 */ 429 MX6QDL_PAD_EIM_D28__GPIO3_IO28 0x1b0b1 /* user led1 */
431 >; 430 >;
432 }; 431 };
433 432
@@ -493,8 +492,8 @@
493 pinctrl_usbotg: usbotggrp { 492 pinctrl_usbotg: usbotggrp {
494 fsl,pins = < 493 fsl,pins = <
495 MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059 494 MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
496 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x80000000 /* MX6QDL_PAD_EIM_D22__USB_OTG_PWR */ 495 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x000b0 /* MX6QDL_PAD_EIM_D22__USB_OTG_PWR */
497 MX6QDL_PAD_EIM_D21__USB_OTG_OC 0x80000000 496 MX6QDL_PAD_EIM_D21__USB_OTG_OC 0x1b0b0
498 >; 497 >;
499 }; 498 };
500 499
@@ -506,8 +505,8 @@
506 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059 505 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
507 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059 506 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
508 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059 507 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
509 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 /* SD2 CD */ 508 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1b0b0 /* SD2 CD */
510 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* SD2 WP */ 509 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x1f0b0 /* SD2 WP */
511 >; 510 >;
512 }; 511 };
513 512
@@ -519,8 +518,8 @@
519 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 518 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
520 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 519 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
521 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 520 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
522 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* SD3 CD */ 521 MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 /* SD3 CD */
523 MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x80000000 /* SD3 WP */ 522 MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x1f0b0 /* SD3 WP */
524 >; 523 >;
525 }; 524 };
526 525
@@ -532,7 +531,7 @@
532 MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059 531 MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059
533 MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059 532 MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059
534 MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059 533 MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059
535 MX6QDL_PAD_NANDF_ALE__GPIO6_IO08 0x80000000 /* SD4 RST (eMMC) */ 534 MX6QDL_PAD_NANDF_ALE__GPIO6_IO08 0x17059 /* SD4 RST (eMMC) */
536 >; 535 >;
537 }; 536 };
538 }; 537 };
diff --git a/arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts b/arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts
new file mode 100644
index 000000000000..913bb9a0466a
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts
@@ -0,0 +1,103 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6dl.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6DL Module on CoMpact TFT";
18 compatible = "karo,imx6dl-tx6dl", "fsl,imx6dl";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 0>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 native-mode = <&ET070001DM6>;
61
62 ET070001DM6: CoMTFT { /* same as ET0700 but with inverted pixel clock */
63 clock-frequency = <33264000>;
64 hactive = <800>;
65 vactive = <480>;
66 hback-porch = <88>;
67 hsync-len = <128>;
68 hfront-porch = <40>;
69 vback-porch = <33>;
70 vsync-len = <2>;
71 vfront-porch = <10>;
72 hsync-active = <0>;
73 vsync-active = <0>;
74 de-active = <1>;
75 pixelclk-active = <1>;
76 };
77 };
78 };
79};
80
81&can1 {
82 status = "disabled";
83};
84
85&can2 {
86 xceiver-supply = <&reg_3v3>;
87};
88
89&ipu1_di0_disp0 {
90 remote-endpoint = <&display0_in>;
91};
92
93&kpp {
94 status = "disabled";
95};
96
97&reg_can_xcvr {
98 status = "disabled";
99};
100
101&touchscreen {
102 status = "disabled";
103};
diff --git a/arch/arm/boot/dts/imx6dl-tx6u-801x.dts b/arch/arm/boot/dts/imx6dl-tx6u-801x.dts
new file mode 100644
index 000000000000..5fe465c2814e
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-tx6u-801x.dts
@@ -0,0 +1,177 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6dl.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6U-801x Module";
18 compatible = "karo,imx6dl-tx6dl", "fsl,imx6dl";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 VGA {
61 clock-frequency = <25200000>;
62 hactive = <640>;
63 vactive = <480>;
64 hback-porch = <48>;
65 hsync-len = <96>;
66 hfront-porch = <16>;
67 vback-porch = <31>;
68 vsync-len = <2>;
69 vfront-porch = <12>;
70 hsync-active = <0>;
71 vsync-active = <0>;
72 de-active = <1>;
73 pixelclk-active = <0>;
74 };
75
76 ETV570 {
77 clock-frequency = <25200000>;
78 hactive = <640>;
79 vactive = <480>;
80 hback-porch = <114>;
81 hsync-len = <30>;
82 hfront-porch = <16>;
83 vback-porch = <32>;
84 vsync-len = <3>;
85 vfront-porch = <10>;
86 hsync-active = <0>;
87 vsync-active = <0>;
88 de-active = <1>;
89 pixelclk-active = <0>;
90 };
91
92 ET0350 {
93 clock-frequency = <6413760>;
94 hactive = <320>;
95 vactive = <240>;
96 hback-porch = <34>;
97 hsync-len = <34>;
98 hfront-porch = <20>;
99 vback-porch = <15>;
100 vsync-len = <3>;
101 vfront-porch = <4>;
102 hsync-active = <0>;
103 vsync-active = <0>;
104 de-active = <1>;
105 pixelclk-active = <0>;
106 };
107
108 ET0430 {
109 clock-frequency = <9009000>;
110 hactive = <480>;
111 vactive = <272>;
112 hback-porch = <2>;
113 hsync-len = <41>;
114 hfront-porch = <2>;
115 vback-porch = <2>;
116 vsync-len = <10>;
117 vfront-porch = <2>;
118 hsync-active = <0>;
119 vsync-active = <0>;
120 de-active = <1>;
121 pixelclk-active = <1>;
122 };
123
124 ET0500 {
125 clock-frequency = <33264000>;
126 hactive = <800>;
127 vactive = <480>;
128 hback-porch = <88>;
129 hsync-len = <128>;
130 hfront-porch = <40>;
131 vback-porch = <33>;
132 vsync-len = <2>;
133 vfront-porch = <10>;
134 hsync-active = <0>;
135 vsync-active = <0>;
136 de-active = <1>;
137 pixelclk-active = <0>;
138 };
139
140 ET0700 { /* same as ET0500 */
141 clock-frequency = <33264000>;
142 hactive = <800>;
143 vactive = <480>;
144 hback-porch = <88>;
145 hsync-len = <128>;
146 hfront-porch = <40>;
147 vback-porch = <33>;
148 vsync-len = <2>;
149 vfront-porch = <10>;
150 hsync-active = <0>;
151 vsync-active = <0>;
152 de-active = <1>;
153 pixelclk-active = <0>;
154 };
155
156 ETQ570 {
157 clock-frequency = <6596040>;
158 hactive = <320>;
159 vactive = <240>;
160 hback-porch = <38>;
161 hsync-len = <30>;
162 hfront-porch = <30>;
163 vback-porch = <16>;
164 vsync-len = <3>;
165 vfront-porch = <4>;
166 hsync-active = <0>;
167 vsync-active = <0>;
168 de-active = <1>;
169 pixelclk-active = <0>;
170 };
171 };
172 };
173};
174
175&ipu1_di0_disp0 {
176 remote-endpoint = <&display0_in>;
177};
diff --git a/arch/arm/boot/dts/imx6dl-tx6u-811x.dts b/arch/arm/boot/dts/imx6dl-tx6u-811x.dts
new file mode 100644
index 000000000000..c275eecc9472
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-tx6u-811x.dts
@@ -0,0 +1,150 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6dl.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6U-811x Module";
18 compatible = "karo,imx6dl-tx6dl", "fsl,imx6dl";
19
20 aliases {
21 display = &lvds0;
22 lvds0 = &lvds0;
23 lvds1 = &lvds1;
24 };
25
26 backlight0: backlight0 {
27 compatible = "pwm-backlight";
28 pwms = <&pwm2 0 500000 0>;
29 power-supply = <&reg_lcd0_pwr>;
30 /*
31 * a poor man's way to create a 1:1 relationship between
32 * the PWM value and the actual duty cycle
33 */
34 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
35 10 11 12 13 14 15 16 17 18 19
36 20 21 22 23 24 25 26 27 28 29
37 30 31 32 33 34 35 36 37 38 39
38 40 41 42 43 44 45 46 47 48 49
39 50 51 52 53 54 55 56 57 58 59
40 60 61 62 63 64 65 66 67 68 69
41 70 71 72 73 74 75 76 77 78 79
42 80 81 82 83 84 85 86 87 88 89
43 90 91 92 93 94 95 96 97 98 99
44 100>;
45 default-brightness-level = <50>;
46 };
47
48 backlight1: backlight1 {
49 compatible = "pwm-backlight";
50 pwms = <&pwm1 0 500000 0>;
51 power-supply = <&reg_lcd1_pwr>;
52 /*
53 * a poor man's way to create a 1:1 relationship between
54 * the PWM value and the actual duty cycle
55 */
56 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
57 10 11 12 13 14 15 16 17 18 19
58 20 21 22 23 24 25 26 27 28 29
59 30 31 32 33 34 35 36 37 38 39
60 40 41 42 43 44 45 46 47 48 49
61 50 51 52 53 54 55 56 57 58 59
62 60 61 62 63 64 65 66 67 68 69
63 70 71 72 73 74 75 76 77 78 79
64 80 81 82 83 84 85 86 87 88 89
65 90 91 92 93 94 95 96 97 98 99
66 100>;
67 default-brightness-level = <50>;
68 };
69};
70
71&i2c3 {
72 polytouch2: eeti@04 {
73 compatible = "eeti,egalax_ts";
74 reg = <0x04>;
75 pinctrl-names = "default";
76 pinctrl-0 = <&pinctrl_eeti>;
77 interrupt-parent = <&gpio3>;
78 interrupts = <22 0>;
79 wakeup-gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
80 linux,wakeup;
81 };
82};
83
84&iomuxc {
85 imx6dl-tx6u-811x {
86 pinctrl_eeti: eetigrp {
87 fsl,pins = <
88 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b1 /* Interrupt */
89 >;
90 };
91 };
92};
93
94&kpp {
95 status = "disabled"; /* pad conflict with backlight1 PWM */
96};
97
98&ldb {
99 status = "okay";
100
101 lvds0: lvds-channel@0 {
102 fsl,data-mapping = "spwg";
103 fsl,data-width = <18>;
104 status = "okay";
105
106 display-timings {
107 native-mode = <&lvds_timing0>;
108 lvds_timing0: hsd100pxn1 {
109 clock-frequency = <65000000>;
110 hactive = <1024>;
111 vactive = <768>;
112 hback-porch = <220>;
113 hfront-porch = <40>;
114 vback-porch = <21>;
115 vfront-porch = <7>;
116 hsync-len = <60>;
117 vsync-len = <10>;
118 de-active = <1>;
119 pixelclk-active = <1>;
120 };
121 };
122 };
123
124 lvds1: lvds-channel@1 {
125 fsl,data-mapping = "spwg";
126 fsl,data-width = <18>;
127 status = "disabled";
128
129 display-timings {
130 native-mode = <&lvds_timing1>;
131 lvds_timing1: hsd100pxn1 {
132 clock-frequency = <65000000>;
133 hactive = <1024>;
134 vactive = <768>;
135 hback-porch = <220>;
136 hfront-porch = <40>;
137 vback-porch = <21>;
138 vfront-porch = <7>;
139 hsync-len = <60>;
140 vsync-len = <10>;
141 de-active = <1>;
142 pixelclk-active = <1>;
143 };
144 };
145 };
146};
147
148&pwm1 {
149 status = "okay";
150};
diff --git a/arch/arm/boot/dts/imx6dl-wandboard-revb1.dts b/arch/arm/boot/dts/imx6dl-wandboard-revb1.dts
new file mode 100644
index 000000000000..f607d4f1d244
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-wandboard-revb1.dts
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6dl.dtsi"
13#include "imx6qdl-wandboard-revb1.dtsi"
14
15/ {
16 model = "Wandboard i.MX6 Dual Lite Board";
17 compatible = "wand,imx6dl-wandboard", "fsl,imx6dl";
18
19 memory {
20 reg = <0x10000000 0x40000000>;
21 };
22};
diff --git a/arch/arm/boot/dts/imx6dl-wandboard.dts b/arch/arm/boot/dts/imx6dl-wandboard.dts
index e672891c1626..bbb616723097 100644
--- a/arch/arm/boot/dts/imx6dl-wandboard.dts
+++ b/arch/arm/boot/dts/imx6dl-wandboard.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11/dts-v1/; 11/dts-v1/;
12#include "imx6dl.dtsi" 12#include "imx6dl.dtsi"
13#include "imx6qdl-wandboard.dtsi" 13#include "imx6qdl-wandboard-revc1.dtsi"
14 14
15/ { 15/ {
16 model = "Wandboard i.MX6 Dual Lite Board"; 16 model = "Wandboard i.MX6 Dual Lite Board";
diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
index 0a9c49d69d41..b453e0e28aee 100644
--- a/arch/arm/boot/dts/imx6dl.dtsi
+++ b/arch/arm/boot/dts/imx6dl.dtsi
@@ -35,8 +35,11 @@
35 396000 1175000 35 396000 1175000
36 >; 36 >;
37 clock-latency = <61036>; /* two CLK32 periods */ 37 clock-latency = <61036>; /* two CLK32 periods */
38 clocks = <&clks 104>, <&clks 6>, <&clks 16>, 38 clocks = <&clks IMX6QDL_CLK_ARM>,
39 <&clks 17>, <&clks 170>; 39 <&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
40 <&clks IMX6QDL_CLK_STEP>,
41 <&clks IMX6QDL_CLK_PLL1_SW>,
42 <&clks IMX6QDL_CLK_PLL1_SYS>;
40 clock-names = "arm", "pll2_pfd2_396m", "step", 43 clock-names = "arm", "pll2_pfd2_396m", "step",
41 "pll1_sw", "pll1_sys"; 44 "pll1_sw", "pll1_sys";
42 arm-supply = <&reg_arm>; 45 arm-supply = <&reg_arm>;
@@ -56,7 +59,7 @@
56 ocram: sram@00900000 { 59 ocram: sram@00900000 {
57 compatible = "mmio-sram"; 60 compatible = "mmio-sram";
58 reg = <0x00900000 0x20000>; 61 reg = <0x00900000 0x20000>;
59 clocks = <&clks 142>; 62 clocks = <&clks IMX6QDL_CLK_OCRAM>;
60 }; 63 };
61 64
62 aips1: aips-bus@02000000 { 65 aips1: aips-bus@02000000 {
@@ -87,7 +90,7 @@
87 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c"; 90 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
88 reg = <0x021f8000 0x4000>; 91 reg = <0x021f8000 0x4000>;
89 interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>; 92 interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>;
90 clocks = <&clks 116>; 93 clocks = <&clks IMX6DL_CLK_I2C4>;
91 status = "disabled"; 94 status = "disabled";
92 }; 95 };
93 }; 96 };
@@ -104,9 +107,9 @@
104}; 107};
105 108
106&ldb { 109&ldb {
107 clocks = <&clks 33>, <&clks 34>, 110 clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>, <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
108 <&clks 39>, <&clks 40>, 111 <&clks IMX6QDL_CLK_IPU1_DI0_SEL>, <&clks IMX6QDL_CLK_IPU1_DI1_SEL>,
109 <&clks 135>, <&clks 136>; 112 <&clks IMX6QDL_CLK_LDB_DI0>, <&clks IMX6QDL_CLK_LDB_DI1>;
110 clock-names = "di0_pll", "di1_pll", 113 clock-names = "di0_pll", "di1_pll",
111 "di0_sel", "di1_sel", 114 "di0_sel", "di1_sel",
112 "di0", "di1"; 115 "di0", "di1";
diff --git a/arch/arm/boot/dts/imx6q-cubox-i.dts b/arch/arm/boot/dts/imx6q-cubox-i.dts
index bc5f31e3e892..9efd8b0c8011 100644
--- a/arch/arm/boot/dts/imx6q-cubox-i.dts
+++ b/arch/arm/boot/dts/imx6q-cubox-i.dts
@@ -13,4 +13,8 @@
13 13
14&sata { 14&sata {
15 status = "okay"; 15 status = "okay";
16 fsl,transmit-level-mV = <1104>;
17 fsl,transmit-boost-mdB = <0>;
18 fsl,transmit-atten-16ths = <9>;
19 fsl,no-spread-spectrum;
16}; 20};
diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
index e0302636aff5..8c1cb53464a0 100644
--- a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
+++ b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
@@ -95,6 +95,12 @@
95 }; 95 };
96}; 96};
97 97
98&can1 {
99 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_can1>;
101 status = "okay";
102};
103
98&ecspi5 { 104&ecspi5 {
99 pinctrl-names = "default"; 105 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_ecspi5>; 106 pinctrl-0 = <&pinctrl_ecspi5>;
@@ -118,6 +124,13 @@
118 status = "okay"; 124 status = "okay";
119}; 125};
120 126
127&i2c1 {
128 clock-frequency = <100000>;
129 pinctrl-names = "default";
130 pinctrl-0 = <&pinctrl_i2c1>;
131 status = "okay";
132};
133
121&i2c2 { 134&i2c2 {
122 clock-frequency = <100000>; 135 clock-frequency = <100000>;
123 pinctrl-names = "default"; 136 pinctrl-names = "default";
@@ -274,6 +287,13 @@
274 }; 287 };
275}; 288};
276 289
290&i2c3 {
291 clock-frequency = <100000>;
292 pinctrl-names = "default";
293 pinctrl-0 = <&pinctrl_i2c3>;
294 status = "okay";
295};
296
277&iomuxc { 297&iomuxc {
278 pinctrl-names = "default"; 298 pinctrl-names = "default";
279 pinctrl-0 = <&pinctrl_hog>; 299 pinctrl-0 = <&pinctrl_hog>;
@@ -286,6 +306,13 @@
286 >; 306 >;
287 }; 307 };
288 308
309 pinctrl_can1: can1grp {
310 fsl,pins = <
311 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b0
312 MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
313 >;
314 };
315
289 pinctrl_ecspi5: ecspi5rp-1 { 316 pinctrl_ecspi5: ecspi5rp-1 {
290 fsl,pins = < 317 fsl,pins = <
291 MX6QDL_PAD_SD1_DAT0__ECSPI5_MISO 0x80000000 318 MX6QDL_PAD_SD1_DAT0__ECSPI5_MISO 0x80000000
@@ -316,6 +343,13 @@
316 >; 343 >;
317 }; 344 };
318 345
346 pinctrl_i2c1: i2c1grp {
347 fsl,pins = <
348 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
349 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
350 >;
351 };
352
319 pinctrl_i2c2: i2c2grp { 353 pinctrl_i2c2: i2c2grp {
320 fsl,pins = < 354 fsl,pins = <
321 MX6QDL_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1 355 MX6QDL_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1
@@ -323,6 +357,19 @@
323 >; 357 >;
324 }; 358 };
325 359
360 pinctrl_i2c3: i2c3grp {
361 fsl,pins = <
362 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
363 MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
364 >;
365 };
366
367 pinctrl_pcie: pciegrp {
368 fsl,pins = <
369 MX6QDL_PAD_KEY_COL1__GPIO4_IO08 0x100b1
370 >;
371 };
372
326 pinctrl_pfuze: pfuze100grp1 { 373 pinctrl_pfuze: pfuze100grp1 {
327 fsl,pins = < 374 fsl,pins = <
328 MX6QDL_PAD_EIM_D20__GPIO3_IO20 0x80000000 375 MX6QDL_PAD_EIM_D20__GPIO3_IO20 0x80000000
@@ -385,6 +432,13 @@
385 }; 432 };
386}; 433};
387 434
435&pcie {
436 pinctrl-names = "default";
437 pinctrl-0 = <&pinctrl_pcie>;
438 reset-gpio = <&gpio4 8 0>;
439 status = "okay";
440};
441
388&sata { 442&sata {
389 status = "okay"; 443 status = "okay";
390}; 444};
diff --git a/arch/arm/boot/dts/imx6q-gw51xx.dts b/arch/arm/boot/dts/imx6q-gw51xx.dts
index 0e1406e58eff..8e8bcd8fe0fb 100644
--- a/arch/arm/boot/dts/imx6q-gw51xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw51xx.dts
@@ -14,6 +14,6 @@
14#include "imx6qdl-gw51xx.dtsi" 14#include "imx6qdl-gw51xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 Quad GW51XX"; 17 model = "Gateworks Ventana i.MX6 Dual/Quad GW51XX";
18 compatible = "gw,imx6q-gw51xx", "gw,ventana", "fsl,imx6q"; 18 compatible = "gw,imx6q-gw51xx", "gw,ventana", "fsl,imx6q";
19}; 19};
diff --git a/arch/arm/boot/dts/imx6q-gw52xx.dts b/arch/arm/boot/dts/imx6q-gw52xx.dts
index 5f71ddbc7f05..a12c47e5ee05 100644
--- a/arch/arm/boot/dts/imx6q-gw52xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw52xx.dts
@@ -14,7 +14,7 @@
14#include "imx6qdl-gw52xx.dtsi" 14#include "imx6qdl-gw52xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 Quad GW52XX"; 17 model = "Gateworks Ventana i.MX6 Dual/Quad GW52XX";
18 compatible = "gw,imx6q-gw52xx", "gw,ventana", "fsl,imx6q"; 18 compatible = "gw,imx6q-gw52xx", "gw,ventana", "fsl,imx6q";
19}; 19};
20 20
diff --git a/arch/arm/boot/dts/imx6q-gw53xx.dts b/arch/arm/boot/dts/imx6q-gw53xx.dts
index 360c316b4740..d76aaa83dad0 100644
--- a/arch/arm/boot/dts/imx6q-gw53xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw53xx.dts
@@ -14,7 +14,7 @@
14#include "imx6qdl-gw53xx.dtsi" 14#include "imx6qdl-gw53xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 Quad GW53XX"; 17 model = "Gateworks Ventana i.MX6 Dual/Quad GW53XX";
18 compatible = "gw,imx6q-gw53xx", "gw,ventana", "fsl,imx6q"; 18 compatible = "gw,imx6q-gw53xx", "gw,ventana", "fsl,imx6q";
19}; 19};
20 20
diff --git a/arch/arm/boot/dts/imx6q-gw5400-a.dts b/arch/arm/boot/dts/imx6q-gw5400-a.dts
index 3689eaa58826..22e6f8e657d2 100644
--- a/arch/arm/boot/dts/imx6q-gw5400-a.dts
+++ b/arch/arm/boot/dts/imx6q-gw5400-a.dts
@@ -115,9 +115,9 @@
115 }; 115 };
116 116
117 sound { 117 sound {
118 compatible = "fsl,imx6q-sabrelite-sgtl5000", 118 compatible = "fsl,imx6q-ventana-sgtl5000",
119 "fsl,imx-audio-sgtl5000"; 119 "fsl,imx-audio-sgtl5000";
120 model = "imx6q-sabrelite-sgtl5000"; 120 model = "sgtl5000-audio";
121 ssi-controller = <&ssi1>; 121 ssi-controller = <&ssi1>;
122 audio-codec = <&codec>; 122 audio-codec = <&codec>;
123 audio-routing = 123 audio-routing =
@@ -504,7 +504,6 @@
504}; 504};
505 505
506&ssi1 { 506&ssi1 {
507 fsl,mode = "i2s-slave";
508 status = "okay"; 507 status = "okay";
509}; 508};
510 509
diff --git a/arch/arm/boot/dts/imx6q-gw54xx.dts b/arch/arm/boot/dts/imx6q-gw54xx.dts
index ab518d66a75e..6e8f53e92a2d 100644
--- a/arch/arm/boot/dts/imx6q-gw54xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw54xx.dts
@@ -14,7 +14,7 @@
14#include "imx6qdl-gw54xx.dtsi" 14#include "imx6qdl-gw54xx.dtsi"
15 15
16/ { 16/ {
17 model = "Gateworks Ventana i.MX6 Quad GW54XX"; 17 model = "Gateworks Ventana i.MX6 Dual/Quad GW54XX";
18 compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q"; 18 compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q";
19}; 19};
20 20
diff --git a/arch/arm/boot/dts/imx6q-rex-pro.dts b/arch/arm/boot/dts/imx6q-rex-pro.dts
new file mode 100644
index 000000000000..3c2852b16f78
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-rex-pro.dts
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2014 FEDEVEL, Inc.
3 *
4 * Author: Robert Nelson <robertcnelson@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6q.dtsi"
13#include "imx6qdl-rex.dtsi"
14
15/ {
16 model = "Rex Pro i.MX6 Quad Board";
17 compatible = "rex,imx6q-rex-pro", "fsl,imx6q";
18
19 memory {
20 reg = <0x10000000 0x80000000>;
21 };
22};
23
24&ecspi3 {
25 flash: m25p80@0 {
26 compatible = "sst,sst25vf032b";
27 spi-max-frequency = <20000000>;
28 reg = <0>;
29 };
30};
31
32&sata {
33 status = "okay";
34};
diff --git a/arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dts b/arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dts
new file mode 100644
index 000000000000..b18fae10b2e3
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dts
@@ -0,0 +1,103 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6Q-1010 Module on CoMpact TFT";
18 compatible = "karo,imx6q-tx6q", "fsl,imx6q";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 0>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 native-mode = <&ET070001DM6>;
61
62 ET070001DM6: CoMTFT { /* same as ET0700 but with inverted pixel clock */
63 clock-frequency = <33264000>;
64 hactive = <800>;
65 vactive = <480>;
66 hback-porch = <88>;
67 hsync-len = <128>;
68 hfront-porch = <40>;
69 vback-porch = <33>;
70 vsync-len = <2>;
71 vfront-porch = <10>;
72 hsync-active = <0>;
73 vsync-active = <0>;
74 de-active = <1>;
75 pixelclk-active = <1>;
76 };
77 };
78 };
79};
80
81&can1 {
82 status = "disabled";
83};
84
85&can2 {
86 xceiver-supply = <&reg_3v3>;
87};
88
89&ipu1_di0_disp0 {
90 remote-endpoint = <&display0_in>;
91};
92
93&kpp {
94 status = "disabled";
95};
96
97&reg_can_xcvr {
98 status = "disabled";
99};
100
101&touchscreen {
102 status = "disabled";
103};
diff --git a/arch/arm/boot/dts/imx6q-tx6q-1010.dts b/arch/arm/boot/dts/imx6q-tx6q-1010.dts
new file mode 100644
index 000000000000..b58ec9c966c8
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tx6q-1010.dts
@@ -0,0 +1,177 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6Q-1010 Module";
18 compatible = "karo,imx6q-tx6q", "fsl,imx6q";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 VGA {
61 clock-frequency = <25200000>;
62 hactive = <640>;
63 vactive = <480>;
64 hback-porch = <48>;
65 hsync-len = <96>;
66 hfront-porch = <16>;
67 vback-porch = <31>;
68 vsync-len = <2>;
69 vfront-porch = <12>;
70 hsync-active = <0>;
71 vsync-active = <0>;
72 de-active = <1>;
73 pixelclk-active = <0>;
74 };
75
76 ETV570 {
77 clock-frequency = <25200000>;
78 hactive = <640>;
79 vactive = <480>;
80 hback-porch = <114>;
81 hsync-len = <30>;
82 hfront-porch = <16>;
83 vback-porch = <32>;
84 vsync-len = <3>;
85 vfront-porch = <10>;
86 hsync-active = <0>;
87 vsync-active = <0>;
88 de-active = <1>;
89 pixelclk-active = <0>;
90 };
91
92 ET0350 {
93 clock-frequency = <6413760>;
94 hactive = <320>;
95 vactive = <240>;
96 hback-porch = <34>;
97 hsync-len = <34>;
98 hfront-porch = <20>;
99 vback-porch = <15>;
100 vsync-len = <3>;
101 vfront-porch = <4>;
102 hsync-active = <0>;
103 vsync-active = <0>;
104 de-active = <1>;
105 pixelclk-active = <0>;
106 };
107
108 ET0430 {
109 clock-frequency = <9009000>;
110 hactive = <480>;
111 vactive = <272>;
112 hback-porch = <2>;
113 hsync-len = <41>;
114 hfront-porch = <2>;
115 vback-porch = <2>;
116 vsync-len = <10>;
117 vfront-porch = <2>;
118 hsync-active = <0>;
119 vsync-active = <0>;
120 de-active = <1>;
121 pixelclk-active = <1>;
122 };
123
124 ET0500 {
125 clock-frequency = <33264000>;
126 hactive = <800>;
127 vactive = <480>;
128 hback-porch = <88>;
129 hsync-len = <128>;
130 hfront-porch = <40>;
131 vback-porch = <33>;
132 vsync-len = <2>;
133 vfront-porch = <10>;
134 hsync-active = <0>;
135 vsync-active = <0>;
136 de-active = <1>;
137 pixelclk-active = <0>;
138 };
139
140 ET0700 { /* same as ET0500 */
141 clock-frequency = <33264000>;
142 hactive = <800>;
143 vactive = <480>;
144 hback-porch = <88>;
145 hsync-len = <128>;
146 hfront-porch = <40>;
147 vback-porch = <33>;
148 vsync-len = <2>;
149 vfront-porch = <10>;
150 hsync-active = <0>;
151 vsync-active = <0>;
152 de-active = <1>;
153 pixelclk-active = <0>;
154 };
155
156 ETQ570 {
157 clock-frequency = <6596040>;
158 hactive = <320>;
159 vactive = <240>;
160 hback-porch = <38>;
161 hsync-len = <30>;
162 hfront-porch = <30>;
163 vback-porch = <16>;
164 vsync-len = <3>;
165 vfront-porch = <4>;
166 hsync-active = <0>;
167 vsync-active = <0>;
168 de-active = <1>;
169 pixelclk-active = <0>;
170 };
171 };
172 };
173};
174
175&ipu1_di0_disp0 {
176 remote-endpoint = <&display0_in>;
177};
diff --git a/arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts b/arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts
new file mode 100644
index 000000000000..0bb9a9de62a9
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts
@@ -0,0 +1,136 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6Q-1020 Module on CoMpact TFT";
18 compatible = "karo,imx6q-tx6q", "fsl,imx6q";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 0>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 native-mode = <&ET070001DM6>;
61
62 ET070001DM6: CoMTFT { /* same as ET0700 but with inverted pixel clock */
63 clock-frequency = <33264000>;
64 hactive = <800>;
65 vactive = <480>;
66 hback-porch = <88>;
67 hsync-len = <128>;
68 hfront-porch = <40>;
69 vback-porch = <33>;
70 vsync-len = <2>;
71 vfront-porch = <10>;
72 hsync-active = <0>;
73 vsync-active = <0>;
74 de-active = <1>;
75 pixelclk-active = <1>;
76 };
77 };
78 };
79};
80
81&can1 {
82 status = "disabled";
83};
84
85&can2 {
86 xceiver-supply = <&reg_3v3>;
87};
88
89&ds1339 {
90 status = "disabled";
91};
92
93&gpmi {
94 status = "disabled";
95};
96
97&iomuxc {
98 imx6qdl-tx6 {
99 pinctrl_usdhc4: usdhc4grp {
100 fsl,pins = <
101 MX6QDL_PAD_SD4_CMD__SD4_CMD 0x070b1
102 MX6QDL_PAD_SD4_CLK__SD4_CLK 0x070b1
103 MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x070b1
104 MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x070b1
105 MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x070b1
106 MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x070b1
107 MX6QDL_PAD_NANDF_ALE__SD4_RESET 0x0b0b1
108 >;
109 };
110 };
111};
112
113&ipu1_di0_disp0 {
114 remote-endpoint = <&display0_in>;
115};
116
117&kpp {
118 status = "disabled";
119};
120
121&reg_can_xcvr {
122 status = "disabled";
123};
124
125&touchscreen {
126 status = "disabled";
127};
128
129&usdhc4 {
130 pinctrl-names = "default";
131 pinctrl-0 = <&pinctrl_usdhc4>;
132 bus-width = <4>;
133 no-1-8-v;
134 fsl,wp-controller;
135 status = "okay";
136};
diff --git a/arch/arm/boot/dts/imx6q-tx6q-1020.dts b/arch/arm/boot/dts/imx6q-tx6q-1020.dts
new file mode 100644
index 000000000000..b96d80a35d39
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tx6q-1020.dts
@@ -0,0 +1,210 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6Q-1020 Module";
18 compatible = "karo,imx6q-tx6q", "fsl,imx6q";
19
20 aliases {
21 display = &display;
22 };
23
24 backlight: backlight {
25 compatible = "pwm-backlight";
26 pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>;
27 power-supply = <&reg_3v3>;
28 /*
29 * a poor man's way to create a 1:1 relationship between
30 * the PWM value and the actual duty cycle
31 */
32 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
33 10 11 12 13 14 15 16 17 18 19
34 20 21 22 23 24 25 26 27 28 29
35 30 31 32 33 34 35 36 37 38 39
36 40 41 42 43 44 45 46 47 48 49
37 50 51 52 53 54 55 56 57 58 59
38 60 61 62 63 64 65 66 67 68 69
39 70 71 72 73 74 75 76 77 78 79
40 80 81 82 83 84 85 86 87 88 89
41 90 91 92 93 94 95 96 97 98 99
42 100>;
43 default-brightness-level = <50>;
44 };
45
46 display: display@di0 {
47 compatible = "fsl,imx-parallel-display";
48 interface-pix-fmt = "rgb24";
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_disp0_1>;
51 status = "okay";
52
53 port {
54 display0_in: endpoint {
55 remote-endpoint = <&ipu1_di0_disp0>;
56 };
57 };
58
59 display-timings {
60 VGA {
61 clock-frequency = <25200000>;
62 hactive = <640>;
63 vactive = <480>;
64 hback-porch = <48>;
65 hsync-len = <96>;
66 hfront-porch = <16>;
67 vback-porch = <31>;
68 vsync-len = <2>;
69 vfront-porch = <12>;
70 hsync-active = <0>;
71 vsync-active = <0>;
72 de-active = <1>;
73 pixelclk-active = <0>;
74 };
75
76 ETV570 {
77 clock-frequency = <25200000>;
78 hactive = <640>;
79 vactive = <480>;
80 hback-porch = <114>;
81 hsync-len = <30>;
82 hfront-porch = <16>;
83 vback-porch = <32>;
84 vsync-len = <3>;
85 vfront-porch = <10>;
86 hsync-active = <0>;
87 vsync-active = <0>;
88 de-active = <1>;
89 pixelclk-active = <0>;
90 };
91
92 ET0350 {
93 clock-frequency = <6413760>;
94 hactive = <320>;
95 vactive = <240>;
96 hback-porch = <34>;
97 hsync-len = <34>;
98 hfront-porch = <20>;
99 vback-porch = <15>;
100 vsync-len = <3>;
101 vfront-porch = <4>;
102 hsync-active = <0>;
103 vsync-active = <0>;
104 de-active = <1>;
105 pixelclk-active = <0>;
106 };
107
108 ET0430 {
109 clock-frequency = <9009000>;
110 hactive = <480>;
111 vactive = <272>;
112 hback-porch = <2>;
113 hsync-len = <41>;
114 hfront-porch = <2>;
115 vback-porch = <2>;
116 vsync-len = <10>;
117 vfront-porch = <2>;
118 hsync-active = <0>;
119 vsync-active = <0>;
120 de-active = <1>;
121 pixelclk-active = <1>;
122 };
123
124 ET0500 {
125 clock-frequency = <33264000>;
126 hactive = <800>;
127 vactive = <480>;
128 hback-porch = <88>;
129 hsync-len = <128>;
130 hfront-porch = <40>;
131 vback-porch = <33>;
132 vsync-len = <2>;
133 vfront-porch = <10>;
134 hsync-active = <0>;
135 vsync-active = <0>;
136 de-active = <1>;
137 pixelclk-active = <0>;
138 };
139
140 ET0700 { /* same as ET0500 */
141 clock-frequency = <33264000>;
142 hactive = <800>;
143 vactive = <480>;
144 hback-porch = <88>;
145 hsync-len = <128>;
146 hfront-porch = <40>;
147 vback-porch = <33>;
148 vsync-len = <2>;
149 vfront-porch = <10>;
150 hsync-active = <0>;
151 vsync-active = <0>;
152 de-active = <1>;
153 pixelclk-active = <0>;
154 };
155
156 ETQ570 {
157 clock-frequency = <6596040>;
158 hactive = <320>;
159 vactive = <240>;
160 hback-porch = <38>;
161 hsync-len = <30>;
162 hfront-porch = <30>;
163 vback-porch = <16>;
164 vsync-len = <3>;
165 vfront-porch = <4>;
166 hsync-active = <0>;
167 vsync-active = <0>;
168 de-active = <1>;
169 pixelclk-active = <0>;
170 };
171 };
172 };
173};
174
175&ds1339 {
176 status = "disabled";
177};
178
179&gpmi {
180 status = "disabled";
181};
182
183&iomuxc {
184 imx6qdl-tx6 {
185 pinctrl_usdhc4: usdhc4grp {
186 fsl,pins = <
187 MX6QDL_PAD_SD4_CMD__SD4_CMD 0x070b1
188 MX6QDL_PAD_SD4_CLK__SD4_CLK 0x070b1
189 MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x070b1
190 MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x070b1
191 MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x070b1
192 MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x070b1
193 MX6QDL_PAD_NANDF_ALE__SD4_RESET 0x0b0b1
194 >;
195 };
196 };
197};
198
199&ipu1_di0_disp0 {
200 remote-endpoint = <&display0_in>;
201};
202
203&usdhc4 {
204 pinctrl-names = "default";
205 pinctrl-0 = <&pinctrl_usdhc4>;
206 bus-width = <4>;
207 no-1-8-v;
208 fsl,wp-controller;
209 status = "okay";
210};
diff --git a/arch/arm/boot/dts/imx6q-tx6q-1110.dts b/arch/arm/boot/dts/imx6q-tx6q-1110.dts
new file mode 100644
index 000000000000..88aa1e4c792d
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-tx6q-1110.dts
@@ -0,0 +1,154 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13#include "imx6q.dtsi"
14#include "imx6qdl-tx6.dtsi"
15
16/ {
17 model = "Ka-Ro electronics TX6Q-1110 Module";
18 compatible = "karo,imx6q-tx6q", "fsl,imx6q";
19
20 aliases {
21 display = &lvds0;
22 lvds0 = &lvds0;
23 lvds1 = &lvds1;
24 };
25
26 backlight0: backlight0 {
27 compatible = "pwm-backlight";
28 pwms = <&pwm2 0 500000 0>;
29 power-supply = <&reg_lcd0_pwr>;
30 /*
31 * a poor man's way to create a 1:1 relationship between
32 * the PWM value and the actual duty cycle
33 */
34 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
35 10 11 12 13 14 15 16 17 18 19
36 20 21 22 23 24 25 26 27 28 29
37 30 31 32 33 34 35 36 37 38 39
38 40 41 42 43 44 45 46 47 48 49
39 50 51 52 53 54 55 56 57 58 59
40 60 61 62 63 64 65 66 67 68 69
41 70 71 72 73 74 75 76 77 78 79
42 80 81 82 83 84 85 86 87 88 89
43 90 91 92 93 94 95 96 97 98 99
44 100>;
45 default-brightness-level = <50>;
46 };
47
48 backlight1: backlight1 {
49 compatible = "pwm-backlight";
50 pwms = <&pwm1 0 500000 0>;
51 power-supply = <&reg_lcd1_pwr>;
52 /*
53 * a poor man's way to create a 1:1 relationship between
54 * the PWM value and the actual duty cycle
55 */
56 brightness-levels = < 0 1 2 3 4 5 6 7 8 9
57 10 11 12 13 14 15 16 17 18 19
58 20 21 22 23 24 25 26 27 28 29
59 30 31 32 33 34 35 36 37 38 39
60 40 41 42 43 44 45 46 47 48 49
61 50 51 52 53 54 55 56 57 58 59
62 60 61 62 63 64 65 66 67 68 69
63 70 71 72 73 74 75 76 77 78 79
64 80 81 82 83 84 85 86 87 88 89
65 90 91 92 93 94 95 96 97 98 99
66 100>;
67 default-brightness-level = <50>;
68 };
69};
70
71&i2c3 {
72 polytouch1: eeti@04 {
73 compatible = "eeti,egalax_ts";
74 reg = <0x04>;
75 pinctrl-names = "default";
76 pinctrl-0 = <&pinctrl_eeti>;
77 interrupt-parent = <&gpio3>;
78 interrupts = <22 0>;
79 wakeup-gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
80 linux,wakeup;
81 };
82};
83
84&iomuxc {
85 imx6q-tx6q-1110 {
86 pinctrl_eeti: eetigrp {
87 fsl,pins = <
88 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b1 /* Interrupt */
89 >;
90 };
91 };
92};
93
94&kpp {
95 status = "disabled"; /* pad conflict with backlight1 PWM */
96};
97
98&ldb {
99 status = "okay";
100
101 lvds0: lvds-channel@0 {
102 fsl,data-mapping = "spwg";
103 fsl,data-width = <18>;
104 status = "okay";
105
106 display-timings {
107 native-mode = <&lvds_timing0>;
108 lvds_timing0: hsd100pxn1 {
109 clock-frequency = <65000000>;
110 hactive = <1024>;
111 vactive = <768>;
112 hback-porch = <220>;
113 hfront-porch = <40>;
114 vback-porch = <21>;
115 vfront-porch = <7>;
116 hsync-len = <60>;
117 vsync-len = <10>;
118 de-active = <1>;
119 pixelclk-active = <1>;
120 };
121 };
122 };
123
124 lvds1: lvds-channel@1 {
125 fsl,data-mapping = "spwg";
126 fsl,data-width = <18>;
127 status = "disabled";
128
129 display-timings {
130 native-mode = <&lvds_timing1>;
131 lvds_timing1: hsd100pxn1 {
132 clock-frequency = <65000000>;
133 hactive = <1024>;
134 vactive = <768>;
135 hback-porch = <220>;
136 hfront-porch = <40>;
137 vback-porch = <21>;
138 vfront-porch = <7>;
139 hsync-len = <60>;
140 vsync-len = <10>;
141 de-active = <1>;
142 pixelclk-active = <1>;
143 };
144 };
145 };
146};
147
148&pwm1 {
149 status = "okay";
150};
151
152&sata {
153 status = "okay";
154};
diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts
index 6c561060bf5c..e3bff2ac00db 100644
--- a/arch/arm/boot/dts/imx6q-udoo.dts
+++ b/arch/arm/boot/dts/imx6q-udoo.dts
@@ -23,6 +23,23 @@
23 memory { 23 memory {
24 reg = <0x10000000 0x40000000>; 24 reg = <0x10000000 0x40000000>;
25 }; 25 };
26
27 regulators {
28 compatible = "simple-bus";
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 reg_usb_h1_vbus: regulator@0 {
33 compatible = "regulator-fixed";
34 reg = <0>;
35 regulator-name = "usb_h1_vbus";
36 regulator-min-microvolt = <5000000>;
37 regulator-max-microvolt = <5000000>;
38 enable-active-high;
39 startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */
40 gpio = <&gpio7 12 0>;
41 };
42 };
26}; 43};
27 44
28&fec { 45&fec {
@@ -81,6 +98,13 @@
81 >; 98 >;
82 }; 99 };
83 100
101 pinctrl_usbh: usbhgrp {
102 fsl,pins = <
103 MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000
104 MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0
105 >;
106 };
107
84 pinctrl_usdhc3: usdhc3grp { 108 pinctrl_usdhc3: usdhc3grp {
85 fsl,pins = < 109 fsl,pins = <
86 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 110 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
@@ -104,6 +128,14 @@
104 status = "okay"; 128 status = "okay";
105}; 129};
106 130
131&usbh1 {
132 pinctrl-names = "default";
133 pinctrl-0 = <&pinctrl_usbh>;
134 vbus-supply = <&reg_usb_h1_vbus>;
135 clocks = <&clks 201>;
136 status = "okay";
137};
138
107&usdhc3 { 139&usdhc3 {
108 pinctrl-names = "default"; 140 pinctrl-names = "default";
109 pinctrl-0 = <&pinctrl_usdhc3>; 141 pinctrl-0 = <&pinctrl_usdhc3>;
diff --git a/arch/arm/boot/dts/imx6q-wandboard-revb1.dts b/arch/arm/boot/dts/imx6q-wandboard-revb1.dts
new file mode 100644
index 000000000000..20bf3c282623
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-wandboard-revb1.dts
@@ -0,0 +1,26 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6q.dtsi"
13#include "imx6qdl-wandboard-revb1.dtsi"
14
15/ {
16 model = "Wandboard i.MX6 Quad Board";
17 compatible = "wand,imx6q-wandboard", "fsl,imx6q";
18
19 memory {
20 reg = <0x10000000 0x80000000>;
21 };
22};
23
24&sata {
25 status = "okay";
26};
diff --git a/arch/arm/boot/dts/imx6q-wandboard.dts b/arch/arm/boot/dts/imx6q-wandboard.dts
index 36be17f207b1..4a8a6ee13e9f 100644
--- a/arch/arm/boot/dts/imx6q-wandboard.dts
+++ b/arch/arm/boot/dts/imx6q-wandboard.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11/dts-v1/; 11/dts-v1/;
12#include "imx6q.dtsi" 12#include "imx6q.dtsi"
13#include "imx6qdl-wandboard.dtsi" 13#include "imx6qdl-wandboard-revc1.dtsi"
14 14
15/ { 15/ {
16 model = "Wandboard i.MX6 Quad Board"; 16 model = "Wandboard i.MX6 Quad Board";
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index addd3f881ce2..e9f3646d1760 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -43,8 +43,11 @@
43 396000 1175000 43 396000 1175000
44 >; 44 >;
45 clock-latency = <61036>; /* two CLK32 periods */ 45 clock-latency = <61036>; /* two CLK32 periods */
46 clocks = <&clks 104>, <&clks 6>, <&clks 16>, 46 clocks = <&clks IMX6QDL_CLK_ARM>,
47 <&clks 17>, <&clks 170>; 47 <&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
48 <&clks IMX6QDL_CLK_STEP>,
49 <&clks IMX6QDL_CLK_PLL1_SW>,
50 <&clks IMX6QDL_CLK_PLL1_SYS>;
48 clock-names = "arm", "pll2_pfd2_396m", "step", 51 clock-names = "arm", "pll2_pfd2_396m", "step",
49 "pll1_sw", "pll1_sys"; 52 "pll1_sw", "pll1_sys";
50 arm-supply = <&reg_arm>; 53 arm-supply = <&reg_arm>;
@@ -78,7 +81,7 @@
78 ocram: sram@00900000 { 81 ocram: sram@00900000 {
79 compatible = "mmio-sram"; 82 compatible = "mmio-sram";
80 reg = <0x00900000 0x40000>; 83 reg = <0x00900000 0x40000>;
81 clocks = <&clks 142>; 84 clocks = <&clks IMX6QDL_CLK_OCRAM>;
82 }; 85 };
83 86
84 aips-bus@02000000 { /* AIPS1 */ 87 aips-bus@02000000 { /* AIPS1 */
@@ -89,7 +92,8 @@
89 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 92 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
90 reg = <0x02018000 0x4000>; 93 reg = <0x02018000 0x4000>;
91 interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>; 94 interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>;
92 clocks = <&clks 116>, <&clks 116>; 95 clocks = <&clks IMX6Q_CLK_ECSPI5>,
96 <&clks IMX6Q_CLK_ECSPI5>;
93 clock-names = "ipg", "per"; 97 clock-names = "ipg", "per";
94 status = "disabled"; 98 status = "disabled";
95 }; 99 };
@@ -140,7 +144,9 @@
140 compatible = "fsl,imx6q-ahci"; 144 compatible = "fsl,imx6q-ahci";
141 reg = <0x02200000 0x4000>; 145 reg = <0x02200000 0x4000>;
142 interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>; 146 interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
143 clocks = <&clks 154>, <&clks 187>, <&clks 105>; 147 clocks = <&clks IMX6QDL_CLK_SATA>,
148 <&clks IMX6QDL_CLK_SATA_REF_100M>,
149 <&clks IMX6QDL_CLK_AHB>;
144 clock-names = "sata", "sata_ref", "ahb"; 150 clock-names = "sata", "sata_ref", "ahb";
145 status = "disabled"; 151 status = "disabled";
146 }; 152 };
@@ -152,10 +158,20 @@
152 reg = <0x02800000 0x400000>; 158 reg = <0x02800000 0x400000>;
153 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, 159 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>,
154 <0 7 IRQ_TYPE_LEVEL_HIGH>; 160 <0 7 IRQ_TYPE_LEVEL_HIGH>;
155 clocks = <&clks 133>, <&clks 134>, <&clks 137>; 161 clocks = <&clks IMX6QDL_CLK_IPU2>,
162 <&clks IMX6QDL_CLK_IPU2_DI0>,
163 <&clks IMX6QDL_CLK_IPU2_DI1>;
156 clock-names = "bus", "di0", "di1"; 164 clock-names = "bus", "di0", "di1";
157 resets = <&src 4>; 165 resets = <&src 4>;
158 166
167 ipu2_csi0: port@0 {
168 reg = <0>;
169 };
170
171 ipu2_csi1: port@1 {
172 reg = <1>;
173 };
174
159 ipu2_di0: port@2 { 175 ipu2_di0: port@2 {
160 #address-cells = <1>; 176 #address-cells = <1>;
161 #size-cells = <0>; 177 #size-cells = <0>;
@@ -230,9 +246,10 @@
230}; 246};
231 247
232&ldb { 248&ldb {
233 clocks = <&clks 33>, <&clks 34>, 249 clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>, <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
234 <&clks 39>, <&clks 40>, <&clks 41>, <&clks 42>, 250 <&clks IMX6QDL_CLK_IPU1_DI0_SEL>, <&clks IMX6QDL_CLK_IPU1_DI1_SEL>,
235 <&clks 135>, <&clks 136>; 251 <&clks IMX6QDL_CLK_IPU2_DI0_SEL>, <&clks IMX6QDL_CLK_IPU2_DI1_SEL>,
252 <&clks IMX6QDL_CLK_LDB_DI0>, <&clks IMX6QDL_CLK_LDB_DI1>;
236 clock-names = "di0_pll", "di1_pll", 253 clock-names = "di0_pll", "di1_pll",
237 "di0_sel", "di1_sel", "di2_sel", "di3_sel", 254 "di0_sel", "di1_sel", "di2_sel", "di3_sel",
238 "di0", "di1"; 255 "di0", "di1";
diff --git a/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
new file mode 100644
index 000000000000..e6d9195a1da7
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-aristainetos.dtsi
@@ -0,0 +1,418 @@
1/*
2 * support fot the imx6 based aristainetos board
3 *
4 * Copyright (C) 2014 Heiko Schocher <hs@denx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <dt-bindings/gpio/gpio.h>
13
14/ {
15 regulators {
16 compatible = "simple-bus";
17 #address-cells = <1>;
18 #size-cells = <0>;
19
20 reg_2p5v: regulator@0 {
21 compatible = "regulator-fixed";
22 regulator-name = "2P5V";
23 regulator-min-microvolt = <2500000>;
24 regulator-max-microvolt = <2500000>;
25 regulator-always-on;
26 };
27
28 reg_3p3v: regulator@1 {
29 compatible = "regulator-fixed";
30 regulator-name = "3P3V";
31 regulator-min-microvolt = <3300000>;
32 regulator-max-microvolt = <3300000>;
33 regulator-always-on;
34 };
35
36 reg_usbh1_vbus: regulator@2 {
37 compatible = "regulator-fixed";
38 enable-active-high;
39 gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>;
40 pinctrl-names = "default";
41 pinctrl-0 = <&pinctrl_aristainetos_usbh1_vbus>;
42 regulator-name = "usb_h1_vbus";
43 regulator-min-microvolt = <5000000>;
44 regulator-max-microvolt = <5000000>;
45 };
46
47 reg_usbotg_vbus: regulator@3 {
48 compatible = "regulator-fixed";
49 enable-active-high;
50 gpio = <&gpio4 15 GPIO_ACTIVE_HIGH>;
51 pinctrl-names = "default";
52 pinctrl-0 = <&pinctrl_aristainetos_usbotg_vbus>;
53 regulator-name = "usb_otg_vbus";
54 regulator-min-microvolt = <5000000>;
55 regulator-max-microvolt = <5000000>;
56 };
57 };
58};
59
60&audmux {
61 pinctrl-names = "default";
62 pinctrl-0 = <&pinctrl_audmux>;
63 status = "okay";
64};
65
66&can1 {
67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_flexcan1>;
69 status = "okay";
70};
71
72&can2 {
73 pinctrl-names = "default";
74 pinctrl-0 = <&pinctrl_flexcan2>;
75 status = "okay";
76};
77
78&i2c1 {
79 clock-frequency = <100000>;
80 pinctrl-names = "default";
81 pinctrl-0 = <&pinctrl_i2c1>;
82 status = "okay";
83
84 tmp103: tmp103@71 {
85 compatible = "ti,tmp103";
86 reg = <0x71>;
87 };
88};
89
90&i2c3 {
91 clock-frequency = <100000>;
92 pinctrl-names = "default";
93 pinctrl-0 = <&pinctrl_i2c3>;
94 status = "okay";
95
96 rtc@68 {
97 compatible = "dallas,m41t00";
98 reg = <0x68>;
99 };
100};
101
102&ecspi4 {
103 fsl,spi-num-chipselects = <1>;
104 cs-gpios = <&gpio3 20 0>;
105 pinctrl-names = "default";
106 pinctrl-0 = <&pinctrl_ecspi4>;
107 status = "okay";
108
109 flash: m25p80@0 {
110 #address-cells = <1>;
111 #size-cells = <1>;
112 compatible = "micron,n25q128a11";
113 spi-max-frequency = <20000000>;
114 reg = <0>;
115 };
116};
117
118&fec {
119 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_enet>;
121 phy-mode = "rmii";
122 phy-reset-gpios = <&gpio3 29 GPIO_ACTIVE_HIGH>;
123 status = "okay";
124};
125
126&gpmi {
127 pinctrl-names = "default";
128 pinctrl-0 = <&pinctrl_gpmi_nand>;
129 status = "okay";
130};
131
132&pcie {
133 status = "okay";
134};
135
136&uart2 {
137 pinctrl-names = "default";
138 pinctrl-0 = <&pinctrl_uart2>;
139 status = "okay";
140};
141
142
143&uart4 {
144 pinctrl-names = "default";
145 pinctrl-0 = <&pinctrl_uart4>;
146 fsl,uart-has-rtscts;
147 status = "okay";
148};
149
150&uart5 {
151 pinctrl-names = "default";
152 pinctrl-0 = <&pinctrl_uart5>;
153 fsl,uart-has-rtscts;
154 status = "okay";
155};
156
157&usbh1 {
158 vbus-supply = <&reg_usbh1_vbus>;
159 dr_mode = "host";
160 status = "okay";
161};
162
163&usbotg {
164 vbus-supply = <&reg_usbotg_vbus>;
165 pinctrl-names = "default";
166 pinctrl-0 = <&pinctrl_usbotg>;
167 disable-over-current;
168 dr_mode = "host";
169 status = "okay";
170};
171
172&usdhc1 {
173 pinctrl-names = "default";
174 pinctrl-0 = <&pinctrl_usdhc1>;
175 vmmc-supply = <&reg_3p3v>;
176 cd-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>;
177 status = "okay";
178};
179
180&usdhc2 {
181 pinctrl-names = "default";
182 pinctrl-0 = <&pinctrl_usdhc2>;
183 vmmc-supply = <&reg_3p3v>;
184 cd-gpios = <&gpio4 8 GPIO_ACTIVE_HIGH>;
185 status = "okay";
186};
187
188&iomuxc {
189 pinctrl-names = "default";
190 pinctrl-0 = <&pinctrl_hog &pinctrl_gpio>;
191
192 imx6qdl-aristainetos {
193 pinctrl_aristainetos_usbh1_vbus: aristainetos-usbh1-vbus {
194 fsl,pins = <MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x130b0>;
195 };
196
197 pinctrl_aristainetos_usbotg_vbus: aristainetos-usbotg-vbus {
198 fsl,pins = <MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0>;
199 };
200
201 pinctrl_audmux: audmuxgrp {
202 fsl,pins = <
203 MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x1b0b0
204 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x1b0b0
205 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x1b0b0
206 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x1b0b0
207 >;
208 };
209
210 pinctrl_backlight: backlightgrp {
211 fsl,pins = <
212 MX6QDL_PAD_GPIO_9__PWM1_OUT 0x1b0b0
213 MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b0
214 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x1b0b0
215 >;
216 };
217
218 pinctrl_ecspi2: ecspi2grp {
219 fsl,pins = <
220 MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
221 MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
222 MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
223 MX6QDL_PAD_EIM_D24__GPIO3_IO24 0x100b1
224 >;
225 };
226
227 pinctrl_ecspi4: ecspi4grp {
228 fsl,pins = <
229 MX6QDL_PAD_EIM_D21__ECSPI4_SCLK 0x100b1
230 MX6QDL_PAD_EIM_D22__ECSPI4_MISO 0x100b1
231 MX6QDL_PAD_EIM_D28__ECSPI4_MOSI 0x100b1
232 MX6QDL_PAD_EIM_D20__GPIO3_IO20 0x100b1
233 MX6QDL_PAD_SD4_DAT7__GPIO2_IO15 0x1b0b0 /* WP pin */
234 >;
235 };
236
237 pinctrl_enet: enetgrp {
238 fsl,pins = <
239 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
240 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
241 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
242 MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0 0x1b0b0
243 MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1 0x1b0b0
244 MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN 0x1b0b0
245 MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER 0x1b0b0
246 MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0 0x1b0b0
247 MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1 0x1b0b0
248 MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN 0x1b0b0
249 >;
250 };
251
252 pinctrl_flexcan1: flexcan1grp {
253 fsl,pins = <
254 MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b0
255 MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b0
256 >;
257 };
258
259 pinctrl_flexcan2: flexcan2grp {
260 fsl,pins = <
261 MX6QDL_PAD_SD3_DAT0__FLEXCAN2_TX 0x1b0b0
262 MX6QDL_PAD_SD3_DAT1__FLEXCAN2_RX 0x1b0b0
263 >;
264 };
265
266 pinctrl_gpio: gpiogrp {
267 fsl,pins = <
268 MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x1b0b0
269 MX6QDL_PAD_SD4_DAT3__GPIO2_IO11 0x1b0b0
270 MX6QDL_PAD_SD4_DAT4__GPIO2_IO12 0x1b0b0
271 MX6QDL_PAD_SD4_DAT5__GPIO2_IO13 0x1b0b0
272 MX6QDL_PAD_GPIO_3__GPIO1_IO03 0x1b0b0
273 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1b0b0
274 MX6QDL_PAD_GPIO_5__GPIO1_IO05 0x1b0b0
275 MX6QDL_PAD_GPIO_6__GPIO1_IO06 0x1b0b0
276 MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x1b0b0
277 MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x1b0b0
278 MX6QDL_PAD_KEY_COL0__GPIO4_IO06 0x1b0b0
279 >;
280 };
281
282 pinctrl_gpmi_nand: gpminandgrp {
283 fsl,pins = <
284 MX6QDL_PAD_NANDF_CLE__NAND_CLE 0xb0b1
285 MX6QDL_PAD_NANDF_ALE__NAND_ALE 0xb0b1
286 MX6QDL_PAD_NANDF_WP_B__NAND_WP_B 0xb0b1
287 MX6QDL_PAD_NANDF_RB0__NAND_READY_B 0xb000
288 MX6QDL_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1
289 MX6QDL_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1
290 MX6QDL_PAD_SD4_CMD__NAND_RE_B 0xb0b1
291 MX6QDL_PAD_SD4_CLK__NAND_WE_B 0xb0b1
292 MX6QDL_PAD_NANDF_D0__NAND_DATA00 0xb0b1
293 MX6QDL_PAD_NANDF_D1__NAND_DATA01 0xb0b1
294 MX6QDL_PAD_NANDF_D2__NAND_DATA02 0xb0b1
295 MX6QDL_PAD_NANDF_D3__NAND_DATA03 0xb0b1
296 MX6QDL_PAD_NANDF_D4__NAND_DATA04 0xb0b1
297 MX6QDL_PAD_NANDF_D5__NAND_DATA05 0xb0b1
298 MX6QDL_PAD_NANDF_D6__NAND_DATA06 0xb0b1
299 MX6QDL_PAD_NANDF_D7__NAND_DATA07 0xb0b1
300 MX6QDL_PAD_SD4_DAT0__NAND_DQS 0x00b1
301 >;
302 };
303
304 pinctrl_hog: hoggrp {
305 fsl,pins = <
306 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x10
307 >;
308 };
309
310 pinctrl_i2c1: i2c1grp {
311 fsl,pins = <
312 MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
313 MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
314 >;
315 };
316
317 pinctrl_i2c2: i2c2grp {
318 fsl,pins = <
319 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
320 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
321 >;
322 };
323
324 pinctrl_i2c3: i2c3grp {
325 fsl,pins = <
326 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
327 MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
328 >;
329 };
330
331 pinctrl_ipu_disp: ipudisp1grp {
332 fsl,pins = <
333 MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10
334 MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x10
335 MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x10
336 MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x10
337 MX6QDL_PAD_DI0_PIN4__GPIO4_IO20 0x20000
338 MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x10
339 MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x10
340 MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x10
341 MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x10
342 MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x10
343 MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x10
344 MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x10
345 MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x10
346 MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x10
347 MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x10
348 MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x10
349 MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x10
350 MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x10
351 MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x10
352 MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x10
353 MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x10
354 MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x10
355 MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x10
356 MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x10
357 MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x10
358 MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x10
359 MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x10
360 MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x10
361 MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x10
362 >;
363 };
364
365 pinctrl_uart2: uart2grp {
366 fsl,pins = <
367 MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
368 MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
369 >;
370 };
371
372 pinctrl_uart4: uart4grp {
373 fsl,pins = <
374 MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA 0x1b0b1
375 MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA 0x1b0b1
376 MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B 0x1b0b1
377 MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B 0x1b0b1
378 >;
379 };
380
381 pinctrl_uart5: uart5grp {
382 fsl,pins = <
383 MX6QDL_PAD_CSI0_DAT14__UART5_TX_DATA 0x1b0b1
384 MX6QDL_PAD_CSI0_DAT15__UART5_RX_DATA 0x1b0b1
385 >;
386 };
387
388 pinctrl_usbotg: usbotggrp {
389 fsl,pins = <
390 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
391 >;
392 };
393
394 pinctrl_usdhc1: usdhc1grp {
395 fsl,pins = <
396 MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17059
397 MX6QDL_PAD_SD1_CLK__SD1_CLK 0x10059
398 MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059
399 MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059
400 MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059
401 MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059
402 MX6QDL_PAD_KEY_ROW0__GPIO4_IO07 0x1b0b0
403 >;
404 };
405
406 pinctrl_usdhc2: usdhc2grp {
407 fsl,pins = <
408 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
409 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
410 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
411 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
412 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
413 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
414 MX6QDL_PAD_KEY_COL1__GPIO4_IO08 0x1b0b0
415 >;
416 };
417 };
418};
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
index 744c8a2d81f6..234e7b755232 100644
--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
@@ -121,9 +121,9 @@
121 }; 121 };
122 122
123 sound { 123 sound {
124 compatible = "fsl,imx6q-sabrelite-sgtl5000", 124 compatible = "fsl,imx6q-ventana-sgtl5000",
125 "fsl,imx-audio-sgtl5000"; 125 "fsl,imx-audio-sgtl5000";
126 model = "imx6q-sabrelite-sgtl5000"; 126 model = "sgtl5000-audio";
127 ssi-controller = <&ssi1>; 127 ssi-controller = <&ssi1>;
128 audio-codec = <&codec>; 128 audio-codec = <&codec>;
129 audio-routing = 129 audio-routing =
@@ -489,7 +489,6 @@
489}; 489};
490 490
491&ssi1 { 491&ssi1 {
492 fsl,mode = "i2s-slave";
493 status = "okay"; 492 status = "okay";
494}; 493};
495 494
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index adf150c1be90..143f84f7812c 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -124,9 +124,9 @@
124 }; 124 };
125 125
126 sound { 126 sound {
127 compatible = "fsl,imx6q-sabrelite-sgtl5000", 127 compatible = "fsl,imx6q-ventana-sgtl5000",
128 "fsl,imx-audio-sgtl5000"; 128 "fsl,imx-audio-sgtl5000";
129 model = "imx6q-sabrelite-sgtl5000"; 129 model = "sgtl5000-audio";
130 ssi-controller = <&ssi1>; 130 ssi-controller = <&ssi1>;
131 audio-codec = <&codec>; 131 audio-codec = <&codec>;
132 audio-routing = 132 audio-routing =
@@ -533,7 +533,6 @@
533}; 533};
534 534
535&ssi1 { 535&ssi1 {
536 fsl,mode = "i2s-slave";
537 status = "okay"; 536 status = "okay";
538}; 537};
539 538
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
index 698d3063b295..16e7ad3d98ad 100644
--- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
@@ -114,9 +114,9 @@
114 }; 114 };
115 115
116 sound { 116 sound {
117 compatible = "fsl,imx6q-sabrelite-sgtl5000", 117 compatible = "fsl,imx6q-ventana-sgtl5000",
118 "fsl,imx-audio-sgtl5000"; 118 "fsl,imx-audio-sgtl5000";
119 model = "imx6q-sabrelite-sgtl5000"; 119 model = "sgtl5000-audio";
120 ssi-controller = <&ssi1>; 120 ssi-controller = <&ssi1>;
121 audio-codec = <&codec>; 121 audio-codec = <&codec>;
122 audio-routing = 122 audio-routing =
@@ -555,12 +555,10 @@
555}; 555};
556 556
557&ssi1 { 557&ssi1 {
558 fsl,mode = "i2s-slave";
559 status = "okay"; 558 status = "okay";
560}; 559};
561 560
562&ssi2 { 561&ssi2 {
563 fsl,mode = "i2s-slave";
564 status = "okay"; 562 status = "okay";
565}; 563};
566 564
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 4c4b17596c8b..42ff525ebe13 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -381,7 +381,6 @@
381}; 381};
382 382
383&ssi1 { 383&ssi1 {
384 fsl,mode = "i2s-slave";
385 status = "okay"; 384 status = "okay";
386}; 385};
387 386
diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
index faa3494a69d4..2694aa84e187 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
@@ -301,6 +301,7 @@
301 pinctrl-0 = <&pinctrl_enet>; 301 pinctrl-0 = <&pinctrl_enet>;
302 phy-mode = "rgmii"; 302 phy-mode = "rgmii";
303 phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; 303 phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
304 phy-supply = <&vdd_eth_io_reg>;
304 status = "disabled"; 305 status = "disabled";
305}; 306};
306 307
diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi
new file mode 100644
index 000000000000..df7bcf86c156
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi
@@ -0,0 +1,357 @@
1/*
2 * Copyright 2014 FEDEVEL, Inc.
3 *
4 * Author: Robert Nelson <robertcnelson@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14
15/ {
16 chosen {
17 stdout-path = &uart1;
18 };
19
20 regulators {
21 compatible = "simple-bus";
22 #address-cells = <1>;
23 #size-cells = <0>;
24
25 reg_3p3v: regulator@0 {
26 compatible = "regulator-fixed";
27 reg = <0>;
28 regulator-name = "3P3V";
29 regulator-min-microvolt = <3300000>;
30 regulator-max-microvolt = <3300000>;
31 regulator-always-on;
32 };
33
34 reg_usbh1_vbus: regulator@1 {
35 compatible = "regulator-fixed";
36 reg = <1>;
37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_usbh1>;
39 regulator-name = "usbh1_vbus";
40 regulator-min-microvolt = <5000000>;
41 regulator-max-microvolt = <5000000>;
42 gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>;
43 enable-active-high;
44 };
45
46 reg_usb_otg_vbus: regulator@2 {
47 compatible = "regulator-fixed";
48 reg = <2>;
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_usbotg>;
51 regulator-name = "usb_otg_vbus";
52 regulator-min-microvolt = <5000000>;
53 regulator-max-microvolt = <5000000>;
54 gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
55 enable-active-high;
56 };
57 };
58
59 leds {
60 compatible = "gpio-leds";
61 pinctrl-names = "default";
62 pinctrl-0 = <&pinctrl_led>;
63
64 led0: usr {
65 label = "usr";
66 gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
67 default-state = "off";
68 linux,default-trigger = "heartbeat";
69 };
70 };
71
72 sound {
73 compatible = "fsl,imx6-rex-sgtl5000",
74 "fsl,imx-audio-sgtl5000";
75 model = "imx6-rex-sgtl5000";
76 ssi-controller = <&ssi1>;
77 audio-codec = <&codec>;
78 audio-routing =
79 "MIC_IN", "Mic Jack",
80 "Mic Jack", "Mic Bias",
81 "Headphone Jack", "HP_OUT";
82 mux-int-port = <1>;
83 mux-ext-port = <3>;
84 };
85};
86
87&audmux {
88 pinctrl-names = "default";
89 pinctrl-0 = <&pinctrl_audmux>;
90 status = "okay";
91};
92
93&ecspi2 {
94 fsl,spi-num-chipselects = <1>;
95 cs-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
96 pinctrl-names = "default";
97 pinctrl-0 = <&pinctrl_ecspi2>;
98 status = "okay";
99};
100
101&ecspi3 {
102 fsl,spi-num-chipselects = <1>;
103 cs-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
104 pinctrl-names = "default";
105 pinctrl-0 = <&pinctrl_ecspi3>;
106 status = "okay";
107};
108
109&fec {
110 pinctrl-names = "default";
111 pinctrl-0 = <&pinctrl_enet>;
112 phy-mode = "rgmii";
113 phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
114 status = "okay";
115};
116
117&hdmi {
118 ddc-i2c-bus = <&i2c2>;
119 status = "okay";
120};
121
122&i2c1 {
123 clock-frequency = <100000>;
124 pinctrl-names = "default";
125 pinctrl-0 = <&pinctrl_i2c1>;
126 status = "okay";
127
128 codec: sgtl5000@0a {
129 compatible = "fsl,sgtl5000";
130 reg = <0x0a>;
131 clocks = <&clks 201>;
132 VDDA-supply = <&reg_3p3v>;
133 VDDIO-supply = <&reg_3p3v>;
134 };
135};
136
137&i2c2 {
138 clock-frequency = <100000>;
139 pinctrl-names = "default";
140 pinctrl-0 = <&pinctrl_i2c2>;
141 status = "okay";
142
143 eeprom@57 {
144 compatible = "at,24c02";
145 reg = <0x57>;
146 };
147};
148
149&i2c3 {
150 clock-frequency = <100000>;
151 pinctrl-names = "default";
152 pinctrl-0 = <&pinctrl_i2c3>;
153 status = "okay";
154};
155
156&iomuxc {
157 pinctrl-names = "default";
158 pinctrl-0 = <&pinctrl_hog>;
159
160 imx6qdl-rex {
161 pinctrl_hog: hoggrp {
162 fsl,pins = <
163 /* SGTL5000 sys_mclk */
164 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x030b0
165 >;
166 };
167
168 pinctrl_audmux: audmuxgrp {
169 fsl,pins = <
170 MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
171 MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
172 MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
173 MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
174 >;
175 };
176
177 pinctrl_ecspi2: ecspi2grp {
178 fsl,pins = <
179 MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO 0x100b1
180 MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI 0x100b1
181 MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK 0x100b1
182 /* CS */
183 MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x000b1
184 >;
185 };
186
187 pinctrl_ecspi3: ecspi3grp {
188 fsl,pins = <
189 MX6QDL_PAD_DISP0_DAT17__ECSPI2_MISO 0x100b1
190 MX6QDL_PAD_DISP0_DAT16__ECSPI2_MOSI 0x100b1
191 MX6QDL_PAD_DISP0_DAT19__ECSPI2_SCLK 0x100b1
192 /* CS */
193 MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12 0x000b1
194 >;
195 };
196
197 pinctrl_enet: enetgrp {
198 fsl,pins = <
199 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
200 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
201 MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
202 MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
203 MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
204 MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
205 MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
206 MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
207 MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
208 MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
209 MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
210 MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
211 MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
212 MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
213 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
214 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
215 /* Phy reset */
216 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x000b0
217 >;
218 };
219
220 pinctrl_i2c1: i2c1grp {
221 fsl,pins = <
222 MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
223 MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
224 >;
225 };
226
227 pinctrl_i2c2: i2c2grp {
228 fsl,pins = <
229 MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
230 MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
231 >;
232 };
233
234 pinctrl_i2c3: i2c3grp {
235 fsl,pins = <
236 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
237 MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
238 >;
239 };
240
241 pinctrl_led: ledgrp {
242 fsl,pins = <
243 /* user led */
244 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000
245 >;
246 };
247
248 pinctrl_uart1: uart1grp {
249 fsl,pins = <
250 MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
251 MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
252 >;
253 };
254
255 pinctrl_uart2: uart2grp {
256 fsl,pins = <
257 MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA 0x1b0b1
258 MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA 0x1b0b1
259 >;
260 };
261
262 pinctrl_usbh1: usbh1grp {
263 fsl,pins = <
264 /* power enable, high active */
265 MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x10b0
266 >;
267 };
268
269 pinctrl_usbotg: usbotggrp {
270 fsl,pins = <
271 MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
272 MX6QDL_PAD_EIM_D21__USB_OTG_OC 0x1b0b0
273 /* power enable, high active */
274 MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x10b0
275 >;
276 };
277
278 pinctrl_usdhc2: usdhc2grp {
279 fsl,pins = <
280 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
281 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
282 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
283 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
284 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
285 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
286 /* CD */
287 MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
288 /* WP */
289 MX6QDL_PAD_NANDF_D3__GPIO2_IO03 0x1f0b0
290 >;
291 };
292
293 pinctrl_usdhc3: usdhc3grp {
294 fsl,pins = <
295 MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059
296 MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059
297 MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
298 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
299 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
300 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
301 /* CD */
302 MX6QDL_PAD_NANDF_D0__GPIO2_IO00 0x1b0b0
303 /* WP */
304 MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x1f0b0
305 >;
306 };
307 };
308};
309
310&ssi1 {
311 fsl,mode = "i2s-slave";
312 status = "okay";
313};
314
315&uart1 {
316 pinctrl-names = "default";
317 pinctrl-0 = <&pinctrl_uart1>;
318 status = "okay";
319};
320
321&uart2 {
322 pinctrl-names = "default";
323 pinctrl-0 = <&pinctrl_uart2>;
324 status = "okay";
325};
326
327&usbh1 {
328 vbus-supply = <&reg_usbh1_vbus>;
329 pinctrl-names = "default";
330 pinctrl-0 = <&pinctrl_usbh1>;
331 status = "okay";
332};
333
334&usbotg {
335 vbus-supply = <&reg_usb_otg_vbus>;
336 pinctrl-names = "default";
337 pinctrl-0 = <&pinctrl_usbotg>;
338 status = "okay";
339};
340
341&usdhc2 {
342 pinctrl-names = "default";
343 pinctrl-0 = <&pinctrl_usdhc2>;
344 bus-width = <4>;
345 cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
346 wp-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
347 status = "okay";
348};
349
350&usdhc3 {
351 pinctrl-names = "default";
352 pinctrl-0 = <&pinctrl_usdhc3>;
353 bus-width = <4>;
354 cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
355 wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
356 status = "okay";
357};
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index 6df6127bf835..0a36129152e0 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -381,7 +381,6 @@
381}; 381};
382 382
383&ssi1 { 383&ssi1 {
384 fsl,mode = "i2s-slave";
385 status = "okay"; 384 status = "okay";
386}; 385};
387 386
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 40ea36534643..ec43dde78525 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -340,6 +340,7 @@
340 MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1 340 MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1
341 MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1 341 MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1
342 MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1 342 MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1
343 MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x1b0b0
343 >; 344 >;
344 }; 345 };
345 346
@@ -512,7 +513,6 @@
512}; 513};
513 514
514&ssi2 { 515&ssi2 {
515 fsl,mode = "i2s-slave";
516 status = "okay"; 516 status = "okay";
517}; 517};
518 518
diff --git a/arch/arm/boot/dts/imx6qdl-tx6.dtsi b/arch/arm/boot/dts/imx6qdl-tx6.dtsi
new file mode 100644
index 000000000000..f02b80b41d4f
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-tx6.dtsi
@@ -0,0 +1,696 @@
1/*
2 * Copyright 2014 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/pwm/pwm.h>
15
16/ {
17 aliases {
18 can0 = &can2;
19 can1 = &can1;
20 ethernet0 = &fec;
21 lcdif_23bit_pins_a = &pinctrl_disp0_1;
22 lcdif_24bit_pins_a = &pinctrl_disp0_2;
23 pwm0 = &pwm1;
24 pwm1 = &pwm2;
25 reg_can_xcvr = &reg_can_xcvr;
26 stk5led = &user_led;
27 usbotg = &usbotg;
28 sdhc0 = &usdhc1;
29 sdhc1 = &usdhc2;
30 };
31
32 memory {
33 reg = <0 0>; /* will be filled by U-Boot */
34 };
35
36 clocks {
37 #address-cells = <1>;
38 #size-cells = <0>;
39 mclk: clock@0 {
40 compatible = "fixed-clock";
41 reg = <0>;
42 #clock-cells = <0>;
43 clock-frequency = <27000000>;
44 };
45 };
46
47 gpio-keys {
48 compatible = "gpio-keys";
49
50 power {
51 label = "Power Button";
52 gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
53 linux,code = <KEY_POWER>;
54 gpio-key,wakeup;
55 };
56 };
57
58 leds {
59 compatible = "gpio-leds";
60
61 user_led: user {
62 label = "Heartbeat";
63 gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
64 linux,default-trigger = "heartbeat";
65 };
66 };
67
68 regulators {
69 compatible = "simple-bus";
70 #address-cells = <1>;
71 #size-cells = <0>;
72
73 reg_3v3_etn: regulator@0 {
74 compatible = "regulator-fixed";
75 reg = <0>;
76 regulator-name = "3V3_ETN";
77 regulator-min-microvolt = <3300000>;
78 regulator-max-microvolt = <3300000>;
79 pinctrl-names = "default";
80 pinctrl-0 = <&pinctrl_etnphy_power>;
81 gpio = <&gpio3 20 GPIO_ACTIVE_HIGH>;
82 enable-active-high;
83 };
84
85 reg_2v5: regulator@1 {
86 compatible = "regulator-fixed";
87 reg = <1>;
88 regulator-name = "2V5";
89 regulator-min-microvolt = <2500000>;
90 regulator-max-microvolt = <2500000>;
91 regulator-always-on;
92 };
93
94 reg_3v3: regulator@2 {
95 compatible = "regulator-fixed";
96 reg = <2>;
97 regulator-name = "3V3";
98 regulator-min-microvolt = <3300000>;
99 regulator-max-microvolt = <3300000>;
100 regulator-always-on;
101 };
102
103 reg_can_xcvr: regulator@3 {
104 compatible = "regulator-fixed";
105 reg = <3>;
106 regulator-name = "CAN XCVR";
107 regulator-min-microvolt = <3300000>;
108 regulator-max-microvolt = <3300000>;
109 pinctrl-names = "default";
110 pinctrl-0 = <&pinctrl_flexcan_xcvr>;
111 gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>;
112 enable-active-low;
113 };
114
115 reg_lcd0_pwr: regulator@4 {
116 compatible = "regulator-fixed";
117 reg = <4>;
118 regulator-name = "LCD0 POWER";
119 regulator-min-microvolt = <3300000>;
120 regulator-max-microvolt = <3300000>;
121 pinctrl-names = "default";
122 pinctrl-0 = <&pinctrl_lcd0_pwr>;
123 gpio = <&gpio3 29 GPIO_ACTIVE_HIGH>;
124 enable-active-high;
125 regulator-boot-on;
126 regulator-always-on;
127 };
128
129 reg_lcd1_pwr: regulator@5 {
130 compatible = "regulator-fixed";
131 reg = <5>;
132 regulator-name = "LCD1 POWER";
133 regulator-min-microvolt = <3300000>;
134 regulator-max-microvolt = <3300000>;
135 pinctrl-names = "default";
136 pinctrl-0 = <&pinctrl_lcd1_pwr>;
137 gpio = <&gpio2 31 GPIO_ACTIVE_HIGH>;
138 enable-active-high;
139 regulator-boot-on;
140 regulator-always-on;
141 };
142
143 reg_usbh1_vbus: regulator@6 {
144 compatible = "regulator-fixed";
145 reg = <6>;
146 regulator-name = "usbh1_vbus";
147 regulator-min-microvolt = <5000000>;
148 regulator-max-microvolt = <5000000>;
149 pinctrl-names = "default";
150 pinctrl-0 = <&pinctrl_usbh1_vbus>;
151 gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>;
152 enable-active-high;
153 };
154
155 reg_usbotg_vbus: regulator@7 {
156 compatible = "regulator-fixed";
157 reg = <7>;
158 regulator-name = "usbotg_vbus";
159 regulator-min-microvolt = <5000000>;
160 regulator-max-microvolt = <5000000>;
161 pinctrl-names = "default";
162 pinctrl-0 = <&pinctrl_usbotg_vbus>;
163 gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
164 enable-active-high;
165 };
166 };
167
168 sound {
169 compatible = "karo,imx6qdl-tx6qdl-sgtl5000",
170 "fsl,imx-audio-sgtl5000";
171 model = "sgtl5000-audio";
172 pinctrl-names = "default";
173 pinctrl-0 = <&pinctrl_audmux>;
174 ssi-controller = <&ssi1>;
175 audio-codec = <&sgtl5000>;
176 audio-routing =
177 "MIC_IN", "Mic Jack",
178 "Mic Jack", "Mic Bias",
179 "Headphone Jack", "HP_OUT";
180 mux-int-port = <1>;
181 mux-ext-port = <5>;
182 };
183};
184
185&audmux {
186 status = "okay";
187};
188
189&can1 {
190 pinctrl-names = "default";
191 pinctrl-0 = <&pinctrl_flexcan1>;
192 xceiver-supply = <&reg_can_xcvr>;
193 status = "okay";
194};
195
196&can2 {
197 pinctrl-names = "default";
198 pinctrl-0 = <&pinctrl_flexcan2>;
199 xceiver-supply = <&reg_can_xcvr>;
200 status = "okay";
201};
202
203&ecspi1 {
204 pinctrl-names = "default";
205 pinctrl-0 = <&pinctrl_ecspi1>;
206 fsl,spi-num-chipselects = <2>;
207 cs-gpios = <
208 &gpio2 30 GPIO_ACTIVE_HIGH
209 &gpio3 19 GPIO_ACTIVE_HIGH
210 >;
211 status = "okay";
212
213 spidev0: spi@0 {
214 compatible = "spidev";
215 reg = <0>;
216 spi-max-frequency = <54000000>;
217 };
218
219 spidev1: spi@1 {
220 compatible = "spidev";
221 reg = <1>;
222 spi-max-frequency = <54000000>;
223 };
224};
225
226&fec {
227 pinctrl-names = "default";
228 pinctrl-0 = <&pinctrl_enet>;
229 phy-mode = "rmii";
230 phy-reset-gpios = <&gpio7 6 GPIO_ACTIVE_HIGH>;
231 phy-supply = <&reg_3v3_etn>;
232 status = "okay";
233};
234
235&gpmi {
236 pinctrl-names = "default";
237 pinctrl-0 = <&pinctrl_gpmi_nand>;
238 nand-on-flash-bbt;
239 fsl,no-blockmark-swap;
240 status = "okay";
241};
242
243&i2c1 {
244 pinctrl-names = "default";
245 pinctrl-0 = <&pinctrl_i2c1>;
246 clock-frequency = <400000>;
247 status = "okay";
248
249 ds1339: rtc@68 {
250 compatible = "dallas,ds1339";
251 reg = <0x68>;
252 };
253};
254
255&i2c3 {
256 pinctrl-names = "default";
257 pinctrl-0 = <&pinctrl_i2c3>;
258 clock-frequency = <400000>;
259 status = "okay";
260
261 sgtl5000: sgtl5000@0a {
262 compatible = "fsl,sgtl5000";
263 reg = <0x0a>;
264 VDDA-supply = <&reg_2v5>;
265 VDDIO-supply = <&reg_3v3>;
266 clocks = <&mclk>;
267 };
268
269 polytouch: edt-ft5x06@38 {
270 compatible = "edt,edt-ft5x06";
271 reg = <0x38>;
272 pinctrl-names = "default";
273 pinctrl-0 = <&pinctrl_edt_ft5x06>;
274 interrupt-parent = <&gpio6>;
275 interrupts = <15 0>;
276 reset-gpios = <&gpio2 22 GPIO_ACTIVE_LOW>;
277 wake-gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
278 linux,wakeup;
279 };
280
281 touchscreen: tsc2007@48 {
282 compatible = "ti,tsc2007";
283 reg = <0x48>;
284 pinctrl-names = "default";
285 pinctrl-0 = <&pinctrl_tsc2007>;
286 interrupt-parent = <&gpio3>;
287 interrupts = <26 0>;
288 gpios = <&gpio3 26 GPIO_ACTIVE_LOW>;
289 ti,x-plate-ohms = <660>;
290 linux,wakeup;
291 };
292};
293
294&iomuxc {
295 pinctrl-names = "default";
296 pinctrl-0 = <&pinctrl_hog>;
297
298 imx6qdl-tx6 {
299 pinctrl_hog: hoggrp {
300 fsl,pins = <
301 MX6QDL_PAD_EIM_A18__GPIO2_IO20 0x1b0b1 /* LED */
302 MX6QDL_PAD_SD3_DAT2__GPIO7_IO06 0x1b0b1 /* ETN PHY RESET */
303 MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x1b0b1 /* ETN PHY INT */
304 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x1b0b1 /* PWR BTN */
305 >;
306 };
307
308 pinctrl_audmux: audmuxgrp {
309 fsl,pins = <
310 MX6QDL_PAD_KEY_ROW1__AUD5_RXD 0x130b0 /* SSI1_RXD */
311 MX6QDL_PAD_KEY_ROW0__AUD5_TXD 0x110b0 /* SSI1_TXD */
312 MX6QDL_PAD_KEY_COL0__AUD5_TXC 0x130b0 /* SSI1_CLK */
313 MX6QDL_PAD_KEY_COL1__AUD5_TXFS 0x130b0 /* SSI1_FS */
314 >;
315 };
316
317 pinctrl_disp0_1: disp0grp-1 {
318 fsl,pins = <
319 MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10
320 MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x10
321 MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x10
322 MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x10
323 /* PAD DISP0_DAT0 is used for the Flexcan transceiver control */
324 MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x10
325 MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x10
326 MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x10
327 MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x10
328 MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x10
329 MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x10
330 MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x10
331 MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x10
332 MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x10
333 MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x10
334 MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x10
335 MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x10
336 MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x10
337 MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x10
338 MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x10
339 MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x10
340 MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x10
341 MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x10
342 MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x10
343 MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x10
344 MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x10
345 MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x10
346 MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x10
347 >;
348 };
349
350 pinctrl_disp0_2: disp0grp-2 {
351 fsl,pins = <
352 MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10
353 MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x10
354 MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x10
355 MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x10
356 MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x10
357 MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x10
358 MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x10
359 MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x10
360 MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x10
361 MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x10
362 MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x10
363 MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x10
364 MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x10
365 MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x10
366 MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x10
367 MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x10
368 MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x10
369 MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x10
370 MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x10
371 MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x10
372 MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x10
373 MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x10
374 MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x10
375 MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x10
376 MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x10
377 MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x10
378 MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x10
379 MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x10
380 >;
381 };
382
383 pinctrl_ecspi1: ecspi1grp {
384 fsl,pins = <
385 MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x0b0b0
386 MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x0b0b0
387 MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x0b0b0
388 MX6QDL_PAD_GPIO_19__ECSPI1_RDY 0x0b0b0
389 MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x0b0b0 /* SPI CS0 */
390 MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x0b0b0 /* SPI CS1 */
391 >;
392 };
393
394 pinctrl_edt_ft5x06: edt-ft5x06grp {
395 fsl,pins = <
396 MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x1b0b0 /* Interrupt */
397 MX6QDL_PAD_EIM_A16__GPIO2_IO22 0x1b0b0 /* Reset */
398 MX6QDL_PAD_EIM_A17__GPIO2_IO21 0x1b0b0 /* Wake */
399 >;
400 };
401
402 pinctrl_enet: enetgrp {
403 fsl,pins = <
404 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
405 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
406 MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0 0x1b0b0
407 MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1 0x1b0b0
408 MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER 0x1b0b0
409 MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN 0x1b0b0
410 MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0 0x1b0b0
411 MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1 0x1b0b0
412 MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN 0x1b0b0
413 >;
414 };
415
416 pinctrl_etnphy_power: etnphy-pwrgrp {
417 fsl,pins = <
418 MX6QDL_PAD_EIM_D20__GPIO3_IO20 0x1b0b1 /* ETN PHY POWER */
419 >;
420 };
421
422 pinctrl_flexcan1: flexcan1grp {
423 fsl,pins = <
424 MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
425 MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
426 >;
427 };
428
429 pinctrl_flexcan2: flexcan2grp {
430 fsl,pins = <
431 MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x1b0b0
432 MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x1b0b0
433 >;
434 };
435
436 pinctrl_flexcan_xcvr: flexcan-xcvrgrp {
437 fsl,pins = <
438 MX6QDL_PAD_DISP0_DAT0__GPIO4_IO21 0x1b0b0 /* Flexcan XCVR enable */
439 >;
440 };
441
442 pinctrl_gpmi_nand: gpminandgrp {
443 fsl,pins = <
444 MX6QDL_PAD_NANDF_CLE__NAND_CLE 0x0b0b1
445 MX6QDL_PAD_NANDF_ALE__NAND_ALE 0x0b0b1
446 MX6QDL_PAD_NANDF_WP_B__NAND_WP_B 0x0b0b1
447 MX6QDL_PAD_NANDF_RB0__NAND_READY_B 0x0b000
448 MX6QDL_PAD_NANDF_CS0__NAND_CE0_B 0x0b0b1
449 MX6QDL_PAD_SD4_CMD__NAND_RE_B 0x0b0b1
450 MX6QDL_PAD_SD4_CLK__NAND_WE_B 0x0b0b1
451 MX6QDL_PAD_NANDF_D0__NAND_DATA00 0x0b0b1
452 MX6QDL_PAD_NANDF_D1__NAND_DATA01 0x0b0b1
453 MX6QDL_PAD_NANDF_D2__NAND_DATA02 0x0b0b1
454 MX6QDL_PAD_NANDF_D3__NAND_DATA03 0x0b0b1
455 MX6QDL_PAD_NANDF_D4__NAND_DATA04 0x0b0b1
456 MX6QDL_PAD_NANDF_D5__NAND_DATA05 0x0b0b1
457 MX6QDL_PAD_NANDF_D6__NAND_DATA06 0x0b0b1
458 MX6QDL_PAD_NANDF_D7__NAND_DATA07 0x0b0b1
459 >;
460 };
461
462 pinctrl_i2c1: i2c1grp {
463 fsl,pins = <
464 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
465 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
466 >;
467 };
468
469 pinctrl_i2c3: i2c3grp {
470 fsl,pins = <
471 MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
472 MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
473 >;
474 };
475
476 pinctrl_kpp: kppgrp {
477 fsl,pins = <
478 MX6QDL_PAD_GPIO_9__KEY_COL6 0x1b0b1
479 MX6QDL_PAD_GPIO_4__KEY_COL7 0x1b0b1
480 MX6QDL_PAD_KEY_COL2__KEY_COL2 0x1b0b1
481 MX6QDL_PAD_KEY_COL3__KEY_COL3 0x1b0b1
482 MX6QDL_PAD_GPIO_2__KEY_ROW6 0x1b0b1
483 MX6QDL_PAD_GPIO_5__KEY_ROW7 0x1b0b1
484 MX6QDL_PAD_KEY_ROW2__KEY_ROW2 0x1b0b1
485 MX6QDL_PAD_KEY_ROW3__KEY_ROW3 0x1b0b1
486 >;
487 };
488
489 pinctrl_lcd0_pwr: lcd0-pwrgrp {
490 fsl,pins = <
491 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x1b0b1 /* LCD Reset */
492 >;
493 };
494
495 pinctrl_lcd1_pwr: lcd1-pwrgrp {
496 fsl,pins = <
497 MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x1b0b1 /* LCD Power Enable */
498 >;
499 };
500
501 pinctrl_pwm1: pwm1grp {
502 fsl,pins = <
503 MX6QDL_PAD_GPIO_9__PWM1_OUT 0x1b0b1
504 >;
505 };
506
507 pinctrl_pwm2: pwm2grp {
508 fsl,pins = <
509 MX6QDL_PAD_GPIO_1__PWM2_OUT 0x1b0b1
510 >;
511 };
512
513 pinctrl_tsc2007: tsc2007grp {
514 fsl,pins = <
515 MX6QDL_PAD_EIM_D26__GPIO3_IO26 0x1b0b0 /* Interrupt */
516 >;
517 };
518
519 pinctrl_uart1: uart1grp {
520 fsl,pins = <
521 MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
522 MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA 0x1b0b1
523 >;
524 };
525
526 pinctrl_uart1_rtscts: uart1_rtsctsgrp {
527 fsl,pins = <
528 MX6QDL_PAD_SD3_DAT1__UART1_RTS_B 0x1b0b1
529 MX6QDL_PAD_SD3_DAT0__UART1_CTS_B 0x1b0b1
530 >;
531 };
532
533 pinctrl_uart2: uart2grp {
534 fsl,pins = <
535 MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA 0x1b0b1
536 MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA 0x1b0b1
537 >;
538 };
539
540 pinctrl_uart2_rtscts: uart2_rtsctsgrp {
541 fsl,pins = <
542 MX6QDL_PAD_SD4_DAT5__UART2_RTS_B 0x1b0b1
543 MX6QDL_PAD_SD4_DAT6__UART2_CTS_B 0x1b0b1
544 >;
545 };
546
547 pinctrl_uart3: uart3grp {
548 fsl,pins = <
549 MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1
550 MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1
551 >;
552 };
553
554 pinctrl_uart3_rtscts: uart3_rtsctsgrp {
555 fsl,pins = <
556 MX6QDL_PAD_SD3_DAT3__UART3_CTS_B 0x1b0b1
557 MX6QDL_PAD_SD3_RST__UART3_RTS_B 0x1b0b1
558 >;
559 };
560
561 pinctrl_usbh1_vbus: usbh1-vbusgrp {
562 fsl,pins = <
563 MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x1b0b0 /* USBH1_VBUSEN */
564 >;
565 };
566
567 pinctrl_usbotg: usbotggrp {
568 fsl,pins = <
569 MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x17059
570 >;
571 };
572
573 pinctrl_usbotg_vbus: usbotg-vbusgrp {
574 fsl,pins = <
575 MX6QDL_PAD_GPIO_7__GPIO1_IO07 0x1b0b0 /* USBOTG_VBUSEN */
576 >;
577 };
578
579 pinctrl_usdhc1: usdhc1grp {
580 fsl,pins = <
581 MX6QDL_PAD_SD1_CMD__SD1_CMD 0x070b1
582 MX6QDL_PAD_SD1_CLK__SD1_CLK 0x070b1
583 MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x070b1
584 MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x070b1
585 MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x070b1
586 MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x070b1
587 MX6QDL_PAD_SD3_CMD__GPIO7_IO02 0x170b0 /* SD1 CD */
588 >;
589 };
590
591 pinctrl_usdhc2: usdhc2grp {
592 fsl,pins = <
593 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x070b1
594 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x070b1
595 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x070b1
596 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x070b1
597 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x070b1
598 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x070b1
599 MX6QDL_PAD_SD3_CLK__GPIO7_IO03 0x170b0 /* SD2 CD */
600 >;
601 };
602 };
603};
604
605&kpp {
606 pinctrl-names = "default";
607 pinctrl-0 = <&pinctrl_kpp>;
608 /* sample keymap */
609 /* row/col 0,1 are mapped to KPP row/col 6,7 */
610 linux,keymap = <
611 MATRIX_KEY(6, 6, KEY_POWER) /* 0x06060074 */
612 MATRIX_KEY(6, 7, KEY_KP0) /* 0x06070052 */
613 MATRIX_KEY(6, 2, KEY_KP1) /* 0x0602004f */
614 MATRIX_KEY(6, 3, KEY_KP2) /* 0x06030050 */
615 MATRIX_KEY(7, 6, KEY_KP3) /* 0x07060051 */
616 MATRIX_KEY(7, 7, KEY_KP4) /* 0x0707004b */
617 MATRIX_KEY(7, 2, KEY_KP5) /* 0x0702004c */
618 MATRIX_KEY(7, 3, KEY_KP6) /* 0x0703004d */
619 MATRIX_KEY(2, 6, KEY_KP7) /* 0x02060047 */
620 MATRIX_KEY(2, 7, KEY_KP8) /* 0x02070048 */
621 MATRIX_KEY(2, 2, KEY_KP9) /* 0x02020049 */
622 >;
623 status = "okay";
624};
625
626&pwm1 {
627 pinctrl-names = "default";
628 pinctrl-0 = <&pinctrl_pwm1>;
629 #pwm-cells = <3>;
630 status = "disabled";
631};
632
633&pwm2 {
634 pinctrl-names = "default";
635 pinctrl-0 = <&pinctrl_pwm2>;
636 #pwm-cells = <3>;
637 status = "okay";
638};
639
640&ssi1 {
641 status = "okay";
642};
643
644&uart1 {
645 pinctrl-names = "default";
646 pinctrl-0 = <&pinctrl_uart1>;
647 status = "okay";
648};
649
650&uart2 {
651 pinctrl-names = "default";
652 pinctrl-0 = <&pinctrl_uart2 &pinctrl_uart2_rtscts>;
653 status = "okay";
654};
655
656&uart3 {
657 pinctrl-names = "default";
658 pinctrl-0 = <&pinctrl_uart3 &pinctrl_uart3_rtscts>;
659 status = "okay";
660};
661
662&usbh1 {
663 vbus-supply = <&reg_usbh1_vbus>;
664 dr_mode = "host";
665 disable-over-current;
666 status = "okay";
667};
668
669&usbotg {
670 vbus-supply = <&reg_usbotg_vbus>;
671 pinctrl-names = "default";
672 pinctrl-0 = <&pinctrl_usbotg>;
673 dr_mode = "peripheral";
674 disable-over-current;
675 status = "okay";
676};
677
678&usdhc1 {
679 pinctrl-names = "default";
680 pinctrl-0 = <&pinctrl_usdhc1>;
681 bus-width = <4>;
682 no-1-8-v;
683 cd-gpios = <&gpio7 2 0>;
684 fsl,wp-controller;
685 status = "okay";
686};
687
688&usdhc2 {
689 pinctrl-names = "default";
690 pinctrl-0 = <&pinctrl_usdhc2>;
691 bus-width = <4>;
692 no-1-8-v;
693 cd-gpios = <&gpio7 3 0>;
694 fsl,wp-controller;
695 status = "okay";
696};
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi
new file mode 100644
index 000000000000..ef7fa62b9898
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include "imx6qdl-wandboard.dtsi"
13
14&iomuxc {
15 pinctrl-0 = <&pinctrl_hog>;
16
17 imx6qdl-wandboard {
18 pinctrl_hog: hoggrp {
19 fsl,pins = <
20 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* GPIO_0_CLKO */
21 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* uSDHC1 CD */
22 MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */
23 MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x0f0b0 /* WL_REF_ON */
24 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x0f0b0 /* WL_RST_N */
25 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x000b0 /* WL_REG_ON */
26 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* WL_HOST_WAKE */
27 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* WL_WAKE */
28 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000 /* RGMII_nRST */
29 MX6QDL_PAD_EIM_DA13__GPIO3_IO13 0x80000000 /* BT_ON */
30 MX6QDL_PAD_EIM_DA14__GPIO3_IO14 0x80000000 /* BT_WAKE */
31 MX6QDL_PAD_EIM_DA15__GPIO3_IO15 0x80000000 /* BT_HOST_WAKE */
32 >;
33 };
34 };
35};
36
37&usdhc2 {
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_usdhc2>;
40 non-removable;
41 status = "okay";
42};
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi
new file mode 100644
index 000000000000..8d893a78cdf0
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include "imx6qdl-wandboard.dtsi"
13
14&iomuxc {
15 pinctrl-0 = <&pinctrl_hog>;
16
17 imx6qdl-wandboard {
18 pinctrl_hog: hoggrp {
19 fsl,pins = <
20 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* GPIO_0_CLKO */
21 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* uSDHC1 CD */
22 MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */
23 MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00 0x0f0b0 /* WIFI_ON (reset, active low) */
24 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x000b0 /* WL_REG_ON (unused) */
25 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* WL_HOST_WAKE, input */
26 MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31 0x0f0b0 /* GPIO5_IO31 (Wifi Power Enable) */
27 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* WL_WAKE (unused) */
28 MX6QDL_PAD_CSI0_VSYNC__GPIO5_IO21 0x80000000 /* BT_ON */
29 MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30 0x80000000 /* BT_WAKE */
30 MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20 0x80000000 /* BT_HOST_WAKE */
31 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000 /* RGMII_nRST */
32 >;
33 };
34 };
35};
36
37&usdhc2 {
38 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_usdhc2>;
40 status = "okay";
41};
diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
index 5c6f10c43f65..5fb091675582 100644
--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi
@@ -91,22 +91,8 @@
91 91
92&iomuxc { 92&iomuxc {
93 pinctrl-names = "default"; 93 pinctrl-names = "default";
94 pinctrl-0 = <&pinctrl_hog>;
95 94
96 imx6qdl-wandboard { 95 imx6qdl-wandboard {
97 pinctrl_hog: hoggrp {
98 fsl,pins = <
99 MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
100 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000
101 MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000
102 MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x80000000 /* WL_REF_ON */
103 MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x80000000 /* WL_RST_N */
104 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* WL_REG_ON */
105 MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* WL_HOST_WAKE */
106 MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* WL_WAKE */
107 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000
108 >;
109 };
110 96
111 pinctrl_audmux: audmuxgrp { 97 pinctrl_audmux: audmuxgrp {
112 fsl,pins = < 98 fsl,pins = <
@@ -233,7 +219,6 @@
233}; 219};
234 220
235&ssi1 { 221&ssi1 {
236 fsl,mode = "i2s-slave";
237 status = "okay"; 222 status = "okay";
238}; 223};
239 224
@@ -269,13 +254,6 @@
269 status = "okay"; 254 status = "okay";
270}; 255};
271 256
272&usdhc2 {
273 pinctrl-names = "default";
274 pinctrl-0 = <&pinctrl_usdhc2>;
275 non-removable;
276 status = "okay";
277};
278
279&usdhc3 { 257&usdhc3 {
280 pinctrl-names = "default"; 258 pinctrl-names = "default";
281 pinctrl-0 = <&pinctrl_usdhc3>; 259 pinctrl-0 = <&pinctrl_usdhc3>;
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index ce0599134a69..c701af958006 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -10,6 +10,7 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13#include <dt-bindings/clock/imx6qdl-clock.h>
13#include <dt-bindings/interrupt-controller/arm-gic.h> 14#include <dt-bindings/interrupt-controller/arm-gic.h>
14 15
15#include "skeleton.dtsi" 16#include "skeleton.dtsi"
@@ -94,7 +95,7 @@
94 interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3"; 95 interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3";
95 #dma-cells = <1>; 96 #dma-cells = <1>;
96 dma-channels = <4>; 97 dma-channels = <4>;
97 clocks = <&clks 106>; 98 clocks = <&clks IMX6QDL_CLK_APBH_DMA>;
98 }; 99 };
99 100
100 gpmi: gpmi-nand@00112000 { 101 gpmi: gpmi-nand@00112000 {
@@ -105,8 +106,11 @@
105 reg-names = "gpmi-nand", "bch"; 106 reg-names = "gpmi-nand", "bch";
106 interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>; 107 interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>;
107 interrupt-names = "bch"; 108 interrupt-names = "bch";
108 clocks = <&clks 152>, <&clks 153>, <&clks 151>, 109 clocks = <&clks IMX6QDL_CLK_GPMI_IO>,
109 <&clks 150>, <&clks 149>; 110 <&clks IMX6QDL_CLK_GPMI_APB>,
111 <&clks IMX6QDL_CLK_GPMI_BCH>,
112 <&clks IMX6QDL_CLK_GPMI_BCH_APB>,
113 <&clks IMX6QDL_CLK_PER1_BCH>;
110 clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch", 114 clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch",
111 "gpmi_bch_apb", "per1_bch"; 115 "gpmi_bch_apb", "per1_bch";
112 dmas = <&dma_apbh 0>; 116 dmas = <&dma_apbh 0>;
@@ -118,7 +122,7 @@
118 compatible = "arm,cortex-a9-twd-timer"; 122 compatible = "arm,cortex-a9-twd-timer";
119 reg = <0x00a00600 0x20>; 123 reg = <0x00a00600 0x20>;
120 interrupts = <1 13 0xf01>; 124 interrupts = <1 13 0xf01>;
121 clocks = <&clks 15>; 125 clocks = <&clks IMX6QDL_CLK_TWD>;
122 }; 126 };
123 127
124 L2: l2-cache@00a02000 { 128 L2: l2-cache@00a02000 {
@@ -149,7 +153,9 @@
149 <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, 153 <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
150 <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, 154 <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
151 <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; 155 <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
152 clocks = <&clks 144>, <&clks 206>, <&clks 189>; 156 clocks = <&clks IMX6QDL_CLK_PCIE_AXI>,
157 <&clks IMX6QDL_CLK_LVDS1_GATE>,
158 <&clks IMX6QDL_CLK_PCIE_REF_125M>;
153 clock-names = "pcie", "pcie_bus", "pcie_phy"; 159 clock-names = "pcie", "pcie_bus", "pcie_phy";
154 status = "disabled"; 160 status = "disabled";
155 }; 161 };
@@ -180,11 +186,11 @@
180 dmas = <&sdma 14 18 0>, 186 dmas = <&sdma 14 18 0>,
181 <&sdma 15 18 0>; 187 <&sdma 15 18 0>;
182 dma-names = "rx", "tx"; 188 dma-names = "rx", "tx";
183 clocks = <&clks 197>, <&clks 3>, 189 clocks = <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_OSC>,
184 <&clks 197>, <&clks 107>, 190 <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_DUMMY>,
185 <&clks 0>, <&clks 118>, 191 <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_DUMMY>,
186 <&clks 0>, <&clks 139>, 192 <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_DUMMY>,
187 <&clks 0>; 193 <&clks IMX6QDL_CLK_DUMMY>;
188 clock-names = "core", "rxtx0", 194 clock-names = "core", "rxtx0",
189 "rxtx1", "rxtx2", 195 "rxtx1", "rxtx2",
190 "rxtx3", "rxtx4", 196 "rxtx3", "rxtx4",
@@ -199,7 +205,8 @@
199 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 205 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
200 reg = <0x02008000 0x4000>; 206 reg = <0x02008000 0x4000>;
201 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>; 207 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
202 clocks = <&clks 112>, <&clks 112>; 208 clocks = <&clks IMX6QDL_CLK_ECSPI1>,
209 <&clks IMX6QDL_CLK_ECSPI1>;
203 clock-names = "ipg", "per"; 210 clock-names = "ipg", "per";
204 dmas = <&sdma 3 7 1>, <&sdma 4 7 2>; 211 dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
205 dma-names = "rx", "tx"; 212 dma-names = "rx", "tx";
@@ -212,7 +219,8 @@
212 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 219 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
213 reg = <0x0200c000 0x4000>; 220 reg = <0x0200c000 0x4000>;
214 interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>; 221 interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>;
215 clocks = <&clks 113>, <&clks 113>; 222 clocks = <&clks IMX6QDL_CLK_ECSPI2>,
223 <&clks IMX6QDL_CLK_ECSPI2>;
216 clock-names = "ipg", "per"; 224 clock-names = "ipg", "per";
217 dmas = <&sdma 5 7 1>, <&sdma 6 7 2>; 225 dmas = <&sdma 5 7 1>, <&sdma 6 7 2>;
218 dma-names = "rx", "tx"; 226 dma-names = "rx", "tx";
@@ -225,7 +233,8 @@
225 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 233 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
226 reg = <0x02010000 0x4000>; 234 reg = <0x02010000 0x4000>;
227 interrupts = <0 33 IRQ_TYPE_LEVEL_HIGH>; 235 interrupts = <0 33 IRQ_TYPE_LEVEL_HIGH>;
228 clocks = <&clks 114>, <&clks 114>; 236 clocks = <&clks IMX6QDL_CLK_ECSPI3>,
237 <&clks IMX6QDL_CLK_ECSPI3>;
229 clock-names = "ipg", "per"; 238 clock-names = "ipg", "per";
230 dmas = <&sdma 7 7 1>, <&sdma 8 7 2>; 239 dmas = <&sdma 7 7 1>, <&sdma 8 7 2>;
231 dma-names = "rx", "tx"; 240 dma-names = "rx", "tx";
@@ -238,7 +247,8 @@
238 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi"; 247 compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
239 reg = <0x02014000 0x4000>; 248 reg = <0x02014000 0x4000>;
240 interrupts = <0 34 IRQ_TYPE_LEVEL_HIGH>; 249 interrupts = <0 34 IRQ_TYPE_LEVEL_HIGH>;
241 clocks = <&clks 115>, <&clks 115>; 250 clocks = <&clks IMX6QDL_CLK_ECSPI4>,
251 <&clks IMX6QDL_CLK_ECSPI4>;
242 clock-names = "ipg", "per"; 252 clock-names = "ipg", "per";
243 dmas = <&sdma 9 7 1>, <&sdma 10 7 2>; 253 dmas = <&sdma 9 7 1>, <&sdma 10 7 2>;
244 dma-names = "rx", "tx"; 254 dma-names = "rx", "tx";
@@ -249,7 +259,8 @@
249 compatible = "fsl,imx6q-uart", "fsl,imx21-uart"; 259 compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
250 reg = <0x02020000 0x4000>; 260 reg = <0x02020000 0x4000>;
251 interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; 261 interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
252 clocks = <&clks 160>, <&clks 161>; 262 clocks = <&clks IMX6QDL_CLK_UART_IPG>,
263 <&clks IMX6QDL_CLK_UART_SERIAL>;
253 clock-names = "ipg", "per"; 264 clock-names = "ipg", "per";
254 dmas = <&sdma 25 4 0>, <&sdma 26 4 0>; 265 dmas = <&sdma 25 4 0>, <&sdma 26 4 0>;
255 dma-names = "rx", "tx"; 266 dma-names = "rx", "tx";
@@ -263,46 +274,40 @@
263 274
264 ssi1: ssi@02028000 { 275 ssi1: ssi@02028000 {
265 compatible = "fsl,imx6q-ssi", 276 compatible = "fsl,imx6q-ssi",
266 "fsl,imx51-ssi", 277 "fsl,imx51-ssi";
267 "fsl,imx21-ssi";
268 reg = <0x02028000 0x4000>; 278 reg = <0x02028000 0x4000>;
269 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>; 279 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
270 clocks = <&clks 178>; 280 clocks = <&clks IMX6QDL_CLK_SSI1_IPG>;
271 dmas = <&sdma 37 1 0>, 281 dmas = <&sdma 37 1 0>,
272 <&sdma 38 1 0>; 282 <&sdma 38 1 0>;
273 dma-names = "rx", "tx"; 283 dma-names = "rx", "tx";
274 fsl,fifo-depth = <15>; 284 fsl,fifo-depth = <15>;
275 fsl,ssi-dma-events = <38 37>;
276 status = "disabled"; 285 status = "disabled";
277 }; 286 };
278 287
279 ssi2: ssi@0202c000 { 288 ssi2: ssi@0202c000 {
280 compatible = "fsl,imx6q-ssi", 289 compatible = "fsl,imx6q-ssi",
281 "fsl,imx51-ssi", 290 "fsl,imx51-ssi";
282 "fsl,imx21-ssi";
283 reg = <0x0202c000 0x4000>; 291 reg = <0x0202c000 0x4000>;
284 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>; 292 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
285 clocks = <&clks 179>; 293 clocks = <&clks IMX6QDL_CLK_SSI2_IPG>;
286 dmas = <&sdma 41 1 0>, 294 dmas = <&sdma 41 1 0>,
287 <&sdma 42 1 0>; 295 <&sdma 42 1 0>;
288 dma-names = "rx", "tx"; 296 dma-names = "rx", "tx";
289 fsl,fifo-depth = <15>; 297 fsl,fifo-depth = <15>;
290 fsl,ssi-dma-events = <42 41>;
291 status = "disabled"; 298 status = "disabled";
292 }; 299 };
293 300
294 ssi3: ssi@02030000 { 301 ssi3: ssi@02030000 {
295 compatible = "fsl,imx6q-ssi", 302 compatible = "fsl,imx6q-ssi",
296 "fsl,imx51-ssi", 303 "fsl,imx51-ssi";
297 "fsl,imx21-ssi";
298 reg = <0x02030000 0x4000>; 304 reg = <0x02030000 0x4000>;
299 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>; 305 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
300 clocks = <&clks 180>; 306 clocks = <&clks IMX6QDL_CLK_SSI3_IPG>;
301 dmas = <&sdma 45 1 0>, 307 dmas = <&sdma 45 1 0>,
302 <&sdma 46 1 0>; 308 <&sdma 46 1 0>;
303 dma-names = "rx", "tx"; 309 dma-names = "rx", "tx";
304 fsl,fifo-depth = <15>; 310 fsl,fifo-depth = <15>;
305 fsl,ssi-dma-events = <46 45>;
306 status = "disabled"; 311 status = "disabled";
307 }; 312 };
308 313
@@ -331,7 +336,8 @@
331 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm"; 336 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
332 reg = <0x02080000 0x4000>; 337 reg = <0x02080000 0x4000>;
333 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>; 338 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
334 clocks = <&clks 62>, <&clks 145>; 339 clocks = <&clks IMX6QDL_CLK_IPG>,
340 <&clks IMX6QDL_CLK_PWM1>;
335 clock-names = "ipg", "per"; 341 clock-names = "ipg", "per";
336 }; 342 };
337 343
@@ -340,7 +346,8 @@
340 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm"; 346 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
341 reg = <0x02084000 0x4000>; 347 reg = <0x02084000 0x4000>;
342 interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>; 348 interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
343 clocks = <&clks 62>, <&clks 146>; 349 clocks = <&clks IMX6QDL_CLK_IPG>,
350 <&clks IMX6QDL_CLK_PWM2>;
344 clock-names = "ipg", "per"; 351 clock-names = "ipg", "per";
345 }; 352 };
346 353
@@ -349,7 +356,8 @@
349 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm"; 356 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
350 reg = <0x02088000 0x4000>; 357 reg = <0x02088000 0x4000>;
351 interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>; 358 interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
352 clocks = <&clks 62>, <&clks 147>; 359 clocks = <&clks IMX6QDL_CLK_IPG>,
360 <&clks IMX6QDL_CLK_PWM3>;
353 clock-names = "ipg", "per"; 361 clock-names = "ipg", "per";
354 }; 362 };
355 363
@@ -358,7 +366,8 @@
358 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm"; 366 compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
359 reg = <0x0208c000 0x4000>; 367 reg = <0x0208c000 0x4000>;
360 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>; 368 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
361 clocks = <&clks 62>, <&clks 148>; 369 clocks = <&clks IMX6QDL_CLK_IPG>,
370 <&clks IMX6QDL_CLK_PWM4>;
362 clock-names = "ipg", "per"; 371 clock-names = "ipg", "per";
363 }; 372 };
364 373
@@ -366,7 +375,8 @@
366 compatible = "fsl,imx6q-flexcan"; 375 compatible = "fsl,imx6q-flexcan";
367 reg = <0x02090000 0x4000>; 376 reg = <0x02090000 0x4000>;
368 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>; 377 interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
369 clocks = <&clks 108>, <&clks 109>; 378 clocks = <&clks IMX6QDL_CLK_CAN1_IPG>,
379 <&clks IMX6QDL_CLK_CAN1_SERIAL>;
370 clock-names = "ipg", "per"; 380 clock-names = "ipg", "per";
371 status = "disabled"; 381 status = "disabled";
372 }; 382 };
@@ -375,7 +385,8 @@
375 compatible = "fsl,imx6q-flexcan"; 385 compatible = "fsl,imx6q-flexcan";
376 reg = <0x02094000 0x4000>; 386 reg = <0x02094000 0x4000>;
377 interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>; 387 interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
378 clocks = <&clks 110>, <&clks 111>; 388 clocks = <&clks IMX6QDL_CLK_CAN2_IPG>,
389 <&clks IMX6QDL_CLK_CAN2_SERIAL>;
379 clock-names = "ipg", "per"; 390 clock-names = "ipg", "per";
380 status = "disabled"; 391 status = "disabled";
381 }; 392 };
@@ -384,7 +395,8 @@
384 compatible = "fsl,imx6q-gpt", "fsl,imx31-gpt"; 395 compatible = "fsl,imx6q-gpt", "fsl,imx31-gpt";
385 reg = <0x02098000 0x4000>; 396 reg = <0x02098000 0x4000>;
386 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; 397 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
387 clocks = <&clks 119>, <&clks 120>; 398 clocks = <&clks IMX6QDL_CLK_GPT_IPG>,
399 <&clks IMX6QDL_CLK_GPT_IPG_PER>;
388 clock-names = "ipg", "per"; 400 clock-names = "ipg", "per";
389 }; 401 };
390 402
@@ -466,22 +478,25 @@
466 }; 478 };
467 479
468 kpp: kpp@020b8000 { 480 kpp: kpp@020b8000 {
481 compatible = "fsl,imx6q-kpp", "fsl,imx21-kpp";
469 reg = <0x020b8000 0x4000>; 482 reg = <0x020b8000 0x4000>;
470 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>; 483 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
484 clocks = <&clks IMX6QDL_CLK_IPG>;
485 status = "disabled";
471 }; 486 };
472 487
473 wdog1: wdog@020bc000 { 488 wdog1: wdog@020bc000 {
474 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt"; 489 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
475 reg = <0x020bc000 0x4000>; 490 reg = <0x020bc000 0x4000>;
476 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>; 491 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
477 clocks = <&clks 0>; 492 clocks = <&clks IMX6QDL_CLK_DUMMY>;
478 }; 493 };
479 494
480 wdog2: wdog@020c0000 { 495 wdog2: wdog@020c0000 {
481 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt"; 496 compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
482 reg = <0x020c0000 0x4000>; 497 reg = <0x020c0000 0x4000>;
483 interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>; 498 interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
484 clocks = <&clks 0>; 499 clocks = <&clks IMX6QDL_CLK_DUMMY>;
485 status = "disabled"; 500 status = "disabled";
486 }; 501 };
487 502
@@ -599,14 +614,14 @@
599 interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>; 614 interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>;
600 fsl,tempmon = <&anatop>; 615 fsl,tempmon = <&anatop>;
601 fsl,tempmon-data = <&ocotp>; 616 fsl,tempmon-data = <&ocotp>;
602 clocks = <&clks 172>; 617 clocks = <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
603 }; 618 };
604 619
605 usbphy1: usbphy@020c9000 { 620 usbphy1: usbphy@020c9000 {
606 compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; 621 compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
607 reg = <0x020c9000 0x1000>; 622 reg = <0x020c9000 0x1000>;
608 interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>; 623 interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
609 clocks = <&clks 182>; 624 clocks = <&clks IMX6QDL_CLK_USBPHY1>;
610 fsl,anatop = <&anatop>; 625 fsl,anatop = <&anatop>;
611 }; 626 };
612 627
@@ -614,7 +629,7 @@
614 compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; 629 compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
615 reg = <0x020ca000 0x1000>; 630 reg = <0x020ca000 0x1000>;
616 interrupts = <0 45 IRQ_TYPE_LEVEL_HIGH>; 631 interrupts = <0 45 IRQ_TYPE_LEVEL_HIGH>;
617 clocks = <&clks 183>; 632 clocks = <&clks IMX6QDL_CLK_USBPHY2>;
618 fsl,anatop = <&anatop>; 633 fsl,anatop = <&anatop>;
619 }; 634 };
620 635
@@ -727,7 +742,8 @@
727 reg = <0x00120000 0x9000>; 742 reg = <0x00120000 0x9000>;
728 interrupts = <0 115 0x04>; 743 interrupts = <0 115 0x04>;
729 gpr = <&gpr>; 744 gpr = <&gpr>;
730 clocks = <&clks 123>, <&clks 124>; 745 clocks = <&clks IMX6QDL_CLK_HDMI_IAHB>,
746 <&clks IMX6QDL_CLK_HDMI_ISFR>;
731 clock-names = "iahb", "isfr"; 747 clock-names = "iahb", "isfr";
732 status = "disabled"; 748 status = "disabled";
733 749
@@ -762,7 +778,8 @@
762 compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma"; 778 compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma";
763 reg = <0x020ec000 0x4000>; 779 reg = <0x020ec000 0x4000>;
764 interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>; 780 interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
765 clocks = <&clks 155>, <&clks 155>; 781 clocks = <&clks IMX6QDL_CLK_SDMA>,
782 <&clks IMX6QDL_CLK_SDMA>;
766 clock-names = "ipg", "ahb"; 783 clock-names = "ipg", "ahb";
767 #dma-cells = <3>; 784 #dma-cells = <3>;
768 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6q.bin"; 785 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6q.bin";
@@ -790,7 +807,7 @@
790 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 807 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
791 reg = <0x02184000 0x200>; 808 reg = <0x02184000 0x200>;
792 interrupts = <0 43 IRQ_TYPE_LEVEL_HIGH>; 809 interrupts = <0 43 IRQ_TYPE_LEVEL_HIGH>;
793 clocks = <&clks 162>; 810 clocks = <&clks IMX6QDL_CLK_USBOH3>;
794 fsl,usbphy = <&usbphy1>; 811 fsl,usbphy = <&usbphy1>;
795 fsl,usbmisc = <&usbmisc 0>; 812 fsl,usbmisc = <&usbmisc 0>;
796 status = "disabled"; 813 status = "disabled";
@@ -800,7 +817,7 @@
800 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 817 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
801 reg = <0x02184200 0x200>; 818 reg = <0x02184200 0x200>;
802 interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>; 819 interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
803 clocks = <&clks 162>; 820 clocks = <&clks IMX6QDL_CLK_USBOH3>;
804 fsl,usbphy = <&usbphy2>; 821 fsl,usbphy = <&usbphy2>;
805 fsl,usbmisc = <&usbmisc 1>; 822 fsl,usbmisc = <&usbmisc 1>;
806 status = "disabled"; 823 status = "disabled";
@@ -810,7 +827,7 @@
810 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 827 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
811 reg = <0x02184400 0x200>; 828 reg = <0x02184400 0x200>;
812 interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>; 829 interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>;
813 clocks = <&clks 162>; 830 clocks = <&clks IMX6QDL_CLK_USBOH3>;
814 fsl,usbmisc = <&usbmisc 2>; 831 fsl,usbmisc = <&usbmisc 2>;
815 status = "disabled"; 832 status = "disabled";
816 }; 833 };
@@ -819,7 +836,7 @@
819 compatible = "fsl,imx6q-usb", "fsl,imx27-usb"; 836 compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
820 reg = <0x02184600 0x200>; 837 reg = <0x02184600 0x200>;
821 interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>; 838 interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>;
822 clocks = <&clks 162>; 839 clocks = <&clks IMX6QDL_CLK_USBOH3>;
823 fsl,usbmisc = <&usbmisc 3>; 840 fsl,usbmisc = <&usbmisc 3>;
824 status = "disabled"; 841 status = "disabled";
825 }; 842 };
@@ -828,7 +845,7 @@
828 #index-cells = <1>; 845 #index-cells = <1>;
829 compatible = "fsl,imx6q-usbmisc"; 846 compatible = "fsl,imx6q-usbmisc";
830 reg = <0x02184800 0x200>; 847 reg = <0x02184800 0x200>;
831 clocks = <&clks 162>; 848 clocks = <&clks IMX6QDL_CLK_USBOH3>;
832 }; 849 };
833 850
834 fec: ethernet@02188000 { 851 fec: ethernet@02188000 {
@@ -837,7 +854,9 @@
837 interrupts-extended = 854 interrupts-extended =
838 <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>, 855 <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>,
839 <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; 856 <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
840 clocks = <&clks 117>, <&clks 117>, <&clks 190>; 857 clocks = <&clks IMX6QDL_CLK_ENET>,
858 <&clks IMX6QDL_CLK_ENET>,
859 <&clks IMX6QDL_CLK_ENET_REF>;
841 clock-names = "ipg", "ahb", "ptp"; 860 clock-names = "ipg", "ahb", "ptp";
842 status = "disabled"; 861 status = "disabled";
843 }; 862 };
@@ -853,7 +872,9 @@
853 compatible = "fsl,imx6q-usdhc"; 872 compatible = "fsl,imx6q-usdhc";
854 reg = <0x02190000 0x4000>; 873 reg = <0x02190000 0x4000>;
855 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>; 874 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
856 clocks = <&clks 163>, <&clks 163>, <&clks 163>; 875 clocks = <&clks IMX6QDL_CLK_USDHC1>,
876 <&clks IMX6QDL_CLK_USDHC1>,
877 <&clks IMX6QDL_CLK_USDHC1>;
857 clock-names = "ipg", "ahb", "per"; 878 clock-names = "ipg", "ahb", "per";
858 bus-width = <4>; 879 bus-width = <4>;
859 status = "disabled"; 880 status = "disabled";
@@ -863,7 +884,9 @@
863 compatible = "fsl,imx6q-usdhc"; 884 compatible = "fsl,imx6q-usdhc";
864 reg = <0x02194000 0x4000>; 885 reg = <0x02194000 0x4000>;
865 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>; 886 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
866 clocks = <&clks 164>, <&clks 164>, <&clks 164>; 887 clocks = <&clks IMX6QDL_CLK_USDHC2>,
888 <&clks IMX6QDL_CLK_USDHC2>,
889 <&clks IMX6QDL_CLK_USDHC2>;
867 clock-names = "ipg", "ahb", "per"; 890 clock-names = "ipg", "ahb", "per";
868 bus-width = <4>; 891 bus-width = <4>;
869 status = "disabled"; 892 status = "disabled";
@@ -873,7 +896,9 @@
873 compatible = "fsl,imx6q-usdhc"; 896 compatible = "fsl,imx6q-usdhc";
874 reg = <0x02198000 0x4000>; 897 reg = <0x02198000 0x4000>;
875 interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>; 898 interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
876 clocks = <&clks 165>, <&clks 165>, <&clks 165>; 899 clocks = <&clks IMX6QDL_CLK_USDHC3>,
900 <&clks IMX6QDL_CLK_USDHC3>,
901 <&clks IMX6QDL_CLK_USDHC3>;
877 clock-names = "ipg", "ahb", "per"; 902 clock-names = "ipg", "ahb", "per";
878 bus-width = <4>; 903 bus-width = <4>;
879 status = "disabled"; 904 status = "disabled";
@@ -883,7 +908,9 @@
883 compatible = "fsl,imx6q-usdhc"; 908 compatible = "fsl,imx6q-usdhc";
884 reg = <0x0219c000 0x4000>; 909 reg = <0x0219c000 0x4000>;
885 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>; 910 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
886 clocks = <&clks 166>, <&clks 166>, <&clks 166>; 911 clocks = <&clks IMX6QDL_CLK_USDHC4>,
912 <&clks IMX6QDL_CLK_USDHC4>,
913 <&clks IMX6QDL_CLK_USDHC4>;
887 clock-names = "ipg", "ahb", "per"; 914 clock-names = "ipg", "ahb", "per";
888 bus-width = <4>; 915 bus-width = <4>;
889 status = "disabled"; 916 status = "disabled";
@@ -895,7 +922,7 @@
895 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c"; 922 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
896 reg = <0x021a0000 0x4000>; 923 reg = <0x021a0000 0x4000>;
897 interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>; 924 interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>;
898 clocks = <&clks 125>; 925 clocks = <&clks IMX6QDL_CLK_I2C1>;
899 status = "disabled"; 926 status = "disabled";
900 }; 927 };
901 928
@@ -905,7 +932,7 @@
905 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c"; 932 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
906 reg = <0x021a4000 0x4000>; 933 reg = <0x021a4000 0x4000>;
907 interrupts = <0 37 IRQ_TYPE_LEVEL_HIGH>; 934 interrupts = <0 37 IRQ_TYPE_LEVEL_HIGH>;
908 clocks = <&clks 126>; 935 clocks = <&clks IMX6QDL_CLK_I2C2>;
909 status = "disabled"; 936 status = "disabled";
910 }; 937 };
911 938
@@ -915,7 +942,7 @@
915 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c"; 942 compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
916 reg = <0x021a8000 0x4000>; 943 reg = <0x021a8000 0x4000>;
917 interrupts = <0 38 IRQ_TYPE_LEVEL_HIGH>; 944 interrupts = <0 38 IRQ_TYPE_LEVEL_HIGH>;
918 clocks = <&clks 127>; 945 clocks = <&clks IMX6QDL_CLK_I2C3>;
919 status = "disabled"; 946 status = "disabled";
920 }; 947 };
921 948
@@ -936,7 +963,7 @@
936 compatible = "fsl,imx6q-weim"; 963 compatible = "fsl,imx6q-weim";
937 reg = <0x021b8000 0x4000>; 964 reg = <0x021b8000 0x4000>;
938 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; 965 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
939 clocks = <&clks 196>; 966 clocks = <&clks IMX6QDL_CLK_EIM_SLOW>;
940 }; 967 };
941 968
942 ocotp: ocotp@021bc000 { 969 ocotp: ocotp@021bc000 {
@@ -996,7 +1023,8 @@
996 compatible = "fsl,imx6q-uart", "fsl,imx21-uart"; 1023 compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
997 reg = <0x021e8000 0x4000>; 1024 reg = <0x021e8000 0x4000>;
998 interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; 1025 interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>;
999 clocks = <&clks 160>, <&clks 161>; 1026 clocks = <&clks IMX6QDL_CLK_UART_IPG>,
1027 <&clks IMX6QDL_CLK_UART_SERIAL>;
1000 clock-names = "ipg", "per"; 1028 clock-names = "ipg", "per";
1001 dmas = <&sdma 27 4 0>, <&sdma 28 4 0>; 1029 dmas = <&sdma 27 4 0>, <&sdma 28 4 0>;
1002 dma-names = "rx", "tx"; 1030 dma-names = "rx", "tx";
@@ -1007,7 +1035,8 @@
1007 compatible = "fsl,imx6q-uart", "fsl,imx21-uart"; 1035 compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
1008 reg = <0x021ec000 0x4000>; 1036 reg = <0x021ec000 0x4000>;
1009 interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; 1037 interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>;
1010 clocks = <&clks 160>, <&clks 161>; 1038 clocks = <&clks IMX6QDL_CLK_UART_IPG>,
1039 <&clks IMX6QDL_CLK_UART_SERIAL>;
1011 clock-names = "ipg", "per"; 1040 clock-names = "ipg", "per";
1012 dmas = <&sdma 29 4 0>, <&sdma 30 4 0>; 1041 dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
1013 dma-names = "rx", "tx"; 1042 dma-names = "rx", "tx";
@@ -1018,7 +1047,8 @@
1018 compatible = "fsl,imx6q-uart", "fsl,imx21-uart"; 1047 compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
1019 reg = <0x021f0000 0x4000>; 1048 reg = <0x021f0000 0x4000>;
1020 interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; 1049 interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
1021 clocks = <&clks 160>, <&clks 161>; 1050 clocks = <&clks IMX6QDL_CLK_UART_IPG>,
1051 <&clks IMX6QDL_CLK_UART_SERIAL>;
1022 clock-names = "ipg", "per"; 1052 clock-names = "ipg", "per";
1023 dmas = <&sdma 31 4 0>, <&sdma 32 4 0>; 1053 dmas = <&sdma 31 4 0>, <&sdma 32 4 0>;
1024 dma-names = "rx", "tx"; 1054 dma-names = "rx", "tx";
@@ -1029,7 +1059,8 @@
1029 compatible = "fsl,imx6q-uart", "fsl,imx21-uart"; 1059 compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
1030 reg = <0x021f4000 0x4000>; 1060 reg = <0x021f4000 0x4000>;
1031 interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; 1061 interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
1032 clocks = <&clks 160>, <&clks 161>; 1062 clocks = <&clks IMX6QDL_CLK_UART_IPG>,
1063 <&clks IMX6QDL_CLK_UART_SERIAL>;
1033 clock-names = "ipg", "per"; 1064 clock-names = "ipg", "per";
1034 dmas = <&sdma 33 4 0>, <&sdma 34 4 0>; 1065 dmas = <&sdma 33 4 0>, <&sdma 34 4 0>;
1035 dma-names = "rx", "tx"; 1066 dma-names = "rx", "tx";
@@ -1044,10 +1075,20 @@
1044 reg = <0x02400000 0x400000>; 1075 reg = <0x02400000 0x400000>;
1045 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>, 1076 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>,
1046 <0 5 IRQ_TYPE_LEVEL_HIGH>; 1077 <0 5 IRQ_TYPE_LEVEL_HIGH>;
1047 clocks = <&clks 130>, <&clks 131>, <&clks 132>; 1078 clocks = <&clks IMX6QDL_CLK_IPU1>,
1079 <&clks IMX6QDL_CLK_IPU1_DI0>,
1080 <&clks IMX6QDL_CLK_IPU1_DI1>;
1048 clock-names = "bus", "di0", "di1"; 1081 clock-names = "bus", "di0", "di1";
1049 resets = <&src 2>; 1082 resets = <&src 2>;
1050 1083
1084 ipu1_csi0: port@0 {
1085 reg = <0>;
1086 };
1087
1088 ipu1_csi1: port@1 {
1089 reg = <1>;
1090 };
1091
1051 ipu1_di0: port@2 { 1092 ipu1_di0: port@2 {
1052 #address-cells = <1>; 1093 #address-cells = <1>;
1053 #size-cells = <0>; 1094 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index a8d9a93fab85..3f9e041c0252 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -116,8 +116,9 @@
116}; 116};
117 117
118&fec { 118&fec {
119 pinctrl-names = "default"; 119 pinctrl-names = "default", "sleep";
120 pinctrl-0 = <&pinctrl_fec>; 120 pinctrl-0 = <&pinctrl_fec>;
121 pinctrl-1 = <&pinctrl_fec_sleep>;
121 phy-mode = "rmii"; 122 phy-mode = "rmii";
122 status = "okay"; 123 status = "okay";
123}; 124};
@@ -300,6 +301,19 @@
300 >; 301 >;
301 }; 302 };
302 303
304 pinctrl_fec_sleep: fecgrp-sleep {
305 fsl,pins = <
306 MX6SL_PAD_FEC_MDC__GPIO4_IO23 0x3080
307 MX6SL_PAD_FEC_CRS_DV__GPIO4_IO25 0x3080
308 MX6SL_PAD_FEC_RXD0__GPIO4_IO17 0x3080
309 MX6SL_PAD_FEC_RXD1__GPIO4_IO18 0x3080
310 MX6SL_PAD_FEC_TX_EN__GPIO4_IO22 0x3080
311 MX6SL_PAD_FEC_TXD0__GPIO4_IO24 0x3080
312 MX6SL_PAD_FEC_TXD1__GPIO4_IO16 0x3080
313 MX6SL_PAD_FEC_REF_CLK__GPIO4_IO26 0x3080
314 >;
315 };
316
303 pinctrl_i2c1: i2c1grp { 317 pinctrl_i2c1: i2c1grp {
304 fsl,pins = < 318 fsl,pins = <
305 MX6SL_PAD_I2C1_SCL__I2C1_SCL 0x4001b8b1 319 MX6SL_PAD_I2C1_SCL__I2C1_SCL 0x4001b8b1
@@ -475,7 +489,6 @@
475}; 489};
476 490
477&ssi2 { 491&ssi2 {
478 fsl,mode = "i2s-slave";
479 status = "okay"; 492 status = "okay";
480}; 493};
481 494
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 57d4abe03a94..c75800ca8b35 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -227,8 +227,7 @@
227 227
228 ssi1: ssi@02028000 { 228 ssi1: ssi@02028000 {
229 compatible = "fsl,imx6sl-ssi", 229 compatible = "fsl,imx6sl-ssi",
230 "fsl,imx51-ssi", 230 "fsl,imx51-ssi";
231 "fsl,imx21-ssi";
232 reg = <0x02028000 0x4000>; 231 reg = <0x02028000 0x4000>;
233 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>; 232 interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
234 clocks = <&clks IMX6SL_CLK_SSI1>; 233 clocks = <&clks IMX6SL_CLK_SSI1>;
@@ -241,8 +240,7 @@
241 240
242 ssi2: ssi@0202c000 { 241 ssi2: ssi@0202c000 {
243 compatible = "fsl,imx6sl-ssi", 242 compatible = "fsl,imx6sl-ssi",
244 "fsl,imx51-ssi", 243 "fsl,imx51-ssi";
245 "fsl,imx21-ssi";
246 reg = <0x0202c000 0x4000>; 244 reg = <0x0202c000 0x4000>;
247 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>; 245 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
248 clocks = <&clks IMX6SL_CLK_SSI2>; 246 clocks = <&clks IMX6SL_CLK_SSI2>;
@@ -255,8 +253,7 @@
255 253
256 ssi3: ssi@02030000 { 254 ssi3: ssi@02030000 {
257 compatible = "fsl,imx6sl-ssi", 255 compatible = "fsl,imx6sl-ssi",
258 "fsl,imx51-ssi", 256 "fsl,imx51-ssi";
259 "fsl,imx21-ssi";
260 reg = <0x02030000 0x4000>; 257 reg = <0x02030000 0x4000>;
261 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>; 258 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
262 clocks = <&clks IMX6SL_CLK_SSI3>; 259 clocks = <&clks IMX6SL_CLK_SSI3>;
@@ -403,6 +400,7 @@
403 reg = <0x020b8000 0x4000>; 400 reg = <0x020b8000 0x4000>;
404 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>; 401 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
405 clocks = <&clks IMX6SL_CLK_DUMMY>; 402 clocks = <&clks IMX6SL_CLK_DUMMY>;
403 status = "disabled";
406 }; 404 };
407 405
408 wdog1: wdog@020bc000 { 406 wdog1: wdog@020bc000 {
@@ -607,7 +605,7 @@
607 }; 605 };
608 606
609 sdma: sdma@020ec000 { 607 sdma: sdma@020ec000 {
610 compatible = "fsl,imx6sl-sdma", "fsl,imx35-sdma"; 608 compatible = "fsl,imx6sl-sdma", "fsl,imx6q-sdma";
611 reg = <0x020ec000 0x4000>; 609 reg = <0x020ec000 0x4000>;
612 interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>; 610 interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
613 clocks = <&clks IMX6SL_CLK_SDMA>, 611 clocks = <&clks IMX6SL_CLK_SDMA>,
diff --git a/arch/arm/boot/dts/imx6sx-pinfunc.h b/arch/arm/boot/dts/imx6sx-pinfunc.h
new file mode 100644
index 000000000000..3e0b816dac08
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sx-pinfunc.h
@@ -0,0 +1,1544 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DTS_IMX6SX_PINFUNC_H
11#define __DTS_IMX6SX_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX6SX_PAD_GPIO1_IO00__I2C1_SCL 0x0014 0x035C 0x07A8 0x0 0x1
18#define MX6SX_PAD_GPIO1_IO00__USDHC1_VSELECT 0x0014 0x035C 0x0000 0x1 0x0
19#define MX6SX_PAD_GPIO1_IO00__SPDIF_LOCK 0x0014 0x035C 0x0000 0x2 0x0
20#define MX6SX_PAD_GPIO1_IO00__CCM_WAIT 0x0014 0x035C 0x0000 0x3 0x0
21#define MX6SX_PAD_GPIO1_IO00__WDOG1_WDOG_ANY 0x0014 0x035C 0x0000 0x4 0x0
22#define MX6SX_PAD_GPIO1_IO00__GPIO1_IO_0 0x0014 0x035C 0x0000 0x5 0x0
23#define MX6SX_PAD_GPIO1_IO00__SNVS_HP_WRAPPER_VIO_5 0x0014 0x035C 0x0000 0x6 0x0
24#define MX6SX_PAD_GPIO1_IO00__PHY_DTB_1 0x0014 0x035C 0x0000 0x7 0x0
25#define MX6SX_PAD_GPIO1_IO01__I2C1_SDA 0x0018 0x0360 0x07AC 0x0 0x1
26#define MX6SX_PAD_GPIO1_IO01__USDHC1_RESET_B 0x0018 0x0360 0x0000 0x1 0x0
27#define MX6SX_PAD_GPIO1_IO01__SPDIF_SR_CLK 0x0018 0x0360 0x0000 0x2 0x0
28#define MX6SX_PAD_GPIO1_IO01__CCM_STOP 0x0018 0x0360 0x0000 0x3 0x0
29#define MX6SX_PAD_GPIO1_IO01__WDOG3_WDOG_B 0x0018 0x0360 0x0000 0x4 0x0
30#define MX6SX_PAD_GPIO1_IO01__GPIO1_IO_1 0x0018 0x0360 0x0000 0x5 0x0
31#define MX6SX_PAD_GPIO1_IO01__SNVS_HP_WRAPPER_VIO_5_CTL 0x0018 0x0360 0x0000 0x6 0x0
32#define MX6SX_PAD_GPIO1_IO01__PHY_DTB_0 0x0018 0x0360 0x0000 0x7 0x0
33#define MX6SX_PAD_GPIO1_IO02__I2C2_SCL 0x001C 0x0364 0x07B0 0x0 0x1
34#define MX6SX_PAD_GPIO1_IO02__USDHC1_CD_B 0x001C 0x0364 0x0864 0x1 0x1
35#define MX6SX_PAD_GPIO1_IO02__CSI2_MCLK 0x001C 0x0364 0x0000 0x2 0x0
36#define MX6SX_PAD_GPIO1_IO02__CCM_DI0_EXT_CLK 0x001C 0x0364 0x0000 0x3 0x0
37#define MX6SX_PAD_GPIO1_IO02__WDOG1_WDOG_B 0x001C 0x0364 0x0000 0x4 0x0
38#define MX6SX_PAD_GPIO1_IO02__GPIO1_IO_2 0x001C 0x0364 0x0000 0x5 0x0
39#define MX6SX_PAD_GPIO1_IO02__CCM_REF_EN_B 0x001C 0x0364 0x0000 0x6 0x0
40#define MX6SX_PAD_GPIO1_IO02__PHY_TDI 0x001C 0x0364 0x0000 0x7 0x0
41#define MX6SX_PAD_GPIO1_IO03__I2C2_SDA 0x0020 0x0368 0x07B4 0x0 0x1
42#define MX6SX_PAD_GPIO1_IO03__USDHC1_WP 0x0020 0x0368 0x0868 0x1 0x1
43#define MX6SX_PAD_GPIO1_IO03__ENET1_REF_CLK_25M 0x0020 0x0368 0x0000 0x2 0x0
44#define MX6SX_PAD_GPIO1_IO03__CCM_DI1_EXT_CLK 0x0020 0x0368 0x0000 0x3 0x0
45#define MX6SX_PAD_GPIO1_IO03__WDOG2_WDOG_B 0x0020 0x0368 0x0000 0x4 0x0
46#define MX6SX_PAD_GPIO1_IO03__GPIO1_IO_3 0x0020 0x0368 0x0000 0x5 0x0
47#define MX6SX_PAD_GPIO1_IO03__CCM_PLL3_BYP 0x0020 0x0368 0x0000 0x6 0x0
48#define MX6SX_PAD_GPIO1_IO03__PHY_TCK 0x0020 0x0368 0x0000 0x7 0x0
49#define MX6SX_PAD_GPIO1_IO04__UART1_RX 0x0024 0x036C 0x0830 0x0 0x0
50#define MX6SX_PAD_GPIO1_IO04__UART1_TX 0x0024 0x036C 0x0000 0x0 0x0
51#define MX6SX_PAD_GPIO1_IO04__USDHC2_RESET_B 0x0024 0x036C 0x0000 0x1 0x0
52#define MX6SX_PAD_GPIO1_IO04__ENET1_MDC 0x0024 0x036C 0x0000 0x2 0x0
53#define MX6SX_PAD_GPIO1_IO04__OSC32K_32K_OUT 0x0024 0x036C 0x0000 0x3 0x0
54#define MX6SX_PAD_GPIO1_IO04__ENET2_REF_CLK2 0x0024 0x036C 0x076C 0x4 0x0
55#define MX6SX_PAD_GPIO1_IO04__GPIO1_IO_4 0x0024 0x036C 0x0000 0x5 0x0
56#define MX6SX_PAD_GPIO1_IO04__CCM_PLL2_BYP 0x0024 0x036C 0x0000 0x6 0x0
57#define MX6SX_PAD_GPIO1_IO04__PHY_TMS 0x0024 0x036C 0x0000 0x7 0x0
58#define MX6SX_PAD_GPIO1_IO05__UART1_RX 0x0028 0x0370 0x0830 0x0 0x1
59#define MX6SX_PAD_GPIO1_IO05__UART1_TX 0x0028 0x0370 0x0000 0x0 0x0
60#define MX6SX_PAD_GPIO1_IO05__USDHC2_VSELECT 0x0028 0x0370 0x0000 0x1 0x0
61#define MX6SX_PAD_GPIO1_IO05__ENET1_MDIO 0x0028 0x0370 0x0764 0x2 0x0
62#define MX6SX_PAD_GPIO1_IO05__ASRC_ASRC_EXT_CLK 0x0028 0x0370 0x0000 0x3 0x0
63#define MX6SX_PAD_GPIO1_IO05__ENET1_REF_CLK1 0x0028 0x0370 0x0760 0x4 0x0
64#define MX6SX_PAD_GPIO1_IO05__GPIO1_IO_5 0x0028 0x0370 0x0000 0x5 0x0
65#define MX6SX_PAD_GPIO1_IO05__SRC_TESTER_ACK 0x0028 0x0370 0x0000 0x6 0x0
66#define MX6SX_PAD_GPIO1_IO05__PHY_TDO 0x0028 0x0370 0x0000 0x7 0x0
67#define MX6SX_PAD_GPIO1_IO06__UART2_RX 0x002C 0x0374 0x0838 0x0 0x0
68#define MX6SX_PAD_GPIO1_IO06__UART2_TX 0x002C 0x0374 0x0000 0x0 0x0
69#define MX6SX_PAD_GPIO1_IO06__USDHC2_CD_B 0x002C 0x0374 0x086C 0x1 0x1
70#define MX6SX_PAD_GPIO1_IO06__ENET2_MDC 0x002C 0x0374 0x0000 0x2 0x0
71#define MX6SX_PAD_GPIO1_IO06__CSI1_MCLK 0x002C 0x0374 0x0000 0x3 0x0
72#define MX6SX_PAD_GPIO1_IO06__UART1_RTS_B 0x002C 0x0374 0x082C 0x4 0x0
73#define MX6SX_PAD_GPIO1_IO06__GPIO1_IO_6 0x002C 0x0374 0x0000 0x5 0x0
74#define MX6SX_PAD_GPIO1_IO06__SRC_ANY_PU_RESET 0x002C 0x0374 0x0000 0x6 0x0
75#define MX6SX_PAD_GPIO1_IO06__OCOTP_CTRL_WRAPPER_FUSE_LATCHED 0x002C 0x0374 0x0000 0x7 0x0
76#define MX6SX_PAD_GPIO1_IO07__UART2_RX 0x0030 0x0378 0x0838 0x0 0x1
77#define MX6SX_PAD_GPIO1_IO07__UART2_TX 0x0030 0x0378 0x0000 0x0 0x0
78#define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1
79#define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0
80#define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0
81#define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x082C 0x4 0x1
82#define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0
83#define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0
84#define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0
85#define MX6SX_PAD_GPIO1_IO07__VDEC_DEBUG_44 0x0030 0x0378 0x0000 0x8 0x0
86#define MX6SX_PAD_GPIO1_IO08__USB_OTG1_OC 0x0034 0x037C 0x0860 0x0 0x0
87#define MX6SX_PAD_GPIO1_IO08__WDOG1_WDOG_B 0x0034 0x037C 0x0000 0x1 0x0
88#define MX6SX_PAD_GPIO1_IO08__SDMA_EXT_EVENT_0 0x0034 0x037C 0x081C 0x2 0x0
89#define MX6SX_PAD_GPIO1_IO08__CCM_PMIC_RDY 0x0034 0x037C 0x069C 0x3 0x1
90#define MX6SX_PAD_GPIO1_IO08__UART2_RTS_B 0x0034 0x037C 0x0834 0x4 0x0
91#define MX6SX_PAD_GPIO1_IO08__GPIO1_IO_8 0x0034 0x037C 0x0000 0x5 0x0
92#define MX6SX_PAD_GPIO1_IO08__SRC_SYSTEM_RESET 0x0034 0x037C 0x0000 0x6 0x0
93#define MX6SX_PAD_GPIO1_IO08__DCIC1_OUT 0x0034 0x037C 0x0000 0x7 0x0
94#define MX6SX_PAD_GPIO1_IO08__VDEC_DEBUG_43 0x0034 0x037C 0x0000 0x8 0x0
95#define MX6SX_PAD_GPIO1_IO09__USB_OTG1_PWR 0x0038 0x0380 0x0000 0x0 0x0
96#define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0
97#define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0
98#define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0
99#define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0834 0x4 0x1
100#define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0
101#define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0
102#define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0
103#define MX6SX_PAD_GPIO1_IO09__VDEC_DEBUG_42 0x0038 0x0380 0x0000 0x8 0x0
104#define MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x003C 0x0384 0x0624 0x0 0x0
105#define MX6SX_PAD_GPIO1_IO10__SPDIF_EXT_CLK 0x003C 0x0384 0x0828 0x1 0x0
106#define MX6SX_PAD_GPIO1_IO10__PWM1_OUT 0x003C 0x0384 0x0000 0x2 0x0
107#define MX6SX_PAD_GPIO1_IO10__CCM_OUT1 0x003C 0x0384 0x0000 0x3 0x0
108#define MX6SX_PAD_GPIO1_IO10__CSI1_FIELD 0x003C 0x0384 0x070C 0x4 0x1
109#define MX6SX_PAD_GPIO1_IO10__GPIO1_IO_10 0x003C 0x0384 0x0000 0x5 0x0
110#define MX6SX_PAD_GPIO1_IO10__CSU_CSU_INT_DEB 0x003C 0x0384 0x0000 0x6 0x0
111#define MX6SX_PAD_GPIO1_IO10__OBSERVE_MUX_OUT_3 0x003C 0x0384 0x0000 0x7 0x0
112#define MX6SX_PAD_GPIO1_IO10__VDEC_DEBUG_41 0x003C 0x0384 0x0000 0x8 0x0
113#define MX6SX_PAD_GPIO1_IO11__USB_OTG2_OC 0x0040 0x0388 0x085C 0x0 0x0
114#define MX6SX_PAD_GPIO1_IO11__SPDIF_IN 0x0040 0x0388 0x0824 0x1 0x2
115#define MX6SX_PAD_GPIO1_IO11__PWM2_OUT 0x0040 0x0388 0x0000 0x2 0x0
116#define MX6SX_PAD_GPIO1_IO11__CCM_CLKO1 0x0040 0x0388 0x0000 0x3 0x0
117#define MX6SX_PAD_GPIO1_IO11__MLB_DATA 0x0040 0x0388 0x07EC 0x4 0x0
118#define MX6SX_PAD_GPIO1_IO11__GPIO1_IO_11 0x0040 0x0388 0x0000 0x5 0x0
119#define MX6SX_PAD_GPIO1_IO11__CSU_CSU_ALARM_AUT_0 0x0040 0x0388 0x0000 0x6 0x0
120#define MX6SX_PAD_GPIO1_IO11__OBSERVE_MUX_OUT_2 0x0040 0x0388 0x0000 0x7 0x0
121#define MX6SX_PAD_GPIO1_IO11__VDEC_DEBUG_40 0x0040 0x0388 0x0000 0x8 0x0
122#define MX6SX_PAD_GPIO1_IO12__USB_OTG2_PWR 0x0044 0x038C 0x0000 0x0 0x0
123#define MX6SX_PAD_GPIO1_IO12__SPDIF_OUT 0x0044 0x038C 0x0000 0x1 0x0
124#define MX6SX_PAD_GPIO1_IO12__PWM3_OUT 0x0044 0x038C 0x0000 0x2 0x0
125#define MX6SX_PAD_GPIO1_IO12__CCM_CLKO2 0x0044 0x038C 0x0000 0x3 0x0
126#define MX6SX_PAD_GPIO1_IO12__MLB_CLK 0x0044 0x038C 0x07E8 0x4 0x0
127#define MX6SX_PAD_GPIO1_IO12__GPIO1_IO_12 0x0044 0x038C 0x0000 0x5 0x0
128#define MX6SX_PAD_GPIO1_IO12__CSU_CSU_ALARM_AUT_1 0x0044 0x038C 0x0000 0x6 0x0
129#define MX6SX_PAD_GPIO1_IO12__OBSERVE_MUX_OUT_1 0x0044 0x038C 0x0000 0x7 0x0
130#define MX6SX_PAD_GPIO1_IO12__VDEC_DEBUG_39 0x0044 0x038C 0x0000 0x8 0x0
131#define MX6SX_PAD_GPIO1_IO13__WDOG1_WDOG_ANY 0x0048 0x0390 0x0000 0x0 0x0
132#define MX6SX_PAD_GPIO1_IO13__ANATOP_OTG2_ID 0x0048 0x0390 0x0628 0x1 0x0
133#define MX6SX_PAD_GPIO1_IO13__PWM4_OUT 0x0048 0x0390 0x0000 0x2 0x0
134#define MX6SX_PAD_GPIO1_IO13__CCM_OUT2 0x0048 0x0390 0x0000 0x3 0x0
135#define MX6SX_PAD_GPIO1_IO13__MLB_SIG 0x0048 0x0390 0x07F0 0x4 0x0
136#define MX6SX_PAD_GPIO1_IO13__GPIO1_IO_13 0x0048 0x0390 0x0000 0x5 0x0
137#define MX6SX_PAD_GPIO1_IO13__CSU_CSU_ALARM_AUT_2 0x0048 0x0390 0x0000 0x6 0x0
138#define MX6SX_PAD_GPIO1_IO13__OBSERVE_MUX_OUT_0 0x0048 0x0390 0x0000 0x7 0x0
139#define MX6SX_PAD_GPIO1_IO13__VDEC_DEBUG_38 0x0048 0x0390 0x0000 0x8 0x0
140#define MX6SX_PAD_CSI_DATA00__CSI1_DATA_2 0x004C 0x0394 0x06A8 0x0 0x0
141#define MX6SX_PAD_CSI_DATA00__ESAI_TX_CLK 0x004C 0x0394 0x078C 0x1 0x1
142#define MX6SX_PAD_CSI_DATA00__AUDMUX_AUD6_TXC 0x004C 0x0394 0x0684 0x2 0x1
143#define MX6SX_PAD_CSI_DATA00__I2C1_SCL 0x004C 0x0394 0x07A8 0x3 0x0
144#define MX6SX_PAD_CSI_DATA00__UART6_RI_B 0x004C 0x0394 0x0000 0x4 0x0
145#define MX6SX_PAD_CSI_DATA00__GPIO1_IO_14 0x004C 0x0394 0x0000 0x5 0x0
146#define MX6SX_PAD_CSI_DATA00__WEIM_DATA_23 0x004C 0x0394 0x0000 0x6 0x0
147#define MX6SX_PAD_CSI_DATA00__SAI1_TX_BCLK 0x004C 0x0394 0x0800 0x7 0x0
148#define MX6SX_PAD_CSI_DATA00__VADC_DATA_4 0x004C 0x0394 0x0000 0x8 0x0
149#define MX6SX_PAD_CSI_DATA00__MMDC_DEBUG_37 0x004C 0x0394 0x0000 0x9 0x0
150#define MX6SX_PAD_CSI_DATA01__CSI1_DATA_3 0x0050 0x0398 0x06AC 0x0 0x0
151#define MX6SX_PAD_CSI_DATA01__ESAI_TX_FS 0x0050 0x0398 0x077C 0x1 0x1
152#define MX6SX_PAD_CSI_DATA01__AUDMUX_AUD6_TXFS 0x0050 0x0398 0x0688 0x2 0x1
153#define MX6SX_PAD_CSI_DATA01__I2C1_SDA 0x0050 0x0398 0x07AC 0x3 0x0
154#define MX6SX_PAD_CSI_DATA01__UART6_DSR_B 0x0050 0x0398 0x0000 0x4 0x0
155#define MX6SX_PAD_CSI_DATA01__GPIO1_IO_15 0x0050 0x0398 0x0000 0x5 0x0
156#define MX6SX_PAD_CSI_DATA01__WEIM_DATA_22 0x0050 0x0398 0x0000 0x6 0x0
157#define MX6SX_PAD_CSI_DATA01__SAI1_TX_SYNC 0x0050 0x0398 0x0804 0x7 0x0
158#define MX6SX_PAD_CSI_DATA01__VADC_DATA_5 0x0050 0x0398 0x0000 0x8 0x0
159#define MX6SX_PAD_CSI_DATA01__MMDC_DEBUG_38 0x0050 0x0398 0x0000 0x9 0x0
160#define MX6SX_PAD_CSI_DATA02__CSI1_DATA_4 0x0054 0x039C 0x06B0 0x0 0x0
161#define MX6SX_PAD_CSI_DATA02__ESAI_RX_CLK 0x0054 0x039C 0x0788 0x1 0x1
162#define MX6SX_PAD_CSI_DATA02__AUDMUX_AUD6_RXC 0x0054 0x039C 0x067C 0x2 0x1
163#define MX6SX_PAD_CSI_DATA02__KPP_COL_5 0x0054 0x039C 0x07C8 0x3 0x0
164#define MX6SX_PAD_CSI_DATA02__UART6_DTR_B 0x0054 0x039C 0x0000 0x4 0x0
165#define MX6SX_PAD_CSI_DATA02__GPIO1_IO_16 0x0054 0x039C 0x0000 0x5 0x0
166#define MX6SX_PAD_CSI_DATA02__WEIM_DATA_21 0x0054 0x039C 0x0000 0x6 0x0
167#define MX6SX_PAD_CSI_DATA02__SAI1_RX_BCLK 0x0054 0x039C 0x07F4 0x7 0x0
168#define MX6SX_PAD_CSI_DATA02__VADC_DATA_6 0x0054 0x039C 0x0000 0x8 0x0
169#define MX6SX_PAD_CSI_DATA02__MMDC_DEBUG_39 0x0054 0x039C 0x0000 0x9 0x0
170#define MX6SX_PAD_CSI_DATA03__CSI1_DATA_5 0x0058 0x03A0 0x06B4 0x0 0x0
171#define MX6SX_PAD_CSI_DATA03__ESAI_RX_FS 0x0058 0x03A0 0x0778 0x1 0x1
172#define MX6SX_PAD_CSI_DATA03__AUDMUX_AUD6_RXFS 0x0058 0x03A0 0x0680 0x2 0x1
173#define MX6SX_PAD_CSI_DATA03__KPP_ROW_5 0x0058 0x03A0 0x07D4 0x3 0x0
174#define MX6SX_PAD_CSI_DATA03__UART6_DCD_B 0x0058 0x03A0 0x0000 0x4 0x0
175#define MX6SX_PAD_CSI_DATA03__GPIO1_IO_17 0x0058 0x03A0 0x0000 0x5 0x0
176#define MX6SX_PAD_CSI_DATA03__WEIM_DATA_20 0x0058 0x03A0 0x0000 0x6 0x0
177#define MX6SX_PAD_CSI_DATA03__SAI1_RX_SYNC 0x0058 0x03A0 0x07FC 0x7 0x0
178#define MX6SX_PAD_CSI_DATA03__VADC_DATA_7 0x0058 0x03A0 0x0000 0x8 0x0
179#define MX6SX_PAD_CSI_DATA03__MMDC_DEBUG_40 0x0058 0x03A0 0x0000 0x9 0x0
180#define MX6SX_PAD_CSI_DATA04__CSI1_DATA_6 0x005C 0x03A4 0x06B8 0x0 0x0
181#define MX6SX_PAD_CSI_DATA04__ESAI_TX1 0x005C 0x03A4 0x0794 0x1 0x1
182#define MX6SX_PAD_CSI_DATA04__SPDIF_OUT 0x005C 0x03A4 0x0000 0x2 0x0
183#define MX6SX_PAD_CSI_DATA04__KPP_COL_6 0x005C 0x03A4 0x07CC 0x3 0x0
184#define MX6SX_PAD_CSI_DATA04__UART6_RX 0x005C 0x03A4 0x0858 0x4 0x0
185#define MX6SX_PAD_CSI_DATA04__UART6_TX 0x005C 0x03A4 0x0000 0x4 0x0
186#define MX6SX_PAD_CSI_DATA04__GPIO1_IO_18 0x005C 0x03A4 0x0000 0x5 0x0
187#define MX6SX_PAD_CSI_DATA04__WEIM_DATA_19 0x005C 0x03A4 0x0000 0x6 0x0
188#define MX6SX_PAD_CSI_DATA04__PWM5_OUT 0x005C 0x03A4 0x0000 0x7 0x0
189#define MX6SX_PAD_CSI_DATA04__VADC_DATA_8 0x005C 0x03A4 0x0000 0x8 0x0
190#define MX6SX_PAD_CSI_DATA04__MMDC_DEBUG_41 0x005C 0x03A4 0x0000 0x9 0x0
191#define MX6SX_PAD_CSI_DATA05__CSI1_DATA_7 0x0060 0x03A8 0x06BC 0x0 0x0
192#define MX6SX_PAD_CSI_DATA05__ESAI_TX4_RX1 0x0060 0x03A8 0x07A0 0x1 0x1
193#define MX6SX_PAD_CSI_DATA05__SPDIF_IN 0x0060 0x03A8 0x0824 0x2 0x1
194#define MX6SX_PAD_CSI_DATA05__KPP_ROW_6 0x0060 0x03A8 0x07D8 0x3 0x0
195#define MX6SX_PAD_CSI_DATA05__UART6_RX 0x0060 0x03A8 0x0858 0x4 0x1
196#define MX6SX_PAD_CSI_DATA05__UART6_TX 0x0060 0x03A8 0x0000 0x4 0x0
197#define MX6SX_PAD_CSI_DATA05__GPIO1_IO_19 0x0060 0x03A8 0x0000 0x5 0x0
198#define MX6SX_PAD_CSI_DATA05__WEIM_DATA_18 0x0060 0x03A8 0x0000 0x6 0x0
199#define MX6SX_PAD_CSI_DATA05__PWM6_OUT 0x0060 0x03A8 0x0000 0x7 0x0
200#define MX6SX_PAD_CSI_DATA05__VADC_DATA_9 0x0060 0x03A8 0x0000 0x8 0x0
201#define MX6SX_PAD_CSI_DATA05__MMDC_DEBUG_42 0x0060 0x03A8 0x0000 0x9 0x0
202#define MX6SX_PAD_CSI_DATA06__CSI1_DATA_8 0x0064 0x03AC 0x06C0 0x0 0x0
203#define MX6SX_PAD_CSI_DATA06__ESAI_TX2_RX3 0x0064 0x03AC 0x0798 0x1 0x1
204#define MX6SX_PAD_CSI_DATA06__I2C4_SCL 0x0064 0x03AC 0x07C0 0x2 0x2
205#define MX6SX_PAD_CSI_DATA06__KPP_COL_7 0x0064 0x03AC 0x07D0 0x3 0x0
206#define MX6SX_PAD_CSI_DATA06__UART6_RTS_B 0x0064 0x03AC 0x0854 0x4 0x0
207#define MX6SX_PAD_CSI_DATA06__GPIO1_IO_20 0x0064 0x03AC 0x0000 0x5 0x0
208#define MX6SX_PAD_CSI_DATA06__WEIM_DATA_17 0x0064 0x03AC 0x0000 0x6 0x0
209#define MX6SX_PAD_CSI_DATA06__DCIC2_OUT 0x0064 0x03AC 0x0000 0x7 0x0
210#define MX6SX_PAD_CSI_DATA06__VADC_DATA_10 0x0064 0x03AC 0x0000 0x8 0x0
211#define MX6SX_PAD_CSI_DATA06__MMDC_DEBUG_43 0x0064 0x03AC 0x0000 0x9 0x0
212#define MX6SX_PAD_CSI_DATA07__CSI1_DATA_9 0x0068 0x03B0 0x06C4 0x0 0x0
213#define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1
214#define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2
215#define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0
216#define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0854 0x4 0x1
217#define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0
218#define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0
219#define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0
220#define MX6SX_PAD_CSI_DATA07__VADC_DATA_11 0x0068 0x03B0 0x0000 0x8 0x0
221#define MX6SX_PAD_CSI_DATA07__MMDC_DEBUG_44 0x0068 0x03B0 0x0000 0x9 0x0
222#define MX6SX_PAD_CSI_HSYNC__CSI1_HSYNC 0x006C 0x03B4 0x0700 0x0 0x0
223#define MX6SX_PAD_CSI_HSYNC__ESAI_TX0 0x006C 0x03B4 0x0790 0x1 0x1
224#define MX6SX_PAD_CSI_HSYNC__AUDMUX_AUD6_TXD 0x006C 0x03B4 0x0678 0x2 0x1
225#define MX6SX_PAD_CSI_HSYNC__UART4_RTS_B 0x006C 0x03B4 0x0844 0x3 0x2
226#define MX6SX_PAD_CSI_HSYNC__MQS_LEFT 0x006C 0x03B4 0x0000 0x4 0x0
227#define MX6SX_PAD_CSI_HSYNC__GPIO1_IO_22 0x006C 0x03B4 0x0000 0x5 0x0
228#define MX6SX_PAD_CSI_HSYNC__WEIM_DATA_25 0x006C 0x03B4 0x0000 0x6 0x0
229#define MX6SX_PAD_CSI_HSYNC__SAI1_TX_DATA_0 0x006C 0x03B4 0x0000 0x7 0x0
230#define MX6SX_PAD_CSI_HSYNC__VADC_DATA_2 0x006C 0x03B4 0x0000 0x8 0x0
231#define MX6SX_PAD_CSI_HSYNC__MMDC_DEBUG_35 0x006C 0x03B4 0x0000 0x9 0x0
232#define MX6SX_PAD_CSI_MCLK__CSI1_MCLK 0x0070 0x03B8 0x0000 0x0 0x0
233#define MX6SX_PAD_CSI_MCLK__ESAI_TX_HF_CLK 0x0070 0x03B8 0x0784 0x1 0x1
234#define MX6SX_PAD_CSI_MCLK__OSC32K_32K_OUT 0x0070 0x03B8 0x0000 0x2 0x0
235#define MX6SX_PAD_CSI_MCLK__UART4_RX 0x0070 0x03B8 0x0848 0x3 0x2
236#define MX6SX_PAD_CSI_MCLK__UART4_TX 0x0070 0x03B8 0x0000 0x3 0x0
237#define MX6SX_PAD_CSI_MCLK__ANATOP_32K_OUT 0x0070 0x03B8 0x0000 0x4 0x0
238#define MX6SX_PAD_CSI_MCLK__GPIO1_IO_23 0x0070 0x03B8 0x0000 0x5 0x0
239#define MX6SX_PAD_CSI_MCLK__WEIM_DATA_26 0x0070 0x03B8 0x0000 0x6 0x0
240#define MX6SX_PAD_CSI_MCLK__CSI1_FIELD 0x0070 0x03B8 0x070C 0x7 0x0
241#define MX6SX_PAD_CSI_MCLK__VADC_DATA_1 0x0070 0x03B8 0x0000 0x8 0x0
242#define MX6SX_PAD_CSI_MCLK__MMDC_DEBUG_34 0x0070 0x03B8 0x0000 0x9 0x0
243#define MX6SX_PAD_CSI_PIXCLK__CSI1_PIXCLK 0x0074 0x03BC 0x0704 0x0 0x0
244#define MX6SX_PAD_CSI_PIXCLK__ESAI_RX_HF_CLK 0x0074 0x03BC 0x0780 0x1 0x1
245#define MX6SX_PAD_CSI_PIXCLK__AUDMUX_MCLK 0x0074 0x03BC 0x0000 0x2 0x0
246#define MX6SX_PAD_CSI_PIXCLK__UART4_RX 0x0074 0x03BC 0x0848 0x3 0x3
247#define MX6SX_PAD_CSI_PIXCLK__UART4_TX 0x0074 0x03BC 0x0000 0x3 0x0
248#define MX6SX_PAD_CSI_PIXCLK__ANATOP_24M_OUT 0x0074 0x03BC 0x0000 0x4 0x0
249#define MX6SX_PAD_CSI_PIXCLK__GPIO1_IO_24 0x0074 0x03BC 0x0000 0x5 0x0
250#define MX6SX_PAD_CSI_PIXCLK__WEIM_DATA_27 0x0074 0x03BC 0x0000 0x6 0x0
251#define MX6SX_PAD_CSI_PIXCLK__ESAI_TX_HF_CLK 0x0074 0x03BC 0x0784 0x7 0x2
252#define MX6SX_PAD_CSI_PIXCLK__VADC_CLK 0x0074 0x03BC 0x0000 0x8 0x0
253#define MX6SX_PAD_CSI_PIXCLK__MMDC_DEBUG_33 0x0074 0x03BC 0x0000 0x9 0x0
254#define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0
255#define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1
256#define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1
257#define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0844 0x3 0x3
258#define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0
259#define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0
260#define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0
261#define MX6SX_PAD_CSI_VSYNC__SAI1_RX_DATA_0 0x0078 0x03C0 0x07F8 0x7 0x0
262#define MX6SX_PAD_CSI_VSYNC__VADC_DATA_3 0x0078 0x03C0 0x0000 0x8 0x0
263#define MX6SX_PAD_CSI_VSYNC__MMDC_DEBUG_36 0x0078 0x03C0 0x0000 0x9 0x0
264#define MX6SX_PAD_ENET1_COL__ENET1_COL 0x007C 0x03C4 0x0000 0x0 0x0
265#define MX6SX_PAD_ENET1_COL__ENET2_MDC 0x007C 0x03C4 0x0000 0x1 0x0
266#define MX6SX_PAD_ENET1_COL__AUDMUX_AUD4_TXC 0x007C 0x03C4 0x0654 0x2 0x1
267#define MX6SX_PAD_ENET1_COL__UART1_RI_B 0x007C 0x03C4 0x0000 0x3 0x0
268#define MX6SX_PAD_ENET1_COL__SPDIF_EXT_CLK 0x007C 0x03C4 0x0828 0x4 0x1
269#define MX6SX_PAD_ENET1_COL__GPIO2_IO_0 0x007C 0x03C4 0x0000 0x5 0x0
270#define MX6SX_PAD_ENET1_COL__CSI2_DATA_23 0x007C 0x03C4 0x0000 0x6 0x0
271#define MX6SX_PAD_ENET1_COL__LCDIF2_DATA_16 0x007C 0x03C4 0x0000 0x7 0x0
272#define MX6SX_PAD_ENET1_COL__VDEC_DEBUG_37 0x007C 0x03C4 0x0000 0x8 0x0
273#define MX6SX_PAD_ENET1_COL__PCIE_CTRL_DEBUG_31 0x007C 0x03C4 0x0000 0x9 0x0
274#define MX6SX_PAD_ENET1_CRS__ENET1_CRS 0x0080 0x03C8 0x0000 0x0 0x0
275#define MX6SX_PAD_ENET1_CRS__ENET2_MDIO 0x0080 0x03C8 0x0770 0x1 0x1
276#define MX6SX_PAD_ENET1_CRS__AUDMUX_AUD4_TXD 0x0080 0x03C8 0x0648 0x2 0x1
277#define MX6SX_PAD_ENET1_CRS__UART1_DCD_B 0x0080 0x03C8 0x0000 0x3 0x0
278#define MX6SX_PAD_ENET1_CRS__SPDIF_LOCK 0x0080 0x03C8 0x0000 0x4 0x0
279#define MX6SX_PAD_ENET1_CRS__GPIO2_IO_1 0x0080 0x03C8 0x0000 0x5 0x0
280#define MX6SX_PAD_ENET1_CRS__CSI2_DATA_22 0x0080 0x03C8 0x0000 0x6 0x0
281#define MX6SX_PAD_ENET1_CRS__LCDIF2_DATA_17 0x0080 0x03C8 0x0000 0x7 0x0
282#define MX6SX_PAD_ENET1_CRS__VDEC_DEBUG_36 0x0080 0x03C8 0x0000 0x8 0x0
283#define MX6SX_PAD_ENET1_CRS__PCIE_CTRL_DEBUG_30 0x0080 0x03C8 0x0000 0x9 0x0
284#define MX6SX_PAD_ENET1_MDC__ENET1_MDC 0x0084 0x03CC 0x0000 0x0 0x0
285#define MX6SX_PAD_ENET1_MDC__ENET2_MDC 0x0084 0x03CC 0x0000 0x1 0x0
286#define MX6SX_PAD_ENET1_MDC__AUDMUX_AUD3_RXFS 0x0084 0x03CC 0x0638 0x2 0x1
287#define MX6SX_PAD_ENET1_MDC__ANATOP_24M_OUT 0x0084 0x03CC 0x0000 0x3 0x0
288#define MX6SX_PAD_ENET1_MDC__EPIT2_OUT 0x0084 0x03CC 0x0000 0x4 0x0
289#define MX6SX_PAD_ENET1_MDC__GPIO2_IO_2 0x0084 0x03CC 0x0000 0x5 0x0
290#define MX6SX_PAD_ENET1_MDC__USB_OTG1_PWR 0x0084 0x03CC 0x0000 0x6 0x0
291#define MX6SX_PAD_ENET1_MDC__PWM7_OUT 0x0084 0x03CC 0x0000 0x7 0x0
292#define MX6SX_PAD_ENET1_MDIO__ENET1_MDIO 0x0088 0x03D0 0x0764 0x0 0x1
293#define MX6SX_PAD_ENET1_MDIO__ENET2_MDIO 0x0088 0x03D0 0x0770 0x1 0x2
294#define MX6SX_PAD_ENET1_MDIO__AUDMUX_MCLK 0x0088 0x03D0 0x0000 0x2 0x0
295#define MX6SX_PAD_ENET1_MDIO__OSC32K_32K_OUT 0x0088 0x03D0 0x0000 0x3 0x0
296#define MX6SX_PAD_ENET1_MDIO__EPIT1_OUT 0x0088 0x03D0 0x0000 0x4 0x0
297#define MX6SX_PAD_ENET1_MDIO__GPIO2_IO_3 0x0088 0x03D0 0x0000 0x5 0x0
298#define MX6SX_PAD_ENET1_MDIO__USB_OTG1_OC 0x0088 0x03D0 0x0860 0x6 0x1
299#define MX6SX_PAD_ENET1_MDIO__PWM8_OUT 0x0088 0x03D0 0x0000 0x7 0x0
300#define MX6SX_PAD_ENET1_RX_CLK__ENET1_RX_CLK 0x008C 0x03D4 0x0768 0x0 0x0
301#define MX6SX_PAD_ENET1_RX_CLK__ENET1_REF_CLK_25M 0x008C 0x03D4 0x0000 0x1 0x0
302#define MX6SX_PAD_ENET1_RX_CLK__AUDMUX_AUD4_TXFS 0x008C 0x03D4 0x0658 0x2 0x1
303#define MX6SX_PAD_ENET1_RX_CLK__UART1_DSR_B 0x008C 0x03D4 0x0000 0x3 0x0
304#define MX6SX_PAD_ENET1_RX_CLK__SPDIF_OUT 0x008C 0x03D4 0x0000 0x4 0x0
305#define MX6SX_PAD_ENET1_RX_CLK__GPIO2_IO_4 0x008C 0x03D4 0x0000 0x5 0x0
306#define MX6SX_PAD_ENET1_RX_CLK__CSI2_DATA_21 0x008C 0x03D4 0x0000 0x6 0x0
307#define MX6SX_PAD_ENET1_RX_CLK__LCDIF2_DATA_18 0x008C 0x03D4 0x0000 0x7 0x0
308#define MX6SX_PAD_ENET1_RX_CLK__VDEC_DEBUG_35 0x008C 0x03D4 0x0000 0x8 0x0
309#define MX6SX_PAD_ENET1_RX_CLK__PCIE_CTRL_DEBUG_29 0x008C 0x03D4 0x0000 0x9 0x0
310#define MX6SX_PAD_ENET1_TX_CLK__ENET1_TX_CLK 0x0090 0x03D8 0x0000 0x0 0x0
311#define MX6SX_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 0x0090 0x03D8 0x0760 0x1 0x1
312#define MX6SX_PAD_ENET1_TX_CLK__AUDMUX_AUD4_RXD 0x0090 0x03D8 0x0644 0x2 0x1
313#define MX6SX_PAD_ENET1_TX_CLK__UART1_DTR_B 0x0090 0x03D8 0x0000 0x3 0x0
314#define MX6SX_PAD_ENET1_TX_CLK__SPDIF_SR_CLK 0x0090 0x03D8 0x0000 0x4 0x0
315#define MX6SX_PAD_ENET1_TX_CLK__GPIO2_IO_5 0x0090 0x03D8 0x0000 0x5 0x0
316#define MX6SX_PAD_ENET1_TX_CLK__CSI2_DATA_20 0x0090 0x03D8 0x0000 0x6 0x0
317#define MX6SX_PAD_ENET1_TX_CLK__LCDIF2_DATA_19 0x0090 0x03D8 0x0000 0x7 0x0
318#define MX6SX_PAD_ENET1_TX_CLK__VDEC_DEBUG_34 0x0090 0x03D8 0x0000 0x8 0x0
319#define MX6SX_PAD_ENET1_TX_CLK__PCIE_CTRL_DEBUG_28 0x0090 0x03D8 0x0000 0x9 0x0
320#define MX6SX_PAD_ENET2_COL__ENET2_COL 0x0094 0x03DC 0x0000 0x0 0x0
321#define MX6SX_PAD_ENET2_COL__ENET1_MDC 0x0094 0x03DC 0x0000 0x1 0x0
322#define MX6SX_PAD_ENET2_COL__AUDMUX_AUD4_RXC 0x0094 0x03DC 0x064C 0x2 0x1
323#define MX6SX_PAD_ENET2_COL__UART1_RX 0x0094 0x03DC 0x0830 0x3 0x2
324#define MX6SX_PAD_ENET2_COL__UART1_TX 0x0094 0x03DC 0x0000 0x3 0x0
325#define MX6SX_PAD_ENET2_COL__SPDIF_IN 0x0094 0x03DC 0x0824 0x4 0x3
326#define MX6SX_PAD_ENET2_COL__GPIO2_IO_6 0x0094 0x03DC 0x0000 0x5 0x0
327#define MX6SX_PAD_ENET2_COL__ANATOP_OTG1_ID 0x0094 0x03DC 0x0624 0x6 0x1
328#define MX6SX_PAD_ENET2_COL__LCDIF2_DATA_20 0x0094 0x03DC 0x0000 0x7 0x0
329#define MX6SX_PAD_ENET2_COL__VDEC_DEBUG_33 0x0094 0x03DC 0x0000 0x8 0x0
330#define MX6SX_PAD_ENET2_COL__PCIE_CTRL_DEBUG_27 0x0094 0x03DC 0x0000 0x9 0x0
331#define MX6SX_PAD_ENET2_CRS__ENET2_CRS 0x0098 0x03E0 0x0000 0x0 0x0
332#define MX6SX_PAD_ENET2_CRS__ENET1_MDIO 0x0098 0x03E0 0x0764 0x1 0x2
333#define MX6SX_PAD_ENET2_CRS__AUDMUX_AUD4_RXFS 0x0098 0x03E0 0x0650 0x2 0x1
334#define MX6SX_PAD_ENET2_CRS__UART1_RX 0x0098 0x03E0 0x0830 0x3 0x3
335#define MX6SX_PAD_ENET2_CRS__UART1_TX 0x0098 0x03E0 0x0000 0x3 0x0
336#define MX6SX_PAD_ENET2_CRS__MLB_SIG 0x0098 0x03E0 0x07F0 0x4 0x1
337#define MX6SX_PAD_ENET2_CRS__GPIO2_IO_7 0x0098 0x03E0 0x0000 0x5 0x0
338#define MX6SX_PAD_ENET2_CRS__ANATOP_OTG2_ID 0x0098 0x03E0 0x0628 0x6 0x1
339#define MX6SX_PAD_ENET2_CRS__LCDIF2_DATA_21 0x0098 0x03E0 0x0000 0x7 0x0
340#define MX6SX_PAD_ENET2_CRS__VDEC_DEBUG_32 0x0098 0x03E0 0x0000 0x8 0x0
341#define MX6SX_PAD_ENET2_CRS__PCIE_CTRL_DEBUG_26 0x0098 0x03E0 0x0000 0x9 0x0
342#define MX6SX_PAD_ENET2_RX_CLK__ENET2_RX_CLK 0x009C 0x03E4 0x0774 0x0 0x0
343#define MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M 0x009C 0x03E4 0x0000 0x1 0x0
344#define MX6SX_PAD_ENET2_RX_CLK__I2C3_SCL 0x009C 0x03E4 0x07B8 0x2 0x1
345#define MX6SX_PAD_ENET2_RX_CLK__UART1_RTS_B 0x009C 0x03E4 0x082C 0x3 0x2
346#define MX6SX_PAD_ENET2_RX_CLK__MLB_DATA 0x009C 0x03E4 0x07EC 0x4 0x1
347#define MX6SX_PAD_ENET2_RX_CLK__GPIO2_IO_8 0x009C 0x03E4 0x0000 0x5 0x0
348#define MX6SX_PAD_ENET2_RX_CLK__USB_OTG2_OC 0x009C 0x03E4 0x085C 0x6 0x1
349#define MX6SX_PAD_ENET2_RX_CLK__LCDIF2_DATA_22 0x009C 0x03E4 0x0000 0x7 0x0
350#define MX6SX_PAD_ENET2_RX_CLK__VDEC_DEBUG_31 0x009C 0x03E4 0x0000 0x8 0x0
351#define MX6SX_PAD_ENET2_RX_CLK__PCIE_CTRL_DEBUG_25 0x009C 0x03E4 0x0000 0x9 0x0
352#define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0
353#define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1
354#define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1
355#define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x082C 0x3 0x3
356#define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1
357#define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0
358#define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0
359#define MX6SX_PAD_ENET2_TX_CLK__LCDIF2_DATA_23 0x00A0 0x03E8 0x0000 0x7 0x0
360#define MX6SX_PAD_ENET2_TX_CLK__VDEC_DEBUG_30 0x00A0 0x03E8 0x0000 0x8 0x0
361#define MX6SX_PAD_ENET2_TX_CLK__PCIE_CTRL_DEBUG_24 0x00A0 0x03E8 0x0000 0x9 0x0
362#define MX6SX_PAD_KEY_COL0__KPP_COL_0 0x00A4 0x03EC 0x0000 0x0 0x0
363#define MX6SX_PAD_KEY_COL0__USDHC3_CD_B 0x00A4 0x03EC 0x0000 0x1 0x0
364#define MX6SX_PAD_KEY_COL0__UART6_RTS_B 0x00A4 0x03EC 0x0854 0x2 0x2
365#define MX6SX_PAD_KEY_COL0__ECSPI1_SCLK 0x00A4 0x03EC 0x0710 0x3 0x0
366#define MX6SX_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x00A4 0x03EC 0x066C 0x4 0x0
367#define MX6SX_PAD_KEY_COL0__GPIO2_IO_10 0x00A4 0x03EC 0x0000 0x5 0x0
368#define MX6SX_PAD_KEY_COL0__SDMA_EXT_EVENT_1 0x00A4 0x03EC 0x0820 0x6 0x1
369#define MX6SX_PAD_KEY_COL0__SAI2_TX_BCLK 0x00A4 0x03EC 0x0814 0x7 0x0
370#define MX6SX_PAD_KEY_COL0__VADC_DATA_0 0x00A4 0x03EC 0x0000 0x8 0x0
371#define MX6SX_PAD_KEY_COL1__KPP_COL_1 0x00A8 0x03F0 0x0000 0x0 0x0
372#define MX6SX_PAD_KEY_COL1__USDHC3_RESET_B 0x00A8 0x03F0 0x0000 0x1 0x0
373#define MX6SX_PAD_KEY_COL1__UART6_RX 0x00A8 0x03F0 0x0858 0x2 0x2
374#define MX6SX_PAD_KEY_COL1__UART6_TX 0x00A8 0x03F0 0x0000 0x2 0x0
375#define MX6SX_PAD_KEY_COL1__ECSPI1_MISO 0x00A8 0x03F0 0x0714 0x3 0x0
376#define MX6SX_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x00A8 0x03F0 0x0670 0x4 0x0
377#define MX6SX_PAD_KEY_COL1__GPIO2_IO_11 0x00A8 0x03F0 0x0000 0x5 0x0
378#define MX6SX_PAD_KEY_COL1__USDHC3_RESET 0x00A8 0x03F0 0x0000 0x6 0x0
379#define MX6SX_PAD_KEY_COL1__SAI2_TX_SYNC 0x00A8 0x03F0 0x0818 0x7 0x0
380#define MX6SX_PAD_KEY_COL2__KPP_COL_2 0x00AC 0x03F4 0x0000 0x0 0x0
381#define MX6SX_PAD_KEY_COL2__USDHC4_CD_B 0x00AC 0x03F4 0x0874 0x1 0x1
382#define MX6SX_PAD_KEY_COL2__UART5_RTS_B 0x00AC 0x03F4 0x084C 0x2 0x2
383#define MX6SX_PAD_KEY_COL2__CAN1_TX 0x00AC 0x03F4 0x0000 0x3 0x0
384#define MX6SX_PAD_KEY_COL2__CANFD_TX1 0x00AC 0x03F4 0x0000 0x4 0x0
385#define MX6SX_PAD_KEY_COL2__GPIO2_IO_12 0x00AC 0x03F4 0x0000 0x5 0x0
386#define MX6SX_PAD_KEY_COL2__WEIM_DATA_30 0x00AC 0x03F4 0x0000 0x6 0x0
387#define MX6SX_PAD_KEY_COL2__ECSPI1_RDY 0x00AC 0x03F4 0x0000 0x7 0x0
388#define MX6SX_PAD_KEY_COL3__KPP_COL_3 0x00B0 0x03F8 0x0000 0x0 0x0
389#define MX6SX_PAD_KEY_COL3__USDHC4_LCTL 0x00B0 0x03F8 0x0000 0x1 0x0
390#define MX6SX_PAD_KEY_COL3__UART5_RX 0x00B0 0x03F8 0x0850 0x2 0x2
391#define MX6SX_PAD_KEY_COL3__UART5_TX 0x00B0 0x03F8 0x0000 0x2 0x0
392#define MX6SX_PAD_KEY_COL3__CAN2_TX 0x00B0 0x03F8 0x0000 0x3 0x0
393#define MX6SX_PAD_KEY_COL3__CANFD_TX2 0x00B0 0x03F8 0x0000 0x4 0x0
394#define MX6SX_PAD_KEY_COL3__GPIO2_IO_13 0x00B0 0x03F8 0x0000 0x5 0x0
395#define MX6SX_PAD_KEY_COL3__WEIM_DATA_28 0x00B0 0x03F8 0x0000 0x6 0x0
396#define MX6SX_PAD_KEY_COL3__ECSPI1_SS2 0x00B0 0x03F8 0x0000 0x7 0x0
397#define MX6SX_PAD_KEY_COL4__KPP_COL_4 0x00B4 0x03FC 0x0000 0x0 0x0
398#define MX6SX_PAD_KEY_COL4__ENET2_MDC 0x00B4 0x03FC 0x0000 0x1 0x0
399#define MX6SX_PAD_KEY_COL4__I2C3_SCL 0x00B4 0x03FC 0x07B8 0x2 0x2
400#define MX6SX_PAD_KEY_COL4__USDHC2_LCTL 0x00B4 0x03FC 0x0000 0x3 0x0
401#define MX6SX_PAD_KEY_COL4__AUDMUX_AUD5_RXC 0x00B4 0x03FC 0x0664 0x4 0x0
402#define MX6SX_PAD_KEY_COL4__GPIO2_IO_14 0x00B4 0x03FC 0x0000 0x5 0x0
403#define MX6SX_PAD_KEY_COL4__WEIM_CRE 0x00B4 0x03FC 0x0000 0x6 0x0
404#define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0
405#define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0
406#define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0
407#define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0854 0x2 0x3
408#define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0
409#define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0
410#define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0
411#define MX6SX_PAD_KEY_ROW0__SDMA_EXT_EVENT_0 0x00B8 0x0400 0x081C 0x6 0x1
412#define MX6SX_PAD_KEY_ROW0__SAI2_TX_DATA_0 0x00B8 0x0400 0x0000 0x7 0x0
413#define MX6SX_PAD_KEY_ROW0__GPU_IDLE 0x00B8 0x0400 0x0000 0x8 0x0
414#define MX6SX_PAD_KEY_ROW1__KPP_ROW_1 0x00BC 0x0404 0x0000 0x0 0x0
415#define MX6SX_PAD_KEY_ROW1__USDHC4_VSELECT 0x00BC 0x0404 0x0000 0x1 0x0
416#define MX6SX_PAD_KEY_ROW1__UART6_RX 0x00BC 0x0404 0x0858 0x2 0x3
417#define MX6SX_PAD_KEY_ROW1__UART6_TX 0x00BC 0x0404 0x0000 0x2 0x0
418#define MX6SX_PAD_KEY_ROW1__ECSPI1_SS0 0x00BC 0x0404 0x071C 0x3 0x0
419#define MX6SX_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x00BC 0x0404 0x065C 0x4 0x0
420#define MX6SX_PAD_KEY_ROW1__GPIO2_IO_16 0x00BC 0x0404 0x0000 0x5 0x0
421#define MX6SX_PAD_KEY_ROW1__WEIM_DATA_31 0x00BC 0x0404 0x0000 0x6 0x0
422#define MX6SX_PAD_KEY_ROW1__SAI2_RX_DATA_0 0x00BC 0x0404 0x080C 0x7 0x0
423#define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0
424#define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0
425#define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1
426#define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x084C 0x2 0x3
427#define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1
428#define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1
429#define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0
430#define MX6SX_PAD_KEY_ROW2__WEIM_DATA_29 0x00C0 0x0408 0x0000 0x6 0x0
431#define MX6SX_PAD_KEY_ROW2__ECSPI1_SS3 0x00C0 0x0408 0x0000 0x7 0x0
432#define MX6SX_PAD_KEY_ROW3__KPP_ROW_3 0x00C4 0x040C 0x0000 0x0 0x0
433#define MX6SX_PAD_KEY_ROW3__USDHC3_LCTL 0x00C4 0x040C 0x0000 0x1 0x0
434#define MX6SX_PAD_KEY_ROW3__UART5_RX 0x00C4 0x040C 0x0850 0x2 0x3
435#define MX6SX_PAD_KEY_ROW3__UART5_TX 0x00C4 0x040C 0x0000 0x2 0x0
436#define MX6SX_PAD_KEY_ROW3__CAN2_RX 0x00C4 0x040C 0x0690 0x3 0x1
437#define MX6SX_PAD_KEY_ROW3__CANFD_RX2 0x00C4 0x040C 0x0698 0x4 0x1
438#define MX6SX_PAD_KEY_ROW3__GPIO2_IO_18 0x00C4 0x040C 0x0000 0x5 0x0
439#define MX6SX_PAD_KEY_ROW3__WEIM_DTACK_B 0x00C4 0x040C 0x0000 0x6 0x0
440#define MX6SX_PAD_KEY_ROW3__ECSPI1_SS1 0x00C4 0x040C 0x0000 0x7 0x0
441#define MX6SX_PAD_KEY_ROW4__KPP_ROW_4 0x00C8 0x0410 0x0000 0x0 0x0
442#define MX6SX_PAD_KEY_ROW4__ENET2_MDIO 0x00C8 0x0410 0x0770 0x1 0x3
443#define MX6SX_PAD_KEY_ROW4__I2C3_SDA 0x00C8 0x0410 0x07BC 0x2 0x2
444#define MX6SX_PAD_KEY_ROW4__USDHC1_LCTL 0x00C8 0x0410 0x0000 0x3 0x0
445#define MX6SX_PAD_KEY_ROW4__AUDMUX_AUD5_RXFS 0x00C8 0x0410 0x0668 0x4 0x0
446#define MX6SX_PAD_KEY_ROW4__GPIO2_IO_19 0x00C8 0x0410 0x0000 0x5 0x0
447#define MX6SX_PAD_KEY_ROW4__WEIM_ACLK_FREERUN 0x00C8 0x0410 0x0000 0x6 0x0
448#define MX6SX_PAD_KEY_ROW4__SAI2_RX_SYNC 0x00C8 0x0410 0x0810 0x7 0x0
449#define MX6SX_PAD_LCD1_CLK__LCDIF1_CLK 0x00CC 0x0414 0x0000 0x0 0x0
450#define MX6SX_PAD_LCD1_CLK__LCDIF1_WR_RWN 0x00CC 0x0414 0x0000 0x1 0x0
451#define MX6SX_PAD_LCD1_CLK__AUDMUX_AUD3_RXC 0x00CC 0x0414 0x0634 0x2 0x1
452#define MX6SX_PAD_LCD1_CLK__ENET1_1588_EVENT2_IN 0x00CC 0x0414 0x0000 0x3 0x0
453#define MX6SX_PAD_LCD1_CLK__CSI1_DATA_16 0x00CC 0x0414 0x06DC 0x4 0x0
454#define MX6SX_PAD_LCD1_CLK__GPIO3_IO_0 0x00CC 0x0414 0x0000 0x5 0x0
455#define MX6SX_PAD_LCD1_CLK__USDHC1_WP 0x00CC 0x0414 0x0868 0x6 0x0
456#define MX6SX_PAD_LCD1_CLK__SIM_M_HADDR_16 0x00CC 0x0414 0x0000 0x7 0x0
457#define MX6SX_PAD_LCD1_CLK__VADC_TEST_0 0x00CC 0x0414 0x0000 0x8 0x0
458#define MX6SX_PAD_LCD1_CLK__MMDC_DEBUG_0 0x00CC 0x0414 0x0000 0x9 0x0
459#define MX6SX_PAD_LCD1_DATA00__LCDIF1_DATA_0 0x00D0 0x0418 0x0000 0x0 0x0
460#define MX6SX_PAD_LCD1_DATA00__WEIM_CS1_B 0x00D0 0x0418 0x0000 0x1 0x0
461#define MX6SX_PAD_LCD1_DATA00__M4_TRACE_0 0x00D0 0x0418 0x0000 0x2 0x0
462#define MX6SX_PAD_LCD1_DATA00__KITTEN_TRACE_0 0x00D0 0x0418 0x0000 0x3 0x0
463#define MX6SX_PAD_LCD1_DATA00__CSI1_DATA_20 0x00D0 0x0418 0x06EC 0x4 0x0
464#define MX6SX_PAD_LCD1_DATA00__GPIO3_IO_1 0x00D0 0x0418 0x0000 0x5 0x0
465#define MX6SX_PAD_LCD1_DATA00__SRC_BT_CFG_0 0x00D0 0x0418 0x0000 0x6 0x0
466#define MX6SX_PAD_LCD1_DATA00__SIM_M_HADDR_21 0x00D0 0x0418 0x0000 0x7 0x0
467#define MX6SX_PAD_LCD1_DATA00__VADC_TEST_5 0x00D0 0x0418 0x0000 0x8 0x0
468#define MX6SX_PAD_LCD1_DATA00__MMDC_DEBUG_5 0x00D0 0x0418 0x0000 0x9 0x0
469#define MX6SX_PAD_LCD1_DATA01__LCDIF1_DATA_1 0x00D4 0x041C 0x0000 0x0 0x0
470#define MX6SX_PAD_LCD1_DATA01__WEIM_CS2_B 0x00D4 0x041C 0x0000 0x1 0x0
471#define MX6SX_PAD_LCD1_DATA01__M4_TRACE_1 0x00D4 0x041C 0x0000 0x2 0x0
472#define MX6SX_PAD_LCD1_DATA01__KITTEN_TRACE_1 0x00D4 0x041C 0x0000 0x3 0x0
473#define MX6SX_PAD_LCD1_DATA01__CSI1_DATA_21 0x00D4 0x041C 0x06F0 0x4 0x0
474#define MX6SX_PAD_LCD1_DATA01__GPIO3_IO_2 0x00D4 0x041C 0x0000 0x5 0x0
475#define MX6SX_PAD_LCD1_DATA01__SRC_BT_CFG_1 0x00D4 0x041C 0x0000 0x6 0x0
476#define MX6SX_PAD_LCD1_DATA01__SIM_M_HADDR_22 0x00D4 0x041C 0x0000 0x7 0x0
477#define MX6SX_PAD_LCD1_DATA01__VADC_TEST_6 0x00D4 0x041C 0x0000 0x8 0x0
478#define MX6SX_PAD_LCD1_DATA01__MMDC_DEBUG_6 0x00D4 0x041C 0x0000 0x9 0x0
479#define MX6SX_PAD_LCD1_DATA02__LCDIF1_DATA_2 0x00D8 0x0420 0x0000 0x0 0x0
480#define MX6SX_PAD_LCD1_DATA02__WEIM_CS3_B 0x00D8 0x0420 0x0000 0x1 0x0
481#define MX6SX_PAD_LCD1_DATA02__M4_TRACE_2 0x00D8 0x0420 0x0000 0x2 0x0
482#define MX6SX_PAD_LCD1_DATA02__KITTEN_TRACE_2 0x00D8 0x0420 0x0000 0x3 0x0
483#define MX6SX_PAD_LCD1_DATA02__CSI1_DATA_22 0x00D8 0x0420 0x06F4 0x4 0x0
484#define MX6SX_PAD_LCD1_DATA02__GPIO3_IO_3 0x00D8 0x0420 0x0000 0x5 0x0
485#define MX6SX_PAD_LCD1_DATA02__SRC_BT_CFG_2 0x00D8 0x0420 0x0000 0x6 0x0
486#define MX6SX_PAD_LCD1_DATA02__SIM_M_HADDR_23 0x00D8 0x0420 0x0000 0x7 0x0
487#define MX6SX_PAD_LCD1_DATA02__VADC_TEST_7 0x00D8 0x0420 0x0000 0x8 0x0
488#define MX6SX_PAD_LCD1_DATA02__MMDC_DEBUG_7 0x00D8 0x0420 0x0000 0x9 0x0
489#define MX6SX_PAD_LCD1_DATA03__LCDIF1_DATA_3 0x00DC 0x0424 0x0000 0x0 0x0
490#define MX6SX_PAD_LCD1_DATA03__WEIM_ADDR_24 0x00DC 0x0424 0x0000 0x1 0x0
491#define MX6SX_PAD_LCD1_DATA03__M4_TRACE_3 0x00DC 0x0424 0x0000 0x2 0x0
492#define MX6SX_PAD_LCD1_DATA03__KITTEN_TRACE_3 0x00DC 0x0424 0x0000 0x3 0x0
493#define MX6SX_PAD_LCD1_DATA03__CSI1_DATA_23 0x00DC 0x0424 0x06F8 0x4 0x0
494#define MX6SX_PAD_LCD1_DATA03__GPIO3_IO_4 0x00DC 0x0424 0x0000 0x5 0x0
495#define MX6SX_PAD_LCD1_DATA03__SRC_BT_CFG_3 0x00DC 0x0424 0x0000 0x6 0x0
496#define MX6SX_PAD_LCD1_DATA03__SIM_M_HADDR_24 0x00DC 0x0424 0x0000 0x7 0x0
497#define MX6SX_PAD_LCD1_DATA03__VADC_TEST_8 0x00DC 0x0424 0x0000 0x8 0x0
498#define MX6SX_PAD_LCD1_DATA03__MMDC_DEBUG_8 0x00DC 0x0424 0x0000 0x9 0x0
499#define MX6SX_PAD_LCD1_DATA04__LCDIF1_DATA_4 0x00E0 0x0428 0x0000 0x0 0x0
500#define MX6SX_PAD_LCD1_DATA04__WEIM_ADDR_25 0x00E0 0x0428 0x0000 0x1 0x0
501#define MX6SX_PAD_LCD1_DATA04__KITTEN_TRACE_4 0x00E0 0x0428 0x0000 0x3 0x0
502#define MX6SX_PAD_LCD1_DATA04__CSI1_VSYNC 0x00E0 0x0428 0x0708 0x4 0x1
503#define MX6SX_PAD_LCD1_DATA04__GPIO3_IO_5 0x00E0 0x0428 0x0000 0x5 0x0
504#define MX6SX_PAD_LCD1_DATA04__SRC_BT_CFG_4 0x00E0 0x0428 0x0000 0x6 0x0
505#define MX6SX_PAD_LCD1_DATA04__SIM_M_HADDR_25 0x00E0 0x0428 0x0000 0x7 0x0
506#define MX6SX_PAD_LCD1_DATA04__VADC_TEST_9 0x00E0 0x0428 0x0000 0x8 0x0
507#define MX6SX_PAD_LCD1_DATA04__MMDC_DEBUG_9 0x00E0 0x0428 0x0000 0x9 0x0
508#define MX6SX_PAD_LCD1_DATA05__LCDIF1_DATA_5 0x00E4 0x042C 0x0000 0x0 0x0
509#define MX6SX_PAD_LCD1_DATA05__WEIM_ADDR_26 0x00E4 0x042C 0x0000 0x1 0x0
510#define MX6SX_PAD_LCD1_DATA05__KITTEN_TRACE_5 0x00E4 0x042C 0x0000 0x3 0x0
511#define MX6SX_PAD_LCD1_DATA05__CSI1_HSYNC 0x00E4 0x042C 0x0700 0x4 0x1
512#define MX6SX_PAD_LCD1_DATA05__GPIO3_IO_6 0x00E4 0x042C 0x0000 0x5 0x0
513#define MX6SX_PAD_LCD1_DATA05__SRC_BT_CFG_5 0x00E4 0x042C 0x0000 0x6 0x0
514#define MX6SX_PAD_LCD1_DATA05__SIM_M_HADDR_26 0x00E4 0x042C 0x0000 0x7 0x0
515#define MX6SX_PAD_LCD1_DATA05__VADC_TEST_10 0x00E4 0x042C 0x0000 0x8 0x0
516#define MX6SX_PAD_LCD1_DATA05__MMDC_DEBUG_10 0x00E4 0x042C 0x0000 0x9 0x0
517#define MX6SX_PAD_LCD1_DATA06__LCDIF1_DATA_6 0x00E8 0x0430 0x0000 0x0 0x0
518#define MX6SX_PAD_LCD1_DATA06__WEIM_EB_B_2 0x00E8 0x0430 0x0000 0x1 0x0
519#define MX6SX_PAD_LCD1_DATA06__KITTEN_TRACE_6 0x00E8 0x0430 0x0000 0x3 0x0
520#define MX6SX_PAD_LCD1_DATA06__CSI1_PIXCLK 0x00E8 0x0430 0x0704 0x4 0x1
521#define MX6SX_PAD_LCD1_DATA06__GPIO3_IO_7 0x00E8 0x0430 0x0000 0x5 0x0
522#define MX6SX_PAD_LCD1_DATA06__SRC_BT_CFG_6 0x00E8 0x0430 0x0000 0x6 0x0
523#define MX6SX_PAD_LCD1_DATA06__SIM_M_HADDR_27 0x00E8 0x0430 0x0000 0x7 0x0
524#define MX6SX_PAD_LCD1_DATA06__VADC_TEST_11 0x00E8 0x0430 0x0000 0x8 0x0
525#define MX6SX_PAD_LCD1_DATA06__MMDC_DEBUG_11 0x00E8 0x0430 0x0000 0x9 0x0
526#define MX6SX_PAD_LCD1_DATA07__LCDIF1_DATA_7 0x00EC 0x0434 0x0000 0x0 0x0
527#define MX6SX_PAD_LCD1_DATA07__WEIM_EB_B_3 0x00EC 0x0434 0x0000 0x1 0x0
528#define MX6SX_PAD_LCD1_DATA07__KITTEN_TRACE_7 0x00EC 0x0434 0x0000 0x3 0x0
529#define MX6SX_PAD_LCD1_DATA07__CSI1_MCLK 0x00EC 0x0434 0x0000 0x4 0x0
530#define MX6SX_PAD_LCD1_DATA07__GPIO3_IO_8 0x00EC 0x0434 0x0000 0x5 0x0
531#define MX6SX_PAD_LCD1_DATA07__SRC_BT_CFG_7 0x00EC 0x0434 0x0000 0x6 0x0
532#define MX6SX_PAD_LCD1_DATA07__SIM_M_HADDR_28 0x00EC 0x0434 0x0000 0x7 0x0
533#define MX6SX_PAD_LCD1_DATA07__VADC_TEST_12 0x00EC 0x0434 0x0000 0x8 0x0
534#define MX6SX_PAD_LCD1_DATA07__MMDC_DEBUG_12 0x00EC 0x0434 0x0000 0x9 0x0
535#define MX6SX_PAD_LCD1_DATA08__LCDIF1_DATA_8 0x00F0 0x0438 0x0000 0x0 0x0
536#define MX6SX_PAD_LCD1_DATA08__WEIM_AD_8 0x00F0 0x0438 0x0000 0x1 0x0
537#define MX6SX_PAD_LCD1_DATA08__KITTEN_TRACE_8 0x00F0 0x0438 0x0000 0x3 0x0
538#define MX6SX_PAD_LCD1_DATA08__CSI1_DATA_9 0x00F0 0x0438 0x06C4 0x4 0x1
539#define MX6SX_PAD_LCD1_DATA08__GPIO3_IO_9 0x00F0 0x0438 0x0000 0x5 0x0
540#define MX6SX_PAD_LCD1_DATA08__SRC_BT_CFG_8 0x00F0 0x0438 0x0000 0x6 0x0
541#define MX6SX_PAD_LCD1_DATA08__SIM_M_HADDR_29 0x00F0 0x0438 0x0000 0x7 0x0
542#define MX6SX_PAD_LCD1_DATA08__VADC_TEST_13 0x00F0 0x0438 0x0000 0x8 0x0
543#define MX6SX_PAD_LCD1_DATA08__MMDC_DEBUG_13 0x00F0 0x0438 0x0000 0x9 0x0
544#define MX6SX_PAD_LCD1_DATA09__LCDIF1_DATA_9 0x00F4 0x043C 0x0000 0x0 0x0
545#define MX6SX_PAD_LCD1_DATA09__WEIM_AD_9 0x00F4 0x043C 0x0000 0x1 0x0
546#define MX6SX_PAD_LCD1_DATA09__KITTEN_TRACE_9 0x00F4 0x043C 0x0000 0x3 0x0
547#define MX6SX_PAD_LCD1_DATA09__CSI1_DATA_8 0x00F4 0x043C 0x06C0 0x4 0x1
548#define MX6SX_PAD_LCD1_DATA09__GPIO3_IO_10 0x00F4 0x043C 0x0000 0x5 0x0
549#define MX6SX_PAD_LCD1_DATA09__SRC_BT_CFG_9 0x00F4 0x043C 0x0000 0x6 0x0
550#define MX6SX_PAD_LCD1_DATA09__SIM_M_HADDR_30 0x00F4 0x043C 0x0000 0x7 0x0
551#define MX6SX_PAD_LCD1_DATA09__VADC_TEST_14 0x00F4 0x043C 0x0000 0x8 0x0
552#define MX6SX_PAD_LCD1_DATA09__MMDC_DEBUG_14 0x00F4 0x043C 0x0000 0x9 0x0
553#define MX6SX_PAD_LCD1_DATA10__LCDIF1_DATA_10 0x00F8 0x0440 0x0000 0x0 0x0
554#define MX6SX_PAD_LCD1_DATA10__WEIM_AD_10 0x00F8 0x0440 0x0000 0x1 0x0
555#define MX6SX_PAD_LCD1_DATA10__KITTEN_TRACE_10 0x00F8 0x0440 0x0000 0x3 0x0
556#define MX6SX_PAD_LCD1_DATA10__CSI1_DATA_7 0x00F8 0x0440 0x06BC 0x4 0x1
557#define MX6SX_PAD_LCD1_DATA10__GPIO3_IO_11 0x00F8 0x0440 0x0000 0x5 0x0
558#define MX6SX_PAD_LCD1_DATA10__SRC_BT_CFG_10 0x00F8 0x0440 0x0000 0x6 0x0
559#define MX6SX_PAD_LCD1_DATA10__SIM_M_HADDR_31 0x00F8 0x0440 0x0000 0x7 0x0
560#define MX6SX_PAD_LCD1_DATA10__VADC_TEST_15 0x00F8 0x0440 0x0000 0x8 0x0
561#define MX6SX_PAD_LCD1_DATA10__MMDC_DEBUG_15 0x00F8 0x0440 0x0000 0x9 0x0
562#define MX6SX_PAD_LCD1_DATA11__LCDIF1_DATA_11 0x00FC 0x0444 0x0000 0x0 0x0
563#define MX6SX_PAD_LCD1_DATA11__WEIM_AD_11 0x00FC 0x0444 0x0000 0x1 0x0
564#define MX6SX_PAD_LCD1_DATA11__KITTEN_TRACE_11 0x00FC 0x0444 0x0000 0x3 0x0
565#define MX6SX_PAD_LCD1_DATA11__CSI1_DATA_6 0x00FC 0x0444 0x06B8 0x4 0x1
566#define MX6SX_PAD_LCD1_DATA11__GPIO3_IO_12 0x00FC 0x0444 0x0000 0x5 0x0
567#define MX6SX_PAD_LCD1_DATA11__SRC_BT_CFG_11 0x00FC 0x0444 0x0000 0x6 0x0
568#define MX6SX_PAD_LCD1_DATA11__SIM_M_HBURST_0 0x00FC 0x0444 0x0000 0x7 0x0
569#define MX6SX_PAD_LCD1_DATA11__VADC_TEST_16 0x00FC 0x0444 0x0000 0x8 0x0
570#define MX6SX_PAD_LCD1_DATA11__MMDC_DEBUG_16 0x00FC 0x0444 0x0000 0x9 0x0
571#define MX6SX_PAD_LCD1_DATA12__LCDIF1_DATA_12 0x0100 0x0448 0x0000 0x0 0x0
572#define MX6SX_PAD_LCD1_DATA12__WEIM_AD_12 0x0100 0x0448 0x0000 0x1 0x0
573#define MX6SX_PAD_LCD1_DATA12__KITTEN_TRACE_12 0x0100 0x0448 0x0000 0x3 0x0
574#define MX6SX_PAD_LCD1_DATA12__CSI1_DATA_5 0x0100 0x0448 0x06B4 0x4 0x1
575#define MX6SX_PAD_LCD1_DATA12__GPIO3_IO_13 0x0100 0x0448 0x0000 0x5 0x0
576#define MX6SX_PAD_LCD1_DATA12__SRC_BT_CFG_12 0x0100 0x0448 0x0000 0x6 0x0
577#define MX6SX_PAD_LCD1_DATA12__SIM_M_HBURST_1 0x0100 0x0448 0x0000 0x7 0x0
578#define MX6SX_PAD_LCD1_DATA12__VADC_TEST_17 0x0100 0x0448 0x0000 0x8 0x0
579#define MX6SX_PAD_LCD1_DATA12__MMDC_DEBUG_17 0x0100 0x0448 0x0000 0x9 0x0
580#define MX6SX_PAD_LCD1_DATA13__LCDIF1_DATA_13 0x0104 0x044C 0x0000 0x0 0x0
581#define MX6SX_PAD_LCD1_DATA13__WEIM_AD_13 0x0104 0x044C 0x0000 0x1 0x0
582#define MX6SX_PAD_LCD1_DATA13__KITTEN_TRACE_13 0x0104 0x044C 0x0000 0x3 0x0
583#define MX6SX_PAD_LCD1_DATA13__CSI1_DATA_4 0x0104 0x044C 0x06B0 0x4 0x1
584#define MX6SX_PAD_LCD1_DATA13__GPIO3_IO_14 0x0104 0x044C 0x0000 0x5 0x0
585#define MX6SX_PAD_LCD1_DATA13__SRC_BT_CFG_13 0x0104 0x044C 0x0000 0x6 0x0
586#define MX6SX_PAD_LCD1_DATA13__SIM_M_HBURST_2 0x0104 0x044C 0x0000 0x7 0x0
587#define MX6SX_PAD_LCD1_DATA13__VADC_TEST_18 0x0104 0x044C 0x0000 0x8 0x0
588#define MX6SX_PAD_LCD1_DATA13__MMDC_DEBUG_18 0x0104 0x044C 0x0000 0x9 0x0
589#define MX6SX_PAD_LCD1_DATA14__LCDIF1_DATA_14 0x0108 0x0450 0x0000 0x0 0x0
590#define MX6SX_PAD_LCD1_DATA14__WEIM_AD_14 0x0108 0x0450 0x0000 0x1 0x0
591#define MX6SX_PAD_LCD1_DATA14__KITTEN_TRACE_14 0x0108 0x0450 0x0000 0x3 0x0
592#define MX6SX_PAD_LCD1_DATA14__CSI1_DATA_3 0x0108 0x0450 0x06AC 0x4 0x1
593#define MX6SX_PAD_LCD1_DATA14__GPIO3_IO_15 0x0108 0x0450 0x0000 0x5 0x0
594#define MX6SX_PAD_LCD1_DATA14__SRC_BT_CFG_14 0x0108 0x0450 0x0000 0x6 0x0
595#define MX6SX_PAD_LCD1_DATA14__SIM_M_HMASTLOCK 0x0108 0x0450 0x0000 0x7 0x0
596#define MX6SX_PAD_LCD1_DATA14__VADC_TEST_19 0x0108 0x0450 0x0000 0x8 0x0
597#define MX6SX_PAD_LCD1_DATA14__MMDC_DEBUG_19 0x0108 0x0450 0x0000 0x9 0x0
598#define MX6SX_PAD_LCD1_DATA15__LCDIF1_DATA_15 0x010C 0x0454 0x0000 0x0 0x0
599#define MX6SX_PAD_LCD1_DATA15__WEIM_AD_15 0x010C 0x0454 0x0000 0x1 0x0
600#define MX6SX_PAD_LCD1_DATA15__KITTEN_TRACE_15 0x010C 0x0454 0x0000 0x3 0x0
601#define MX6SX_PAD_LCD1_DATA15__CSI1_DATA_2 0x010C 0x0454 0x06A8 0x4 0x1
602#define MX6SX_PAD_LCD1_DATA15__GPIO3_IO_16 0x010C 0x0454 0x0000 0x5 0x0
603#define MX6SX_PAD_LCD1_DATA15__SRC_BT_CFG_15 0x010C 0x0454 0x0000 0x6 0x0
604#define MX6SX_PAD_LCD1_DATA15__SIM_M_HPROT_0 0x010C 0x0454 0x0000 0x7 0x0
605#define MX6SX_PAD_LCD1_DATA15__VDEC_DEBUG_0 0x010C 0x0454 0x0000 0x8 0x0
606#define MX6SX_PAD_LCD1_DATA15__MMDC_DEBUG_20 0x010C 0x0454 0x0000 0x9 0x0
607#define MX6SX_PAD_LCD1_DATA16__LCDIF1_DATA_16 0x0110 0x0458 0x0000 0x0 0x0
608#define MX6SX_PAD_LCD1_DATA16__WEIM_ADDR_16 0x0110 0x0458 0x0000 0x1 0x0
609#define MX6SX_PAD_LCD1_DATA16__M4_TRACE_CLK 0x0110 0x0458 0x0000 0x2 0x0
610#define MX6SX_PAD_LCD1_DATA16__KITTEN_TRACE_CLK 0x0110 0x0458 0x0000 0x3 0x0
611#define MX6SX_PAD_LCD1_DATA16__CSI1_DATA_1 0x0110 0x0458 0x06A4 0x4 0x0
612#define MX6SX_PAD_LCD1_DATA16__GPIO3_IO_17 0x0110 0x0458 0x0000 0x5 0x0
613#define MX6SX_PAD_LCD1_DATA16__SRC_BT_CFG_24 0x0110 0x0458 0x0000 0x6 0x0
614#define MX6SX_PAD_LCD1_DATA16__SIM_M_HPROT_1 0x0110 0x0458 0x0000 0x7 0x0
615#define MX6SX_PAD_LCD1_DATA16__VDEC_DEBUG_1 0x0110 0x0458 0x0000 0x8 0x0
616#define MX6SX_PAD_LCD1_DATA16__MMDC_DEBUG_21 0x0110 0x0458 0x0000 0x9 0x0
617#define MX6SX_PAD_LCD1_DATA17__LCDIF1_DATA_17 0x0114 0x045C 0x0000 0x0 0x0
618#define MX6SX_PAD_LCD1_DATA17__WEIM_ADDR_17 0x0114 0x045C 0x0000 0x1 0x0
619#define MX6SX_PAD_LCD1_DATA17__KITTEN_TRACE_CTL 0x0114 0x045C 0x0000 0x3 0x0
620#define MX6SX_PAD_LCD1_DATA17__CSI1_DATA_0 0x0114 0x045C 0x06A0 0x4 0x0
621#define MX6SX_PAD_LCD1_DATA17__GPIO3_IO_18 0x0114 0x045C 0x0000 0x5 0x0
622#define MX6SX_PAD_LCD1_DATA17__SRC_BT_CFG_25 0x0114 0x045C 0x0000 0x6 0x0
623#define MX6SX_PAD_LCD1_DATA17__SIM_M_HPROT_2 0x0114 0x045C 0x0000 0x7 0x0
624#define MX6SX_PAD_LCD1_DATA17__VDEC_DEBUG_2 0x0114 0x045C 0x0000 0x8 0x0
625#define MX6SX_PAD_LCD1_DATA17__MMDC_DEBUG_22 0x0114 0x045C 0x0000 0x9 0x0
626#define MX6SX_PAD_LCD1_DATA18__LCDIF1_DATA_18 0x0118 0x0460 0x0000 0x0 0x0
627#define MX6SX_PAD_LCD1_DATA18__WEIM_ADDR_18 0x0118 0x0460 0x0000 0x1 0x0
628#define MX6SX_PAD_LCD1_DATA18__M4_EVENTO 0x0118 0x0460 0x0000 0x2 0x0
629#define MX6SX_PAD_LCD1_DATA18__KITTEN_EVENTO 0x0118 0x0460 0x0000 0x3 0x0
630#define MX6SX_PAD_LCD1_DATA18__CSI1_DATA_15 0x0118 0x0460 0x06D8 0x4 0x0
631#define MX6SX_PAD_LCD1_DATA18__GPIO3_IO_19 0x0118 0x0460 0x0000 0x5 0x0
632#define MX6SX_PAD_LCD1_DATA18__SRC_BT_CFG_26 0x0118 0x0460 0x0000 0x6 0x0
633#define MX6SX_PAD_LCD1_DATA18__SIM_M_HPROT_3 0x0118 0x0460 0x0000 0x7 0x0
634#define MX6SX_PAD_LCD1_DATA18__VDEC_DEBUG_3 0x0118 0x0460 0x0000 0x8 0x0
635#define MX6SX_PAD_LCD1_DATA18__MMDC_DEBUG_23 0x0118 0x0460 0x0000 0x9 0x0
636#define MX6SX_PAD_LCD1_DATA19__LCDIF1_DATA_19 0x011C 0x0464 0x0000 0x0 0x0
637#define MX6SX_PAD_LCD1_DATA19__WEIM_ADDR_19 0x011C 0x0464 0x0000 0x1 0x0
638#define MX6SX_PAD_LCD1_DATA19__M4_TRACE_SWO 0x011C 0x0464 0x0000 0x2 0x0
639#define MX6SX_PAD_LCD1_DATA19__CSI1_DATA_14 0x011C 0x0464 0x06D4 0x4 0x0
640#define MX6SX_PAD_LCD1_DATA19__GPIO3_IO_20 0x011C 0x0464 0x0000 0x5 0x0
641#define MX6SX_PAD_LCD1_DATA19__SRC_BT_CFG_27 0x011C 0x0464 0x0000 0x6 0x0
642#define MX6SX_PAD_LCD1_DATA19__SIM_M_HREADYOUT 0x011C 0x0464 0x0000 0x7 0x0
643#define MX6SX_PAD_LCD1_DATA19__VDEC_DEBUG_4 0x011C 0x0464 0x0000 0x8 0x0
644#define MX6SX_PAD_LCD1_DATA19__MMDC_DEBUG_24 0x011C 0x0464 0x0000 0x9 0x0
645#define MX6SX_PAD_LCD1_DATA20__LCDIF1_DATA_20 0x0120 0x0468 0x0000 0x0 0x0
646#define MX6SX_PAD_LCD1_DATA20__WEIM_ADDR_20 0x0120 0x0468 0x0000 0x1 0x0
647#define MX6SX_PAD_LCD1_DATA20__PWM8_OUT 0x0120 0x0468 0x0000 0x2 0x0
648#define MX6SX_PAD_LCD1_DATA20__ENET1_1588_EVENT2_OUT 0x0120 0x0468 0x0000 0x3 0x0
649#define MX6SX_PAD_LCD1_DATA20__CSI1_DATA_13 0x0120 0x0468 0x06D0 0x4 0x0
650#define MX6SX_PAD_LCD1_DATA20__GPIO3_IO_21 0x0120 0x0468 0x0000 0x5 0x0
651#define MX6SX_PAD_LCD1_DATA20__SRC_BT_CFG_28 0x0120 0x0468 0x0000 0x6 0x0
652#define MX6SX_PAD_LCD1_DATA20__SIM_M_HRESP 0x0120 0x0468 0x0000 0x7 0x0
653#define MX6SX_PAD_LCD1_DATA20__VDEC_DEBUG_5 0x0120 0x0468 0x0000 0x8 0x0
654#define MX6SX_PAD_LCD1_DATA20__MMDC_DEBUG_25 0x0120 0x0468 0x0000 0x9 0x0
655#define MX6SX_PAD_LCD1_DATA21__LCDIF1_DATA_21 0x0124 0x046C 0x0000 0x0 0x0
656#define MX6SX_PAD_LCD1_DATA21__WEIM_ADDR_21 0x0124 0x046C 0x0000 0x1 0x0
657#define MX6SX_PAD_LCD1_DATA21__PWM7_OUT 0x0124 0x046C 0x0000 0x2 0x0
658#define MX6SX_PAD_LCD1_DATA21__ENET1_1588_EVENT3_OUT 0x0124 0x046C 0x0000 0x3 0x0
659#define MX6SX_PAD_LCD1_DATA21__CSI1_DATA_12 0x0124 0x046C 0x06CC 0x4 0x0
660#define MX6SX_PAD_LCD1_DATA21__GPIO3_IO_22 0x0124 0x046C 0x0000 0x5 0x0
661#define MX6SX_PAD_LCD1_DATA21__SRC_BT_CFG_29 0x0124 0x046C 0x0000 0x6 0x0
662#define MX6SX_PAD_LCD1_DATA21__SIM_M_HSIZE_0 0x0124 0x046C 0x0000 0x7 0x0
663#define MX6SX_PAD_LCD1_DATA21__VDEC_DEBUG_6 0x0124 0x046C 0x0000 0x8 0x0
664#define MX6SX_PAD_LCD1_DATA21__MMDC_DEBUG_26 0x0124 0x046C 0x0000 0x9 0x0
665#define MX6SX_PAD_LCD1_DATA22__LCDIF1_DATA_22 0x0128 0x0470 0x0000 0x0 0x0
666#define MX6SX_PAD_LCD1_DATA22__WEIM_ADDR_22 0x0128 0x0470 0x0000 0x1 0x0
667#define MX6SX_PAD_LCD1_DATA22__PWM6_OUT 0x0128 0x0470 0x0000 0x2 0x0
668#define MX6SX_PAD_LCD1_DATA22__ENET2_1588_EVENT2_OUT 0x0128 0x0470 0x0000 0x3 0x0
669#define MX6SX_PAD_LCD1_DATA22__CSI1_DATA_11 0x0128 0x0470 0x06C8 0x4 0x0
670#define MX6SX_PAD_LCD1_DATA22__GPIO3_IO_23 0x0128 0x0470 0x0000 0x5 0x0
671#define MX6SX_PAD_LCD1_DATA22__SRC_BT_CFG_30 0x0128 0x0470 0x0000 0x6 0x0
672#define MX6SX_PAD_LCD1_DATA22__SIM_M_HSIZE_1 0x0128 0x0470 0x0000 0x7 0x0
673#define MX6SX_PAD_LCD1_DATA22__VDEC_DEBUG_7 0x0128 0x0470 0x0000 0x8 0x0
674#define MX6SX_PAD_LCD1_DATA22__MMDC_DEBUG_27 0x0128 0x0470 0x0000 0x9 0x0
675#define MX6SX_PAD_LCD1_DATA23__LCDIF1_DATA_23 0x012C 0x0474 0x0000 0x0 0x0
676#define MX6SX_PAD_LCD1_DATA23__WEIM_ADDR_23 0x012C 0x0474 0x0000 0x1 0x0
677#define MX6SX_PAD_LCD1_DATA23__PWM5_OUT 0x012C 0x0474 0x0000 0x2 0x0
678#define MX6SX_PAD_LCD1_DATA23__ENET2_1588_EVENT3_OUT 0x012C 0x0474 0x0000 0x3 0x0
679#define MX6SX_PAD_LCD1_DATA23__CSI1_DATA_10 0x012C 0x0474 0x06FC 0x4 0x0
680#define MX6SX_PAD_LCD1_DATA23__GPIO3_IO_24 0x012C 0x0474 0x0000 0x5 0x0
681#define MX6SX_PAD_LCD1_DATA23__SRC_BT_CFG_31 0x012C 0x0474 0x0000 0x6 0x0
682#define MX6SX_PAD_LCD1_DATA23__SIM_M_HSIZE_2 0x012C 0x0474 0x0000 0x7 0x0
683#define MX6SX_PAD_LCD1_DATA23__VDEC_DEBUG_8 0x012C 0x0474 0x0000 0x8 0x0
684#define MX6SX_PAD_LCD1_DATA23__MMDC_DEBUG_28 0x012C 0x0474 0x0000 0x9 0x0
685#define MX6SX_PAD_LCD1_ENABLE__LCDIF1_ENABLE 0x0130 0x0478 0x0000 0x0 0x0
686#define MX6SX_PAD_LCD1_ENABLE__LCDIF1_RD_E 0x0130 0x0478 0x0000 0x1 0x0
687#define MX6SX_PAD_LCD1_ENABLE__AUDMUX_AUD3_TXC 0x0130 0x0478 0x063C 0x2 0x1
688#define MX6SX_PAD_LCD1_ENABLE__ENET1_1588_EVENT3_IN 0x0130 0x0478 0x0000 0x3 0x0
689#define MX6SX_PAD_LCD1_ENABLE__CSI1_DATA_17 0x0130 0x0478 0x06E0 0x4 0x0
690#define MX6SX_PAD_LCD1_ENABLE__GPIO3_IO_25 0x0130 0x0478 0x0000 0x5 0x0
691#define MX6SX_PAD_LCD1_ENABLE__USDHC1_CD_B 0x0130 0x0478 0x0864 0x6 0x0
692#define MX6SX_PAD_LCD1_ENABLE__SIM_M_HADDR_17 0x0130 0x0478 0x0000 0x7 0x0
693#define MX6SX_PAD_LCD1_ENABLE__VADC_TEST_1 0x0130 0x0478 0x0000 0x8 0x0
694#define MX6SX_PAD_LCD1_ENABLE__MMDC_DEBUG_1 0x0130 0x0478 0x0000 0x9 0x0
695#define MX6SX_PAD_LCD1_HSYNC__LCDIF1_HSYNC 0x0134 0x047C 0x07E0 0x0 0x0
696#define MX6SX_PAD_LCD1_HSYNC__LCDIF1_RS 0x0134 0x047C 0x0000 0x1 0x0
697#define MX6SX_PAD_LCD1_HSYNC__AUDMUX_AUD3_TXD 0x0134 0x047C 0x0630 0x2 0x1
698#define MX6SX_PAD_LCD1_HSYNC__ENET2_1588_EVENT2_IN 0x0134 0x047C 0x0000 0x3 0x0
699#define MX6SX_PAD_LCD1_HSYNC__CSI1_DATA_18 0x0134 0x047C 0x06E4 0x4 0x0
700#define MX6SX_PAD_LCD1_HSYNC__GPIO3_IO_26 0x0134 0x047C 0x0000 0x5 0x0
701#define MX6SX_PAD_LCD1_HSYNC__USDHC2_WP 0x0134 0x047C 0x0870 0x6 0x0
702#define MX6SX_PAD_LCD1_HSYNC__SIM_M_HADDR_18 0x0134 0x047C 0x0000 0x7 0x0
703#define MX6SX_PAD_LCD1_HSYNC__VADC_TEST_2 0x0134 0x047C 0x0000 0x8 0x0
704#define MX6SX_PAD_LCD1_HSYNC__MMDC_DEBUG_2 0x0134 0x047C 0x0000 0x9 0x0
705#define MX6SX_PAD_LCD1_RESET__LCDIF1_RESET 0x0138 0x0480 0x0000 0x0 0x0
706#define MX6SX_PAD_LCD1_RESET__LCDIF1_CS 0x0138 0x0480 0x0000 0x1 0x0
707#define MX6SX_PAD_LCD1_RESET__AUDMUX_AUD3_RXD 0x0138 0x0480 0x062C 0x2 0x1
708#define MX6SX_PAD_LCD1_RESET__KITTEN_EVENTI 0x0138 0x0480 0x0000 0x3 0x0
709#define MX6SX_PAD_LCD1_RESET__M4_EVENTI 0x0138 0x0480 0x0000 0x4 0x0
710#define MX6SX_PAD_LCD1_RESET__GPIO3_IO_27 0x0138 0x0480 0x0000 0x5 0x0
711#define MX6SX_PAD_LCD1_RESET__CCM_PMIC_RDY 0x0138 0x0480 0x069C 0x6 0x0
712#define MX6SX_PAD_LCD1_RESET__SIM_M_HADDR_20 0x0138 0x0480 0x0000 0x7 0x0
713#define MX6SX_PAD_LCD1_RESET__VADC_TEST_4 0x0138 0x0480 0x0000 0x8 0x0
714#define MX6SX_PAD_LCD1_RESET__MMDC_DEBUG_4 0x0138 0x0480 0x0000 0x9 0x0
715#define MX6SX_PAD_LCD1_VSYNC__LCDIF1_VSYNC 0x013C 0x0484 0x0000 0x0 0x0
716#define MX6SX_PAD_LCD1_VSYNC__LCDIF1_BUSY 0x013C 0x0484 0x07E0 0x1 0x1
717#define MX6SX_PAD_LCD1_VSYNC__AUDMUX_AUD3_TXFS 0x013C 0x0484 0x0640 0x2 0x1
718#define MX6SX_PAD_LCD1_VSYNC__ENET2_1588_EVENT3_IN 0x013C 0x0484 0x0000 0x3 0x0
719#define MX6SX_PAD_LCD1_VSYNC__CSI1_DATA_19 0x013C 0x0484 0x06E8 0x4 0x0
720#define MX6SX_PAD_LCD1_VSYNC__GPIO3_IO_28 0x013C 0x0484 0x0000 0x5 0x0
721#define MX6SX_PAD_LCD1_VSYNC__USDHC2_CD_B 0x013C 0x0484 0x086C 0x6 0x0
722#define MX6SX_PAD_LCD1_VSYNC__SIM_M_HADDR_19 0x013C 0x0484 0x0000 0x7 0x0
723#define MX6SX_PAD_LCD1_VSYNC__VADC_TEST_3 0x013C 0x0484 0x0000 0x8 0x0
724#define MX6SX_PAD_LCD1_VSYNC__MMDC_DEBUG_3 0x013C 0x0484 0x0000 0x9 0x0
725#define MX6SX_PAD_NAND_ALE__RAWNAND_ALE 0x0140 0x0488 0x0000 0x0 0x0
726#define MX6SX_PAD_NAND_ALE__I2C3_SDA 0x0140 0x0488 0x07BC 0x1 0x0
727#define MX6SX_PAD_NAND_ALE__QSPI2_A_SS0_B 0x0140 0x0488 0x0000 0x2 0x0
728#define MX6SX_PAD_NAND_ALE__ECSPI2_SS0 0x0140 0x0488 0x072C 0x3 0x0
729#define MX6SX_PAD_NAND_ALE__ESAI_TX3_RX2 0x0140 0x0488 0x079C 0x4 0x0
730#define MX6SX_PAD_NAND_ALE__GPIO4_IO_0 0x0140 0x0488 0x0000 0x5 0x0
731#define MX6SX_PAD_NAND_ALE__WEIM_CS0_B 0x0140 0x0488 0x0000 0x6 0x0
732#define MX6SX_PAD_NAND_ALE__TPSMP_HDATA_0 0x0140 0x0488 0x0000 0x7 0x0
733#define MX6SX_PAD_NAND_ALE__ANATOP_USBPHY1_TSTI_TX_EN 0x0140 0x0488 0x0000 0x8 0x0
734#define MX6SX_PAD_NAND_ALE__SDMA_DEBUG_PC_12 0x0140 0x0488 0x0000 0x9 0x0
735#define MX6SX_PAD_NAND_CE0_B__RAWNAND_CE0_B 0x0144 0x048C 0x0000 0x0 0x0
736#define MX6SX_PAD_NAND_CE0_B__USDHC2_VSELECT 0x0144 0x048C 0x0000 0x1 0x0
737#define MX6SX_PAD_NAND_CE0_B__QSPI2_A_DATA_2 0x0144 0x048C 0x0000 0x2 0x0
738#define MX6SX_PAD_NAND_CE0_B__AUDMUX_AUD4_TXC 0x0144 0x048C 0x0654 0x3 0x0
739#define MX6SX_PAD_NAND_CE0_B__ESAI_TX_CLK 0x0144 0x048C 0x078C 0x4 0x0
740#define MX6SX_PAD_NAND_CE0_B__GPIO4_IO_1 0x0144 0x048C 0x0000 0x5 0x0
741#define MX6SX_PAD_NAND_CE0_B__WEIM_LBA_B 0x0144 0x048C 0x0000 0x6 0x0
742#define MX6SX_PAD_NAND_CE0_B__TPSMP_HDATA_3 0x0144 0x048C 0x0000 0x7 0x0
743#define MX6SX_PAD_NAND_CE0_B__ANATOP_USBPHY1_TSTI_TX_HIZ 0x0144 0x048C 0x0000 0x8 0x0
744#define MX6SX_PAD_NAND_CE0_B__SDMA_DEBUG_PC_9 0x0144 0x048C 0x0000 0x9 0x0
745#define MX6SX_PAD_NAND_CE1_B__RAWNAND_CE1_B 0x0148 0x0490 0x0000 0x0 0x0
746#define MX6SX_PAD_NAND_CE1_B__USDHC3_RESET_B 0x0148 0x0490 0x0000 0x1 0x0
747#define MX6SX_PAD_NAND_CE1_B__QSPI2_A_DATA_3 0x0148 0x0490 0x0000 0x2 0x0
748#define MX6SX_PAD_NAND_CE1_B__AUDMUX_AUD4_TXD 0x0148 0x0490 0x0648 0x3 0x0
749#define MX6SX_PAD_NAND_CE1_B__ESAI_TX0 0x0148 0x0490 0x0790 0x4 0x0
750#define MX6SX_PAD_NAND_CE1_B__GPIO4_IO_2 0x0148 0x0490 0x0000 0x5 0x0
751#define MX6SX_PAD_NAND_CE1_B__WEIM_OE 0x0148 0x0490 0x0000 0x6 0x0
752#define MX6SX_PAD_NAND_CE1_B__TPSMP_HDATA_4 0x0148 0x0490 0x0000 0x7 0x0
753#define MX6SX_PAD_NAND_CE1_B__ANATOP_USBPHY1_TSTI_TX_LS_MODE 0x0148 0x0490 0x0000 0x8 0x0
754#define MX6SX_PAD_NAND_CE1_B__SDMA_DEBUG_PC_8 0x0148 0x0490 0x0000 0x9 0x0
755#define MX6SX_PAD_NAND_CLE__RAWNAND_CLE 0x014C 0x0494 0x0000 0x0 0x0
756#define MX6SX_PAD_NAND_CLE__I2C3_SCL 0x014C 0x0494 0x07B8 0x1 0x0
757#define MX6SX_PAD_NAND_CLE__QSPI2_A_SCLK 0x014C 0x0494 0x0000 0x2 0x0
758#define MX6SX_PAD_NAND_CLE__ECSPI2_SCLK 0x014C 0x0494 0x0720 0x3 0x0
759#define MX6SX_PAD_NAND_CLE__ESAI_TX2_RX3 0x014C 0x0494 0x0798 0x4 0x0
760#define MX6SX_PAD_NAND_CLE__GPIO4_IO_3 0x014C 0x0494 0x0000 0x5 0x0
761#define MX6SX_PAD_NAND_CLE__WEIM_BCLK 0x014C 0x0494 0x0000 0x6 0x0
762#define MX6SX_PAD_NAND_CLE__TPSMP_CLK 0x014C 0x0494 0x0000 0x7 0x0
763#define MX6SX_PAD_NAND_CLE__ANATOP_USBPHY1_TSTI_TX_DP 0x014C 0x0494 0x0000 0x8 0x0
764#define MX6SX_PAD_NAND_CLE__SDMA_DEBUG_PC_13 0x014C 0x0494 0x0000 0x9 0x0
765#define MX6SX_PAD_NAND_DATA00__RAWNAND_DATA00 0x0150 0x0498 0x0000 0x0 0x0
766#define MX6SX_PAD_NAND_DATA00__USDHC1_DATA4 0x0150 0x0498 0x0000 0x1 0x0
767#define MX6SX_PAD_NAND_DATA00__QSPI2_B_DATA_1 0x0150 0x0498 0x0000 0x2 0x0
768#define MX6SX_PAD_NAND_DATA00__ECSPI5_MISO 0x0150 0x0498 0x0754 0x3 0x0
769#define MX6SX_PAD_NAND_DATA00__ESAI_RX_CLK 0x0150 0x0498 0x0788 0x4 0x0
770#define MX6SX_PAD_NAND_DATA00__GPIO4_IO_4 0x0150 0x0498 0x0000 0x5 0x0
771#define MX6SX_PAD_NAND_DATA00__WEIM_AD_0 0x0150 0x0498 0x0000 0x6 0x0
772#define MX6SX_PAD_NAND_DATA00__TPSMP_HDATA_7 0x0150 0x0498 0x0000 0x7 0x0
773#define MX6SX_PAD_NAND_DATA00__ANATOP_USBPHY1_TSTO_RX_DISCON_DET 0x0150 0x0498 0x0000 0x8 0x0
774#define MX6SX_PAD_NAND_DATA00__SDMA_DEBUG_EVT_CHN_LINES_5 0x0150 0x0498 0x0000 0x9 0x0
775#define MX6SX_PAD_NAND_DATA01__RAWNAND_DATA01 0x0154 0x049C 0x0000 0x0 0x0
776#define MX6SX_PAD_NAND_DATA01__USDHC1_DATA5 0x0154 0x049C 0x0000 0x1 0x0
777#define MX6SX_PAD_NAND_DATA01__QSPI2_B_DATA_0 0x0154 0x049C 0x0000 0x2 0x0
778#define MX6SX_PAD_NAND_DATA01__ECSPI5_MOSI 0x0154 0x049C 0x0758 0x3 0x0
779#define MX6SX_PAD_NAND_DATA01__ESAI_RX_FS 0x0154 0x049C 0x0778 0x4 0x0
780#define MX6SX_PAD_NAND_DATA01__GPIO4_IO_5 0x0154 0x049C 0x0000 0x5 0x0
781#define MX6SX_PAD_NAND_DATA01__WEIM_AD_1 0x0154 0x049C 0x0000 0x6 0x0
782#define MX6SX_PAD_NAND_DATA01__TPSMP_HDATA_8 0x0154 0x049C 0x0000 0x7 0x0
783#define MX6SX_PAD_NAND_DATA01__ANATOP_USBPHY1_TSTO_RX_HS_RXD 0x0154 0x049C 0x0000 0x8 0x0
784#define MX6SX_PAD_NAND_DATA01__SDMA_DEBUG_EVT_CHN_LINES_4 0x0154 0x049C 0x0000 0x9 0x0
785#define MX6SX_PAD_NAND_DATA02__RAWNAND_DATA02 0x0158 0x04A0 0x0000 0x0 0x0
786#define MX6SX_PAD_NAND_DATA02__USDHC1_DATA6 0x0158 0x04A0 0x0000 0x1 0x0
787#define MX6SX_PAD_NAND_DATA02__QSPI2_B_SCLK 0x0158 0x04A0 0x0000 0x2 0x0
788#define MX6SX_PAD_NAND_DATA02__ECSPI5_SCLK 0x0158 0x04A0 0x0750 0x3 0x0
789#define MX6SX_PAD_NAND_DATA02__ESAI_TX_HF_CLK 0x0158 0x04A0 0x0784 0x4 0x0
790#define MX6SX_PAD_NAND_DATA02__GPIO4_IO_6 0x0158 0x04A0 0x0000 0x5 0x0
791#define MX6SX_PAD_NAND_DATA02__WEIM_AD_2 0x0158 0x04A0 0x0000 0x6 0x0
792#define MX6SX_PAD_NAND_DATA02__TPSMP_HDATA_9 0x0158 0x04A0 0x0000 0x7 0x0
793#define MX6SX_PAD_NAND_DATA02__ANATOP_USBPHY2_TSTO_PLL_CLK20DIV 0x0158 0x04A0 0x0000 0x8 0x0
794#define MX6SX_PAD_NAND_DATA02__SDMA_DEBUG_EVT_CHN_LINES_3 0x0158 0x04A0 0x0000 0x9 0x0
795#define MX6SX_PAD_NAND_DATA03__RAWNAND_DATA03 0x015C 0x04A4 0x0000 0x0 0x0
796#define MX6SX_PAD_NAND_DATA03__USDHC1_DATA7 0x015C 0x04A4 0x0000 0x1 0x0
797#define MX6SX_PAD_NAND_DATA03__QSPI2_B_SS0_B 0x015C 0x04A4 0x0000 0x2 0x0
798#define MX6SX_PAD_NAND_DATA03__ECSPI5_SS0 0x015C 0x04A4 0x075C 0x3 0x0
799#define MX6SX_PAD_NAND_DATA03__ESAI_RX_HF_CLK 0x015C 0x04A4 0x0780 0x4 0x0
800#define MX6SX_PAD_NAND_DATA03__GPIO4_IO_7 0x015C 0x04A4 0x0000 0x5 0x0
801#define MX6SX_PAD_NAND_DATA03__WEIM_AD_3 0x015C 0x04A4 0x0000 0x6 0x0
802#define MX6SX_PAD_NAND_DATA03__TPSMP_HDATA_10 0x015C 0x04A4 0x0000 0x7 0x0
803#define MX6SX_PAD_NAND_DATA03__ANATOP_USBPHY1_TSTO_RX_SQUELCH 0x015C 0x04A4 0x0000 0x8 0x0
804#define MX6SX_PAD_NAND_DATA03__SDMA_DEBUG_EVT_CHN_LINES_6 0x015C 0x04A4 0x0000 0x9 0x0
805#define MX6SX_PAD_NAND_DATA04__RAWNAND_DATA04 0x0160 0x04A8 0x0000 0x0 0x0
806#define MX6SX_PAD_NAND_DATA04__USDHC2_DATA4 0x0160 0x04A8 0x0000 0x1 0x0
807#define MX6SX_PAD_NAND_DATA04__QSPI2_B_SS1_B 0x0160 0x04A8 0x0000 0x2 0x0
808#define MX6SX_PAD_NAND_DATA04__UART3_RTS_B 0x0160 0x04A8 0x083C 0x3 0x0
809#define MX6SX_PAD_NAND_DATA04__AUDMUX_AUD4_RXFS 0x0160 0x04A8 0x0650 0x4 0x0
810#define MX6SX_PAD_NAND_DATA04__GPIO4_IO_8 0x0160 0x04A8 0x0000 0x5 0x0
811#define MX6SX_PAD_NAND_DATA04__WEIM_AD_4 0x0160 0x04A8 0x0000 0x6 0x0
812#define MX6SX_PAD_NAND_DATA04__TPSMP_HDATA_11 0x0160 0x04A8 0x0000 0x7 0x0
813#define MX6SX_PAD_NAND_DATA04__ANATOP_USBPHY2_TSTO_RX_SQUELCH 0x0160 0x04A8 0x0000 0x8 0x0
814#define MX6SX_PAD_NAND_DATA04__SDMA_DEBUG_CORE_STATE_0 0x0160 0x04A8 0x0000 0x9 0x0
815#define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0
816#define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0
817#define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0
818#define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x083C 0x3 0x1
819#define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0
820#define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0
821#define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0
822#define MX6SX_PAD_NAND_DATA05__TPSMP_HDATA_12 0x0164 0x04AC 0x0000 0x7 0x0
823#define MX6SX_PAD_NAND_DATA05__ANATOP_USBPHY2_TSTO_RX_DISCON_DET 0x0164 0x04AC 0x0000 0x8 0x0
824#define MX6SX_PAD_NAND_DATA05__SDMA_DEBUG_CORE_STATE_1 0x0164 0x04AC 0x0000 0x9 0x0
825#define MX6SX_PAD_NAND_DATA06__RAWNAND_DATA06 0x0168 0x04B0 0x0000 0x0 0x0
826#define MX6SX_PAD_NAND_DATA06__USDHC2_DATA6 0x0168 0x04B0 0x0000 0x1 0x0
827#define MX6SX_PAD_NAND_DATA06__QSPI2_A_SS1_B 0x0168 0x04B0 0x0000 0x2 0x0
828#define MX6SX_PAD_NAND_DATA06__UART3_RX 0x0168 0x04B0 0x0840 0x3 0x0
829#define MX6SX_PAD_NAND_DATA06__UART3_TX 0x0168 0x04B0 0x0000 0x3 0x0
830#define MX6SX_PAD_NAND_DATA06__PWM3_OUT 0x0168 0x04B0 0x0000 0x4 0x0
831#define MX6SX_PAD_NAND_DATA06__GPIO4_IO_10 0x0168 0x04B0 0x0000 0x5 0x0
832#define MX6SX_PAD_NAND_DATA06__WEIM_AD_6 0x0168 0x04B0 0x0000 0x6 0x0
833#define MX6SX_PAD_NAND_DATA06__TPSMP_HDATA_13 0x0168 0x04B0 0x0000 0x7 0x0
834#define MX6SX_PAD_NAND_DATA06__ANATOP_USBPHY2_TSTO_RX_FS_RXD 0x0168 0x04B0 0x0000 0x8 0x0
835#define MX6SX_PAD_NAND_DATA06__SDMA_DEBUG_CORE_STATE_2 0x0168 0x04B0 0x0000 0x9 0x0
836#define MX6SX_PAD_NAND_DATA07__RAWNAND_DATA07 0x016C 0x04B4 0x0000 0x0 0x0
837#define MX6SX_PAD_NAND_DATA07__USDHC2_DATA7 0x016C 0x04B4 0x0000 0x1 0x0
838#define MX6SX_PAD_NAND_DATA07__QSPI2_A_DQS 0x016C 0x04B4 0x0000 0x2 0x0
839#define MX6SX_PAD_NAND_DATA07__UART3_RX 0x016C 0x04B4 0x0840 0x3 0x1
840#define MX6SX_PAD_NAND_DATA07__UART3_TX 0x016C 0x04B4 0x0000 0x3 0x0
841#define MX6SX_PAD_NAND_DATA07__PWM4_OUT 0x016C 0x04B4 0x0000 0x4 0x0
842#define MX6SX_PAD_NAND_DATA07__GPIO4_IO_11 0x016C 0x04B4 0x0000 0x5 0x0
843#define MX6SX_PAD_NAND_DATA07__WEIM_AD_7 0x016C 0x04B4 0x0000 0x6 0x0
844#define MX6SX_PAD_NAND_DATA07__TPSMP_HDATA_14 0x016C 0x04B4 0x0000 0x7 0x0
845#define MX6SX_PAD_NAND_DATA07__ANATOP_USBPHY1_TSTO_RX_FS_RXD 0x016C 0x04B4 0x0000 0x8 0x0
846#define MX6SX_PAD_NAND_DATA07__SDMA_DEBUG_CORE_STATE_3 0x016C 0x04B4 0x0000 0x9 0x0
847#define MX6SX_PAD_NAND_RE_B__RAWNAND_RE_B 0x0170 0x04B8 0x0000 0x0 0x0
848#define MX6SX_PAD_NAND_RE_B__USDHC2_RESET_B 0x0170 0x04B8 0x0000 0x1 0x0
849#define MX6SX_PAD_NAND_RE_B__QSPI2_B_DATA_3 0x0170 0x04B8 0x0000 0x2 0x0
850#define MX6SX_PAD_NAND_RE_B__AUDMUX_AUD4_TXFS 0x0170 0x04B8 0x0658 0x3 0x0
851#define MX6SX_PAD_NAND_RE_B__ESAI_TX_FS 0x0170 0x04B8 0x077C 0x4 0x0
852#define MX6SX_PAD_NAND_RE_B__GPIO4_IO_12 0x0170 0x04B8 0x0000 0x5 0x0
853#define MX6SX_PAD_NAND_RE_B__WEIM_RW 0x0170 0x04B8 0x0000 0x6 0x0
854#define MX6SX_PAD_NAND_RE_B__TPSMP_HDATA_5 0x0170 0x04B8 0x0000 0x7 0x0
855#define MX6SX_PAD_NAND_RE_B__ANATOP_USBPHY2_TSTO_RX_HS_RXD 0x0170 0x04B8 0x0000 0x8 0x0
856#define MX6SX_PAD_NAND_RE_B__SDMA_DEBUG_PC_7 0x0170 0x04B8 0x0000 0x9 0x0
857#define MX6SX_PAD_NAND_READY_B__RAWNAND_READY_B 0x0174 0x04BC 0x0000 0x0 0x0
858#define MX6SX_PAD_NAND_READY_B__USDHC1_VSELECT 0x0174 0x04BC 0x0000 0x1 0x0
859#define MX6SX_PAD_NAND_READY_B__QSPI2_A_DATA_1 0x0174 0x04BC 0x0000 0x2 0x0
860#define MX6SX_PAD_NAND_READY_B__ECSPI2_MISO 0x0174 0x04BC 0x0724 0x3 0x0
861#define MX6SX_PAD_NAND_READY_B__ESAI_TX1 0x0174 0x04BC 0x0794 0x4 0x0
862#define MX6SX_PAD_NAND_READY_B__GPIO4_IO_13 0x0174 0x04BC 0x0000 0x5 0x0
863#define MX6SX_PAD_NAND_READY_B__WEIM_EB_B_1 0x0174 0x04BC 0x0000 0x6 0x0
864#define MX6SX_PAD_NAND_READY_B__TPSMP_HDATA_2 0x0174 0x04BC 0x0000 0x7 0x0
865#define MX6SX_PAD_NAND_READY_B__ANATOP_USBPHY1_TSTI_TX_DN 0x0174 0x04BC 0x0000 0x8 0x0
866#define MX6SX_PAD_NAND_READY_B__SDMA_DEBUG_PC_10 0x0174 0x04BC 0x0000 0x9 0x0
867#define MX6SX_PAD_NAND_WE_B__RAWNAND_WE_B 0x0178 0x04C0 0x0000 0x0 0x0
868#define MX6SX_PAD_NAND_WE_B__USDHC4_VSELECT 0x0178 0x04C0 0x0000 0x1 0x0
869#define MX6SX_PAD_NAND_WE_B__QSPI2_B_DATA_2 0x0178 0x04C0 0x0000 0x2 0x0
870#define MX6SX_PAD_NAND_WE_B__AUDMUX_AUD4_RXD 0x0178 0x04C0 0x0644 0x3 0x0
871#define MX6SX_PAD_NAND_WE_B__ESAI_TX5_RX0 0x0178 0x04C0 0x07A4 0x4 0x0
872#define MX6SX_PAD_NAND_WE_B__GPIO4_IO_14 0x0178 0x04C0 0x0000 0x5 0x0
873#define MX6SX_PAD_NAND_WE_B__WEIM_WAIT 0x0178 0x04C0 0x0000 0x6 0x0
874#define MX6SX_PAD_NAND_WE_B__TPSMP_HDATA_6 0x0178 0x04C0 0x0000 0x7 0x0
875#define MX6SX_PAD_NAND_WE_B__ANATOP_USBPHY1_TSTO_PLL_CLK20DIV 0x0178 0x04C0 0x0000 0x8 0x0
876#define MX6SX_PAD_NAND_WE_B__SDMA_DEBUG_PC_6 0x0178 0x04C0 0x0000 0x9 0x0
877#define MX6SX_PAD_NAND_WP_B__RAWNAND_WP_B 0x017C 0x04C4 0x0000 0x0 0x0
878#define MX6SX_PAD_NAND_WP_B__USDHC1_RESET_B 0x017C 0x04C4 0x0000 0x1 0x0
879#define MX6SX_PAD_NAND_WP_B__QSPI2_A_DATA_0 0x017C 0x04C4 0x0000 0x2 0x0
880#define MX6SX_PAD_NAND_WP_B__ECSPI2_MOSI 0x017C 0x04C4 0x0728 0x3 0x0
881#define MX6SX_PAD_NAND_WP_B__ESAI_TX4_RX1 0x017C 0x04C4 0x07A0 0x4 0x0
882#define MX6SX_PAD_NAND_WP_B__GPIO4_IO_15 0x017C 0x04C4 0x0000 0x5 0x0
883#define MX6SX_PAD_NAND_WP_B__WEIM_EB_B_0 0x017C 0x04C4 0x0000 0x6 0x0
884#define MX6SX_PAD_NAND_WP_B__TPSMP_HDATA_1 0x017C 0x04C4 0x0000 0x7 0x0
885#define MX6SX_PAD_NAND_WP_B__ANATOP_USBPHY1_TSTI_TX_HS_MODE 0x017C 0x04C4 0x0000 0x8 0x0
886#define MX6SX_PAD_NAND_WP_B__SDMA_DEBUG_PC_11 0x017C 0x04C4 0x0000 0x9 0x0
887#define MX6SX_PAD_QSPI1A_DATA0__QSPI1_A_DATA_0 0x0180 0x04C8 0x0000 0x0 0x0
888#define MX6SX_PAD_QSPI1A_DATA0__USB_OTG2_OC 0x0180 0x04C8 0x085C 0x1 0x2
889#define MX6SX_PAD_QSPI1A_DATA0__ECSPI1_MOSI 0x0180 0x04C8 0x0718 0x2 0x1
890#define MX6SX_PAD_QSPI1A_DATA0__ESAI_TX4_RX1 0x0180 0x04C8 0x07A0 0x3 0x2
891#define MX6SX_PAD_QSPI1A_DATA0__CSI1_DATA_14 0x0180 0x04C8 0x06D4 0x4 0x1
892#define MX6SX_PAD_QSPI1A_DATA0__GPIO4_IO_16 0x0180 0x04C8 0x0000 0x5 0x0
893#define MX6SX_PAD_QSPI1A_DATA0__WEIM_DATA_6 0x0180 0x04C8 0x0000 0x6 0x0
894#define MX6SX_PAD_QSPI1A_DATA0__SIM_M_HADDR_3 0x0180 0x04C8 0x0000 0x7 0x0
895#define MX6SX_PAD_QSPI1A_DATA0__SDMA_DEBUG_BUS_DEVICE_3 0x0180 0x04C8 0x0000 0x9 0x0
896#define MX6SX_PAD_QSPI1A_DATA1__QSPI1_A_DATA_1 0x0184 0x04CC 0x0000 0x0 0x0
897#define MX6SX_PAD_QSPI1A_DATA1__ANATOP_OTG1_ID 0x0184 0x04CC 0x0624 0x1 0x2
898#define MX6SX_PAD_QSPI1A_DATA1__ECSPI1_MISO 0x0184 0x04CC 0x0714 0x2 0x1
899#define MX6SX_PAD_QSPI1A_DATA1__ESAI_TX1 0x0184 0x04CC 0x0794 0x3 0x2
900#define MX6SX_PAD_QSPI1A_DATA1__CSI1_DATA_13 0x0184 0x04CC 0x06D0 0x4 0x1
901#define MX6SX_PAD_QSPI1A_DATA1__GPIO4_IO_17 0x0184 0x04CC 0x0000 0x5 0x0
902#define MX6SX_PAD_QSPI1A_DATA1__WEIM_DATA_5 0x0184 0x04CC 0x0000 0x6 0x0
903#define MX6SX_PAD_QSPI1A_DATA1__SIM_M_HADDR_4 0x0184 0x04CC 0x0000 0x7 0x0
904#define MX6SX_PAD_QSPI1A_DATA1__SDMA_DEBUG_PC_0 0x0184 0x04CC 0x0000 0x9 0x0
905#define MX6SX_PAD_QSPI1A_DATA2__QSPI1_A_DATA_2 0x0188 0x04D0 0x0000 0x0 0x0
906#define MX6SX_PAD_QSPI1A_DATA2__USB_OTG1_PWR 0x0188 0x04D0 0x0000 0x1 0x0
907#define MX6SX_PAD_QSPI1A_DATA2__ECSPI5_SS1 0x0188 0x04D0 0x0000 0x2 0x0
908#define MX6SX_PAD_QSPI1A_DATA2__ESAI_TX_CLK 0x0188 0x04D0 0x078C 0x3 0x2
909#define MX6SX_PAD_QSPI1A_DATA2__CSI1_DATA_12 0x0188 0x04D0 0x06CC 0x4 0x1
910#define MX6SX_PAD_QSPI1A_DATA2__GPIO4_IO_18 0x0188 0x04D0 0x0000 0x5 0x0
911#define MX6SX_PAD_QSPI1A_DATA2__WEIM_DATA_4 0x0188 0x04D0 0x0000 0x6 0x0
912#define MX6SX_PAD_QSPI1A_DATA2__SIM_M_HADDR_6 0x0188 0x04D0 0x0000 0x7 0x0
913#define MX6SX_PAD_QSPI1A_DATA2__SDMA_DEBUG_PC_1 0x0188 0x04D0 0x0000 0x9 0x0
914#define MX6SX_PAD_QSPI1A_DATA3__QSPI1_A_DATA_3 0x018C 0x04D4 0x0000 0x0 0x0
915#define MX6SX_PAD_QSPI1A_DATA3__USB_OTG1_OC 0x018C 0x04D4 0x0860 0x1 0x2
916#define MX6SX_PAD_QSPI1A_DATA3__ECSPI5_SS2 0x018C 0x04D4 0x0000 0x2 0x0
917#define MX6SX_PAD_QSPI1A_DATA3__ESAI_TX0 0x018C 0x04D4 0x0790 0x3 0x2
918#define MX6SX_PAD_QSPI1A_DATA3__CSI1_DATA_11 0x018C 0x04D4 0x06C8 0x4 0x1
919#define MX6SX_PAD_QSPI1A_DATA3__GPIO4_IO_19 0x018C 0x04D4 0x0000 0x5 0x0
920#define MX6SX_PAD_QSPI1A_DATA3__WEIM_DATA_3 0x018C 0x04D4 0x0000 0x6 0x0
921#define MX6SX_PAD_QSPI1A_DATA3__SIM_M_HADDR_7 0x018C 0x04D4 0x0000 0x7 0x0
922#define MX6SX_PAD_QSPI1A_DATA3__SDMA_DEBUG_PC_2 0x018C 0x04D4 0x0000 0x9 0x0
923#define MX6SX_PAD_QSPI1A_DQS__QSPI1_A_DQS 0x0190 0x04D8 0x0000 0x0 0x0
924#define MX6SX_PAD_QSPI1A_DQS__CAN2_TX 0x0190 0x04D8 0x0000 0x1 0x0
925#define MX6SX_PAD_QSPI1A_DQS__CANFD_TX2 0x0190 0x04D8 0x0000 0x2 0x0
926#define MX6SX_PAD_QSPI1A_DQS__ECSPI5_MOSI 0x0190 0x04D8 0x0758 0x3 0x1
927#define MX6SX_PAD_QSPI1A_DQS__CSI1_DATA_15 0x0190 0x04D8 0x06D8 0x4 0x1
928#define MX6SX_PAD_QSPI1A_DQS__GPIO4_IO_20 0x0190 0x04D8 0x0000 0x5 0x0
929#define MX6SX_PAD_QSPI1A_DQS__WEIM_DATA_7 0x0190 0x04D8 0x0000 0x6 0x0
930#define MX6SX_PAD_QSPI1A_DQS__SIM_M_HADDR_13 0x0190 0x04D8 0x0000 0x7 0x0
931#define MX6SX_PAD_QSPI1A_DQS__SDMA_DEBUG_BUS_DEVICE_4 0x0190 0x04D8 0x0000 0x9 0x0
932#define MX6SX_PAD_QSPI1A_SCLK__QSPI1_A_SCLK 0x0194 0x04DC 0x0000 0x0 0x0
933#define MX6SX_PAD_QSPI1A_SCLK__ANATOP_OTG2_ID 0x0194 0x04DC 0x0628 0x1 0x2
934#define MX6SX_PAD_QSPI1A_SCLK__ECSPI1_SCLK 0x0194 0x04DC 0x0710 0x2 0x1
935#define MX6SX_PAD_QSPI1A_SCLK__ESAI_TX2_RX3 0x0194 0x04DC 0x0798 0x3 0x2
936#define MX6SX_PAD_QSPI1A_SCLK__CSI1_DATA_1 0x0194 0x04DC 0x06A4 0x4 0x1
937#define MX6SX_PAD_QSPI1A_SCLK__GPIO4_IO_21 0x0194 0x04DC 0x0000 0x5 0x0
938#define MX6SX_PAD_QSPI1A_SCLK__WEIM_DATA_0 0x0194 0x04DC 0x0000 0x6 0x0
939#define MX6SX_PAD_QSPI1A_SCLK__SIM_M_HADDR_0 0x0194 0x04DC 0x0000 0x7 0x0
940#define MX6SX_PAD_QSPI1A_SCLK__SDMA_DEBUG_PC_5 0x0194 0x04DC 0x0000 0x9 0x0
941#define MX6SX_PAD_QSPI1A_SS0_B__QSPI1_A_SS0_B 0x0198 0x04E0 0x0000 0x0 0x0
942#define MX6SX_PAD_QSPI1A_SS0_B__USB_OTG2_PWR 0x0198 0x04E0 0x0000 0x1 0x0
943#define MX6SX_PAD_QSPI1A_SS0_B__ECSPI1_SS0 0x0198 0x04E0 0x071C 0x2 0x1
944#define MX6SX_PAD_QSPI1A_SS0_B__ESAI_TX3_RX2 0x0198 0x04E0 0x079C 0x3 0x2
945#define MX6SX_PAD_QSPI1A_SS0_B__CSI1_DATA_0 0x0198 0x04E0 0x06A0 0x4 0x1
946#define MX6SX_PAD_QSPI1A_SS0_B__GPIO4_IO_22 0x0198 0x04E0 0x0000 0x5 0x0
947#define MX6SX_PAD_QSPI1A_SS0_B__WEIM_DATA_1 0x0198 0x04E0 0x0000 0x6 0x0
948#define MX6SX_PAD_QSPI1A_SS0_B__SIM_M_HADDR_1 0x0198 0x04E0 0x0000 0x7 0x0
949#define MX6SX_PAD_QSPI1A_SS0_B__SDMA_DEBUG_PC_4 0x0198 0x04E0 0x0000 0x9 0x0
950#define MX6SX_PAD_QSPI1A_SS1_B__QSPI1_A_SS1_B 0x019C 0x04E4 0x0000 0x0 0x0
951#define MX6SX_PAD_QSPI1A_SS1_B__CAN1_RX 0x019C 0x04E4 0x068C 0x1 0x2
952#define MX6SX_PAD_QSPI1A_SS1_B__CANFD_RX1 0x019C 0x04E4 0x0694 0x2 0x2
953#define MX6SX_PAD_QSPI1A_SS1_B__ECSPI5_MISO 0x019C 0x04E4 0x0754 0x3 0x1
954#define MX6SX_PAD_QSPI1A_SS1_B__CSI1_DATA_10 0x019C 0x04E4 0x06FC 0x4 0x1
955#define MX6SX_PAD_QSPI1A_SS1_B__GPIO4_IO_23 0x019C 0x04E4 0x0000 0x5 0x0
956#define MX6SX_PAD_QSPI1A_SS1_B__WEIM_DATA_2 0x019C 0x04E4 0x0000 0x6 0x0
957#define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0
958#define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0
959#define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0
960#define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x083C 0x1 0x4
961#define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1
962#define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2
963#define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1
964#define MX6SX_PAD_QSPI1B_DATA0__GPIO4_IO_24 0x01A0 0x04E8 0x0000 0x5 0x0
965#define MX6SX_PAD_QSPI1B_DATA0__WEIM_DATA_14 0x01A0 0x04E8 0x0000 0x6 0x0
966#define MX6SX_PAD_QSPI1B_DATA0__SIM_M_HADDR_9 0x01A0 0x04E8 0x0000 0x7 0x0
967#define MX6SX_PAD_QSPI1B_DATA1__QSPI1_B_DATA_1 0x01A4 0x04EC 0x0000 0x0 0x0
968#define MX6SX_PAD_QSPI1B_DATA1__UART3_RTS_B 0x01A4 0x04EC 0x083C 0x1 0x5
969#define MX6SX_PAD_QSPI1B_DATA1__ECSPI3_MISO 0x01A4 0x04EC 0x0734 0x2 0x1
970#define MX6SX_PAD_QSPI1B_DATA1__ESAI_RX_CLK 0x01A4 0x04EC 0x0788 0x3 0x2
971#define MX6SX_PAD_QSPI1B_DATA1__CSI1_DATA_21 0x01A4 0x04EC 0x06F0 0x4 0x1
972#define MX6SX_PAD_QSPI1B_DATA1__GPIO4_IO_25 0x01A4 0x04EC 0x0000 0x5 0x0
973#define MX6SX_PAD_QSPI1B_DATA1__WEIM_DATA_13 0x01A4 0x04EC 0x0000 0x6 0x0
974#define MX6SX_PAD_QSPI1B_DATA1__SIM_M_HADDR_8 0x01A4 0x04EC 0x0000 0x7 0x0
975#define MX6SX_PAD_QSPI1B_DATA2__QSPI1_B_DATA_2 0x01A8 0x04F0 0x0000 0x0 0x0
976#define MX6SX_PAD_QSPI1B_DATA2__I2C2_SDA 0x01A8 0x04F0 0x07B4 0x1 0x2
977#define MX6SX_PAD_QSPI1B_DATA2__ECSPI5_RDY 0x01A8 0x04F0 0x0000 0x2 0x0
978#define MX6SX_PAD_QSPI1B_DATA2__ESAI_TX5_RX0 0x01A8 0x04F0 0x07A4 0x3 0x2
979#define MX6SX_PAD_QSPI1B_DATA2__CSI1_DATA_20 0x01A8 0x04F0 0x06EC 0x4 0x1
980#define MX6SX_PAD_QSPI1B_DATA2__GPIO4_IO_26 0x01A8 0x04F0 0x0000 0x5 0x0
981#define MX6SX_PAD_QSPI1B_DATA2__WEIM_DATA_12 0x01A8 0x04F0 0x0000 0x6 0x0
982#define MX6SX_PAD_QSPI1B_DATA2__SIM_M_HADDR_5 0x01A8 0x04F0 0x0000 0x7 0x0
983#define MX6SX_PAD_QSPI1B_DATA3__QSPI1_B_DATA_3 0x01AC 0x04F4 0x0000 0x0 0x0
984#define MX6SX_PAD_QSPI1B_DATA3__I2C2_SCL 0x01AC 0x04F4 0x07B0 0x1 0x2
985#define MX6SX_PAD_QSPI1B_DATA3__ECSPI5_SS3 0x01AC 0x04F4 0x0000 0x2 0x0
986#define MX6SX_PAD_QSPI1B_DATA3__ESAI_TX_FS 0x01AC 0x04F4 0x077C 0x3 0x2
987#define MX6SX_PAD_QSPI1B_DATA3__CSI1_DATA_19 0x01AC 0x04F4 0x06E8 0x4 0x1
988#define MX6SX_PAD_QSPI1B_DATA3__GPIO4_IO_27 0x01AC 0x04F4 0x0000 0x5 0x0
989#define MX6SX_PAD_QSPI1B_DATA3__WEIM_DATA_11 0x01AC 0x04F4 0x0000 0x6 0x0
990#define MX6SX_PAD_QSPI1B_DATA3__SIM_M_HADDR_2 0x01AC 0x04F4 0x0000 0x7 0x0
991#define MX6SX_PAD_QSPI1B_DQS__QSPI1_B_DQS 0x01B0 0x04F8 0x0000 0x0 0x0
992#define MX6SX_PAD_QSPI1B_DQS__CAN1_TX 0x01B0 0x04F8 0x0000 0x1 0x0
993#define MX6SX_PAD_QSPI1B_DQS__CANFD_TX1 0x01B0 0x04F8 0x0000 0x2 0x0
994#define MX6SX_PAD_QSPI1B_DQS__ECSPI5_SS0 0x01B0 0x04F8 0x075C 0x3 0x1
995#define MX6SX_PAD_QSPI1B_DQS__CSI1_DATA_23 0x01B0 0x04F8 0x06F8 0x4 0x1
996#define MX6SX_PAD_QSPI1B_DQS__GPIO4_IO_28 0x01B0 0x04F8 0x0000 0x5 0x0
997#define MX6SX_PAD_QSPI1B_DQS__WEIM_DATA_15 0x01B0 0x04F8 0x0000 0x6 0x0
998#define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0
999#define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0
1000#define MX6SX_PAD_QSPI1B_SCLK__UART3_RX 0x01B4 0x04FC 0x0840 0x1 0x4
1001#define MX6SX_PAD_QSPI1B_SCLK__UART3_TX 0x01B4 0x04FC 0x0000 0x0 0x0
1002#define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1
1003#define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2
1004#define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1
1005#define MX6SX_PAD_QSPI1B_SCLK__GPIO4_IO_29 0x01B4 0x04FC 0x0000 0x5 0x0
1006#define MX6SX_PAD_QSPI1B_SCLK__WEIM_DATA_8 0x01B4 0x04FC 0x0000 0x6 0x0
1007#define MX6SX_PAD_QSPI1B_SCLK__SIM_M_HADDR_11 0x01B4 0x04FC 0x0000 0x7 0x0
1008#define MX6SX_PAD_QSPI1B_SS0_B__QSPI1_B_SS0_B 0x01B8 0x0500 0x0000 0x0 0x0
1009#define MX6SX_PAD_QSPI1B_SS0_B__UART3_RX 0x01B8 0x0500 0x0840 0x1 0x5
1010#define MX6SX_PAD_QSPI1B_SS0_B__UART3_TX 0x01B8 0x0500 0x0000 0x1 0x0
1011#define MX6SX_PAD_QSPI1B_SS0_B__ECSPI3_SS0 0x01B8 0x0500 0x073C 0x2 0x1
1012#define MX6SX_PAD_QSPI1B_SS0_B__ESAI_TX_HF_CLK 0x01B8 0x0500 0x0784 0x3 0x3
1013#define MX6SX_PAD_QSPI1B_SS0_B__CSI1_DATA_17 0x01B8 0x0500 0x06E0 0x4 0x1
1014#define MX6SX_PAD_QSPI1B_SS0_B__GPIO4_IO_30 0x01B8 0x0500 0x0000 0x5 0x0
1015#define MX6SX_PAD_QSPI1B_SS0_B__WEIM_DATA_9 0x01B8 0x0500 0x0000 0x6 0x0
1016#define MX6SX_PAD_QSPI1B_SS0_B__SIM_M_HADDR_10 0x01B8 0x0500 0x0000 0x7 0x0
1017#define MX6SX_PAD_QSPI1B_SS1_B__QSPI1_B_SS1_B 0x01BC 0x0504 0x0000 0x0 0x0
1018#define MX6SX_PAD_QSPI1B_SS1_B__CAN2_RX 0x01BC 0x0504 0x0690 0x1 0x2
1019#define MX6SX_PAD_QSPI1B_SS1_B__CANFD_RX2 0x01BC 0x0504 0x0698 0x2 0x2
1020#define MX6SX_PAD_QSPI1B_SS1_B__ECSPI5_SCLK 0x01BC 0x0504 0x0750 0x3 0x1
1021#define MX6SX_PAD_QSPI1B_SS1_B__CSI1_DATA_18 0x01BC 0x0504 0x06E4 0x4 0x1
1022#define MX6SX_PAD_QSPI1B_SS1_B__GPIO4_IO_31 0x01BC 0x0504 0x0000 0x5 0x0
1023#define MX6SX_PAD_QSPI1B_SS1_B__WEIM_DATA_10 0x01BC 0x0504 0x0000 0x6 0x0
1024#define MX6SX_PAD_QSPI1B_SS1_B__SIM_M_HADDR_14 0x01BC 0x0504 0x0000 0x7 0x0
1025#define MX6SX_PAD_RGMII1_RD0__ENET1_RX_DATA_0 0x01C0 0x0508 0x0000 0x0 0x0
1026#define MX6SX_PAD_RGMII1_RD0__GPIO5_IO_0 0x01C0 0x0508 0x0000 0x5 0x0
1027#define MX6SX_PAD_RGMII1_RD0__CSI2_DATA_10 0x01C0 0x0508 0x0000 0x6 0x0
1028#define MX6SX_PAD_RGMII1_RD0__ANATOP_TESTI_0 0x01C0 0x0508 0x0000 0x7 0x0
1029#define MX6SX_PAD_RGMII1_RD0__RAWNAND_TESTER_TRIGGER 0x01C0 0x0508 0x0000 0x8 0x0
1030#define MX6SX_PAD_RGMII1_RD0__PCIE_CTRL_DEBUG_0 0x01C0 0x0508 0x0000 0x9 0x0
1031#define MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1 0x01C4 0x050C 0x0000 0x0 0x0
1032#define MX6SX_PAD_RGMII1_RD1__GPIO5_IO_1 0x01C4 0x050C 0x0000 0x5 0x0
1033#define MX6SX_PAD_RGMII1_RD1__CSI2_DATA_11 0x01C4 0x050C 0x0000 0x6 0x0
1034#define MX6SX_PAD_RGMII1_RD1__ANATOP_TESTI_1 0x01C4 0x050C 0x0000 0x7 0x0
1035#define MX6SX_PAD_RGMII1_RD1__USDHC1_TESTER_TRIGGER 0x01C4 0x050C 0x0000 0x8 0x0
1036#define MX6SX_PAD_RGMII1_RD1__PCIE_CTRL_DEBUG_1 0x01C4 0x050C 0x0000 0x9 0x0
1037#define MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 0x01C8 0x0510 0x0000 0x0 0x0
1038#define MX6SX_PAD_RGMII1_RD2__GPIO5_IO_2 0x01C8 0x0510 0x0000 0x5 0x0
1039#define MX6SX_PAD_RGMII1_RD2__CSI2_DATA_12 0x01C8 0x0510 0x0000 0x6 0x0
1040#define MX6SX_PAD_RGMII1_RD2__ANATOP_TESTI_2 0x01C8 0x0510 0x0000 0x7 0x0
1041#define MX6SX_PAD_RGMII1_RD2__USDHC2_TESTER_TRIGGER 0x01C8 0x0510 0x0000 0x8 0x0
1042#define MX6SX_PAD_RGMII1_RD2__PCIE_CTRL_DEBUG_2 0x01C8 0x0510 0x0000 0x9 0x0
1043#define MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x01CC 0x0514 0x0000 0x0 0x0
1044#define MX6SX_PAD_RGMII1_RD3__GPIO5_IO_3 0x01CC 0x0514 0x0000 0x5 0x0
1045#define MX6SX_PAD_RGMII1_RD3__CSI2_DATA_13 0x01CC 0x0514 0x0000 0x6 0x0
1046#define MX6SX_PAD_RGMII1_RD3__ANATOP_TESTI_3 0x01CC 0x0514 0x0000 0x7 0x0
1047#define MX6SX_PAD_RGMII1_RD3__USDHC3_TESTER_TRIGGER 0x01CC 0x0514 0x0000 0x8 0x0
1048#define MX6SX_PAD_RGMII1_RD3__PCIE_CTRL_DEBUG_3 0x01CC 0x0514 0x0000 0x9 0x0
1049#define MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x01D0 0x0518 0x0000 0x0 0x0
1050#define MX6SX_PAD_RGMII1_RX_CTL__GPIO5_IO_4 0x01D0 0x0518 0x0000 0x5 0x0
1051#define MX6SX_PAD_RGMII1_RX_CTL__CSI2_DATA_14 0x01D0 0x0518 0x0000 0x6 0x0
1052#define MX6SX_PAD_RGMII1_RX_CTL__ANATOP_TESTO_0 0x01D0 0x0518 0x0000 0x7 0x0
1053#define MX6SX_PAD_RGMII1_RX_CTL__USDHC4_TESTER_TRIGGER 0x01D0 0x0518 0x0000 0x8 0x0
1054#define MX6SX_PAD_RGMII1_RX_CTL__PCIE_CTRL_DEBUG_4 0x01D0 0x0518 0x0000 0x9 0x0
1055#define MX6SX_PAD_RGMII1_RXC__ENET1_RX_CLK 0x01D4 0x051C 0x0768 0x0 0x1
1056#define MX6SX_PAD_RGMII1_RXC__ENET1_RX_ER 0x01D4 0x051C 0x0000 0x1 0x0
1057#define MX6SX_PAD_RGMII1_RXC__GPIO5_IO_5 0x01D4 0x051C 0x0000 0x5 0x0
1058#define MX6SX_PAD_RGMII1_RXC__CSI2_DATA_15 0x01D4 0x051C 0x0000 0x6 0x0
1059#define MX6SX_PAD_RGMII1_RXC__ANATOP_TESTO_1 0x01D4 0x051C 0x0000 0x7 0x0
1060#define MX6SX_PAD_RGMII1_RXC__ECSPI1_TESTER_TRIGGER 0x01D4 0x051C 0x0000 0x8 0x0
1061#define MX6SX_PAD_RGMII1_RXC__PCIE_CTRL_DEBUG_5 0x01D4 0x051C 0x0000 0x9 0x0
1062#define MX6SX_PAD_RGMII1_TD0__ENET1_TX_DATA_0 0x01D8 0x0520 0x0000 0x0 0x0
1063#define MX6SX_PAD_RGMII1_TD0__SAI2_RX_SYNC 0x01D8 0x0520 0x0810 0x2 0x1
1064#define MX6SX_PAD_RGMII1_TD0__GPIO5_IO_6 0x01D8 0x0520 0x0000 0x5 0x0
1065#define MX6SX_PAD_RGMII1_TD0__CSI2_DATA_16 0x01D8 0x0520 0x0000 0x6 0x0
1066#define MX6SX_PAD_RGMII1_TD0__ANATOP_TESTO_2 0x01D8 0x0520 0x0000 0x7 0x0
1067#define MX6SX_PAD_RGMII1_TD0__ECSPI2_TESTER_TRIGGER 0x01D8 0x0520 0x0000 0x8 0x0
1068#define MX6SX_PAD_RGMII1_TD0__PCIE_CTRL_DEBUG_6 0x01D8 0x0520 0x0000 0x9 0x0
1069#define MX6SX_PAD_RGMII1_TD1__ENET1_TX_DATA_1 0x01DC 0x0524 0x0000 0x0 0x0
1070#define MX6SX_PAD_RGMII1_TD1__SAI2_RX_BCLK 0x01DC 0x0524 0x0808 0x2 0x1
1071#define MX6SX_PAD_RGMII1_TD1__GPIO5_IO_7 0x01DC 0x0524 0x0000 0x5 0x0
1072#define MX6SX_PAD_RGMII1_TD1__CSI2_DATA_17 0x01DC 0x0524 0x0000 0x6 0x0
1073#define MX6SX_PAD_RGMII1_TD1__ANATOP_TESTO_3 0x01DC 0x0524 0x0000 0x7 0x0
1074#define MX6SX_PAD_RGMII1_TD1__ECSPI3_TESTER_TRIGGER 0x01DC 0x0524 0x0000 0x8 0x0
1075#define MX6SX_PAD_RGMII1_TD1__PCIE_CTRL_DEBUG_7 0x01DC 0x0524 0x0000 0x9 0x0
1076#define MX6SX_PAD_RGMII1_TD2__ENET1_TX_DATA_2 0x01E0 0x0528 0x0000 0x0 0x0
1077#define MX6SX_PAD_RGMII1_TD2__SAI2_TX_SYNC 0x01E0 0x0528 0x0818 0x2 0x1
1078#define MX6SX_PAD_RGMII1_TD2__GPIO5_IO_8 0x01E0 0x0528 0x0000 0x5 0x0
1079#define MX6SX_PAD_RGMII1_TD2__CSI2_DATA_18 0x01E0 0x0528 0x0000 0x6 0x0
1080#define MX6SX_PAD_RGMII1_TD2__ANATOP_TESTO_4 0x01E0 0x0528 0x0000 0x7 0x0
1081#define MX6SX_PAD_RGMII1_TD2__ECSPI4_TESTER_TRIGGER 0x01E0 0x0528 0x0000 0x8 0x0
1082#define MX6SX_PAD_RGMII1_TD2__PCIE_CTRL_DEBUG_8 0x01E0 0x0528 0x0000 0x9 0x0
1083#define MX6SX_PAD_RGMII1_TD3__ENET1_TX_DATA_3 0x01E4 0x052C 0x0000 0x0 0x0
1084#define MX6SX_PAD_RGMII1_TD3__SAI2_TX_BCLK 0x01E4 0x052C 0x0814 0x2 0x1
1085#define MX6SX_PAD_RGMII1_TD3__GPIO5_IO_9 0x01E4 0x052C 0x0000 0x5 0x0
1086#define MX6SX_PAD_RGMII1_TD3__CSI2_DATA_19 0x01E4 0x052C 0x0000 0x6 0x0
1087#define MX6SX_PAD_RGMII1_TD3__ANATOP_TESTO_5 0x01E4 0x052C 0x0000 0x7 0x0
1088#define MX6SX_PAD_RGMII1_TD3__ECSPI5_TESTER_TRIGGER 0x01E4 0x052C 0x0000 0x8 0x0
1089#define MX6SX_PAD_RGMII1_TD3__PCIE_CTRL_DEBUG_9 0x01E4 0x052C 0x0000 0x9 0x0
1090#define MX6SX_PAD_RGMII1_TX_CTL__ENET1_TX_EN 0x01E8 0x0530 0x0000 0x0 0x0
1091#define MX6SX_PAD_RGMII1_TX_CTL__SAI2_RX_DATA_0 0x01E8 0x0530 0x080C 0x2 0x1
1092#define MX6SX_PAD_RGMII1_TX_CTL__GPIO5_IO_10 0x01E8 0x0530 0x0000 0x5 0x0
1093#define MX6SX_PAD_RGMII1_TX_CTL__CSI2_DATA_0 0x01E8 0x0530 0x0000 0x6 0x0
1094#define MX6SX_PAD_RGMII1_TX_CTL__ANATOP_TESTO_6 0x01E8 0x0530 0x0000 0x7 0x0
1095#define MX6SX_PAD_RGMII1_TX_CTL__QSPI1_TESTER_TRIGGER 0x01E8 0x0530 0x0000 0x8 0x0
1096#define MX6SX_PAD_RGMII1_TX_CTL__PCIE_CTRL_DEBUG_10 0x01E8 0x0530 0x0000 0x9 0x0
1097#define MX6SX_PAD_RGMII1_TXC__ENET1_RGMII_TXC 0x01EC 0x0534 0x0000 0x0 0x0
1098#define MX6SX_PAD_RGMII1_TXC__ENET1_TX_ER 0x01EC 0x0534 0x0000 0x1 0x0
1099#define MX6SX_PAD_RGMII1_TXC__SAI2_TX_DATA_0 0x01EC 0x0534 0x0000 0x2 0x0
1100#define MX6SX_PAD_RGMII1_TXC__GPIO5_IO_11 0x01EC 0x0534 0x0000 0x5 0x0
1101#define MX6SX_PAD_RGMII1_TXC__CSI2_DATA_1 0x01EC 0x0534 0x0000 0x6 0x0
1102#define MX6SX_PAD_RGMII1_TXC__ANATOP_TESTO_7 0x01EC 0x0534 0x0000 0x7 0x0
1103#define MX6SX_PAD_RGMII1_TXC__QSPI2_TESTER_TRIGGER 0x01EC 0x0534 0x0000 0x8 0x0
1104#define MX6SX_PAD_RGMII1_TXC__PCIE_CTRL_DEBUG_11 0x01EC 0x0534 0x0000 0x9 0x0
1105#define MX6SX_PAD_RGMII2_RD0__ENET2_RX_DATA_0 0x01F0 0x0538 0x0000 0x0 0x0
1106#define MX6SX_PAD_RGMII2_RD0__PWM4_OUT 0x01F0 0x0538 0x0000 0x2 0x0
1107#define MX6SX_PAD_RGMII2_RD0__GPIO5_IO_12 0x01F0 0x0538 0x0000 0x5 0x0
1108#define MX6SX_PAD_RGMII2_RD0__CSI2_DATA_2 0x01F0 0x0538 0x0000 0x6 0x0
1109#define MX6SX_PAD_RGMII2_RD0__ANATOP_TESTO_8 0x01F0 0x0538 0x0000 0x7 0x0
1110#define MX6SX_PAD_RGMII2_RD0__VDEC_DEBUG_18 0x01F0 0x0538 0x0000 0x8 0x0
1111#define MX6SX_PAD_RGMII2_RD0__PCIE_CTRL_DEBUG_12 0x01F0 0x0538 0x0000 0x9 0x0
1112#define MX6SX_PAD_RGMII2_RD1__ENET2_RX_DATA_1 0x01F4 0x053C 0x0000 0x0 0x0
1113#define MX6SX_PAD_RGMII2_RD1__PWM3_OUT 0x01F4 0x053C 0x0000 0x2 0x0
1114#define MX6SX_PAD_RGMII2_RD1__GPIO5_IO_13 0x01F4 0x053C 0x0000 0x5 0x0
1115#define MX6SX_PAD_RGMII2_RD1__CSI2_DATA_3 0x01F4 0x053C 0x0000 0x6 0x0
1116#define MX6SX_PAD_RGMII2_RD1__ANATOP_TESTO_9 0x01F4 0x053C 0x0000 0x7 0x0
1117#define MX6SX_PAD_RGMII2_RD1__VDEC_DEBUG_19 0x01F4 0x053C 0x0000 0x8 0x0
1118#define MX6SX_PAD_RGMII2_RD1__PCIE_CTRL_DEBUG_13 0x01F4 0x053C 0x0000 0x9 0x0
1119#define MX6SX_PAD_RGMII2_RD2__ENET2_RX_DATA_2 0x01F8 0x0540 0x0000 0x0 0x0
1120#define MX6SX_PAD_RGMII2_RD2__PWM2_OUT 0x01F8 0x0540 0x0000 0x2 0x0
1121#define MX6SX_PAD_RGMII2_RD2__GPIO5_IO_14 0x01F8 0x0540 0x0000 0x5 0x0
1122#define MX6SX_PAD_RGMII2_RD2__CSI2_DATA_4 0x01F8 0x0540 0x0000 0x6 0x0
1123#define MX6SX_PAD_RGMII2_RD2__ANATOP_TESTO_10 0x01F8 0x0540 0x0000 0x7 0x0
1124#define MX6SX_PAD_RGMII2_RD2__VDEC_DEBUG_20 0x01F8 0x0540 0x0000 0x8 0x0
1125#define MX6SX_PAD_RGMII2_RD2__PCIE_CTRL_DEBUG_14 0x01F8 0x0540 0x0000 0x9 0x0
1126#define MX6SX_PAD_RGMII2_RD3__ENET2_RX_DATA_3 0x01FC 0x0544 0x0000 0x0 0x0
1127#define MX6SX_PAD_RGMII2_RD3__PWM1_OUT 0x01FC 0x0544 0x0000 0x2 0x0
1128#define MX6SX_PAD_RGMII2_RD3__GPIO5_IO_15 0x01FC 0x0544 0x0000 0x5 0x0
1129#define MX6SX_PAD_RGMII2_RD3__CSI2_DATA_5 0x01FC 0x0544 0x0000 0x6 0x0
1130#define MX6SX_PAD_RGMII2_RD3__ANATOP_TESTO_11 0x01FC 0x0544 0x0000 0x7 0x0
1131#define MX6SX_PAD_RGMII2_RD3__VDEC_DEBUG_21 0x01FC 0x0544 0x0000 0x8 0x0
1132#define MX6SX_PAD_RGMII2_RD3__PCIE_CTRL_DEBUG_15 0x01FC 0x0544 0x0000 0x9 0x0
1133#define MX6SX_PAD_RGMII2_RX_CTL__ENET2_RX_EN 0x0200 0x0548 0x0000 0x0 0x0
1134#define MX6SX_PAD_RGMII2_RX_CTL__GPIO5_IO_16 0x0200 0x0548 0x0000 0x5 0x0
1135#define MX6SX_PAD_RGMII2_RX_CTL__CSI2_DATA_6 0x0200 0x0548 0x0000 0x6 0x0
1136#define MX6SX_PAD_RGMII2_RX_CTL__ANATOP_TESTO_12 0x0200 0x0548 0x0000 0x7 0x0
1137#define MX6SX_PAD_RGMII2_RX_CTL__VDEC_DEBUG_22 0x0200 0x0548 0x0000 0x8 0x0
1138#define MX6SX_PAD_RGMII2_RX_CTL__PCIE_CTRL_DEBUG_16 0x0200 0x0548 0x0000 0x9 0x0
1139#define MX6SX_PAD_RGMII2_RXC__ENET2_RX_CLK 0x0204 0x054C 0x0774 0x0 0x1
1140#define MX6SX_PAD_RGMII2_RXC__ENET2_RX_ER 0x0204 0x054C 0x0000 0x1 0x0
1141#define MX6SX_PAD_RGMII2_RXC__GPIO5_IO_17 0x0204 0x054C 0x0000 0x5 0x0
1142#define MX6SX_PAD_RGMII2_RXC__CSI2_DATA_7 0x0204 0x054C 0x0000 0x6 0x0
1143#define MX6SX_PAD_RGMII2_RXC__ANATOP_TESTO_13 0x0204 0x054C 0x0000 0x7 0x0
1144#define MX6SX_PAD_RGMII2_RXC__VDEC_DEBUG_23 0x0204 0x054C 0x0000 0x8 0x0
1145#define MX6SX_PAD_RGMII2_RXC__PCIE_CTRL_DEBUG_17 0x0204 0x054C 0x0000 0x9 0x0
1146#define MX6SX_PAD_RGMII2_TD0__ENET2_TX_DATA_0 0x0208 0x0550 0x0000 0x0 0x0
1147#define MX6SX_PAD_RGMII2_TD0__SAI1_RX_SYNC 0x0208 0x0550 0x07FC 0x2 0x1
1148#define MX6SX_PAD_RGMII2_TD0__PWM8_OUT 0x0208 0x0550 0x0000 0x3 0x0
1149#define MX6SX_PAD_RGMII2_TD0__GPIO5_IO_18 0x0208 0x0550 0x0000 0x5 0x0
1150#define MX6SX_PAD_RGMII2_TD0__CSI2_DATA_8 0x0208 0x0550 0x0000 0x6 0x0
1151#define MX6SX_PAD_RGMII2_TD0__ANATOP_TESTO_14 0x0208 0x0550 0x0000 0x7 0x0
1152#define MX6SX_PAD_RGMII2_TD0__VDEC_DEBUG_24 0x0208 0x0550 0x0000 0x8 0x0
1153#define MX6SX_PAD_RGMII2_TD0__PCIE_CTRL_DEBUG_18 0x0208 0x0550 0x0000 0x9 0x0
1154#define MX6SX_PAD_RGMII2_TD1__ENET2_TX_DATA_1 0x020C 0x0554 0x0000 0x0 0x0
1155#define MX6SX_PAD_RGMII2_TD1__SAI1_RX_BCLK 0x020C 0x0554 0x07F4 0x2 0x1
1156#define MX6SX_PAD_RGMII2_TD1__PWM7_OUT 0x020C 0x0554 0x0000 0x3 0x0
1157#define MX6SX_PAD_RGMII2_TD1__GPIO5_IO_19 0x020C 0x0554 0x0000 0x5 0x0
1158#define MX6SX_PAD_RGMII2_TD1__CSI2_DATA_9 0x020C 0x0554 0x0000 0x6 0x0
1159#define MX6SX_PAD_RGMII2_TD1__ANATOP_TESTO_15 0x020C 0x0554 0x0000 0x7 0x0
1160#define MX6SX_PAD_RGMII2_TD1__VDEC_DEBUG_25 0x020C 0x0554 0x0000 0x8 0x0
1161#define MX6SX_PAD_RGMII2_TD1__PCIE_CTRL_DEBUG_19 0x020C 0x0554 0x0000 0x9 0x0
1162#define MX6SX_PAD_RGMII2_TD2__ENET2_TX_DATA_2 0x0210 0x0558 0x0000 0x0 0x0
1163#define MX6SX_PAD_RGMII2_TD2__SAI1_TX_SYNC 0x0210 0x0558 0x0804 0x2 0x1
1164#define MX6SX_PAD_RGMII2_TD2__PWM6_OUT 0x0210 0x0558 0x0000 0x3 0x0
1165#define MX6SX_PAD_RGMII2_TD2__GPIO5_IO_20 0x0210 0x0558 0x0000 0x5 0x0
1166#define MX6SX_PAD_RGMII2_TD2__CSI2_VSYNC 0x0210 0x0558 0x0000 0x6 0x0
1167#define MX6SX_PAD_RGMII2_TD2__SJC_FAIL 0x0210 0x0558 0x0000 0x7 0x0
1168#define MX6SX_PAD_RGMII2_TD2__VDEC_DEBUG_26 0x0210 0x0558 0x0000 0x8 0x0
1169#define MX6SX_PAD_RGMII2_TD2__PCIE_CTRL_DEBUG_20 0x0210 0x0558 0x0000 0x9 0x0
1170#define MX6SX_PAD_RGMII2_TD3__ENET2_TX_DATA_3 0x0214 0x055C 0x0000 0x0 0x0
1171#define MX6SX_PAD_RGMII2_TD3__SAI1_TX_BCLK 0x0214 0x055C 0x0800 0x2 0x1
1172#define MX6SX_PAD_RGMII2_TD3__PWM5_OUT 0x0214 0x055C 0x0000 0x3 0x0
1173#define MX6SX_PAD_RGMII2_TD3__GPIO5_IO_21 0x0214 0x055C 0x0000 0x5 0x0
1174#define MX6SX_PAD_RGMII2_TD3__CSI2_HSYNC 0x0214 0x055C 0x0000 0x6 0x0
1175#define MX6SX_PAD_RGMII2_TD3__SJC_JTAG_ACT 0x0214 0x055C 0x0000 0x7 0x0
1176#define MX6SX_PAD_RGMII2_TD3__VDEC_DEBUG_27 0x0214 0x055C 0x0000 0x8 0x0
1177#define MX6SX_PAD_RGMII2_TD3__PCIE_CTRL_DEBUG_21 0x0214 0x055C 0x0000 0x9 0x0
1178#define MX6SX_PAD_RGMII2_TX_CTL__ENET2_TX_EN 0x0218 0x0560 0x0000 0x0 0x0
1179#define MX6SX_PAD_RGMII2_TX_CTL__SAI1_RX_DATA_0 0x0218 0x0560 0x07F8 0x2 0x1
1180#define MX6SX_PAD_RGMII2_TX_CTL__GPIO5_IO_22 0x0218 0x0560 0x0000 0x5 0x0
1181#define MX6SX_PAD_RGMII2_TX_CTL__CSI2_FIELD 0x0218 0x0560 0x0000 0x6 0x0
1182#define MX6SX_PAD_RGMII2_TX_CTL__SJC_DE_B 0x0218 0x0560 0x0000 0x7 0x0
1183#define MX6SX_PAD_RGMII2_TX_CTL__VDEC_DEBUG_28 0x0218 0x0560 0x0000 0x8 0x0
1184#define MX6SX_PAD_RGMII2_TX_CTL__PCIE_CTRL_DEBUG_22 0x0218 0x0560 0x0000 0x9 0x0
1185#define MX6SX_PAD_RGMII2_TXC__ENET2_RGMII_TXC 0x021C 0x0564 0x0000 0x0 0x0
1186#define MX6SX_PAD_RGMII2_TXC__ENET2_TX_ER 0x021C 0x0564 0x0000 0x1 0x0
1187#define MX6SX_PAD_RGMII2_TXC__SAI1_TX_DATA_0 0x021C 0x0564 0x0000 0x2 0x0
1188#define MX6SX_PAD_RGMII2_TXC__GPIO5_IO_23 0x021C 0x0564 0x0000 0x5 0x0
1189#define MX6SX_PAD_RGMII2_TXC__CSI2_PIXCLK 0x021C 0x0564 0x0000 0x6 0x0
1190#define MX6SX_PAD_RGMII2_TXC__SJC_DONE 0x021C 0x0564 0x0000 0x7 0x0
1191#define MX6SX_PAD_RGMII2_TXC__VDEC_DEBUG_29 0x021C 0x0564 0x0000 0x8 0x0
1192#define MX6SX_PAD_RGMII2_TXC__PCIE_CTRL_DEBUG_23 0x021C 0x0564 0x0000 0x9 0x0
1193#define MX6SX_PAD_SD1_CLK__USDHC1_CLK 0x0220 0x0568 0x0000 0x0 0x0
1194#define MX6SX_PAD_SD1_CLK__AUDMUX_AUD5_RXFS 0x0220 0x0568 0x0668 0x1 0x1
1195#define MX6SX_PAD_SD1_CLK__WDOG2_WDOG_B 0x0220 0x0568 0x0000 0x2 0x0
1196#define MX6SX_PAD_SD1_CLK__GPT_CLK 0x0220 0x0568 0x0000 0x3 0x0
1197#define MX6SX_PAD_SD1_CLK__WDOG2_WDOG_RST_B_DEB 0x0220 0x0568 0x0000 0x4 0x0
1198#define MX6SX_PAD_SD1_CLK__GPIO6_IO_0 0x0220 0x0568 0x0000 0x5 0x0
1199#define MX6SX_PAD_SD1_CLK__ENET2_1588_EVENT1_OUT 0x0220 0x0568 0x0000 0x6 0x0
1200#define MX6SX_PAD_SD1_CLK__CCM_OUT1 0x0220 0x0568 0x0000 0x7 0x0
1201#define MX6SX_PAD_SD1_CLK__VADC_ADC_PROC_CLK 0x0220 0x0568 0x0000 0x8 0x0
1202#define MX6SX_PAD_SD1_CLK__MMDC_DEBUG_45 0x0220 0x0568 0x0000 0x9 0x0
1203#define MX6SX_PAD_SD1_CMD__USDHC1_CMD 0x0224 0x056C 0x0000 0x0 0x0
1204#define MX6SX_PAD_SD1_CMD__AUDMUX_AUD5_RXC 0x0224 0x056C 0x0664 0x1 0x1
1205#define MX6SX_PAD_SD1_CMD__WDOG1_WDOG_B 0x0224 0x056C 0x0000 0x2 0x0
1206#define MX6SX_PAD_SD1_CMD__GPT_COMPARE1 0x0224 0x056C 0x0000 0x3 0x0
1207#define MX6SX_PAD_SD1_CMD__WDOG1_WDOG_RST_B_DEB 0x0224 0x056C 0x0000 0x4 0x0
1208#define MX6SX_PAD_SD1_CMD__GPIO6_IO_1 0x0224 0x056C 0x0000 0x5 0x0
1209#define MX6SX_PAD_SD1_CMD__ENET2_1588_EVENT1_IN 0x0224 0x056C 0x0000 0x6 0x0
1210#define MX6SX_PAD_SD1_CMD__CCM_CLKO1 0x0224 0x056C 0x0000 0x7 0x0
1211#define MX6SX_PAD_SD1_CMD__VADC_EXT_SYSCLK 0x0224 0x056C 0x0000 0x8 0x0
1212#define MX6SX_PAD_SD1_CMD__MMDC_DEBUG_46 0x0224 0x056C 0x0000 0x9 0x0
1213#define MX6SX_PAD_SD1_DATA0__USDHC1_DATA0 0x0228 0x0570 0x0000 0x0 0x0
1214#define MX6SX_PAD_SD1_DATA0__AUDMUX_AUD5_RXD 0x0228 0x0570 0x065C 0x1 0x1
1215#define MX6SX_PAD_SD1_DATA0__CAAM_WRAPPER_RNG_OSC_OBS 0x0228 0x0570 0x0000 0x2 0x0
1216#define MX6SX_PAD_SD1_DATA0__GPT_CAPTURE1 0x0228 0x0570 0x0000 0x3 0x0
1217#define MX6SX_PAD_SD1_DATA0__UART2_RX 0x0228 0x0570 0x0838 0x4 0x2
1218#define MX6SX_PAD_SD1_DATA0__UART2_TX 0x0228 0x0570 0x0000 0x4 0x0
1219#define MX6SX_PAD_SD1_DATA0__GPIO6_IO_2 0x0228 0x0570 0x0000 0x5 0x0
1220#define MX6SX_PAD_SD1_DATA0__ENET1_1588_EVENT1_IN 0x0228 0x0570 0x0000 0x6 0x0
1221#define MX6SX_PAD_SD1_DATA0__CCM_OUT2 0x0228 0x0570 0x0000 0x7 0x0
1222#define MX6SX_PAD_SD1_DATA0__VADC_CLAMP_UP 0x0228 0x0570 0x0000 0x8 0x0
1223#define MX6SX_PAD_SD1_DATA0__MMDC_DEBUG_48 0x0228 0x0570 0x0000 0x9 0x0
1224#define MX6SX_PAD_SD1_DATA1__USDHC1_DATA1 0x022C 0x0574 0x0000 0x0 0x0
1225#define MX6SX_PAD_SD1_DATA1__AUDMUX_AUD5_TXC 0x022C 0x0574 0x066C 0x1 0x1
1226#define MX6SX_PAD_SD1_DATA1__PWM4_OUT 0x022C 0x0574 0x0000 0x2 0x0
1227#define MX6SX_PAD_SD1_DATA1__GPT_CAPTURE2 0x022C 0x0574 0x0000 0x3 0x0
1228#define MX6SX_PAD_SD1_DATA1__UART2_RX 0x022C 0x0574 0x0838 0x4 0x3
1229#define MX6SX_PAD_SD1_DATA1__UART2_TX 0x022C 0x0574 0x0000 0x4 0x0
1230#define MX6SX_PAD_SD1_DATA1__GPIO6_IO_3 0x022C 0x0574 0x0000 0x5 0x0
1231#define MX6SX_PAD_SD1_DATA1__ENET1_1588_EVENT1_OUT 0x022C 0x0574 0x0000 0x6 0x0
1232#define MX6SX_PAD_SD1_DATA1__CCM_CLKO2 0x022C 0x0574 0x0000 0x7 0x0
1233#define MX6SX_PAD_SD1_DATA1__VADC_CLAMP_DOWN 0x022C 0x0574 0x0000 0x8 0x0
1234#define MX6SX_PAD_SD1_DATA1__MMDC_DEBUG_47 0x022C 0x0574 0x0000 0x9 0x0
1235#define MX6SX_PAD_SD1_DATA2__USDHC1_DATA2 0x0230 0x0578 0x0000 0x0 0x0
1236#define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1
1237#define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0
1238#define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0
1239#define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0834 0x4 0x2
1240#define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0
1241#define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0
1242#define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0
1243#define MX6SX_PAD_SD1_DATA2__VADC_EXT_PD_N 0x0230 0x0578 0x0000 0x8 0x0
1244#define MX6SX_PAD_SD1_DATA3__USDHC1_DATA3 0x0234 0x057C 0x0000 0x0 0x0
1245#define MX6SX_PAD_SD1_DATA3__AUDMUX_AUD5_TXD 0x0234 0x057C 0x0660 0x1 0x1
1246#define MX6SX_PAD_SD1_DATA3__AUDMUX_AUD5_RXD 0x0234 0x057C 0x065C 0x2 0x2
1247#define MX6SX_PAD_SD1_DATA3__GPT_COMPARE3 0x0234 0x057C 0x0000 0x3 0x0
1248#define MX6SX_PAD_SD1_DATA3__UART2_RTS_B 0x0234 0x057C 0x0834 0x4 0x3
1249#define MX6SX_PAD_SD1_DATA3__GPIO6_IO_5 0x0234 0x057C 0x0000 0x5 0x0
1250#define MX6SX_PAD_SD1_DATA3__ECSPI4_SS1 0x0234 0x057C 0x0000 0x6 0x0
1251#define MX6SX_PAD_SD1_DATA3__CCM_PMIC_RDY 0x0234 0x057C 0x069C 0x7 0x2
1252#define MX6SX_PAD_SD1_DATA3__VADC_RST_N 0x0234 0x057C 0x0000 0x8 0x0
1253#define MX6SX_PAD_SD2_CLK__USDHC2_CLK 0x0238 0x0580 0x0000 0x0 0x0
1254#define MX6SX_PAD_SD2_CLK__AUDMUX_AUD6_RXFS 0x0238 0x0580 0x0680 0x1 0x2
1255#define MX6SX_PAD_SD2_CLK__KPP_COL_5 0x0238 0x0580 0x07C8 0x2 0x1
1256#define MX6SX_PAD_SD2_CLK__ECSPI4_SCLK 0x0238 0x0580 0x0740 0x3 0x1
1257#define MX6SX_PAD_SD2_CLK__MLB_SIG 0x0238 0x0580 0x07F0 0x4 0x2
1258#define MX6SX_PAD_SD2_CLK__GPIO6_IO_6 0x0238 0x0580 0x0000 0x5 0x0
1259#define MX6SX_PAD_SD2_CLK__MQS_RIGHT 0x0238 0x0580 0x0000 0x6 0x0
1260#define MX6SX_PAD_SD2_CLK__WDOG1_WDOG_ANY 0x0238 0x0580 0x0000 0x7 0x0
1261#define MX6SX_PAD_SD2_CLK__VADC_CLAMP_CURRENT_5 0x0238 0x0580 0x0000 0x8 0x0
1262#define MX6SX_PAD_SD2_CLK__MMDC_DEBUG_29 0x0238 0x0580 0x0000 0x9 0x0
1263#define MX6SX_PAD_SD2_CMD__USDHC2_CMD 0x023C 0x0584 0x0000 0x0 0x0
1264#define MX6SX_PAD_SD2_CMD__AUDMUX_AUD6_RXC 0x023C 0x0584 0x067C 0x1 0x2
1265#define MX6SX_PAD_SD2_CMD__KPP_ROW_5 0x023C 0x0584 0x07D4 0x2 0x1
1266#define MX6SX_PAD_SD2_CMD__ECSPI4_MOSI 0x023C 0x0584 0x0748 0x3 0x1
1267#define MX6SX_PAD_SD2_CMD__MLB_CLK 0x023C 0x0584 0x07E8 0x4 0x2
1268#define MX6SX_PAD_SD2_CMD__GPIO6_IO_7 0x023C 0x0584 0x0000 0x5 0x0
1269#define MX6SX_PAD_SD2_CMD__MQS_LEFT 0x023C 0x0584 0x0000 0x6 0x0
1270#define MX6SX_PAD_SD2_CMD__WDOG3_WDOG_B 0x023C 0x0584 0x0000 0x7 0x0
1271#define MX6SX_PAD_SD2_CMD__VADC_CLAMP_CURRENT_4 0x023C 0x0584 0x0000 0x8 0x0
1272#define MX6SX_PAD_SD2_CMD__MMDC_DEBUG_30 0x023C 0x0584 0x0000 0x9 0x0
1273#define MX6SX_PAD_SD2_DATA0__USDHC2_DATA0 0x0240 0x0588 0x0000 0x0 0x0
1274#define MX6SX_PAD_SD2_DATA0__AUDMUX_AUD6_RXD 0x0240 0x0588 0x0674 0x1 0x2
1275#define MX6SX_PAD_SD2_DATA0__KPP_ROW_7 0x0240 0x0588 0x07DC 0x2 0x1
1276#define MX6SX_PAD_SD2_DATA0__PWM1_OUT 0x0240 0x0588 0x0000 0x3 0x0
1277#define MX6SX_PAD_SD2_DATA0__I2C4_SDA 0x0240 0x0588 0x07C4 0x4 0x3
1278#define MX6SX_PAD_SD2_DATA0__GPIO6_IO_8 0x0240 0x0588 0x0000 0x5 0x0
1279#define MX6SX_PAD_SD2_DATA0__ECSPI4_SS3 0x0240 0x0588 0x0000 0x6 0x0
1280#define MX6SX_PAD_SD2_DATA0__UART4_RX 0x0240 0x0588 0x0848 0x7 0x4
1281#define MX6SX_PAD_SD2_DATA0__UART4_TX 0x0240 0x0588 0x0000 0x7 0x0
1282#define MX6SX_PAD_SD2_DATA0__VADC_CLAMP_CURRENT_0 0x0240 0x0588 0x0000 0x8 0x0
1283#define MX6SX_PAD_SD2_DATA0__MMDC_DEBUG_50 0x0240 0x0588 0x0000 0x9 0x0
1284#define MX6SX_PAD_SD2_DATA1__USDHC2_DATA1 0x0244 0x058C 0x0000 0x0 0x0
1285#define MX6SX_PAD_SD2_DATA1__AUDMUX_AUD6_TXC 0x0244 0x058C 0x0684 0x1 0x2
1286#define MX6SX_PAD_SD2_DATA1__KPP_COL_7 0x0244 0x058C 0x07D0 0x2 0x1
1287#define MX6SX_PAD_SD2_DATA1__PWM2_OUT 0x0244 0x058C 0x0000 0x3 0x0
1288#define MX6SX_PAD_SD2_DATA1__I2C4_SCL 0x0244 0x058C 0x07C0 0x4 0x3
1289#define MX6SX_PAD_SD2_DATA1__GPIO6_IO_9 0x0244 0x058C 0x0000 0x5 0x0
1290#define MX6SX_PAD_SD2_DATA1__ECSPI4_SS2 0x0244 0x058C 0x0000 0x6 0x0
1291#define MX6SX_PAD_SD2_DATA1__UART4_RX 0x0244 0x058C 0x0848 0x7 0x5
1292#define MX6SX_PAD_SD2_DATA1__UART4_TX 0x0244 0x058C 0x0000 0x7 0x0
1293#define MX6SX_PAD_SD2_DATA1__VADC_CLAMP_CURRENT_1 0x0244 0x058C 0x0000 0x8 0x0
1294#define MX6SX_PAD_SD2_DATA1__MMDC_DEBUG_49 0x0244 0x058C 0x0000 0x9 0x0
1295#define MX6SX_PAD_SD2_DATA2__USDHC2_DATA2 0x0248 0x0590 0x0000 0x0 0x0
1296#define MX6SX_PAD_SD2_DATA2__AUDMUX_AUD6_TXFS 0x0248 0x0590 0x0688 0x1 0x2
1297#define MX6SX_PAD_SD2_DATA2__KPP_ROW_6 0x0248 0x0590 0x07D8 0x2 0x1
1298#define MX6SX_PAD_SD2_DATA2__ECSPI4_SS0 0x0248 0x0590 0x074C 0x3 0x1
1299#define MX6SX_PAD_SD2_DATA2__SDMA_EXT_EVENT_0 0x0248 0x0590 0x081C 0x4 0x2
1300#define MX6SX_PAD_SD2_DATA2__GPIO6_IO_10 0x0248 0x0590 0x0000 0x5 0x0
1301#define MX6SX_PAD_SD2_DATA2__SPDIF_OUT 0x0248 0x0590 0x0000 0x6 0x0
1302#define MX6SX_PAD_SD2_DATA2__UART6_RX 0x0248 0x0590 0x0858 0x7 0x4
1303#define MX6SX_PAD_SD2_DATA2__UART6_TX 0x0248 0x0590 0x0000 0x7 0x0
1304#define MX6SX_PAD_SD2_DATA2__VADC_CLAMP_CURRENT_2 0x0248 0x0590 0x0000 0x8 0x0
1305#define MX6SX_PAD_SD2_DATA2__MMDC_DEBUG_32 0x0248 0x0590 0x0000 0x9 0x0
1306#define MX6SX_PAD_SD2_DATA3__USDHC2_DATA3 0x024C 0x0594 0x0000 0x0 0x0
1307#define MX6SX_PAD_SD2_DATA3__AUDMUX_AUD6_TXD 0x024C 0x0594 0x0678 0x1 0x2
1308#define MX6SX_PAD_SD2_DATA3__KPP_COL_6 0x024C 0x0594 0x07CC 0x2 0x1
1309#define MX6SX_PAD_SD2_DATA3__ECSPI4_MISO 0x024C 0x0594 0x0744 0x3 0x1
1310#define MX6SX_PAD_SD2_DATA3__MLB_DATA 0x024C 0x0594 0x07EC 0x4 0x2
1311#define MX6SX_PAD_SD2_DATA3__GPIO6_IO_11 0x024C 0x0594 0x0000 0x5 0x0
1312#define MX6SX_PAD_SD2_DATA3__SPDIF_IN 0x024C 0x0594 0x0824 0x6 0x4
1313#define MX6SX_PAD_SD2_DATA3__UART6_RX 0x024C 0x0594 0x0858 0x7 0x5
1314#define MX6SX_PAD_SD2_DATA3__UART6_TX 0x024C 0x0594 0x0000 0x7 0x0
1315#define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0
1316#define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0
1317#define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0
1318#define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0844 0x1 0x0
1319#define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0
1320#define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0
1321#define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0
1322#define MX6SX_PAD_SD3_CLK__GPIO7_IO_0 0x0250 0x0598 0x0000 0x5 0x0
1323#define MX6SX_PAD_SD3_CLK__LCDIF2_BUSY 0x0250 0x0598 0x07E4 0x6 0x0
1324#define MX6SX_PAD_SD3_CLK__TPSMP_HDATA_29 0x0250 0x0598 0x0000 0x7 0x0
1325#define MX6SX_PAD_SD3_CLK__SDMA_DEBUG_EVENT_CHANNEL_5 0x0250 0x0598 0x0000 0x9 0x0
1326#define MX6SX_PAD_SD3_CMD__USDHC3_CMD 0x0254 0x059C 0x0000 0x0 0x0
1327#define MX6SX_PAD_SD3_CMD__UART4_RX 0x0254 0x059C 0x0848 0x1 0x0
1328#define MX6SX_PAD_SD3_CMD__UART4_TX 0x0254 0x059C 0x0000 0x1 0x0
1329#define MX6SX_PAD_SD3_CMD__ECSPI4_MOSI 0x0254 0x059C 0x0748 0x2 0x0
1330#define MX6SX_PAD_SD3_CMD__AUDMUX_AUD6_RXC 0x0254 0x059C 0x067C 0x3 0x0
1331#define MX6SX_PAD_SD3_CMD__LCDIF2_HSYNC 0x0254 0x059C 0x07E4 0x4 0x1
1332#define MX6SX_PAD_SD3_CMD__GPIO7_IO_1 0x0254 0x059C 0x0000 0x5 0x0
1333#define MX6SX_PAD_SD3_CMD__LCDIF2_RS 0x0254 0x059C 0x0000 0x6 0x0
1334#define MX6SX_PAD_SD3_CMD__TPSMP_HDATA_28 0x0254 0x059C 0x0000 0x7 0x0
1335#define MX6SX_PAD_SD3_CMD__SDMA_DEBUG_EVENT_CHANNEL_4 0x0254 0x059C 0x0000 0x9 0x0
1336#define MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 0x0258 0x05A0 0x0000 0x0 0x0
1337#define MX6SX_PAD_SD3_DATA0__I2C4_SCL 0x0258 0x05A0 0x07C0 0x1 0x0
1338#define MX6SX_PAD_SD3_DATA0__ECSPI2_SS1 0x0258 0x05A0 0x0000 0x2 0x0
1339#define MX6SX_PAD_SD3_DATA0__AUDMUX_AUD6_RXD 0x0258 0x05A0 0x0674 0x3 0x0
1340#define MX6SX_PAD_SD3_DATA0__LCDIF2_DATA_1 0x0258 0x05A0 0x0000 0x4 0x0
1341#define MX6SX_PAD_SD3_DATA0__GPIO7_IO_2 0x0258 0x05A0 0x0000 0x5 0x0
1342#define MX6SX_PAD_SD3_DATA0__DCIC1_OUT 0x0258 0x05A0 0x0000 0x6 0x0
1343#define MX6SX_PAD_SD3_DATA0__TPSMP_HDATA_30 0x0258 0x05A0 0x0000 0x7 0x0
1344#define MX6SX_PAD_SD3_DATA0__GPU_DEBUG_0 0x0258 0x05A0 0x0000 0x8 0x0
1345#define MX6SX_PAD_SD3_DATA0__SDMA_DEBUG_EVT_CHN_LINES_0 0x0258 0x05A0 0x0000 0x9 0x0
1346#define MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 0x025C 0x05A4 0x0000 0x0 0x0
1347#define MX6SX_PAD_SD3_DATA1__I2C4_SDA 0x025C 0x05A4 0x07C4 0x1 0x0
1348#define MX6SX_PAD_SD3_DATA1__ECSPI2_SS2 0x025C 0x05A4 0x0000 0x2 0x0
1349#define MX6SX_PAD_SD3_DATA1__AUDMUX_AUD6_TXC 0x025C 0x05A4 0x0684 0x3 0x0
1350#define MX6SX_PAD_SD3_DATA1__LCDIF2_DATA_0 0x025C 0x05A4 0x0000 0x4 0x0
1351#define MX6SX_PAD_SD3_DATA1__GPIO7_IO_3 0x025C 0x05A4 0x0000 0x5 0x0
1352#define MX6SX_PAD_SD3_DATA1__DCIC2_OUT 0x025C 0x05A4 0x0000 0x6 0x0
1353#define MX6SX_PAD_SD3_DATA1__TPSMP_HDATA_31 0x025C 0x05A4 0x0000 0x7 0x0
1354#define MX6SX_PAD_SD3_DATA1__GPU_DEBUG_1 0x025C 0x05A4 0x0000 0x8 0x0
1355#define MX6SX_PAD_SD3_DATA1__SDMA_DEBUG_EVT_CHN_LINES_1 0x025C 0x05A4 0x0000 0x9 0x0
1356#define MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 0x0260 0x05A8 0x0000 0x0 0x0
1357#define MX6SX_PAD_SD3_DATA2__UART4_RTS_B 0x0260 0x05A8 0x0844 0x1 0x1
1358#define MX6SX_PAD_SD3_DATA2__ECSPI4_SS0 0x0260 0x05A8 0x074C 0x2 0x0
1359#define MX6SX_PAD_SD3_DATA2__AUDMUX_AUD6_TXFS 0x0260 0x05A8 0x0688 0x3 0x0
1360#define MX6SX_PAD_SD3_DATA2__LCDIF2_CLK 0x0260 0x05A8 0x0000 0x4 0x0
1361#define MX6SX_PAD_SD3_DATA2__GPIO7_IO_4 0x0260 0x05A8 0x0000 0x5 0x0
1362#define MX6SX_PAD_SD3_DATA2__LCDIF2_WR_RWN 0x0260 0x05A8 0x0000 0x6 0x0
1363#define MX6SX_PAD_SD3_DATA2__TPSMP_HDATA_26 0x0260 0x05A8 0x0000 0x7 0x0
1364#define MX6SX_PAD_SD3_DATA2__GPU_DEBUG_2 0x0260 0x05A8 0x0000 0x8 0x0
1365#define MX6SX_PAD_SD3_DATA2__SDMA_DEBUG_EVENT_CHANNEL_2 0x0260 0x05A8 0x0000 0x9 0x0
1366#define MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 0x0264 0x05AC 0x0000 0x0 0x0
1367#define MX6SX_PAD_SD3_DATA3__UART4_RX 0x0264 0x05AC 0x0848 0x1 0x1
1368#define MX6SX_PAD_SD3_DATA3__UART4_TX 0x0264 0x05AC 0x0000 0x1 0x0
1369#define MX6SX_PAD_SD3_DATA3__ECSPI4_MISO 0x0264 0x05AC 0x0744 0x2 0x0
1370#define MX6SX_PAD_SD3_DATA3__AUDMUX_AUD6_TXD 0x0264 0x05AC 0x0678 0x3 0x0
1371#define MX6SX_PAD_SD3_DATA3__LCDIF2_ENABLE 0x0264 0x05AC 0x0000 0x4 0x0
1372#define MX6SX_PAD_SD3_DATA3__GPIO7_IO_5 0x0264 0x05AC 0x0000 0x5 0x0
1373#define MX6SX_PAD_SD3_DATA3__LCDIF2_RD_E 0x0264 0x05AC 0x0000 0x6 0x0
1374#define MX6SX_PAD_SD3_DATA3__TPSMP_HDATA_27 0x0264 0x05AC 0x0000 0x7 0x0
1375#define MX6SX_PAD_SD3_DATA3__GPU_DEBUG_3 0x0264 0x05AC 0x0000 0x8 0x0
1376#define MX6SX_PAD_SD3_DATA3__SDMA_DEBUG_EVENT_CHANNEL_3 0x0264 0x05AC 0x0000 0x9 0x0
1377#define MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 0x0268 0x05B0 0x0000 0x0 0x0
1378#define MX6SX_PAD_SD3_DATA4__CAN2_RX 0x0268 0x05B0 0x0690 0x1 0x0
1379#define MX6SX_PAD_SD3_DATA4__CANFD_RX2 0x0268 0x05B0 0x0698 0x2 0x0
1380#define MX6SX_PAD_SD3_DATA4__UART3_RX 0x0268 0x05B0 0x0840 0x3 0x2
1381#define MX6SX_PAD_SD3_DATA4__UART3_TX 0x0268 0x05B0 0x0000 0x3 0x0
1382#define MX6SX_PAD_SD3_DATA4__LCDIF2_DATA_3 0x0268 0x05B0 0x0000 0x4 0x0
1383#define MX6SX_PAD_SD3_DATA4__GPIO7_IO_6 0x0268 0x05B0 0x0000 0x5 0x0
1384#define MX6SX_PAD_SD3_DATA4__ENET2_1588_EVENT0_IN 0x0268 0x05B0 0x0000 0x6 0x0
1385#define MX6SX_PAD_SD3_DATA4__TPSMP_HTRANS_1 0x0268 0x05B0 0x0000 0x7 0x0
1386#define MX6SX_PAD_SD3_DATA4__GPU_DEBUG_4 0x0268 0x05B0 0x0000 0x8 0x0
1387#define MX6SX_PAD_SD3_DATA4__SDMA_DEBUG_BUS_DEVICE_0 0x0268 0x05B0 0x0000 0x9 0x0
1388#define MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 0x026C 0x05B4 0x0000 0x0 0x0
1389#define MX6SX_PAD_SD3_DATA5__CAN1_TX 0x026C 0x05B4 0x0000 0x1 0x0
1390#define MX6SX_PAD_SD3_DATA5__CANFD_TX1 0x026C 0x05B4 0x0000 0x2 0x0
1391#define MX6SX_PAD_SD3_DATA5__UART3_RX 0x026C 0x05B4 0x0840 0x3 0x3
1392#define MX6SX_PAD_SD3_DATA5__UART3_TX 0x026C 0x05B4 0x0000 0x3 0x0
1393#define MX6SX_PAD_SD3_DATA5__LCDIF2_DATA_2 0x026C 0x05B4 0x0000 0x4 0x0
1394#define MX6SX_PAD_SD3_DATA5__GPIO7_IO_7 0x026C 0x05B4 0x0000 0x5 0x0
1395#define MX6SX_PAD_SD3_DATA5__ENET2_1588_EVENT0_OUT 0x026C 0x05B4 0x0000 0x6 0x0
1396#define MX6SX_PAD_SD3_DATA5__SIM_M_HWRITE 0x026C 0x05B4 0x0000 0x7 0x0
1397#define MX6SX_PAD_SD3_DATA5__GPU_DEBUG_5 0x026C 0x05B4 0x0000 0x8 0x0
1398#define MX6SX_PAD_SD3_DATA5__SDMA_DEBUG_BUS_DEVICE_1 0x026C 0x05B4 0x0000 0x9 0x0
1399#define MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 0x0270 0x05B8 0x0000 0x0 0x0
1400#define MX6SX_PAD_SD3_DATA6__CAN2_TX 0x0270 0x05B8 0x0000 0x1 0x0
1401#define MX6SX_PAD_SD3_DATA6__CANFD_TX2 0x0270 0x05B8 0x0000 0x2 0x0
1402#define MX6SX_PAD_SD3_DATA6__UART3_RTS_B 0x0270 0x05B8 0x083C 0x3 0x2
1403#define MX6SX_PAD_SD3_DATA6__LCDIF2_DATA_4 0x0270 0x05B8 0x0000 0x4 0x0
1404#define MX6SX_PAD_SD3_DATA6__GPIO7_IO_8 0x0270 0x05B8 0x0000 0x5 0x0
1405#define MX6SX_PAD_SD3_DATA6__ENET1_1588_EVENT0_OUT 0x0270 0x05B8 0x0000 0x6 0x0
1406#define MX6SX_PAD_SD3_DATA6__TPSMP_HTRANS_0 0x0270 0x05B8 0x0000 0x7 0x0
1407#define MX6SX_PAD_SD3_DATA6__GPU_DEBUG_7 0x0270 0x05B8 0x0000 0x8 0x0
1408#define MX6SX_PAD_SD3_DATA6__SDMA_DEBUG_EVT_CHN_LINES_7 0x0270 0x05B8 0x0000 0x9 0x0
1409#define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0
1410#define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0
1411#define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0
1412#define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x083C 0x3 0x3
1413#define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0
1414#define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0
1415#define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0
1416#define MX6SX_PAD_SD3_DATA7__TPSMP_HDATA_DIR 0x0274 0x05BC 0x0000 0x7 0x0
1417#define MX6SX_PAD_SD3_DATA7__GPU_DEBUG_6 0x0274 0x05BC 0x0000 0x8 0x0
1418#define MX6SX_PAD_SD3_DATA7__SDMA_DEBUG_EVT_CHN_LINES_2 0x0274 0x05BC 0x0000 0x9 0x0
1419#define MX6SX_PAD_SD4_CLK__USDHC4_CLK 0x0278 0x05C0 0x0000 0x0 0x0
1420#define MX6SX_PAD_SD4_CLK__RAWNAND_DATA15 0x0278 0x05C0 0x0000 0x1 0x0
1421#define MX6SX_PAD_SD4_CLK__ECSPI2_MISO 0x0278 0x05C0 0x0724 0x2 0x1
1422#define MX6SX_PAD_SD4_CLK__AUDMUX_AUD3_RXFS 0x0278 0x05C0 0x0638 0x3 0x0
1423#define MX6SX_PAD_SD4_CLK__LCDIF2_DATA_13 0x0278 0x05C0 0x0000 0x4 0x0
1424#define MX6SX_PAD_SD4_CLK__GPIO6_IO_12 0x0278 0x05C0 0x0000 0x5 0x0
1425#define MX6SX_PAD_SD4_CLK__ECSPI3_SS2 0x0278 0x05C0 0x0000 0x6 0x0
1426#define MX6SX_PAD_SD4_CLK__TPSMP_HDATA_20 0x0278 0x05C0 0x0000 0x7 0x0
1427#define MX6SX_PAD_SD4_CLK__VDEC_DEBUG_12 0x0278 0x05C0 0x0000 0x8 0x0
1428#define MX6SX_PAD_SD4_CLK__SDMA_DEBUG_EVENT_CHANNEL_SEL 0x0278 0x05C0 0x0000 0x9 0x0
1429#define MX6SX_PAD_SD4_CMD__USDHC4_CMD 0x027C 0x05C4 0x0000 0x0 0x0
1430#define MX6SX_PAD_SD4_CMD__RAWNAND_DATA14 0x027C 0x05C4 0x0000 0x1 0x0
1431#define MX6SX_PAD_SD4_CMD__ECSPI2_MOSI 0x027C 0x05C4 0x0728 0x2 0x1
1432#define MX6SX_PAD_SD4_CMD__AUDMUX_AUD3_RXC 0x027C 0x05C4 0x0634 0x3 0x0
1433#define MX6SX_PAD_SD4_CMD__LCDIF2_DATA_14 0x027C 0x05C4 0x0000 0x4 0x0
1434#define MX6SX_PAD_SD4_CMD__GPIO6_IO_13 0x027C 0x05C4 0x0000 0x5 0x0
1435#define MX6SX_PAD_SD4_CMD__ECSPI3_SS1 0x027C 0x05C4 0x0000 0x6 0x0
1436#define MX6SX_PAD_SD4_CMD__TPSMP_HDATA_19 0x027C 0x05C4 0x0000 0x7 0x0
1437#define MX6SX_PAD_SD4_CMD__VDEC_DEBUG_11 0x027C 0x05C4 0x0000 0x8 0x0
1438#define MX6SX_PAD_SD4_CMD__SDMA_DEBUG_CORE_RUN 0x027C 0x05C4 0x0000 0x9 0x0
1439#define MX6SX_PAD_SD4_DATA0__USDHC4_DATA0 0x0280 0x05C8 0x0000 0x0 0x0
1440#define MX6SX_PAD_SD4_DATA0__RAWNAND_DATA10 0x0280 0x05C8 0x0000 0x1 0x0
1441#define MX6SX_PAD_SD4_DATA0__ECSPI2_SS0 0x0280 0x05C8 0x072C 0x2 0x1
1442#define MX6SX_PAD_SD4_DATA0__AUDMUX_AUD3_RXD 0x0280 0x05C8 0x062C 0x3 0x0
1443#define MX6SX_PAD_SD4_DATA0__LCDIF2_DATA_12 0x0280 0x05C8 0x0000 0x4 0x0
1444#define MX6SX_PAD_SD4_DATA0__GPIO6_IO_14 0x0280 0x05C8 0x0000 0x5 0x0
1445#define MX6SX_PAD_SD4_DATA0__ECSPI3_SS3 0x0280 0x05C8 0x0000 0x6 0x0
1446#define MX6SX_PAD_SD4_DATA0__TPSMP_HDATA_21 0x0280 0x05C8 0x0000 0x7 0x0
1447#define MX6SX_PAD_SD4_DATA0__VDEC_DEBUG_13 0x0280 0x05C8 0x0000 0x8 0x0
1448#define MX6SX_PAD_SD4_DATA0__SDMA_DEBUG_MODE 0x0280 0x05C8 0x0000 0x9 0x0
1449#define MX6SX_PAD_SD4_DATA1__USDHC4_DATA1 0x0284 0x05CC 0x0000 0x0 0x0
1450#define MX6SX_PAD_SD4_DATA1__RAWNAND_DATA11 0x0284 0x05CC 0x0000 0x1 0x0
1451#define MX6SX_PAD_SD4_DATA1__ECSPI2_SCLK 0x0284 0x05CC 0x0720 0x2 0x1
1452#define MX6SX_PAD_SD4_DATA1__AUDMUX_AUD3_TXC 0x0284 0x05CC 0x063C 0x3 0x0
1453#define MX6SX_PAD_SD4_DATA1__LCDIF2_DATA_11 0x0284 0x05CC 0x0000 0x4 0x0
1454#define MX6SX_PAD_SD4_DATA1__GPIO6_IO_15 0x0284 0x05CC 0x0000 0x5 0x0
1455#define MX6SX_PAD_SD4_DATA1__ECSPI3_RDY 0x0284 0x05CC 0x0000 0x6 0x0
1456#define MX6SX_PAD_SD4_DATA1__TPSMP_HDATA_22 0x0284 0x05CC 0x0000 0x7 0x0
1457#define MX6SX_PAD_SD4_DATA1__VDEC_DEBUG_14 0x0284 0x05CC 0x0000 0x8 0x0
1458#define MX6SX_PAD_SD4_DATA1__SDMA_DEBUG_BUS_ERROR 0x0284 0x05CC 0x0000 0x9 0x0
1459#define MX6SX_PAD_SD4_DATA2__USDHC4_DATA2 0x0288 0x05D0 0x0000 0x0 0x0
1460#define MX6SX_PAD_SD4_DATA2__RAWNAND_DATA12 0x0288 0x05D0 0x0000 0x1 0x0
1461#define MX6SX_PAD_SD4_DATA2__I2C2_SDA 0x0288 0x05D0 0x07B4 0x2 0x0
1462#define MX6SX_PAD_SD4_DATA2__AUDMUX_AUD3_TXFS 0x0288 0x05D0 0x0640 0x3 0x0
1463#define MX6SX_PAD_SD4_DATA2__LCDIF2_DATA_10 0x0288 0x05D0 0x0000 0x4 0x0
1464#define MX6SX_PAD_SD4_DATA2__GPIO6_IO_16 0x0288 0x05D0 0x0000 0x5 0x0
1465#define MX6SX_PAD_SD4_DATA2__ECSPI2_SS3 0x0288 0x05D0 0x0000 0x6 0x0
1466#define MX6SX_PAD_SD4_DATA2__TPSMP_HDATA_23 0x0288 0x05D0 0x0000 0x7 0x0
1467#define MX6SX_PAD_SD4_DATA2__VDEC_DEBUG_15 0x0288 0x05D0 0x0000 0x8 0x0
1468#define MX6SX_PAD_SD4_DATA2__SDMA_DEBUG_BUS_RWB 0x0288 0x05D0 0x0000 0x9 0x0
1469#define MX6SX_PAD_SD4_DATA3__USDHC4_DATA3 0x028C 0x05D4 0x0000 0x0 0x0
1470#define MX6SX_PAD_SD4_DATA3__RAWNAND_DATA13 0x028C 0x05D4 0x0000 0x1 0x0
1471#define MX6SX_PAD_SD4_DATA3__I2C2_SCL 0x028C 0x05D4 0x07B0 0x2 0x0
1472#define MX6SX_PAD_SD4_DATA3__AUDMUX_AUD3_TXD 0x028C 0x05D4 0x0630 0x3 0x0
1473#define MX6SX_PAD_SD4_DATA3__LCDIF2_DATA_9 0x028C 0x05D4 0x0000 0x4 0x0
1474#define MX6SX_PAD_SD4_DATA3__GPIO6_IO_17 0x028C 0x05D4 0x0000 0x5 0x0
1475#define MX6SX_PAD_SD4_DATA3__ECSPI2_RDY 0x028C 0x05D4 0x0000 0x6 0x0
1476#define MX6SX_PAD_SD4_DATA3__TPSMP_HDATA_24 0x028C 0x05D4 0x0000 0x7 0x0
1477#define MX6SX_PAD_SD4_DATA3__VDEC_DEBUG_16 0x028C 0x05D4 0x0000 0x8 0x0
1478#define MX6SX_PAD_SD4_DATA3__SDMA_DEBUG_MATCHED_DMBUS 0x028C 0x05D4 0x0000 0x9 0x0
1479#define MX6SX_PAD_SD4_DATA4__USDHC4_DATA4 0x0290 0x05D8 0x0000 0x0 0x0
1480#define MX6SX_PAD_SD4_DATA4__RAWNAND_DATA09 0x0290 0x05D8 0x0000 0x1 0x0
1481#define MX6SX_PAD_SD4_DATA4__UART5_RX 0x0290 0x05D8 0x0850 0x2 0x0
1482#define MX6SX_PAD_SD4_DATA4__UART5_TX 0x0290 0x05D8 0x0000 0x2 0x0
1483#define MX6SX_PAD_SD4_DATA4__ECSPI3_SCLK 0x0290 0x05D8 0x0730 0x3 0x0
1484#define MX6SX_PAD_SD4_DATA4__LCDIF2_DATA_8 0x0290 0x05D8 0x0000 0x4 0x0
1485#define MX6SX_PAD_SD4_DATA4__GPIO6_IO_18 0x0290 0x05D8 0x0000 0x5 0x0
1486#define MX6SX_PAD_SD4_DATA4__SPDIF_OUT 0x0290 0x05D8 0x0000 0x6 0x0
1487#define MX6SX_PAD_SD4_DATA4__TPSMP_HDATA_16 0x0290 0x05D8 0x0000 0x7 0x0
1488#define MX6SX_PAD_SD4_DATA4__USB_OTG_HOST_MODE 0x0290 0x05D8 0x0000 0x8 0x0
1489#define MX6SX_PAD_SD4_DATA4__SDMA_DEBUG_RTBUFFER_WRITE 0x0290 0x05D8 0x0000 0x9 0x0
1490#define MX6SX_PAD_SD4_DATA5__USDHC4_DATA5 0x0294 0x05DC 0x0000 0x0 0x0
1491#define MX6SX_PAD_SD4_DATA5__RAWNAND_CE2_B 0x0294 0x05DC 0x0000 0x1 0x0
1492#define MX6SX_PAD_SD4_DATA5__UART5_RX 0x0294 0x05DC 0x0850 0x2 0x1
1493#define MX6SX_PAD_SD4_DATA5__UART5_TX 0x0294 0x05DC 0x0000 0x2 0x0
1494#define MX6SX_PAD_SD4_DATA5__ECSPI3_MOSI 0x0294 0x05DC 0x0738 0x3 0x0
1495#define MX6SX_PAD_SD4_DATA5__LCDIF2_DATA_7 0x0294 0x05DC 0x0000 0x4 0x0
1496#define MX6SX_PAD_SD4_DATA5__GPIO6_IO_19 0x0294 0x05DC 0x0000 0x5 0x0
1497#define MX6SX_PAD_SD4_DATA5__SPDIF_IN 0x0294 0x05DC 0x0824 0x6 0x0
1498#define MX6SX_PAD_SD4_DATA5__TPSMP_HDATA_17 0x0294 0x05DC 0x0000 0x7 0x0
1499#define MX6SX_PAD_SD4_DATA5__VDEC_DEBUG_9 0x0294 0x05DC 0x0000 0x8 0x0
1500#define MX6SX_PAD_SD4_DATA5__SDMA_DEBUG_EVENT_CHANNEL_0 0x0294 0x05DC 0x0000 0x9 0x0
1501#define MX6SX_PAD_SD4_DATA6__USDHC4_DATA6 0x0298 0x05E0 0x0000 0x0 0x0
1502#define MX6SX_PAD_SD4_DATA6__RAWNAND_CE3_B 0x0298 0x05E0 0x0000 0x1 0x0
1503#define MX6SX_PAD_SD4_DATA6__UART5_RTS_B 0x0298 0x05E0 0x084C 0x2 0x0
1504#define MX6SX_PAD_SD4_DATA6__ECSPI3_MISO 0x0298 0x05E0 0x0734 0x3 0x0
1505#define MX6SX_PAD_SD4_DATA6__LCDIF2_DATA_6 0x0298 0x05E0 0x0000 0x4 0x0
1506#define MX6SX_PAD_SD4_DATA6__GPIO6_IO_20 0x0298 0x05E0 0x0000 0x5 0x0
1507#define MX6SX_PAD_SD4_DATA6__USDHC4_WP 0x0298 0x05E0 0x0878 0x6 0x0
1508#define MX6SX_PAD_SD4_DATA6__TPSMP_HDATA_18 0x0298 0x05E0 0x0000 0x7 0x0
1509#define MX6SX_PAD_SD4_DATA6__VDEC_DEBUG_10 0x0298 0x05E0 0x0000 0x8 0x0
1510#define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0
1511#define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0
1512#define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0
1513#define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x084C 0x2 0x1
1514#define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0
1515#define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0
1516#define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0
1517#define MX6SX_PAD_SD4_DATA7__USDHC4_CD_B 0x029C 0x05E4 0x0874 0x6 0x0
1518#define MX6SX_PAD_SD4_DATA7__TPSMP_HDATA_15 0x029C 0x05E4 0x0000 0x7 0x0
1519#define MX6SX_PAD_SD4_DATA7__USB_OTG_PWR_WAKE 0x029C 0x05E4 0x0000 0x8 0x0
1520#define MX6SX_PAD_SD4_DATA7__SDMA_DEBUG_YIELD 0x029C 0x05E4 0x0000 0x9 0x0
1521#define MX6SX_PAD_SD4_RESET_B__USDHC4_RESET_B 0x02A0 0x05E8 0x0000 0x0 0x0
1522#define MX6SX_PAD_SD4_RESET_B__RAWNAND_DQS 0x02A0 0x05E8 0x0000 0x1 0x0
1523#define MX6SX_PAD_SD4_RESET_B__USDHC4_RESET 0x02A0 0x05E8 0x0000 0x2 0x0
1524#define MX6SX_PAD_SD4_RESET_B__AUDMUX_MCLK 0x02A0 0x05E8 0x0000 0x3 0x0
1525#define MX6SX_PAD_SD4_RESET_B__LCDIF2_RESET 0x02A0 0x05E8 0x0000 0x4 0x0
1526#define MX6SX_PAD_SD4_RESET_B__GPIO6_IO_22 0x02A0 0x05E8 0x0000 0x5 0x0
1527#define MX6SX_PAD_SD4_RESET_B__LCDIF2_CS 0x02A0 0x05E8 0x0000 0x6 0x0
1528#define MX6SX_PAD_SD4_RESET_B__TPSMP_HDATA_25 0x02A0 0x05E8 0x0000 0x7 0x0
1529#define MX6SX_PAD_SD4_RESET_B__VDEC_DEBUG_17 0x02A0 0x05E8 0x0000 0x8 0x0
1530#define MX6SX_PAD_SD4_RESET_B__SDMA_DEBUG_BUS_DEVICE_2 0x02A0 0x05E8 0x0000 0x9 0x0
1531#define MX6SX_PAD_USB_H_DATA__USB_H_DATA 0x02A4 0x05EC 0x0000 0x0 0x0
1532#define MX6SX_PAD_USB_H_DATA__PWM2_OUT 0x02A4 0x05EC 0x0000 0x1 0x0
1533#define MX6SX_PAD_USB_H_DATA__ANATOP_24M_OUT 0x02A4 0x05EC 0x0000 0x2 0x0
1534#define MX6SX_PAD_USB_H_DATA__I2C4_SDA 0x02A4 0x05EC 0x07C4 0x3 0x1
1535#define MX6SX_PAD_USB_H_DATA__WDOG3_WDOG_B 0x02A4 0x05EC 0x0000 0x4 0x0
1536#define MX6SX_PAD_USB_H_DATA__GPIO7_IO_10 0x02A4 0x05EC 0x0000 0x5 0x0
1537#define MX6SX_PAD_USB_H_STROBE__USB_H_STROBE 0x02A8 0x05F0 0x0000 0x0 0x0
1538#define MX6SX_PAD_USB_H_STROBE__PWM1_OUT 0x02A8 0x05F0 0x0000 0x1 0x0
1539#define MX6SX_PAD_USB_H_STROBE__ANATOP_32K_OUT 0x02A8 0x05F0 0x0000 0x2 0x0
1540#define MX6SX_PAD_USB_H_STROBE__I2C4_SCL 0x02A8 0x05F0 0x07C0 0x3 0x1
1541#define MX6SX_PAD_USB_H_STROBE__WDOG3_WDOG_RST_B_DEB 0x02A8 0x05F0 0x0000 0x4 0x0
1542#define MX6SX_PAD_USB_H_STROBE__GPIO7_IO_11 0x02A8 0x05F0 0x0000 0x5 0x0
1543
1544#endif /* __DTS_IMX6SX_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
new file mode 100644
index 000000000000..a3980d970590
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -0,0 +1,479 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/dts-v1/;
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/input.h>
13#include "imx6sx.dtsi"
14
15/ {
16 model = "Freescale i.MX6 SoloX SDB Board";
17 compatible = "fsl,imx6sx-sdb", "fsl,imx6sx";
18
19 chosen {
20 stdout-path = &uart1;
21 };
22
23 memory {
24 reg = <0x80000000 0x40000000>;
25 };
26
27 gpio-keys {
28 compatible = "gpio-keys";
29 pinctrl-names = "default";
30 pinctrl-0 = <&pinctrl_gpio_keys>;
31
32 volume-up {
33 label = "Volume Up";
34 gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
35 linux,code = <KEY_VOLUMEUP>;
36 };
37
38 volume-down {
39 label = "Volume Down";
40 gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
41 linux,code = <KEY_VOLUMEDOWN>;
42 };
43 };
44
45 regulators {
46 compatible = "simple-bus";
47 #address-cells = <1>;
48 #size-cells = <0>;
49
50 vcc_sd3: regulator@0 {
51 compatible = "regulator-fixed";
52 reg = <0>;
53 pinctrl-names = "default";
54 pinctrl-0 = <&pinctrl_vcc_sd3>;
55 regulator-name = "VCC_SD3";
56 regulator-min-microvolt = <3000000>;
57 regulator-max-microvolt = <3000000>;
58 gpio = <&gpio2 11 GPIO_ACTIVE_HIGH>;
59 enable-active-high;
60 };
61
62 reg_usb_otg1_vbus: regulator@1 {
63 compatible = "regulator-fixed";
64 reg = <1>;
65 pinctrl-names = "default";
66 pinctrl-0 = <&pinctrl_usb_otg1>;
67 regulator-name = "usb_otg1_vbus";
68 regulator-min-microvolt = <5000000>;
69 regulator-max-microvolt = <5000000>;
70 gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
71 enable-active-high;
72 };
73
74 reg_usb_otg2_vbus: regulator@2 {
75 compatible = "regulator-fixed";
76 reg = <2>;
77 pinctrl-names = "default";
78 pinctrl-0 = <&pinctrl_usb_otg2>;
79 regulator-name = "usb_otg2_vbus";
80 regulator-min-microvolt = <5000000>;
81 regulator-max-microvolt = <5000000>;
82 gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
83 enable-active-high;
84 };
85
86 reg_psu_5v: regulator@3 {
87 compatible = "regulator-fixed";
88 reg = <3>;
89 regulator-name = "PSU-5V0";
90 regulator-min-microvolt = <5000000>;
91 regulator-max-microvolt = <5000000>;
92 };
93 };
94
95 sound {
96 compatible = "fsl,imx6sx-sdb-wm8962", "fsl,imx-audio-wm8962";
97 model = "wm8962-audio";
98 ssi-controller = <&ssi2>;
99 audio-codec = <&codec>;
100 audio-routing =
101 "Headphone Jack", "HPOUTL",
102 "Headphone Jack", "HPOUTR",
103 "Ext Spk", "SPKOUTL",
104 "Ext Spk", "SPKOUTR",
105 "AMIC", "MICBIAS",
106 "IN3R", "AMIC";
107 mux-int-port = <2>;
108 mux-ext-port = <6>;
109 };
110};
111
112&audmux {
113 pinctrl-names = "default";
114 pinctrl-0 = <&pinctrl_audmux>;
115 status = "okay";
116};
117
118&fec1 {
119 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_enet1>;
121 phy-mode = "rgmii";
122 status = "okay";
123};
124
125&i2c1 {
126 clock-frequency = <100000>;
127 pinctrl-names = "default";
128 pinctrl-0 = <&pinctrl_i2c1>;
129 status = "okay";
130
131 pmic: pfuze100@08 {
132 compatible = "fsl,pfuze100";
133 reg = <0x08>;
134
135 regulators {
136 sw1a_reg: sw1ab {
137 regulator-min-microvolt = <300000>;
138 regulator-max-microvolt = <1875000>;
139 regulator-boot-on;
140 regulator-always-on;
141 regulator-ramp-delay = <6250>;
142 };
143
144 sw1c_reg: sw1c {
145 regulator-min-microvolt = <300000>;
146 regulator-max-microvolt = <1875000>;
147 regulator-boot-on;
148 regulator-always-on;
149 regulator-ramp-delay = <6250>;
150 };
151
152 sw2_reg: sw2 {
153 regulator-min-microvolt = <800000>;
154 regulator-max-microvolt = <3300000>;
155 regulator-boot-on;
156 regulator-always-on;
157 };
158
159 sw3a_reg: sw3a {
160 regulator-min-microvolt = <400000>;
161 regulator-max-microvolt = <1975000>;
162 regulator-boot-on;
163 regulator-always-on;
164 };
165
166 sw3b_reg: sw3b {
167 regulator-min-microvolt = <400000>;
168 regulator-max-microvolt = <1975000>;
169 regulator-boot-on;
170 regulator-always-on;
171 };
172
173 sw4_reg: sw4 {
174 regulator-min-microvolt = <800000>;
175 regulator-max-microvolt = <3300000>;
176 };
177
178 swbst_reg: swbst {
179 regulator-min-microvolt = <5000000>;
180 regulator-max-microvolt = <5150000>;
181 };
182
183 snvs_reg: vsnvs {
184 regulator-min-microvolt = <1000000>;
185 regulator-max-microvolt = <3000000>;
186 regulator-boot-on;
187 regulator-always-on;
188 };
189
190 vref_reg: vrefddr {
191 regulator-boot-on;
192 regulator-always-on;
193 };
194
195 vgen1_reg: vgen1 {
196 regulator-min-microvolt = <800000>;
197 regulator-max-microvolt = <1550000>;
198 regulator-always-on;
199 };
200
201 vgen2_reg: vgen2 {
202 regulator-min-microvolt = <800000>;
203 regulator-max-microvolt = <1550000>;
204 };
205
206 vgen3_reg: vgen3 {
207 regulator-min-microvolt = <1800000>;
208 regulator-max-microvolt = <3300000>;
209 regulator-always-on;
210 };
211
212 vgen4_reg: vgen4 {
213 regulator-min-microvolt = <1800000>;
214 regulator-max-microvolt = <3300000>;
215 regulator-always-on;
216 };
217
218 vgen5_reg: vgen5 {
219 regulator-min-microvolt = <1800000>;
220 regulator-max-microvolt = <3300000>;
221 regulator-always-on;
222 };
223
224 vgen6_reg: vgen6 {
225 regulator-min-microvolt = <1800000>;
226 regulator-max-microvolt = <3300000>;
227 regulator-always-on;
228 };
229 };
230 };
231};
232
233&i2c4 {
234 clock-frequency = <100000>;
235 pinctrl-names = "default";
236 pinctrl-0 = <&pinctrl_i2c4>;
237 status = "okay";
238
239 codec: wm8962@1a {
240 compatible = "wlf,wm8962";
241 reg = <0x1a>;
242 clocks = <&clks IMX6SX_CLK_AUDIO>;
243 DCVDD-supply = <&vgen4_reg>;
244 DBVDD-supply = <&vgen4_reg>;
245 AVDD-supply = <&vgen4_reg>;
246 CPVDD-supply = <&vgen4_reg>;
247 MICVDD-supply = <&vgen3_reg>;
248 PLLVDD-supply = <&vgen4_reg>;
249 SPKVDD1-supply = <&reg_psu_5v>;
250 SPKVDD2-supply = <&reg_psu_5v>;
251 };
252};
253
254&ssi2 {
255 status = "okay";
256};
257
258&uart1 {
259 pinctrl-names = "default";
260 pinctrl-0 = <&pinctrl_uart1>;
261 status = "okay";
262};
263
264&uart5 { /* for bluetooth */
265 pinctrl-names = "default";
266 pinctrl-0 = <&pinctrl_uart5>;
267 fsl,uart-has-rtscts;
268 status = "okay";
269};
270
271&usbotg1 {
272 vbus-supply = <&reg_usb_otg1_vbus>;
273 pinctrl-names = "default";
274 pinctrl-0 = <&pinctrl_usb_otg1_id>;
275 status = "okay";
276};
277
278&usbotg2 {
279 vbus-supply = <&reg_usb_otg2_vbus>;
280 dr_mode = "host";
281 status = "okay";
282};
283
284&usdhc2 {
285 pinctrl-names = "default";
286 pinctrl-0 = <&pinctrl_usdhc2>;
287 non-removable;
288 no-1-8-v;
289 keep-power-in-suspend;
290 enable-sdio-wakeup;
291 status = "okay";
292};
293
294&usdhc3 {
295 pinctrl-names = "default", "state_100mhz", "state_200mhz";
296 pinctrl-0 = <&pinctrl_usdhc3>;
297 pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
298 pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
299 bus-width = <8>;
300 cd-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
301 wp-gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>;
302 keep-power-in-suspend;
303 enable-sdio-wakeup;
304 vmmc-supply = <&vcc_sd3>;
305 status = "okay";
306};
307
308&usdhc4 {
309 pinctrl-names = "default";
310 pinctrl-0 = <&pinctrl_usdhc4>;
311 cd-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>;
312 wp-gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>;
313 status = "okay";
314};
315
316&iomuxc {
317 imx6x-sdb {
318 pinctrl_audmux: audmuxgrp {
319 fsl,pins = <
320 MX6SX_PAD_CSI_DATA00__AUDMUX_AUD6_TXC 0x130b0
321 MX6SX_PAD_CSI_DATA01__AUDMUX_AUD6_TXFS 0x130b0
322 MX6SX_PAD_CSI_HSYNC__AUDMUX_AUD6_TXD 0x120b0
323 MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x130b0
324 MX6SX_PAD_CSI_PIXCLK__AUDMUX_MCLK 0x130b0
325 >;
326 };
327
328 pinctrl_enet1: enet1grp {
329 fsl,pins = <
330 MX6SX_PAD_ENET1_MDIO__ENET1_MDIO 0xa0b1
331 MX6SX_PAD_ENET1_MDC__ENET1_MDC 0xa0b1
332 MX6SX_PAD_RGMII1_TXC__ENET1_RGMII_TXC 0xa0b1
333 MX6SX_PAD_RGMII1_TD0__ENET1_TX_DATA_0 0xa0b1
334 MX6SX_PAD_RGMII1_TD1__ENET1_TX_DATA_1 0xa0b1
335 MX6SX_PAD_RGMII1_TD2__ENET1_TX_DATA_2 0xa0b1
336 MX6SX_PAD_RGMII1_TD3__ENET1_TX_DATA_3 0xa0b1
337 MX6SX_PAD_RGMII1_TX_CTL__ENET1_TX_EN 0xa0b1
338 MX6SX_PAD_RGMII1_RXC__ENET1_RX_CLK 0x3081
339 MX6SX_PAD_RGMII1_RD0__ENET1_RX_DATA_0 0x3081
340 MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1 0x3081
341 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2 0x3081
342 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081
343 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081
344 >;
345 };
346
347 pinctrl_gpio_keys: gpio_keysgrp {
348 fsl,pins = <
349 MX6SX_PAD_CSI_DATA04__GPIO1_IO_18 0x17059
350 MX6SX_PAD_CSI_DATA05__GPIO1_IO_19 0x17059
351 >;
352 };
353
354 pinctrl_i2c1: i2c1grp {
355 fsl,pins = <
356 MX6SX_PAD_GPIO1_IO01__I2C1_SDA 0x4001b8b1
357 MX6SX_PAD_GPIO1_IO00__I2C1_SCL 0x4001b8b1
358 >;
359 };
360
361 pinctrl_i2c4: i2c4grp {
362 fsl,pins = <
363 MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x4001b8b1
364 MX6SX_PAD_CSI_DATA06__I2C4_SCL 0x4001b8b1
365 >;
366 };
367
368 pinctrl_vcc_sd3: vccsd3grp {
369 fsl,pins = <
370 MX6SX_PAD_KEY_COL1__GPIO2_IO_11 0x17059
371 >;
372 };
373
374 pinctrl_uart1: uart1grp {
375 fsl,pins = <
376 MX6SX_PAD_GPIO1_IO04__UART1_TX 0x1b0b1
377 MX6SX_PAD_GPIO1_IO05__UART1_RX 0x1b0b1
378 >;
379 };
380
381 pinctrl_uart5: uart5grp {
382 fsl,pins = <
383 MX6SX_PAD_KEY_ROW3__UART5_RX 0x1b0b1
384 MX6SX_PAD_KEY_COL3__UART5_TX 0x1b0b1
385 MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x1b0b1
386 MX6SX_PAD_KEY_COL2__UART5_RTS_B 0x1b0b1
387 >;
388 };
389
390 pinctrl_usb_otg1: usbotg1grp {
391 fsl,pins = <
392 MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x10b0
393 >;
394 };
395
396 pinctrl_usb_otg1_id: usbotg1idgrp {
397 fsl,pins = <
398 MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x17059
399 >;
400 };
401
402 pinctrl_usb_otg2: usbot2ggrp {
403 fsl,pins = <
404 MX6SX_PAD_GPIO1_IO12__GPIO1_IO_12 0x10b0
405 >;
406 };
407
408 pinctrl_usdhc2: usdhc2grp {
409 fsl,pins = <
410 MX6SX_PAD_SD2_CMD__USDHC2_CMD 0x17059
411 MX6SX_PAD_SD2_CLK__USDHC2_CLK 0x10059
412 MX6SX_PAD_SD2_DATA0__USDHC2_DATA0 0x17059
413 MX6SX_PAD_SD2_DATA1__USDHC2_DATA1 0x17059
414 MX6SX_PAD_SD2_DATA2__USDHC2_DATA2 0x17059
415 MX6SX_PAD_SD2_DATA3__USDHC2_DATA3 0x17059
416 >;
417 };
418
419 pinctrl_usdhc3: usdhc3grp {
420 fsl,pins = <
421 MX6SX_PAD_SD3_CMD__USDHC3_CMD 0x17059
422 MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x10059
423 MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 0x17059
424 MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 0x17059
425 MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 0x17059
426 MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 0x17059
427 MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 0x17059
428 MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 0x17059
429 MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 0x17059
430 MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x17059
431 MX6SX_PAD_KEY_COL0__GPIO2_IO_10 0x17059 /* CD */
432 MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x17059 /* WP */
433 >;
434 };
435
436 pinctrl_usdhc3_100mhz: usdhc3grp-100mhz {
437 fsl,pins = <
438 MX6SX_PAD_SD3_CMD__USDHC3_CMD 0x170b9
439 MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x100b9
440 MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 0x170b9
441 MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 0x170b9
442 MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 0x170b9
443 MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 0x170b9
444 MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 0x170b9
445 MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 0x170b9
446 MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 0x170b9
447 MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x170b9
448 >;
449 };
450
451 pinctrl_usdhc3_200mhz: usdhc3grp-200mhz {
452 fsl,pins = <
453 MX6SX_PAD_SD3_CMD__USDHC3_CMD 0x170f9
454 MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x100f9
455 MX6SX_PAD_SD3_DATA0__USDHC3_DATA0 0x170f9
456 MX6SX_PAD_SD3_DATA1__USDHC3_DATA1 0x170f9
457 MX6SX_PAD_SD3_DATA2__USDHC3_DATA2 0x170f9
458 MX6SX_PAD_SD3_DATA3__USDHC3_DATA3 0x170f9
459 MX6SX_PAD_SD3_DATA4__USDHC3_DATA4 0x170f9
460 MX6SX_PAD_SD3_DATA5__USDHC3_DATA5 0x170f9
461 MX6SX_PAD_SD3_DATA6__USDHC3_DATA6 0x170f9
462 MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x170f9
463 >;
464 };
465
466 pinctrl_usdhc4: usdhc4grp {
467 fsl,pins = <
468 MX6SX_PAD_SD4_CMD__USDHC4_CMD 0x17059
469 MX6SX_PAD_SD4_CLK__USDHC4_CLK 0x10059
470 MX6SX_PAD_SD4_DATA0__USDHC4_DATA0 0x17059
471 MX6SX_PAD_SD4_DATA1__USDHC4_DATA1 0x17059
472 MX6SX_PAD_SD4_DATA2__USDHC4_DATA2 0x17059
473 MX6SX_PAD_SD4_DATA3__USDHC4_DATA3 0x17059
474 MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x17059 /* CD */
475 MX6SX_PAD_SD4_DATA6__GPIO6_IO_20 0x17059 /* WP */
476 >;
477 };
478 };
479};
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
new file mode 100644
index 000000000000..f4b9da65bc0f
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -0,0 +1,1208 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <dt-bindings/clock/imx6sx-clock.h>
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/interrupt-controller/arm-gic.h>
12#include "imx6sx-pinfunc.h"
13#include "skeleton.dtsi"
14
15/ {
16 aliases {
17 can0 = &flexcan1;
18 can1 = &flexcan2;
19 ethernet0 = &fec1;
20 ethernet1 = &fec2;
21 gpio0 = &gpio1;
22 gpio1 = &gpio2;
23 gpio2 = &gpio3;
24 gpio3 = &gpio4;
25 gpio4 = &gpio5;
26 gpio5 = &gpio6;
27 gpio6 = &gpio7;
28 i2c0 = &i2c1;
29 i2c1 = &i2c2;
30 i2c2 = &i2c3;
31 i2c3 = &i2c4;
32 mmc0 = &usdhc1;
33 mmc1 = &usdhc2;
34 mmc2 = &usdhc3;
35 mmc3 = &usdhc4;
36 serial0 = &uart1;
37 serial1 = &uart2;
38 serial2 = &uart3;
39 serial3 = &uart4;
40 serial4 = &uart5;
41 serial5 = &uart6;
42 spi0 = &ecspi1;
43 spi1 = &ecspi2;
44 spi2 = &ecspi3;
45 spi3 = &ecspi4;
46 spi4 = &ecspi5;
47 usbphy0 = &usbphy1;
48 usbphy1 = &usbphy2;
49 };
50
51 cpus {
52 #address-cells = <1>;
53 #size-cells = <0>;
54
55 cpu0: cpu@0 {
56 compatible = "arm,cortex-a9";
57 device_type = "cpu";
58 reg = <0>;
59 next-level-cache = <&L2>;
60 operating-points = <
61 /* kHz uV */
62 996000 1250000
63 792000 1175000
64 396000 1075000
65 >;
66 fsl,soc-operating-points = <
67 /* ARM kHz SOC uV */
68 996000 1175000
69 792000 1175000
70 396000 1175000
71 >;
72 clock-latency = <61036>; /* two CLK32 periods */
73 clocks = <&clks IMX6SX_CLK_ARM>,
74 <&clks IMX6SX_CLK_PLL2_PFD2>,
75 <&clks IMX6SX_CLK_STEP>,
76 <&clks IMX6SX_CLK_PLL1_SW>,
77 <&clks IMX6SX_CLK_PLL1_SYS>;
78 clock-names = "arm", "pll2_pfd2_396m", "step",
79 "pll1_sw", "pll1_sys";
80 arm-supply = <&reg_arm>;
81 soc-supply = <&reg_soc>;
82 };
83 };
84
85 intc: interrupt-controller@00a01000 {
86 compatible = "arm,cortex-a9-gic";
87 #interrupt-cells = <3>;
88 interrupt-controller;
89 reg = <0x00a01000 0x1000>,
90 <0x00a00100 0x100>;
91 };
92
93 clocks {
94 #address-cells = <1>;
95 #size-cells = <0>;
96
97 ckil: clock@0 {
98 compatible = "fixed-clock";
99 reg = <0>;
100 #clock-cells = <0>;
101 clock-frequency = <32768>;
102 clock-output-names = "ckil";
103 };
104
105 osc: clock@1 {
106 compatible = "fixed-clock";
107 reg = <1>;
108 #clock-cells = <0>;
109 clock-frequency = <24000000>;
110 clock-output-names = "osc";
111 };
112
113 ipp_di0: clock@2 {
114 compatible = "fixed-clock";
115 reg = <2>;
116 #clock-cells = <0>;
117 clock-frequency = <0>;
118 clock-output-names = "ipp_di0";
119 };
120
121 ipp_di1: clock@3 {
122 compatible = "fixed-clock";
123 reg = <3>;
124 #clock-cells = <0>;
125 clock-frequency = <0>;
126 clock-output-names = "ipp_di1";
127 };
128 };
129
130 soc {
131 #address-cells = <1>;
132 #size-cells = <1>;
133 compatible = "simple-bus";
134 interrupt-parent = <&intc>;
135 ranges;
136
137 pmu {
138 compatible = "arm,cortex-a9-pmu";
139 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
140 };
141
142 ocram: sram@00900000 {
143 compatible = "mmio-sram";
144 reg = <0x00900000 0x20000>;
145 clocks = <&clks IMX6SX_CLK_OCRAM>;
146 };
147
148 L2: l2-cache@00a02000 {
149 compatible = "arm,pl310-cache";
150 reg = <0x00a02000 0x1000>;
151 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
152 cache-unified;
153 cache-level = <2>;
154 arm,tag-latency = <4 2 3>;
155 arm,data-latency = <4 2 3>;
156 };
157
158 dma_apbh: dma-apbh@01804000 {
159 compatible = "fsl,imx6sx-dma-apbh", "fsl,imx28-dma-apbh";
160 reg = <0x01804000 0x2000>;
161 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
162 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
163 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
164 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
165 interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3";
166 #dma-cells = <1>;
167 dma-channels = <4>;
168 clocks = <&clks IMX6SX_CLK_APBH_DMA>;
169 };
170
171 gpmi: gpmi-nand@01806000{
172 compatible = "fsl,imx6sx-gpmi-nand";
173 #address-cells = <1>;
174 #size-cells = <1>;
175 reg = <0x01806000 0x2000>, <0x01808000 0x4000>;
176 reg-names = "gpmi-nand", "bch";
177 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
178 interrupt-names = "bch";
179 clocks = <&clks IMX6SX_CLK_GPMI_IO>,
180 <&clks IMX6SX_CLK_GPMI_APB>,
181 <&clks IMX6SX_CLK_GPMI_BCH>,
182 <&clks IMX6SX_CLK_GPMI_BCH_APB>,
183 <&clks IMX6SX_CLK_PER1_BCH>;
184 clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch",
185 "gpmi_bch_apb", "per1_bch";
186 dmas = <&dma_apbh 0>;
187 dma-names = "rx-tx";
188 status = "disabled";
189 };
190
191 aips1: aips-bus@02000000 {
192 compatible = "fsl,aips-bus", "simple-bus";
193 #address-cells = <1>;
194 #size-cells = <1>;
195 reg = <0x02000000 0x100000>;
196 ranges;
197
198 spba-bus@02000000 {
199 compatible = "fsl,spba-bus", "simple-bus";
200 #address-cells = <1>;
201 #size-cells = <1>;
202 reg = <0x02000000 0x40000>;
203 ranges;
204
205 spdif: spdif@02004000 {
206 compatible = "fsl,imx6sx-spdif", "fsl,imx35-spdif";
207 reg = <0x02004000 0x4000>;
208 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
209 dmas = <&sdma 14 18 0>,
210 <&sdma 15 18 0>;
211 dma-names = "rx", "tx";
212 clocks = <&clks IMX6SX_CLK_SPDIF>,
213 <&clks IMX6SX_CLK_OSC>,
214 <&clks IMX6SX_CLK_SPDIF>,
215 <&clks 0>, <&clks 0>, <&clks 0>,
216 <&clks IMX6SX_CLK_IPG>,
217 <&clks 0>, <&clks 0>,
218 <&clks IMX6SX_CLK_SPBA>;
219 clock-names = "core", "rxtx0",
220 "rxtx1", "rxtx2",
221 "rxtx3", "rxtx4",
222 "rxtx5", "rxtx6",
223 "rxtx7", "dma";
224 status = "disabled";
225 };
226
227 ecspi1: ecspi@02008000 {
228 #address-cells = <1>;
229 #size-cells = <0>;
230 compatible = "fsl,imx6sx-ecspi", "fsl,imx51-ecspi";
231 reg = <0x02008000 0x4000>;
232 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
233 clocks = <&clks IMX6SX_CLK_ECSPI1>,
234 <&clks IMX6SX_CLK_ECSPI1>;
235 clock-names = "ipg", "per";
236 status = "disabled";
237 };
238
239 ecspi2: ecspi@0200c000 {
240 #address-cells = <1>;
241 #size-cells = <0>;
242 compatible = "fsl,imx6sx-ecspi", "fsl,imx51-ecspi";
243 reg = <0x0200c000 0x4000>;
244 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
245 clocks = <&clks IMX6SX_CLK_ECSPI2>,
246 <&clks IMX6SX_CLK_ECSPI2>;
247 clock-names = "ipg", "per";
248 status = "disabled";
249 };
250
251 ecspi3: ecspi@02010000 {
252 #address-cells = <1>;
253 #size-cells = <0>;
254 compatible = "fsl,imx6sx-ecspi", "fsl,imx51-ecspi";
255 reg = <0x02010000 0x4000>;
256 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
257 clocks = <&clks IMX6SX_CLK_ECSPI3>,
258 <&clks IMX6SX_CLK_ECSPI3>;
259 clock-names = "ipg", "per";
260 status = "disabled";
261 };
262
263 ecspi4: ecspi@02014000 {
264 #address-cells = <1>;
265 #size-cells = <0>;
266 compatible = "fsl,imx6sx-ecspi", "fsl,imx51-ecspi";
267 reg = <0x02014000 0x4000>;
268 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
269 clocks = <&clks IMX6SX_CLK_ECSPI4>,
270 <&clks IMX6SX_CLK_ECSPI4>;
271 clock-names = "ipg", "per";
272 status = "disabled";
273 };
274
275 uart1: serial@02020000 {
276 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
277 reg = <0x02020000 0x4000>;
278 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
279 clocks = <&clks IMX6SX_CLK_UART_IPG>,
280 <&clks IMX6SX_CLK_UART_SERIAL>;
281 clock-names = "ipg", "per";
282 dmas = <&sdma 25 4 0>, <&sdma 26 4 0>;
283 dma-names = "rx", "tx";
284 status = "disabled";
285 };
286
287 esai: esai@02024000 {
288 reg = <0x02024000 0x4000>;
289 interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
290 clocks = <&clks IMX6SX_CLK_ESAI_IPG>,
291 <&clks IMX6SX_CLK_ESAI_MEM>,
292 <&clks IMX6SX_CLK_ESAI_EXTAL>,
293 <&clks IMX6SX_CLK_ESAI_IPG>,
294 <&clks IMX6SX_CLK_SPBA>;
295 clock-names = "core", "mem", "extal",
296 "fsys", "dma";
297 status = "disabled";
298 };
299
300 ssi1: ssi@02028000 {
301 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
302 reg = <0x02028000 0x4000>;
303 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
304 clocks = <&clks IMX6SX_CLK_SSI1_IPG>,
305 <&clks IMX6SX_CLK_SSI1>;
306 clock-names = "ipg", "baud";
307 dmas = <&sdma 37 1 0>, <&sdma 38 1 0>;
308 dma-names = "rx", "tx";
309 fsl,fifo-depth = <15>;
310 status = "disabled";
311 };
312
313 ssi2: ssi@0202c000 {
314 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
315 reg = <0x0202c000 0x4000>;
316 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
317 clocks = <&clks IMX6SX_CLK_SSI2_IPG>,
318 <&clks IMX6SX_CLK_SSI2>;
319 clock-names = "ipg", "baud";
320 dmas = <&sdma 41 1 0>, <&sdma 42 1 0>;
321 dma-names = "rx", "tx";
322 fsl,fifo-depth = <15>;
323 status = "disabled";
324 };
325
326 ssi3: ssi@02030000 {
327 compatible = "fsl,imx6sx-ssi", "fsl,imx51-ssi";
328 reg = <0x02030000 0x4000>;
329 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
330 clocks = <&clks IMX6SX_CLK_SSI3_IPG>,
331 <&clks IMX6SX_CLK_SSI3>;
332 clock-names = "ipg", "baud";
333 dmas = <&sdma 45 1 0>, <&sdma 46 1 0>;
334 dma-names = "rx", "tx";
335 fsl,fifo-depth = <15>;
336 status = "disabled";
337 };
338
339 asrc: asrc@02034000 {
340 reg = <0x02034000 0x4000>;
341 interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
342 clocks = <&clks IMX6SX_CLK_ASRC_MEM>,
343 <&clks IMX6SX_CLK_ASRC_IPG>,
344 <&clks IMX6SX_CLK_SPDIF>,
345 <&clks IMX6SX_CLK_SPBA>;
346 clock-names = "mem", "ipg", "asrck", "dma";
347 dmas = <&sdma 17 20 1>, <&sdma 18 20 1>,
348 <&sdma 19 20 1>, <&sdma 20 20 1>,
349 <&sdma 21 20 1>, <&sdma 22 20 1>;
350 dma-names = "rxa", "rxb", "rxc",
351 "txa", "txb", "txc";
352 status = "okay";
353 };
354 };
355
356 pwm1: pwm@02080000 {
357 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
358 reg = <0x02080000 0x4000>;
359 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
360 clocks = <&clks IMX6SX_CLK_PWM1>,
361 <&clks IMX6SX_CLK_PWM1>;
362 clock-names = "ipg", "per";
363 #pwm-cells = <2>;
364 };
365
366 pwm2: pwm@02084000 {
367 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
368 reg = <0x02084000 0x4000>;
369 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
370 clocks = <&clks IMX6SX_CLK_PWM2>,
371 <&clks IMX6SX_CLK_PWM2>;
372 clock-names = "ipg", "per";
373 #pwm-cells = <2>;
374 };
375
376 pwm3: pwm@02088000 {
377 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
378 reg = <0x02088000 0x4000>;
379 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
380 clocks = <&clks IMX6SX_CLK_PWM3>,
381 <&clks IMX6SX_CLK_PWM3>;
382 clock-names = "ipg", "per";
383 #pwm-cells = <2>;
384 };
385
386 pwm4: pwm@0208c000 {
387 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
388 reg = <0x0208c000 0x4000>;
389 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
390 clocks = <&clks IMX6SX_CLK_PWM4>,
391 <&clks IMX6SX_CLK_PWM4>;
392 clock-names = "ipg", "per";
393 #pwm-cells = <2>;
394 };
395
396 flexcan1: can@02090000 {
397 compatible = "fsl,imx6sx-flexcan", "fsl,imx6q-flexcan";
398 reg = <0x02090000 0x4000>;
399 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
400 clocks = <&clks IMX6SX_CLK_CAN1_IPG>,
401 <&clks IMX6SX_CLK_CAN1_SERIAL>;
402 clock-names = "ipg", "per";
403 status = "disabled";
404 };
405
406 flexcan2: can@02094000 {
407 compatible = "fsl,imx6sx-flexcan", "fsl,imx6q-flexcan";
408 reg = <0x02094000 0x4000>;
409 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
410 clocks = <&clks IMX6SX_CLK_CAN2_IPG>,
411 <&clks IMX6SX_CLK_CAN2_SERIAL>;
412 clock-names = "ipg", "per";
413 status = "disabled";
414 };
415
416 gpt: gpt@02098000 {
417 compatible = "fsl,imx6sx-gpt", "fsl,imx31-gpt";
418 reg = <0x02098000 0x4000>;
419 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
420 clocks = <&clks IMX6SX_CLK_GPT_BUS>,
421 <&clks IMX6SX_CLK_GPT_SERIAL>;
422 clock-names = "ipg", "per";
423 };
424
425 gpio1: gpio@0209c000 {
426 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
427 reg = <0x0209c000 0x4000>;
428 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>,
429 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
430 gpio-controller;
431 #gpio-cells = <2>;
432 interrupt-controller;
433 #interrupt-cells = <2>;
434 };
435
436 gpio2: gpio@020a0000 {
437 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
438 reg = <0x020a0000 0x4000>;
439 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
440 <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
441 gpio-controller;
442 #gpio-cells = <2>;
443 interrupt-controller;
444 #interrupt-cells = <2>;
445 };
446
447 gpio3: gpio@020a4000 {
448 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
449 reg = <0x020a4000 0x4000>;
450 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
451 <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
452 gpio-controller;
453 #gpio-cells = <2>;
454 interrupt-controller;
455 #interrupt-cells = <2>;
456 };
457
458 gpio4: gpio@020a8000 {
459 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
460 reg = <0x020a8000 0x4000>;
461 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
462 <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
463 gpio-controller;
464 #gpio-cells = <2>;
465 interrupt-controller;
466 #interrupt-cells = <2>;
467 };
468
469 gpio5: gpio@020ac000 {
470 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
471 reg = <0x020ac000 0x4000>;
472 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,
473 <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
474 gpio-controller;
475 #gpio-cells = <2>;
476 interrupt-controller;
477 #interrupt-cells = <2>;
478 };
479
480 gpio6: gpio@020b0000 {
481 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
482 reg = <0x020b0000 0x4000>;
483 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>,
484 <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
485 gpio-controller;
486 #gpio-cells = <2>;
487 interrupt-controller;
488 #interrupt-cells = <2>;
489 };
490
491 gpio7: gpio@020b4000 {
492 compatible = "fsl,imx6sx-gpio", "fsl,imx35-gpio";
493 reg = <0x020b4000 0x4000>;
494 interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>,
495 <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
496 gpio-controller;
497 #gpio-cells = <2>;
498 interrupt-controller;
499 #interrupt-cells = <2>;
500 };
501
502 kpp: kpp@020b8000 {
503 compatible = "fsl,imx6sx-kpp", "fsl,imx21-kpp";
504 reg = <0x020b8000 0x4000>;
505 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
506 clocks = <&clks IMX6SX_CLK_DUMMY>;
507 status = "disabled";
508 };
509
510 wdog1: wdog@020bc000 {
511 compatible = "fsl,imx6sx-wdt", "fsl,imx21-wdt";
512 reg = <0x020bc000 0x4000>;
513 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
514 clocks = <&clks IMX6SX_CLK_DUMMY>;
515 };
516
517 wdog2: wdog@020c0000 {
518 compatible = "fsl,imx6sx-wdt", "fsl,imx21-wdt";
519 reg = <0x020c0000 0x4000>;
520 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
521 clocks = <&clks IMX6SX_CLK_DUMMY>;
522 status = "disabled";
523 };
524
525 clks: ccm@020c4000 {
526 compatible = "fsl,imx6sx-ccm";
527 reg = <0x020c4000 0x4000>;
528 interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
529 <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
530 #clock-cells = <1>;
531 clocks = <&ckil>, <&osc>, <&ipp_di0>, <&ipp_di1>;
532 clock-names = "ckil", "osc", "ipp_di0", "ipp_di1";
533 };
534
535 anatop: anatop@020c8000 {
536 compatible = "fsl,imx6sx-anatop", "fsl,imx6q-anatop",
537 "syscon", "simple-bus";
538 reg = <0x020c8000 0x1000>;
539 interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>,
540 <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
541 <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
542
543 regulator-1p1@110 {
544 compatible = "fsl,anatop-regulator";
545 regulator-name = "vdd1p1";
546 regulator-min-microvolt = <800000>;
547 regulator-max-microvolt = <1375000>;
548 regulator-always-on;
549 anatop-reg-offset = <0x110>;
550 anatop-vol-bit-shift = <8>;
551 anatop-vol-bit-width = <5>;
552 anatop-min-bit-val = <4>;
553 anatop-min-voltage = <800000>;
554 anatop-max-voltage = <1375000>;
555 };
556
557 regulator-3p0@120 {
558 compatible = "fsl,anatop-regulator";
559 regulator-name = "vdd3p0";
560 regulator-min-microvolt = <2800000>;
561 regulator-max-microvolt = <3150000>;
562 regulator-always-on;
563 anatop-reg-offset = <0x120>;
564 anatop-vol-bit-shift = <8>;
565 anatop-vol-bit-width = <5>;
566 anatop-min-bit-val = <0>;
567 anatop-min-voltage = <2625000>;
568 anatop-max-voltage = <3400000>;
569 };
570
571 regulator-2p5@130 {
572 compatible = "fsl,anatop-regulator";
573 regulator-name = "vdd2p5";
574 regulator-min-microvolt = <2100000>;
575 regulator-max-microvolt = <2875000>;
576 regulator-always-on;
577 anatop-reg-offset = <0x130>;
578 anatop-vol-bit-shift = <8>;
579 anatop-vol-bit-width = <5>;
580 anatop-min-bit-val = <0>;
581 anatop-min-voltage = <2100000>;
582 anatop-max-voltage = <2875000>;
583 };
584
585 reg_arm: regulator-vddcore@140 {
586 compatible = "fsl,anatop-regulator";
587 regulator-name = "vddarm";
588 regulator-min-microvolt = <725000>;
589 regulator-max-microvolt = <1450000>;
590 regulator-always-on;
591 anatop-reg-offset = <0x140>;
592 anatop-vol-bit-shift = <0>;
593 anatop-vol-bit-width = <5>;
594 anatop-delay-reg-offset = <0x170>;
595 anatop-delay-bit-shift = <24>;
596 anatop-delay-bit-width = <2>;
597 anatop-min-bit-val = <1>;
598 anatop-min-voltage = <725000>;
599 anatop-max-voltage = <1450000>;
600 };
601
602 reg_pcie: regulator-vddpcie@140 {
603 compatible = "fsl,anatop-regulator";
604 regulator-name = "vddpcie";
605 regulator-min-microvolt = <725000>;
606 regulator-max-microvolt = <1450000>;
607 anatop-reg-offset = <0x140>;
608 anatop-vol-bit-shift = <9>;
609 anatop-vol-bit-width = <5>;
610 anatop-delay-reg-offset = <0x170>;
611 anatop-delay-bit-shift = <26>;
612 anatop-delay-bit-width = <2>;
613 anatop-min-bit-val = <1>;
614 anatop-min-voltage = <725000>;
615 anatop-max-voltage = <1450000>;
616 };
617
618 reg_soc: regulator-vddsoc@140 {
619 compatible = "fsl,anatop-regulator";
620 regulator-name = "vddsoc";
621 regulator-min-microvolt = <725000>;
622 regulator-max-microvolt = <1450000>;
623 regulator-always-on;
624 anatop-reg-offset = <0x140>;
625 anatop-vol-bit-shift = <18>;
626 anatop-vol-bit-width = <5>;
627 anatop-delay-reg-offset = <0x170>;
628 anatop-delay-bit-shift = <28>;
629 anatop-delay-bit-width = <2>;
630 anatop-min-bit-val = <1>;
631 anatop-min-voltage = <725000>;
632 anatop-max-voltage = <1450000>;
633 };
634 };
635
636 tempmon: tempmon {
637 compatible = "fsl,imx6sx-tempmon", "fsl,imx6q-tempmon";
638 interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
639 fsl,tempmon = <&anatop>;
640 fsl,tempmon-data = <&ocotp>;
641 clocks = <&clks IMX6SX_CLK_PLL3_USB_OTG>;
642 };
643
644 usbphy1: usbphy@020c9000 {
645 compatible = "fsl,imx6sx-usbphy", "fsl,imx23-usbphy";
646 reg = <0x020c9000 0x1000>;
647 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
648 clocks = <&clks IMX6SX_CLK_USBPHY1>;
649 fsl,anatop = <&anatop>;
650 };
651
652 usbphy2: usbphy@020ca000 {
653 compatible = "fsl,imx6sx-usbphy", "fsl,imx23-usbphy";
654 reg = <0x020ca000 0x1000>;
655 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
656 clocks = <&clks IMX6SX_CLK_USBPHY2>;
657 fsl,anatop = <&anatop>;
658 };
659
660 snvs: snvs@020cc000 {
661 compatible = "fsl,sec-v4.0-mon", "simple-bus";
662 #address-cells = <1>;
663 #size-cells = <1>;
664 ranges = <0 0x020cc000 0x4000>;
665
666 snvs-rtc-lp@34 {
667 compatible = "fsl,sec-v4.0-mon-rtc-lp";
668 reg = <0x34 0x58>;
669 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
670 };
671 };
672
673 epit1: epit@020d0000 {
674 reg = <0x020d0000 0x4000>;
675 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
676 };
677
678 epit2: epit@020d4000 {
679 reg = <0x020d4000 0x4000>;
680 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
681 };
682
683 src: src@020d8000 {
684 compatible = "fsl,imx6sx-src", "fsl,imx51-src";
685 reg = <0x020d8000 0x4000>;
686 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>,
687 <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
688 #reset-cells = <1>;
689 };
690
691 gpc: gpc@020dc000 {
692 compatible = "fsl,imx6sx-gpc", "fsl,imx6q-gpc";
693 reg = <0x020dc000 0x4000>;
694 interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
695 };
696
697 iomuxc: iomuxc@020e0000 {
698 compatible = "fsl,imx6sx-iomuxc";
699 reg = <0x020e0000 0x4000>;
700 };
701
702 gpr: iomuxc-gpr@020e4000 {
703 compatible = "fsl,imx6sx-iomuxc-gpr",
704 "fsl,imx6q-iomuxc-gpr", "syscon";
705 reg = <0x020e4000 0x4000>;
706 };
707
708 sdma: sdma@020ec000 {
709 compatible = "fsl,imx6sx-sdma", "fsl,imx6q-sdma";
710 reg = <0x020ec000 0x4000>;
711 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
712 clocks = <&clks IMX6SX_CLK_SDMA>,
713 <&clks IMX6SX_CLK_SDMA>;
714 clock-names = "ipg", "ahb";
715 #dma-cells = <3>;
716 /* imx6sx reuses imx6q sdma firmware */
717 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6q.bin";
718 };
719 };
720
721 aips2: aips-bus@02100000 {
722 compatible = "fsl,aips-bus", "simple-bus";
723 #address-cells = <1>;
724 #size-cells = <1>;
725 reg = <0x02100000 0x100000>;
726 ranges;
727
728 usbotg1: usb@02184000 {
729 compatible = "fsl,imx6sx-usb", "fsl,imx27-usb";
730 reg = <0x02184000 0x200>;
731 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
732 clocks = <&clks IMX6SX_CLK_USBOH3>;
733 fsl,usbphy = <&usbphy1>;
734 fsl,usbmisc = <&usbmisc 0>;
735 fsl,anatop = <&anatop>;
736 status = "disabled";
737 };
738
739 usbotg2: usb@02184200 {
740 compatible = "fsl,imx6sx-usb", "fsl,imx27-usb";
741 reg = <0x02184200 0x200>;
742 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
743 clocks = <&clks IMX6SX_CLK_USBOH3>;
744 fsl,usbphy = <&usbphy2>;
745 fsl,usbmisc = <&usbmisc 1>;
746 status = "disabled";
747 };
748
749 usbh: usb@02184400 {
750 compatible = "fsl,imx6sx-usb", "fsl,imx27-usb";
751 reg = <0x02184400 0x200>;
752 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
753 clocks = <&clks IMX6SX_CLK_USBOH3>;
754 fsl,usbmisc = <&usbmisc 2>;
755 phy_type = "hsic";
756 fsl,anatop = <&anatop>;
757 status = "disabled";
758 };
759
760 usbmisc: usbmisc@02184800 {
761 #index-cells = <1>;
762 compatible = "fsl,imx6sx-usbmisc", "fsl,imx6q-usbmisc";
763 reg = <0x02184800 0x200>;
764 clocks = <&clks IMX6SX_CLK_USBOH3>;
765 };
766
767 fec1: ethernet@02188000 {
768 compatible = "fsl,imx6sx-fec", "fsl,imx6q-fec";
769 reg = <0x02188000 0x4000>;
770 interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
771 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
772 clocks = <&clks IMX6SX_CLK_ENET>,
773 <&clks IMX6SX_CLK_ENET_AHB>,
774 <&clks IMX6SX_CLK_ENET_PTP>,
775 <&clks IMX6SX_CLK_ENET_REF>,
776 <&clks IMX6SX_CLK_ENET_PTP>;
777 clock-names = "ipg", "ahb", "ptp",
778 "enet_clk_ref", "enet_out";
779 status = "disabled";
780 };
781
782 mlb: mlb@0218c000 {
783 reg = <0x0218c000 0x4000>;
784 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>,
785 <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
786 <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
787 clocks = <&clks IMX6SX_CLK_MLB>;
788 status = "disabled";
789 };
790
791 usdhc1: usdhc@02190000 {
792 compatible = "fsl,imx6sx-usdhc", "fsl,imx6sl-usdhc";
793 reg = <0x02190000 0x4000>;
794 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
795 clocks = <&clks IMX6SX_CLK_USDHC1>,
796 <&clks IMX6SX_CLK_USDHC1>,
797 <&clks IMX6SX_CLK_USDHC1>;
798 clock-names = "ipg", "ahb", "per";
799 bus-width = <4>;
800 status = "disabled";
801 };
802
803 usdhc2: usdhc@02194000 {
804 compatible = "fsl,imx6sx-usdhc", "fsl,imx6sl-usdhc";
805 reg = <0x02194000 0x4000>;
806 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
807 clocks = <&clks IMX6SX_CLK_USDHC2>,
808 <&clks IMX6SX_CLK_USDHC2>,
809 <&clks IMX6SX_CLK_USDHC2>;
810 clock-names = "ipg", "ahb", "per";
811 bus-width = <4>;
812 status = "disabled";
813 };
814
815 usdhc3: usdhc@02198000 {
816 compatible = "fsl,imx6sx-usdhc", "fsl,imx6sl-usdhc";
817 reg = <0x02198000 0x4000>;
818 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
819 clocks = <&clks IMX6SX_CLK_USDHC3>,
820 <&clks IMX6SX_CLK_USDHC3>,
821 <&clks IMX6SX_CLK_USDHC3>;
822 clock-names = "ipg", "ahb", "per";
823 bus-width = <4>;
824 status = "disabled";
825 };
826
827 usdhc4: usdhc@0219c000 {
828 compatible = "fsl,imx6sx-usdhc", "fsl,imx6sl-usdhc";
829 reg = <0x0219c000 0x4000>;
830 interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
831 clocks = <&clks IMX6SX_CLK_USDHC4>,
832 <&clks IMX6SX_CLK_USDHC4>,
833 <&clks IMX6SX_CLK_USDHC4>;
834 clock-names = "ipg", "ahb", "per";
835 bus-width = <4>;
836 status = "disabled";
837 };
838
839 i2c1: i2c@021a0000 {
840 #address-cells = <1>;
841 #size-cells = <0>;
842 compatible = "fsl,imx6sx-i2c", "fsl,imx21-i2c";
843 reg = <0x021a0000 0x4000>;
844 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
845 clocks = <&clks IMX6SX_CLK_I2C1>;
846 status = "disabled";
847 };
848
849 i2c2: i2c@021a4000 {
850 #address-cells = <1>;
851 #size-cells = <0>;
852 compatible = "fsl,imx6sx-i2c", "fsl,imx21-i2c";
853 reg = <0x021a4000 0x4000>;
854 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
855 clocks = <&clks IMX6SX_CLK_I2C2>;
856 status = "disabled";
857 };
858
859 i2c3: i2c@021a8000 {
860 #address-cells = <1>;
861 #size-cells = <0>;
862 compatible = "fsl,imx6sx-i2c", "fsl,imx21-i2c";
863 reg = <0x021a8000 0x4000>;
864 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
865 clocks = <&clks IMX6SX_CLK_I2C3>;
866 status = "disabled";
867 };
868
869 mmdc: mmdc@021b0000 {
870 compatible = "fsl,imx6sx-mmdc", "fsl,imx6q-mmdc";
871 reg = <0x021b0000 0x4000>;
872 };
873
874 fec2: ethernet@021b4000 {
875 compatible = "fsl,imx6sx-fec";
876 reg = <0x021b4000 0x4000>;
877 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
878 <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
879 clocks = <&clks IMX6SX_CLK_ENET>,
880 <&clks IMX6SX_CLK_ENET_AHB>,
881 <&clks IMX6SX_CLK_ENET_PTP>,
882 <&clks IMX6SX_CLK_ENET2_REF_125M>,
883 <&clks IMX6SX_CLK_ENET_PTP>;
884 clock-names = "ipg", "ahb", "ptp",
885 "enet_clk_ref", "enet_out";
886 status = "disabled";
887 };
888
889 weim: weim@021b8000 {
890 compatible = "fsl,imx6sx-weim", "fsl,imx6q-weim";
891 reg = <0x021b8000 0x4000>;
892 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
893 clocks = <&clks IMX6SX_CLK_EIM_SLOW>;
894 };
895
896 ocotp: ocotp@021bc000 {
897 compatible = "fsl,imx6sx-ocotp", "syscon";
898 reg = <0x021bc000 0x4000>;
899 clocks = <&clks IMX6SX_CLK_OCOTP>;
900 };
901
902 sai1: sai@021d4000 {
903 compatible = "fsl,imx6sx-sai";
904 reg = <0x021d4000 0x4000>;
905 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
906 clocks = <&clks IMX6SX_CLK_SAI1_IPG>,
907 <&clks IMX6SX_CLK_SAI1>,
908 <&clks 0>, <&clks 0>;
909 clock-names = "bus", "mclk1", "mclk2", "mclk3";
910 dma-names = "rx", "tx";
911 dmas = <&sdma 31 23 0>, <&sdma 32 23 0>;
912 dma-source = <&gpr 0 15 0 16>;
913 status = "disabled";
914 };
915
916 audmux: audmux@021d8000 {
917 compatible = "fsl,imx6sx-audmux", "fsl,imx31-audmux";
918 reg = <0x021d8000 0x4000>;
919 status = "disabled";
920 };
921
922 sai2: sai@021dc000 {
923 compatible = "fsl,imx6sx-sai";
924 reg = <0x021dc000 0x4000>;
925 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
926 clocks = <&clks IMX6SX_CLK_SAI2_IPG>,
927 <&clks IMX6SX_CLK_SAI2>,
928 <&clks 0>, <&clks 0>;
929 clock-names = "bus", "mclk1", "mclk2", "mclk3";
930 dma-names = "rx", "tx";
931 dmas = <&sdma 33 23 0>, <&sdma 34 23 0>;
932 dma-source = <&gpr 0 17 0 18>;
933 status = "disabled";
934 };
935
936 qspi1: qspi@021e0000 {
937 #address-cells = <1>;
938 #size-cells = <0>;
939 compatible = "fsl,imx6sx-qspi";
940 reg = <0x021e0000 0x4000>, <0x60000000 0x10000000>;
941 reg-names = "QuadSPI", "QuadSPI-memory";
942 interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
943 clocks = <&clks IMX6SX_CLK_QSPI1>,
944 <&clks IMX6SX_CLK_QSPI1>;
945 clock-names = "qspi_en", "qspi";
946 status = "disabled";
947 };
948
949 qspi2: qspi@021e4000 {
950 #address-cells = <1>;
951 #size-cells = <0>;
952 compatible = "fsl,imx6sx-qspi";
953 reg = <0x021e4000 0x4000>, <0x70000000 0x10000000>;
954 reg-names = "QuadSPI", "QuadSPI-memory";
955 interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
956 clocks = <&clks IMX6SX_CLK_QSPI2>,
957 <&clks IMX6SX_CLK_QSPI2>;
958 clock-names = "qspi_en", "qspi";
959 status = "disabled";
960 };
961
962 uart2: serial@021e8000 {
963 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
964 reg = <0x021e8000 0x4000>;
965 interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
966 clocks = <&clks IMX6SX_CLK_UART_IPG>,
967 <&clks IMX6SX_CLK_UART_SERIAL>;
968 clock-names = "ipg", "per";
969 dmas = <&sdma 27 4 0>, <&sdma 28 4 0>;
970 dma-names = "rx", "tx";
971 status = "disabled";
972 };
973
974 uart3: serial@021ec000 {
975 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
976 reg = <0x021ec000 0x4000>;
977 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
978 clocks = <&clks IMX6SX_CLK_UART_IPG>,
979 <&clks IMX6SX_CLK_UART_SERIAL>;
980 clock-names = "ipg", "per";
981 dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
982 dma-names = "rx", "tx";
983 status = "disabled";
984 };
985
986 uart4: serial@021f0000 {
987 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
988 reg = <0x021f0000 0x4000>;
989 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
990 clocks = <&clks IMX6SX_CLK_UART_IPG>,
991 <&clks IMX6SX_CLK_UART_SERIAL>;
992 clock-names = "ipg", "per";
993 dmas = <&sdma 31 4 0>, <&sdma 32 4 0>;
994 dma-names = "rx", "tx";
995 status = "disabled";
996 };
997
998 uart5: serial@021f4000 {
999 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
1000 reg = <0x021f4000 0x4000>;
1001 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
1002 clocks = <&clks IMX6SX_CLK_UART_IPG>,
1003 <&clks IMX6SX_CLK_UART_SERIAL>;
1004 clock-names = "ipg", "per";
1005 dmas = <&sdma 33 4 0>, <&sdma 34 4 0>;
1006 dma-names = "rx", "tx";
1007 status = "disabled";
1008 };
1009
1010 i2c4: i2c@021f8000 {
1011 #address-cells = <1>;
1012 #size-cells = <0>;
1013 compatible = "fsl,imx6sx-i2c", "fsl,imx21-i2c";
1014 reg = <0x021f8000 0x4000>;
1015 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
1016 clocks = <&clks IMX6SX_CLK_I2C4>;
1017 status = "disabled";
1018 };
1019 };
1020
1021 aips3: aips-bus@02200000 {
1022 compatible = "fsl,aips-bus", "simple-bus";
1023 #address-cells = <1>;
1024 #size-cells = <1>;
1025 reg = <0x02200000 0x100000>;
1026 ranges;
1027
1028 spba-bus@02200000 {
1029 compatible = "fsl,spba-bus", "simple-bus";
1030 #address-cells = <1>;
1031 #size-cells = <1>;
1032 reg = <0x02240000 0x40000>;
1033 ranges;
1034
1035 csi1: csi@02214000 {
1036 reg = <0x02214000 0x4000>;
1037 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
1038 clocks = <&clks IMX6SX_CLK_DISPLAY_AXI>,
1039 <&clks IMX6SX_CLK_CSI>,
1040 <&clks IMX6SX_CLK_DCIC1>;
1041 clock-names = "disp-axi", "csi_mclk", "dcic";
1042 status = "disabled";
1043 };
1044
1045 pxp: pxp@02218000 {
1046 reg = <0x02218000 0x4000>;
1047 interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
1048 clocks = <&clks IMX6SX_CLK_PXP_AXI>,
1049 <&clks IMX6SX_CLK_DISPLAY_AXI>;
1050 clock-names = "pxp-axi", "disp-axi";
1051 status = "disabled";
1052 };
1053
1054 csi2: csi@0221c000 {
1055 reg = <0x0221c000 0x4000>;
1056 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
1057 clocks = <&clks IMX6SX_CLK_DISPLAY_AXI>,
1058 <&clks IMX6SX_CLK_CSI>,
1059 <&clks IMX6SX_CLK_DCIC2>;
1060 clock-names = "disp-axi", "csi_mclk", "dcic";
1061 status = "disabled";
1062 };
1063
1064 lcdif1: lcdif@02220000 {
1065 reg = <0x02220000 0x4000>;
1066 interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
1067 clocks = <&clks IMX6SX_CLK_LCDIF1_PIX>,
1068 <&clks IMX6SX_CLK_LCDIF_APB>,
1069 <&clks IMX6SX_CLK_DISPLAY_AXI>;
1070 clock-names = "pix", "axi", "disp_axi";
1071 status = "disabled";
1072 };
1073
1074 lcdif2: lcdif@02224000 {
1075 reg = <0x02224000 0x4000>;
1076 interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
1077 clocks = <&clks IMX6SX_CLK_LCDIF2_PIX>,
1078 <&clks IMX6SX_CLK_LCDIF_APB>,
1079 <&clks IMX6SX_CLK_DISPLAY_AXI>;
1080 clock-names = "pix", "axi", "disp_axi";
1081 status = "disabled";
1082 };
1083
1084 vadc: vadc@02228000 {
1085 reg = <0x02228000 0x4000>, <0x0222c000 0x4000>;
1086 reg-names = "vadc-vafe", "vadc-vdec";
1087 clocks = <&clks IMX6SX_CLK_VADC>,
1088 <&clks IMX6SX_CLK_CSI>;
1089 clock-names = "vadc", "csi";
1090 status = "disabled";
1091 };
1092 };
1093
1094 adc1: adc@02280000 {
1095 compatible = "fsl,imx6sx-adc", "fsl,vf610-adc";
1096 reg = <0x02280000 0x4000>;
1097 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
1098 clocks = <&clks IMX6SX_CLK_IPG>;
1099 clock-names = "adc";
1100 status = "disabled";
1101 };
1102
1103 adc2: adc@02284000 {
1104 compatible = "fsl,imx6sx-adc", "fsl,vf610-adc";
1105 reg = <0x02284000 0x4000>;
1106 interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
1107 clocks = <&clks IMX6SX_CLK_IPG>;
1108 clock-names = "adc";
1109 status = "disabled";
1110 };
1111
1112 wdog3: wdog@02288000 {
1113 compatible = "fsl,imx6sx-wdt", "fsl,imx21-wdt";
1114 reg = <0x02288000 0x4000>;
1115 interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
1116 clocks = <&clks IMX6SX_CLK_DUMMY>;
1117 status = "disabled";
1118 };
1119
1120 ecspi5: ecspi@0228c000 {
1121 #address-cells = <1>;
1122 #size-cells = <0>;
1123 compatible = "fsl,imx6sx-ecspi", "fsl,imx51-ecspi";
1124 reg = <0x0228c000 0x4000>;
1125 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
1126 clocks = <&clks IMX6SX_CLK_ECSPI5>,
1127 <&clks IMX6SX_CLK_ECSPI5>;
1128 clock-names = "ipg", "per";
1129 status = "disabled";
1130 };
1131
1132 uart6: serial@022a0000 {
1133 compatible = "fsl,imx6sx-uart", "fsl,imx21-uart";
1134 reg = <0x022a0000 0x4000>;
1135 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
1136 clocks = <&clks IMX6SX_CLK_UART_IPG>,
1137 <&clks IMX6SX_CLK_UART_SERIAL>;
1138 clock-names = "ipg", "per";
1139 dmas = <&sdma 0 4 0>, <&sdma 47 4 0>;
1140 dma-names = "rx", "tx";
1141 status = "disabled";
1142 };
1143
1144 pwm5: pwm@022a4000 {
1145 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
1146 reg = <0x022a4000 0x4000>;
1147 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
1148 clocks = <&clks IMX6SX_CLK_PWM5>,
1149 <&clks IMX6SX_CLK_PWM5>;
1150 clock-names = "ipg", "per";
1151 #pwm-cells = <2>;
1152 };
1153
1154 pwm6: pwm@022a8000 {
1155 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
1156 reg = <0x022a8000 0x4000>;
1157 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
1158 clocks = <&clks IMX6SX_CLK_PWM6>,
1159 <&clks IMX6SX_CLK_PWM6>;
1160 clock-names = "ipg", "per";
1161 #pwm-cells = <2>;
1162 };
1163
1164 pwm7: pwm@022ac000 {
1165 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
1166 reg = <0x022ac000 0x4000>;
1167 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
1168 clocks = <&clks IMX6SX_CLK_PWM7>,
1169 <&clks IMX6SX_CLK_PWM7>;
1170 clock-names = "ipg", "per";
1171 #pwm-cells = <2>;
1172 };
1173
1174 pwm8: pwm@0022b0000 {
1175 compatible = "fsl,imx6sx-pwm", "fsl,imx27-pwm";
1176 reg = <0x0022b0000 0x4000>;
1177 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
1178 clocks = <&clks IMX6SX_CLK_PWM8>,
1179 <&clks IMX6SX_CLK_PWM8>;
1180 clock-names = "ipg", "per";
1181 #pwm-cells = <2>;
1182 };
1183 };
1184
1185 pcie: pcie@0x08000000 {
1186 compatible = "fsl,imx6sx-pcie", "snps,dw-pcie";
1187 reg = <0x08ffc000 0x4000>; /* DBI */
1188 #address-cells = <3>;
1189 #size-cells = <2>;
1190 device_type = "pci";
1191 /* configuration space */
1192 ranges = <0x00000800 0 0x08f00000 0x08f00000 0 0x00080000
1193 /* downstream I/O */
1194 0x81000000 0 0 0x08f80000 0 0x00010000
1195 /* non-prefetchable memory */
1196 0x82000000 0 0x08000000 0x08000000 0 0x00f00000>;
1197 num-lanes = <1>;
1198 interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
1199 clocks = <&clks IMX6SX_CLK_PCIE_REF_125M>,
1200 <&clks IMX6SX_CLK_PCIE_AXI>,
1201 <&clks IMX6SX_CLK_LVDS1_OUT>,
1202 <&clks IMX6SX_CLK_DISPLAY_AXI>;
1203 clock-names = "pcie_ref_125m", "pcie_axi",
1204 "lvds_gate", "display_axi";
1205 status = "disabled";
1206 };
1207 };
1208};
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
index b10e6351da53..cf06e32ee108 100644
--- a/arch/arm/boot/dts/integratorap.dts
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -8,6 +8,7 @@
8/ { 8/ {
9 model = "ARM Integrator/AP"; 9 model = "ARM Integrator/AP";
10 compatible = "arm,integrator-ap"; 10 compatible = "arm,integrator-ap";
11 dma-ranges = <0x80000000 0x0 0x80000000>;
11 12
12 aliases { 13 aliases {
13 arm,timer-primary = &timer2; 14 arm,timer-primary = &timer2;
diff --git a/arch/arm/boot/dts/k2e-clocks.dtsi b/arch/arm/boot/dts/k2e-clocks.dtsi
index 90774d604bc1..598afe91c676 100644
--- a/arch/arm/boot/dts/k2e-clocks.dtsi
+++ b/arch/arm/boot/dts/k2e-clocks.dtsi
@@ -22,7 +22,7 @@ clocks {
22 #clock-cells = <0>; 22 #clock-cells = <0>;
23 compatible = "ti,keystone,pll-clock"; 23 compatible = "ti,keystone,pll-clock";
24 clocks = <&refclkpass>; 24 clocks = <&refclkpass>;
25 clock-output-names = "pa-pll-clk"; 25 clock-output-names = "papllclk";
26 reg = <0x02620358 4>; 26 reg = <0x02620358 4>;
27 reg-names = "control"; 27 reg-names = "control";
28 }; 28 };
diff --git a/arch/arm/boot/dts/k2hk-clocks.dtsi b/arch/arm/boot/dts/k2hk-clocks.dtsi
index 96e65365afe3..d5adee3c0067 100644
--- a/arch/arm/boot/dts/k2hk-clocks.dtsi
+++ b/arch/arm/boot/dts/k2hk-clocks.dtsi
@@ -31,7 +31,7 @@ clocks {
31 #clock-cells = <0>; 31 #clock-cells = <0>;
32 compatible = "ti,keystone,pll-clock"; 32 compatible = "ti,keystone,pll-clock";
33 clocks = <&refclkpass>; 33 clocks = <&refclkpass>;
34 clock-output-names = "pa-pll-clk"; 34 clock-output-names = "papllclk";
35 reg = <0x02620358 4>; 35 reg = <0x02620358 4>;
36 reg-names = "control"; 36 reg-names = "control";
37 }; 37 };
diff --git a/arch/arm/boot/dts/k2hk-evm.dts b/arch/arm/boot/dts/k2hk-evm.dts
index 1f90cbf27fd7..3223cc152a85 100644
--- a/arch/arm/boot/dts/k2hk-evm.dts
+++ b/arch/arm/boot/dts/k2hk-evm.dts
@@ -167,3 +167,15 @@
167 }; 167 };
168 }; 168 };
169}; 169};
170
171&mdio {
172 ethphy0: ethernet-phy@0 {
173 compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
174 reg = <0>;
175 };
176
177 ethphy1: ethernet-phy@1 {
178 compatible = "marvell,88E1111", "ethernet-phy-ieee802.3-c22";
179 reg = <1>;
180 };
181};
diff --git a/arch/arm/boot/dts/k2l-clocks.dtsi b/arch/arm/boot/dts/k2l-clocks.dtsi
index f584b80200f8..eb1e3e29f073 100644
--- a/arch/arm/boot/dts/k2l-clocks.dtsi
+++ b/arch/arm/boot/dts/k2l-clocks.dtsi
@@ -31,7 +31,7 @@ clocks {
31 #clock-cells = <0>; 31 #clock-cells = <0>;
32 compatible = "ti,keystone,pll-clock"; 32 compatible = "ti,keystone,pll-clock";
33 clocks = <&refclksys>; 33 clocks = <&refclksys>;
34 clock-output-names = "pa-pll-clk"; 34 clock-output-names = "papllclk";
35 reg = <0x02620358 4>; 35 reg = <0x02620358 4>;
36 reg-names = "control"; 36 reg-names = "control";
37 }; 37 };
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index 93f82c7010ab..0c334b25781e 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -215,7 +215,7 @@ clocks {
215 clkpa: clkpa { 215 clkpa: clkpa {
216 #clock-cells = <0>; 216 #clock-cells = <0>;
217 compatible = "ti,keystone,psc-clock"; 217 compatible = "ti,keystone,psc-clock";
218 clocks = <&chipclk16>; 218 clocks = <&paclk13>;
219 clock-output-names = "pa"; 219 clock-output-names = "pa";
220 reg = <0x0235001c 0xb00>, <0x02350008 0x400>; 220 reg = <0x0235001c 0xb00>, <0x02350008 0x400>;
221 reg-names = "control", "domain"; 221 reg-names = "control", "domain";
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
index c1414cb81fd4..9e31fe7d31f8 100644
--- a/arch/arm/boot/dts/keystone.dtsi
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -266,5 +266,16 @@
266 ranges = <0 0 0x30000000 0x10000000 266 ranges = <0 0 0x30000000 0x10000000
267 1 0 0x21000A00 0x00000100>; 267 1 0 0x21000A00 0x00000100>;
268 }; 268 };
269
270 mdio: mdio@02090300 {
271 compatible = "ti,keystone_mdio", "ti,davinci_mdio";
272 #address-cells = <1>;
273 #size-cells = <0>;
274 reg = <0x02090300 0x100>;
275 status = "disabled";
276 clocks = <&clkpa>;
277 clock-names = "fck";
278 bus_freq = <2500000>;
279 };
269 }; 280 };
270}; 281};
diff --git a/arch/arm/boot/dts/kirkwood-d2net.dts b/arch/arm/boot/dts/kirkwood-d2net.dts
new file mode 100644
index 000000000000..6b7856025001
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-d2net.dts
@@ -0,0 +1,42 @@
1/*
2 * Device Tree file for d2 Network v2
3 *
4 * Copyright (C) 2014 Simon Guinot <simon.guinot@sequanux.org>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9*/
10
11/dts-v1/;
12
13#include "kirkwood-netxbig.dtsi"
14
15/ {
16 model = "LaCie d2 Network v2";
17 compatible = "lacie,d2net_v2", "lacie,netxbig", "marvell,kirkwood-88f6281", "marvell,kirkwood";
18
19 memory {
20 device_type = "memory";
21 reg = <0x00000000 0x10000000>;
22 };
23
24 ns2-leds {
25 compatible = "lacie,ns2-leds";
26
27 blue-sata {
28 label = "d2net_v2:blue:sata";
29 slow-gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
30 cmd-gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
31 };
32 };
33
34 gpio-leds {
35 compatible = "gpio-leds";
36
37 red-fail {
38 label = "d2net_v2:red:fail";
39 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
40 };
41 };
42};
diff --git a/arch/arm/boot/dts/kirkwood-net2big.dts b/arch/arm/boot/dts/kirkwood-net2big.dts
new file mode 100644
index 000000000000..53dc37a3b687
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-net2big.dts
@@ -0,0 +1,60 @@
1/*
2 * Device Tree file for LaCie 2Big Network v2
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * Based on netxbig_v2-setup.c,
9 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14*/
15
16/dts-v1/;
17
18#include "kirkwood.dtsi"
19#include "kirkwood-6281.dtsi"
20#include "kirkwood-netxbig.dtsi"
21
22/ {
23 model = "LaCie 2Big Network v2";
24 compatible = "lacie,net2big_v2", "lacie,netxbig", "marvell,kirkwood-88f6281", "marvell,kirkwood";
25
26 memory {
27 device_type = "memory";
28 reg = <0x00000000 0x10000000>;
29 };
30};
31
32&regulators {
33 regulator@2 {
34 compatible = "regulator-fixed";
35 reg = <2>;
36 regulator-name = "hdd1power";
37 regulator-min-microvolt = <5000000>;
38 regulator-max-microvolt = <5000000>;
39 enable-active-high;
40 regulator-always-on;
41 regulator-boot-on;
42 gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;
43 };
44
45 clocks {
46 g762_clk: g762-oscillator {
47 compatible = "fixed-clock";
48 #clock-cells = <0>;
49 clock-frequency = <32768>;
50 };
51 };
52};
53
54&i2c0 {
55 g762@3e {
56 compatible = "gmt,g762";
57 reg = <0x3e>;
58 clocks = <&g762_clk>;
59 };
60};
diff --git a/arch/arm/boot/dts/kirkwood-net5big.dts b/arch/arm/boot/dts/kirkwood-net5big.dts
new file mode 100644
index 000000000000..36155b749d9f
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-net5big.dts
@@ -0,0 +1,111 @@
1/*
2 * Device Tree file for LaCie 5Big Network v2
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * Based on netxbig_v2-setup.c,
9 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14*/
15
16/dts-v1/;
17
18#include "kirkwood.dtsi"
19#include "kirkwood-6281.dtsi"
20#include "kirkwood-netxbig.dtsi"
21
22/ {
23 model = "LaCie 5Big Network v2";
24 compatible = "lacie,net5big_v2", "lacie,netxbig", "marvell,kirkwood-88f6281", "marvell,kirkwood";
25
26 memory {
27 device_type = "memory";
28 reg = <0x00000000 0x20000000>;
29 };
30
31};
32
33&regulators {
34 regulator@2 {
35 compatible = "regulator-fixed";
36 reg = <2>;
37 regulator-name = "hdd1power";
38 regulator-min-microvolt = <5000000>;
39 regulator-max-microvolt = <5000000>;
40 enable-active-high;
41 regulator-always-on;
42 regulator-boot-on;
43 gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;
44 };
45
46 regulator@3 {
47 compatible = "regulator-fixed";
48 reg = <3>;
49 regulator-name = "hdd2power";
50 regulator-min-microvolt = <5000000>;
51 regulator-max-microvolt = <5000000>;
52 enable-active-high;
53 regulator-always-on;
54 regulator-boot-on;
55 gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
56 };
57
58 regulator@4 {
59 compatible = "regulator-fixed";
60 reg = <4>;
61 regulator-name = "hdd3power";
62 regulator-min-microvolt = <5000000>;
63 regulator-max-microvolt = <5000000>;
64 enable-active-high;
65 regulator-always-on;
66 regulator-boot-on;
67 gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
68 };
69
70 regulator@5 {
71 compatible = "regulator-fixed";
72 reg = <5>;
73 regulator-name = "hdd4power";
74 regulator-min-microvolt = <5000000>;
75 regulator-max-microvolt = <5000000>;
76 enable-active-high;
77 regulator-always-on;
78 regulator-boot-on;
79 gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
80 };
81
82 clocks {
83 g762_clk: g762-oscillator {
84 compatible = "fixed-clock";
85 #clock-cells = <0>;
86 clock-frequency = <32768>;
87 };
88 };
89};
90
91&mdio {
92 ethphy1: ethernet-phy@1 {
93 reg = <0>;
94 };
95};
96
97&eth1 {
98 status = "okay";
99 ethernet1-port@0 {
100 phy-handle = <&ethphy1>;
101 };
102};
103
104
105&i2c0 {
106 g762@3e {
107 compatible = "gmt,g762";
108 reg = <0x3e>;
109 clocks = <&g762_clk>;
110 };
111};
diff --git a/arch/arm/boot/dts/kirkwood-netxbig.dtsi b/arch/arm/boot/dts/kirkwood-netxbig.dtsi
new file mode 100644
index 000000000000..b0cfb7cd30b9
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-netxbig.dtsi
@@ -0,0 +1,154 @@
1/*
2 * Device Tree common file for LaCie 2Big and 5Big Network v2
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * Based on netxbig_v2-setup.c,
9 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14*/
15
16#include "kirkwood.dtsi"
17#include "kirkwood-6281.dtsi"
18
19/ {
20 chosen {
21 bootargs = "console=ttyS0,115200n8";
22 stdout-path = &uart0;
23 };
24
25 ocp@f1000000 {
26 serial@12000 {
27 status = "okay";
28 };
29
30 spi@10600 {
31 status = "okay";
32
33 flash@0 {
34 #address-cells = <1>;
35 #size-cells = <1>;
36 compatible = "mxicy,mx25l4005a";
37 reg = <0>;
38 spi-max-frequency = <20000000>;
39 mode = <0>;
40
41 partition@0 {
42 reg = <0x0 0x80000>;
43 label = "u-boot";
44 };
45 };
46 };
47
48 sata@80000 {
49 status = "okay";
50 nr-ports = <2>;
51 };
52
53 };
54
55 gpio-keys {
56 compatible = "gpio-keys";
57 #address-cells = <1>;
58 #size-cells = <0>;
59
60 /*
61 * button@1 and button@2 represent a three position rocker
62 * switch. Thus the conventional KEY_POWER does not fit
63 */
64 button@1 {
65 label = "Back power switch (on|auto)";
66 linux,code = <KEY_ESC>;
67 linux,input-type = <5>;
68 gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
69 };
70 button@2 {
71 label = "Back power switch (auto|off)";
72 linux,code = <KEY_1>;
73 linux,input-type = <5>;
74 gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
75 };
76 button@3 {
77 label = "Function button";
78 linux,code = <KEY_OPTION>;
79 gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
80 };
81
82 };
83
84 gpio-poweroff {
85 compatible = "gpio-poweroff";
86 gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
87 };
88
89 regulators: regulators {
90 status = "okay";
91 compatible = "simple-bus";
92 #address-cells = <1>;
93 #size-cells = <0>;
94 pinctrl-names = "default";
95
96 regulator@1 {
97 compatible = "regulator-fixed";
98 reg = <1>;
99 regulator-name = "hdd0power";
100 regulator-min-microvolt = <5000000>;
101 regulator-max-microvolt = <5000000>;
102 enable-active-high;
103 regulator-always-on;
104 regulator-boot-on;
105 gpio = <&gpio0 16 GPIO_ACTIVE_HIGH>;
106 };
107 };
108};
109
110&mdio {
111 status = "okay";
112
113 ethphy0: ethernet-phy@0 {
114 reg = <8>;
115 };
116
117 ethphy1: ethernet-phy@1 {
118 reg = <0>;
119 };
120};
121
122&eth0 {
123 status = "okay";
124 ethernet0-port@0 {
125 phy-handle = <&ethphy0>;
126 };
127};
128
129&pinctrl {
130 pinctrl-names = "default";
131
132 pmx_button_function: pmx-button-function {
133 marvell,pins = "mpp34";
134 marvell,function = "gpio";
135 };
136 pmx_button_power_off: pmx-button-power-off {
137 marvell,pins = "mpp15";
138 marvell,function = "gpio";
139 };
140 pmx_button_power_on: pmx-button-power-on {
141 marvell,pins = "mpp13";
142 marvell,function = "gpio";
143 };
144};
145
146&i2c0 {
147 status = "okay";
148
149 eeprom@50 {
150 compatible = "atmel,24c04";
151 pagesize = <16>;
152 reg = <0x50>;
153 };
154};
diff --git a/arch/arm/boot/dts/kizbox.dts b/arch/arm/boot/dts/kizbox.dts
index 928f6eef2d59..e83e4f9310b8 100644
--- a/arch/arm/boot/dts/kizbox.dts
+++ b/arch/arm/boot/dts/kizbox.dts
@@ -30,6 +30,10 @@
30 compatible = "atmel,osc", "fixed-clock"; 30 compatible = "atmel,osc", "fixed-clock";
31 clock-frequency = <18432000>; 31 clock-frequency = <18432000>;
32 }; 32 };
33
34 main_xtal {
35 clock-frequency = <18432000>;
36 };
33 }; 37 };
34 38
35 ahb { 39 ahb {
diff --git a/arch/arm/boot/dts/mpa1600.dts b/arch/arm/boot/dts/mpa1600.dts
index ccf9ea242f72..f0f5e1098928 100644
--- a/arch/arm/boot/dts/mpa1600.dts
+++ b/arch/arm/boot/dts/mpa1600.dts
@@ -25,6 +25,14 @@
25 compatible = "atmel,osc", "fixed-clock"; 25 compatible = "atmel,osc", "fixed-clock";
26 clock-frequency = <18432000>; 26 clock-frequency = <18432000>;
27 }; 27 };
28
29 slow_xtal {
30 clock-frequency = <32768>;
31 };
32
33 main_xtal {
34 clock-frequency = <18432000>;
35 };
28 }; 36 };
29 37
30 ahb { 38 ahb {
diff --git a/arch/arm/mach-s5pv210/include/mach/dma.h b/arch/arm/boot/dts/mt6589-aquaris5.dts
index 201842a3769e..443b4467de15 100644
--- a/arch/arm/mach-s5pv210/include/mach/dma.h
+++ b/arch/arm/boot/dts/mt6589-aquaris5.dts
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd. 2 * Copyright (c) 2014 MundoReader S.L.
3 * Jaswinder Singh <jassi.brar@samsung.com> 3 * Author: Matthias Brugger <matthias.bgg@gmail.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -11,16 +11,15 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 14 */
19 15
20#ifndef __MACH_DMA_H 16/dts-v1/;
21#define __MACH_DMA_H 17#include "mt6589.dtsi"
22 18
23/* This platform uses the common DMA API driver for PL330 */ 19/ {
24#include <plat/dma-pl330.h> 20 model = "bq Aquaris5";
25 21
26#endif /* __MACH_DMA_H */ 22 memory {
23 reg = <0x80000000 0x40000000>;
24 };
25};
diff --git a/arch/arm/boot/dts/mt6589.dtsi b/arch/arm/boot/dts/mt6589.dtsi
new file mode 100644
index 000000000000..d0297a051549
--- /dev/null
+++ b/arch/arm/boot/dts/mt6589.dtsi
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Matthias Brugger <matthias.bgg@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 as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <dt-bindings/interrupt-controller/irq.h>
17#include <dt-bindings/interrupt-controller/arm-gic.h>
18#include "skeleton.dtsi"
19
20/ {
21 compatible = "mediatek,mt6589";
22 interrupt-parent = <&gic>;
23
24 cpus {
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 cpu@0 {
29 device_type = "cpu";
30 compatible = "arm,cortex-a7";
31 reg = <0x0>;
32 };
33 cpu@1 {
34 device_type = "cpu";
35 compatible = "arm,cortex-a7";
36 reg = <0x1>;
37 };
38 cpu@2 {
39 device_type = "cpu";
40 compatible = "arm,cortex-a7";
41 reg = <0x2>;
42 };
43 cpu@3 {
44 device_type = "cpu";
45 compatible = "arm,cortex-a7";
46 reg = <0x3>;
47 };
48
49 };
50
51 clocks {
52 #address-cells = <1>;
53 #size-cells = <1>;
54 compatible = "simple-bus";
55 ranges;
56
57 system_clk: dummy13m {
58 compatible = "fixed-clock";
59 clock-frequency = <13000000>;
60 #clock-cells = <0>;
61 };
62
63 rtc_clk: dummy32k {
64 compatible = "fixed-clock";
65 clock-frequency = <32000>;
66 #clock-cells = <0>;
67 };
68 };
69
70 soc {
71 #address-cells = <1>;
72 #size-cells = <1>;
73 compatible = "simple-bus";
74 ranges;
75
76 timer: timer@10008000 {
77 compatible = "mediatek,mt6577-timer";
78 reg = <0x10008000 0x80>;
79 interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>;
80 clocks = <&system_clk>, <&rtc_clk>;
81 clock-names = "system-clk", "rtc-clk";
82 };
83
84 gic: interrupt-controller@10212000 {
85 compatible = "arm,cortex-a15-gic";
86 interrupt-controller;
87 #interrupt-cells = <3>;
88 reg = <0x10211000 0x1000>,
89 <0x10212000 0x1000>,
90 <0x10214000 0x2000>,
91 <0x10216000 0x2000>;
92 };
93 };
94};
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index e83b0468080c..9be3c1266378 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -157,6 +157,8 @@
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 ti,mbox-num-users = <4>;
161 ti,mbox-num-fifos = <6>;
160 }; 162 };
161 163
162 timer1: timer@48028000 { 164 timer1: timer@48028000 {
@@ -182,3 +184,6 @@
182&i2c2 { 184&i2c2 {
183 compatible = "ti,omap2420-i2c"; 185 compatible = "ti,omap2420-i2c";
184}; 186};
187
188/include/ "omap24xx-clocks.dtsi"
189/include/ "omap2420-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index c4e8013801ee..1a00f15d9096 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -247,6 +247,8 @@
247 reg = <0x48094000 0x200>; 247 reg = <0x48094000 0x200>;
248 interrupts = <26>; 248 interrupts = <26>;
249 ti,hwmods = "mailbox"; 249 ti,hwmods = "mailbox";
250 ti,mbox-num-users = <4>;
251 ti,mbox-num-fifos = <6>;
250 }; 252 };
251 253
252 timer1: timer@49018000 { 254 timer1: timer@49018000 {
@@ -288,3 +290,6 @@
288&i2c2 { 290&i2c2 {
289 compatible = "ti,omap2430-i2c"; 291 compatible = "ti,omap2430-i2c";
290}; 292};
293
294/include/ "omap24xx-clocks.dtsi"
295/include/ "omap2430-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index b2891a9a6975..575a49bf968d 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -332,6 +332,8 @@
332 ti,hwmods = "mailbox"; 332 ti,hwmods = "mailbox";
333 reg = <0x48094000 0x200>; 333 reg = <0x48094000 0x200>;
334 interrupts = <26>; 334 interrupts = <26>;
335 ti,mbox-num-users = <2>;
336 ti,mbox-num-fifos = <2>;
335 }; 337 };
336 338
337 mcspi1: spi@48098000 { 339 mcspi1: spi@48098000 {
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 7e26d222bfe3..69408b53200d 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -649,6 +649,15 @@
649 }; 649 };
650 }; 650 };
651 651
652 mailbox: mailbox@4a0f4000 {
653 compatible = "ti,omap4-mailbox";
654 reg = <0x4a0f4000 0x200>;
655 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
656 ti,hwmods = "mailbox";
657 ti,mbox-num-users = <3>;
658 ti,mbox-num-fifos = <8>;
659 };
660
652 timer1: timer@4a318000 { 661 timer1: timer@4a318000 {
653 compatible = "ti,omap3430-timer"; 662 compatible = "ti,omap3430-timer";
654 reg = <0x4a318000 0x80>; 663 reg = <0x4a318000 0x80>;
diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
index 1e1b05768cec..159720d6c956 100644
--- a/arch/arm/boot/dts/omap5-uevm.dts
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -100,15 +100,33 @@
100 }; 100 };
101 }; 101 };
102 }; 102 };
103
104 sound: sound {
105 compatible = "ti,abe-twl6040";
106 ti,model = "omap5-uevm";
107
108 ti,mclk-freq = <19200000>;
109
110 ti,mcpdm = <&mcpdm>;
111
112 ti,twl6040 = <&twl6040>;
113
114 /* Audio routing */
115 ti,audio-routing =
116 "Headset Stereophone", "HSOL",
117 "Headset Stereophone", "HSOR",
118 "Line Out", "AUXL",
119 "Line Out", "AUXR",
120 "HSMIC", "Headset Mic",
121 "Headset Mic", "Headset Mic Bias",
122 "AFML", "Line In",
123 "AFMR", "Line In";
124 };
103}; 125};
104 126
105&omap5_pmx_core { 127&omap5_pmx_core {
106 pinctrl-names = "default"; 128 pinctrl-names = "default";
107 pinctrl-0 = < 129 pinctrl-0 = <
108 &twl6040_pins
109 &mcpdm_pins
110 &mcbsp1_pins
111 &mcbsp2_pins
112 &usbhost_pins 130 &usbhost_pins
113 &led_gpio_pins 131 &led_gpio_pins
114 >; 132 >;
@@ -306,6 +324,11 @@
306 ti,wakeup; 324 ti,wakeup;
307 }; 325 };
308 326
327 clk32kgaudio: palmas_clk32k@1 {
328 compatible = "ti,palmas-clk32kgaudio";
329 #clock-cells = <0>;
330 };
331
309 palmas_pmic { 332 palmas_pmic {
310 compatible = "ti,palmas-pmic"; 333 compatible = "ti,palmas-pmic";
311 interrupt-parent = <&palmas>; 334 interrupt-parent = <&palmas>;
@@ -489,6 +512,25 @@
489 }; 512 };
490 }; 513 };
491 }; 514 };
515
516 twl6040: twl@4b {
517 compatible = "ti,twl6040";
518 reg = <0x4b>;
519
520 pinctrl-names = "default";
521 pinctrl-0 = <&twl6040_pins>;
522
523 interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */
524 interrupt-parent = <&gic>;
525 ti,audpwron-gpio = <&gpio5 13 0>; /* gpio line 141 */
526
527 vio-supply = <&smps7_reg>;
528 v2v1-supply = <&smps9_reg>;
529 enable-active-high;
530
531 clocks = <&clk32kgaudio>;
532 clock-names = "clk32k";
533 };
492}; 534};
493 535
494&i2c5 { 536&i2c5 {
@@ -505,8 +547,22 @@
505 }; 547 };
506}; 548};
507 549
508&mcbsp3 { 550&mcpdm {
509 status = "disabled"; 551 pinctrl-names = "default";
552 pinctrl-0 = <&mcpdm_pins>;
553 status = "okay";
554};
555
556&mcbsp1 {
557 pinctrl-names = "default";
558 pinctrl-0 = <&mcbsp1_pins>;
559 status = "okay";
560};
561
562&mcbsp2 {
563 pinctrl-names = "default";
564 pinctrl-0 = <&mcbsp2_pins>;
565 status = "okay";
510}; 566};
511 567
512&usbhshost { 568&usbhshost {
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index a4ed54988866..fc8df1739f39 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -640,6 +640,8 @@
640 reg = <0x4a0f4000 0x200>; 640 reg = <0x4a0f4000 0x200>;
641 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; 641 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
642 ti,hwmods = "mailbox"; 642 ti,hwmods = "mailbox";
643 ti,mbox-num-users = <3>;
644 ti,mbox-num-fifos = <8>;
643 }; 645 };
644 646
645 timer1: timer@4ae18000 { 647 timer1: timer@4ae18000 {
@@ -985,6 +987,66 @@
985 dma-names = "audio_tx"; 987 dma-names = "audio_tx";
986 }; 988 };
987 }; 989 };
990
991 abb_mpu: regulator-abb-mpu {
992 compatible = "ti,abb-v2";
993 regulator-name = "abb_mpu";
994 #address-cells = <0>;
995 #size-cells = <0>;
996 clocks = <&sys_clkin>;
997 ti,settling-time = <50>;
998 ti,clock-cycles = <16>;
999
1000 reg = <0x4ae07cdc 0x8>, <0x4ae06014 0x4>,
1001 <0x4a0021c4 0x8>, <0x4ae0c318 0x4>;
1002 reg-names = "base-address", "int-address",
1003 "efuse-address", "ldo-address";
1004 ti,tranxdone-status-mask = <0x80>;
1005 /* LDOVBBMPU_MUX_CTRL */
1006 ti,ldovbb-override-mask = <0x400>;
1007 /* LDOVBBMPU_VSET_OUT */
1008 ti,ldovbb-vset-mask = <0x1F>;
1009
1010 /*
1011 * NOTE: only FBB mode used but actual vset will
1012 * determine final biasing
1013 */
1014 ti,abb_info = <
1015 /*uV ABB efuse rbb_m fbb_m vset_m*/
1016 1060000 0 0x0 0 0x02000000 0x01F00000
1017 1250000 0 0x4 0 0x02000000 0x01F00000
1018 >;
1019 };
1020
1021 abb_mm: regulator-abb-mm {
1022 compatible = "ti,abb-v2";
1023 regulator-name = "abb_mm";
1024 #address-cells = <0>;
1025 #size-cells = <0>;
1026 clocks = <&sys_clkin>;
1027 ti,settling-time = <50>;
1028 ti,clock-cycles = <16>;
1029
1030 reg = <0x4ae07ce4 0x8>, <0x4ae06010 0x4>,
1031 <0x4a0021a4 0x8>, <0x4ae0c314 0x4>;
1032 reg-names = "base-address", "int-address",
1033 "efuse-address", "ldo-address";
1034 ti,tranxdone-status-mask = <0x80000000>;
1035 /* LDOVBBMM_MUX_CTRL */
1036 ti,ldovbb-override-mask = <0x400>;
1037 /* LDOVBBMM_VSET_OUT */
1038 ti,ldovbb-vset-mask = <0x1F>;
1039
1040 /*
1041 * NOTE: only FBB mode used but actual vset will
1042 * determine final biasing
1043 */
1044 ti,abb_info = <
1045 /*uV ABB efuse rbb_m fbb_m vset_m*/
1046 1025000 0 0x0 0 0x02000000 0x01F00000
1047 1120000 0 0x4 0 0x02000000 0x01F00000
1048 >;
1049 };
988 }; 1050 };
989}; 1051};
990 1052
diff --git a/arch/arm/boot/dts/pm9g45.dts b/arch/arm/boot/dts/pm9g45.dts
index 33ffabe9c4c8..66afcff67fde 100644
--- a/arch/arm/boot/dts/pm9g45.dts
+++ b/arch/arm/boot/dts/pm9g45.dts
@@ -29,6 +29,14 @@
29 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>; 30 clock-frequency = <12000000>;
31 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <12000000>;
39 };
32 }; 40 };
33 41
34 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index 56849b55e1c2..20705467f4c9 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -57,3 +57,13 @@
57&scif2 { 57&scif2 {
58 status = "okay"; 58 status = "okay";
59}; 59};
60
61&spi4 {
62 status = "okay";
63
64 codec: codec@0 {
65 compatible = "wlf,wm8978";
66 reg = <0>;
67 spi-max-frequency = <5000000>;
68 };
69};
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index f50fbc8f3bd9..bdee22541189 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -144,6 +144,7 @@
144 device_type = "cpu"; 144 device_type = "cpu";
145 compatible = "arm,cortex-a9"; 145 compatible = "arm,cortex-a9";
146 reg = <0>; 146 reg = <0>;
147 clock-frequency = <400000000>;
147 }; 148 };
148 }; 149 };
149 150
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
index 70b1fff8f4a3..a860f32bca27 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
@@ -16,6 +16,10 @@
16 model = "APE6EVM"; 16 model = "APE6EVM";
17 compatible = "renesas,ape6evm-reference", "renesas,r8a73a4"; 17 compatible = "renesas,ape6evm-reference", "renesas,r8a73a4";
18 18
19 aliases {
20 serial0 = &scifa0;
21 };
22
19 chosen { 23 chosen {
20 bootargs = "console=ttySC0,115200 ignore_loglevel rw"; 24 bootargs = "console=ttySC0,115200 ignore_loglevel rw";
21 }; 25 };
@@ -90,9 +94,6 @@
90}; 94};
91 95
92&pfc { 96&pfc {
93 pinctrl-0 = <&scifa0_pins>;
94 pinctrl-names = "default";
95
96 scifa0_pins: serial0 { 97 scifa0_pins: serial0 {
97 renesas,groups = "scifa0_data"; 98 renesas,groups = "scifa0_data";
98 renesas,function = "scifa0"; 99 renesas,function = "scifa0";
@@ -123,6 +124,13 @@
123 status = "okay"; 124 status = "okay";
124}; 125};
125 126
127&scifa0 {
128 pinctrl-0 = <&scifa0_pins>;
129 pinctrl-names = "default";
130
131 status = "okay";
132};
133
126&sdhi0 { 134&sdhi0 {
127 vmmc-supply = <&vcc_sdhi0>; 135 vmmc-supply = <&vcc_sdhi0>;
128 bus-width = <4>; 136 bus-width = <4>;
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 82c5ac825386..d8ec5058c351 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -252,6 +252,48 @@
252 status = "disabled"; 252 status = "disabled";
253 }; 253 };
254 254
255 scifa0: serial@e6c40000 {
256 compatible = "renesas,scifa-r8a73a4", "renesas,scifa";
257 reg = <0 0xe6c40000 0 0x100>;
258 interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
259 status = "disabled";
260 };
261
262 scifa1: serial@e6c50000 {
263 compatible = "renesas,scifa-r8a73a4", "renesas,scifa";
264 reg = <0 0xe6c50000 0 0x100>;
265 interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
266 status = "disabled";
267 };
268
269 scifb2: serial@e6c20000 {
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";
285 reg = <0 0xe6ce0000 0 0x100>;
286 interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
287 status = "disabled";
288 };
289
290 scifb5: serial@e6cf0000 {
291 compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
292 reg = <0 0xe6cf0000 0 0x100>;
293 interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
294 status = "disabled";
295 };
296
255 mmcif0: mmc@ee200000 { 297 mmcif0: mmc@ee200000 {
256 compatible = "renesas,sh-mmcif"; 298 compatible = "renesas,sh-mmcif";
257 reg = <0 0xee200000 0 0x80>; 299 reg = <0 0xee200000 0 0x80>;
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index 486007d7ffe4..ee9e7d5c97a9 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -19,8 +19,12 @@
19 model = "armadillo 800 eva reference"; 19 model = "armadillo 800 eva reference";
20 compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740"; 20 compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740";
21 21
22 aliases {
23 serial1 = &scifa1;
24 };
25
22 chosen { 26 chosen {
23 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 ignore_loglevel root=/dev/nfs ip=dhcp rw";
24 }; 28 };
25 29
26 memory { 30 memory {
@@ -104,17 +108,21 @@
104 108
105 leds { 109 leds {
106 compatible = "gpio-leds"; 110 compatible = "gpio-leds";
107 led1 { 111 led3 {
108 gpios = <&pfc 102 GPIO_ACTIVE_HIGH>; 112 gpios = <&pfc 102 GPIO_ACTIVE_HIGH>;
113 label = "LED3";
109 }; 114 };
110 led2 { 115 led4 {
111 gpios = <&pfc 111 GPIO_ACTIVE_HIGH>; 116 gpios = <&pfc 111 GPIO_ACTIVE_HIGH>;
117 label = "LED4";
112 }; 118 };
113 led3 { 119 led5 {
114 gpios = <&pfc 110 GPIO_ACTIVE_HIGH>; 120 gpios = <&pfc 110 GPIO_ACTIVE_HIGH>;
121 label = "LED5";
115 }; 122 };
116 led4 { 123 led6 {
117 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>; 124 gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
125 label = "LED6";
118 }; 126 };
119 }; 127 };
120 128
@@ -198,9 +206,6 @@
198}; 206};
199 207
200&pfc { 208&pfc {
201 pinctrl-0 = <&scifa1_pins>;
202 pinctrl-names = "default";
203
204 ether_pins: ether { 209 ether_pins: ether {
205 renesas,groups = "gether_mii", "gether_int"; 210 renesas,groups = "gether_mii", "gether_int";
206 renesas,function = "gether"; 211 renesas,function = "gether";
@@ -252,6 +257,13 @@
252 status = "okay"; 257 status = "okay";
253}; 258};
254 259
260&scifa1 {
261 pinctrl-0 = <&scifa1_pins>;
262 pinctrl-names = "default";
263
264 status = "okay";
265};
266
255&sdhi0 { 267&sdhi0 {
256 pinctrl-0 = <&sdhi0_pins>; 268 pinctrl-0 = <&sdhi0_pins>;
257 pinctrl-names = "default"; 269 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 55d29f4d2ed6..bda18fb3d9e5 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -156,6 +156,69 @@
156 status = "disabled"; 156 status = "disabled";
157 }; 157 };
158 158
159 scifa0: serial@e6c40000 {
160 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
161 reg = <0xe6c40000 0x100>;
162 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
163 status = "disabled";
164 };
165
166 scifa1: serial@e6c50000 {
167 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
168 reg = <0xe6c50000 0x100>;
169 interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
170 status = "disabled";
171 };
172
173 scifa2: serial@e6c60000 {
174 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
175 reg = <0xe6c60000 0x100>;
176 interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
177 status = "disabled";
178 };
179
180 scifa3: serial@e6c70000 {
181 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
182 reg = <0xe6c70000 0x100>;
183 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
184 status = "disabled";
185 };
186
187 scifa4: serial@e6c80000 {
188 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
189 reg = <0xe6c80000 0x100>;
190 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
191 status = "disabled";
192 };
193
194 scifa5: serial@e6cb0000 {
195 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
196 reg = <0xe6cb0000 0x100>;
197 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
198 status = "disabled";
199 };
200
201 scifa6: serial@e6cc0000 {
202 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
203 reg = <0xe6cc0000 0x100>;
204 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
205 status = "disabled";
206 };
207
208 scifa7: serial@e6cd0000 {
209 compatible = "renesas,scifa-r8a7740", "renesas,scifa";
210 reg = <0xe6cd0000 0x100>;
211 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
212 status = "disabled";
213 };
214
215 scifb8: serial@e6c30000 {
216 compatible = "renesas,scifb-r8a7740", "renesas,scifb";
217 reg = <0xe6c30000 0x100>;
218 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
219 status = "disabled";
220 };
221
159 pfc: pfc@e6050000 { 222 pfc: pfc@e6050000 {
160 compatible = "renesas,pfc-r8a7740"; 223 compatible = "renesas,pfc-r8a7740";
161 reg = <0xe6050000 0x8000>, 224 reg = <0xe6050000 0x8000>,
diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index f76f6ec01e19..3342c74c5de8 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -23,6 +23,10 @@
23 model = "bockw"; 23 model = "bockw";
24 compatible = "renesas,bockw-reference", "renesas,r8a7778"; 24 compatible = "renesas,bockw-reference", "renesas,r8a7778";
25 25
26 aliases {
27 serial0 = &scif0;
28 };
29
26 chosen { 30 chosen {
27 bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw"; 31 bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
28 }; 32 };
@@ -70,9 +74,6 @@
70}; 74};
71 75
72&pfc { 76&pfc {
73 pinctrl-0 = <&scif0_pins>;
74 pinctrl-names = "default";
75
76 scif0_pins: serial0 { 77 scif0_pins: serial0 {
77 renesas,groups = "scif0_data_a", "scif0_ctrl"; 78 renesas,groups = "scif0_data_a", "scif0_ctrl";
78 renesas,function = "scif0"; 79 renesas,function = "scif0";
@@ -124,3 +125,10 @@
124 }; 125 };
125 }; 126 };
126}; 127};
128
129&scif0 {
130 pinctrl-0 = <&scif0_pins>;
131 pinctrl-names = "default";
132
133 status = "okay";
134};
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 3af0a2187493..ecfdf4b01b5a 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -156,6 +156,48 @@
156 status = "disabled"; 156 status = "disabled";
157 }; 157 };
158 158
159 scif0: serial@ffe40000 {
160 compatible = "renesas,scif-r8a7778", "renesas,scif";
161 reg = <0xffe40000 0x100>;
162 interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH>;
163 status = "disabled";
164 };
165
166 scif1: serial@ffe41000 {
167 compatible = "renesas,scif-r8a7778", "renesas,scif";
168 reg = <0xffe41000 0x100>;
169 interrupts = <0 71 IRQ_TYPE_LEVEL_HIGH>;
170 status = "disabled";
171 };
172
173 scif2: serial@ffe42000 {
174 compatible = "renesas,scif-r8a7778", "renesas,scif";
175 reg = <0xffe42000 0x100>;
176 interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
177 status = "disabled";
178 };
179
180 scif3: serial@ffe43000 {
181 compatible = "renesas,scif-r8a7778", "renesas,scif";
182 reg = <0xffe43000 0x100>;
183 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
184 status = "disabled";
185 };
186
187 scif4: serial@ffe44000 {
188 compatible = "renesas,scif-r8a7778", "renesas,scif";
189 reg = <0xffe44000 0x100>;
190 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
191 status = "disabled";
192 };
193
194 scif5: serial@ffe45000 {
195 compatible = "renesas,scif-r8a7778", "renesas,scif";
196 reg = <0xffe45000 0x100>;
197 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
198 status = "disabled";
199 };
200
159 mmcif: mmc@ffe4e000 { 201 mmcif: mmc@ffe4e000 {
160 compatible = "renesas,sh-mmcif"; 202 compatible = "renesas,sh-mmcif";
161 reg = <0xffe4e000 0x100>; 203 reg = <0xffe4e000 0x100>;
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
deleted file mode 100644
index b27c6373ff4d..000000000000
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Reference Device Tree Source for the Marzen board
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/dts-v1/;
13#include "r8a7779.dtsi"
14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16
17/ {
18 model = "marzen";
19 compatible = "renesas,marzen-reference", "renesas,r8a7779";
20
21 chosen {
22 bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on rw";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x60000000 0x40000000>;
28 };
29
30 fixedregulator3v3: fixedregulator@0 {
31 compatible = "regulator-fixed";
32 regulator-name = "fixed-3.3V";
33 regulator-min-microvolt = <3300000>;
34 regulator-max-microvolt = <3300000>;
35 regulator-boot-on;
36 regulator-always-on;
37 };
38
39 lan0@18000000 {
40 compatible = "smsc,lan9220", "smsc,lan9115";
41 reg = <0x18000000 0x100>;
42 pinctrl-0 = <&lan0_pins>;
43 pinctrl-names = "default";
44
45 phy-mode = "mii";
46 interrupt-parent = <&irqpin0>;
47 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
48 smsc,irq-push-pull;
49 reg-io-width = <4>;
50 vddvario-supply = <&fixedregulator3v3>;
51 vdd33a-supply = <&fixedregulator3v3>;
52 };
53
54 leds {
55 compatible = "gpio-leds";
56 led2 {
57 gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
58 };
59 led3 {
60 gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
61 };
62 led4 {
63 gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
64 };
65 };
66};
67
68&irqpin0 {
69 status = "okay";
70};
71
72&pfc {
73 pinctrl-0 = <&scif2_pins &scif4_pins>;
74 pinctrl-names = "default";
75
76 lan0_pins: lan0 {
77 intc {
78 renesas,groups = "intc_irq1_b";
79 renesas,function = "intc";
80 };
81 lbsc {
82 renesas,groups = "lbsc_ex_cs0";
83 renesas,function = "lbsc";
84 };
85 };
86
87 scif2_pins: serial2 {
88 renesas,groups = "scif2_data_c";
89 renesas,function = "scif2";
90 };
91
92 scif4_pins: serial4 {
93 renesas,groups = "scif4_data";
94 renesas,function = "scif4";
95 };
96
97 sdhi0_pins: sd0 {
98 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
99 renesas,function = "sdhi0";
100 };
101
102 hspi0_pins: hspi0 {
103 renesas,groups = "hspi0";
104 renesas,function = "hspi0";
105 };
106};
107
108&sdhi0 {
109 pinctrl-0 = <&sdhi0_pins>;
110 pinctrl-names = "default";
111
112 vmmc-supply = <&fixedregulator3v3>;
113 bus-width = <4>;
114 status = "okay";
115};
116
117&hspi0 {
118 pinctrl-0 = <&hspi0_pins>;
119 pinctrl-names = "default";
120 status = "okay";
121};
diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
index a7af2c2371f2..5745555df943 100644
--- a/arch/arm/boot/dts/r8a7779-marzen.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen.dts
@@ -11,17 +11,131 @@
11 11
12/dts-v1/; 12/dts-v1/;
13#include "r8a7779.dtsi" 13#include "r8a7779.dtsi"
14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/interrupt-controller/irq.h>
14 16
15/ { 17/ {
16 model = "marzen"; 18 model = "marzen";
17 compatible = "renesas,marzen", "renesas,r8a7779"; 19 compatible = "renesas,marzen", "renesas,r8a7779";
18 20
21 aliases {
22 serial2 = &scif2;
23 serial4 = &scif4;
24 };
25
19 chosen { 26 chosen {
20 bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on"; 27 bootargs = "console=ttySC2,115200 ignore_loglevel root=/dev/nfs ip=on";
21 }; 28 };
22 29
23 memory { 30 memory {
24 device_type = "memory"; 31 device_type = "memory";
25 reg = <0x60000000 0x40000000>; 32 reg = <0x60000000 0x40000000>;
26 }; 33 };
34
35 fixedregulator3v3: fixedregulator@0 {
36 compatible = "regulator-fixed";
37 regulator-name = "fixed-3.3V";
38 regulator-min-microvolt = <3300000>;
39 regulator-max-microvolt = <3300000>;
40 regulator-boot-on;
41 regulator-always-on;
42 };
43
44 lan0@18000000 {
45 compatible = "smsc,lan9220", "smsc,lan9115";
46 reg = <0x18000000 0x100>;
47 pinctrl-0 = <&lan0_pins>;
48 pinctrl-names = "default";
49
50 phy-mode = "mii";
51 interrupt-parent = <&irqpin0>;
52 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
53 smsc,irq-push-pull;
54 reg-io-width = <4>;
55 vddvario-supply = <&fixedregulator3v3>;
56 vdd33a-supply = <&fixedregulator3v3>;
57 };
58
59 leds {
60 compatible = "gpio-leds";
61 led2 {
62 gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
63 };
64 led3 {
65 gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
66 };
67 led4 {
68 gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
69 };
70 };
71};
72
73&irqpin0 {
74 status = "okay";
75};
76
77&extal_clk {
78 clock-frequency = <31250000>;
79};
80
81&pfc {
82 lan0_pins: lan0 {
83 intc {
84 renesas,groups = "intc_irq1_b";
85 renesas,function = "intc";
86 };
87 lbsc {
88 renesas,groups = "lbsc_ex_cs0";
89 renesas,function = "lbsc";
90 };
91 };
92
93 scif2_pins: serial2 {
94 renesas,groups = "scif2_data_c";
95 renesas,function = "scif2";
96 };
97
98 scif4_pins: serial4 {
99 renesas,groups = "scif4_data";
100 renesas,function = "scif4";
101 };
102
103 sdhi0_pins: sd0 {
104 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
105 renesas,function = "sdhi0";
106 };
107
108 hspi0_pins: hspi0 {
109 renesas,groups = "hspi0";
110 renesas,function = "hspi0";
111 };
112};
113
114&scif2 {
115 pinctrl-0 = <&scif2_pins>;
116 pinctrl-names = "default";
117
118 status = "okay";
119};
120
121&scif4 {
122 pinctrl-0 = <&scif4_pins>;
123 pinctrl-names = "default";
124
125 status = "okay";
126};
127
128&sdhi0 {
129 pinctrl-0 = <&sdhi0_pins>;
130 pinctrl-names = "default";
131
132 vmmc-supply = <&fixedregulator3v3>;
133 bus-width = <4>;
134 status = "okay";
135};
136
137&hspi0 {
138 pinctrl-0 = <&hspi0_pins>;
139 pinctrl-names = "default";
140 status = "okay";
27}; 141};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index b517c8e6b420..58d0d952d60e 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -11,6 +11,7 @@
11 11
12/include/ "skeleton.dtsi" 12/include/ "skeleton.dtsi"
13 13
14#include <dt-bindings/clock/r8a7779-clock.h>
14#include <dt-bindings/interrupt-controller/irq.h> 15#include <dt-bindings/interrupt-controller/irq.h>
15 16
16/ { 17/ {
@@ -25,21 +26,25 @@
25 device_type = "cpu"; 26 device_type = "cpu";
26 compatible = "arm,cortex-a9"; 27 compatible = "arm,cortex-a9";
27 reg = <0>; 28 reg = <0>;
29 clock-frequency = <1000000000>;
28 }; 30 };
29 cpu@1 { 31 cpu@1 {
30 device_type = "cpu"; 32 device_type = "cpu";
31 compatible = "arm,cortex-a9"; 33 compatible = "arm,cortex-a9";
32 reg = <1>; 34 reg = <1>;
35 clock-frequency = <1000000000>;
33 }; 36 };
34 cpu@2 { 37 cpu@2 {
35 device_type = "cpu"; 38 device_type = "cpu";
36 compatible = "arm,cortex-a9"; 39 compatible = "arm,cortex-a9";
37 reg = <2>; 40 reg = <2>;
41 clock-frequency = <1000000000>;
38 }; 42 };
39 cpu@3 { 43 cpu@3 {
40 device_type = "cpu"; 44 device_type = "cpu";
41 compatible = "arm,cortex-a9"; 45 compatible = "arm,cortex-a9";
42 reg = <3>; 46 reg = <3>;
47 clock-frequency = <1000000000>;
43 }; 48 };
44 }; 49 };
45 50
@@ -49,13 +54,13 @@
49 spi2 = &hspi2; 54 spi2 = &hspi2;
50 }; 55 };
51 56
52 gic: interrupt-controller@f0001000 { 57 gic: interrupt-controller@f0001000 {
53 compatible = "arm,cortex-a9-gic"; 58 compatible = "arm,cortex-a9-gic";
54 #interrupt-cells = <3>; 59 #interrupt-cells = <3>;
55 interrupt-controller; 60 interrupt-controller;
56 reg = <0xf0001000 0x1000>, 61 reg = <0xf0001000 0x1000>,
57 <0xf0000100 0x100>; 62 <0xf0000100 0x100>;
58 }; 63 };
59 64
60 gpio0: gpio@ffc40000 { 65 gpio0: gpio@ffc40000 {
61 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 66 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
@@ -157,6 +162,7 @@
157 compatible = "renesas,i2c-r8a7779"; 162 compatible = "renesas,i2c-r8a7779";
158 reg = <0xffc70000 0x1000>; 163 reg = <0xffc70000 0x1000>;
159 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>; 164 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
165 clocks = <&mstp0_clks R8A7779_CLK_I2C0>;
160 status = "disabled"; 166 status = "disabled";
161 }; 167 };
162 168
@@ -166,6 +172,7 @@
166 compatible = "renesas,i2c-r8a7779"; 172 compatible = "renesas,i2c-r8a7779";
167 reg = <0xffc71000 0x1000>; 173 reg = <0xffc71000 0x1000>;
168 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>; 174 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
175 clocks = <&mstp0_clks R8A7779_CLK_I2C1>;
169 status = "disabled"; 176 status = "disabled";
170 }; 177 };
171 178
@@ -175,6 +182,7 @@
175 compatible = "renesas,i2c-r8a7779"; 182 compatible = "renesas,i2c-r8a7779";
176 reg = <0xffc72000 0x1000>; 183 reg = <0xffc72000 0x1000>;
177 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>; 184 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
185 clocks = <&mstp0_clks R8A7779_CLK_I2C2>;
178 status = "disabled"; 186 status = "disabled";
179 }; 187 };
180 188
@@ -184,6 +192,67 @@
184 compatible = "renesas,i2c-r8a7779"; 192 compatible = "renesas,i2c-r8a7779";
185 reg = <0xffc73000 0x1000>; 193 reg = <0xffc73000 0x1000>;
186 interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>; 194 interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
195 clocks = <&mstp0_clks R8A7779_CLK_I2C3>;
196 status = "disabled";
197 };
198
199 scif0: serial@ffe40000 {
200 compatible = "renesas,scif-r8a7779", "renesas,scif";
201 reg = <0xffe40000 0x100>;
202 interrupt-parent = <&gic>;
203 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
204 clocks = <&cpg_clocks R8A7779_CLK_P>;
205 clock-names = "sci_ick";
206 status = "disabled";
207 };
208
209 scif1: serial@ffe41000 {
210 compatible = "renesas,scif-r8a7779", "renesas,scif";
211 reg = <0xffe41000 0x100>;
212 interrupt-parent = <&gic>;
213 interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
214 clocks = <&cpg_clocks R8A7779_CLK_P>;
215 clock-names = "sci_ick";
216 status = "disabled";
217 };
218
219 scif2: serial@ffe42000 {
220 compatible = "renesas,scif-r8a7779", "renesas,scif";
221 reg = <0xffe42000 0x100>;
222 interrupt-parent = <&gic>;
223 interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
224 clocks = <&cpg_clocks R8A7779_CLK_P>;
225 clock-names = "sci_ick";
226 status = "disabled";
227 };
228
229 scif3: serial@ffe43000 {
230 compatible = "renesas,scif-r8a7779", "renesas,scif";
231 reg = <0xffe43000 0x100>;
232 interrupt-parent = <&gic>;
233 interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
234 clocks = <&cpg_clocks R8A7779_CLK_P>;
235 clock-names = "sci_ick";
236 status = "disabled";
237 };
238
239 scif4: serial@ffe44000 {
240 compatible = "renesas,scif-r8a7779", "renesas,scif";
241 reg = <0xffe44000 0x100>;
242 interrupt-parent = <&gic>;
243 interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
244 clocks = <&cpg_clocks R8A7779_CLK_P>;
245 clock-names = "sci_ick";
246 status = "disabled";
247 };
248
249 scif5: serial@ffe45000 {
250 compatible = "renesas,scif-r8a7779", "renesas,scif";
251 reg = <0xffe45000 0x100>;
252 interrupt-parent = <&gic>;
253 interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
254 clocks = <&cpg_clocks R8A7779_CLK_P>;
255 clock-names = "sci_ick";
187 status = "disabled"; 256 status = "disabled";
188 }; 257 };
189 258
@@ -201,12 +270,14 @@
201 compatible = "renesas,rcar-sata"; 270 compatible = "renesas,rcar-sata";
202 reg = <0xfc600000 0x2000>; 271 reg = <0xfc600000 0x2000>;
203 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>; 272 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
273 clocks = <&mstp1_clks R8A7779_CLK_SATA>;
204 }; 274 };
205 275
206 sdhi0: sd@ffe4c000 { 276 sdhi0: sd@ffe4c000 {
207 compatible = "renesas,sdhi-r8a7779"; 277 compatible = "renesas,sdhi-r8a7779";
208 reg = <0xffe4c000 0x100>; 278 reg = <0xffe4c000 0x100>;
209 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>; 279 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
280 clocks = <&mstp3_clks R8A7779_CLK_SDHI0>;
210 cap-sd-highspeed; 281 cap-sd-highspeed;
211 cap-sdio-irq; 282 cap-sdio-irq;
212 status = "disabled"; 283 status = "disabled";
@@ -216,6 +287,7 @@
216 compatible = "renesas,sdhi-r8a7779"; 287 compatible = "renesas,sdhi-r8a7779";
217 reg = <0xffe4d000 0x100>; 288 reg = <0xffe4d000 0x100>;
218 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>; 289 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
290 clocks = <&mstp3_clks R8A7779_CLK_SDHI1>;
219 cap-sd-highspeed; 291 cap-sd-highspeed;
220 cap-sdio-irq; 292 cap-sdio-irq;
221 status = "disabled"; 293 status = "disabled";
@@ -225,6 +297,7 @@
225 compatible = "renesas,sdhi-r8a7779"; 297 compatible = "renesas,sdhi-r8a7779";
226 reg = <0xffe4e000 0x100>; 298 reg = <0xffe4e000 0x100>;
227 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; 299 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
300 clocks = <&mstp3_clks R8A7779_CLK_SDHI2>;
228 cap-sd-highspeed; 301 cap-sd-highspeed;
229 cap-sdio-irq; 302 cap-sdio-irq;
230 status = "disabled"; 303 status = "disabled";
@@ -234,6 +307,7 @@
234 compatible = "renesas,sdhi-r8a7779"; 307 compatible = "renesas,sdhi-r8a7779";
235 reg = <0xffe4f000 0x100>; 308 reg = <0xffe4f000 0x100>;
236 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>; 309 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
310 clocks = <&mstp3_clks R8A7779_CLK_SDHI3>;
237 cap-sd-highspeed; 311 cap-sd-highspeed;
238 cap-sdio-irq; 312 cap-sdio-irq;
239 status = "disabled"; 313 status = "disabled";
@@ -245,6 +319,7 @@
245 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>; 319 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
246 #address-cells = <1>; 320 #address-cells = <1>;
247 #size-cells = <0>; 321 #size-cells = <0>;
322 clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
248 status = "disabled"; 323 status = "disabled";
249 }; 324 };
250 325
@@ -254,6 +329,7 @@
254 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>; 329 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
255 #address-cells = <1>; 330 #address-cells = <1>;
256 #size-cells = <0>; 331 #size-cells = <0>;
332 clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
257 status = "disabled"; 333 status = "disabled";
258 }; 334 };
259 335
@@ -263,6 +339,150 @@
263 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>; 339 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
264 #address-cells = <1>; 340 #address-cells = <1>;
265 #size-cells = <0>; 341 #size-cells = <0>;
342 clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
266 status = "disabled"; 343 status = "disabled";
267 }; 344 };
345
346 clocks {
347 #address-cells = <1>;
348 #size-cells = <1>;
349 ranges;
350
351 /* External root clock */
352 extal_clk: extal_clk {
353 compatible = "fixed-clock";
354 #clock-cells = <0>;
355 /* This value must be overriden by the board. */
356 clock-frequency = <0>;
357 clock-output-names = "extal";
358 };
359
360 /* Special CPG clocks */
361 cpg_clocks: clocks@ffc80000 {
362 compatible = "renesas,r8a7779-cpg-clocks";
363 reg = <0xffc80000 0x30>;
364 clocks = <&extal_clk>;
365 #clock-cells = <1>;
366 clock-output-names = "plla", "z", "zs", "s",
367 "s1", "p", "b", "out";
368 };
369
370 /* Fixed factor clocks */
371 i_clk: i_clk {
372 compatible = "fixed-factor-clock";
373 clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
374 #clock-cells = <0>;
375 clock-div = <2>;
376 clock-mult = <1>;
377 clock-output-names = "i";
378 };
379 s3_clk: s3_clk {
380 compatible = "fixed-factor-clock";
381 clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
382 #clock-cells = <0>;
383 clock-div = <8>;
384 clock-mult = <1>;
385 clock-output-names = "s3";
386 };
387 s4_clk: s4_clk {
388 compatible = "fixed-factor-clock";
389 clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
390 #clock-cells = <0>;
391 clock-div = <16>;
392 clock-mult = <1>;
393 clock-output-names = "s4";
394 };
395 g_clk: g_clk {
396 compatible = "fixed-factor-clock";
397 clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
398 #clock-cells = <0>;
399 clock-div = <24>;
400 clock-mult = <1>;
401 clock-output-names = "g";
402 };
403
404 /* Gate clocks */
405 mstp0_clks: clocks@ffc80030 {
406 compatible = "renesas,r8a7779-mstp-clocks",
407 "renesas,cpg-mstp-clocks";
408 reg = <0xffc80030 4>;
409 clocks = <&cpg_clocks R8A7779_CLK_S>,
410 <&cpg_clocks R8A7779_CLK_P>,
411 <&cpg_clocks R8A7779_CLK_P>,
412 <&cpg_clocks R8A7779_CLK_P>,
413 <&cpg_clocks R8A7779_CLK_S>,
414 <&cpg_clocks R8A7779_CLK_S>,
415 <&cpg_clocks R8A7779_CLK_S1>,
416 <&cpg_clocks R8A7779_CLK_S1>,
417 <&cpg_clocks R8A7779_CLK_S1>,
418 <&cpg_clocks R8A7779_CLK_S1>,
419 <&cpg_clocks R8A7779_CLK_S1>,
420 <&cpg_clocks R8A7779_CLK_S1>,
421 <&cpg_clocks R8A7779_CLK_P>,
422 <&cpg_clocks R8A7779_CLK_P>,
423 <&cpg_clocks R8A7779_CLK_P>,
424 <&cpg_clocks R8A7779_CLK_P>;
425 #clock-cells = <1>;
426 renesas,clock-indices = <
427 R8A7779_CLK_HSPI R8A7779_CLK_TMU2
428 R8A7779_CLK_TMU1 R8A7779_CLK_TMU0
429 R8A7779_CLK_HSCIF1 R8A7779_CLK_HSCIF0
430 R8A7779_CLK_SCIF5 R8A7779_CLK_SCIF4
431 R8A7779_CLK_SCIF3 R8A7779_CLK_SCIF2
432 R8A7779_CLK_SCIF1 R8A7779_CLK_SCIF0
433 R8A7779_CLK_I2C3 R8A7779_CLK_I2C2
434 R8A7779_CLK_I2C1 R8A7779_CLK_I2C0
435 >;
436 clock-output-names =
437 "hspi", "tmu2", "tmu1", "tmu0", "hscif1",
438 "hscif0", "scif5", "scif4", "scif3", "scif2",
439 "scif1", "scif0", "i2c3", "i2c2", "i2c1",
440 "i2c0";
441 };
442 mstp1_clks: clocks@ffc80034 {
443 compatible = "renesas,r8a7779-mstp-clocks",
444 "renesas,cpg-mstp-clocks";
445 reg = <0xffc80034 4>, <0xffc80044 4>;
446 clocks = <&cpg_clocks R8A7779_CLK_P>,
447 <&cpg_clocks R8A7779_CLK_P>,
448 <&cpg_clocks R8A7779_CLK_S>,
449 <&cpg_clocks R8A7779_CLK_S>,
450 <&cpg_clocks R8A7779_CLK_S>,
451 <&cpg_clocks R8A7779_CLK_S>,
452 <&cpg_clocks R8A7779_CLK_P>,
453 <&cpg_clocks R8A7779_CLK_P>,
454 <&cpg_clocks R8A7779_CLK_P>,
455 <&cpg_clocks R8A7779_CLK_S>;
456 #clock-cells = <1>;
457 renesas,clock-indices = <
458 R8A7779_CLK_USB01 R8A7779_CLK_USB2
459 R8A7779_CLK_DU R8A7779_CLK_VIN2
460 R8A7779_CLK_VIN1 R8A7779_CLK_VIN0
461 R8A7779_CLK_ETHER R8A7779_CLK_SATA
462 R8A7779_CLK_PCIE R8A7779_CLK_VIN3
463 >;
464 clock-output-names =
465 "usb01", "usb2",
466 "du", "vin2",
467 "vin1", "vin0",
468 "ether", "sata",
469 "pcie", "vin3";
470 };
471 mstp3_clks: clocks@ffc8003c {
472 compatible = "renesas,r8a7779-mstp-clocks",
473 "renesas,cpg-mstp-clocks";
474 reg = <0xffc8003c 4>;
475 clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>,
476 <&s4_clk>, <&s4_clk>;
477 #clock-cells = <1>;
478 renesas,clock-indices = <
479 R8A7779_CLK_SDHI3 R8A7779_CLK_SDHI2
480 R8A7779_CLK_SDHI1 R8A7779_CLK_SDHI0
481 R8A7779_CLK_MMC1 R8A7779_CLK_MMC0
482 >;
483 clock-output-names =
484 "sdhi3", "sdhi2", "sdhi1", "sdhi0",
485 "mmc1", "mmc0";
486 };
487 };
268}; 488};
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index dd2fe46073f2..856b4236b674 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -29,12 +29,12 @@
29 29
30 memory@40000000 { 30 memory@40000000 {
31 device_type = "memory"; 31 device_type = "memory";
32 reg = <0 0x40000000 0 0x80000000>; 32 reg = <0 0x40000000 0 0x40000000>;
33 }; 33 };
34 34
35 memory@180000000 { 35 memory@180000000 {
36 device_type = "memory"; 36 device_type = "memory";
37 reg = <1 0x80000000 0 0x80000000>; 37 reg = <1 0x40000000 0 0xc0000000>;
38 }; 38 };
39 39
40 lbsc { 40 lbsc {
@@ -204,6 +204,36 @@
204 "msiof1_tx"; 204 "msiof1_tx";
205 renesas,function = "msiof1"; 205 renesas,function = "msiof1";
206 }; 206 };
207
208 iic1_pins: iic1 {
209 renesas,groups = "iic1";
210 renesas,function = "iic1";
211 };
212
213 iic2_pins: iic2 {
214 renesas,groups = "iic2";
215 renesas,function = "iic2";
216 };
217
218 iic3_pins: iic3 {
219 renesas,groups = "iic3";
220 renesas,function = "iic3";
221 };
222
223 usb0_pins: usb0 {
224 renesas,groups = "usb0";
225 renesas,function = "usb0";
226 };
227
228 usb1_pins: usb1 {
229 renesas,groups = "usb1";
230 renesas,function = "usb1";
231 };
232
233 usb2_pins: usb2 {
234 renesas,groups = "usb2";
235 renesas,function = "usb2";
236 };
207}; 237};
208 238
209&ether { 239&ether {
@@ -317,3 +347,57 @@
317 cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; 347 cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>;
318 status = "okay"; 348 status = "okay";
319}; 349};
350
351&cpu0 {
352 cpu0-supply = <&vdd_dvfs>;
353};
354
355&iic0 {
356 status = "ok";
357};
358
359&iic1 {
360 status = "ok";
361 pinctrl-0 = <&iic1_pins>;
362 pinctrl-names = "default";
363};
364
365&iic2 {
366 status = "ok";
367 pinctrl-0 = <&iic2_pins>;
368 pinctrl-names = "default";
369};
370
371&iic3 {
372 pinctrl-names = "default";
373 pinctrl-0 = <&iic3_pins>;
374 status = "okay";
375
376 vdd_dvfs: regulator@68 {
377 compatible = "diasemi,da9210";
378 reg = <0x68>;
379
380 regulator-min-microvolt = <1000000>;
381 regulator-max-microvolt = <1000000>;
382 regulator-boot-on;
383 regulator-always-on;
384 };
385};
386
387&pci0 {
388 status = "okay";
389 pinctrl-0 = <&usb0_pins>;
390 pinctrl-names = "default";
391};
392
393&pci1 {
394 status = "okay";
395 pinctrl-0 = <&usb1_pins>;
396 pinctrl-names = "default";
397};
398
399&pci2 {
400 status = "okay";
401 pinctrl-0 = <&usb2_pins>;
402 pinctrl-names = "default";
403};
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 7ff29601f962..d9ddecbb859c 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -44,6 +44,17 @@
44 compatible = "arm,cortex-a15"; 44 compatible = "arm,cortex-a15";
45 reg = <0>; 45 reg = <0>;
46 clock-frequency = <1300000000>; 46 clock-frequency = <1300000000>;
47 voltage-tolerance = <1>; /* 1% */
48 clocks = <&cpg_clocks R8A7790_CLK_Z>;
49 clock-latency = <300000>; /* 300 us */
50
51 /* kHz - uV - OPPs unknown yet */
52 operating-points = <1400000 1000000>,
53 <1225000 1000000>,
54 <1050000 1000000>,
55 < 875000 1000000>,
56 < 700000 1000000>,
57 < 350000 1000000>;
47 }; 58 };
48 59
49 cpu1: cpu@1 { 60 cpu1: cpu@1 {
@@ -476,6 +487,15 @@
476 clock-output-names = "extal"; 487 clock-output-names = "extal";
477 }; 488 };
478 489
490 /* External PCIe clock - can be overridden by the board */
491 pcie_bus_clk: pcie_bus_clk {
492 compatible = "fixed-clock";
493 #clock-cells = <0>;
494 clock-frequency = <100000000>;
495 clock-output-names = "pcie_bus";
496 status = "disabled";
497 };
498
479 /* 499 /*
480 * The external audio clocks are configured as 0 Hz fixed frequency clocks by 500 * The external audio clocks are configured as 0 Hz fixed frequency clocks by
481 * default. Boards that provide audio clocks should override them. 501 * default. Boards that provide audio clocks should override them.
@@ -754,17 +774,17 @@
754 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; 774 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
755 clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, 775 clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>,
756 <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>, 776 <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>,
757 <&hp_clk>, <&hp_clk>, <&rclk_clk>; 777 <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
758 #clock-cells = <1>; 778 #clock-cells = <1>;
759 renesas,clock-indices = < 779 renesas,clock-indices = <
760 R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3 780 R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
761 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0 781 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0
762 R8A7790_CLK_IIC0 R8A7790_CLK_IIC1 R8A7790_CLK_CMT1 782 R8A7790_CLK_IIC0 R8A7790_CLK_PCIEC R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1
763 >; 783 >;
764 clock-output-names = 784 clock-output-names =
765 "iic2", "tpu0", "mmcif1", "sdhi3", 785 "iic2", "tpu0", "mmcif1", "sdhi3",
766 "sdhi2", "sdhi1", "sdhi0", "mmcif0", 786 "sdhi2", "sdhi1", "sdhi0", "mmcif0",
767 "iic0", "iic1", "cmt1"; 787 "iic0", "pciec", "iic1", "ssusb", "cmt1";
768 }; 788 };
769 mstp5_clks: mstp5_clks@e6150144 { 789 mstp5_clks: mstp5_clks@e6150144 {
770 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; 790 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -824,6 +844,39 @@
824 "rcan1", "rcan0", "qspi_mod", "iic3", 844 "rcan1", "rcan0", "qspi_mod", "iic3",
825 "i2c3", "i2c2", "i2c1", "i2c0"; 845 "i2c3", "i2c2", "i2c1", "i2c0";
826 }; 846 };
847 mstp10_clks: mstp10_clks@e6150998 {
848 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
849 reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
850 clocks = <&p_clk>,
851 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
852 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
853 <&p_clk>,
854 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
855 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
856 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
857 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
858 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
859 <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>;
860
861 #clock-cells = <1>;
862 clock-indices = <
863 R8A7790_CLK_SSI_ALL
864 R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5
865 R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
866 R8A7790_CLK_SCU_ALL
867 R8A7790_CLK_SCU_DVC1 R8A7790_CLK_SCU_DVC0
868 R8A7790_CLK_SCU_SRC9 R8A7790_CLK_SCU_SRC8 R8A7790_CLK_SCU_SRC7 R8A7790_CLK_SCU_SRC6 R8A7790_CLK_SCU_SRC5
869 R8A7790_CLK_SCU_SRC4 R8A7790_CLK_SCU_SRC3 R8A7790_CLK_SCU_SRC2 R8A7790_CLK_SCU_SRC1 R8A7790_CLK_SCU_SRC0
870 >;
871 clock-output-names =
872 "ssi-all",
873 "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
874 "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
875 "scu-all",
876 "scu-dvc1", "scu-dvc0",
877 "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
878 "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
879 };
827 }; 880 };
828 881
829 qspi: spi@e6b10000 { 882 qspi: spi@e6b10000 {
@@ -876,4 +929,152 @@
876 #size-cells = <0>; 929 #size-cells = <0>;
877 status = "disabled"; 930 status = "disabled";
878 }; 931 };
932
933 pci0: pci@ee090000 {
934 compatible = "renesas,pci-r8a7790";
935 device_type = "pci";
936 clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
937 reg = <0 0xee090000 0 0xc00>,
938 <0 0xee080000 0 0x1100>;
939 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
940 status = "disabled";
941
942 bus-range = <0 0>;
943 #address-cells = <3>;
944 #size-cells = <2>;
945 #interrupt-cells = <1>;
946 ranges = <0x02000000 0 0xee080000 0 0xee080000 0 0x00010000>;
947 interrupt-map-mask = <0xff00 0 0 0x7>;
948 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
949 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
950 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
951 };
952
953 pci1: pci@ee0b0000 {
954 compatible = "renesas,pci-r8a7790";
955 device_type = "pci";
956 clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
957 reg = <0 0xee0b0000 0 0xc00>,
958 <0 0xee0a0000 0 0x1100>;
959 interrupts = <0 112 IRQ_TYPE_LEVEL_HIGH>;
960 status = "disabled";
961
962 bus-range = <1 1>;
963 #address-cells = <3>;
964 #size-cells = <2>;
965 #interrupt-cells = <1>;
966 ranges = <0x02000000 0 0xee0a0000 0 0xee0a0000 0 0x00010000>;
967 interrupt-map-mask = <0xff00 0 0 0x7>;
968 interrupt-map = <0x0000 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
969 0x0800 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
970 0x1000 0 0 2 &gic 0 112 IRQ_TYPE_LEVEL_HIGH>;
971 };
972
973 pci2: pci@ee0d0000 {
974 compatible = "renesas,pci-r8a7790";
975 device_type = "pci";
976 clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
977 reg = <0 0xee0d0000 0 0xc00>,
978 <0 0xee0c0000 0 0x1100>;
979 interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
980 status = "disabled";
981
982 bus-range = <2 2>;
983 #address-cells = <3>;
984 #size-cells = <2>;
985 #interrupt-cells = <1>;
986 ranges = <0x02000000 0 0xee0c0000 0 0xee0c0000 0 0x00010000>;
987 interrupt-map-mask = <0xff00 0 0 0x7>;
988 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
989 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
990 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
991 };
992
993 pciec: pcie@fe000000 {
994 compatible = "renesas,pcie-r8a7790";
995 reg = <0 0xfe000000 0 0x80000>;
996 #address-cells = <3>;
997 #size-cells = <2>;
998 bus-range = <0x00 0xff>;
999 device_type = "pci";
1000 ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000
1001 0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000
1002 0x02000000 0 0x30000000 0 0x30000000 0 0x08000000
1003 0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
1004 /* Map all possible DDR as inbound ranges */
1005 dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000
1006 0x43000000 1 0x80000000 1 0x80000000 0 0x80000000>;
1007 interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>,
1008 <0 117 IRQ_TYPE_LEVEL_HIGH>,
1009 <0 118 IRQ_TYPE_LEVEL_HIGH>;
1010 #interrupt-cells = <1>;
1011 interrupt-map-mask = <0 0 0 0>;
1012 interrupt-map = <0 0 0 0 &gic 0 116 IRQ_TYPE_LEVEL_HIGH>;
1013 clocks = <&mstp3_clks R8A7790_CLK_PCIEC>, <&pcie_bus_clk>;
1014 clock-names = "pcie", "pcie_bus";
1015 status = "disabled";
1016 };
1017
1018 rcar_sound: rcar_sound@0xec500000 {
1019 #sound-dai-cells = <1>;
1020 compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1021 interrupt-parent = <&gic>;
1022 reg = <0 0xec500000 0 0x1000>, /* SCU */
1023 <0 0xec5a0000 0 0x100>, /* ADG */
1024 <0 0xec540000 0 0x1000>, /* SSIU */
1025 <0 0xec541000 0 0x1280>; /* SSI */
1026 clocks = <&mstp10_clks R8A7790_CLK_SSI_ALL>,
1027 <&mstp10_clks R8A7790_CLK_SSI9>, <&mstp10_clks R8A7790_CLK_SSI8>,
1028 <&mstp10_clks R8A7790_CLK_SSI7>, <&mstp10_clks R8A7790_CLK_SSI6>,
1029 <&mstp10_clks R8A7790_CLK_SSI5>, <&mstp10_clks R8A7790_CLK_SSI4>,
1030 <&mstp10_clks R8A7790_CLK_SSI3>, <&mstp10_clks R8A7790_CLK_SSI2>,
1031 <&mstp10_clks R8A7790_CLK_SSI1>, <&mstp10_clks R8A7790_CLK_SSI0>,
1032 <&mstp10_clks R8A7790_CLK_SCU_SRC9>, <&mstp10_clks R8A7790_CLK_SCU_SRC8>,
1033 <&mstp10_clks R8A7790_CLK_SCU_SRC7>, <&mstp10_clks R8A7790_CLK_SCU_SRC6>,
1034 <&mstp10_clks R8A7790_CLK_SCU_SRC5>, <&mstp10_clks R8A7790_CLK_SCU_SRC4>,
1035 <&mstp10_clks R8A7790_CLK_SCU_SRC3>, <&mstp10_clks R8A7790_CLK_SCU_SRC2>,
1036 <&mstp10_clks R8A7790_CLK_SCU_SRC1>, <&mstp10_clks R8A7790_CLK_SCU_SRC0>,
1037 <&mstp10_clks R8A7790_CLK_SCU_DVC0>, <&mstp10_clks R8A7790_CLK_SCU_DVC1>,
1038 <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
1039 clock-names = "ssi-all",
1040 "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
1041 "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
1042 "src.9", "src.8", "src.7", "src.6", "src.5",
1043 "src.4", "src.3", "src.2", "src.1", "src.0",
1044 "dvc.0", "dvc.1",
1045 "clk_a", "clk_b", "clk_c", "clk_i";
1046
1047 status = "disabled";
1048
1049 rcar_sound,dvc {
1050 dvc0: dvc@0 { };
1051 dvc1: dvc@1 { };
1052 };
1053
1054 rcar_sound,src {
1055 src0: src@0 { };
1056 src1: src@1 { };
1057 src2: src@2 { };
1058 src3: src@3 { };
1059 src4: src@4 { };
1060 src5: src@5 { };
1061 src6: src@6 { };
1062 src7: src@7 { };
1063 src8: src@8 { };
1064 src9: src@9 { };
1065 };
1066
1067 rcar_sound,ssi {
1068 ssi0: ssi@0 { interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; };
1069 ssi1: ssi@1 { interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; };
1070 ssi2: ssi@2 { interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; };
1071 ssi3: ssi@3 { interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; };
1072 ssi4: ssi@4 { interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; };
1073 ssi5: ssi@5 { interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; };
1074 ssi6: ssi@6 { interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; };
1075 ssi7: ssi@7 { interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; };
1076 ssi8: ssi@8 { interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; };
1077 ssi9: ssi@9 { interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; };
1078 };
1079 };
879}; 1080};
diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
index cc6d992e8db2..3a2ef0a2a137 100644
--- a/arch/arm/boot/dts/r8a7791-henninger.dts
+++ b/arch/arm/boot/dts/r8a7791-henninger.dts
@@ -110,6 +110,11 @@
110 renesas,function = "sdhi2"; 110 renesas,function = "sdhi2";
111 }; 111 };
112 112
113 i2c2_pins: i2c2 {
114 renesas,groups = "i2c2";
115 renesas,function = "i2c2";
116 };
117
113 qspi_pins: spi0 { 118 qspi_pins: spi0 {
114 renesas,groups = "qspi_ctrl", "qspi_data4"; 119 renesas,groups = "qspi_ctrl", "qspi_data4";
115 renesas,function = "qspi"; 120 renesas,function = "qspi";
@@ -120,6 +125,16 @@
120 "msiof0_tx"; 125 "msiof0_tx";
121 renesas,function = "msiof0"; 126 renesas,function = "msiof0";
122 }; 127 };
128
129 usb0_pins: usb0 {
130 renesas,groups = "usb0";
131 renesas,function = "usb0";
132 };
133
134 usb1_pins: usb1 {
135 renesas,groups = "usb1";
136 renesas,function = "usb1";
137 };
123}; 138};
124 139
125&scif0 { 140&scif0 {
@@ -146,7 +161,7 @@
146}; 161};
147 162
148&sata0 { 163&sata0 {
149 status = "okay"; 164 status = "okay";
150}; 165};
151 166
152&sdhi0 { 167&sdhi0 {
@@ -170,6 +185,14 @@
170 status = "okay"; 185 status = "okay";
171}; 186};
172 187
188&i2c2 {
189 pinctrl-0 = <&i2c2_pins>;
190 pinctrl-names = "default";
191
192 status = "okay";
193 clock-frequency = <400000>;
194};
195
173&qspi { 196&qspi {
174 pinctrl-0 = <&qspi_pins>; 197 pinctrl-0 = <&qspi_pins>;
175 pinctrl-names = "default"; 198 pinctrl-names = "default";
@@ -217,3 +240,23 @@
217 spi-cpha; 240 spi-cpha;
218 }; 241 };
219}; 242};
243
244&pci0 {
245 status = "okay";
246 pinctrl-0 = <&usb0_pins>;
247 pinctrl-names = "default";
248};
249
250&pci1 {
251 status = "okay";
252 pinctrl-0 = <&usb1_pins>;
253 pinctrl-names = "default";
254};
255
256&pcie_bus_clk {
257 status = "okay";
258};
259
260&pciec {
261 status = "okay";
262};
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 05d44f9b202f..23486c081a69 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -215,25 +215,6 @@
215 clock-frequency = <20000000>; 215 clock-frequency = <20000000>;
216}; 216};
217 217
218&i2c2 {
219 pinctrl-0 = <&i2c2_pins>;
220 pinctrl-names = "default";
221
222 status = "okay";
223 clock-frequency = <400000>;
224
225 eeprom@50 {
226 compatible = "renesas,24c02";
227 reg = <0x50>;
228 pagesize = <16>;
229 };
230};
231
232&i2c6 {
233 status = "okay";
234 clock-frequency = <100000>;
235};
236
237&pfc { 218&pfc {
238 pinctrl-0 = <&du_pins>; 219 pinctrl-0 = <&du_pins>;
239 pinctrl-names = "default"; 220 pinctrl-names = "default";
@@ -293,6 +274,21 @@
293 "msiof0_tx"; 274 "msiof0_tx";
294 renesas,function = "msiof0"; 275 renesas,function = "msiof0";
295 }; 276 };
277
278 i2c6_pins: i2c6 {
279 renesas,groups = "i2c6";
280 renesas,function = "i2c6";
281 };
282
283 usb0_pins: usb0 {
284 renesas,groups = "usb0";
285 renesas,function = "usb0";
286 };
287
288 usb1_pins: usb1 {
289 renesas,groups = "usb1";
290 renesas,function = "usb1";
291 };
296}; 292};
297 293
298&ether { 294&ether {
@@ -408,3 +404,58 @@
408 spi-cpha; 404 spi-cpha;
409 }; 405 };
410}; 406};
407
408&i2c2 {
409 pinctrl-0 = <&i2c2_pins>;
410 pinctrl-names = "default";
411
412 status = "okay";
413 clock-frequency = <400000>;
414
415 eeprom@50 {
416 compatible = "renesas,24c02";
417 reg = <0x50>;
418 pagesize = <16>;
419 };
420};
421
422&i2c6 {
423 pinctrl-names = "default";
424 pinctrl-0 = <&i2c6_pins>;
425 status = "okay";
426 clock-frequency = <100000>;
427
428 vdd_dvfs: regulator@68 {
429 compatible = "diasemi,da9210";
430 reg = <0x68>;
431
432 regulator-min-microvolt = <1000000>;
433 regulator-max-microvolt = <1000000>;
434 regulator-boot-on;
435 regulator-always-on;
436 };
437};
438
439&pci0 {
440 status = "okay";
441 pinctrl-0 = <&usb0_pins>;
442 pinctrl-names = "default";
443};
444
445&pci1 {
446 status = "okay";
447 pinctrl-0 = <&usb1_pins>;
448 pinctrl-names = "default";
449};
450
451&pcie_bus_clk {
452 status = "okay";
453};
454
455&pciec {
456 status = "okay";
457};
458
459&cpu0 {
460 cpu0-supply = <&vdd_dvfs>;
461};
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 79f68acfd5d4..0d82a4b3c650 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -45,6 +45,17 @@
45 compatible = "arm,cortex-a15"; 45 compatible = "arm,cortex-a15";
46 reg = <0>; 46 reg = <0>;
47 clock-frequency = <1500000000>; 47 clock-frequency = <1500000000>;
48 voltage-tolerance = <1>; /* 1% */
49 clocks = <&cpg_clocks R8A7791_CLK_Z>;
50 clock-latency = <300000>; /* 300 us */
51
52 /* kHz - uV - OPPs unknown yet */
53 operating-points = <1500000 1000000>,
54 <1312500 1000000>,
55 <1125000 1000000>,
56 < 937500 1000000>,
57 < 750000 1000000>,
58 < 375000 1000000>;
48 }; 59 };
49 60
50 cpu1: cpu@1 { 61 cpu1: cpu@1 {
@@ -521,6 +532,38 @@
521 clock-output-names = "extal"; 532 clock-output-names = "extal";
522 }; 533 };
523 534
535 /*
536 * The external audio clocks are configured as 0 Hz fixed frequency clocks by
537 * default. Boards that provide audio clocks should override them.
538 */
539 audio_clk_a: audio_clk_a {
540 compatible = "fixed-clock";
541 #clock-cells = <0>;
542 clock-frequency = <0>;
543 clock-output-names = "audio_clk_a";
544 };
545 audio_clk_b: audio_clk_b {
546 compatible = "fixed-clock";
547 #clock-cells = <0>;
548 clock-frequency = <0>;
549 clock-output-names = "audio_clk_b";
550 };
551 audio_clk_c: audio_clk_c {
552 compatible = "fixed-clock";
553 #clock-cells = <0>;
554 clock-frequency = <0>;
555 clock-output-names = "audio_clk_c";
556 };
557
558 /* External PCIe clock - can be overridden by the board */
559 pcie_bus_clk: pcie_bus_clk {
560 compatible = "fixed-clock";
561 #clock-cells = <0>;
562 clock-frequency = <100000000>;
563 clock-output-names = "pcie_bus";
564 status = "disabled";
565 };
566
524 /* Special CPG clocks */ 567 /* Special CPG clocks */
525 cpg_clocks: cpg_clocks@e6150000 { 568 cpg_clocks: cpg_clocks@e6150000 {
526 compatible = "renesas,r8a7791-cpg-clocks", 569 compatible = "renesas,r8a7791-cpg-clocks",
@@ -743,30 +786,34 @@
743 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 786 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
744 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>; 787 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
745 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, 788 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
746 <&mp_clk>, <&mp_clk>, <&mp_clk>; 789 <&mp_clk>, <&mp_clk>, <&mp_clk>,
790 <&zs_clk>, <&zs_clk>;
747 #clock-cells = <1>; 791 #clock-cells = <1>;
748 renesas,clock-indices = < 792 renesas,clock-indices = <
749 R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0 793 R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0
750 R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1 794 R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1
751 R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2 795 R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2
796 R8A7791_CLK_SYS_DMAC1 R8A7791_CLK_SYS_DMAC0
752 >; 797 >;
753 clock-output-names = 798 clock-output-names =
754 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0", 799 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
755 "scifb1", "msiof1", "scifb2"; 800 "scifb1", "msiof1", "scifb2",
801 "sys-dmac1", "sys-dmac0";
756 }; 802 };
757 mstp3_clks: mstp3_clks@e615013c { 803 mstp3_clks: mstp3_clks@e615013c {
758 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 804 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
759 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; 805 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
760 clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>, 806 clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>,
761 <&mmc0_clk>, <&hp_clk>, <&hp_clk>, <&rclk_clk>; 807 <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
762 #clock-cells = <1>; 808 #clock-cells = <1>;
763 renesas,clock-indices = < 809 renesas,clock-indices = <
764 R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0 810 R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0
765 R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_IIC1 R8A7791_CLK_CMT1 811 R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_PCIEC R8A7791_CLK_IIC1
812 R8A7791_CLK_SSUSB R8A7791_CLK_CMT1
766 >; 813 >;
767 clock-output-names = 814 clock-output-names =
768 "tpu0", "sdhi2", "sdhi1", "sdhi0", 815 "tpu0", "sdhi2", "sdhi1", "sdhi0",
769 "mmcif0", "i2c7", "i2c8", "cmt1"; 816 "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1";
770 }; 817 };
771 mstp5_clks: mstp5_clks@e6150144 { 818 mstp5_clks: mstp5_clks@e6150144 {
772 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 819 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
@@ -828,6 +875,39 @@
828 "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", "i2c4", "i2c3", "i2c2", 875 "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", "i2c4", "i2c3", "i2c2",
829 "i2c1", "i2c0"; 876 "i2c1", "i2c0";
830 }; 877 };
878 mstp10_clks: mstp10_clks@e6150998 {
879 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
880 reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
881 clocks = <&p_clk>,
882 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
883 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
884 <&p_clk>,
885 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
886 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
887 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
888 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
889 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
890 <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>;
891
892 #clock-cells = <1>;
893 clock-indices = <
894 R8A7791_CLK_SSI_ALL
895 R8A7791_CLK_SSI9 R8A7791_CLK_SSI8 R8A7791_CLK_SSI7 R8A7791_CLK_SSI6 R8A7791_CLK_SSI5
896 R8A7791_CLK_SSI4 R8A7791_CLK_SSI3 R8A7791_CLK_SSI2 R8A7791_CLK_SSI1 R8A7791_CLK_SSI0
897 R8A7791_CLK_SCU_ALL
898 R8A7791_CLK_SCU_DVC1 R8A7791_CLK_SCU_DVC0
899 R8A7791_CLK_SCU_SRC9 R8A7791_CLK_SCU_SRC8 R8A7791_CLK_SCU_SRC7 R8A7791_CLK_SCU_SRC6 R8A7791_CLK_SCU_SRC5
900 R8A7791_CLK_SCU_SRC4 R8A7791_CLK_SCU_SRC3 R8A7791_CLK_SCU_SRC2 R8A7791_CLK_SCU_SRC1 R8A7791_CLK_SCU_SRC0
901 >;
902 clock-output-names =
903 "ssi-all",
904 "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
905 "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
906 "scu-all",
907 "scu-dvc1", "scu-dvc0",
908 "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
909 "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
910 };
831 mstp11_clks: mstp11_clks@e615099c { 911 mstp11_clks: mstp11_clks@e615099c {
832 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; 912 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
833 reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>; 913 reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>;
@@ -880,4 +960,132 @@
880 #size-cells = <0>; 960 #size-cells = <0>;
881 status = "disabled"; 961 status = "disabled";
882 }; 962 };
963
964 pci0: pci@ee090000 {
965 compatible = "renesas,pci-r8a7791";
966 device_type = "pci";
967 clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
968 reg = <0 0xee090000 0 0xc00>,
969 <0 0xee080000 0 0x1100>;
970 interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
971 status = "disabled";
972
973 bus-range = <0 0>;
974 #address-cells = <3>;
975 #size-cells = <2>;
976 #interrupt-cells = <1>;
977 ranges = <0x02000000 0 0xee080000 0 0xee080000 0 0x00010000>;
978 interrupt-map-mask = <0xff00 0 0 0x7>;
979 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
980 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
981 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
982 };
983
984 pci1: pci@ee0d0000 {
985 compatible = "renesas,pci-r8a7791";
986 device_type = "pci";
987 clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
988 reg = <0 0xee0d0000 0 0xc00>,
989 <0 0xee0c0000 0 0x1100>;
990 interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
991 status = "disabled";
992
993 bus-range = <1 1>;
994 #address-cells = <3>;
995 #size-cells = <2>;
996 #interrupt-cells = <1>;
997 ranges = <0x02000000 0 0xee0c0000 0 0xee0c0000 0 0x00010000>;
998 interrupt-map-mask = <0xff00 0 0 0x7>;
999 interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1000 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
1001 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
1002 };
1003
1004 pciec: pcie@fe000000 {
1005 compatible = "renesas,pcie-r8a7791";
1006 reg = <0 0xfe000000 0 0x80000>;
1007 #address-cells = <3>;
1008 #size-cells = <2>;
1009 bus-range = <0x00 0xff>;
1010 device_type = "pci";
1011 ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000
1012 0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000
1013 0x02000000 0 0x30000000 0 0x30000000 0 0x08000000
1014 0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
1015 /* Map all possible DDR as inbound ranges */
1016 dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000
1017 0x43000000 2 0x00000000 2 0x00000000 1 0x00000000>;
1018 interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>,
1019 <0 117 IRQ_TYPE_LEVEL_HIGH>,
1020 <0 118 IRQ_TYPE_LEVEL_HIGH>;
1021 #interrupt-cells = <1>;
1022 interrupt-map-mask = <0 0 0 0>;
1023 interrupt-map = <0 0 0 0 &gic 0 116 IRQ_TYPE_LEVEL_HIGH>;
1024 clocks = <&mstp3_clks R8A7791_CLK_PCIEC>, <&pcie_bus_clk>;
1025 clock-names = "pcie", "pcie_bus";
1026 status = "disabled";
1027 };
1028
1029 rcar_sound: rcar_sound@0xec500000 {
1030 #sound-dai-cells = <1>;
1031 compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
1032 interrupt-parent = <&gic>;
1033 reg = <0 0xec500000 0 0x1000>, /* SCU */
1034 <0 0xec5a0000 0 0x100>, /* ADG */
1035 <0 0xec540000 0 0x1000>, /* SSIU */
1036 <0 0xec541000 0 0x1280>; /* SSI */
1037 clocks = <&mstp10_clks R8A7791_CLK_SSI_ALL>,
1038 <&mstp10_clks R8A7791_CLK_SSI9>, <&mstp10_clks R8A7791_CLK_SSI8>,
1039 <&mstp10_clks R8A7791_CLK_SSI7>, <&mstp10_clks R8A7791_CLK_SSI6>,
1040 <&mstp10_clks R8A7791_CLK_SSI5>, <&mstp10_clks R8A7791_CLK_SSI4>,
1041 <&mstp10_clks R8A7791_CLK_SSI3>, <&mstp10_clks R8A7791_CLK_SSI2>,
1042 <&mstp10_clks R8A7791_CLK_SSI1>, <&mstp10_clks R8A7791_CLK_SSI0>,
1043 <&mstp10_clks R8A7791_CLK_SCU_SRC9>, <&mstp10_clks R8A7791_CLK_SCU_SRC8>,
1044 <&mstp10_clks R8A7791_CLK_SCU_SRC7>, <&mstp10_clks R8A7791_CLK_SCU_SRC6>,
1045 <&mstp10_clks R8A7791_CLK_SCU_SRC5>, <&mstp10_clks R8A7791_CLK_SCU_SRC4>,
1046 <&mstp10_clks R8A7791_CLK_SCU_SRC3>, <&mstp10_clks R8A7791_CLK_SCU_SRC2>,
1047 <&mstp10_clks R8A7791_CLK_SCU_SRC1>, <&mstp10_clks R8A7791_CLK_SCU_SRC0>,
1048 <&mstp10_clks R8A7791_CLK_SCU_DVC0>, <&mstp10_clks R8A7791_CLK_SCU_DVC1>,
1049 <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
1050 clock-names = "ssi-all",
1051 "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
1052 "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
1053 "src.9", "src.8", "src.7", "src.6", "src.5",
1054 "src.4", "src.3", "src.2", "src.1", "src.0",
1055 "dvc.0", "dvc.1",
1056 "clk_a", "clk_b", "clk_c", "clk_i";
1057
1058 status = "disabled";
1059
1060 rcar_sound,dvc {
1061 dvc0: dvc@0 { };
1062 dvc1: dvc@1 { };
1063 };
1064
1065 rcar_sound,src {
1066 src0: src@0 { };
1067 src1: src@1 { };
1068 src2: src@2 { };
1069 src3: src@3 { };
1070 src4: src@4 { };
1071 src5: src@5 { };
1072 src6: src@6 { };
1073 src7: src@7 { };
1074 src8: src@8 { };
1075 src9: src@9 { };
1076 };
1077
1078 rcar_sound,ssi {
1079 ssi0: ssi@0 { interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; };
1080 ssi1: ssi@1 { interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; };
1081 ssi2: ssi@2 { interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; };
1082 ssi3: ssi@3 { interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; };
1083 ssi4: ssi@4 { interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; };
1084 ssi5: ssi@5 { interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; };
1085 ssi6: ssi@6 { interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; };
1086 ssi7: ssi@7 { interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; };
1087 ssi8: ssi@8 { interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; };
1088 ssi9: ssi@9 { interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; };
1089 };
1090 };
883}; 1091};
diff --git a/arch/arm/boot/dts/rk3066a-bqcurie2.dts b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
index afb327322a4a..042f821d9e4d 100644
--- a/arch/arm/boot/dts/rk3066a-bqcurie2.dts
+++ b/arch/arm/boot/dts/rk3066a-bqcurie2.dts
@@ -24,87 +24,171 @@
24 reg = <0x60000000 0x40000000>; 24 reg = <0x60000000 0x40000000>;
25 }; 25 };
26 26
27 soc { 27 vcc_sd0: fixed-regulator {
28 uart0: serial@10124000 { 28 compatible = "regulator-fixed";
29 status = "okay"; 29 regulator-name = "sdmmc-supply";
30 }; 30 regulator-min-microvolt = <3000000>;
31 regulator-max-microvolt = <3000000>;
32 gpio = <&gpio3 7 GPIO_ACTIVE_LOW>;
33 startup-delay-us = <100000>;
34 vin-supply = <&vcc_io>;
35 };
31 36
32 uart1: serial@10126000 { 37 gpio-keys {
33 status = "okay"; 38 compatible = "gpio-keys";
39 #address-cells = <1>;
40 #size-cells = <0>;
41 autorepeat;
42
43 button@0 {
44 gpios = <&gpio6 2 GPIO_ACTIVE_LOW>; /* GPIO6_A2 */
45 linux,code = <116>;
46 label = "GPIO Key Power";
47 linux,input-type = <1>;
48 gpio-key,wakeup = <1>;
49 debounce-interval = <100>;
34 }; 50 };
35 51 button@1 {
36 uart2: serial@20064000 { 52 gpios = <&gpio4 21 GPIO_ACTIVE_LOW>; /* GPIO4_C5 */
37 pinctrl-names = "default"; 53 linux,code = <104>;
38 pinctrl-0 = <&uart2_xfer>; 54 label = "GPIO Key Vol-";
39 status = "okay"; 55 linux,input-type = <1>;
56 gpio-key,wakeup = <0>;
57 debounce-interval = <100>;
40 }; 58 };
59 /* VOL+ comes somehow thru the ADC */
60 };
61};
41 62
42 uart3: serial@20068000 { 63&i2c1 {
43 status = "okay"; 64 status = "okay";
44 }; 65 clock-frequency = <400000>;
45 66
46 vcc_sd0: fixed-regulator { 67 tps: tps@2d {
47 compatible = "regulator-fixed"; 68 reg = <0x2d>;
48 regulator-name = "sdmmc-supply";
49 regulator-min-microvolt = <3000000>;
50 regulator-max-microvolt = <3000000>;
51 gpio = <&gpio3 7 GPIO_ACTIVE_LOW>;
52 startup-delay-us = <100000>;
53 };
54 69
55 dwmmc@10214000 { /* sdmmc */ 70 interrupt-parent = <&gpio6>;
56 num-slots = <1>; 71 interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
57 status = "okay";
58 72
59 pinctrl-names = "default"; 73 vcc5-supply = <&vcc_io>;
60 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4>; 74 vcc6-supply = <&vcc_io>;
61 vmmc-supply = <&vcc_sd0>;
62 75
63 slot@0 { 76 regulators {
64 reg = <0>; 77 vcc_rtc: regulator@0 {
65 bus-width = <4>; 78 regulator-name = "vcc_rtc";
66 disable-wp; 79 regulator-always-on;
67 }; 80 };
68 };
69 81
70 dwmmc@10218000 { /* wifi */ 82 vcc_io: regulator@1 {
71 num-slots = <1>; 83 regulator-name = "vcc_io";
72 status = "okay"; 84 regulator-always-on;
73 non-removable; 85 };
74 86
75 pinctrl-names = "default"; 87 vdd_arm: regulator@2 {
76 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>; 88 regulator-name = "vdd_arm";
89 regulator-min-microvolt = <600000>;
90 regulator-max-microvolt = <1500000>;
91 regulator-boot-on;
92 regulator-always-on;
93 };
77 94
78 slot@0 { 95 vcc_ddr: regulator@3 {
79 reg = <0>; 96 regulator-name = "vcc_ddr";
80 bus-width = <4>; 97 regulator-min-microvolt = <600000>;
81 disable-wp; 98 regulator-max-microvolt = <1500000>;
99 regulator-boot-on;
100 regulator-always-on;
101 };
102
103 vcc18_cif: regulator@5 {
104 regulator-name = "vcc18_cif";
105 regulator-always-on;
106 };
107
108 vdd_11: regulator@6 {
109 regulator-name = "vdd_11";
110 regulator-always-on;
111 };
112
113 vcc_25: regulator@7 {
114 regulator-name = "vcc_25";
115 regulator-always-on;
116 };
117
118 vcc_18: regulator@8 {
119 regulator-name = "vcc_18";
120 regulator-always-on;
121 };
122
123 vcc25_hdmi: regulator@9 {
124 regulator-name = "vcc25_hdmi";
125 regulator-always-on;
126 };
127
128 vcca_33: regulator@10 {
129 regulator-name = "vcca_33";
130 regulator-always-on;
82 }; 131 };
83 };
84 132
85 gpio-keys { 133 vcc_tp: regulator@11 {
86 compatible = "gpio-keys"; 134 regulator-name = "vcc_tp";
87 #address-cells = <1>; 135 regulator-always-on;
88 #size-cells = <0>;
89 autorepeat;
90
91 button@0 {
92 gpios = <&gpio6 2 GPIO_ACTIVE_LOW>; /* GPIO6_A2 */
93 linux,code = <116>;
94 label = "GPIO Key Power";
95 linux,input-type = <1>;
96 gpio-key,wakeup = <1>;
97 debounce-interval = <100>;
98 }; 136 };
99 button@1 { 137
100 gpios = <&gpio4 21 GPIO_ACTIVE_LOW>; /* GPIO4_C5 */ 138 vcc28_cif: regulator@12 {
101 linux,code = <104>; 139 regulator-name = "vcc28_cif";
102 label = "GPIO Key Vol-"; 140 regulator-always-on;
103 linux,input-type = <1>;
104 gpio-key,wakeup = <0>;
105 debounce-interval = <100>;
106 }; 141 };
107 /* VOL+ comes somehow thru the ADC */
108 }; 142 };
109 }; 143 };
110}; 144};
145
146/* must be included after &tps gets defined */
147#include "tps65910.dtsi"
148
149&mmc0 { /* sdmmc */
150 num-slots = <1>;
151 status = "okay";
152 vmmc-supply = <&vcc_sd0>;
153
154 slot@0 {
155 reg = <0>;
156 bus-width = <4>;
157 disable-wp;
158 };
159};
160
161&mmc1 { /* wifi */
162 num-slots = <1>;
163 status = "okay";
164 non-removable;
165
166 pinctrl-names = "default";
167 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_bus4>;
168
169 slot@0 {
170 reg = <0>;
171 bus-width = <4>;
172 disable-wp;
173 };
174};
175
176&uart0 {
177 status = "okay";
178};
179
180&uart1 {
181 status = "okay";
182};
183
184&uart2 {
185 status = "okay";
186};
187
188&uart3 {
189 status = "okay";
190};
191
192&wdt {
193 status = "okay";
194};
diff --git a/arch/arm/boot/dts/rk3066a-clocks.dtsi b/arch/arm/boot/dts/rk3066a-clocks.dtsi
deleted file mode 100644
index 6e307fc4c451..000000000000
--- a/arch/arm/boot/dts/rk3066a-clocks.dtsi
+++ /dev/null
@@ -1,299 +0,0 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License 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 clocks {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 ranges;
21
22 /*
23 * This is a dummy clock, to be used as placeholder on
24 * other mux clocks when a specific parent clock is not
25 * yet implemented. It should be dropped when the driver
26 * is complete.
27 */
28 dummy: dummy {
29 compatible = "fixed-clock";
30 clock-frequency = <0>;
31 #clock-cells = <0>;
32 };
33
34 xin24m: xin24m {
35 compatible = "fixed-clock";
36 clock-frequency = <24000000>;
37 #clock-cells = <0>;
38 };
39
40 dummy48m: dummy48m {
41 compatible = "fixed-clock";
42 clock-frequency = <48000000>;
43 #clock-cells = <0>;
44 };
45
46 dummy150m: dummy150m {
47 compatible = "fixed-clock";
48 clock-frequency = <150000000>;
49 #clock-cells = <0>;
50 };
51
52 clk_gates0: gate-clk@200000d0 {
53 compatible = "rockchip,rk2928-gate-clk";
54 reg = <0x200000d0 0x4>;
55 clocks = <&dummy>, <&dummy>,
56 <&dummy>, <&dummy>,
57 <&dummy>, <&dummy>,
58 <&dummy>, <&dummy>,
59 <&dummy>, <&dummy>,
60 <&dummy>, <&dummy>,
61 <&dummy>, <&dummy>,
62 <&dummy>, <&dummy>;
63
64 clock-output-names =
65 "gate_core_periph", "gate_cpu_gpll",
66 "gate_ddrphy", "gate_aclk_cpu",
67 "gate_hclk_cpu", "gate_pclk_cpu",
68 "gate_atclk_cpu", "gate_i2s0",
69 "gate_i2s0_frac", "gate_i2s1",
70 "gate_i2s1_frac", "gate_i2s2",
71 "gate_i2s2_frac", "gate_spdif",
72 "gate_spdif_frac", "gate_testclk";
73
74 #clock-cells = <1>;
75 };
76
77 clk_gates1: gate-clk@200000d4 {
78 compatible = "rockchip,rk2928-gate-clk";
79 reg = <0x200000d4 0x4>;
80 clocks = <&xin24m>, <&xin24m>,
81 <&xin24m>, <&dummy>,
82 <&dummy>, <&xin24m>,
83 <&xin24m>, <&dummy>,
84 <&xin24m>, <&dummy>,
85 <&xin24m>, <&dummy>,
86 <&xin24m>, <&dummy>,
87 <&xin24m>, <&dummy>;
88
89 clock-output-names =
90 "gate_timer0", "gate_timer1",
91 "gate_timer2", "gate_jtag",
92 "gate_aclk_lcdc1_src", "gate_otgphy0",
93 "gate_otgphy1", "gate_ddr_gpll",
94 "gate_uart0", "gate_frac_uart0",
95 "gate_uart1", "gate_frac_uart1",
96 "gate_uart2", "gate_frac_uart2",
97 "gate_uart3", "gate_frac_uart3";
98
99 #clock-cells = <1>;
100 };
101
102 clk_gates2: gate-clk@200000d8 {
103 compatible = "rockchip,rk2928-gate-clk";
104 reg = <0x200000d8 0x4>;
105 clocks = <&clk_gates2 1>, <&dummy>,
106 <&dummy>, <&dummy>,
107 <&dummy>, <&dummy>,
108 <&clk_gates2 3>, <&dummy>,
109 <&dummy>, <&dummy>,
110 <&dummy>, <&dummy48m>,
111 <&dummy>, <&dummy48m>,
112 <&dummy>, <&dummy>;
113
114 clock-output-names =
115 "gate_periph_src", "gate_aclk_periph",
116 "gate_hclk_periph", "gate_pclk_periph",
117 "gate_smc", "gate_mac",
118 "gate_hsadc", "gate_hsadc_frac",
119 "gate_saradc", "gate_spi0",
120 "gate_spi1", "gate_mmc0",
121 "gate_mac_lbtest", "gate_mmc1",
122 "gate_emmc", "gate_tsadc";
123
124 #clock-cells = <1>;
125 };
126
127 clk_gates3: gate-clk@200000dc {
128 compatible = "rockchip,rk2928-gate-clk";
129 reg = <0x200000dc 0x4>;
130 clocks = <&dummy>, <&dummy>,
131 <&dummy>, <&dummy>,
132 <&dummy>, <&dummy>,
133 <&dummy>, <&dummy>,
134 <&dummy>, <&dummy>,
135 <&dummy>, <&dummy>,
136 <&dummy>, <&dummy>,
137 <&dummy>, <&dummy>;
138
139 clock-output-names =
140 "gate_aclk_lcdc0_src", "gate_dclk_lcdc0",
141 "gate_dclk_lcdc1", "gate_pclkin_cif0",
142 "gate_pclkin_cif1", "reserved",
143 "reserved", "gate_cif0_out",
144 "gate_cif1_out", "gate_aclk_vepu",
145 "gate_hclk_vepu", "gate_aclk_vdpu",
146 "gate_hclk_vdpu", "gate_gpu_src",
147 "reserved", "gate_xin27m";
148
149 #clock-cells = <1>;
150 };
151
152 clk_gates4: gate-clk@200000e0 {
153 compatible = "rockchip,rk2928-gate-clk";
154 reg = <0x200000e0 0x4>;
155 clocks = <&clk_gates2 2>, <&clk_gates2 3>,
156 <&clk_gates2 1>, <&clk_gates2 1>,
157 <&clk_gates2 1>, <&clk_gates2 2>,
158 <&clk_gates2 2>, <&clk_gates2 2>,
159 <&clk_gates0 4>, <&clk_gates0 4>,
160 <&clk_gates0 3>, <&clk_gates0 3>,
161 <&clk_gates0 3>, <&clk_gates2 3>,
162 <&clk_gates0 4>;
163
164 clock-output-names =
165 "gate_hclk_peri_axi_matrix", "gate_pclk_peri_axi_matrix",
166 "gate_aclk_cpu_peri", "gate_aclk_peri_axi_matrix",
167 "gate_aclk_pei_niu", "gate_hclk_usb_peri",
168 "gate_hclk_peri_ahb_arbi", "gate_hclk_emem_peri",
169 "gate_hclk_cpubus", "gate_hclk_ahb2apb",
170 "gate_aclk_strc_sys", "gate_aclk_l2mem_con",
171 "gate_aclk_intmem", "gate_pclk_tsadc",
172 "gate_hclk_hdmi";
173
174 #clock-cells = <1>;
175 };
176
177 clk_gates5: gate-clk@200000e4 {
178 compatible = "rockchip,rk2928-gate-clk";
179 reg = <0x200000e4 0x4>;
180 clocks = <&clk_gates0 3>, <&clk_gates2 1>,
181 <&clk_gates0 5>, <&clk_gates0 5>,
182 <&clk_gates0 5>, <&clk_gates0 5>,
183 <&clk_gates0 4>, <&clk_gates0 5>,
184 <&clk_gates2 1>, <&clk_gates2 2>,
185 <&clk_gates2 2>, <&clk_gates2 2>,
186 <&clk_gates2 2>, <&clk_gates4 5>,
187 <&clk_gates4 5>, <&dummy>;
188
189 clock-output-names =
190 "gate_aclk_dmac1", "gate_aclk_dmac2",
191 "gate_pclk_efuse", "gate_pclk_tzpc",
192 "gate_pclk_grf", "gate_pclk_pmu",
193 "gate_hclk_rom", "gate_pclk_ddrupctl",
194 "gate_aclk_smc", "gate_hclk_nandc",
195 "gate_hclk_mmc0", "gate_hclk_mmc1",
196 "gate_hclk_emmc", "gate_hclk_otg0",
197 "gate_hclk_otg1", "gate_aclk_gpu";
198
199 #clock-cells = <1>;
200 };
201
202 clk_gates6: gate-clk@200000e8 {
203 compatible = "rockchip,rk2928-gate-clk";
204 reg = <0x200000e8 0x4>;
205 clocks = <&clk_gates3 0>, <&clk_gates0 4>,
206 <&clk_gates0 4>, <&clk_gates1 4>,
207 <&clk_gates0 4>, <&clk_gates3 0>,
208 <&clk_gates0 4>, <&clk_gates1 4>,
209 <&clk_gates3 0>, <&clk_gates0 4>,
210 <&clk_gates0 4>, <&clk_gates1 4>,
211 <&clk_gates0 4>, <&clk_gates3 0>,
212 <&dummy>, <&dummy>;
213
214 clock-output-names =
215 "gate_aclk_lcdc0", "gate_hclk_lcdc0",
216 "gate_hclk_lcdc1", "gate_aclk_lcdc1",
217 "gate_hclk_cif0", "gate_aclk_cif0",
218 "gate_hclk_cif1", "gate_aclk_cif1",
219 "gate_aclk_ipp", "gate_hclk_ipp",
220 "gate_hclk_rga", "gate_aclk_rga",
221 "gate_hclk_vio_bus", "gate_aclk_vio0",
222 "gate_aclk_vcodec", "gate_shclk_vio_h2h";
223
224 #clock-cells = <1>;
225 };
226
227 clk_gates7: gate-clk@200000ec {
228 compatible = "rockchip,rk2928-gate-clk";
229 reg = <0x200000ec 0x4>;
230 clocks = <&clk_gates2 2>, <&clk_gates0 4>,
231 <&clk_gates0 4>, <&clk_gates0 4>,
232 <&clk_gates0 4>, <&clk_gates2 2>,
233 <&clk_gates2 2>, <&clk_gates0 5>,
234 <&clk_gates0 5>, <&clk_gates0 5>,
235 <&clk_gates0 5>, <&clk_gates2 3>,
236 <&clk_gates2 3>, <&clk_gates2 3>,
237 <&clk_gates2 3>, <&clk_gates2 3>;
238
239 clock-output-names =
240 "gate_hclk_emac", "gate_hclk_spdif",
241 "gate_hclk_i2s0_2ch", "gate_hclk_i2s1_2ch",
242 "gate_hclk_i2s_8ch", "gate_hclk_hsadc",
243 "gate_hclk_pidf", "gate_pclk_timer0",
244 "gate_pclk_timer1", "gate_pclk_timer2",
245 "gate_pclk_pwm01", "gate_pclk_pwm23",
246 "gate_pclk_spi0", "gate_pclk_spi1",
247 "gate_pclk_saradc", "gate_pclk_wdt";
248
249 #clock-cells = <1>;
250 };
251
252 clk_gates8: gate-clk@200000f0 {
253 compatible = "rockchip,rk2928-gate-clk";
254 reg = <0x200000f0 0x4>;
255 clocks = <&clk_gates0 5>, <&clk_gates0 5>,
256 <&clk_gates2 3>, <&clk_gates2 3>,
257 <&clk_gates0 5>, <&clk_gates0 5>,
258 <&clk_gates2 3>, <&clk_gates2 3>,
259 <&clk_gates2 3>, <&clk_gates0 5>,
260 <&clk_gates0 5>, <&clk_gates0 5>,
261 <&clk_gates2 3>, <&clk_gates2 3>,
262 <&dummy>, <&clk_gates0 5>;
263
264 clock-output-names =
265 "gate_pclk_uart0", "gate_pclk_uart1",
266 "gate_pclk_uart2", "gate_pclk_uart3",
267 "gate_pclk_i2c0", "gate_pclk_i2c1",
268 "gate_pclk_i2c2", "gate_pclk_i2c3",
269 "gate_pclk_i2c4", "gate_pclk_gpio0",
270 "gate_pclk_gpio1", "gate_pclk_gpio2",
271 "gate_pclk_gpio3", "gate_pclk_gpio4",
272 "reserved", "gate_pclk_gpio6";
273
274 #clock-cells = <1>;
275 };
276
277 clk_gates9: gate-clk@200000f4 {
278 compatible = "rockchip,rk2928-gate-clk";
279 reg = <0x200000f4 0x4>;
280 clocks = <&dummy>, <&clk_gates0 5>,
281 <&dummy>, <&dummy>,
282 <&dummy>, <&clk_gates1 4>,
283 <&clk_gates0 5>, <&dummy>,
284 <&dummy>, <&dummy>,
285 <&dummy>;
286
287 clock-output-names =
288 "gate_clk_core_dbg", "gate_pclk_dbg",
289 "gate_clk_trace", "gate_atclk",
290 "gate_clk_l2c", "gate_aclk_vio1",
291 "gate_pclk_publ", "gate_aclk_intmem0",
292 "gate_aclk_intmem1", "gate_aclk_intmem2",
293 "gate_aclk_intmem3";
294
295 #clock-cells = <1>;
296 };
297 };
298
299};
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index 4387cfd420ba..879a818fba51 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -15,8 +15,8 @@
15 15
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/pinctrl/rockchip.h> 17#include <dt-bindings/pinctrl/rockchip.h>
18#include <dt-bindings/clock/rk3066a-cru.h>
18#include "rk3xxx.dtsi" 19#include "rk3xxx.dtsi"
19#include "rk3066a-clocks.dtsi"
20 20
21/ { 21/ {
22 compatible = "rockchip,rk3066a"; 22 compatible = "rockchip,rk3066a";
@@ -40,247 +40,392 @@
40 }; 40 };
41 }; 41 };
42 42
43 soc { 43 sram: sram@10080000 {
44 timer@20038000 { 44 compatible = "mmio-sram";
45 compatible = "snps,dw-apb-timer-osc"; 45 reg = <0x10080000 0x10000>;
46 reg = <0x20038000 0x100>; 46 #address-cells = <1>;
47 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; 47 #size-cells = <1>;
48 clocks = <&clk_gates1 0>, <&clk_gates7 7>; 48 ranges = <0 0x10080000 0x10000>;
49 clock-names = "timer", "pclk"; 49
50 smp-sram@0 {
51 compatible = "rockchip,rk3066-smp-sram";
52 reg = <0x0 0x50>;
50 }; 53 };
54 };
55
56 cru: clock-controller@20000000 {
57 compatible = "rockchip,rk3066a-cru";
58 reg = <0x20000000 0x1000>;
59 rockchip,grf = <&grf>;
51 60
52 timer@2003a000 { 61 #clock-cells = <1>;
53 compatible = "snps,dw-apb-timer-osc"; 62 #reset-cells = <1>;
54 reg = <0x2003a000 0x100>; 63 };
55 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; 64
56 clocks = <&clk_gates1 1>, <&clk_gates7 8>; 65 timer@2000e000 {
57 clock-names = "timer", "pclk"; 66 compatible = "snps,dw-apb-timer-osc";
67 reg = <0x2000e000 0x100>;
68 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
69 clocks = <&cru SCLK_TIMER2>, <&cru PCLK_TIMER2>;
70 clock-names = "timer", "pclk";
71 };
72
73 timer@20038000 {
74 compatible = "snps,dw-apb-timer-osc";
75 reg = <0x20038000 0x100>;
76 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
77 clocks = <&cru SCLK_TIMER0>, <&cru PCLK_TIMER0>;
78 clock-names = "timer", "pclk";
79 };
80
81 timer@2003a000 {
82 compatible = "snps,dw-apb-timer-osc";
83 reg = <0x2003a000 0x100>;
84 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
85 clocks = <&cru SCLK_TIMER1>, <&cru PCLK_TIMER1>;
86 clock-names = "timer", "pclk";
87 };
88
89 pinctrl: pinctrl {
90 compatible = "rockchip,rk3066a-pinctrl";
91 rockchip,grf = <&grf>;
92 #address-cells = <1>;
93 #size-cells = <1>;
94 ranges;
95
96 gpio0: gpio0@20034000 {
97 compatible = "rockchip,gpio-bank";
98 reg = <0x20034000 0x100>;
99 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
100 clocks = <&cru PCLK_GPIO0>;
101
102 gpio-controller;
103 #gpio-cells = <2>;
104
105 interrupt-controller;
106 #interrupt-cells = <2>;
58 }; 107 };
59 108
60 timer@2000e000 { 109 gpio1: gpio1@2003c000 {
61 compatible = "snps,dw-apb-timer-osc"; 110 compatible = "rockchip,gpio-bank";
62 reg = <0x2000e000 0x100>; 111 reg = <0x2003c000 0x100>;
63 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 112 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
64 clocks = <&clk_gates1 2>, <&clk_gates7 9>; 113 clocks = <&cru PCLK_GPIO1>;
65 clock-names = "timer", "pclk"; 114
115 gpio-controller;
116 #gpio-cells = <2>;
117
118 interrupt-controller;
119 #interrupt-cells = <2>;
66 }; 120 };
67 121
68 sram: sram@10080000 { 122 gpio2: gpio2@2003e000 {
69 compatible = "mmio-sram"; 123 compatible = "rockchip,gpio-bank";
70 reg = <0x10080000 0x10000>; 124 reg = <0x2003e000 0x100>;
71 #address-cells = <1>; 125 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
72 #size-cells = <1>; 126 clocks = <&cru PCLK_GPIO2>;
73 ranges = <0 0x10080000 0x10000>;
74 127
75 smp-sram@0 { 128 gpio-controller;
76 compatible = "rockchip,rk3066-smp-sram"; 129 #gpio-cells = <2>;
77 reg = <0x0 0x50>; 130
78 }; 131 interrupt-controller;
132 #interrupt-cells = <2>;
133 };
134
135 gpio3: gpio3@20080000 {
136 compatible = "rockchip,gpio-bank";
137 reg = <0x20080000 0x100>;
138 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
139 clocks = <&cru PCLK_GPIO3>;
140
141 gpio-controller;
142 #gpio-cells = <2>;
143
144 interrupt-controller;
145 #interrupt-cells = <2>;
79 }; 146 };
80 147
81 pinctrl@20008000 { 148 gpio4: gpio4@20084000 {
82 compatible = "rockchip,rk3066a-pinctrl"; 149 compatible = "rockchip,gpio-bank";
83 rockchip,grf = <&grf>; 150 reg = <0x20084000 0x100>;
84 #address-cells = <1>; 151 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
85 #size-cells = <1>; 152 clocks = <&cru PCLK_GPIO4>;
86 ranges;
87 153
88 gpio0: gpio0@20034000 { 154 gpio-controller;
89 compatible = "rockchip,gpio-bank"; 155 #gpio-cells = <2>;
90 reg = <0x20034000 0x100>;
91 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
92 clocks = <&clk_gates8 9>;
93 156
94 gpio-controller; 157 interrupt-controller;
95 #gpio-cells = <2>; 158 #interrupt-cells = <2>;
159 };
96 160
97 interrupt-controller; 161 gpio6: gpio6@2000a000 {
98 #interrupt-cells = <2>; 162 compatible = "rockchip,gpio-bank";
163 reg = <0x2000a000 0x100>;
164 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
165 clocks = <&cru PCLK_GPIO6>;
166
167 gpio-controller;
168 #gpio-cells = <2>;
169
170 interrupt-controller;
171 #interrupt-cells = <2>;
172 };
173
174 pcfg_pull_default: pcfg_pull_default {
175 bias-pull-pin-default;
176 };
177
178 pcfg_pull_none: pcfg_pull_none {
179 bias-disable;
180 };
181
182 i2c0 {
183 i2c0_xfer: i2c0-xfer {
184 rockchip,pins = <RK_GPIO2 28 RK_FUNC_1 &pcfg_pull_none>,
185 <RK_GPIO2 29 RK_FUNC_1 &pcfg_pull_none>;
99 }; 186 };
187 };
100 188
101 gpio1: gpio1@2003c000 { 189 i2c1 {
102 compatible = "rockchip,gpio-bank"; 190 i2c1_xfer: i2c1-xfer {
103 reg = <0x2003c000 0x100>; 191 rockchip,pins = <RK_GPIO2 30 RK_FUNC_1 &pcfg_pull_none>,
104 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; 192 <RK_GPIO2 31 RK_FUNC_1 &pcfg_pull_none>;
105 clocks = <&clk_gates8 10>; 193 };
194 };
106 195
107 gpio-controller; 196 i2c2 {
108 #gpio-cells = <2>; 197 i2c2_xfer: i2c2-xfer {
198 rockchip,pins = <RK_GPIO3 0 RK_FUNC_1 &pcfg_pull_none>,
199 <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>;
200 };
201 };
109 202
110 interrupt-controller; 203 i2c3 {
111 #interrupt-cells = <2>; 204 i2c3_xfer: i2c3-xfer {
205 rockchip,pins = <RK_GPIO3 2 RK_FUNC_2 &pcfg_pull_none>,
206 <RK_GPIO3 3 RK_FUNC_2 &pcfg_pull_none>;
112 }; 207 };
208 };
113 209
114 gpio2: gpio2@2003e000 { 210 i2c4 {
115 compatible = "rockchip,gpio-bank"; 211 i2c4_xfer: i2c4-xfer {
116 reg = <0x2003e000 0x100>; 212 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>,
117 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; 213 <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>;
118 clocks = <&clk_gates8 11>; 214 };
215 };
119 216
120 gpio-controller; 217 pwm0 {
121 #gpio-cells = <2>; 218 pwm0_out: pwm0-out {
219 rockchip,pins = <RK_GPIO0 3 RK_FUNC_1 &pcfg_pull_none>;
220 };
221 };
122 222
123 interrupt-controller; 223 pwm1 {
124 #interrupt-cells = <2>; 224 pwm1_out: pwm1-out {
225 rockchip,pins = <RK_GPIO0 4 RK_FUNC_1 &pcfg_pull_none>;
125 }; 226 };
227 };
126 228
127 gpio3: gpio3@20080000 { 229 pwm2 {
128 compatible = "rockchip,gpio-bank"; 230 pwm2_out: pwm2-out {
129 reg = <0x20080000 0x100>; 231 rockchip,pins = <RK_GPIO0 30 RK_FUNC_1 &pcfg_pull_none>;
130 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; 232 };
131 clocks = <&clk_gates8 12>; 233 };
132 234
133 gpio-controller; 235 pwm3 {
134 #gpio-cells = <2>; 236 pwm3_out: pwm3-out {
237 rockchip,pins = <RK_GPIO0 31 RK_FUNC_1 &pcfg_pull_none>;
238 };
239 };
135 240
136 interrupt-controller; 241 uart0 {
137 #interrupt-cells = <2>; 242 uart0_xfer: uart0-xfer {
243 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>,
244 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>;
138 }; 245 };
139 246
140 gpio4: gpio4@20084000 { 247 uart0_cts: uart0-cts {
141 compatible = "rockchip,gpio-bank"; 248 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>;
142 reg = <0x20084000 0x100>; 249 };
143 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
144 clocks = <&clk_gates8 13>;
145 250
146 gpio-controller; 251 uart0_rts: uart0-rts {
147 #gpio-cells = <2>; 252 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>;
253 };
254 };
255
256 uart1 {
257 uart1_xfer: uart1-xfer {
258 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>,
259 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>;
260 };
148 261
149 interrupt-controller; 262 uart1_cts: uart1-cts {
150 #interrupt-cells = <2>; 263 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>;
151 }; 264 };
152 265
153 gpio6: gpio6@2000a000 { 266 uart1_rts: uart1-rts {
154 compatible = "rockchip,gpio-bank"; 267 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>;
155 reg = <0x2000a000 0x100>; 268 };
156 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; 269 };
157 clocks = <&clk_gates8 15>;
158 270
159 gpio-controller; 271 uart2 {
160 #gpio-cells = <2>; 272 uart2_xfer: uart2-xfer {
273 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>,
274 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>;
275 };
276 /* no rts / cts for uart2 */
277 };
161 278
162 interrupt-controller; 279 uart3 {
163 #interrupt-cells = <2>; 280 uart3_xfer: uart3-xfer {
281 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>,
282 <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>;
164 }; 283 };
165 284
166 pcfg_pull_default: pcfg_pull_default { 285 uart3_cts: uart3-cts {
167 bias-pull-pin-default; 286 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>;
168 }; 287 };
169 288
170 pcfg_pull_none: pcfg_pull_none { 289 uart3_rts: uart3-rts {
171 bias-disable; 290 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>;
172 }; 291 };
292 };
173 293
174 uart0 { 294 sd0 {
175 uart0_xfer: uart0-xfer { 295 sd0_clk: sd0-clk {
176 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>, 296 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>;
177 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>; 297 };
178 };
179 298
180 uart0_cts: uart0-cts { 299 sd0_cmd: sd0-cmd {
181 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>; 300 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>;
182 }; 301 };
183 302
184 uart0_rts: uart0-rts { 303 sd0_cd: sd0-cd {
185 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>; 304 rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>;
186 };
187 }; 305 };
188 306
189 uart1 { 307 sd0_wp: sd0-wp {
190 uart1_xfer: uart1-xfer { 308 rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>;
191 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>, 309 };
192 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>;
193 };
194 310
195 uart1_cts: uart1-cts { 311 sd0_bus1: sd0-bus-width1 {
196 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>; 312 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>;
197 }; 313 };
198 314
199 uart1_rts: uart1-rts { 315 sd0_bus4: sd0-bus-width4 {
200 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>; 316 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>,
201 }; 317 <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>,
318 <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>,
319 <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>;
202 }; 320 };
321 };
203 322
204 uart2 { 323 sd1 {
205 uart2_xfer: uart2-xfer { 324 sd1_clk: sd1-clk {
206 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>, 325 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>;
207 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>;
208 };
209 /* no rts / cts for uart2 */
210 }; 326 };
211 327
212 uart3 { 328 sd1_cmd: sd1-cmd {
213 uart3_xfer: uart3-xfer { 329 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>;
214 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>, 330 };
215 <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>;
216 };
217 331
218 uart3_cts: uart3-cts { 332 sd1_cd: sd1-cd {
219 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>; 333 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>;
220 }; 334 };
221 335
222 uart3_rts: uart3-rts { 336 sd1_wp: sd1-wp {
223 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>; 337 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>;
224 };
225 }; 338 };
226 339
227 sd0 { 340 sd1_bus1: sd1-bus-width1 {
228 sd0_clk: sd0-clk { 341 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>;
229 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>;
230 };
231
232 sd0_cmd: sd0-cmd {
233 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>;
234 };
235
236 sd0_cd: sd0-cd {
237 rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>;
238 };
239
240 sd0_wp: sd0-wp {
241 rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>;
242 };
243
244 sd0_bus1: sd0-bus-width1 {
245 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>;
246 };
247
248 sd0_bus4: sd0-bus-width4 {
249 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>,
250 <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>,
251 <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>,
252 <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>;
253 };
254 }; 342 };
255 343
256 sd1 { 344 sd1_bus4: sd1-bus-width4 {
257 sd1_clk: sd1-clk { 345 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>,
258 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>; 346 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>,
259 }; 347 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>,
260 348 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
261 sd1_cmd: sd1-cmd {
262 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>;
263 };
264
265 sd1_cd: sd1-cd {
266 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>;
267 };
268
269 sd1_wp: sd1-wp {
270 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>;
271 };
272
273 sd1_bus1: sd1-bus-width1 {
274 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>;
275 };
276
277 sd1_bus4: sd1-bus-width4 {
278 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>,
279 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>,
280 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>,
281 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
282 };
283 }; 349 };
284 }; 350 };
285 }; 351 };
286}; 352};
353
354&i2c0 {
355 pinctrl-names = "default";
356 pinctrl-0 = <&i2c0_xfer>;
357};
358
359&i2c1 {
360 pinctrl-names = "default";
361 pinctrl-0 = <&i2c1_xfer>;
362};
363
364&i2c2 {
365 pinctrl-names = "default";
366 pinctrl-0 = <&i2c2_xfer>;
367};
368
369&i2c3 {
370 pinctrl-names = "default";
371 pinctrl-0 = <&i2c3_xfer>;
372};
373
374&i2c4 {
375 pinctrl-names = "default";
376 pinctrl-0 = <&i2c4_xfer>;
377};
378
379&mmc0 {
380 pinctrl-names = "default";
381 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4>;
382};
383
384&mmc1 {
385 pinctrl-names = "default";
386 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus4>;
387};
388
389&pwm0 {
390 pinctrl-names = "default";
391 pinctrl-0 = <&pwm0_out>;
392};
393
394&pwm1 {
395 pinctrl-names = "default";
396 pinctrl-0 = <&pwm1_out>;
397};
398
399&pwm2 {
400 pinctrl-names = "default";
401 pinctrl-0 = <&pwm2_out>;
402};
403
404&pwm3 {
405 pinctrl-names = "default";
406 pinctrl-0 = <&pwm3_out>;
407};
408
409&uart0 {
410 pinctrl-names = "default";
411 pinctrl-0 = <&uart0_xfer>;
412};
413
414&uart1 {
415 pinctrl-names = "default";
416 pinctrl-0 = <&uart1_xfer>;
417};
418
419&uart2 {
420 pinctrl-names = "default";
421 pinctrl-0 = <&uart2_xfer>;
422};
423
424&uart3 {
425 pinctrl-names = "default";
426 pinctrl-0 = <&uart3_xfer>;
427};
428
429&wdt {
430 compatible = "rockchip,rk3066-wdt", "snps,dw-wdt";
431};
diff --git a/arch/arm/boot/dts/rk3188-clocks.dtsi b/arch/arm/boot/dts/rk3188-clocks.dtsi
deleted file mode 100644
index b1b92dc245ce..000000000000
--- a/arch/arm/boot/dts/rk3188-clocks.dtsi
+++ /dev/null
@@ -1,289 +0,0 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License 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 clocks {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 ranges;
21
22 /*
23 * This is a dummy clock, to be used as placeholder on
24 * other mux clocks when a specific parent clock is not
25 * yet implemented. It should be dropped when the driver
26 * is complete.
27 */
28 dummy: dummy {
29 compatible = "fixed-clock";
30 clock-frequency = <0>;
31 #clock-cells = <0>;
32 };
33
34 xin24m: xin24m {
35 compatible = "fixed-clock";
36 clock-frequency = <24000000>;
37 #clock-cells = <0>;
38 };
39
40 dummy48m: dummy48m {
41 compatible = "fixed-clock";
42 clock-frequency = <48000000>;
43 #clock-cells = <0>;
44 };
45
46 dummy150m: dummy150m {
47 compatible = "fixed-clock";
48 clock-frequency = <150000000>;
49 #clock-cells = <0>;
50 };
51
52 clk_gates0: gate-clk@200000d0 {
53 compatible = "rockchip,rk2928-gate-clk";
54 reg = <0x200000d0 0x4>;
55 clocks = <&dummy150m>, <&dummy>,
56 <&dummy>, <&dummy>,
57 <&dummy>, <&dummy>,
58 <&dummy>, <&dummy>,
59 <&dummy>, <&dummy>,
60 <&dummy>, <&dummy>,
61 <&dummy>, <&dummy>,
62 <&dummy>, <&dummy>;
63
64 clock-output-names =
65 "gate_core_periph", "gate_cpu_gpll",
66 "gate_ddrphy", "gate_aclk_cpu",
67 "gate_hclk_cpu", "gate_pclk_cpu",
68 "gate_atclk_cpu", "gate_aclk_core",
69 "reserved", "gate_i2s0",
70 "gate_i2s0_frac", "reserved",
71 "reserved", "gate_spdif",
72 "gate_spdif_frac", "gate_testclk";
73
74 #clock-cells = <1>;
75 };
76
77 clk_gates1: gate-clk@200000d4 {
78 compatible = "rockchip,rk2928-gate-clk";
79 reg = <0x200000d4 0x4>;
80 clocks = <&xin24m>, <&xin24m>,
81 <&xin24m>, <&dummy>,
82 <&dummy>, <&xin24m>,
83 <&xin24m>, <&dummy>,
84 <&xin24m>, <&dummy>,
85 <&xin24m>, <&dummy>,
86 <&xin24m>, <&dummy>,
87 <&xin24m>, <&dummy>;
88
89 clock-output-names =
90 "gate_timer0", "gate_timer1",
91 "gate_timer3", "gate_jtag",
92 "gate_aclk_lcdc1_src", "gate_otgphy0",
93 "gate_otgphy1", "gate_ddr_gpll",
94 "gate_uart0", "gate_frac_uart0",
95 "gate_uart1", "gate_frac_uart1",
96 "gate_uart2", "gate_frac_uart2",
97 "gate_uart3", "gate_frac_uart3";
98
99 #clock-cells = <1>;
100 };
101
102 clk_gates2: gate-clk@200000d8 {
103 compatible = "rockchip,rk2928-gate-clk";
104 reg = <0x200000d8 0x4>;
105 clocks = <&clk_gates2 1>, <&dummy>,
106 <&dummy>, <&dummy>,
107 <&dummy>, <&dummy>,
108 <&clk_gates2 3>, <&dummy>,
109 <&dummy>, <&dummy>,
110 <&dummy>, <&dummy48m>,
111 <&dummy>, <&dummy48m>,
112 <&dummy>, <&dummy>;
113
114 clock-output-names =
115 "gate_periph_src", "gate_aclk_periph",
116 "gate_hclk_periph", "gate_pclk_periph",
117 "gate_smc", "gate_mac",
118 "gate_hsadc", "gate_hsadc_frac",
119 "gate_saradc", "gate_spi0",
120 "gate_spi1", "gate_mmc0",
121 "gate_mac_lbtest", "gate_mmc1",
122 "gate_emmc", "reserved";
123
124 #clock-cells = <1>;
125 };
126
127 clk_gates3: gate-clk@200000dc {
128 compatible = "rockchip,rk2928-gate-clk";
129 reg = <0x200000dc 0x4>;
130 clocks = <&dummy>, <&dummy>,
131 <&dummy>, <&dummy>,
132 <&xin24m>, <&xin24m>,
133 <&dummy>, <&dummy>,
134 <&xin24m>, <&dummy>,
135 <&dummy>, <&dummy>,
136 <&dummy>, <&dummy>,
137 <&xin24m>, <&dummy>;
138
139 clock-output-names =
140 "gate_aclk_lcdc0_src", "gate_dclk_lcdc0",
141 "gate_dclk_lcdc1", "gate_pclkin_cif0",
142 "gate_timer2", "gate_timer4",
143 "gate_hsicphy", "gate_cif0_out",
144 "gate_timer5", "gate_aclk_vepu",
145 "gate_hclk_vepu", "gate_aclk_vdpu",
146 "gate_hclk_vdpu", "reserved",
147 "gate_timer6", "gate_aclk_gpu_src";
148
149 #clock-cells = <1>;
150 };
151
152 clk_gates4: gate-clk@200000e0 {
153 compatible = "rockchip,rk2928-gate-clk";
154 reg = <0x200000e0 0x4>;
155 clocks = <&clk_gates2 2>, <&clk_gates2 3>,
156 <&clk_gates2 1>, <&clk_gates2 1>,
157 <&clk_gates2 1>, <&clk_gates2 2>,
158 <&clk_gates2 2>, <&clk_gates2 2>,
159 <&clk_gates0 4>, <&clk_gates0 4>,
160 <&clk_gates0 3>, <&dummy>,
161 <&clk_gates0 3>, <&dummy>,
162 <&dummy>, <&dummy>;
163
164 clock-output-names =
165 "gate_hclk_peri_axi_matrix", "gate_pclk_peri_axi_matrix",
166 "gate_aclk_cpu_peri", "gate_aclk_peri_axi_matrix",
167 "gate_aclk_pei_niu", "gate_hclk_usb_peri",
168 "gate_hclk_peri_ahb_arbi", "gate_hclk_emem_peri",
169 "gate_hclk_cpubus", "gate_hclk_ahb2apb",
170 "gate_aclk_strc_sys", "reserved",
171 "gate_aclk_intmem", "reserved",
172 "gate_hclk_imem1", "gate_hclk_imem0";
173
174 #clock-cells = <1>;
175 };
176
177 clk_gates5: gate-clk@200000e4 {
178 compatible = "rockchip,rk2928-gate-clk";
179 reg = <0x200000e4 0x4>;
180 clocks = <&clk_gates0 3>, <&clk_gates2 1>,
181 <&clk_gates0 5>, <&clk_gates0 5>,
182 <&clk_gates0 5>, <&clk_gates0 5>,
183 <&clk_gates0 4>, <&clk_gates0 5>,
184 <&clk_gates2 1>, <&clk_gates2 2>,
185 <&clk_gates2 2>, <&clk_gates2 2>,
186 <&clk_gates2 2>, <&clk_gates4 5>;
187
188 clock-output-names =
189 "gate_aclk_dmac1", "gate_aclk_dmac2",
190 "gate_pclk_efuse", "gate_pclk_tzpc",
191 "gate_pclk_grf", "gate_pclk_pmu",
192 "gate_hclk_rom", "gate_pclk_ddrupctl",
193 "gate_aclk_smc", "gate_hclk_nandc",
194 "gate_hclk_mmc0", "gate_hclk_mmc1",
195 "gate_hclk_emmc", "gate_hclk_otg0";
196
197 #clock-cells = <1>;
198 };
199
200 clk_gates6: gate-clk@200000e8 {
201 compatible = "rockchip,rk2928-gate-clk";
202 reg = <0x200000e8 0x4>;
203 clocks = <&clk_gates3 0>, <&clk_gates0 4>,
204 <&clk_gates0 4>, <&clk_gates1 4>,
205 <&clk_gates0 4>, <&clk_gates3 0>,
206 <&dummy>, <&dummy>,
207 <&clk_gates3 0>, <&clk_gates0 4>,
208 <&clk_gates0 4>, <&clk_gates1 4>,
209 <&clk_gates0 4>, <&clk_gates3 0>;
210
211 clock-output-names =
212 "gate_aclk_lcdc0", "gate_hclk_lcdc0",
213 "gate_hclk_lcdc1", "gate_aclk_lcdc1",
214 "gate_hclk_cif0", "gate_aclk_cif0",
215 "reserved", "reserved",
216 "gate_aclk_ipp", "gate_hclk_ipp",
217 "gate_hclk_rga", "gate_aclk_rga",
218 "gate_hclk_vio_bus", "gate_aclk_vio0";
219
220 #clock-cells = <1>;
221 };
222
223 clk_gates7: gate-clk@200000ec {
224 compatible = "rockchip,rk2928-gate-clk";
225 reg = <0x200000ec 0x4>;
226 clocks = <&clk_gates2 2>, <&clk_gates0 4>,
227 <&clk_gates0 4>, <&dummy>,
228 <&dummy>, <&clk_gates2 2>,
229 <&clk_gates2 2>, <&clk_gates0 5>,
230 <&dummy>, <&clk_gates0 5>,
231 <&clk_gates0 5>, <&clk_gates2 3>,
232 <&clk_gates2 3>, <&clk_gates2 3>,
233 <&clk_gates2 3>, <&clk_gates2 3>;
234
235 clock-output-names =
236 "gate_hclk_emac", "gate_hclk_spdif",
237 "gate_hclk_i2s0_2ch", "gate_hclk_otg1",
238 "gate_hclk_hsic", "gate_hclk_hsadc",
239 "gate_hclk_pidf", "gate_pclk_timer0",
240 "reserved", "gate_pclk_timer2",
241 "gate_pclk_pwm01", "gate_pclk_pwm23",
242 "gate_pclk_spi0", "gate_pclk_spi1",
243 "gate_pclk_saradc", "gate_pclk_wdt";
244
245 #clock-cells = <1>;
246 };
247
248 clk_gates8: gate-clk@200000f0 {
249 compatible = "rockchip,rk2928-gate-clk";
250 reg = <0x200000f0 0x4>;
251 clocks = <&clk_gates0 5>, <&clk_gates0 5>,
252 <&clk_gates2 3>, <&clk_gates2 3>,
253 <&clk_gates0 5>, <&clk_gates0 5>,
254 <&clk_gates2 3>, <&clk_gates2 3>,
255 <&clk_gates2 3>, <&clk_gates0 5>,
256 <&clk_gates0 5>, <&clk_gates0 5>,
257 <&clk_gates2 3>, <&dummy>;
258
259 clock-output-names =
260 "gate_pclk_uart0", "gate_pclk_uart1",
261 "gate_pclk_uart2", "gate_pclk_uart3",
262 "gate_pclk_i2c0", "gate_pclk_i2c1",
263 "gate_pclk_i2c2", "gate_pclk_i2c3",
264 "gate_pclk_i2c4", "gate_pclk_gpio0",
265 "gate_pclk_gpio1", "gate_pclk_gpio2",
266 "gate_pclk_gpio3", "gate_aclk_gps";
267
268 #clock-cells = <1>;
269 };
270
271 clk_gates9: gate-clk@200000f4 {
272 compatible = "rockchip,rk2928-gate-clk";
273 reg = <0x200000f4 0x4>;
274 clocks = <&dummy>, <&dummy>,
275 <&dummy>, <&dummy>,
276 <&dummy>, <&dummy>,
277 <&dummy>, <&dummy>;
278
279 clock-output-names =
280 "gate_clk_core_dbg", "gate_pclk_dbg",
281 "gate_clk_trace", "gate_atclk",
282 "gate_clk_l2c", "gate_aclk_vio1",
283 "gate_pclk_publ", "gate_aclk_gpu";
284
285 #clock-cells = <1>;
286 };
287 };
288
289};
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index a5eee55079cb..171b610db709 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -23,59 +23,205 @@
23 reg = <0x60000000 0x80000000>; 23 reg = <0x60000000 0x80000000>;
24 }; 24 };
25 25
26 soc { 26 gpio-keys {
27 uart0: serial@10124000 { 27 compatible = "gpio-keys";
28 status = "okay"; 28 #address-cells = <1>;
29 #size-cells = <0>;
30 autorepeat;
31
32 button@0 {
33 gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
34 linux,code = <116>;
35 label = "GPIO Key Power";
36 linux,input-type = <1>;
37 gpio-key,wakeup = <1>;
38 debounce-interval = <100>;
29 }; 39 };
40 };
30 41
31 uart1: serial@10126000 { 42 gpio-leds {
32 status = "okay"; 43 compatible = "gpio-leds";
44
45 green {
46 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
47 default-state = "off";
33 }; 48 };
34 49
35 uart2: serial@20064000 { 50 yellow {
36 pinctrl-names = "default"; 51 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
37 pinctrl-0 = <&uart2_xfer>; 52 default-state = "off";
38 status = "okay";
39 }; 53 };
40 54
41 uart3: serial@20068000 { 55 sleep {
42 status = "okay"; 56 gpios = <&gpio0 15 0>;
57 default-state = "off";
43 }; 58 };
59 };
44 60
45 gpio-keys { 61 ir_recv: gpio-ir-receiver {
46 compatible = "gpio-keys"; 62 compatible = "gpio-ir-receiver";
47 #address-cells = <1>; 63 gpios = <&gpio0 10 1>;
48 #size-cells = <0>; 64 pinctrl-names = "default";
49 autorepeat; 65 pinctrl-0 = <&ir_recv_pin>;
50 66 };
51 button@0 { 67
52 gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; 68 vcc_sd0: sdmmc-regulator {
53 linux,code = <116>; 69 compatible = "regulator-fixed";
54 label = "GPIO Key Power"; 70 regulator-name = "sdmmc-supply";
55 linux,input-type = <1>; 71 regulator-min-microvolt = <3300000>;
56 gpio-key,wakeup = <1>; 72 regulator-max-microvolt = <3300000>;
57 debounce-interval = <100>; 73 gpio = <&gpio3 1 GPIO_ACTIVE_LOW>;
74 startup-delay-us = <100000>;
75 vin-supply = <&vcc_io>;
76 };
77};
78
79&i2c1 {
80 status = "okay";
81 clock-frequency = <400000>;
82
83 act8846: act8846@5a {
84 compatible = "active-semi,act8846";
85 reg = <0x5a>;
86 status = "okay";
87
88 pinctrl-names = "default";
89 pinctrl-0 = <&act8846_dvs0_ctl>;
90
91 regulators {
92 vcc_ddr: REG1 {
93 regulator-name = "VCC_DDR";
94 regulator-min-microvolt = <1200000>;
95 regulator-max-microvolt = <1200000>;
96 regulator-always-on;
97 };
98
99 vdd_log: REG2 {
100 regulator-name = "VDD_LOG";
101 regulator-min-microvolt = <1000000>;
102 regulator-max-microvolt = <1000000>;
103 regulator-always-on;
104 };
105
106 vdd_arm: REG3 {
107 regulator-name = "VDD_ARM";
108 regulator-min-microvolt = <875000>;
109 regulator-max-microvolt = <1300000>;
110 regulator-always-on;
111 };
112
113 vcc_io: REG4 {
114 regulator-name = "VCC_IO";
115 regulator-min-microvolt = <3300000>;
116 regulator-max-microvolt = <3300000>;
117 regulator-always-on;
118 };
119
120 vdd_10: REG5 {
121 regulator-name = "VDD_10";
122 regulator-min-microvolt = <1000000>;
123 regulator-max-microvolt = <1000000>;
124 regulator-always-on;
125 };
126
127 vdd_hdmi: REG6 {
128 regulator-name = "VDD_HDMI";
129 regulator-min-microvolt = <2500000>;
130 regulator-max-microvolt = <2500000>;
131 regulator-always-on;
132 };
133
134 vcc18: REG7 {
135 regulator-name = "VCC_18";
136 regulator-min-microvolt = <1800000>;
137 regulator-max-microvolt = <1800000>;
138 regulator-always-on;
58 }; 139 };
59 };
60 140
61 gpio-leds { 141 vcca_33: REG8 {
62 compatible = "gpio-leds"; 142 regulator-name = "VCCA_33";
143 regulator-min-microvolt = <3300000>;
144 regulator-max-microvolt = <3300000>;
145 regulator-always-on;
146 };
147
148 vcc_rmii: REG9 {
149 regulator-name = "VCC_RMII";
150 regulator-min-microvolt = <3300000>;
151 regulator-max-microvolt = <3300000>;
152 regulator-always-on;
153 };
63 154
64 green { 155 vccio_wl: REG10 {
65 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; 156 regulator-name = "VCCIO_WL";
66 default-state = "off"; 157 regulator-min-microvolt = <3300000>;
158 regulator-max-microvolt = <3300000>;
159 regulator-always-on;
67 }; 160 };
68 161
69 yellow { 162 vcc_18: REG11 {
70 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; 163 regulator-name = "VCC18_IO";
71 default-state = "off"; 164 regulator-min-microvolt = <1800000>;
165 regulator-max-microvolt = <1800000>;
166 regulator-always-on;
72 }; 167 };
73 168
74 sleep { 169 vcc28: REG12 {
75 gpios = <&gpio0 15 0>; 170 regulator-name = "VCC_28";
76 default-state = "off"; 171 regulator-min-microvolt = <2800000>;
172 regulator-max-microvolt = <2800000>;
173 regulator-always-on;
77 }; 174 };
78 }; 175 };
176 };
177};
178
179&mmc0 {
180 num-slots = <1>;
181 status = "okay";
182 vmmc-supply = <&vcc_sd0>;
79 183
184 slot@0 {
185 reg = <0>;
186 bus-width = <4>;
187 disable-wp;
80 }; 188 };
81}; 189};
190
191&pinctrl {
192 pcfg_output_low: pcfg-output-low {
193 output-low;
194 };
195
196 act8846 {
197 act8846_dvs0_ctl: act8846-dvs0-ctl {
198 rockchip,pins = <RK_GPIO3 27 RK_FUNC_GPIO &pcfg_output_low>;
199 };
200 };
201
202 ir-receiver {
203 ir_recv_pin: ir-recv-pin {
204 rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>;
205 };
206 };
207};
208
209&uart0 {
210 status = "okay";
211};
212
213&uart1 {
214 status = "okay";
215};
216
217&uart2 {
218 status = "okay";
219};
220
221&uart3 {
222 status = "okay";
223};
224
225&wdt {
226 status = "okay";
227};
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 238c996d4a7f..ee801a9c6b74 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -15,8 +15,8 @@
15 15
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/pinctrl/rockchip.h> 17#include <dt-bindings/pinctrl/rockchip.h>
18#include <dt-bindings/clock/rk3188-cru.h>
18#include "rk3xxx.dtsi" 19#include "rk3xxx.dtsi"
19#include "rk3188-clocks.dtsi"
20 20
21/ { 21/ {
22 compatible = "rockchip,rk3188"; 22 compatible = "rockchip,rk3188";
@@ -52,215 +52,355 @@
52 }; 52 };
53 }; 53 };
54 54
55 soc { 55 sram: sram@10080000 {
56 global-timer@1013c200 { 56 compatible = "mmio-sram";
57 interrupts = <GIC_PPI 11 0xf04>; 57 reg = <0x10080000 0x8000>;
58 #address-cells = <1>;
59 #size-cells = <1>;
60 ranges = <0 0x10080000 0x8000>;
61
62 smp-sram@0 {
63 compatible = "rockchip,rk3066-smp-sram";
64 reg = <0x0 0x50>;
58 }; 65 };
66 };
67
68 cru: clock-controller@20000000 {
69 compatible = "rockchip,rk3188-cru";
70 reg = <0x20000000 0x1000>;
71 rockchip,grf = <&grf>;
72
73 #clock-cells = <1>;
74 #reset-cells = <1>;
75 };
76
77 pinctrl: pinctrl {
78 compatible = "rockchip,rk3188-pinctrl";
79 rockchip,grf = <&grf>;
80 rockchip,pmu = <&pmu>;
81
82 #address-cells = <1>;
83 #size-cells = <1>;
84 ranges;
85
86 gpio0: gpio0@0x2000a000 {
87 compatible = "rockchip,rk3188-gpio-bank0";
88 reg = <0x2000a000 0x100>;
89 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
90 clocks = <&cru PCLK_GPIO0>;
91
92 gpio-controller;
93 #gpio-cells = <2>;
59 94
60 local-timer@1013c600 { 95 interrupt-controller;
61 interrupts = <GIC_PPI 13 0xf04>; 96 #interrupt-cells = <2>;
62 }; 97 };
63 98
64 sram: sram@10080000 { 99 gpio1: gpio1@0x2003c000 {
65 compatible = "mmio-sram"; 100 compatible = "rockchip,gpio-bank";
66 reg = <0x10080000 0x8000>; 101 reg = <0x2003c000 0x100>;
67 #address-cells = <1>; 102 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
68 #size-cells = <1>; 103 clocks = <&cru PCLK_GPIO1>;
69 ranges = <0 0x10080000 0x8000>;
70 104
71 smp-sram@0 { 105 gpio-controller;
72 compatible = "rockchip,rk3066-smp-sram"; 106 #gpio-cells = <2>;
73 reg = <0x0 0x50>; 107
74 }; 108 interrupt-controller;
109 #interrupt-cells = <2>;
75 }; 110 };
76 111
77 pinctrl@20008000 { 112 gpio2: gpio2@2003e000 {
78 compatible = "rockchip,rk3188-pinctrl"; 113 compatible = "rockchip,gpio-bank";
79 rockchip,grf = <&grf>; 114 reg = <0x2003e000 0x100>;
80 rockchip,pmu = <&pmu>; 115 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
116 clocks = <&cru PCLK_GPIO2>;
81 117
82 #address-cells = <1>; 118 gpio-controller;
83 #size-cells = <1>; 119 #gpio-cells = <2>;
84 ranges;
85 120
86 gpio0: gpio0@0x2000a000 { 121 interrupt-controller;
87 compatible = "rockchip,rk3188-gpio-bank0"; 122 #interrupt-cells = <2>;
88 reg = <0x2000a000 0x100>; 123 };
89 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
90 clocks = <&clk_gates8 9>;
91 124
92 gpio-controller; 125 gpio3: gpio3@20080000 {
93 #gpio-cells = <2>; 126 compatible = "rockchip,gpio-bank";
127 reg = <0x20080000 0x100>;
128 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
129 clocks = <&cru PCLK_GPIO3>;
94 130
95 interrupt-controller; 131 gpio-controller;
96 #interrupt-cells = <2>; 132 #gpio-cells = <2>;
97 };
98 133
99 gpio1: gpio1@0x2003c000 { 134 interrupt-controller;
100 compatible = "rockchip,gpio-bank"; 135 #interrupt-cells = <2>;
101 reg = <0x2003c000 0x100>; 136 };
102 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
103 clocks = <&clk_gates8 10>;
104 137
105 gpio-controller; 138 pcfg_pull_up: pcfg_pull_up {
106 #gpio-cells = <2>; 139 bias-pull-up;
140 };
107 141
108 interrupt-controller; 142 pcfg_pull_down: pcfg_pull_down {
109 #interrupt-cells = <2>; 143 bias-pull-down;
110 }; 144 };
111 145
112 gpio2: gpio2@2003e000 { 146 pcfg_pull_none: pcfg_pull_none {
113 compatible = "rockchip,gpio-bank"; 147 bias-disable;
114 reg = <0x2003e000 0x100>; 148 };
115 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; 149
116 clocks = <&clk_gates8 11>; 150 i2c0 {
151 i2c0_xfer: i2c0-xfer {
152 rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>,
153 <RK_GPIO1 25 RK_FUNC_1 &pcfg_pull_none>;
154 };
155 };
117 156
118 gpio-controller; 157 i2c1 {
119 #gpio-cells = <2>; 158 i2c1_xfer: i2c1-xfer {
159 rockchip,pins = <RK_GPIO1 26 RK_FUNC_1 &pcfg_pull_none>,
160 <RK_GPIO1 27 RK_FUNC_1 &pcfg_pull_none>;
161 };
162 };
120 163
121 interrupt-controller; 164 i2c2 {
122 #interrupt-cells = <2>; 165 i2c2_xfer: i2c2-xfer {
166 rockchip,pins = <RK_GPIO1 28 RK_FUNC_1 &pcfg_pull_none>,
167 <RK_GPIO1 29 RK_FUNC_1 &pcfg_pull_none>;
123 }; 168 };
169 };
124 170
125 gpio3: gpio3@20080000 { 171 i2c3 {
126 compatible = "rockchip,gpio-bank"; 172 i2c3_xfer: i2c3-xfer {
127 reg = <0x20080000 0x100>; 173 rockchip,pins = <RK_GPIO3 14 RK_FUNC_2 &pcfg_pull_none>,
128 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; 174 <RK_GPIO3 15 RK_FUNC_2 &pcfg_pull_none>;
129 clocks = <&clk_gates8 12>; 175 };
176 };
130 177
131 gpio-controller; 178 i2c4 {
132 #gpio-cells = <2>; 179 i2c4_xfer: i2c4-xfer {
180 rockchip,pins = <RK_GPIO1 30 RK_FUNC_1 &pcfg_pull_none>,
181 <RK_GPIO1 31 RK_FUNC_1 &pcfg_pull_none>;
182 };
183 };
133 184
134 interrupt-controller; 185 pwm0 {
135 #interrupt-cells = <2>; 186 pwm0_out: pwm0-out {
187 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_none>;
136 }; 188 };
189 };
137 190
138 pcfg_pull_up: pcfg_pull_up { 191 pwm1 {
139 bias-pull-up; 192 pwm1_out: pwm1-out {
193 rockchip,pins = <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_none>;
140 }; 194 };
195 };
141 196
142 pcfg_pull_down: pcfg_pull_down { 197 pwm2 {
143 bias-pull-down; 198 pwm2_out: pwm2-out {
199 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_none>;
144 }; 200 };
201 };
145 202
146 pcfg_pull_none: pcfg_pull_none { 203 pwm3 {
147 bias-disable; 204 pwm3_out: pwm3-out {
205 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_none>;
148 }; 206 };
207 };
149 208
150 uart0 { 209 uart0 {
151 uart0_xfer: uart0-xfer { 210 uart0_xfer: uart0-xfer {
152 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_up>, 211 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_up>,
153 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_none>; 212 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_none>;
154 }; 213 };
155 214
156 uart0_cts: uart0-cts { 215 uart0_cts: uart0-cts {
157 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_none>; 216 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_none>;
158 }; 217 };
159 218
160 uart0_rts: uart0-rts { 219 uart0_rts: uart0-rts {
161 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_none>; 220 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_none>;
162 };
163 }; 221 };
222 };
164 223
165 uart1 { 224 uart1 {
166 uart1_xfer: uart1-xfer { 225 uart1_xfer: uart1-xfer {
167 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_up>, 226 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_up>,
168 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_none>; 227 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_none>;
169 }; 228 };
170 229
171 uart1_cts: uart1-cts { 230 uart1_cts: uart1-cts {
172 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_none>; 231 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_none>;
173 }; 232 };
174 233
175 uart1_rts: uart1-rts { 234 uart1_rts: uart1-rts {
176 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_none>; 235 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_none>;
177 };
178 }; 236 };
237 };
179 238
180 uart2 { 239 uart2 {
181 uart2_xfer: uart2-xfer { 240 uart2_xfer: uart2-xfer {
182 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_up>, 241 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_up>,
183 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_none>; 242 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_none>;
184 };
185 /* no rts / cts for uart2 */
186 }; 243 };
244 /* no rts / cts for uart2 */
245 };
187 246
188 uart3 { 247 uart3 {
189 uart3_xfer: uart3-xfer { 248 uart3_xfer: uart3-xfer {
190 rockchip,pins = <RK_GPIO1 10 RK_FUNC_1 &pcfg_pull_up>, 249 rockchip,pins = <RK_GPIO1 10 RK_FUNC_1 &pcfg_pull_up>,
191 <RK_GPIO1 11 RK_FUNC_1 &pcfg_pull_none>; 250 <RK_GPIO1 11 RK_FUNC_1 &pcfg_pull_none>;
192 }; 251 };
193 252
194 uart3_cts: uart3-cts { 253 uart3_cts: uart3-cts {
195 rockchip,pins = <RK_GPIO1 12 RK_FUNC_1 &pcfg_pull_none>; 254 rockchip,pins = <RK_GPIO1 12 RK_FUNC_1 &pcfg_pull_none>;
196 }; 255 };
197 256
198 uart3_rts: uart3-rts { 257 uart3_rts: uart3-rts {
199 rockchip,pins = <RK_GPIO1 13 RK_FUNC_1 &pcfg_pull_none>; 258 rockchip,pins = <RK_GPIO1 13 RK_FUNC_1 &pcfg_pull_none>;
200 };
201 }; 259 };
260 };
202 261
203 sd0 { 262 sd0 {
204 sd0_clk: sd0-clk { 263 sd0_clk: sd0-clk {
205 rockchip,pins = <RK_GPIO3 2 RK_FUNC_1 &pcfg_pull_none>; 264 rockchip,pins = <RK_GPIO3 2 RK_FUNC_1 &pcfg_pull_none>;
206 }; 265 };
207 266
208 sd0_cmd: sd0-cmd { 267 sd0_cmd: sd0-cmd {
209 rockchip,pins = <RK_GPIO3 3 RK_FUNC_1 &pcfg_pull_none>; 268 rockchip,pins = <RK_GPIO3 3 RK_FUNC_1 &pcfg_pull_none>;
210 }; 269 };
211 270
212 sd0_cd: sd0-cd { 271 sd0_cd: sd0-cd {
213 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_none>; 272 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_none>;
214 }; 273 };
215 274
216 sd0_wp: sd0-wp { 275 sd0_wp: sd0-wp {
217 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_none>; 276 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_none>;
218 }; 277 };
219 278
220 sd0_pwr: sd0-pwr { 279 sd0_pwr: sd0-pwr {
221 rockchip,pins = <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>; 280 rockchip,pins = <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>;
222 }; 281 };
223 282
224 sd0_bus1: sd0-bus-width1 { 283 sd0_bus1: sd0-bus-width1 {
225 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>; 284 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>;
226 }; 285 };
227 286
228 sd0_bus4: sd0-bus-width4 { 287 sd0_bus4: sd0-bus-width4 {
229 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>, 288 rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>,
230 <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>, 289 <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>,
231 <RK_GPIO3 6 RK_FUNC_1 &pcfg_pull_none>, 290 <RK_GPIO3 6 RK_FUNC_1 &pcfg_pull_none>,
232 <RK_GPIO3 7 RK_FUNC_1 &pcfg_pull_none>; 291 <RK_GPIO3 7 RK_FUNC_1 &pcfg_pull_none>;
233 };
234 }; 292 };
293 };
235 294
236 sd1 { 295 sd1 {
237 sd1_clk: sd1-clk { 296 sd1_clk: sd1-clk {
238 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_none>; 297 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_none>;
239 }; 298 };
240 299
241 sd1_cmd: sd1-cmd { 300 sd1_cmd: sd1-cmd {
242 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_none>; 301 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_none>;
243 }; 302 };
244 303
245 sd1_cd: sd1-cd { 304 sd1_cd: sd1-cd {
246 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_none>; 305 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_none>;
247 }; 306 };
248 307
249 sd1_wp: sd1-wp { 308 sd1_wp: sd1-wp {
250 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_none>; 309 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_none>;
251 }; 310 };
252 311
253 sd1_bus1: sd1-bus-width1 { 312 sd1_bus1: sd1-bus-width1 {
254 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>; 313 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>;
255 }; 314 };
256 315
257 sd1_bus4: sd1-bus-width4 { 316 sd1_bus4: sd1-bus-width4 {
258 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>, 317 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>,
259 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_none>, 318 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_none>,
260 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_none>, 319 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_none>,
261 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>; 320 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>;
262 };
263 }; 321 };
264 }; 322 };
265 }; 323 };
266}; 324};
325
326&global_timer {
327 interrupts = <GIC_PPI 11 0xf04>;
328};
329
330&local_timer {
331 interrupts = <GIC_PPI 13 0xf04>;
332};
333
334&i2c0 {
335 compatible = "rockchip,rk3188-i2c";
336 pinctrl-names = "default";
337 pinctrl-0 = <&i2c0_xfer>;
338};
339
340&i2c1 {
341 compatible = "rockchip,rk3188-i2c";
342 pinctrl-names = "default";
343 pinctrl-0 = <&i2c1_xfer>;
344};
345
346&i2c2 {
347 compatible = "rockchip,rk3188-i2c";
348 pinctrl-names = "default";
349 pinctrl-0 = <&i2c2_xfer>;
350};
351
352&i2c3 {
353 compatible = "rockchip,rk3188-i2c";
354 pinctrl-names = "default";
355 pinctrl-0 = <&i2c3_xfer>;
356};
357
358&i2c4 {
359 compatible = "rockchip,rk3188-i2c";
360 pinctrl-names = "default";
361 pinctrl-0 = <&i2c4_xfer>;
362};
363
364&pwm0 {
365 pinctrl-names = "default";
366 pinctrl-0 = <&pwm0_out>;
367};
368
369&pwm1 {
370 pinctrl-names = "default";
371 pinctrl-0 = <&pwm1_out>;
372};
373
374&pwm2 {
375 pinctrl-names = "default";
376 pinctrl-0 = <&pwm2_out>;
377};
378
379&pwm3 {
380 pinctrl-names = "default";
381 pinctrl-0 = <&pwm3_out>;
382};
383
384&uart0 {
385 pinctrl-names = "default";
386 pinctrl-0 = <&uart0_xfer>;
387};
388
389&uart1 {
390 pinctrl-names = "default";
391 pinctrl-0 = <&uart1_xfer>;
392};
393
394&uart2 {
395 pinctrl-names = "default";
396 pinctrl-0 = <&uart2_xfer>;
397};
398
399&uart3 {
400 pinctrl-names = "default";
401 pinctrl-0 = <&uart3_xfer>;
402};
403
404&wdt {
405 compatible = "rockchip,rk3188-wdt", "snps,dw-wdt";
406};
diff --git a/arch/arm/boot/dts/rk3288-evb-act8846.dts b/arch/arm/boot/dts/rk3288-evb-act8846.dts
new file mode 100644
index 000000000000..7d59ff4de408
--- /dev/null
+++ b/arch/arm/boot/dts/rk3288-evb-act8846.dts
@@ -0,0 +1,134 @@
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
13/dts-v1/;
14#include "rk3288-evb.dtsi"
15
16/ {
17 compatible = "rockchip,rk3288-evb-act8846", "rockchip,rk3288";
18};
19
20&i2c0 {
21 hym8563@51 {
22 compatible = "haoyu,hym8563";
23 reg = <0x51>;
24
25 interrupt-parent = <&gpio0>;
26 interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
27
28 pinctrl-names = "default";
29 pinctrl-0 = <&hym8563_int>;
30
31 #clock-cells = <0>;
32 clock-output-names = "xin32k";
33 };
34
35 act8846: act8846@5a {
36 compatible = "active-semi,act8846";
37 reg = <0x5a>;
38 status = "okay";
39
40 regulators {
41 vcc_ddr: REG1 {
42 regulator-name = "VCC_DDR";
43 regulator-min-microvolt = <1200000>;
44 regulator-max-microvolt = <1200000>;
45 regulator-always-on;
46 };
47
48 vcc_io: REG2 {
49 regulator-name = "VCC_IO";
50 regulator-min-microvolt = <3300000>;
51 regulator-max-microvolt = <3300000>;
52 regulator-always-on;
53 };
54
55 vdd_log: REG3 {
56 regulator-name = "VDD_LOG";
57 regulator-min-microvolt = <1000000>;
58 regulator-max-microvolt = <1000000>;
59 regulator-always-on;
60 };
61
62 vcc_20: REG4 {
63 regulator-name = "VCC_20";
64 regulator-min-microvolt = <2000000>;
65 regulator-max-microvolt = <2000000>;
66 regulator-always-on;
67 };
68
69 vccio_sd: REG5 {
70 regulator-name = "VCCIO_SD";
71 regulator-min-microvolt = <3300000>;
72 regulator-max-microvolt = <3300000>;
73 regulator-always-on;
74 };
75
76 vdd10_lcd: REG6 {
77 regulator-name = "VDD10_LCD";
78 regulator-min-microvolt = <1000000>;
79 regulator-max-microvolt = <1000000>;
80 regulator-always-on;
81 };
82
83 vcca_codec: REG7 {
84 regulator-name = "VCCA_CODEC";
85 regulator-min-microvolt = <3300000>;
86 regulator-max-microvolt = <3300000>;
87 regulator-always-on;
88 };
89
90 vcca_tp: REG8 {
91 regulator-name = "VCCA_TP";
92 regulator-min-microvolt = <3300000>;
93 regulator-max-microvolt = <3300000>;
94 regulator-always-on;
95 };
96
97 vccio_pmu: REG9 {
98 regulator-name = "VCCIO_PMU";
99 regulator-min-microvolt = <3300000>;
100 regulator-max-microvolt = <3300000>;
101 regulator-always-on;
102 };
103
104 vdd_10: REG10 {
105 regulator-name = "VDD_10";
106 regulator-min-microvolt = <1000000>;
107 regulator-max-microvolt = <1000000>;
108 regulator-always-on;
109 };
110
111 vcc_18: REG11 {
112 regulator-name = "VCC_18";
113 regulator-min-microvolt = <1800000>;
114 regulator-max-microvolt = <1800000>;
115 regulator-always-on;
116 };
117
118 vcc18_lcd: REG12 {
119 regulator-name = "VCC18_LCD";
120 regulator-min-microvolt = <1800000>;
121 regulator-max-microvolt = <1800000>;
122 regulator-always-on;
123 };
124 };
125 };
126};
127
128&pinctrl {
129 hym8563 {
130 hym8563_int: hym8563-int {
131 rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
132 };
133 };
134};
diff --git a/arch/arm/mach-s5p64x0/include/mach/dma.h b/arch/arm/boot/dts/rk3288-evb-rk808.dts
index 5a622af461d7..9a88b6c66396 100644
--- a/arch/arm/mach-s5p64x0/include/mach/dma.h
+++ b/arch/arm/boot/dts/rk3288-evb-rk808.dts
@@ -1,7 +1,4 @@
1/* 1/*
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
3 * Jaswinder Singh <jassi.brar@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify 2 * 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 3 * 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 4 * the Free Software Foundation; either version 2 of the License, or
@@ -11,16 +8,11 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 10 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 11 */
19 12
20#ifndef __MACH_DMA_H 13/dts-v1/;
21#define __MACH_DMA_H 14#include "rk3288-evb.dtsi"
22
23/* This platform uses the common common DMA API driver for PL330 */
24#include <plat/dma-pl330.h>
25 15
26#endif /* __MACH_DMA_H */ 16/ {
17 compatible = "rockchip,rk3288-evb-rk808", "rockchip,rk3288";
18};
diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi
new file mode 100644
index 000000000000..4f572093c8b4
--- /dev/null
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -0,0 +1,96 @@
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
13#include "rk3288.dtsi"
14
15/ {
16 memory {
17 reg = <0x0 0x80000000>;
18 };
19
20 gpio-keys {
21 compatible = "gpio-keys";
22 #address-cells = <1>;
23 #size-cells = <0>;
24 autorepeat;
25
26 pinctrl-names = "default";
27 pinctrl-0 = <&pwrbtn>;
28
29 button@0 {
30 gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
31 linux,code = <116>;
32 label = "GPIO Key Power";
33 linux,input-type = <1>;
34 gpio-key,wakeup = <1>;
35 debounce-interval = <100>;
36 };
37 };
38
39 /* This turns on USB vbus for both host0 (ehci) and host1 (dwc2) */
40 vcc_host: vcc-host-regulator {
41 compatible = "regulator-fixed";
42 enable-active-high;
43 gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
44 pinctrl-names = "default";
45 pinctrl-0 = <&host_vbus_drv>;
46 regulator-name = "vcc_host";
47 regulator-always-on;
48 regulator-boot-on;
49 };
50};
51
52&i2c0 {
53 status = "okay";
54};
55
56&wdt {
57 status = "okay";
58};
59
60&uart0 {
61 status = "okay";
62};
63
64&uart1 {
65 status = "okay";
66};
67
68&uart2 {
69 status = "okay";
70};
71
72&uart3 {
73 status = "okay";
74};
75
76&uart4 {
77 status = "okay";
78};
79
80&pinctrl {
81 buttons {
82 pwrbtn: pwrbtn {
83 rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
84 };
85 };
86
87 usb {
88 host_vbus_drv: host-vbus-drv {
89 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
90 };
91 };
92};
93
94&usb_host0_ehci {
95 status = "okay";
96};
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
new file mode 100644
index 000000000000..5950b0a53224
--- /dev/null
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -0,0 +1,595 @@
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
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/interrupt-controller/arm-gic.h>
16#include <dt-bindings/pinctrl/rockchip.h>
17#include <dt-bindings/clock/rk3288-cru.h>
18#include "skeleton.dtsi"
19
20/ {
21 compatible = "rockchip,rk3288";
22
23 interrupt-parent = <&gic>;
24
25 aliases {
26 i2c0 = &i2c0;
27 i2c1 = &i2c1;
28 i2c2 = &i2c2;
29 i2c3 = &i2c3;
30 i2c4 = &i2c4;
31 i2c5 = &i2c5;
32 serial0 = &uart0;
33 serial1 = &uart1;
34 serial2 = &uart2;
35 serial3 = &uart3;
36 serial4 = &uart4;
37 };
38
39 cpus {
40 #address-cells = <1>;
41 #size-cells = <0>;
42
43 cpu@500 {
44 device_type = "cpu";
45 compatible = "arm,cortex-a12";
46 reg = <0x500>;
47 };
48 cpu@501 {
49 device_type = "cpu";
50 compatible = "arm,cortex-a12";
51 reg = <0x501>;
52 };
53 cpu@502 {
54 device_type = "cpu";
55 compatible = "arm,cortex-a12";
56 reg = <0x502>;
57 };
58 cpu@503 {
59 device_type = "cpu";
60 compatible = "arm,cortex-a12";
61 reg = <0x503>;
62 };
63 };
64
65 xin24m: oscillator {
66 compatible = "fixed-clock";
67 clock-frequency = <24000000>;
68 clock-output-names = "xin24m";
69 #clock-cells = <0>;
70 };
71
72 timer {
73 compatible = "arm,armv7-timer";
74 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
75 <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
76 <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
77 <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
78 clock-frequency = <24000000>;
79 };
80
81 i2c1: i2c@ff140000 {
82 compatible = "rockchip,rk3288-i2c";
83 reg = <0xff140000 0x1000>;
84 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
85 #address-cells = <1>;
86 #size-cells = <0>;
87 clock-names = "i2c";
88 clocks = <&cru PCLK_I2C1>;
89 pinctrl-names = "default";
90 pinctrl-0 = <&i2c1_xfer>;
91 status = "disabled";
92 };
93
94 i2c3: i2c@ff150000 {
95 compatible = "rockchip,rk3288-i2c";
96 reg = <0xff150000 0x1000>;
97 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
98 #address-cells = <1>;
99 #size-cells = <0>;
100 clock-names = "i2c";
101 clocks = <&cru PCLK_I2C3>;
102 pinctrl-names = "default";
103 pinctrl-0 = <&i2c3_xfer>;
104 status = "disabled";
105 };
106
107 i2c4: i2c@ff160000 {
108 compatible = "rockchip,rk3288-i2c";
109 reg = <0xff160000 0x1000>;
110 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
111 #address-cells = <1>;
112 #size-cells = <0>;
113 clock-names = "i2c";
114 clocks = <&cru PCLK_I2C4>;
115 pinctrl-names = "default";
116 pinctrl-0 = <&i2c4_xfer>;
117 status = "disabled";
118 };
119
120 i2c5: i2c@ff170000 {
121 compatible = "rockchip,rk3288-i2c";
122 reg = <0xff170000 0x1000>;
123 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
124 #address-cells = <1>;
125 #size-cells = <0>;
126 clock-names = "i2c";
127 clocks = <&cru PCLK_I2C5>;
128 pinctrl-names = "default";
129 pinctrl-0 = <&i2c5_xfer>;
130 status = "disabled";
131 };
132
133 uart0: serial@ff180000 {
134 compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
135 reg = <0xff180000 0x100>;
136 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
137 reg-shift = <2>;
138 reg-io-width = <4>;
139 clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
140 clock-names = "baudclk", "apb_pclk";
141 pinctrl-names = "default";
142 pinctrl-0 = <&uart0_xfer>;
143 status = "disabled";
144 };
145
146 uart1: serial@ff190000 {
147 compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
148 reg = <0xff190000 0x100>;
149 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
150 reg-shift = <2>;
151 reg-io-width = <4>;
152 clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
153 clock-names = "baudclk", "apb_pclk";
154 pinctrl-names = "default";
155 pinctrl-0 = <&uart1_xfer>;
156 status = "disabled";
157 };
158
159 uart2: serial@ff690000 {
160 compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
161 reg = <0xff690000 0x100>;
162 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
163 reg-shift = <2>;
164 reg-io-width = <4>;
165 clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
166 clock-names = "baudclk", "apb_pclk";
167 pinctrl-names = "default";
168 pinctrl-0 = <&uart2_xfer>;
169 status = "disabled";
170 };
171
172 uart3: serial@ff1b0000 {
173 compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
174 reg = <0xff1b0000 0x100>;
175 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
176 reg-shift = <2>;
177 reg-io-width = <4>;
178 clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
179 clock-names = "baudclk", "apb_pclk";
180 pinctrl-names = "default";
181 pinctrl-0 = <&uart3_xfer>;
182 status = "disabled";
183 };
184
185 uart4: serial@ff1c0000 {
186 compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
187 reg = <0xff1c0000 0x100>;
188 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
189 reg-shift = <2>;
190 reg-io-width = <4>;
191 clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>;
192 clock-names = "baudclk", "apb_pclk";
193 pinctrl-names = "default";
194 pinctrl-0 = <&uart4_xfer>;
195 status = "disabled";
196 };
197
198 usb_host0_ehci: usb@ff500000 {
199 compatible = "generic-ehci";
200 reg = <0xff500000 0x100>;
201 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
202 clocks = <&cru HCLK_USBHOST0>;
203 clock-names = "usbhost";
204 status = "disabled";
205 };
206
207 /* NOTE: ohci@ff520000 doesn't actually work on hardware */
208
209 usb_hsic: usb@ff5c0000 {
210 compatible = "generic-ehci";
211 reg = <0xff5c0000 0x100>;
212 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
213 clocks = <&cru HCLK_HSIC>;
214 clock-names = "usbhost";
215 status = "disabled";
216 };
217
218 i2c0: i2c@ff650000 {
219 compatible = "rockchip,rk3288-i2c";
220 reg = <0xff650000 0x1000>;
221 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
222 #address-cells = <1>;
223 #size-cells = <0>;
224 clock-names = "i2c";
225 clocks = <&cru PCLK_I2C0>;
226 pinctrl-names = "default";
227 pinctrl-0 = <&i2c0_xfer>;
228 status = "disabled";
229 };
230
231 i2c2: i2c@ff660000 {
232 compatible = "rockchip,rk3288-i2c";
233 reg = <0xff660000 0x1000>;
234 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
235 #address-cells = <1>;
236 #size-cells = <0>;
237 clock-names = "i2c";
238 clocks = <&cru PCLK_I2C2>;
239 pinctrl-names = "default";
240 pinctrl-0 = <&i2c2_xfer>;
241 status = "disabled";
242 };
243
244 pmu: power-management@ff730000 {
245 compatible = "rockchip,rk3288-pmu", "syscon";
246 reg = <0xff730000 0x100>;
247 };
248
249 sgrf: syscon@ff740000 {
250 compatible = "rockchip,rk3288-sgrf", "syscon";
251 reg = <0xff740000 0x1000>;
252 };
253
254 cru: clock-controller@ff760000 {
255 compatible = "rockchip,rk3288-cru";
256 reg = <0xff760000 0x1000>;
257 rockchip,grf = <&grf>;
258 #clock-cells = <1>;
259 #reset-cells = <1>;
260 };
261
262 grf: syscon@ff770000 {
263 compatible = "rockchip,rk3288-grf", "syscon";
264 reg = <0xff770000 0x1000>;
265 };
266
267 wdt: watchdog@ff800000 {
268 compatible = "rockchip,rk3288-wdt", "snps,dw-wdt";
269 reg = <0xff800000 0x100>;
270 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
271 status = "disabled";
272 };
273
274 gic: interrupt-controller@ffc01000 {
275 compatible = "arm,gic-400";
276 interrupt-controller;
277 #interrupt-cells = <3>;
278 #address-cells = <0>;
279
280 reg = <0xffc01000 0x1000>,
281 <0xffc02000 0x1000>,
282 <0xffc04000 0x2000>,
283 <0xffc06000 0x2000>;
284 interrupts = <GIC_PPI 9 0xf04>;
285 };
286
287 pinctrl: pinctrl {
288 compatible = "rockchip,rk3288-pinctrl";
289 rockchip,grf = <&grf>;
290 rockchip,pmu = <&pmu>;
291 #address-cells = <1>;
292 #size-cells = <1>;
293 ranges;
294
295 gpio0: gpio0@ff750000 {
296 compatible = "rockchip,gpio-bank";
297 reg = <0xff750000 0x100>;
298 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
299 clocks = <&cru PCLK_GPIO0>;
300
301 gpio-controller;
302 #gpio-cells = <2>;
303
304 interrupt-controller;
305 #interrupt-cells = <2>;
306 };
307
308 gpio1: gpio1@ff780000 {
309 compatible = "rockchip,gpio-bank";
310 reg = <0xff780000 0x100>;
311 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
312 clocks = <&cru PCLK_GPIO1>;
313
314 gpio-controller;
315 #gpio-cells = <2>;
316
317 interrupt-controller;
318 #interrupt-cells = <2>;
319 };
320
321 gpio2: gpio2@ff790000 {
322 compatible = "rockchip,gpio-bank";
323 reg = <0xff790000 0x100>;
324 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
325 clocks = <&cru PCLK_GPIO2>;
326
327 gpio-controller;
328 #gpio-cells = <2>;
329
330 interrupt-controller;
331 #interrupt-cells = <2>;
332 };
333
334 gpio3: gpio3@ff7a0000 {
335 compatible = "rockchip,gpio-bank";
336 reg = <0xff7a0000 0x100>;
337 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
338 clocks = <&cru PCLK_GPIO3>;
339
340 gpio-controller;
341 #gpio-cells = <2>;
342
343 interrupt-controller;
344 #interrupt-cells = <2>;
345 };
346
347 gpio4: gpio4@ff7b0000 {
348 compatible = "rockchip,gpio-bank";
349 reg = <0xff7b0000 0x100>;
350 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
351 clocks = <&cru PCLK_GPIO4>;
352
353 gpio-controller;
354 #gpio-cells = <2>;
355
356 interrupt-controller;
357 #interrupt-cells = <2>;
358 };
359
360 gpio5: gpio5@ff7c0000 {
361 compatible = "rockchip,gpio-bank";
362 reg = <0xff7c0000 0x100>;
363 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
364 clocks = <&cru PCLK_GPIO5>;
365
366 gpio-controller;
367 #gpio-cells = <2>;
368
369 interrupt-controller;
370 #interrupt-cells = <2>;
371 };
372
373 gpio6: gpio6@ff7d0000 {
374 compatible = "rockchip,gpio-bank";
375 reg = <0xff7d0000 0x100>;
376 interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
377 clocks = <&cru PCLK_GPIO6>;
378
379 gpio-controller;
380 #gpio-cells = <2>;
381
382 interrupt-controller;
383 #interrupt-cells = <2>;
384 };
385
386 gpio7: gpio7@ff7e0000 {
387 compatible = "rockchip,gpio-bank";
388 reg = <0xff7e0000 0x100>;
389 interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
390 clocks = <&cru PCLK_GPIO7>;
391
392 gpio-controller;
393 #gpio-cells = <2>;
394
395 interrupt-controller;
396 #interrupt-cells = <2>;
397 };
398
399 gpio8: gpio8@ff7f0000 {
400 compatible = "rockchip,gpio-bank";
401 reg = <0xff7f0000 0x100>;
402 interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
403 clocks = <&cru PCLK_GPIO8>;
404
405 gpio-controller;
406 #gpio-cells = <2>;
407
408 interrupt-controller;
409 #interrupt-cells = <2>;
410 };
411
412 pcfg_pull_up: pcfg-pull-up {
413 bias-pull-up;
414 };
415
416 pcfg_pull_down: pcfg-pull-down {
417 bias-pull-down;
418 };
419
420 pcfg_pull_none: pcfg-pull-none {
421 bias-disable;
422 };
423
424 i2c0 {
425 i2c0_xfer: i2c0-xfer {
426 rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>,
427 <0 16 RK_FUNC_1 &pcfg_pull_none>;
428 };
429 };
430
431 i2c1 {
432 i2c1_xfer: i2c1-xfer {
433 rockchip,pins = <8 4 RK_FUNC_1 &pcfg_pull_none>,
434 <8 5 RK_FUNC_1 &pcfg_pull_none>;
435 };
436 };
437
438 i2c2 {
439 i2c2_xfer: i2c2-xfer {
440 rockchip,pins = <6 9 RK_FUNC_1 &pcfg_pull_none>,
441 <6 10 RK_FUNC_1 &pcfg_pull_none>;
442 };
443 };
444
445 i2c3 {
446 i2c3_xfer: i2c3-xfer {
447 rockchip,pins = <2 16 RK_FUNC_1 &pcfg_pull_none>,
448 <2 17 RK_FUNC_1 &pcfg_pull_none>;
449 };
450 };
451
452 i2c4 {
453 i2c4_xfer: i2c4-xfer {
454 rockchip,pins = <7 17 RK_FUNC_1 &pcfg_pull_none>,
455 <7 18 RK_FUNC_1 &pcfg_pull_none>;
456 };
457 };
458
459 i2c5 {
460 i2c5_xfer: i2c5-xfer {
461 rockchip,pins = <7 19 RK_FUNC_1 &pcfg_pull_none>,
462 <7 20 RK_FUNC_1 &pcfg_pull_none>;
463 };
464 };
465
466 sdmmc {
467 sdmmc_clk: sdmmc-clk {
468 rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none>;
469 };
470
471 sdmmc_cmd: sdmmc-cmd {
472 rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up>;
473 };
474
475 sdmmc_cd: sdmcc-cd {
476 rockchip,pins = <6 22 RK_FUNC_1 &pcfg_pull_up>;
477 };
478
479 sdmmc_bus1: sdmmc-bus1 {
480 rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up>;
481 };
482
483 sdmmc_bus4: sdmmc-bus4 {
484 rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up>,
485 <6 17 RK_FUNC_1 &pcfg_pull_up>,
486 <6 18 RK_FUNC_1 &pcfg_pull_up>,
487 <6 19 RK_FUNC_1 &pcfg_pull_up>;
488 };
489 };
490
491 emmc {
492 emmc_clk: emmc-clk {
493 rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none>;
494 };
495
496 emmc_cmd: emmc-cmd {
497 rockchip,pins = <3 16 RK_FUNC_2 &pcfg_pull_up>;
498 };
499
500 emmc_pwr: emmc-pwr {
501 rockchip,pins = <3 9 RK_FUNC_2 &pcfg_pull_up>;
502 };
503
504 emmc_bus1: emmc-bus1 {
505 rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>;
506 };
507
508 emmc_bus4: emmc-bus4 {
509 rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>,
510 <3 1 RK_FUNC_2 &pcfg_pull_up>,
511 <3 2 RK_FUNC_2 &pcfg_pull_up>,
512 <3 3 RK_FUNC_2 &pcfg_pull_up>;
513 };
514
515 emmc_bus8: emmc-bus8 {
516 rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>,
517 <3 1 RK_FUNC_2 &pcfg_pull_up>,
518 <3 2 RK_FUNC_2 &pcfg_pull_up>,
519 <3 3 RK_FUNC_2 &pcfg_pull_up>,
520 <3 4 RK_FUNC_2 &pcfg_pull_up>,
521 <3 5 RK_FUNC_2 &pcfg_pull_up>,
522 <3 6 RK_FUNC_2 &pcfg_pull_up>,
523 <3 7 RK_FUNC_2 &pcfg_pull_up>;
524 };
525 };
526
527 uart0 {
528 uart0_xfer: uart0-xfer {
529 rockchip,pins = <4 16 RK_FUNC_1 &pcfg_pull_up>,
530 <4 17 RK_FUNC_1 &pcfg_pull_none>;
531 };
532
533 uart0_cts: uart0-cts {
534 rockchip,pins = <4 18 RK_FUNC_1 &pcfg_pull_none>;
535 };
536
537 uart0_rts: uart0-rts {
538 rockchip,pins = <4 19 RK_FUNC_1 &pcfg_pull_none>;
539 };
540 };
541
542 uart1 {
543 uart1_xfer: uart1-xfer {
544 rockchip,pins = <5 8 RK_FUNC_1 &pcfg_pull_up>,
545 <5 9 RK_FUNC_1 &pcfg_pull_none>;
546 };
547
548 uart1_cts: uart1-cts {
549 rockchip,pins = <5 10 RK_FUNC_1 &pcfg_pull_none>;
550 };
551
552 uart1_rts: uart1-rts {
553 rockchip,pins = <5 11 RK_FUNC_1 &pcfg_pull_none>;
554 };
555 };
556
557 uart2 {
558 uart2_xfer: uart2-xfer {
559 rockchip,pins = <7 22 RK_FUNC_1 &pcfg_pull_up>,
560 <7 23 RK_FUNC_1 &pcfg_pull_none>;
561 };
562 /* no rts / cts for uart2 */
563 };
564
565 uart3 {
566 uart3_xfer: uart3-xfer {
567 rockchip,pins = <7 7 RK_FUNC_1 &pcfg_pull_up>,
568 <7 8 RK_FUNC_1 &pcfg_pull_none>;
569 };
570
571 uart3_cts: uart3-cts {
572 rockchip,pins = <7 9 RK_FUNC_1 &pcfg_pull_none>;
573 };
574
575 uart3_rts: uart3-rts {
576 rockchip,pins = <7 10 RK_FUNC_1 &pcfg_pull_none>;
577 };
578 };
579
580 uart4 {
581 uart4_xfer: uart4-xfer {
582 rockchip,pins = <5 12 3 &pcfg_pull_up>,
583 <5 13 3 &pcfg_pull_none>;
584 };
585
586 uart4_cts: uart4-cts {
587 rockchip,pins = <5 14 3 &pcfg_pull_none>;
588 };
589
590 uart4_rts: uart4-rts {
591 rockchip,pins = <5 15 3 &pcfg_pull_none>;
592 };
593 };
594 };
595};
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 2adf1cc9e85d..8caf85d83901 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -20,120 +20,248 @@
20/ { 20/ {
21 interrupt-parent = <&gic>; 21 interrupt-parent = <&gic>;
22 22
23 soc { 23 aliases {
24 i2c0 = &i2c0;
25 i2c1 = &i2c1;
26 i2c2 = &i2c2;
27 i2c3 = &i2c3;
28 i2c4 = &i2c4;
29 };
30
31 xin24m: oscillator {
32 compatible = "fixed-clock";
33 clock-frequency = <24000000>;
34 #clock-cells = <0>;
35 clock-output-names = "xin24m";
36 };
37
38 L2: l2-cache-controller@10138000 {
39 compatible = "arm,pl310-cache";
40 reg = <0x10138000 0x1000>;
41 cache-unified;
42 cache-level = <2>;
43 };
44
45 scu@1013c000 {
46 compatible = "arm,cortex-a9-scu";
47 reg = <0x1013c000 0x100>;
48 };
49
50 global_timer: global-timer@1013c200 {
51 compatible = "arm,cortex-a9-global-timer";
52 reg = <0x1013c200 0x20>;
53 interrupts = <GIC_PPI 11 0x304>;
54 clocks = <&cru CORE_PERI>;
55 };
56
57 local_timer: local-timer@1013c600 {
58 compatible = "arm,cortex-a9-twd-timer";
59 reg = <0x1013c600 0x20>;
60 interrupts = <GIC_PPI 13 0x304>;
61 clocks = <&cru CORE_PERI>;
62 };
63
64 gic: interrupt-controller@1013d000 {
65 compatible = "arm,cortex-a9-gic";
66 interrupt-controller;
67 #interrupt-cells = <3>;
68 reg = <0x1013d000 0x1000>,
69 <0x1013c100 0x0100>;
70 };
71
72 uart0: serial@10124000 {
73 compatible = "snps,dw-apb-uart";
74 reg = <0x10124000 0x400>;
75 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
76 reg-shift = <2>;
77 reg-io-width = <1>;
78 clock-names = "baudclk", "apb_pclk";
79 clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
80 status = "disabled";
81 };
82
83 uart1: serial@10126000 {
84 compatible = "snps,dw-apb-uart";
85 reg = <0x10126000 0x400>;
86 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
87 reg-shift = <2>;
88 reg-io-width = <1>;
89 clock-names = "baudclk", "apb_pclk";
90 clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
91 status = "disabled";
92 };
93
94 mmc0: dwmmc@10214000 {
95 compatible = "rockchip,rk2928-dw-mshc";
96 reg = <0x10214000 0x1000>;
97 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
24 #address-cells = <1>; 98 #address-cells = <1>;
25 #size-cells = <1>; 99 #size-cells = <0>;
26 compatible = "simple-bus"; 100
27 ranges; 101 clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
28 102 clock-names = "biu", "ciu";
29 scu@1013c000 { 103
30 compatible = "arm,cortex-a9-scu"; 104 status = "disabled";
31 reg = <0x1013c000 0x100>; 105 };
32 }; 106
33 107 mmc1: dwmmc@10218000 {
34 pmu: pmu@20004000 { 108 compatible = "rockchip,rk2928-dw-mshc";
35 compatible = "rockchip,rk3066-pmu", "syscon"; 109 reg = <0x10218000 0x1000>;
36 reg = <0x20004000 0x100>; 110 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
37 }; 111 #address-cells = <1>;
38 112 #size-cells = <0>;
39 grf: grf@20008000 { 113
40 compatible = "syscon"; 114 clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>;
41 reg = <0x20008000 0x200>; 115 clock-names = "biu", "ciu";
42 }; 116
43 117 status = "disabled";
44 gic: interrupt-controller@1013d000 { 118 };
45 compatible = "arm,cortex-a9-gic"; 119
46 interrupt-controller; 120 pmu: pmu@20004000 {
47 #interrupt-cells = <3>; 121 compatible = "rockchip,rk3066-pmu", "syscon";
48 reg = <0x1013d000 0x1000>, 122 reg = <0x20004000 0x100>;
49 <0x1013c100 0x0100>; 123 };
50 }; 124
51 125 grf: grf@20008000 {
52 L2: l2-cache-controller@10138000 { 126 compatible = "syscon";
53 compatible = "arm,pl310-cache"; 127 reg = <0x20008000 0x200>;
54 reg = <0x10138000 0x1000>; 128 };
55 cache-unified; 129
56 cache-level = <2>; 130 i2c0: i2c@2002d000 {
57 }; 131 compatible = "rockchip,rk3066-i2c";
58 132 reg = <0x2002d000 0x1000>;
59 global-timer@1013c200 { 133 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
60 compatible = "arm,cortex-a9-global-timer"; 134 #address-cells = <1>;
61 reg = <0x1013c200 0x20>; 135 #size-cells = <0>;
62 interrupts = <GIC_PPI 11 0x304>; 136
63 clocks = <&dummy150m>; 137 rockchip,grf = <&grf>;
64 }; 138 rockchip,bus-index = <0>;
65 139
66 local-timer@1013c600 { 140 clock-names = "i2c";
67 compatible = "arm,cortex-a9-twd-timer"; 141 clocks = <&cru PCLK_I2C0>;
68 reg = <0x1013c600 0x20>; 142
69 interrupts = <GIC_PPI 13 0x304>; 143 status = "disabled";
70 clocks = <&dummy150m>; 144 };
71 }; 145
72 146 i2c1: i2c@2002f000 {
73 uart0: serial@10124000 { 147 compatible = "rockchip,rk3066-i2c";
74 compatible = "snps,dw-apb-uart"; 148 reg = <0x2002f000 0x1000>;
75 reg = <0x10124000 0x400>; 149 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
76 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; 150 #address-cells = <1>;
77 reg-shift = <2>; 151 #size-cells = <0>;
78 reg-io-width = <1>; 152
79 clocks = <&clk_gates1 8>; 153 rockchip,grf = <&grf>;
80 status = "disabled"; 154
81 }; 155 clocks = <&cru PCLK_I2C1>;
82 156 clock-names = "i2c";
83 uart1: serial@10126000 { 157
84 compatible = "snps,dw-apb-uart"; 158 status = "disabled";
85 reg = <0x10126000 0x400>; 159 };
86 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; 160
87 reg-shift = <2>; 161 pwm0: pwm@20030000 {
88 reg-io-width = <1>; 162 compatible = "rockchip,rk2928-pwm";
89 clocks = <&clk_gates1 10>; 163 reg = <0x20030000 0x10>;
90 status = "disabled"; 164 #pwm-cells = <2>;
91 }; 165 clocks = <&cru PCLK_PWM01>;
92 166 status = "disabled";
93 uart2: serial@20064000 { 167 };
94 compatible = "snps,dw-apb-uart"; 168
95 reg = <0x20064000 0x400>; 169 pwm1: pwm@20030010 {
96 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 170 compatible = "rockchip,rk2928-pwm";
97 reg-shift = <2>; 171 reg = <0x20030010 0x10>;
98 reg-io-width = <1>; 172 #pwm-cells = <2>;
99 clocks = <&clk_gates1 12>; 173 clocks = <&cru PCLK_PWM01>;
100 status = "disabled"; 174 status = "disabled";
101 }; 175 };
102 176
103 uart3: serial@20068000 { 177 wdt: watchdog@2004c000 {
104 compatible = "snps,dw-apb-uart"; 178 compatible = "snps,dw-wdt";
105 reg = <0x20068000 0x400>; 179 reg = <0x2004c000 0x100>;
106 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 180 clocks = <&cru PCLK_WDT>;
107 reg-shift = <2>; 181 interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
108 reg-io-width = <1>; 182 status = "disabled";
109 clocks = <&clk_gates1 14>; 183 };
110 status = "disabled"; 184
111 }; 185 pwm2: pwm@20050020 {
112 186 compatible = "rockchip,rk2928-pwm";
113 dwmmc@10214000 { 187 reg = <0x20050020 0x10>;
114 compatible = "rockchip,rk2928-dw-mshc"; 188 #pwm-cells = <2>;
115 reg = <0x10214000 0x1000>; 189 clocks = <&cru PCLK_PWM23>;
116 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; 190 status = "disabled";
117 #address-cells = <1>; 191 };
118 #size-cells = <0>; 192
119 193 pwm3: pwm@20050030 {
120 clocks = <&clk_gates5 10>, <&clk_gates2 11>; 194 compatible = "rockchip,rk2928-pwm";
121 clock-names = "biu", "ciu"; 195 reg = <0x20050030 0x10>;
122 196 #pwm-cells = <2>;
123 status = "disabled"; 197 clocks = <&cru PCLK_PWM23>;
124 }; 198 status = "disabled";
125 199 };
126 dwmmc@10218000 { 200
127 compatible = "rockchip,rk2928-dw-mshc"; 201 i2c2: i2c@20056000 {
128 reg = <0x10218000 0x1000>; 202 compatible = "rockchip,rk3066-i2c";
129 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; 203 reg = <0x20056000 0x1000>;
130 #address-cells = <1>; 204 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
131 #size-cells = <0>; 205 #address-cells = <1>;
132 206 #size-cells = <0>;
133 clocks = <&clk_gates5 11>, <&clk_gates2 13>; 207
134 clock-names = "biu", "ciu"; 208 rockchip,grf = <&grf>;
135 209
136 status = "disabled"; 210 clocks = <&cru PCLK_I2C2>;
137 }; 211 clock-names = "i2c";
212
213 status = "disabled";
214 };
215
216 i2c3: i2c@2005a000 {
217 compatible = "rockchip,rk3066-i2c";
218 reg = <0x2005a000 0x1000>;
219 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
220 #address-cells = <1>;
221 #size-cells = <0>;
222
223 rockchip,grf = <&grf>;
224
225 clocks = <&cru PCLK_I2C3>;
226 clock-names = "i2c";
227
228 status = "disabled";
229 };
230
231 i2c4: i2c@2005e000 {
232 compatible = "rockchip,rk3066-i2c";
233 reg = <0x2005e000 0x1000>;
234 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
235 #address-cells = <1>;
236 #size-cells = <0>;
237
238 rockchip,grf = <&grf>;
239
240 clocks = <&cru PCLK_I2C4>;
241 clock-names = "i2c";
242
243 status = "disabled";
244 };
245
246 uart2: serial@20064000 {
247 compatible = "snps,dw-apb-uart";
248 reg = <0x20064000 0x400>;
249 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
250 reg-shift = <2>;
251 reg-io-width = <1>;
252 clock-names = "baudclk", "apb_pclk";
253 clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
254 status = "disabled";
255 };
256
257 uart3: serial@20068000 {
258 compatible = "snps,dw-apb-uart";
259 reg = <0x20068000 0x400>;
260 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
261 reg-shift = <2>;
262 reg-io-width = <1>;
263 clock-names = "baudclk", "apb_pclk";
264 clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
265 status = "disabled";
138 }; 266 };
139}; 267};
diff --git a/arch/arm/boot/dts/s3c2416.dtsi b/arch/arm/boot/dts/s3c2416.dtsi
index 955e4a4f8c31..30b8f7e47454 100644
--- a/arch/arm/boot/dts/s3c2416.dtsi
+++ b/arch/arm/boot/dts/s3c2416.dtsi
@@ -16,6 +16,10 @@
16 model = "Samsung S3C2416 SoC"; 16 model = "Samsung S3C2416 SoC";
17 compatible = "samsung,s3c2416"; 17 compatible = "samsung,s3c2416";
18 18
19 aliases {
20 serial3 = &uart3;
21 };
22
19 cpus { 23 cpus {
20 #address-cells = <1>; 24 #address-cells = <1>;
21 #size-cells = <0>; 25 #size-cells = <0>;
@@ -68,7 +72,7 @@
68 <&clocks SCLK_UART>; 72 <&clocks SCLK_UART>;
69 }; 73 };
70 74
71 serial@5000C000 { 75 uart3: serial@5000C000 {
72 compatible = "samsung,s3c2440-uart"; 76 compatible = "samsung,s3c2440-uart";
73 reg = <0x5000C000 0x4000>; 77 reg = <0x5000C000 0x4000>;
74 interrupts = <1 18 24 4>, <1 18 25 4>; 78 interrupts = <1 18 24 4>, <1 18 25 4>;
diff --git a/arch/arm/boot/dts/s3c24xx.dtsi b/arch/arm/boot/dts/s3c24xx.dtsi
index 2d1d7dc9418a..5ed43b857cc4 100644
--- a/arch/arm/boot/dts/s3c24xx.dtsi
+++ b/arch/arm/boot/dts/s3c24xx.dtsi
@@ -16,6 +16,9 @@
16 16
17 aliases { 17 aliases {
18 pinctrl0 = &pinctrl_0; 18 pinctrl0 = &pinctrl_0;
19 serial0 = &uart0;
20 serial1 = &uart1;
21 serial2 = &uart2;
19 }; 22 };
20 23
21 intc:interrupt-controller@4a000000 { 24 intc:interrupt-controller@4a000000 {
@@ -46,21 +49,21 @@
46 #pwm-cells = <4>; 49 #pwm-cells = <4>;
47 }; 50 };
48 51
49 serial@50000000 { 52 uart0: serial@50000000 {
50 compatible = "samsung,s3c2410-uart"; 53 compatible = "samsung,s3c2410-uart";
51 reg = <0x50000000 0x4000>; 54 reg = <0x50000000 0x4000>;
52 interrupts = <1 28 0 4>, <1 28 1 4>; 55 interrupts = <1 28 0 4>, <1 28 1 4>;
53 status = "disabled"; 56 status = "disabled";
54 }; 57 };
55 58
56 serial@50004000 { 59 uart1: serial@50004000 {
57 compatible = "samsung,s3c2410-uart"; 60 compatible = "samsung,s3c2410-uart";
58 reg = <0x50004000 0x4000>; 61 reg = <0x50004000 0x4000>;
59 interrupts = <1 23 3 4>, <1 23 4 4>; 62 interrupts = <1 23 3 4>, <1 23 4 4>;
60 status = "disabled"; 63 status = "disabled";
61 }; 64 };
62 65
63 serial@50008000 { 66 uart2: serial@50008000 {
64 compatible = "samsung,s3c2410-uart"; 67 compatible = "samsung,s3c2410-uart";
65 reg = <0x50008000 0x4000>; 68 reg = <0x50008000 0x4000>;
66 interrupts = <1 15 6 4>, <1 15 7 4>; 69 interrupts = <1 15 6 4>, <1 15 7 4>;
diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi
index 4e3be4d3493d..ff5bdaac987a 100644
--- a/arch/arm/boot/dts/s3c64xx.dtsi
+++ b/arch/arm/boot/dts/s3c64xx.dtsi
@@ -23,6 +23,10 @@
23 aliases { 23 aliases {
24 i2c0 = &i2c0; 24 i2c0 = &i2c0;
25 pinctrl0 = &pinctrl0; 25 pinctrl0 = &pinctrl0;
26 serial0 = &uart0;
27 serial1 = &uart1;
28 serial2 = &uart2;
29 serial3 = &uart3;
26 }; 30 };
27 31
28 cpus { 32 cpus {
diff --git a/arch/arm/boot/dts/s5pv210-aquila.dts b/arch/arm/boot/dts/s5pv210-aquila.dts
new file mode 100644
index 000000000000..aa31b84a707a
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-aquila.dts
@@ -0,0 +1,392 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Board device tree source for Samsung Aquila board.
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/dts-v1/;
17#include <dt-bindings/input/input.h>
18#include "s5pv210.dtsi"
19
20/ {
21 model = "Samsung Aquila based on S5PC110";
22 compatible = "samsung,aquila", "samsung,s5pv210";
23
24 aliases {
25 i2c3 = &i2c_pmic;
26 };
27
28 chosen {
29 bootargs = "console=ttySAC2,115200n8 root=/dev/mmcblk1p5 rw rootwait ignore_loglevel earlyprintk";
30 };
31
32 memory {
33 device_type = "memory";
34 reg = <0x30000000 0x05000000
35 0x40000000 0x18000000>;
36 };
37
38 regulators {
39 compatible = "simple-bus";
40 #address-cells = <1>;
41 #size-cells = <0>;
42
43 vtf_reg: fixed-regulator@0 {
44 compatible = "regulator-fixed";
45 reg = <0>;
46 regulator-name = "V_TF_2.8V";
47 regulator-min-microvolt = <2800000>;
48 regulator-max-microvolt = <2800000>;
49 gpios = <&mp05 4 0>;
50 enable-active-high;
51 };
52
53 pda_reg: fixed-regulator@1 {
54 compatible = "regulator-fixed";
55 regulator-name = "VCC_1.8V_PDA";
56 regulator-min-microvolt = <1800000>;
57 regulator-max-microvolt = <1800000>;
58 reg = <1>;
59 };
60
61 bat_reg: fixed-regulator@2 {
62 compatible = "regulator-fixed";
63 regulator-name = "V_BAT";
64 regulator-min-microvolt = <3700000>;
65 regulator-max-microvolt = <3700000>;
66 reg = <2>;
67 };
68 };
69
70 i2c_pmic: i2c-pmic {
71 compatible = "i2c-gpio";
72 gpios = <&gpj4 0 0>, /* sda */
73 <&gpj4 3 0>; /* scl */
74 i2c-gpio,delay-us = <2>; /* ~100 kHz */
75 #address-cells = <1>;
76 #size-cells = <0>;
77
78 pmic@66 {
79 compatible = "national,lp3974";
80 reg = <0x66>;
81
82 max8998,pmic-buck1-default-dvs-idx = <0>;
83 max8998,pmic-buck1-dvs-gpios = <&gph0 3 0>,
84 <&gph0 4 0>;
85 max8998,pmic-buck1-dvs-voltage = <1200000>, <1200000>,
86 <1200000>, <1200000>;
87
88 max8998,pmic-buck2-default-dvs-idx = <0>;
89 max8998,pmic-buck2-dvs-gpio = <&gph0 5 0>;
90 max8998,pmic-buck2-dvs-voltage = <1200000>, <1200000>;
91
92 regulators {
93 ldo2_reg: LDO2 {
94 regulator-name = "VALIVE_1.1V";
95 regulator-min-microvolt = <1100000>;
96 regulator-max-microvolt = <1100000>;
97 regulator-always-on;
98 };
99
100 ldo3_reg: LDO3 {
101 regulator-name = "VUSB+MIPI_1.1V";
102 regulator-min-microvolt = <1100000>;
103 regulator-max-microvolt = <1100000>;
104 regulator-always-on;
105 };
106
107 ldo4_reg: LDO4 {
108 regulator-name = "VADC_3.3V";
109 regulator-min-microvolt = <3300000>;
110 regulator-max-microvolt = <3300000>;
111 };
112
113 ldo5_reg: LDO5 {
114 regulator-name = "VTF_2.8V";
115 regulator-min-microvolt = <2800000>;
116 regulator-max-microvolt = <2800000>;
117 regulator-always-on;
118 };
119
120 ldo6_reg: LDO6 {
121 regulator-name = "VCC_3.3V";
122 regulator-min-microvolt = <3300000>;
123 regulator-max-microvolt = <3300000>;
124 regulator-always-on;
125 };
126
127 ldo7_reg: LDO7 {
128 regulator-name = "VCC_3.0V";
129 regulator-min-microvolt = <3000000>;
130 regulator-max-microvolt = <3000000>;
131 regulator-always-on;
132 regulator-boot-on;
133 };
134
135 ldo8_reg: LDO8 {
136 regulator-name = "VUSB+VDAC_3.3V";
137 regulator-min-microvolt = <3300000>;
138 regulator-max-microvolt = <3300000>;
139 regulator-always-on;
140 };
141
142 ldo9_reg: LDO9 {
143 regulator-name = "VCC+VCAM_2.8V";
144 regulator-min-microvolt = <2800000>;
145 regulator-max-microvolt = <2800000>;
146 regulator-always-on;
147 };
148
149 ldo10_reg: LDO10 {
150 regulator-name = "VPLL_1.1V";
151 regulator-min-microvolt = <1100000>;
152 regulator-max-microvolt = <1100000>;
153 regulator-always-on;
154 regulator-boot-on;
155 };
156
157 ldo11_reg: LDO11 {
158 regulator-name = "CAM_IO_2.8V";
159 regulator-min-microvolt = <2800000>;
160 regulator-max-microvolt = <2800000>;
161 regulator-always-on;
162 };
163
164 ldo12_reg: LDO12 {
165 regulator-name = "CAM_ISP_1.2V";
166 regulator-min-microvolt = <1200000>;
167 regulator-max-microvolt = <1200000>;
168 regulator-always-on;
169 };
170
171 ldo13_reg: LDO13 {
172 regulator-name = "CAM_A_2.8V";
173 regulator-min-microvolt = <2800000>;
174 regulator-max-microvolt = <2800000>;
175 regulator-always-on;
176 };
177
178 ldo14_reg: LDO14 {
179 regulator-name = "CAM_CIF_1.8V";
180 regulator-min-microvolt = <1800000>;
181 regulator-max-microvolt = <1800000>;
182 regulator-always-on;
183 };
184
185 ldo15_reg: LDO15 {
186 regulator-name = "CAM_AF_3.3V";
187 regulator-min-microvolt = <3300000>;
188 regulator-max-microvolt = <3300000>;
189 regulator-always-on;
190 };
191
192 ldo16_reg: LDO16 {
193 regulator-name = "VMIPI_1.8V";
194 regulator-min-microvolt = <1800000>;
195 regulator-max-microvolt = <1800000>;
196 regulator-always-on;
197 };
198
199 ldo17_reg: LDO17 {
200 regulator-name = "CAM_8M_1.8V";
201 regulator-min-microvolt = <1800000>;
202 regulator-max-microvolt = <1800000>;
203 regulator-always-on;
204 };
205
206 buck1_reg: BUCK1 {
207 regulator-name = "VARM_1.2V";
208 regulator-min-microvolt = <1200000>;
209 regulator-max-microvolt = <1200000>;
210 regulator-always-on;
211 };
212
213 buck2_reg: BUCK2 {
214 regulator-name = "VINT_1.2V";
215 regulator-min-microvolt = <1200000>;
216 regulator-max-microvolt = <1200000>;
217 regulator-always-on;
218 };
219
220 buck3_reg: BUCK3 {
221 regulator-name = "VCC_1.8V";
222 regulator-min-microvolt = <1800000>;
223 regulator-max-microvolt = <1800000>;
224 regulator-always-on;
225 };
226
227 buck4_reg: BUCK4 {
228 regulator-name = "CAM_CORE_1.2V";
229 regulator-min-microvolt = <1200000>;
230 regulator-max-microvolt = <1200000>;
231 regulator-always-on;
232 };
233
234 vichg_reg: ENVICHG {
235 regulator-name = "VICHG";
236 };
237
238 safeout1_reg: ESAFEOUT1 {
239 regulator-name = "SAFEOUT1";
240 regulator-always-on;
241 };
242
243 safeout2_reg: ESAFEOUT2 {
244 regulator-name = "SAFEOUT2";
245 regulator-boot-on;
246 };
247 };
248 };
249
250 };
251
252 gpio-keys {
253 compatible = "gpio-keys";
254
255 power-key {
256 gpios = <&gph2 6 1>;
257 linux,code = <KEY_POWER>;
258 label = "power";
259 debounce-interval = <1>;
260 gpio-key,wakeup;
261 };
262 };
263};
264
265&xusbxti {
266 clock-frequency = <24000000>;
267};
268
269&keypad {
270 linux,input-no-autorepeat;
271 linux,input-wakeup;
272 samsung,keypad-num-rows = <3>;
273 samsung,keypad-num-columns = <3>;
274 pinctrl-names = "default";
275 pinctrl-0 = <&keypad_row0>, <&keypad_row1>, <&keypad_row2>,
276 <&keypad_col0>, <&keypad_col1>, <&keypad_col2>;
277 status = "okay";
278
279 key_1 {
280 keypad,row = <0>;
281 keypad,column = <1>;
282 linux,code = <KEY_CONNECT>;
283 };
284
285 key_2 {
286 keypad,row = <0>;
287 keypad,column = <2>;
288 linux,code = <KEY_BACK>;
289 };
290
291 key_3 {
292 keypad,row = <1>;
293 keypad,column = <1>;
294 linux,code = <KEY_CAMERA_FOCUS>;
295 };
296
297 key_4 {
298 keypad,row = <1>;
299 keypad,column = <2>;
300 linux,code = <KEY_VOLUMEUP>;
301 };
302
303 key_5 {
304 keypad,row = <2>;
305 keypad,column = <1>;
306 linux,code = <KEY_CAMERA>;
307 };
308
309 key_6 {
310 keypad,row = <2>;
311 keypad,column = <2>;
312 linux,code = <KEY_VOLUMEDOWN>;
313 };
314};
315
316&uart0 {
317 status = "okay";
318};
319
320&uart1 {
321 status = "okay";
322};
323
324&uart2 {
325 status = "okay";
326};
327
328&uart3 {
329 status = "okay";
330};
331
332&sdhci0 {
333 bus-width = <4>;
334 non-removable;
335 status = "okay";
336 vmmc-supply = <&ldo5_reg>;
337 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>;
338 pinctrl-names = "default";
339};
340
341&sdhci2 {
342 bus-width = <4>;
343 cd-gpios = <&gph3 4 1>;
344 vmmc-supply = <&vtf_reg>;
345 cd-inverted;
346 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &t_flash_detect>;
347 pinctrl-names = "default";
348 status = "okay";
349};
350
351&onenand {
352 status = "okay";
353};
354
355&hsotg {
356 vusb_a-supply = <&ldo3_reg>;
357 vusb_d-supply = <&ldo8_reg>;
358 status = "okay";
359};
360
361&usbphy {
362 status = "okay";
363};
364
365&fimd {
366 pinctrl-0 = <&lcd_clk &lcd_data24 &pwm1_out>;
367 pinctrl-names = "default";
368 status = "okay";
369
370 display-timings {
371 native-mode = <&timing0>;
372 timing0: timing {
373 clock-frequency = <0>;
374 hactive = <800>;
375 vactive = <480>;
376 hfront-porch = <16>;
377 hback-porch = <16>;
378 hsync-len = <2>;
379 vback-porch = <3>;
380 vfront-porch = <28>;
381 vsync-len = <1>;
382 };
383 };
384};
385
386&pinctrl0 {
387 t_flash_detect: t-flash-detect {
388 samsung,pins = "gph3-4";
389 samsung,pin-function = <0>;
390 samsung,pin-pud = <0>;
391 };
392};
diff --git a/arch/arm/boot/dts/s5pv210-goni.dts b/arch/arm/boot/dts/s5pv210-goni.dts
new file mode 100644
index 000000000000..6387c77a6f7b
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-goni.dts
@@ -0,0 +1,449 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Board device tree source for Samsung Goni board.
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/dts-v1/;
17#include <dt-bindings/input/input.h>
18#include "s5pv210.dtsi"
19
20/ {
21 model = "Samsung Goni based on S5PC110";
22 compatible = "samsung,goni", "samsung,s5pv210";
23
24 aliases {
25 i2c3 = &i2c_pmic;
26 };
27
28 chosen {
29 bootargs = "console=ttySAC0,115200n8 root=/dev/mmcblk0p5 rw rootwait ignore_loglevel earlyprintk";
30 };
31
32 memory {
33 device_type = "memory";
34 reg = <0x30000000 0x05000000
35 0x40000000 0x10000000
36 0x50000000 0x08000000>;
37 };
38
39 regulators {
40 compatible = "simple-bus";
41 #address-cells = <1>;
42 #size-cells = <0>;
43
44 vtf_reg: fixed-regulator@0 {
45 compatible = "regulator-fixed";
46 regulator-name = "V_TF_2.8V";
47 regulator-min-microvolt = <2800000>;
48 regulator-max-microvolt = <2800000>;
49 reg = <0>;
50 gpios = <&mp05 4 0>;
51 enable-active-high;
52 };
53
54 pda_reg: fixed-regulator@1 {
55 compatible = "regulator-fixed";
56 regulator-name = "VCC_1.8V_PDA";
57 regulator-min-microvolt = <1800000>;
58 regulator-max-microvolt = <1800000>;
59 reg = <1>;
60 };
61
62 bat_reg: fixed-regulator@2 {
63 compatible = "regulator-fixed";
64 regulator-name = "V_BAT";
65 regulator-min-microvolt = <3700000>;
66 regulator-max-microvolt = <3700000>;
67 reg = <2>;
68 };
69
70 tsp_reg: fixed-regulator@3 {
71 compatible = "regulator-fixed";
72 regulator-name = "TSP_VDD";
73 regulator-min-microvolt = <2800000>;
74 regulator-max-microvolt = <2800000>;
75 reg = <3>;
76 gpios = <&gpj1 3 0>;
77 enable-active-high;
78 };
79 };
80
81 i2c_pmic: i2c-pmic {
82 compatible = "i2c-gpio";
83 gpios = <&gpj4 0 0>, /* sda */
84 <&gpj4 3 0>; /* scl */
85 i2c-gpio,delay-us = <2>; /* ~100 kHz */
86 #address-cells = <1>;
87 #size-cells = <0>;
88
89 pmic@66 {
90 compatible = "national,lp3974";
91 reg = <0x66>;
92
93 max8998,pmic-buck1-default-dvs-idx = <0>;
94 max8998,pmic-buck1-dvs-gpios = <&gph0 3 0>,
95 <&gph0 4 0>;
96 max8998,pmic-buck1-dvs-voltage = <1200000>, <1200000>,
97 <1200000>, <1200000>;
98
99 max8998,pmic-buck2-default-dvs-idx = <0>;
100 max8998,pmic-buck2-dvs-gpio = <&gph0 5 0>;
101 max8998,pmic-buck2-dvs-voltage = <1200000>, <1200000>;
102
103 regulators {
104 ldo2_reg: LDO2 {
105 regulator-name = "VALIVE_1.1V";
106 regulator-min-microvolt = <1100000>;
107 regulator-max-microvolt = <1100000>;
108 regulator-always-on;
109 };
110
111 ldo3_reg: LDO3 {
112 regulator-name = "VUSB+MIPI_1.1V";
113 regulator-min-microvolt = <1100000>;
114 regulator-max-microvolt = <1100000>;
115 regulator-always-on;
116 };
117
118 ldo4_reg: LDO4 {
119 regulator-name = "VADC_3.3V";
120 regulator-min-microvolt = <3300000>;
121 regulator-max-microvolt = <3300000>;
122 };
123
124 ldo5_reg: LDO5 {
125 regulator-name = "VTF_2.8V";
126 regulator-min-microvolt = <2800000>;
127 regulator-max-microvolt = <2800000>;
128 };
129
130 ldo6_reg: LDO6 {
131 regulator-name = "VCC_3.3V";
132 regulator-min-microvolt = <3300000>;
133 regulator-max-microvolt = <3300000>;
134 };
135
136 ldo7_reg: LDO7 {
137 regulator-name = "VLCD_1.8V";
138 regulator-min-microvolt = <1800000>;
139 regulator-max-microvolt = <1800000>;
140 regulator-always-on;
141 };
142
143 ldo8_reg: LDO8 {
144 regulator-name = "VUSB+VDAC_3.3V";
145 regulator-min-microvolt = <3300000>;
146 regulator-max-microvolt = <3300000>;
147 };
148
149 ldo9_reg: LDO9 {
150 regulator-name = "VCC+VCAM_2.8V";
151 regulator-min-microvolt = <2800000>;
152 regulator-max-microvolt = <2800000>;
153 };
154
155 ldo10_reg: LDO10 {
156 regulator-name = "VPLL_1.1V";
157 regulator-min-microvolt = <1100000>;
158 regulator-max-microvolt = <1100000>;
159 regulator-boot-on;
160 };
161
162 ldo11_reg: LDO11 {
163 regulator-name = "CAM_IO_2.8V";
164 regulator-min-microvolt = <2800000>;
165 regulator-max-microvolt = <2800000>;
166 };
167
168 ldo12_reg: LDO12 {
169 regulator-name = "CAM_ISP_1.2V";
170 regulator-min-microvolt = <1200000>;
171 regulator-max-microvolt = <1200000>;
172 };
173
174 ldo13_reg: LDO13 {
175 regulator-name = "CAM_A_2.8V";
176 regulator-min-microvolt = <2800000>;
177 regulator-max-microvolt = <2800000>;
178 };
179
180 ldo14_reg: LDO14 {
181 regulator-name = "CAM_CIF_1.8V";
182 regulator-min-microvolt = <1800000>;
183 regulator-max-microvolt = <1800000>;
184 };
185
186 ldo15_reg: LDO15 {
187 regulator-name = "CAM_AF_3.3V";
188 regulator-min-microvolt = <3300000>;
189 regulator-max-microvolt = <3300000>;
190 };
191
192 ldo16_reg: LDO16 {
193 regulator-name = "VMIPI_1.8V";
194 regulator-min-microvolt = <1800000>;
195 regulator-max-microvolt = <1800000>;
196 };
197
198 ldo17_reg: LDO17 {
199 regulator-name = "CAM_8M_1.8V";
200 regulator-min-microvolt = <1800000>;
201 regulator-max-microvolt = <1800000>;
202 regulator-always-on;
203 };
204
205 buck1_reg: BUCK1 {
206 regulator-name = "VARM_1.2V";
207 regulator-min-microvolt = <1200000>;
208 regulator-max-microvolt = <1200000>;
209 };
210
211 buck2_reg: BUCK2 {
212 regulator-name = "VINT_1.2V";
213 regulator-min-microvolt = <1200000>;
214 regulator-max-microvolt = <1200000>;
215 };
216
217 buck3_reg: BUCK3 {
218 regulator-name = "VCC_1.8V";
219 regulator-min-microvolt = <1800000>;
220 regulator-max-microvolt = <1800000>;
221 regulator-always-on;
222 };
223
224 buck4_reg: BUCK4 {
225 regulator-name = "CAM_CORE_1.2V";
226 regulator-min-microvolt = <1200000>;
227 regulator-max-microvolt = <1200000>;
228 regulator-always-on;
229 };
230 };
231 };
232 };
233
234 gpio-keys {
235 compatible = "gpio-keys";
236
237 power-key {
238 gpios = <&gph2 6 1>;
239 linux,code = <KEY_POWER>;
240 label = "power";
241 debounce-interval = <1>;
242 gpio-key,wakeup;
243 };
244 };
245};
246
247&xusbxti {
248 clock-frequency = <24000000>;
249};
250
251&keypad {
252 linux,input-no-autorepeat;
253 linux,input-wakeup;
254 samsung,keypad-num-rows = <3>;
255 samsung,keypad-num-columns = <3>;
256 pinctrl-names = "default";
257 pinctrl-0 = <&keypad_row0>, <&keypad_row1>, <&keypad_row2>,
258 <&keypad_col0>, <&keypad_col1>, <&keypad_col2>;
259 status = "okay";
260
261 key_1 {
262 keypad,row = <0>;
263 keypad,column = <1>;
264 linux,code = <KEY_CONNECT>;
265 };
266
267 key_2 {
268 keypad,row = <0>;
269 keypad,column = <2>;
270 linux,code = <KEY_BACK>;
271 };
272
273 key_3 {
274 keypad,row = <1>;
275 keypad,column = <1>;
276 linux,code = <KEY_CAMERA_FOCUS>;
277 };
278
279 key_4 {
280 keypad,row = <1>;
281 keypad,column = <2>;
282 linux,code = <KEY_VOLUMEUP>;
283 };
284
285 key_5 {
286 keypad,row = <2>;
287 keypad,column = <1>;
288 linux,code = <KEY_CAMERA>;
289 };
290
291 key_6 {
292 keypad,row = <2>;
293 keypad,column = <2>;
294 linux,code = <KEY_VOLUMEDOWN>;
295 };
296};
297
298&uart0 {
299 status = "okay";
300};
301
302&uart1 {
303 status = "okay";
304};
305
306&uart2 {
307 status = "okay";
308};
309
310&uart3 {
311 status = "okay";
312};
313
314&sdhci0 {
315 bus-width = <4>;
316 non-removable;
317 vmmc-supply = <&ldo5_reg>;
318 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus1 &sd0_bus4>;
319 pinctrl-names = "default";
320 status = "okay";
321};
322
323&sdhci2 {
324 bus-width = <4>;
325 cd-gpios = <&gph3 4 1>;
326 vmmc-supply = <&vtf_reg>;
327 cd-inverted;
328 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4>;
329 pinctrl-names = "default";
330 status = "okay";
331};
332
333&hsotg {
334 vusb_a-supply = <&ldo3_reg>;
335 vusb_d-supply = <&ldo8_reg>;
336 status = "okay";
337};
338
339&usbphy {
340 status = "okay";
341};
342
343&i2c2 {
344 samsung,i2c-sda-delay = <100>;
345 samsung,i2c-max-bus-freq = <400000>;
346 samsung,i2c-slave-addr = <0x10>;
347 status = "okay";
348
349 tsp@4a {
350 compatible = "atmel,maxtouch";
351 reg = <0x4a>;
352 interrupt-parent = <&gpj0>;
353 interrupts = <5 2>;
354
355 atmel,x-line = <17>;
356 atmel,y-line = <11>;
357 atmel,x-size = <800>;
358 atmel,y-size = <480>;
359 atmel,burst-length = <0x21>;
360 atmel,threshold = <0x28>;
361 atmel,orientation = <1>;
362
363 vdd-supply = <&tsp_reg>;
364 };
365};
366
367&i2c0 {
368 samsung,i2c-sda-delay = <100>;
369 samsung,i2c-max-bus-freq = <100000>;
370 samsung,i2c-slave-addr = <0x10>;
371 status = "okay";
372
373 noon010pc30: sensor@30 {
374 compatible = "siliconfile,noon010pc30";
375 reg = <0x30>;
376 vddio-supply = <&ldo11_reg>;
377 vdda-supply = <&ldo13_reg>;
378 vdd_core-supply = <&ldo14_reg>;
379
380 clock-frequency = <16000000>;
381 clocks = <&clock_cam 0>;
382 clock-names = "mclk";
383 nreset-gpios = <&gpb 2 0>;
384 nstby-gpios = <&gpb 0 0>;
385
386 port {
387 noon010pc30_ep: endpoint {
388 remote-endpoint = <&fimc0_ep>;
389 bus-width = <8>;
390 hsync-active = <0>;
391 vsync-active = <1>;
392 pclk-sample = <1>;
393 };
394 };
395 };
396};
397
398&camera {
399 pinctrl-0 = <&cam_port_a_io &cam_port_a_clk_active>;
400 pinctrl-1 = <&cam_port_a_io &cam_port_a_clk_idle>;
401 pinctrl-names = "default", "idle";
402
403 parallel-ports {
404 #address-cells = <1>;
405 #size-cells = <0>;
406
407 /* camera A input */
408 port@1 {
409 reg = <1>;
410 fimc0_ep: endpoint {
411 remote-endpoint = <&noon010pc30_ep>;
412 bus-width = <8>;
413 hsync-active = <1>;
414 vsync-active = <1>;
415 pclk-sample = <0>;
416 };
417 };
418 };
419};
420
421&fimd {
422 pinctrl-0 = <&lcd_clk &lcd_data24>;
423 pinctrl-names = "default";
424 status = "okay";
425
426 display-timings {
427 native-mode = <&timing0>;
428 timing0: timing {
429 /* 480x800@55Hz */
430 clock-frequency = <23439570>;
431 hactive = <480>;
432 hfront-porch = <16>;
433 hback-porch = <16>;
434 hsync-len = <2>;
435 vactive = <800>;
436 vback-porch = <2>;
437 vfront-porch = <28>;
438 vsync-len = <1>;
439 hsync-active = <0>;
440 vsync-active = <0>;
441 de-active = <0>;
442 pixelclk-active = <0>;
443 };
444 };
445};
446
447&onenand {
448 status = "okay";
449};
diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
new file mode 100644
index 000000000000..8c714088e3c6
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -0,0 +1,839 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
10 * based board files can include this file and provide values for board specfic
11 * bindings.
12 *
13 * Note: This file does not include device nodes for all the controllers in
14 * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
15 * nodes can be added to this file.
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&pinctrl0 {
23 gpa0: gpa0 {
24 gpio-controller;
25 #gpio-cells = <2>;
26
27 interrupt-controller;
28 #interrupt-cells = <2>;
29 };
30
31 gpa1: gpa1 {
32 gpio-controller;
33 #gpio-cells = <2>;
34
35 interrupt-controller;
36 #interrupt-cells = <2>;
37 };
38
39 gpb: gpb {
40 gpio-controller;
41 #gpio-cells = <2>;
42
43 interrupt-controller;
44 #interrupt-cells = <2>;
45 };
46
47 gpc0: gpc0 {
48 gpio-controller;
49 #gpio-cells = <2>;
50
51 interrupt-controller;
52 #interrupt-cells = <2>;
53 };
54
55 gpc1: gpc1 {
56 gpio-controller;
57 #gpio-cells = <2>;
58
59 interrupt-controller;
60 #interrupt-cells = <2>;
61 };
62
63 gpd0: gpd0 {
64 gpio-controller;
65 #gpio-cells = <2>;
66
67 interrupt-controller;
68 #interrupt-cells = <2>;
69 };
70
71 gpd1: gpd1 {
72 gpio-controller;
73 #gpio-cells = <2>;
74
75 interrupt-controller;
76 #interrupt-cells = <2>;
77 };
78
79 gpe0: gpe0 {
80 gpio-controller;
81 #gpio-cells = <2>;
82
83 interrupt-controller;
84 #interrupt-cells = <2>;
85 };
86
87 gpe1: gpe1 {
88 gpio-controller;
89 #gpio-cells = <2>;
90
91 interrupt-controller;
92 #interrupt-cells = <2>;
93 };
94
95 gpf0: gpf0 {
96 gpio-controller;
97 #gpio-cells = <2>;
98
99 interrupt-controller;
100 #interrupt-cells = <2>;
101 };
102
103 gpf1: gpf1 {
104 gpio-controller;
105 #gpio-cells = <2>;
106
107 interrupt-controller;
108 #interrupt-cells = <2>;
109 };
110
111 gpf2: gpf2 {
112 gpio-controller;
113 #gpio-cells = <2>;
114
115 interrupt-controller;
116 #interrupt-cells = <2>;
117 };
118
119 gpf3: gpf3 {
120 gpio-controller;
121 #gpio-cells = <2>;
122
123 interrupt-controller;
124 #interrupt-cells = <2>;
125 };
126
127 gpg0: gpg0 {
128 gpio-controller;
129 #gpio-cells = <2>;
130
131 interrupt-controller;
132 #interrupt-cells = <2>;
133 };
134
135 gpg1: gpg1 {
136 gpio-controller;
137 #gpio-cells = <2>;
138
139 interrupt-controller;
140 #interrupt-cells = <2>;
141 };
142
143 gpg2: gpg2 {
144 gpio-controller;
145 #gpio-cells = <2>;
146
147 interrupt-controller;
148 #interrupt-cells = <2>;
149 };
150
151 gpg3: gpg3 {
152 gpio-controller;
153 #gpio-cells = <2>;
154
155 interrupt-controller;
156 #interrupt-cells = <2>;
157 };
158
159 gpj0: gpj0 {
160 gpio-controller;
161 #gpio-cells = <2>;
162
163 interrupt-controller;
164 #interrupt-cells = <2>;
165 };
166
167 gpj1: gpj1 {
168 gpio-controller;
169 #gpio-cells = <2>;
170
171 interrupt-controller;
172 #interrupt-cells = <2>;
173 };
174
175 gpj2: gpj2 {
176 gpio-controller;
177 #gpio-cells = <2>;
178
179 interrupt-controller;
180 #interrupt-cells = <2>;
181 };
182
183 gpj3: gpj3 {
184 gpio-controller;
185 #gpio-cells = <2>;
186
187 interrupt-controller;
188 #interrupt-cells = <2>;
189 };
190
191 gpj4: gpj4 {
192 gpio-controller;
193 #gpio-cells = <2>;
194
195 interrupt-controller;
196 #interrupt-cells = <2>;
197 };
198
199 gpgi: gpgi {
200 gpio-controller;
201 #gpio-cells = <2>;
202 };
203
204 mp01: mp01 {
205 gpio-controller;
206 #gpio-cells = <2>;
207 };
208
209 mp02: mp02 {
210 gpio-controller;
211 #gpio-cells = <2>;
212 };
213
214 mp03: mp03 {
215 gpio-controller;
216 #gpio-cells = <2>;
217 };
218
219 mp04: mp04 {
220 gpio-controller;
221 #gpio-cells = <2>;
222 };
223
224 mp05: mp05 {
225 gpio-controller;
226 #gpio-cells = <2>;
227 };
228
229 mp06: mp06 {
230 gpio-controller;
231 #gpio-cells = <2>;
232 };
233
234 mp07: mp07 {
235 gpio-controller;
236 #gpio-cells = <2>;
237 };
238
239 gph0: gph0 {
240 gpio-controller;
241 interrupt-controller;
242 interrupt-parent = <&vic0>;
243 interrupts = <0>, <1>, <2>, <3>,
244 <4>, <5>, <6>, <7>;
245 #gpio-cells = <2>;
246 #interrupt-cells = <2>;
247 };
248
249 gph1: gph1 {
250 gpio-controller;
251 interrupt-controller;
252 interrupt-parent = <&vic0>;
253 interrupts = <8>, <9>, <10>, <11>,
254 <12>, <13>, <14>, <15>;
255 #gpio-cells = <2>;
256 #interrupt-cells = <2>;
257 };
258
259 gph2: gph2 {
260 gpio-controller;
261 #gpio-cells = <2>;
262 #interrupt-cells = <2>;
263 };
264
265 gph3: gph3 {
266 gpio-controller;
267 #gpio-cells = <2>;
268 #interrupt-cells = <2>;
269 };
270
271 uart0_data: uart0-data {
272 samsung,pins = "gpa0-0", "gpa0-1";
273 samsung,pin-function = <2>;
274 samsung,pin-pud = <0>;
275 samsung,pin-drv = <0>;
276 };
277
278 uart0_fctl: uart0-fctl {
279 samsung,pins = "gpa0-2", "gpa0-3";
280 samsung,pin-function = <2>;
281 samsung,pin-pud = <0>;
282 samsung,pin-drv = <0>;
283 };
284
285 uart1_data: uart1-data {
286 samsung,pins = "gpa0-4", "gpa0-5";
287 samsung,pin-function = <2>;
288 samsung,pin-pud = <0>;
289 samsung,pin-drv = <0>;
290 };
291
292 uart1_fctl: uart1-fctl {
293 samsung,pins = "gpa0-6", "gpa0-7";
294 samsung,pin-function = <2>;
295 samsung,pin-pud = <0>;
296 samsung,pin-drv = <0>;
297 };
298
299 uart2_data: uart2-data {
300 samsung,pins = "gpa1-0", "gpa1-1";
301 samsung,pin-function = <2>;
302 samsung,pin-pud = <0>;
303 samsung,pin-drv = <0>;
304 };
305
306 uart2_fctl: uart2-fctl {
307 samsung,pins = "gpa1-2", "gpa1-3";
308 samsung,pin-function = <3>;
309 samsung,pin-pud = <0>;
310 samsung,pin-drv = <0>;
311 };
312
313 uart3_data: uart3-data {
314 samsung,pins = "gpa1-2", "gpa1-3";
315 samsung,pin-function = <2>;
316 samsung,pin-pud = <0>;
317 samsung,pin-drv = <0>;
318 };
319
320 uart_audio: uart-audio {
321 samsung,pins = "gpa1-2", "gpa1-3";
322 samsung,pin-function = <4>;
323 samsung,pin-pud = <0>;
324 samsung,pin-drv = <0>;
325 };
326
327 spi0_bus: spi0-bus {
328 samsung,pins = "gpb-0", "gpb-2", "gpb-3";
329 samsung,pin-function = <2>;
330 samsung,pin-pud = <2>;
331 samsung,pin-drv = <0>;
332 };
333
334 spi1_bus: spi1-bus {
335 samsung,pins = "gpb-4", "gpb-6", "gpb-7";
336 samsung,pin-function = <2>;
337 samsung,pin-pud = <2>;
338 samsung,pin-drv = <0>;
339 };
340
341 i2s0_bus: i2s0-bus {
342 samsung,pins = "gpi-0", "gpi-1", "gpi-2", "gpi-3",
343 "gpi-4", "gpi-5", "gpi-6";
344 samsung,pin-function = <2>;
345 samsung,pin-pud = <0>;
346 samsung,pin-drv = <0>;
347 };
348
349 i2s1_bus: i2s1-bus {
350 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
351 "gpc0-4";
352 samsung,pin-function = <2>;
353 samsung,pin-pud = <0>;
354 samsung,pin-drv = <0>;
355 };
356
357 i2s2_bus: i2s2-bus {
358 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
359 "gpc1-4";
360 samsung,pin-function = <4>;
361 samsung,pin-pud = <0>;
362 samsung,pin-drv = <0>;
363 };
364
365 pcm1_bus: pcm1-bus {
366 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
367 "gpc0-4";
368 samsung,pin-function = <3>;
369 samsung,pin-pud = <0>;
370 samsung,pin-drv = <0>;
371 };
372
373 ac97_bus: ac97-bus {
374 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
375 "gpc0-4";
376 samsung,pin-function = <4>;
377 samsung,pin-pud = <0>;
378 samsung,pin-drv = <0>;
379 };
380
381 i2s2_bus: i2s2-bus {
382 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
383 "gpc1-4";
384 samsung,pin-function = <2>;
385 samsung,pin-pud = <0>;
386 samsung,pin-drv = <0>;
387 };
388
389 pcm2_bus: pcm2-bus {
390 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
391 "gpc1-4";
392 samsung,pin-function = <3>;
393 samsung,pin-pud = <0>;
394 samsung,pin-drv = <0>;
395 };
396
397 spdif_bus: spdif-bus {
398 samsung,pins = "gpc1-0", "gpc1-1";
399 samsung,pin-function = <4>;
400 samsung,pin-pud = <0>;
401 samsung,pin-drv = <0>;
402 };
403
404 spi2_bus: spi2-bus {
405 samsung,pins = "gpc1-1", "gpc1-2", "gpc1-3", "gpc1-4";
406 samsung,pin-function = <5>;
407 samsung,pin-pud = <2>;
408 samsung,pin-drv = <0>;
409 };
410
411 i2c0_bus: i2c0-bus {
412 samsung,pins = "gpd1-0", "gpd1-1";
413 samsung,pin-function = <2>;
414 samsung,pin-pud = <2>;
415 samsung,pin-drv = <0>;
416 };
417
418 i2c1_bus: i2c1-bus {
419 samsung,pins = "gpd1-2", "gpd1-3";
420 samsung,pin-function = <2>;
421 samsung,pin-pud = <2>;
422 samsung,pin-drv = <0>;
423 };
424
425 i2c2_bus: i2c2-bus {
426 samsung,pins = "gpd1-4", "gpd1-5";
427 samsung,pin-function = <2>;
428 samsung,pin-pud = <2>;
429 samsung,pin-drv = <0>;
430 };
431
432 pwm0_out: pwm0-out {
433 samsung,pins = "gpd0-0";
434 samsung,pin-function = <2>;
435 samsung,pin-pud = <0>;
436 samsung,pin-drv = <0>;
437 };
438
439 pwm1_out: pwm1-out {
440 samsung,pins = "gpd0-1";
441 samsung,pin-function = <2>;
442 samsung,pin-pud = <0>;
443 samsung,pin-drv = <0>;
444 };
445
446 pwm2_out: pwm2-out {
447 samsung,pins = "gpd0-2";
448 samsung,pin-function = <2>;
449 samsung,pin-pud = <0>;
450 samsung,pin-drv = <0>;
451 };
452
453 pwm3_out: pwm3-out {
454 samsung,pins = "gpd0-3";
455 samsung,pin-function = <2>;
456 samsung,pin-pud = <0>;
457 samsung,pin-drv = <0>;
458 };
459
460 keypad_row0: keypad-row-0 {
461 samsung,pins = "gph3-0";
462 samsung,pin-function = <3>;
463 samsung,pin-pud = <0>;
464 samsung,pin-drv = <0>;
465 };
466
467 keypad_row1: keypad-row-1 {
468 samsung,pins = "gph3-1";
469 samsung,pin-function = <3>;
470 samsung,pin-pud = <0>;
471 samsung,pin-drv = <0>;
472 };
473
474 keypad_row2: keypad-row-2 {
475 samsung,pins = "gph3-2";
476 samsung,pin-function = <3>;
477 samsung,pin-pud = <0>;
478 samsung,pin-drv = <0>;
479 };
480
481 keypad_row3: keypad-row-3 {
482 samsung,pins = "gph3-3";
483 samsung,pin-function = <3>;
484 samsung,pin-pud = <0>;
485 samsung,pin-drv = <0>;
486 };
487
488 keypad_row4: keypad-row-4 {
489 samsung,pins = "gph3-4";
490 samsung,pin-function = <3>;
491 samsung,pin-pud = <0>;
492 samsung,pin-drv = <0>;
493 };
494
495 keypad_row5: keypad-row-5 {
496 samsung,pins = "gph3-5";
497 samsung,pin-function = <3>;
498 samsung,pin-pud = <0>;
499 samsung,pin-drv = <0>;
500 };
501
502 keypad_row6: keypad-row-6 {
503 samsung,pins = "gph3-6";
504 samsung,pin-function = <3>;
505 samsung,pin-pud = <0>;
506 samsung,pin-drv = <0>;
507 };
508
509 keypad_row7: keypad-row-7 {
510 samsung,pins = "gph3-7";
511 samsung,pin-function = <3>;
512 samsung,pin-pud = <0>;
513 samsung,pin-drv = <0>;
514 };
515
516 keypad_col0: keypad-col-0 {
517 samsung,pins = "gph2-0";
518 samsung,pin-function = <3>;
519 samsung,pin-pud = <0>;
520 samsung,pin-drv = <0>;
521 };
522
523 keypad_col1: keypad-col-1 {
524 samsung,pins = "gph2-1";
525 samsung,pin-function = <3>;
526 samsung,pin-pud = <0>;
527 samsung,pin-drv = <0>;
528 };
529
530 keypad_col2: keypad-col-2 {
531 samsung,pins = "gph2-2";
532 samsung,pin-function = <3>;
533 samsung,pin-pud = <0>;
534 samsung,pin-drv = <0>;
535 };
536
537 keypad_col3: keypad-col-3 {
538 samsung,pins = "gph2-3";
539 samsung,pin-function = <3>;
540 samsung,pin-pud = <0>;
541 samsung,pin-drv = <0>;
542 };
543
544 keypad_col4: keypad-col-4 {
545 samsung,pins = "gph2-4";
546 samsung,pin-function = <3>;
547 samsung,pin-pud = <0>;
548 samsung,pin-drv = <0>;
549 };
550
551 keypad_col5: keypad-col-5 {
552 samsung,pins = "gph2-5";
553 samsung,pin-function = <3>;
554 samsung,pin-pud = <0>;
555 samsung,pin-drv = <0>;
556 };
557
558 keypad_col6: keypad-col-6 {
559 samsung,pins = "gph2-6";
560 samsung,pin-function = <3>;
561 samsung,pin-pud = <0>;
562 samsung,pin-drv = <0>;
563 };
564
565 keypad_col7: keypad-col-7 {
566 samsung,pins = "gph2-7";
567 samsung,pin-function = <3>;
568 samsung,pin-pud = <0>;
569 samsung,pin-drv = <0>;
570 };
571
572 sd0_clk: sd0-clk {
573 samsung,pins = "gpg0-0";
574 samsung,pin-function = <2>;
575 samsung,pin-pud = <0>;
576 samsung,pin-drv = <3>;
577 };
578
579 sd0_cmd: sd0-cmd {
580 samsung,pins = "gpg0-1";
581 samsung,pin-function = <2>;
582 samsung,pin-pud = <0>;
583 samsung,pin-drv = <3>;
584 };
585
586 sd0_cd: sd0-cd {
587 samsung,pins = "gpg0-2";
588 samsung,pin-function = <2>;
589 samsung,pin-pud = <2>;
590 samsung,pin-drv = <3>;
591 };
592
593 sd0_bus1: sd0-bus-width1 {
594 samsung,pins = "gpg0-3";
595 samsung,pin-function = <2>;
596 samsung,pin-pud = <2>;
597 samsung,pin-drv = <3>;
598 };
599
600 sd0_bus4: sd0-bus-width4 {
601 samsung,pins = "gpg0-3", "gpg0-4", "gpg0-5", "gpg0-6";
602 samsung,pin-function = <2>;
603 samsung,pin-pud = <2>;
604 samsung,pin-drv = <3>;
605 };
606
607 sd0_bus8: sd0-bus-width8 {
608 samsung,pins = "gpg1-3", "gpg1-4", "gpg1-5", "gpg1-6";
609 samsung,pin-function = <3>;
610 samsung,pin-pud = <2>;
611 samsung,pin-drv = <3>;
612 };
613
614 sd1_clk: sd1-clk {
615 samsung,pins = "gpg1-0";
616 samsung,pin-function = <2>;
617 samsung,pin-pud = <0>;
618 samsung,pin-drv = <3>;
619 };
620
621 sd1_cmd: sd1-cmd {
622 samsung,pins = "gpg1-1";
623 samsung,pin-function = <2>;
624 samsung,pin-pud = <0>;
625 samsung,pin-drv = <3>;
626 };
627
628 sd1_cd: sd1-cd {
629 samsung,pins = "gpg1-2";
630 samsung,pin-function = <2>;
631 samsung,pin-pud = <2>;
632 samsung,pin-drv = <3>;
633 };
634
635 sd1_bus1: sd1-bus-width1 {
636 samsung,pins = "gpg1-3";
637 samsung,pin-function = <2>;
638 samsung,pin-pud = <2>;
639 samsung,pin-drv = <3>;
640 };
641
642 sd1_bus4: sd1-bus-width4 {
643 samsung,pins = "gpg1-3", "gpg1-4", "gpg1-5", "gpg1-6";
644 samsung,pin-function = <2>;
645 samsung,pin-pud = <2>;
646 samsung,pin-drv = <3>;
647 };
648
649 sd2_clk: sd2-clk {
650 samsung,pins = "gpg2-0";
651 samsung,pin-function = <2>;
652 samsung,pin-pud = <0>;
653 samsung,pin-drv = <3>;
654 };
655
656 sd2_cmd: sd2-cmd {
657 samsung,pins = "gpg2-1";
658 samsung,pin-function = <2>;
659 samsung,pin-pud = <0>;
660 samsung,pin-drv = <3>;
661 };
662
663 sd2_cd: sd2-cd {
664 samsung,pins = "gpg2-2";
665 samsung,pin-function = <2>;
666 samsung,pin-pud = <2>;
667 samsung,pin-drv = <3>;
668 };
669
670 sd2_bus1: sd2-bus-width1 {
671 samsung,pins = "gpg2-3";
672 samsung,pin-function = <2>;
673 samsung,pin-pud = <2>;
674 samsung,pin-drv = <3>;
675 };
676
677 sd2_bus4: sd2-bus-width4 {
678 samsung,pins = "gpg2-3", "gpg2-4", "gpg2-5", "gpg2-6";
679 samsung,pin-function = <2>;
680 samsung,pin-pud = <2>;
681 samsung,pin-drv = <3>;
682 };
683
684 sd2_bus8: sd2-bus-width8 {
685 samsung,pins = "gpg3-3", "gpg3-4", "gpg3-5", "gpg3-6";
686 samsung,pin-function = <3>;
687 samsung,pin-pud = <2>;
688 samsung,pin-drv = <3>;
689 };
690
691 sd3_clk: sd3-clk {
692 samsung,pins = "gpg3-0";
693 samsung,pin-function = <2>;
694 samsung,pin-pud = <0>;
695 samsung,pin-drv = <3>;
696 };
697
698 sd3_cmd: sd3-cmd {
699 samsung,pins = "gpg3-1";
700 samsung,pin-function = <2>;
701 samsung,pin-pud = <0>;
702 samsung,pin-drv = <3>;
703 };
704
705 sd3_cd: sd3-cd {
706 samsung,pins = "gpg3-2";
707 samsung,pin-function = <2>;
708 samsung,pin-pud = <2>;
709 samsung,pin-drv = <3>;
710 };
711
712 sd3_bus1: sd3-bus-width1 {
713 samsung,pins = "gpg3-3";
714 samsung,pin-function = <2>;
715 samsung,pin-pud = <2>;
716 samsung,pin-drv = <3>;
717 };
718
719 sd3_bus4: sd3-bus-width4 {
720 samsung,pins = "gpg3-3", "gpg3-4", "gpg3-5", "gpg3-6";
721 samsung,pin-function = <2>;
722 samsung,pin-pud = <2>;
723 samsung,pin-drv = <3>;
724 };
725
726 eint0: ext-int0 {
727 samsung,pins = "gph0-0";
728 samsung,pin-function = <0xf>;
729 samsung,pin-pud = <0>;
730 samsung,pin-drv = <0>;
731 };
732
733 eint8: ext-int8 {
734 samsung,pins = "gph1-0";
735 samsung,pin-function = <0xf>;
736 samsung,pin-pud = <0>;
737 samsung,pin-drv = <0>;
738 };
739
740 eint15: ext-int15 {
741 samsung,pins = "gph1-7";
742 samsung,pin-function = <0xf>;
743 samsung,pin-pud = <0>;
744 samsung,pin-drv = <0>;
745 };
746
747 eint16: ext-int16 {
748 samsung,pins = "gph2-0";
749 samsung,pin-function = <0xf>;
750 samsung,pin-pud = <0>;
751 samsung,pin-drv = <0>;
752 };
753
754 eint31: ext-int31 {
755 samsung,pins = "gph3-7";
756 samsung,pin-function = <0xf>;
757 samsung,pin-pud = <0>;
758 samsung,pin-drv = <0>;
759 };
760
761 cam_port_a_io: cam-port-a-io {
762 samsung,pins = "gpe0-0", "gpe0-1", "gpe0-2", "gpe0-3",
763 "gpe0-4", "gpe0-5", "gpe0-6", "gpe0-7",
764 "gpe1-0", "gpe1-1", "gpe1-2", "gpe1-4";
765 samsung,pin-function = <2>;
766 samsung,pin-pud = <0>;
767 samsung,pin-drv = <0>;
768 };
769
770 cam_port_a_clk_active: cam-port-a-clk-active {
771 samsung,pins = "gpe1-3";
772 samsung,pin-function = <2>;
773 samsung,pin-pud = <0>;
774 samsung,pin-drv = <3>;
775 };
776
777 cam_port_a_clk_idle: cam-port-a-clk-idle {
778 samsung,pins = "gpe1-3";
779 samsung,pin-function = <0>;
780 samsung,pin-pud = <1>;
781 samsung,pin-drv = <0>;
782 };
783
784 cam_port_b_io: cam-port-b-io {
785 samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3",
786 "gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7",
787 "gpj1-0", "gpj1-1", "gpj1-2", "gpj1-4";
788 samsung,pin-function = <3>;
789 samsung,pin-pud = <0>;
790 samsung,pin-drv = <0>;
791 };
792
793 cam_port_b_clk_active: cam-port-b-clk-active {
794 samsung,pins = "gpj1-3";
795 samsung,pin-function = <3>;
796 samsung,pin-pud = <0>;
797 samsung,pin-drv = <3>;
798 };
799
800 cam_port_b_clk_idle: cam-port-b-clk-idle {
801 samsung,pins = "gpj1-3";
802 samsung,pin-function = <0>;
803 samsung,pin-pud = <1>;
804 samsung,pin-drv = <0>;
805 };
806
807 lcd_ctrl: lcd-ctrl {
808 samsung,pins = "gpd0-0", "gpd0-1";
809 samsung,pin-function = <3>;
810 samsung,pin-pud = <0>;
811 samsung,pin-drv = <0>;
812 };
813
814 lcd_sync: lcd-sync {
815 samsung,pins = "gpf0-0", "gpf0-1";
816 samsung,pin-function = <2>;
817 samsung,pin-pud = <0>;
818 samsung,pin-drv = <0>;
819 };
820
821 lcd_clk: lcd-clk {
822 samsung,pins = "gpf0-0", "gpf0-1", "gpf0-2", "gpf0-3";
823 samsung,pin-function = <2>;
824 samsung,pin-pud = <0>;
825 samsung,pin-drv = <0>;
826 };
827
828 lcd_data24: lcd-data-width24 {
829 samsung,pins = "gpf0-4", "gpf0-5", "gpf0-6", "gpf0-7",
830 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3",
831 "gpf1-4", "gpf1-5", "gpf1-6", "gpf1-7",
832 "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3",
833 "gpf2-4", "gpf2-5", "gpf2-6", "gpf2-7",
834 "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3";
835 samsung,pin-function = <2>;
836 samsung,pin-pud = <0>;
837 samsung,pin-drv = <0>;
838 };
839};
diff --git a/arch/arm/boot/dts/s5pv210-smdkc110.dts b/arch/arm/boot/dts/s5pv210-smdkc110.dts
new file mode 100644
index 000000000000..1eedab7ffe94
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-smdkc110.dts
@@ -0,0 +1,78 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Board device tree source for YIC System SMDC110 board.
10 *
11 * NOTE: This file is completely based on original board file for mach-smdkc110
12 * available in Linux 3.15 and intends to provide equivalent level of hardware
13 * support. Due to lack of hardware, _no_ testing has been performed.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20/dts-v1/;
21#include <dt-bindings/input/input.h>
22#include "s5pv210.dtsi"
23
24/ {
25 model = "YIC System SMDKC110 based on S5PC110";
26 compatible = "yic,smdkc110", "samsung,s5pv210";
27
28 chosen {
29 bootargs = "console=ttySAC0,115200n8 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk";
30 };
31
32 memory {
33 device_type = "memory";
34 reg = <0x20000000 0x20000000>;
35 };
36};
37
38&xusbxti {
39 clock-frequency = <24000000>;
40};
41
42&uart0 {
43 status = "okay";
44};
45
46&uart1 {
47 status = "okay";
48};
49
50&uart2 {
51 status = "okay";
52};
53
54&uart3 {
55 status = "okay";
56};
57
58&rtc {
59 status = "okay";
60};
61
62&i2c0 {
63 status = "okay";
64
65 audio-codec@1b {
66 compatible = "wlf,wm8580";
67 reg = <0x1b>;
68 };
69
70 eeprom@50 {
71 compatible = "atmel,24c08";
72 reg = <0x50>;
73 };
74};
75
76&i2s0 {
77 status = "okay";
78};
diff --git a/arch/arm/boot/dts/s5pv210-smdkv210.dts b/arch/arm/boot/dts/s5pv210-smdkv210.dts
new file mode 100644
index 000000000000..cb8521899ec8
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-smdkv210.dts
@@ -0,0 +1,238 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Board device tree source for YIC System SMDV210 board.
10 *
11 * NOTE: This file is completely based on original board file for mach-smdkv210
12 * available in Linux 3.15 and intends to provide equivalent level of hardware
13 * support. Due to lack of hardware, _no_ testing has been performed.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20/dts-v1/;
21#include <dt-bindings/input/input.h>
22#include "s5pv210.dtsi"
23
24/ {
25 model = "YIC System SMDKV210 based on S5PV210";
26 compatible = "yic,smdkv210", "samsung,s5pv210";
27
28 chosen {
29 bootargs = "console=ttySAC0,115200n8 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk";
30 };
31
32 memory {
33 device_type = "memory";
34 reg = <0x20000000 0x40000000>;
35 };
36
37 ethernet@18000000 {
38 compatible = "davicom,dm9000";
39 reg = <0xA8000000 0x2 0xA8000002 0x2>;
40 interrupt-parent = <&gph1>;
41 interrupts = <1 4>;
42 local-mac-address = [00 00 de ad be ef];
43 davicom,no-eeprom;
44 };
45
46 backlight {
47 compatible = "pwm-backlight";
48 pwms = <&pwm 3 5000000 0>;
49 brightness-levels = <0 4 8 16 32 64 128 255>;
50 default-brightness-level = <6>;
51 pinctrl-names = "default";
52 pinctrl-0 = <&pwm3_out>;
53 };
54};
55
56&xusbxti {
57 clock-frequency = <24000000>;
58};
59
60&keypad {
61 linux,input-no-autorepeat;
62 linux,input-wakeup;
63 samsung,keypad-num-rows = <8>;
64 samsung,keypad-num-columns = <8>;
65 pinctrl-names = "default";
66 pinctrl-0 = <&keypad_row0>, <&keypad_row1>, <&keypad_row2>,
67 <&keypad_row3>, <&keypad_row4>, <&keypad_row5>,
68 <&keypad_row6>, <&keypad_row7>,
69 <&keypad_col0>, <&keypad_col1>, <&keypad_col2>,
70 <&keypad_col3>, <&keypad_col4>, <&keypad_col5>,
71 <&keypad_col6>, <&keypad_col7>;
72 status = "okay";
73
74 key_1 {
75 keypad,row = <0>;
76 keypad,column = <3>;
77 linux,code = <KEY_1>;
78 };
79
80 key_2 {
81 keypad,row = <0>;
82 keypad,column = <4>;
83 linux,code = <KEY_2>;
84 };
85
86 key_3 {
87 keypad,row = <0>;
88 keypad,column = <5>;
89 linux,code = <KEY_3>;
90 };
91
92 key_4 {
93 keypad,row = <0>;
94 keypad,column = <6>;
95 linux,code = <KEY_4>;
96 };
97
98 key_5 {
99 keypad,row = <0
100 >;
101 keypad,column = <7>;
102 linux,code = <KEY_5>;
103 };
104
105 key_6 {
106 keypad,row = <1>;
107 keypad,column = <3>;
108 linux,code = <KEY_A>;
109 };
110 key_7 {
111 keypad,row = <1>;
112 keypad,column = <4>;
113 linux,code = <KEY_B>;
114 };
115
116 key_8 {
117 keypad,row = <1>;
118 keypad,column = <5>;
119 linux,code = <KEY_C>;
120 };
121
122 key_9 {
123 keypad,row = <1>;
124 keypad,column = <6>;
125 linux,code = <KEY_D>;
126 };
127
128 key_10 {
129 keypad,row = <1>;
130 keypad,column = <7>;
131 linux,code = <KEY_E>;
132 };
133};
134
135&uart0 {
136 status = "okay";
137};
138
139&uart1 {
140 status = "okay";
141};
142
143&uart2 {
144 status = "okay";
145};
146
147&uart3 {
148 status = "okay";
149};
150
151&rtc {
152 status = "okay";
153};
154
155&sdhci0 {
156 bus-width = <4>;
157 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus1 &sd0_bus4>;
158 pinctrl-names = "default";
159 status = "okay";
160};
161
162&sdhci1 {
163 bus-width = <4>;
164 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus1 &sd1_bus4>;
165 pinctrl-names = "default";
166 status = "okay";
167};
168
169&sdhci2 {
170 bus-width = <4>;
171 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>;
172 pinctrl-names = "default";
173 status = "okay";
174};
175
176&sdhci3 {
177 bus-width = <4>;
178 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_cd &sd3_bus1 &sd3_bus4>;
179 pinctrl-names = "default";
180 status = "okay";
181};
182
183&hsotg {
184 status = "okay";
185};
186
187&usbphy {
188 status = "okay";
189};
190
191&fimd {
192 pinctrl-0 = <&lcd_clk &lcd_data24>;
193 pinctrl-names = "default";
194 status = "okay";
195
196 display-timings {
197 native-mode = <&timing0>;
198
199 timing0: timing@0 {
200 /* 800x480@60Hz */
201 clock-frequency = <24373920>;
202 hactive = <800>;
203 vactive = <480>;
204 hfront-porch = <8>;
205 hback-porch = <13>;
206 hsync-len = <3>;
207 vback-porch = <7>;
208 vfront-porch = <5>;
209 vsync-len = <1>;
210 hsync-active = <0>;
211 vsync-active = <0>;
212 de-active = <1>;
213 pixelclk-active = <1>;
214 };
215 };
216};
217
218&pwm {
219 samsung,pwm-outputs = <3>;
220};
221
222&i2c0 {
223 status = "okay";
224
225 audio-codec@1b {
226 compatible = "wlf,wm8580";
227 reg = <0x1b>;
228 };
229
230 eeprom@50 {
231 compatible = "atmel,24c08";
232 reg = <0x50>;
233 };
234};
235
236&i2s0 {
237 status = "okay";
238};
diff --git a/arch/arm/boot/dts/s5pv210-torbreck.dts b/arch/arm/boot/dts/s5pv210-torbreck.dts
new file mode 100644
index 000000000000..622599fd2cfa
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210-torbreck.dts
@@ -0,0 +1,92 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Board device tree source for Torbreck board.
10 *
11 * NOTE: This file is completely based on original board file for mach-torbreck
12 * available in Linux 3.15 and intends to provide equivalent level of hardware
13 * support. Due to lack of hardware, _no_ testing has been performed.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20/dts-v1/;
21#include <dt-bindings/input/input.h>
22#include "s5pv210.dtsi"
23
24/ {
25 model = "aESOP Torbreck based on S5PV210";
26 compatible = "aesop,torbreck", "samsung,s5pv210";
27
28 chosen {
29 bootargs = "console=ttySAC0,115200n8 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk";
30 };
31
32 memory {
33 device_type = "memory";
34 reg = <0x20000000 0x20000000>;
35 };
36};
37
38&xusbxti {
39 clock-frequency = <24000000>;
40};
41
42&uart0 {
43 status = "okay";
44};
45
46&uart1 {
47 status = "okay";
48};
49
50&uart2 {
51 status = "okay";
52};
53
54&uart3 {
55 status = "okay";
56};
57
58&rtc {
59 status = "okay";
60};
61
62&sdhci0 {
63 bus-width = <4>;
64 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus1 &sd0_bus4>;
65 pinctrl-names = "default";
66 status = "okay";
67};
68
69&sdhci1 {
70 bus-width = <4>;
71 pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus1 &sd1_bus4>;
72 pinctrl-names = "default";
73 status = "okay";
74};
75
76&sdhci2 {
77 bus-width = <4>;
78 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus1 &sd2_bus4>;
79 pinctrl-names = "default";
80 status = "okay";
81};
82
83&sdhci3 {
84 bus-width = <4>;
85 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_cd &sd3_bus1 &sd3_bus4>;
86 pinctrl-names = "default";
87 status = "okay";
88};
89
90&i2s0 {
91 status = "okay";
92};
diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
new file mode 100644
index 000000000000..8344a0ee2b86
--- /dev/null
+++ b/arch/arm/boot/dts/s5pv210.dtsi
@@ -0,0 +1,633 @@
1/*
2 * Samsung's S5PV210 SoC device tree source
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics, Co. Ltd.
5 *
6 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 * Tomasz Figa <t.figa@samsung.com>
8 *
9 * Samsung's S5PV210 SoC device nodes are listed in this file. S5PV210
10 * based board files can include this file and provide values for board specfic
11 * bindings.
12 *
13 * Note: This file does not include device nodes for all the controllers in
14 * S5PV210 SoC. As device tree coverage for S5PV210 increases, additional
15 * nodes can be added to this file.
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#include "skeleton.dtsi"
23#include <dt-bindings/clock/s5pv210.h>
24#include <dt-bindings/clock/s5pv210-audss.h>
25
26/ {
27 aliases {
28 csis0 = &csis0;
29 fimc0 = &fimc0;
30 fimc1 = &fimc1;
31 fimc2 = &fimc2;
32 i2c0 = &i2c0;
33 i2c1 = &i2c1;
34 i2c2 = &i2c2;
35 i2s0 = &i2s0;
36 i2s1 = &i2s1;
37 i2s2 = &i2s2;
38 pinctrl0 = &pinctrl0;
39 spi0 = &spi0;
40 spi1 = &spi1;
41 };
42
43 cpus {
44 #address-cells = <1>;
45 #size-cells = <0>;
46
47 cpu@0 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a8";
50 reg = <0>;
51 };
52 };
53
54 soc {
55 compatible = "simple-bus";
56 #address-cells = <1>;
57 #size-cells = <1>;
58 ranges;
59
60 external-clocks {
61 compatible = "simple-bus";
62 #address-cells = <1>;
63 #size-cells = <0>;
64
65 xxti: oscillator@0 {
66 compatible = "fixed-clock";
67 reg = <0>;
68 clock-frequency = <0>;
69 clock-output-names = "xxti";
70 #clock-cells = <0>;
71 };
72
73 xusbxti: oscillator@1 {
74 compatible = "fixed-clock";
75 reg = <1>;
76 clock-frequency = <0>;
77 clock-output-names = "xusbxti";
78 #clock-cells = <0>;
79 };
80 };
81
82 onenand: onenand@b0000000 {
83 compatible = "samsung,s5pv210-onenand";
84 reg = <0xb0600000 0x2000>,
85 <0xb0000000 0x20000>,
86 <0xb0040000 0x20000>;
87 interrupt-parent = <&vic1>;
88 interrupts = <31>;
89 clocks = <&clocks CLK_NANDXL>, <&clocks DOUT_FLASH>;
90 clock-names = "bus", "onenand";
91 #address-cells = <1>;
92 #size-cells = <1>;
93 status = "disabled";
94 };
95
96 chipid@e0000000 {
97 compatible = "samsung,s5pv210-chipid";
98 reg = <0xe0000000 0x1000>;
99 };
100
101 clocks: clock-controller@e0100000 {
102 compatible = "samsung,s5pv210-clock", "simple-bus";
103 reg = <0xe0100000 0x10000>;
104 clock-names = "xxti", "xusbxti";
105 clocks = <&xxti>, <&xusbxti>;
106 #clock-cells = <1>;
107 #address-cells = <1>;
108 #size-cells = <1>;
109 ranges;
110
111 pmu_syscon: syscon@e0108000 {
112 compatible = "samsung-s5pv210-pmu", "syscon";
113 reg = <0xe0108000 0x8000>;
114 };
115 };
116
117 pinctrl0: pinctrl@e0200000 {
118 compatible = "samsung,s5pv210-pinctrl";
119 reg = <0xe0200000 0x1000>;
120 interrupt-parent = <&vic0>;
121 interrupts = <30>;
122
123 wakeup-interrupt-controller {
124 compatible = "samsung,exynos4210-wakeup-eint";
125 interrupts = <16>;
126 interrupt-parent = <&vic0>;
127 };
128 };
129
130 amba {
131 #address-cells = <1>;
132 #size-cells = <1>;
133 compatible = "arm,amba-bus";
134 ranges;
135
136 pdma0: dma@e0900000 {
137 compatible = "arm,pl330", "arm,primecell";
138 reg = <0xe0900000 0x1000>;
139 interrupt-parent = <&vic0>;
140 interrupts = <19>;
141 clocks = <&clocks CLK_PDMA0>;
142 clock-names = "apb_pclk";
143 #dma-cells = <1>;
144 #dma-channels = <8>;
145 #dma-requests = <32>;
146 };
147
148 pdma1: dma@e0a00000 {
149 compatible = "arm,pl330", "arm,primecell";
150 reg = <0xe0a00000 0x1000>;
151 interrupt-parent = <&vic0>;
152 interrupts = <20>;
153 clocks = <&clocks CLK_PDMA1>;
154 clock-names = "apb_pclk";
155 #dma-cells = <1>;
156 #dma-channels = <8>;
157 #dma-requests = <32>;
158 };
159 };
160
161 spi0: spi@e1300000 {
162 compatible = "samsung,s5pv210-spi";
163 reg = <0xe1300000 0x1000>;
164 interrupt-parent = <&vic1>;
165 interrupts = <15>;
166 dmas = <&pdma0 7>, <&pdma0 6>;
167 dma-names = "tx", "rx";
168 clocks = <&clocks SCLK_SPI0>, <&clocks CLK_SPI0>;
169 clock-names = "spi", "spi_busclk0";
170 pinctrl-names = "default";
171 pinctrl-0 = <&spi0_bus>;
172 #address-cells = <1>;
173 #size-cells = <0>;
174 status = "disabled";
175 };
176
177 spi1: spi@e1400000 {
178 compatible = "samsung,s5pv210-spi";
179 reg = <0xe1400000 0x1000>;
180 interrupt-parent = <&vic1>;
181 interrupts = <16>;
182 dmas = <&pdma1 7>, <&pdma1 6>;
183 dma-names = "tx", "rx";
184 clocks = <&clocks SCLK_SPI1>, <&clocks CLK_SPI1>;
185 clock-names = "spi", "spi_busclk0";
186 pinctrl-names = "default";
187 pinctrl-0 = <&spi1_bus>;
188 #address-cells = <1>;
189 #size-cells = <0>;
190 status = "disabled";
191 };
192
193 keypad: keypad@e1600000 {
194 compatible = "samsung,s5pv210-keypad";
195 reg = <0xe1600000 0x1000>;
196 interrupt-parent = <&vic2>;
197 interrupts = <25>;
198 clocks = <&clocks CLK_KEYIF>;
199 clock-names = "keypad";
200 status = "disabled";
201 };
202
203 i2c0: i2c@e1800000 {
204 compatible = "samsung,s3c2440-i2c";
205 reg = <0xe1800000 0x1000>;
206 interrupt-parent = <&vic1>;
207 interrupts = <14>;
208 clocks = <&clocks CLK_I2C0>;
209 clock-names = "i2c";
210 pinctrl-names = "default";
211 pinctrl-0 = <&i2c0_bus>;
212 #address-cells = <1>;
213 #size-cells = <0>;
214 status = "disabled";
215 };
216
217 i2c2: i2c@e1a00000 {
218 compatible = "samsung,s3c2440-i2c";
219 reg = <0xe1a00000 0x1000>;
220 interrupt-parent = <&vic1>;
221 interrupts = <19>;
222 clocks = <&clocks CLK_I2C2>;
223 clock-names = "i2c";
224 pinctrl-0 = <&i2c2_bus>;
225 pinctrl-names = "default";
226 #address-cells = <1>;
227 #size-cells = <0>;
228 status = "disabled";
229 };
230
231 audio-subsystem {
232 compatible = "samsung,s5pv210-audss", "simple-bus";
233 #address-cells = <1>;
234 #size-cells = <1>;
235 ranges;
236
237 clk_audss: clock-controller@eee10000 {
238 compatible = "samsung,s5pv210-audss-clock";
239 reg = <0xeee10000 0x1000>;
240 clock-names = "hclk", "xxti",
241 "fout_epll",
242 "sclk_audio0";
243 clocks = <&clocks DOUT_HCLKP>, <&xxti>,
244 <&clocks FOUT_EPLL>,
245 <&clocks SCLK_AUDIO0>;
246 #clock-cells = <1>;
247 };
248
249 i2s0: i2s@eee30000 {
250 compatible = "samsung,s5pv210-i2s";
251 reg = <0xeee30000 0x1000>;
252 interrupt-parent = <&vic2>;
253 interrupts = <16>;
254 dma-names = "rx", "tx", "tx-sec";
255 dmas = <&pdma1 9>, <&pdma1 10>, <&pdma1 11>;
256 clock-names = "iis",
257 "i2s_opclk0",
258 "i2s_opclk1";
259 clocks = <&clk_audss CLK_I2S>,
260 <&clk_audss CLK_I2S>,
261 <&clk_audss CLK_DOUT_AUD_BUS>;
262 samsung,idma-addr = <0xc0010000>;
263 pinctrl-names = "default";
264 pinctrl-0 = <&i2s0_bus>;
265 #sound-dai-cells = <0>;
266 status = "disabled";
267 };
268 };
269
270 i2s1: i2s@e2100000 {
271 compatible = "samsung,s3c6410-i2s";
272 reg = <0xe2100000 0x1000>;
273 interrupt-parent = <&vic2>;
274 interrupts = <17>;
275 dma-names = "rx", "tx";
276 dmas = <&pdma1 12>, <&pdma1 13>;
277 clock-names = "iis", "i2s_opclk0";
278 clocks = <&clocks CLK_I2S1>, <&clocks SCLK_AUDIO1>;
279 pinctrl-names = "default";
280 pinctrl-0 = <&i2s1_bus>;
281 #sound-dai-cells = <0>;
282 status = "disabled";
283 };
284
285 i2s2: i2s@e2a00000 {
286 compatible = "samsung,s3c6410-i2s";
287 reg = <0xe2a00000 0x1000>;
288 interrupt-parent = <&vic2>;
289 interrupts = <18>;
290 dma-names = "rx", "tx";
291 dmas = <&pdma1 14>, <&pdma1 15>;
292 clock-names = "iis", "i2s_opclk0";
293 clocks = <&clocks CLK_I2S2>, <&clocks SCLK_AUDIO2>;
294 pinctrl-names = "default";
295 pinctrl-0 = <&i2s2_bus>;
296 #sound-dai-cells = <0>;
297 status = "disabled";
298 };
299
300 pwm: pwm@e2500000 {
301 compatible = "samsung,s5pc100-pwm";
302 reg = <0xe2500000 0x1000>;
303 interrupt-parent = <&vic0>;
304 interrupts = <21>, <22>, <23>, <24>, <25>;
305 clock-names = "timers";
306 clocks = <&clocks CLK_PWM>;
307 #pwm-cells = <3>;
308 };
309
310 watchdog: watchdog@e2700000 {
311 compatible = "samsung,s3c2410-wdt";
312 reg = <0xe2700000 0x1000>;
313 interrupt-parent = <&vic0>;
314 interrupts = <26>;
315 clock-names = "watchdog";
316 clocks = <&clocks CLK_WDT>;
317 };
318
319 rtc: rtc@e2800000 {
320 compatible = "samsung,s3c6410-rtc";
321 reg = <0xe2800000 0x100>;
322 interrupt-parent = <&vic0>;
323 interrupts = <28>, <29>;
324 clocks = <&clocks CLK_RTC>;
325 clock-names = "rtc";
326 status = "disabled";
327 };
328
329 uart0: serial@e2900000 {
330 compatible = "samsung,s5pv210-uart";
331 reg = <0xe2900000 0x400>;
332 interrupt-parent = <&vic1>;
333 interrupts = <10>;
334 clock-names = "uart", "clk_uart_baud0",
335 "clk_uart_baud1";
336 clocks = <&clocks CLK_UART0>, <&clocks CLK_UART0>,
337 <&clocks SCLK_UART0>;
338 status = "disabled";
339 };
340
341 uart1: serial@e2900400 {
342 compatible = "samsung,s5pv210-uart";
343 reg = <0xe2900400 0x400>;
344 interrupt-parent = <&vic1>;
345 interrupts = <11>;
346 clock-names = "uart", "clk_uart_baud0",
347 "clk_uart_baud1";
348 clocks = <&clocks CLK_UART1>, <&clocks CLK_UART1>,
349 <&clocks SCLK_UART1>;
350 status = "disabled";
351 };
352
353 uart2: serial@e2900800 {
354 compatible = "samsung,s5pv210-uart";
355 reg = <0xe2900800 0x400>;
356 interrupt-parent = <&vic1>;
357 interrupts = <12>;
358 clock-names = "uart", "clk_uart_baud0",
359 "clk_uart_baud1";
360 clocks = <&clocks CLK_UART2>, <&clocks CLK_UART2>,
361 <&clocks SCLK_UART2>;
362 status = "disabled";
363 };
364
365 uart3: serial@e2900c00 {
366 compatible = "samsung,s5pv210-uart";
367 reg = <0xe2900c00 0x400>;
368 interrupt-parent = <&vic1>;
369 interrupts = <13>;
370 clock-names = "uart", "clk_uart_baud0",
371 "clk_uart_baud1";
372 clocks = <&clocks CLK_UART3>, <&clocks CLK_UART3>,
373 <&clocks SCLK_UART3>;
374 status = "disabled";
375 };
376
377 sdhci0: sdhci@eb000000 {
378 compatible = "samsung,s3c6410-sdhci";
379 reg = <0xeb000000 0x100000>;
380 interrupt-parent = <&vic1>;
381 interrupts = <26>;
382 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
383 clocks = <&clocks CLK_HSMMC0>, <&clocks CLK_HSMMC0>,
384 <&clocks SCLK_MMC0>;
385 status = "disabled";
386 };
387
388 sdhci1: sdhci@eb100000 {
389 compatible = "samsung,s3c6410-sdhci";
390 reg = <0xeb100000 0x100000>;
391 interrupt-parent = <&vic1>;
392 interrupts = <27>;
393 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
394 clocks = <&clocks CLK_HSMMC1>, <&clocks CLK_HSMMC1>,
395 <&clocks SCLK_MMC1>;
396 status = "disabled";
397 };
398
399 sdhci2: sdhci@eb200000 {
400 compatible = "samsung,s3c6410-sdhci";
401 reg = <0xeb200000 0x100000>;
402 interrupt-parent = <&vic1>;
403 interrupts = <28>;
404 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.2";
405 clocks = <&clocks CLK_HSMMC2>, <&clocks CLK_HSMMC2>,
406 <&clocks SCLK_MMC2>;
407 status = "disabled";
408 };
409
410 sdhci3: sdhci@eb300000 {
411 compatible = "samsung,s3c6410-sdhci";
412 reg = <0xeb300000 0x100000>;
413 interrupt-parent = <&vic3>;
414 interrupts = <2>;
415 clock-names = "hsmmc", "mmc_busclk.0", "mmc_busclk.3";
416 clocks = <&clocks CLK_HSMMC3>, <&clocks CLK_HSMMC3>,
417 <&clocks SCLK_MMC3>;
418 status = "disabled";
419 };
420
421 hsotg: hsotg@ec000000 {
422 compatible = "samsung,s3c6400-hsotg";
423 reg = <0xec000000 0x20000>;
424 interrupt-parent = <&vic1>;
425 interrupts = <24>;
426 clocks = <&clocks CLK_USB_OTG>;
427 clock-names = "otg";
428 phy-names = "usb2-phy";
429 phys = <&usbphy 0>;
430 status = "disabled";
431 };
432
433 usbphy: usbphy@ec100000 {
434 compatible = "samsung,s5pv210-usb2-phy";
435 reg = <0xec100000 0x100>;
436 samsung,pmureg-phandle = <&pmu_syscon>;
437 clocks = <&clocks CLK_USB_OTG>, <&xusbxti>;
438 clock-names = "phy", "ref";
439 #phy-cells = <1>;
440 status = "disabled";
441 };
442
443 ehci: ehci@ec200000 {
444 compatible = "samsung,exynos4210-ehci";
445 reg = <0xec200000 0x100>;
446 interrupts = <23>;
447 interrupt-parent = <&vic1>;
448 clocks = <&clocks CLK_USB_HOST>;
449 clock-names = "usbhost";
450 #address-cells = <1>;
451 #size-cells = <0>;
452 status = "disabled";
453
454 port@0 {
455 reg = <0>;
456 phys = <&usbphy 1>;
457 };
458 };
459
460 ohci: ohci@ec300000 {
461 compatible = "samsung,exynos4210-ohci";
462 reg = <0xec300000 0x100>;
463 interrupts = <23>;
464 clocks = <&clocks CLK_USB_HOST>;
465 clock-names = "usbhost";
466 #address-cells = <1>;
467 #size-cells = <0>;
468 status = "disabled";
469
470 port@0 {
471 reg = <0>;
472 phys = <&usbphy 1>;
473 };
474 };
475
476 mfc: codec@f1700000 {
477 compatible = "samsung,mfc-v5";
478 reg = <0xf1700000 0x10000>;
479 interrupt-parent = <&vic2>;
480 interrupts = <14>;
481 clocks = <&clocks DOUT_MFC>, <&clocks CLK_MFC>;
482 clock-names = "sclk_mfc", "mfc";
483 };
484
485 vic0: interrupt-controller@f2000000 {
486 compatible = "arm,pl192-vic";
487 interrupt-controller;
488 reg = <0xf2000000 0x1000>;
489 #interrupt-cells = <1>;
490 };
491
492 vic1: interrupt-controller@f2100000 {
493 compatible = "arm,pl192-vic";
494 interrupt-controller;
495 reg = <0xf2100000 0x1000>;
496 #interrupt-cells = <1>;
497 };
498
499 vic2: interrupt-controller@f2200000 {
500 compatible = "arm,pl192-vic";
501 interrupt-controller;
502 reg = <0xf2200000 0x1000>;
503 #interrupt-cells = <1>;
504 };
505
506 vic3: interrupt-controller@f2300000 {
507 compatible = "arm,pl192-vic";
508 interrupt-controller;
509 reg = <0xf2300000 0x1000>;
510 #interrupt-cells = <1>;
511 };
512
513 fimd: fimd@f8000000 {
514 compatible = "samsung,exynos4210-fimd";
515 interrupt-parent = <&vic2>;
516 reg = <0xf8000000 0x20000>;
517 interrupt-names = "fifo", "vsync", "lcd_sys";
518 interrupts = <0>, <1>, <2>;
519 clocks = <&clocks SCLK_FIMD>, <&clocks CLK_FIMD>;
520 clock-names = "sclk_fimd", "fimd";
521 status = "disabled";
522 };
523
524 g2d: g2d@fa000000 {
525 compatible = "samsung,s5pv210-g2d";
526 reg = <0xfa000000 0x1000>;
527 interrupt-parent = <&vic2>;
528 interrupts = <9>;
529 clocks = <&clocks DOUT_G2D>, <&clocks CLK_G2D>;
530 clock-names = "sclk_fimg2d", "fimg2d";
531 };
532
533 mdma1: mdma@fa200000 {
534 compatible = "arm,pl330", "arm,primecell";
535 reg = <0xfa200000 0x1000>;
536 interrupt-parent = <&vic0>;
537 interrupts = <18>;
538 clocks = <&clocks CLK_MDMA>;
539 clock-names = "apb_pclk";
540 #dma-cells = <1>;
541 #dma-channels = <8>;
542 #dma-requests = <1>;
543 };
544
545 i2c1: i2c@fab00000 {
546 compatible = "samsung,s3c2440-i2c";
547 reg = <0xfab00000 0x1000>;
548 interrupt-parent = <&vic2>;
549 interrupts = <13>;
550 clocks = <&clocks CLK_I2C1>;
551 clock-names = "i2c";
552 pinctrl-names = "default";
553 pinctrl-0 = <&i2c1_bus>;
554 #address-cells = <1>;
555 #size-cells = <0>;
556 status = "disabled";
557 };
558
559 camera: camera {
560 compatible = "samsung,fimc", "simple-bus";
561 pinctrl-names = "default";
562 pinctrl-0 = <>;
563 clocks = <&clocks SCLK_CAM0>, <&clocks SCLK_CAM1>;
564 clock-names = "sclk_cam0", "sclk_cam1";
565 #address-cells = <1>;
566 #size-cells = <1>;
567 ranges;
568
569 clock_cam: clock-controller {
570 #clock-cells = <1>;
571 };
572
573 csis0: csis@fa600000 {
574 compatible = "samsung,s5pv210-csis";
575 reg = <0xfa600000 0x4000>;
576 interrupt-parent = <&vic2>;
577 interrupts = <29>;
578 clocks = <&clocks CLK_CSIS>,
579 <&clocks SCLK_CSIS>;
580 clock-names = "clk_csis",
581 "sclk_csis";
582 bus-width = <4>;
583 status = "disabled";
584 #address-cells = <1>;
585 #size-cells = <0>;
586 };
587
588 fimc0: fimc@fb200000 {
589 compatible = "samsung,s5pv210-fimc";
590 reg = <0xfb200000 0x1000>;
591 interrupts = <5>;
592 interrupt-parent = <&vic2>;
593 clocks = <&clocks CLK_FIMC0>,
594 <&clocks SCLK_FIMC0>;
595 clock-names = "fimc",
596 "sclk_fimc";
597 samsung,pix-limits = <4224 8192 1920 4224>;
598 samsung,mainscaler-ext;
599 samsung,cam-if;
600 };
601
602 fimc1: fimc@fb300000 {
603 compatible = "samsung,s5pv210-fimc";
604 reg = <0xfb300000 0x1000>;
605 interrupt-parent = <&vic2>;
606 interrupts = <6>;
607 clocks = <&clocks CLK_FIMC1>,
608 <&clocks SCLK_FIMC1>;
609 clock-names = "fimc",
610 "sclk_fimc";
611 samsung,pix-limits = <4224 8192 1920 4224>;
612 samsung,mainscaler-ext;
613 samsung,cam-if;
614 };
615
616 fimc2: fimc@fb400000 {
617 compatible = "samsung,s5pv210-fimc";
618 reg = <0xfb400000 0x1000>;
619 interrupt-parent = <&vic2>;
620 interrupts = <7>;
621 clocks = <&clocks CLK_FIMC2>,
622 <&clocks SCLK_FIMC2>;
623 clock-names = "fimc",
624 "sclk_fimc";
625 samsung,pix-limits = <4224 8192 1920 4224>;
626 samsung,mainscaler-ext;
627 samsung,lcd-wb;
628 };
629 };
630 };
631};
632
633#include "s5pv210-pinctrl.dtsi"
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index e0b15a6e8897..45013b867c8d 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -58,19 +58,19 @@
58 reg = <0x20000000 0x8000000>; 58 reg = <0x20000000 0x8000000>;
59 }; 59 };
60 60
61 slow_xtal: slow_xtal { 61 clocks {
62 compatible = "fixed-clock"; 62 slow_xtal: slow_xtal {
63 #clock-cells = <0>; 63 compatible = "fixed-clock";
64 clock-frequency = <0>; 64 #clock-cells = <0>;
65 }; 65 clock-frequency = <0>;
66 };
66 67
67 main_xtal: main_xtal { 68 main_xtal: main_xtal {
68 compatible = "fixed-clock"; 69 compatible = "fixed-clock";
69 #clock-cells = <0>; 70 #clock-cells = <0>;
70 clock-frequency = <0>; 71 clock-frequency = <0>;
71 }; 72 };
72 73
73 clocks {
74 adc_op_clk: adc_op_clk{ 74 adc_op_clk: adc_op_clk{
75 compatible = "fixed-clock"; 75 compatible = "fixed-clock";
76 #clock-cells = <0>; 76 #clock-cells = <0>;
diff --git a/arch/arm/boot/dts/sama5d3_gmac.dtsi b/arch/arm/boot/dts/sama5d3_gmac.dtsi
index a6cb0508762f..de5ed59fb446 100644
--- a/arch/arm/boot/dts/sama5d3_gmac.dtsi
+++ b/arch/arm/boot/dts/sama5d3_gmac.dtsi
@@ -74,7 +74,7 @@
74 }; 74 };
75 75
76 macb0: ethernet@f0028000 { 76 macb0: ethernet@f0028000 {
77 compatible = "cdns,pc302-gem", "cdns,gem"; 77 compatible = "atmel,sama5d3-gem";
78 reg = <0xf0028000 0x100>; 78 reg = <0xf0028000 0x100>;
79 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>; 79 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
80 pinctrl-names = "default"; 80 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
index b0b1331c1974..f7d8583eef82 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -18,12 +18,14 @@
18 reg = <0x20000000 0x20000000>; 18 reg = <0x20000000 0x20000000>;
19 }; 19 };
20 20
21 slow_xtal { 21 clocks {
22 clock-frequency = <32768>; 22 slow_xtal {
23 }; 23 clock-frequency = <32768>;
24 };
24 25
25 main_xtal { 26 main_xtal {
26 clock-frequency = <12000000>; 27 clock-frequency = <12000000>;
28 };
27 }; 29 };
28 30
29 ahb { 31 ahb {
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index 306eef0f97ef..b8c6f20e780c 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -45,6 +45,8 @@
45 wm8904: wm8904@1a { 45 wm8904: wm8904@1a {
46 compatible = "wm8904"; 46 compatible = "wm8904";
47 reg = <0x1a>; 47 reg = <0x1a>;
48 clocks = <&pck0>;
49 clock-names = "mclk";
48 }; 50 };
49 }; 51 };
50 52
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index a99171c8a782..18662aec2ec4 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -21,6 +21,10 @@
21 model = "KZM-A9-GT"; 21 model = "KZM-A9-GT";
22 compatible = "renesas,kzm9g-reference", "renesas,sh73a0"; 22 compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
23 23
24 aliases {
25 serial4 = &scifa4;
26 };
27
24 cpus { 28 cpus {
25 cpu@0 { 29 cpu@0 {
26 cpu0-supply = <&vdd_dvfs>; 30 cpu0-supply = <&vdd_dvfs>;
@@ -35,7 +39,7 @@
35 }; 39 };
36 40
37 chosen { 41 chosen {
38 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200 rw"; 42 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel rw";
39 }; 43 };
40 44
41 memory { 45 memory {
@@ -276,9 +280,6 @@
276}; 280};
277 281
278&pfc { 282&pfc {
279 pinctrl-0 = <&scifa4_pins>;
280 pinctrl-names = "default";
281
282 i2c3_pins: i2c3 { 283 i2c3_pins: i2c3 {
283 renesas,groups = "i2c3_1"; 284 renesas,groups = "i2c3_1";
284 renesas,function = "i2c3"; 285 renesas,function = "i2c3";
@@ -318,6 +319,13 @@
318 }; 319 };
319}; 320};
320 321
322&scifa4 {
323 pinctrl-0 = <&scifa4_pins>;
324 pinctrl-names = "default";
325
326 status = "okay";
327};
328
321&sdhi0 { 329&sdhi0 {
322 pinctrl-0 = <&sdhi0_pins>; 330 pinctrl-0 = <&sdhi0_pins>;
323 pinctrl-names = "default"; 331 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 5ecf552e1c00..910b79079d5a 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -235,6 +235,78 @@
235 status = "disabled"; 235 status = "disabled";
236 }; 236 };
237 237
238 scifa0: serial@e6c40000 {
239 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
240 reg = <0xe6c40000 0x100>;
241 interrupt-parent = <&gic>;
242 interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
243 status = "disabled";
244 };
245
246 scifa1: serial@e6c50000 {
247 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
248 reg = <0xe6c50000 0x100>;
249 interrupt-parent = <&gic>;
250 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
251 status = "disabled";
252 };
253
254 scifa2: serial@e6c60000 {
255 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
256 reg = <0xe6c60000 0x100>;
257 interrupt-parent = <&gic>;
258 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
259 status = "disabled";
260 };
261
262 scifa3: serial@e6c70000 {
263 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
264 reg = <0xe6c70000 0x100>;
265 interrupt-parent = <&gic>;
266 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
267 status = "disabled";
268 };
269
270 scifa4: serial@e6c80000 {
271 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
272 reg = <0xe6c80000 0x100>;
273 interrupt-parent = <&gic>;
274 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
275 status = "disabled";
276 };
277
278 scifa5: serial@e6cb0000 {
279 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
280 reg = <0xe6cb0000 0x100>;
281 interrupt-parent = <&gic>;
282 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
283 status = "disabled";
284 };
285
286 scifa6: serial@e6cc0000 {
287 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
288 reg = <0xe6cc0000 0x100>;
289 interrupt-parent = <&gic>;
290 interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
291 status = "disabled";
292 };
293
294 scifa7: serial@e6cd0000 {
295 compatible = "renesas,scifa-sh73a0", "renesas,scifa";
296 reg = <0xe6cd0000 0x100>;
297 interrupt-parent = <&gic>;
298 interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>;
299 status = "disabled";
300 };
301
302 scifb8: serial@e6c30000 {
303 compatible = "renesas,scifb-sh73a0", "renesas,scifb";
304 reg = <0xe6c30000 0x100>;
305 interrupt-parent = <&gic>;
306 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
307 status = "disabled";
308 };
309
238 pfc: pfc@e6050000 { 310 pfc: pfc@e6050000 {
239 compatible = "renesas,pfc-sh73a0"; 311 compatible = "renesas,pfc-sh73a0";
240 reg = <0xe6050000 0x8000>, 312 reg = <0xe6050000 0x8000>,
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 4676f25e87a7..4d77ad690ed5 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -486,6 +486,8 @@
486 clock-names = "stmmaceth"; 486 clock-names = "stmmaceth";
487 resets = <&rst EMAC0_RESET>; 487 resets = <&rst EMAC0_RESET>;
488 reset-names = "stmmaceth"; 488 reset-names = "stmmaceth";
489 snps,multicast-filter-bins = <256>;
490 snps,perfect-filter-entries = <128>;
489 status = "disabled"; 491 status = "disabled";
490 }; 492 };
491 493
@@ -500,6 +502,8 @@
500 clock-names = "stmmaceth"; 502 clock-names = "stmmaceth";
501 resets = <&rst EMAC1_RESET>; 503 resets = <&rst EMAC1_RESET>;
502 reset-names = "stmmaceth"; 504 reset-names = "stmmaceth";
505 snps,multicast-filter-bins = <256>;
506 snps,perfect-filter-entries = <128>;
503 status = "disabled"; 507 status = "disabled";
504 }; 508 };
505 509
@@ -683,6 +687,7 @@
683 }; 687 };
684 688
685 rst: rstmgr@ffd05000 { 689 rst: rstmgr@ffd05000 {
690 #reset-cells = <1>;
686 compatible = "altr,rst-mgr"; 691 compatible = "altr,rst-mgr";
687 reg = <0xffd05000 0x1000>; 692 reg = <0xffd05000 0x1000>;
688 }; 693 };
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
index b56a801e42a2..d42c84b1df8d 100644
--- a/arch/arm/boot/dts/spear1310-evb.dts
+++ b/arch/arm/boot/dts/spear1310-evb.dts
@@ -106,6 +106,10 @@
106 status = "okay"; 106 status = "okay";
107 }; 107 };
108 108
109 miphy@eb800000 {
110 status = "okay";
111 };
112
109 cf@b2800000 { 113 cf@b2800000 {
110 status = "okay"; 114 status = "okay";
111 }; 115 };
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 122ae94076c8..fa5f2bb5f106 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -29,24 +29,111 @@
29 #gpio-cells = <2>; 29 #gpio-cells = <2>;
30 }; 30 };
31 31
32 ahci@b1000000 { 32 miphy0: miphy@eb800000 {
33 compatible = "st,spear1310-miphy";
34 reg = <0xeb800000 0x4000>;
35 misc = <&misc>;
36 phy-id = <0>;
37 #phy-cells = <1>;
38 status = "disabled";
39 };
40
41 miphy1: miphy@eb804000 {
42 compatible = "st,spear1310-miphy";
43 reg = <0xeb804000 0x4000>;
44 misc = <&misc>;
45 phy-id = <1>;
46 #phy-cells = <1>;
47 status = "disabled";
48 };
49
50 miphy2: miphy@eb808000 {
51 compatible = "st,spear1310-miphy";
52 reg = <0xeb808000 0x4000>;
53 misc = <&misc>;
54 phy-id = <2>;
55 #phy-cells = <1>;
56 status = "disabled";
57 };
58
59 ahci0: ahci@b1000000 {
33 compatible = "snps,spear-ahci"; 60 compatible = "snps,spear-ahci";
34 reg = <0xb1000000 0x10000>; 61 reg = <0xb1000000 0x10000>;
35 interrupts = <0 68 0x4>; 62 interrupts = <0 68 0x4>;
63 phys = <&miphy0 0>;
64 phy-names = "sata-phy";
36 status = "disabled"; 65 status = "disabled";
37 }; 66 };
38 67
39 ahci@b1800000 { 68 ahci1: ahci@b1800000 {
40 compatible = "snps,spear-ahci"; 69 compatible = "snps,spear-ahci";
41 reg = <0xb1800000 0x10000>; 70 reg = <0xb1800000 0x10000>;
42 interrupts = <0 69 0x4>; 71 interrupts = <0 69 0x4>;
72 phys = <&miphy1 0>;
73 phy-names = "sata-phy";
43 status = "disabled"; 74 status = "disabled";
44 }; 75 };
45 76
46 ahci@b4000000 { 77 ahci2: ahci@b4000000 {
47 compatible = "snps,spear-ahci"; 78 compatible = "snps,spear-ahci";
48 reg = <0xb4000000 0x10000>; 79 reg = <0xb4000000 0x10000>;
49 interrupts = <0 70 0x4>; 80 interrupts = <0 70 0x4>;
81 phys = <&miphy2 0>;
82 phy-names = "sata-phy";
83 status = "disabled";
84 };
85
86 pcie0: pcie@b1000000 {
87 compatible = "st,spear1340-pcie", "snps,dw-pcie";
88 reg = <0xb1000000 0x4000>;
89 interrupts = <0 68 0x4>;
90 interrupt-map-mask = <0 0 0 0>;
91 interrupt-map = <0x0 0 &gic 0 68 0x4>;
92 num-lanes = <1>;
93 phys = <&miphy0 1>;
94 phy-names = "pcie-phy";
95 #address-cells = <3>;
96 #size-cells = <2>;
97 device_type = "pci";
98 ranges = <0x00000800 0 0x80000000 0x80000000 0 0x00020000 /* configuration space */
99 0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
100 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
101 status = "disabled";
102 };
103
104 pcie1: pcie@b1800000 {
105 compatible = "st,spear1340-pcie", "snps,dw-pcie";
106 reg = <0xb1800000 0x4000>;
107 interrupts = <0 69 0x4>;
108 interrupt-map-mask = <0 0 0 0>;
109 interrupt-map = <0x0 0 &gic 0 69 0x4>;
110 num-lanes = <1>;
111 phys = <&miphy1 1>;
112 phy-names = "pcie-phy";
113 #address-cells = <3>;
114 #size-cells = <2>;
115 device_type = "pci";
116 ranges = <0x00000800 0 0x90000000 0x90000000 0 0x00020000 /* configuration space */
117 0x81000000 0 0 0x90020000 0 0x00010000 /* downstream I/O */
118 0x82000000 0 0x90030000 0x90030000 0 0x0ffd0000>; /* non-prefetchable memory */
119 status = "disabled";
120 };
121
122 pcie2: pcie@b4000000 {
123 compatible = "st,spear1340-pcie", "snps,dw-pcie";
124 reg = <0xb4000000 0x4000>;
125 interrupts = <0 70 0x4>;
126 interrupt-map-mask = <0 0 0 0>;
127 interrupt-map = <0x0 0 &gic 0 70 0x4>;
128 num-lanes = <1>;
129 phys = <&miphy2 1>;
130 phy-names = "pcie-phy";
131 #address-cells = <3>;
132 #size-cells = <2>;
133 device_type = "pci";
134 ranges = <0x00000800 0 0xc0000000 0xc0000000 0 0x00020000 /* configuration space */
135 0x81000000 0 0 0xc0020000 0 0x00010000 /* downstream I/O */
136 0x82000000 0 0xc0030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
50 status = "disabled"; 137 status = "disabled";
51 }; 138 };
52 139
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts
index d6c30ae0a8d7..b23e05ed1d60 100644
--- a/arch/arm/boot/dts/spear1340-evb.dts
+++ b/arch/arm/boot/dts/spear1340-evb.dts
@@ -122,6 +122,10 @@
122 status = "okay"; 122 status = "okay";
123 }; 123 };
124 124
125 miphy@eb800000 {
126 status = "okay";
127 };
128
125 dma@ea800000 { 129 dma@ea800000 {
126 status = "okay"; 130 status = "okay";
127 }; 131 };
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 54d128d35681..e71df0f2cb52 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -31,10 +31,38 @@
31 status = "disabled"; 31 status = "disabled";
32 }; 32 };
33 33
34 ahci@b1000000 { 34 miphy0: miphy@eb800000 {
35 compatible = "st,spear1340-miphy";
36 reg = <0xeb800000 0x4000>;
37 misc = <&misc>;
38 #phy-cells = <1>;
39 status = "disabled";
40 };
41
42 ahci0: ahci@b1000000 {
35 compatible = "snps,spear-ahci"; 43 compatible = "snps,spear-ahci";
36 reg = <0xb1000000 0x10000>; 44 reg = <0xb1000000 0x10000>;
37 interrupts = <0 72 0x4>; 45 interrupts = <0 72 0x4>;
46 phys = <&miphy0 0>;
47 phy-names = "sata-phy";
48 status = "disabled";
49 };
50
51 pcie0: pcie@b1000000 {
52 compatible = "st,spear1340-pcie", "snps,dw-pcie";
53 reg = <0xb1000000 0x4000>;
54 interrupts = <0 68 0x4>;
55 interrupt-map-mask = <0 0 0 0>;
56 interrupt-map = <0x0 0 &gic 0 68 0x4>;
57 num-lanes = <1>;
58 phys = <&miphy0 1>;
59 phy-names = "pcie-phy";
60 #address-cells = <3>;
61 #size-cells = <2>;
62 device_type = "pci";
63 ranges = <0x00000800 0 0x80000000 0x80000000 0 0x00020000 /* configuration space */
64 0x81000000 0 0 0x80020000 0 0x00010000 /* downstream I/O */
65 0x82000000 0 0x80030000 0xc0030000 0 0x0ffd0000>; /* non-prefetchable memory */
38 status = "disabled"; 66 status = "disabled";
39 }; 67 };
40 68
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
index 4382547df58a..a6eb5436d26d 100644
--- a/arch/arm/boot/dts/spear13xx.dtsi
+++ b/arch/arm/boot/dts/spear13xx.dtsi
@@ -83,8 +83,8 @@
83 #size-cells = <1>; 83 #size-cells = <1>;
84 compatible = "simple-bus"; 84 compatible = "simple-bus";
85 ranges = <0x50000000 0x50000000 0x10000000 85 ranges = <0x50000000 0x50000000 0x10000000
86 0xb0000000 0xb0000000 0x10000000 86 0x80000000 0x80000000 0x20000000
87 0xd0000000 0xd0000000 0x02000000 87 0xb0000000 0xb0000000 0x22000000
88 0xd8000000 0xd8000000 0x01000000 88 0xd8000000 0xd8000000 0x01000000
89 0xe0000000 0xe0000000 0x10000000>; 89 0xe0000000 0xe0000000 0x10000000>;
90 90
@@ -220,6 +220,11 @@
220 0xd8000000 0xd8000000 0x01000000 220 0xd8000000 0xd8000000 0x01000000
221 0xe0000000 0xe0000000 0x10000000>; 221 0xe0000000 0xe0000000 0x10000000>;
222 222
223 misc: syscon@e0700000 {
224 compatible = "st,spear1340-misc", "syscon";
225 reg = <0xe0700000 0x1000>;
226 };
227
223 gpio0: gpio@e0600000 { 228 gpio0: gpio@e0600000 {
224 compatible = "arm,pl061", "arm,primecell"; 229 compatible = "arm,pl061", "arm,primecell";
225 reg = <0xe0600000 0x1000>; 230 reg = <0xe0600000 0x1000>;
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index e41eedca3ce3..9d2323020d34 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -875,6 +875,10 @@
875 reg = <0x80119000 0x1000>; 875 reg = <0x80119000 0x1000>;
876 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>; 876 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>;
877 877
878 dmas = <&dma 41 0 0x2>, /* Logical - DevToMem */
879 <&dma 41 0 0x0>; /* Logical - MemToDev */
880 dma-names = "rx", "tx";
881
878 clocks = <&prcc_kclk 2 5>, <&prcc_pclk 2 7>; 882 clocks = <&prcc_kclk 2 5>, <&prcc_pclk 2 7>;
879 clock-names = "sdi", "apb_pclk"; 883 clock-names = "sdi", "apb_pclk";
880 884
@@ -901,6 +905,10 @@
901 reg = <0x80008000 0x1000>; 905 reg = <0x80008000 0x1000>;
902 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>; 906 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
903 907
908 dmas = <&dma 43 0 0x2>, /* Logical - DevToMem */
909 <&dma 43 0 0x0>; /* Logical - MemToDev */
910 dma-names = "rx", "tx";
911
904 clocks = <&prcc_kclk 3 7>, <&prcc_pclk 3 7>; 912 clocks = <&prcc_kclk 3 7>, <&prcc_pclk 3 7>;
905 clock-names = "sdi", "apb_pclk"; 913 clock-names = "sdi", "apb_pclk";
906 914
@@ -929,6 +937,7 @@
929 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 937 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
930 v-ape-supply = <&db8500_vape_reg>; 938 v-ape-supply = <&db8500_vape_reg>;
931 939
940 /* This DMA channel only exist on DB8500 v1 */
932 dmas = <&dma 30 0 0x10>; /* Logical - MemToDev - HighPrio */ 941 dmas = <&dma 30 0 0x10>; /* Logical - MemToDev - HighPrio */
933 dma-names = "tx"; 942 dma-names = "tx";
934 943
@@ -962,6 +971,7 @@
962 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 971 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
963 v-ape-supply = <&db8500_vape_reg>; 972 v-ape-supply = <&db8500_vape_reg>;
964 973
974 /* This DMA channel only exist on DB8500 v2 */
965 dmas = <&dma 30 0 0x12>; /* Logical - DevToMem - HighPrio */ 975 dmas = <&dma 30 0 0x12>; /* Logical - DevToMem - HighPrio */
966 dma-names = "rx"; 976 dma-names = "rx";
967 977
diff --git a/arch/arm/boot/dts/ste-href-stuib.dtsi b/arch/arm/boot/dts/ste-href-stuib.dtsi
index 1c3574435ea8..84d7c5d883f2 100644
--- a/arch/arm/boot/dts/ste-href-stuib.dtsi
+++ b/arch/arm/boot/dts/ste-href-stuib.dtsi
@@ -42,6 +42,8 @@
42 interrupts = <26 IRQ_TYPE_EDGE_FALLING>; 42 interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
43 interrupt-parent = <&gpio6>; 43 interrupt-parent = <&gpio6>;
44 interrupt-controller; 44 interrupt-controller;
45 vcc-supply = <&db8500_vsmps2_reg>;
46 vio-supply = <&db8500_vsmps2_reg>;
45 47
46 wakeup-source; 48 wakeup-source;
47 st,autosleep-timeout = <1024>; 49 st,autosleep-timeout = <1024>;
diff --git a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
index c40565320978..18b65d1b14f2 100644
--- a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
+++ b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
@@ -88,6 +88,43 @@
88 }; 88 };
89 }; 89 };
90 }; 90 };
91 /* Sensors mounted on this board variant */
92 i2c@80128000 {
93 lsm303dlh@18 {
94 /* Accelerometer */
95 compatible = "st,lsm303dlh-accel";
96 st,drdy-int-pin = <1>;
97 reg = <0x18>;
98 vdd-supply = <&ab8500_ldo_aux1_reg>;
99 vddio-supply = <&db8500_vsmps2_reg>;
100 pinctrl-names = "default";
101 pinctrl-0 = <&accel_tvk_mode>;
102 };
103 lsm303dlm@1e {
104 /* Magnetometer */
105 compatible = "st,lsm303dlm-magn";
106 reg = <0x1e>;
107 vdd-supply = <&ab8500_ldo_aux1_reg>;
108 vddio-supply = <&db8500_vsmps2_reg>;
109 pinctrl-names = "default";
110 pinctrl-0 = <&magneto_tvk_mode>;
111 };
112 l3g4200d@68 {
113 /* Gyroscope */
114 compatible = "st,l3g4200d-gyro";
115 st,drdy-int-pin = <2>;
116 reg = <0x68>;
117 vdd-supply = <&ab8500_ldo_aux1_reg>;
118 vddio-supply = <&db8500_vsmps2_reg>;
119 };
120 lsp001wm@5c {
121 /* Barometer/pressure sensor */
122 compatible = "st,lps001wp-press";
123 reg = <0x5c>;
124 vdd-supply = <&ab8500_ldo_aux1_reg>;
125 vddio-supply = <&db8500_vsmps2_reg>;
126 };
127 };
91 pinctrl { 128 pinctrl {
92 /* Pull up this GPIO pin */ 129 /* Pull up this GPIO pin */
93 tc35893 { 130 tc35893 {
@@ -114,6 +151,28 @@
114 }; 151 };
115 }; 152 };
116 }; 153 };
154 accelerometer {
155 accel_tvk_mode: accel_tvk {
156 /* Accelerometer interrupt lines 1 & 2 */
157 tvk_cfg {
158 ste,pins = "GPIO82_C1", "GPIO83_D3";
159 ste,config = <&gpio_in_pu>;
160 };
161 };
162 };
163 magnetometer {
164 magneto_tvk_mode: magneto_tvk {
165 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
166 tvk_cfg1 {
167 ste,pins = "GPIO31_V3";
168 ste,config = <&gpio_in_pu>;
169 };
170 tvk_cfg2 {
171 ste,pins = "GPIO32_V2";
172 ste,config = <&gpio_in_pd>;
173 };
174 };
175 };
117 }; 176 };
118 }; 177 };
119}; 178};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
index c2341061b943..bcc1f0c37f49 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -35,8 +35,6 @@
35 */ 35 */
36 pinctrl-names = "default"; 36 pinctrl-names = "default";
37 pinctrl-0 = <&ipgpio_hrefv60_mode>, 37 pinctrl-0 = <&ipgpio_hrefv60_mode>,
38 <&accel_hrefv60_mode>,
39 <&magneto_hrefv60_mode>,
40 <&etm_hrefv60_mode>, 38 <&etm_hrefv60_mode>,
41 <&nahj_hrefv60_mode>, 39 <&nahj_hrefv60_mode>,
42 <&nfc_hrefv60_mode>, 40 <&nfc_hrefv60_mode>,
@@ -83,28 +81,6 @@
83 }; 81 };
84 }; 82 };
85 }; 83 };
86 accelerometer {
87 accel_hrefv60_mode: accel_hrefv60 {
88 /* Accelerometer interrupt lines 1 & 2 */
89 hrefv60_cfg1 {
90 ste,pins = "GPIO82_C1", "GPIO83_D3";
91 ste,config = <&gpio_in_pu>;
92 };
93 };
94 };
95 magnetometer {
96 magneto_hrefv60_mode: magneto_hrefv60 {
97 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
98 hrefv60_cfg1 {
99 ste,pins = "GPIO31_V3";
100 ste,config = <&gpio_in_pu>;
101 };
102 hrefv60_cfg2 {
103 ste,pins = "GPIO32_V2";
104 ste,config = <&gpio_in_pd>;
105 };
106 };
107 };
108 etm { 84 etm {
109 /* 85 /*
110 * Drive D19-D23 for the ETM PTM trace interface low, 86 * Drive D19-D23 for the ETM PTM trace interface low,
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index 474ef83229cd..4a2000c620ad 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -241,6 +241,40 @@
241 pinctrl-names = "default","sleep"; 241 pinctrl-names = "default","sleep";
242 pinctrl-0 = <&i2c2_default_mode>; 242 pinctrl-0 = <&i2c2_default_mode>;
243 pinctrl-1 = <&i2c2_sleep_mode>; 243 pinctrl-1 = <&i2c2_sleep_mode>;
244 lsm303dlh@18 {
245 /* Accelerometer */
246 compatible = "st,lsm303dlh-accel";
247 st,drdy-int-pin = <1>;
248 reg = <0x18>;
249 vdd-supply = <&ab8500_ldo_aux1_reg>;
250 vddio-supply = <&db8500_vsmps2_reg>;
251 pinctrl-names = "default";
252 pinctrl-0 = <&accel_snowball_mode>;
253 };
254 lsm303dlm@1e {
255 /* Magnetometer */
256 compatible = "st,lsm303dlm-magn";
257 reg = <0x1e>;
258 vdd-supply = <&ab8500_ldo_aux1_reg>;
259 vddio-supply = <&db8500_vsmps2_reg>;
260 pinctrl-names = "default";
261 pinctrl-0 = <&magneto_snowball_mode>;
262 };
263 l3g4200d@68 {
264 /* Gyroscope */
265 compatible = "st,l3g4200d-gyro";
266 st,drdy-int-pin = <2>;
267 reg = <0x68>;
268 vdd-supply = <&ab8500_ldo_aux1_reg>;
269 vddio-supply = <&db8500_vsmps2_reg>;
270 };
271 lsp001wm@5c {
272 /* Barometer/pressure sensor */
273 compatible = "st,lps001wp-press";
274 reg = <0x5c>;
275 vdd-supply = <&ab8500_ldo_aux1_reg>;
276 vddio-supply = <&db8500_vsmps2_reg>;
277 };
244 }; 278 };
245 279
246 i2c@80110000 { 280 i2c@80110000 {
@@ -361,9 +395,7 @@
361 * can be moved over to being controlled by respective device. 395 * can be moved over to being controlled by respective device.
362 */ 396 */
363 pinctrl-names = "default"; 397 pinctrl-names = "default";
364 pinctrl-0 = <&accel_snowball_mode>, 398 pinctrl-0 = <&gbf_snowball_mode>,
365 <&magneto_snowball_mode>,
366 <&gbf_snowball_mode>,
367 <&wlan_snowball_mode>; 399 <&wlan_snowball_mode>;
368 400
369 ethernet { 401 ethernet {
diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index 0b97c071dd56..9e99ade35e37 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -88,6 +88,12 @@
88 }; 88 };
89 }; 89 };
90 90
91 ir0: ir@01c21800 {
92 pinctrl-names = "default";
93 pinctrl-0 = <&ir0_pins_a>;
94 status = "okay";
95 };
96
91 uart0: serial@01c28000 { 97 uart0: serial@01c28000 {
92 pinctrl-names = "default"; 98 pinctrl-names = "default";
93 pinctrl-0 = <&uart0_pins_a>; 99 pinctrl-0 = <&uart0_pins_a>;
@@ -98,6 +104,15 @@
98 pinctrl-names = "default"; 104 pinctrl-names = "default";
99 pinctrl-0 = <&i2c0_pins_a>; 105 pinctrl-0 = <&i2c0_pins_a>;
100 status = "okay"; 106 status = "okay";
107
108 axp209: pmic@34 {
109 compatible = "x-powers,axp209";
110 reg = <0x34>;
111 interrupts = <0>;
112
113 interrupt-controller;
114 #interrupt-cells = <1>;
115 };
101 }; 116 };
102 }; 117 };
103 118
diff --git a/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
new file mode 100644
index 000000000000..1763cc7ec023
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
@@ -0,0 +1,110 @@
1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "sun4i-a10.dtsi"
14/include/ "sunxi-common-regulators.dtsi"
15
16/ {
17 model = "BA10 tvbox";
18 compatible = "allwinner,ba10-tvbox", "allwinner,sun4i-a10";
19
20 soc@01c00000 {
21 emac: ethernet@01c0b000 {
22 pinctrl-names = "default";
23 pinctrl-0 = <&emac_pins_a>;
24 phy = <&phy1>;
25 status = "okay";
26 };
27
28 mdio@01c0b080 {
29 status = "okay";
30
31 phy1: ethernet-phy@1 {
32 reg = <1>;
33 };
34 };
35
36 mmc0: mmc@01c0f000 {
37 pinctrl-names = "default";
38 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
39 vmmc-supply = <&reg_vcc3v3>;
40 bus-width = <4>;
41 cd-gpios = <&pio 7 1 0>; /* PH1 */
42 cd-inverted;
43 status = "okay";
44 };
45
46 usbphy: phy@01c13400 {
47 usb1_vbus-supply = <&reg_usb1_vbus>;
48 usb2_vbus-supply = <&reg_usb2_vbus>;
49 status = "okay";
50 };
51
52 ehci0: usb@01c14000 {
53 status = "okay";
54 };
55
56 ohci0: usb@01c14400 {
57 status = "okay";
58 };
59
60 ehci1: usb@01c1c000 {
61 status = "okay";
62 };
63
64 ohci1: usb@01c1c400 {
65 status = "okay";
66 };
67
68 pinctrl@01c20800 {
69 usb2_vbus_pin_a: usb2_vbus_pin@0 {
70 allwinner,pins = "PH12";
71 };
72 };
73
74 ir0: ir@01c21800 {
75 pinctrl-names = "default";
76 pinctrl-0 = <&ir0_pins_a>;
77 status = "okay";
78 };
79
80 uart0: serial@01c28000 {
81 pinctrl-names = "default";
82 pinctrl-0 = <&uart0_pins_a>;
83 status = "okay";
84 };
85
86 i2c0: i2c@01c2ac00 {
87 pinctrl-names = "default";
88 pinctrl-0 = <&i2c0_pins_a>;
89 status = "okay";
90
91 axp209: pmic@34 {
92 compatible = "x-powers,axp209";
93 reg = <0x34>;
94 interrupts = <0>;
95
96 interrupt-controller;
97 #interrupt-cells = <1>;
98 };
99 };
100 };
101
102 reg_usb1_vbus: usb1-vbus {
103 status = "okay";
104 };
105
106 reg_usb2_vbus: usb2-vbus {
107 gpio = <&pio 7 12 0>;
108 status = "okay";
109 };
110};
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index c200eacc66e8..3ce56bfbc0b5 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -80,6 +80,12 @@
80 }; 80 };
81 }; 81 };
82 82
83 ir0: ir@01c21800 {
84 pinctrl-names = "default";
85 pinctrl-0 = <&ir0_pins_a>;
86 status = "okay";
87 };
88
83 uart0: serial@01c28000 { 89 uart0: serial@01c28000 {
84 pinctrl-names = "default"; 90 pinctrl-names = "default";
85 pinctrl-0 = <&uart0_pins_a>; 91 pinctrl-0 = <&uart0_pins_a>;
@@ -90,6 +96,15 @@
90 pinctrl-names = "default"; 96 pinctrl-names = "default";
91 pinctrl-0 = <&i2c0_pins_a>; 97 pinctrl-0 = <&i2c0_pins_a>;
92 status = "okay"; 98 status = "okay";
99
100 axp209: pmic@34 {
101 compatible = "x-powers,axp209";
102 reg = <0x34>;
103 interrupts = <0>;
104
105 interrupt-controller;
106 #interrupt-cells = <1>;
107 };
93 }; 108 };
94 109
95 i2c1: i2c@01c2b000 { 110 i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index 547fadcb984b..891ea446abae 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -87,11 +87,32 @@
87 }; 87 };
88 }; 88 };
89 89
90 ir0: ir@01c21800 {
91 pinctrl-names = "default";
92 pinctrl-0 = <&ir0_pins_a>;
93 status = "okay";
94 };
95
90 uart0: serial@01c28000 { 96 uart0: serial@01c28000 {
91 pinctrl-names = "default"; 97 pinctrl-names = "default";
92 pinctrl-0 = <&uart0_pins_a>; 98 pinctrl-0 = <&uart0_pins_a>;
93 status = "okay"; 99 status = "okay";
94 }; 100 };
101
102 i2c0: i2c@01c2ac00 {
103 pinctrl-names = "default";
104 pinctrl-0 = <&i2c0_pins_a>;
105 status = "okay";
106
107 axp209: pmic@34 {
108 compatible = "x-powers,axp209";
109 reg = <0x34>;
110 interrupts = <0>;
111
112 interrupt-controller;
113 #interrupt-cells = <1>;
114 };
115 };
95 }; 116 };
96 117
97 reg_emac_3v3: emac-3v3 { 118 reg_emac_3v3: emac-3v3 {
diff --git a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
index f13723e18b86..6b0c37812ade 100644
--- a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
+++ b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
@@ -40,12 +40,6 @@
40 status = "okay"; 40 status = "okay";
41 }; 41 };
42 42
43 i2c0: i2c@01c2ac00 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&i2c0_pins_a>;
46 status = "okay";
47 };
48
49 usbphy: phy@01c13400 { 43 usbphy: phy@01c13400 {
50 usb1_vbus-supply = <&reg_usb1_vbus>; 44 usb1_vbus-supply = <&reg_usb1_vbus>;
51 usb2_vbus-supply = <&reg_usb2_vbus>; 45 usb2_vbus-supply = <&reg_usb2_vbus>;
@@ -67,6 +61,21 @@
67 ohci1: usb@01c1c400 { 61 ohci1: usb@01c1c400 {
68 status = "okay"; 62 status = "okay";
69 }; 63 };
64
65 i2c0: i2c@01c2ac00 {
66 pinctrl-names = "default";
67 pinctrl-0 = <&i2c0_pins_a>;
68 status = "okay";
69
70 axp209: pmic@34 {
71 compatible = "x-powers,axp209";
72 reg = <0x34>;
73 interrupts = <0>;
74
75 interrupt-controller;
76 #interrupt-cells = <1>;
77 };
78 };
70 }; 79 };
71 80
72 reg_usb1_vbus: usb1-vbus { 81 reg_usb1_vbus: usb1-vbus {
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index c01cea50cf0c..b9ecce60f2e7 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -52,11 +52,39 @@
52 status = "okay"; 52 status = "okay";
53 }; 53 };
54 54
55 pinctrl@01c20800 {
56 ir0_pins_a: ir0@0 {
57 /* The ir receiver is not always populated */
58 allwinner,pull = <1>;
59 };
60 };
61
62 ir0: ir@01c21800 {
63 pinctrl-names = "default";
64 pinctrl-0 = <&ir0_pins_a>;
65 status = "okay";
66 };
67
55 uart0: serial@01c28000 { 68 uart0: serial@01c28000 {
56 pinctrl-names = "default"; 69 pinctrl-names = "default";
57 pinctrl-0 = <&uart0_pins_a>; 70 pinctrl-0 = <&uart0_pins_a>;
58 status = "okay"; 71 status = "okay";
59 }; 72 };
73
74 i2c0: i2c@01c2ac00 {
75 pinctrl-names = "default";
76 pinctrl-0 = <&i2c0_pins_a>;
77 status = "okay";
78
79 axp209: pmic@34 {
80 compatible = "x-powers,axp209";
81 reg = <0x34>;
82 interrupts = <0>;
83
84 interrupt-controller;
85 #interrupt-cells = <1>;
86 };
87 };
60 }; 88 };
61 89
62 reg_usb1_vbus: usb1-vbus { 90 reg_usb1_vbus: usb1-vbus {
diff --git a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
index d46a7dbecef5..d046d568f5a1 100644
--- a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
@@ -91,6 +91,21 @@
91 pinctrl-0 = <&uart0_pins_a>; 91 pinctrl-0 = <&uart0_pins_a>;
92 status = "okay"; 92 status = "okay";
93 }; 93 };
94
95 i2c0: i2c@01c2ac00 {
96 pinctrl-names = "default";
97 pinctrl-0 = <&i2c0_pins_a>;
98 status = "okay";
99
100 axp209: pmic@34 {
101 compatible = "x-powers,axp209";
102 reg = <0x34>;
103 interrupts = <0>;
104
105 interrupt-controller;
106 #interrupt-cells = <1>;
107 };
108 };
94 }; 109 };
95 110
96 leds { 111 leds {
diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index fb03bccb78d2..6675bcd7860e 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -76,6 +76,15 @@
76 pinctrl-names = "default"; 76 pinctrl-names = "default";
77 pinctrl-0 = <&i2c0_pins_a>; 77 pinctrl-0 = <&i2c0_pins_a>;
78 status = "okay"; 78 status = "okay";
79
80 axp209: pmic@34 {
81 compatible = "x-powers,axp209";
82 reg = <0x34>;
83 interrupts = <0>;
84
85 interrupt-controller;
86 #interrupt-cells = <1>;
87 };
79 }; 88 };
80 }; 89 };
81 90
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index d96e179490ce..459cb6377764 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -509,7 +509,7 @@
509 clocks = <&apb0_gates 5>; 509 clocks = <&apb0_gates 5>;
510 gpio-controller; 510 gpio-controller;
511 interrupt-controller; 511 interrupt-controller;
512 #address-cells = <1>; 512 #interrupt-cells = <2>;
513 #size-cells = <0>; 513 #size-cells = <0>;
514 #gpio-cells = <3>; 514 #gpio-cells = <3>;
515 515
@@ -593,6 +593,20 @@
593 allwinner,drive = <0>; 593 allwinner,drive = <0>;
594 allwinner,pull = <1>; 594 allwinner,pull = <1>;
595 }; 595 };
596
597 ir0_pins_a: ir0@0 {
598 allwinner,pins = "PB3","PB4";
599 allwinner,function = "ir0";
600 allwinner,drive = <0>;
601 allwinner,pull = <0>;
602 };
603
604 ir1_pins_a: ir1@0 {
605 allwinner,pins = "PB22","PB23";
606 allwinner,function = "ir1";
607 allwinner,drive = <0>;
608 allwinner,pull = <0>;
609 };
596 }; 610 };
597 611
598 timer@01c20c00 { 612 timer@01c20c00 {
@@ -621,6 +635,24 @@
621 status = "disabled"; 635 status = "disabled";
622 }; 636 };
623 637
638 ir0: ir@01c21800 {
639 compatible = "allwinner,sun4i-a10-ir";
640 clocks = <&apb0_gates 6>, <&ir0_clk>;
641 clock-names = "apb", "ir";
642 interrupts = <5>;
643 reg = <0x01c21800 0x40>;
644 status = "disabled";
645 };
646
647 ir1: ir@01c21c00 {
648 compatible = "allwinner,sun4i-a10-ir";
649 clocks = <&apb0_gates 7>, <&ir1_clk>;
650 clock-names = "apb", "ir";
651 interrupts = <6>;
652 reg = <0x01c21c00 0x40>;
653 status = "disabled";
654 };
655
624 sid: eeprom@01c23800 { 656 sid: eeprom@01c23800 {
625 compatible = "allwinner,sun4i-a10-sid"; 657 compatible = "allwinner,sun4i-a10-sid";
626 reg = <0x01c23800 0x10>; 658 reg = <0x01c23800 0x10>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index b64f705d9008..24b0ad3a7c07 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -422,7 +422,7 @@
422 clocks = <&apb0_gates 5>; 422 clocks = <&apb0_gates 5>;
423 gpio-controller; 423 gpio-controller;
424 interrupt-controller; 424 interrupt-controller;
425 #address-cells = <1>; 425 #interrupt-cells = <2>;
426 #size-cells = <0>; 426 #size-cells = <0>;
427 #gpio-cells = <3>; 427 #gpio-cells = <3>;
428 428
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 3b2a94c40f6e..bf86e65dd167 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -395,7 +395,7 @@
395 clocks = <&apb0_gates 5>; 395 clocks = <&apb0_gates 5>;
396 gpio-controller; 396 gpio-controller;
397 interrupt-controller; 397 interrupt-controller;
398 #address-cells = <1>; 398 #interrupt-cells = <2>;
399 #size-cells = <0>; 399 #size-cells = <0>;
400 #gpio-cells = <3>; 400 #gpio-cells = <3>;
401 401
diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
new file mode 100644
index 000000000000..f142065b3c1f
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
@@ -0,0 +1,119 @@
1/*
2 * Copyright 2014 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "sun6i-a31.dtsi"
16/include/ "sunxi-common-regulators.dtsi"
17
18/ {
19 model = "Merrii A31 Hummingbird";
20 compatible = "merrii,a31-hummingbird", "allwinner,sun6i-a31";
21
22 chosen {
23 bootargs = "earlyprintk console=ttyS0,115200";
24 };
25
26 soc@01c00000 {
27 mmc0: mmc@01c0f000 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_hummingbird>;
30 vmmc-supply = <&reg_vcc3v0>;
31 bus-width = <4>;
32 cd-gpios = <&pio 0 8 0>; /* PA8 */
33 cd-inverted;
34 status = "okay";
35 };
36
37 usbphy: phy@01c19400 {
38 usb1_vbus-supply = <&reg_usb1_vbus>;
39 status = "okay";
40 };
41
42 ehci0: usb@01c1a000 {
43 status = "okay";
44 };
45
46 ohci0: usb@01c1a400 {
47 status = "okay";
48 };
49
50 pio: pinctrl@01c20800 {
51 mmc0_pins_a: mmc0@0 {
52 /* external pull-ups missing for some pins */
53 allwinner,pull = <1>;
54 };
55
56 mmc0_cd_pin_hummingbird: mmc0_cd_pin@0 {
57 allwinner,pins = "PA8";
58 allwinner,function = "gpio_in";
59 allwinner,drive = <0>;
60 allwinner,pull = <1>;
61 };
62
63 usb1_vbus_pin_a: usb1_vbus_pin@0 {
64 allwinner,pins = "PH24";
65 allwinner,function = "gpio_out";
66 allwinner,drive = <0>;
67 allwinner,pull = <0>;
68 };
69 };
70
71 uart0: serial@01c28000 {
72 pinctrl-names = "default";
73 pinctrl-0 = <&uart0_pins_a>;
74 status = "okay";
75 };
76
77 i2c0: i2c@01c2ac00 {
78 pinctrl-names = "default";
79 pinctrl-0 = <&i2c0_pins_a>;
80 /* pull-ups and devices require AXP221 DLDO3 */
81 status = "failed";
82 };
83
84 i2c1: i2c@01c2b000 {
85 pinctrl-names = "default";
86 pinctrl-0 = <&i2c1_pins_a>;
87 status = "okay";
88 };
89
90 i2c2: i2c@01c2b400 {
91 pinctrl-names = "default";
92 pinctrl-0 = <&i2c2_pins_a>;
93 status = "okay";
94
95 pcf8563: rtc@51 {
96 compatible = "nxp,pcf8563";
97 reg = <0x51>;
98 };
99 };
100
101 gmac: ethernet@01c30000 {
102 pinctrl-names = "default";
103 pinctrl-0 = <&gmac_pins_rgmii_a>;
104 phy = <&phy1>;
105 phy-mode = "rgmii";
106 status = "okay";
107
108 phy1: ethernet-phy@1 {
109 reg = <1>;
110 };
111 };
112 };
113
114 reg_usb1_vbus: usb1-vbus {
115 pinctrl-0 = <&usb1_vbus_pin_a>;
116 gpio = <&pio 7 24 0>; /* PH24 */
117 status = "okay";
118 };
119};
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index a9dfa12eb735..44b07e512c24 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -23,6 +23,7 @@
23 serial3 = &uart3; 23 serial3 = &uart3;
24 serial4 = &uart4; 24 serial4 = &uart4;
25 serial5 = &uart5; 25 serial5 = &uart5;
26 ethernet0 = &gmac;
26 }; 27 };
27 28
28 29
@@ -281,6 +282,34 @@
281 "usb_ohci0", "usb_ohci1", 282 "usb_ohci0", "usb_ohci1",
282 "usb_ohci2"; 283 "usb_ohci2";
283 }; 284 };
285
286 /*
287 * The following two are dummy clocks, placeholders used in the gmac_tx
288 * clock. The gmac driver will choose one parent depending on the PHY
289 * interface mode, using clk_set_rate auto-reparenting.
290 * The actual TX clock rate is not controlled by the gmac_tx clock.
291 */
292 mii_phy_tx_clk: clk@1 {
293 #clock-cells = <0>;
294 compatible = "fixed-clock";
295 clock-frequency = <25000000>;
296 clock-output-names = "mii_phy_tx";
297 };
298
299 gmac_int_tx_clk: clk@2 {
300 #clock-cells = <0>;
301 compatible = "fixed-clock";
302 clock-frequency = <125000000>;
303 clock-output-names = "gmac_int_tx";
304 };
305
306 gmac_tx_clk: clk@01c200d0 {
307 #clock-cells = <0>;
308 compatible = "allwinner,sun7i-a20-gmac-clk";
309 reg = <0x01c200d0 0x4>;
310 clocks = <&mii_phy_tx_clk>, <&gmac_int_tx_clk>;
311 clock-output-names = "gmac_tx";
312 };
284 }; 313 };
285 314
286 soc@01c00000 { 315 soc@01c00000 {
@@ -429,7 +458,7 @@
429 clocks = <&apb1_gates 5>; 458 clocks = <&apb1_gates 5>;
430 gpio-controller; 459 gpio-controller;
431 interrupt-controller; 460 interrupt-controller;
432 #address-cells = <1>; 461 #interrupt-cells = <2>;
433 #size-cells = <0>; 462 #size-cells = <0>;
434 #gpio-cells = <3>; 463 #gpio-cells = <3>;
435 464
@@ -467,6 +496,48 @@
467 allwinner,drive = <2>; 496 allwinner,drive = <2>;
468 allwinner,pull = <0>; 497 allwinner,pull = <0>;
469 }; 498 };
499
500 gmac_pins_mii_a: gmac_mii@0 {
501 allwinner,pins = "PA0", "PA1", "PA2", "PA3",
502 "PA8", "PA9", "PA11",
503 "PA12", "PA13", "PA14", "PA19",
504 "PA20", "PA21", "PA22", "PA23",
505 "PA24", "PA26", "PA27";
506 allwinner,function = "gmac";
507 allwinner,drive = <0>;
508 allwinner,pull = <0>;
509 };
510
511 gmac_pins_gmii_a: gmac_gmii@0 {
512 allwinner,pins = "PA0", "PA1", "PA2", "PA3",
513 "PA4", "PA5", "PA6", "PA7",
514 "PA8", "PA9", "PA10", "PA11",
515 "PA12", "PA13", "PA14", "PA15",
516 "PA16", "PA17", "PA18", "PA19",
517 "PA20", "PA21", "PA22", "PA23",
518 "PA24", "PA25", "PA26", "PA27";
519 allwinner,function = "gmac";
520 /*
521 * data lines in GMII mode run at 125MHz and
522 * might need a higher signal drive strength
523 */
524 allwinner,drive = <2>;
525 allwinner,pull = <0>;
526 };
527
528 gmac_pins_rgmii_a: gmac_rgmii@0 {
529 allwinner,pins = "PA0", "PA1", "PA2", "PA3",
530 "PA9", "PA10", "PA11",
531 "PA12", "PA13", "PA14", "PA19",
532 "PA20", "PA25", "PA26", "PA27";
533 allwinner,function = "gmac";
534 /*
535 * data lines in RGMII mode use DDR mode
536 * and need a higher signal drive strength
537 */
538 allwinner,drive = <3>;
539 allwinner,pull = <0>;
540 };
470 }; 541 };
471 542
472 ahb1_rst: reset@01c202c0 { 543 ahb1_rst: reset@01c202c0 {
@@ -621,6 +692,23 @@
621 status = "disabled"; 692 status = "disabled";
622 }; 693 };
623 694
695 gmac: ethernet@01c30000 {
696 compatible = "allwinner,sun7i-a20-gmac";
697 reg = <0x01c30000 0x1054>;
698 interrupts = <0 82 4>;
699 interrupt-names = "macirq";
700 clocks = <&ahb1_gates 17>, <&gmac_tx_clk>;
701 clock-names = "stmmaceth", "allwinner_gmac_tx";
702 resets = <&ahb1_rst 17>;
703 reset-names = "stmmaceth";
704 snps,pbl = <2>;
705 snps,fixed-burst;
706 snps,force_sf_dma_mode;
707 status = "disabled";
708 #address-cells = <1>;
709 #size-cells = <0>;
710 };
711
624 timer@01c60000 { 712 timer@01c60000 {
625 compatible = "allwinner,sun6i-a31-hstimer", "allwinner,sun7i-a20-hstimer"; 713 compatible = "allwinner,sun6i-a31-hstimer", "allwinner,sun7i-a20-hstimer";
626 reg = <0x01c60000 0x1000>; 714 reg = <0x01c60000 0x1000>;
@@ -756,7 +844,7 @@
756 resets = <&apb0_rst 0>; 844 resets = <&apb0_rst 0>;
757 gpio-controller; 845 gpio-controller;
758 interrupt-controller; 846 interrupt-controller;
759 #address-cells = <1>; 847 #interrupt-cells = <2>;
760 #size-cells = <0>; 848 #size-cells = <0>;
761 #gpio-cells = <3>; 849 #gpio-cells = <3>;
762 }; 850 };
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index a5ad945197e8..53680983461a 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -66,6 +66,12 @@
66 }; 66 };
67 }; 67 };
68 68
69 ir0: ir@01c21800 {
70 pinctrl-names = "default";
71 pinctrl-0 = <&ir0_pins_a>;
72 status = "okay";
73 };
74
69 uart0: serial@01c28000 { 75 uart0: serial@01c28000 {
70 pinctrl-names = "default"; 76 pinctrl-names = "default";
71 pinctrl-0 = <&uart0_pins_a>; 77 pinctrl-0 = <&uart0_pins_a>;
@@ -76,6 +82,16 @@
76 pinctrl-names = "default"; 82 pinctrl-names = "default";
77 pinctrl-0 = <&i2c0_pins_a>; 83 pinctrl-0 = <&i2c0_pins_a>;
78 status = "okay"; 84 status = "okay";
85
86 axp209: pmic@34 {
87 compatible = "x-powers,axp209";
88 reg = <0x34>;
89 interrupt-parent = <&nmi_intc>;
90 interrupts = <0 8>;
91
92 interrupt-controller;
93 #interrupt-cells = <1>;
94 };
79 }; 95 };
80 96
81 i2c1: i2c@01c2b000 { 97 i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index b87fea901489..a6c1a3c717bc 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -100,6 +100,12 @@
100 status = "okay"; 100 status = "okay";
101 }; 101 };
102 102
103 ir0: ir@01c21800 {
104 pinctrl-names = "default";
105 pinctrl-0 = <&ir0_pins_a>;
106 status = "okay";
107 };
108
103 uart0: serial@01c28000 { 109 uart0: serial@01c28000 {
104 pinctrl-names = "default"; 110 pinctrl-names = "default";
105 pinctrl-0 = <&uart0_pins_a>; 111 pinctrl-0 = <&uart0_pins_a>;
@@ -110,6 +116,16 @@
110 pinctrl-names = "default"; 116 pinctrl-names = "default";
111 pinctrl-0 = <&i2c0_pins_a>; 117 pinctrl-0 = <&i2c0_pins_a>;
112 status = "okay"; 118 status = "okay";
119
120 axp209: pmic@34 {
121 compatible = "x-powers,axp209";
122 reg = <0x34>;
123 interrupt-parent = <&nmi_intc>;
124 interrupts = <0 8>;
125
126 interrupt-controller;
127 #interrupt-cells = <1>;
128 };
113 }; 129 };
114 130
115 i2c1: i2c@01c2b000 { 131 i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts b/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
index b77308e90199..6a67712d417a 100644
--- a/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts
@@ -94,12 +94,34 @@
94 }; 94 };
95 }; 95 };
96 96
97 ir0: ir@01c21800 {
98 pinctrl-names = "default";
99 pinctrl-0 = <&ir0_pins_a>;
100 status = "okay";
101 };
102
97 uart0: serial@01c28000 { 103 uart0: serial@01c28000 {
98 pinctrl-names = "default"; 104 pinctrl-names = "default";
99 pinctrl-0 = <&uart0_pins_a>; 105 pinctrl-0 = <&uart0_pins_a>;
100 status = "okay"; 106 status = "okay";
101 }; 107 };
102 108
109 i2c0: i2c@01c2ac00 {
110 pinctrl-names = "default";
111 pinctrl-0 = <&i2c0_pins_a>;
112 status = "okay";
113
114 axp209: pmic@34 {
115 compatible = "x-powers,axp209";
116 reg = <0x34>;
117 interrupt-parent = <&nmi_intc>;
118 interrupts = <0 8>;
119
120 interrupt-controller;
121 #interrupt-cells = <1>;
122 };
123 };
124
103 gmac: ethernet@01c50000 { 125 gmac: ethernet@01c50000 {
104 pinctrl-names = "default"; 126 pinctrl-names = "default";
105 pinctrl-0 = <&gmac_pins_mii_a>; 127 pinctrl-0 = <&gmac_pins_mii_a>;
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index b759630bc9a9..9d669cdf031d 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -122,6 +122,16 @@
122 pinctrl-names = "default"; 122 pinctrl-names = "default";
123 pinctrl-0 = <&i2c0_pins_a>; 123 pinctrl-0 = <&i2c0_pins_a>;
124 status = "okay"; 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 };
125 }; 135 };
126 136
127 i2c1: i2c@01c2b000 { 137 i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-pcduino3.dts b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
new file mode 100644
index 000000000000..046dfc0d45d8
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-pcduino3.dts
@@ -0,0 +1,173 @@
1/*
2 * Copyright 2014 Zoltan HERPAI
3 * Zoltan HERPAI <wigyori@uid0.hu>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/dts-v1/;
14/include/ "sun7i-a20.dtsi"
15/include/ "sunxi-common-regulators.dtsi"
16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/input/input.h>
18
19/ {
20 model = "LinkSprite pcDuino3";
21 compatible = "linksprite,pcduino3", "allwinner,sun7i-a20";
22
23 soc@01c00000 {
24 mmc0: mmc@01c0f000 {
25 pinctrl-names = "default";
26 pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
27 vmmc-supply = <&reg_vcc3v3>;
28 bus-width = <4>;
29 cd-gpios = <&pio 7 1 0>; /* PH1 */
30 cd-inverted;
31 status = "okay";
32 };
33
34 usbphy: phy@01c13400 {
35 usb1_vbus-supply = <&reg_usb1_vbus>;
36 usb2_vbus-supply = <&reg_usb2_vbus>;
37 status = "okay";
38 };
39
40 ehci0: usb@01c14000 {
41 status = "okay";
42 };
43
44 ohci0: usb@01c14400 {
45 status = "okay";
46 };
47
48 ahci: sata@01c18000 {
49 target-supply = <&reg_ahci_5v>;
50 status = "okay";
51 };
52
53 ehci1: usb@01c1c000 {
54 status = "okay";
55 };
56
57 ohci1: usb@01c1c400 {
58 status = "okay";
59 };
60
61 pinctrl@01c20800 {
62 ahci_pwr_pin_a: ahci_pwr_pin@0 {
63 allwinner,pins = "PH2";
64 };
65
66 led_pins_pcduino3: led_pins@0 {
67 allwinner,pins = "PH15", "PH16";
68 allwinner,function = "gpio_out";
69 allwinner,drive = <0>;
70 allwinner,pull = <0>;
71 };
72
73 key_pins_pcduino3: key_pins@0 {
74 allwinner,pins = "PH17", "PH18", "PH19";
75 allwinner,function = "gpio_in";
76 allwinner,drive = <0>;
77 allwinner,pull = <0>;
78 };
79 };
80
81 ir0: ir@01c21800 {
82 pinctrl-names = "default";
83 pinctrl-0 = <&ir0_pins_a>;
84 status = "okay";
85 };
86
87 uart0: serial@01c28000 {
88 pinctrl-names = "default";
89 pinctrl-0 = <&uart0_pins_a>;
90 status = "okay";
91 };
92
93 i2c0: i2c@01c2ac00 {
94 pinctrl-names = "default";
95 pinctrl-0 = <&i2c0_pins_a>;
96 status = "okay";
97
98 axp209: pmic@34 {
99 compatible = "x-powers,axp209";
100 reg = <0x34>;
101 interrupt-parent = <&nmi_intc>;
102 interrupts = <0 8>;
103
104 interrupt-controller;
105 #interrupt-cells = <1>;
106 };
107 };
108
109 gmac: ethernet@01c50000 {
110 pinctrl-names = "default";
111 pinctrl-0 = <&gmac_pins_mii_a>;
112 phy = <&phy1>;
113 phy-mode = "mii";
114 status = "okay";
115
116 phy1: ethernet-phy@1 {
117 reg = <1>;
118 };
119 };
120 };
121
122 leds {
123 compatible = "gpio-leds";
124 pinctrl-names = "default";
125 pinctrl-0 = <&led_pins_pcduino3>;
126
127 tx {
128 label = "pcduino3:green:tx";
129 gpios = <&pio 7 15 GPIO_ACTIVE_LOW>;
130 };
131
132 rx {
133 label = "pcduino3:green:rx";
134 gpios = <&pio 7 16 GPIO_ACTIVE_LOW>;
135 };
136 };
137
138 gpio_keys {
139 compatible = "gpio-keys";
140 pinctrl-names = "default";
141 pinctrl-0 = <&key_pins_pcduino3>;
142 #address-cells = <1>;
143 #size-cells = <0>;
144 button@0 {
145 label = "Key Back";
146 linux,code = <KEY_BACK>;
147 gpios = <&pio 7 17 GPIO_ACTIVE_LOW>;
148 };
149 button@1 {
150 label = "Key Home";
151 linux,code = <KEY_HOME>;
152 gpios = <&pio 7 18 GPIO_ACTIVE_LOW>;
153 };
154 button@2 {
155 label = "Key Menu";
156 linux,code = <KEY_MENU>;
157 gpios = <&pio 7 19 GPIO_ACTIVE_LOW>;
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
169 reg_ahci_5v: ahci-5v {
170 gpio = <&pio 7 2 0>;
171 status = "okay";
172 };
173};
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 01e94664232a..4011628c7381 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -586,7 +586,7 @@
586 clocks = <&apb0_gates 5>; 586 clocks = <&apb0_gates 5>;
587 gpio-controller; 587 gpio-controller;
588 interrupt-controller; 588 interrupt-controller;
589 #address-cells = <1>; 589 #interrupt-cells = <2>;
590 #size-cells = <0>; 590 #size-cells = <0>;
591 #gpio-cells = <3>; 591 #gpio-cells = <3>;
592 592
@@ -738,6 +738,20 @@
738 allwinner,drive = <2>; 738 allwinner,drive = <2>;
739 allwinner,pull = <0>; 739 allwinner,pull = <0>;
740 }; 740 };
741
742 ir0_pins_a: ir0@0 {
743 allwinner,pins = "PB3","PB4";
744 allwinner,function = "ir0";
745 allwinner,drive = <0>;
746 allwinner,pull = <0>;
747 };
748
749 ir1_pins_a: ir1@0 {
750 allwinner,pins = "PB22","PB23";
751 allwinner,function = "ir1";
752 allwinner,drive = <0>;
753 allwinner,pull = <0>;
754 };
741 }; 755 };
742 756
743 timer@01c20c00 { 757 timer@01c20c00 {
@@ -771,6 +785,24 @@
771 status = "disabled"; 785 status = "disabled";
772 }; 786 };
773 787
788 ir0: ir@01c21800 {
789 compatible = "allwinner,sun4i-a10-ir";
790 clocks = <&apb0_gates 6>, <&ir0_clk>;
791 clock-names = "apb", "ir";
792 interrupts = <0 5 4>;
793 reg = <0x01c21800 0x40>;
794 status = "disabled";
795 };
796
797 ir1: ir@01c21c00 {
798 compatible = "allwinner,sun4i-a10-ir";
799 clocks = <&apb0_gates 7>, <&ir1_clk>;
800 clock-names = "apb", "ir";
801 interrupts = <0 6 4>;
802 reg = <0x01c21c00 0x40>;
803 status = "disabled";
804 };
805
774 sid: eeprom@01c23800 { 806 sid: eeprom@01c23800 {
775 compatible = "allwinner,sun7i-a20-sid"; 807 compatible = "allwinner,sun7i-a20-sid";
776 reg = <0x01c23800 0x200>; 808 reg = <0x01c23800 0x200>;
diff --git a/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts b/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
new file mode 100644
index 000000000000..34002e3eba9d
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-a23-ippo-q8h-v5.dts
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2014 Chen-Yu Tsai
3 *
4 * Chen-Yu Tsai <wens@csie.org>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "sun8i-a23.dtsi"
16
17/ {
18 model = "Ippo Q8H Dual Core Tablet (v5)";
19 compatible = "ippo,q8h-v5", "allwinner,sun8i-a23";
20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc@01c00000 {
26 r_uart: serial@01f02800 {
27 status = "okay";
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/sun8i-a23.dtsi b/arch/arm/boot/dts/sun8i-a23.dtsi
new file mode 100644
index 000000000000..54ac0787216a
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-a23.dtsi
@@ -0,0 +1,343 @@
1/*
2 * Copyright 2014 Chen-Yu Tsai
3 *
4 * Chen-Yu Tsai <wens@csie.org>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&gic>;
18
19 aliases {
20 serial0 = &uart0;
21 serial1 = &uart1;
22 serial2 = &uart2;
23 serial3 = &uart3;
24 serial4 = &uart4;
25 serial5 = &r_uart;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 cpu@0 {
33 compatible = "arm,cortex-a7";
34 device_type = "cpu";
35 reg = <0>;
36 };
37
38 cpu@1 {
39 compatible = "arm,cortex-a7";
40 device_type = "cpu";
41 reg = <1>;
42 };
43 };
44
45 memory {
46 reg = <0x40000000 0x40000000>;
47 };
48
49 clocks {
50 #address-cells = <1>;
51 #size-cells = <1>;
52 ranges;
53
54 osc24M: osc24M_clk {
55 #clock-cells = <0>;
56 compatible = "fixed-clock";
57 clock-frequency = <24000000>;
58 clock-output-names = "osc24M";
59 };
60
61 osc32k: osc32k_clk {
62 #clock-cells = <0>;
63 compatible = "fixed-clock";
64 clock-frequency = <32768>;
65 clock-output-names = "osc32k";
66 };
67
68 pll1: clk@01c20000 {
69 #clock-cells = <0>;
70 compatible = "allwinner,sun8i-a23-pll1-clk";
71 reg = <0x01c20000 0x4>;
72 clocks = <&osc24M>;
73 clock-output-names = "pll1";
74 };
75
76 /* dummy clock until actually implemented */
77 pll6: pll6_clk {
78 #clock-cells = <0>;
79 compatible = "fixed-clock";
80 clock-frequency = <600000000>;
81 clock-output-names = "pll6";
82 };
83
84 cpu: cpu_clk@01c20050 {
85 #clock-cells = <0>;
86 compatible = "allwinner,sun4i-a10-cpu-clk";
87 reg = <0x01c20050 0x4>;
88
89 /*
90 * PLL1 is listed twice here.
91 * While it looks suspicious, it's actually documented
92 * that way both in the datasheet and in the code from
93 * Allwinner.
94 */
95 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>;
96 clock-output-names = "cpu";
97 };
98
99 axi: axi_clk@01c20050 {
100 #clock-cells = <0>;
101 compatible = "allwinner,sun8i-a23-axi-clk";
102 reg = <0x01c20050 0x4>;
103 clocks = <&cpu>;
104 clock-output-names = "axi";
105 };
106
107 ahb1_mux: ahb1_mux_clk@01c20054 {
108 #clock-cells = <0>;
109 compatible = "allwinner,sun6i-a31-ahb1-mux-clk";
110 reg = <0x01c20054 0x4>;
111 clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6>;
112 clock-output-names = "ahb1_mux";
113 };
114
115 ahb1: ahb1_clk@01c20054 {
116 #clock-cells = <0>;
117 compatible = "allwinner,sun4i-a10-ahb-clk";
118 reg = <0x01c20054 0x4>;
119 clocks = <&ahb1_mux>;
120 clock-output-names = "ahb1";
121 };
122
123 apb1: apb1_clk@01c20054 {
124 #clock-cells = <0>;
125 compatible = "allwinner,sun4i-a10-apb0-clk";
126 reg = <0x01c20054 0x4>;
127 clocks = <&ahb1>;
128 clock-output-names = "apb1";
129 };
130
131 ahb1_gates: clk@01c20060 {
132 #clock-cells = <1>;
133 compatible = "allwinner,sun8i-a23-ahb1-gates-clk";
134 reg = <0x01c20060 0x8>;
135 clocks = <&ahb1>;
136 clock-output-names = "ahb1_mipidsi", "ahb1_dma",
137 "ahb1_mmc0", "ahb1_mmc1", "ahb1_mmc2",
138 "ahb1_nand", "ahb1_sdram",
139 "ahb1_hstimer", "ahb1_spi0",
140 "ahb1_spi1", "ahb1_otg", "ahb1_ehci",
141 "ahb1_ohci", "ahb1_ve", "ahb1_lcd",
142 "ahb1_csi", "ahb1_be", "ahb1_fe",
143 "ahb1_gpu", "ahb1_spinlock",
144 "ahb1_drc";
145 };
146
147 apb1_gates: clk@01c20068 {
148 #clock-cells = <1>;
149 compatible = "allwinner,sun8i-a23-apb1-gates-clk";
150 reg = <0x01c20068 0x4>;
151 clocks = <&apb1>;
152 clock-output-names = "apb1_codec", "apb1_pio",
153 "apb1_daudio0", "apb1_daudio1";
154 };
155
156 apb2_mux: apb2_mux_clk@01c20058 {
157 #clock-cells = <0>;
158 compatible = "allwinner,sun4i-a10-apb1-mux-clk";
159 reg = <0x01c20058 0x4>;
160 clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>;
161 clock-output-names = "apb2_mux";
162 };
163
164 apb2: apb2_clk@01c20058 {
165 #clock-cells = <0>;
166 compatible = "allwinner,sun6i-a31-apb2-div-clk";
167 reg = <0x01c20058 0x4>;
168 clocks = <&apb2_mux>;
169 clock-output-names = "apb2";
170 };
171
172 apb2_gates: clk@01c2006c {
173 #clock-cells = <1>;
174 compatible = "allwinner,sun8i-a23-apb2-gates-clk";
175 reg = <0x01c2006c 0x4>;
176 clocks = <&apb2>;
177 clock-output-names = "apb2_i2c0", "apb2_i2c1",
178 "apb2_i2c2", "apb2_uart0",
179 "apb2_uart1", "apb2_uart2",
180 "apb2_uart3", "apb2_uart4";
181 };
182 };
183
184 soc@01c00000 {
185 compatible = "simple-bus";
186 #address-cells = <1>;
187 #size-cells = <1>;
188 ranges;
189
190 ahb1_rst: reset@01c202c0 {
191 #reset-cells = <1>;
192 compatible = "allwinner,sun6i-a31-clock-reset";
193 reg = <0x01c202c0 0xc>;
194 };
195
196 apb1_rst: reset@01c202d0 {
197 #reset-cells = <1>;
198 compatible = "allwinner,sun6i-a31-clock-reset";
199 reg = <0x01c202d0 0x4>;
200 };
201
202 apb2_rst: reset@01c202d8 {
203 #reset-cells = <1>;
204 compatible = "allwinner,sun6i-a31-clock-reset";
205 reg = <0x01c202d8 0x4>;
206 };
207
208 timer@01c20c00 {
209 compatible = "allwinner,sun4i-a10-timer";
210 reg = <0x01c20c00 0xa0>;
211 interrupts = <0 18 4>,
212 <0 19 4>;
213 clocks = <&osc24M>;
214 };
215
216 wdt0: watchdog@01c20ca0 {
217 compatible = "allwinner,sun6i-a31-wdt";
218 reg = <0x01c20ca0 0x20>;
219 interrupts = <0 25 4>;
220 };
221
222 uart0: serial@01c28000 {
223 compatible = "snps,dw-apb-uart";
224 reg = <0x01c28000 0x400>;
225 interrupts = <0 0 4>;
226 reg-shift = <2>;
227 reg-io-width = <4>;
228 clocks = <&apb2_gates 16>;
229 resets = <&apb2_rst 16>;
230 status = "disabled";
231 };
232
233 uart1: serial@01c28400 {
234 compatible = "snps,dw-apb-uart";
235 reg = <0x01c28400 0x400>;
236 interrupts = <0 1 4>;
237 reg-shift = <2>;
238 reg-io-width = <4>;
239 clocks = <&apb2_gates 17>;
240 resets = <&apb2_rst 17>;
241 status = "disabled";
242 };
243
244 uart2: serial@01c28800 {
245 compatible = "snps,dw-apb-uart";
246 reg = <0x01c28800 0x400>;
247 interrupts = <0 2 4>;
248 reg-shift = <2>;
249 reg-io-width = <4>;
250 clocks = <&apb2_gates 18>;
251 resets = <&apb2_rst 18>;
252 status = "disabled";
253 };
254
255 uart3: serial@01c28c00 {
256 compatible = "snps,dw-apb-uart";
257 reg = <0x01c28c00 0x400>;
258 interrupts = <0 3 4>;
259 reg-shift = <2>;
260 reg-io-width = <4>;
261 clocks = <&apb2_gates 19>;
262 resets = <&apb2_rst 19>;
263 status = "disabled";
264 };
265
266 uart4: serial@01c29000 {
267 compatible = "snps,dw-apb-uart";
268 reg = <0x01c29000 0x400>;
269 interrupts = <0 4 4>;
270 reg-shift = <2>;
271 reg-io-width = <4>;
272 clocks = <&apb2_gates 20>;
273 resets = <&apb2_rst 20>;
274 status = "disabled";
275 };
276
277 gic: interrupt-controller@01c81000 {
278 compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
279 reg = <0x01c81000 0x1000>,
280 <0x01c82000 0x1000>,
281 <0x01c84000 0x2000>,
282 <0x01c86000 0x2000>;
283 interrupt-controller;
284 #interrupt-cells = <3>;
285 interrupts = <1 9 0xf04>;
286 };
287
288 prcm@01f01400 {
289 compatible = "allwinner,sun8i-a23-prcm";
290 reg = <0x01f01400 0x200>;
291
292 ar100: ar100_clk {
293 compatible = "fixed-factor-clock";
294 #clock-cells = <0>;
295 clock-div = <1>;
296 clock-mult = <1>;
297 clocks = <&osc24M>;
298 clock-output-names = "ar100";
299 };
300
301 ahb0: ahb0_clk {
302 compatible = "fixed-factor-clock";
303 #clock-cells = <0>;
304 clock-div = <1>;
305 clock-mult = <1>;
306 clocks = <&ar100>;
307 clock-output-names = "ahb0";
308 };
309
310 apb0: apb0_clk {
311 compatible = "allwinner,sun8i-a23-apb0-clk";
312 #clock-cells = <0>;
313 clocks = <&ahb0>;
314 clock-output-names = "apb0";
315 };
316
317 apb0_gates: apb0_gates_clk {
318 compatible = "allwinner,sun8i-a23-apb0-gates-clk";
319 #clock-cells = <1>;
320 clocks = <&apb0>;
321 clock-output-names = "apb0_pio", "apb0_timer",
322 "apb0_rsb", "apb0_uart",
323 "apb0_i2c";
324 };
325
326 apb0_rst: apb0_rst {
327 compatible = "allwinner,sun6i-a31-clock-reset";
328 #reset-cells = <1>;
329 };
330 };
331
332 r_uart: serial@01f02800 {
333 compatible = "snps,dw-apb-uart";
334 reg = <0x01f02800 0x400>;
335 interrupts = <0 38 4>;
336 reg-shift = <2>;
337 reg-io-width = <4>;
338 clocks = <&apb0_gates 4>;
339 resets = <&apb0_rst 4>;
340 status = "disabled";
341 };
342 };
343};
diff --git a/arch/arm/boot/dts/tegra114-roth.dts b/arch/arm/boot/dts/tegra114-roth.dts
index 0b0e8e07d965..c7c6825f11fb 100644
--- a/arch/arm/boot/dts/tegra114-roth.dts
+++ b/arch/arm/boot/dts/tegra114-roth.dts
@@ -28,6 +28,22 @@
28 reg = <0x80000000 0x79600000>; 28 reg = <0x80000000 0x79600000>;
29 }; 29 };
30 30
31 host1x@50000000 {
32 dsi@54300000 {
33 status = "okay";
34
35 vdd-supply = <&vdd_1v2_ap>;
36
37 panel@0 {
38 compatible = "lg,lh500wx1-sd03";
39 reg = <0>;
40
41 power-supply = <&vdd_lcd>;
42 backlight = <&backlight>;
43 };
44 };
45 };
46
31 pinmux@70000868 { 47 pinmux@70000868 {
32 pinctrl-names = "default"; 48 pinctrl-names = "default";
33 pinctrl-0 = <&state_default>; 49 pinctrl-0 = <&state_default>;
@@ -244,7 +260,7 @@
244 nvidia,function = "sdmmc1"; 260 nvidia,function = "sdmmc1";
245 nvidia,pull = <TEGRA_PIN_PULL_NONE>; 261 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
246 nvidia,tristate = <TEGRA_PIN_DISABLE>; 262 nvidia,tristate = <TEGRA_PIN_DISABLE>;
247 nvidia,enable-input = <TEGRA_PIN_DISABLE>; 263 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
248 }; 264 };
249 sdmmc1_cmd_pz1 { 265 sdmmc1_cmd_pz1 {
250 nvidia,pins = "sdmmc1_cmd_pz1", 266 nvidia,pins = "sdmmc1_cmd_pz1",
@@ -262,7 +278,7 @@
262 nvidia,function = "sdmmc3"; 278 nvidia,function = "sdmmc3";
263 nvidia,pull = <TEGRA_PIN_PULL_NONE>; 279 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
264 nvidia,tristate = <TEGRA_PIN_DISABLE>; 280 nvidia,tristate = <TEGRA_PIN_DISABLE>;
265 nvidia,enable-input = <TEGRA_PIN_DISABLE>; 281 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
266 }; 282 };
267 sdmmc3_cmd_pa7 { 283 sdmmc3_cmd_pa7 {
268 nvidia,pins = "sdmmc3_cmd_pa7", 284 nvidia,pins = "sdmmc3_cmd_pa7",
@@ -290,7 +306,7 @@
290 nvidia,function = "sdmmc4"; 306 nvidia,function = "sdmmc4";
291 nvidia,pull = <TEGRA_PIN_PULL_NONE>; 307 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
292 nvidia,tristate = <TEGRA_PIN_DISABLE>; 308 nvidia,tristate = <TEGRA_PIN_DISABLE>;
293 nvidia,enable-input = <TEGRA_PIN_DISABLE>; 309 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
294 }; 310 };
295 sdmmc4_cmd_pt7 { 311 sdmmc4_cmd_pt7 {
296 nvidia,pins = "sdmmc4_cmd_pt7", 312 nvidia,pins = "sdmmc4_cmd_pt7",
@@ -730,7 +746,6 @@
730 nvidia,pins = "drive_sdio1"; 746 nvidia,pins = "drive_sdio1";
731 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>; 747 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
732 nvidia,schmitt = <TEGRA_PIN_DISABLE>; 748 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
733 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
734 nvidia,pull-down-strength = <36>; 749 nvidia,pull-down-strength = <36>;
735 nvidia,pull-up-strength = <20>; 750 nvidia,pull-up-strength = <20>;
736 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOW>; 751 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOW>;
@@ -740,7 +755,6 @@
740 nvidia,pins = "drive_sdio3"; 755 nvidia,pins = "drive_sdio3";
741 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>; 756 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
742 nvidia,schmitt = <TEGRA_PIN_DISABLE>; 757 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
743 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
744 nvidia,pull-down-strength = <36>; 758 nvidia,pull-down-strength = <36>;
745 nvidia,pull-up-strength = <20>; 759 nvidia,pull-up-strength = <20>;
746 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>; 760 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
@@ -750,12 +764,10 @@
750 nvidia,pins = "drive_gma"; 764 nvidia,pins = "drive_gma";
751 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>; 765 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
752 nvidia,schmitt = <TEGRA_PIN_DISABLE>; 766 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
753 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
754 nvidia,pull-down-strength = <2>; 767 nvidia,pull-down-strength = <2>;
755 nvidia,pull-up-strength = <2>; 768 nvidia,pull-up-strength = <2>;
756 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>; 769 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
757 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>; 770 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
758 nvidia,drive-type = <1>;
759 }; 771 };
760 }; 772 };
761 }; 773 };
@@ -815,7 +827,6 @@
815 regulator-name = "vdd-1v8"; 827 regulator-name = "vdd-1v8";
816 regulator-min-microvolt = <1800000>; 828 regulator-min-microvolt = <1800000>;
817 regulator-max-microvolt = <1800000>; 829 regulator-max-microvolt = <1800000>;
818 regulator-always-on;
819 regulator-boot-on; 830 regulator-boot-on;
820 }; 831 };
821 832
@@ -862,10 +873,11 @@
862 regulator-name = "vdd-2v8-display"; 873 regulator-name = "vdd-2v8-display";
863 regulator-min-microvolt = <2800000>; 874 regulator-min-microvolt = <2800000>;
864 regulator-max-microvolt = <2800000>; 875 regulator-max-microvolt = <2800000>;
876 regulator-always-on;
865 regulator-boot-on; 877 regulator-boot-on;
866 }; 878 };
867 879
868 ldo3 { 880 vdd_1v2_ap: ldo3 {
869 regulator-name = "avdd-1v2"; 881 regulator-name = "avdd-1v2";
870 regulator-min-microvolt = <1200000>; 882 regulator-min-microvolt = <1200000>;
871 regulator-max-microvolt = <1200000>; 883 regulator-max-microvolt = <1200000>;
@@ -1052,7 +1064,7 @@
1052 regulator-boot-on; 1064 regulator-boot-on;
1053 }; 1065 };
1054 1066
1055 regulator@1 { 1067 vdd_lcd: regulator@1 {
1056 compatible = "regulator-fixed"; 1068 compatible = "regulator-fixed";
1057 reg = <1>; 1069 reg = <1>;
1058 regulator-name = "vdd_lcd_1v8"; 1070 regulator-name = "vdd_lcd_1v8";
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index fdc559ab2db3..80b8eddb4105 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -220,6 +220,12 @@
220 interrupt-controller; 220 interrupt-controller;
221 }; 221 };
222 222
223 apbmisc@70000800 {
224 compatible = "nvidia,tegra114-apbmisc", "nvidia,tegra20-apbmisc";
225 reg = <0x70000800 0x64 /* Chip revision */
226 0x70000008 0x04>; /* Strapping options */
227 };
228
223 pinmux: pinmux@70000868 { 229 pinmux: pinmux@70000868 {
224 compatible = "nvidia,tegra114-pinmux"; 230 compatible = "nvidia,tegra114-pinmux";
225 reg = <0x70000868 0x148 /* Pad control registers */ 231 reg = <0x70000868 0x148 /* Pad control registers */
@@ -485,6 +491,15 @@
485 clock-names = "pclk", "clk32k_in"; 491 clock-names = "pclk", "clk32k_in";
486 }; 492 };
487 493
494 fuse@7000f800 {
495 compatible = "nvidia,tegra114-efuse";
496 reg = <0x7000f800 0x400>;
497 clocks = <&tegra_car TEGRA114_CLK_FUSE>;
498 clock-names = "fuse";
499 resets = <&tegra_car 39>;
500 reset-names = "fuse";
501 };
502
488 iommu@70019010 { 503 iommu@70019010 {
489 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu"; 504 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu";
490 reg = <0x70019010 0x02c 505 reg = <0x70019010 0x02c
@@ -657,6 +672,8 @@
657 <&tegra_car TEGRA114_CLK_PLL_U>, 672 <&tegra_car TEGRA114_CLK_PLL_U>,
658 <&tegra_car TEGRA114_CLK_USBD>; 673 <&tegra_car TEGRA114_CLK_USBD>;
659 clock-names = "reg", "pll_u", "utmi-pads"; 674 clock-names = "reg", "pll_u", "utmi-pads";
675 resets = <&tegra_car 22>, <&tegra_car 22>;
676 reset-names = "usb", "utmi-pads";
660 nvidia,hssync-start-delay = <0>; 677 nvidia,hssync-start-delay = <0>;
661 nvidia,idle-wait-delay = <17>; 678 nvidia,idle-wait-delay = <17>;
662 nvidia,elastic-limit = <16>; 679 nvidia,elastic-limit = <16>;
@@ -667,6 +684,7 @@
667 nvidia,hssquelch-level = <2>; 684 nvidia,hssquelch-level = <2>;
668 nvidia,hsdiscon-level = <5>; 685 nvidia,hsdiscon-level = <5>;
669 nvidia,xcvr-hsslew = <12>; 686 nvidia,xcvr-hsslew = <12>;
687 nvidia,has-utmi-pad-registers;
670 status = "disabled"; 688 status = "disabled";
671 }; 689 };
672 690
@@ -690,6 +708,8 @@
690 <&tegra_car TEGRA114_CLK_PLL_U>, 708 <&tegra_car TEGRA114_CLK_PLL_U>,
691 <&tegra_car TEGRA114_CLK_USBD>; 709 <&tegra_car TEGRA114_CLK_USBD>;
692 clock-names = "reg", "pll_u", "utmi-pads"; 710 clock-names = "reg", "pll_u", "utmi-pads";
711 resets = <&tegra_car 59>, <&tegra_car 22>;
712 reset-names = "usb", "utmi-pads";
693 nvidia,hssync-start-delay = <0>; 713 nvidia,hssync-start-delay = <0>;
694 nvidia,idle-wait-delay = <17>; 714 nvidia,idle-wait-delay = <17>;
695 nvidia,elastic-limit = <16>; 715 nvidia,elastic-limit = <16>;
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index e31fb61a81d3..624b0fba2d0a 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -1461,7 +1461,7 @@
1461 regulator-max-microamp = <3500000>; 1461 regulator-max-microamp = <3500000>;
1462 regulator-always-on; 1462 regulator-always-on;
1463 regulator-boot-on; 1463 regulator-boot-on;
1464 ams,external-control = <2>; 1464 ams,ext-control = <2>;
1465 }; 1465 };
1466 1466
1467 sd1 { 1467 sd1 {
@@ -1472,7 +1472,7 @@
1472 regulator-max-microamp = <2500000>; 1472 regulator-max-microamp = <2500000>;
1473 regulator-always-on; 1473 regulator-always-on;
1474 regulator-boot-on; 1474 regulator-boot-on;
1475 ams,external-control = <1>; 1475 ams,ext-control = <1>;
1476 }; 1476 };
1477 1477
1478 vdd_1v35_lp0: sd2 { 1478 vdd_1v35_lp0: sd2 {
@@ -1521,7 +1521,7 @@
1521 regulator-max-microvolt = <1050000>; 1521 regulator-max-microvolt = <1050000>;
1522 regulator-boot-on; 1522 regulator-boot-on;
1523 regulator-always-on; 1523 regulator-always-on;
1524 ams,external-control = <1>; 1524 ams,ext-control = <1>;
1525 }; 1525 };
1526 1526
1527 ldo1 { 1527 ldo1 {
@@ -1619,6 +1619,32 @@
1619 nvidia,sys-clock-req-active-high; 1619 nvidia,sys-clock-req-active-high;
1620 }; 1620 };
1621 1621
1622 padctl@0,7009f000 {
1623 pinctrl-0 = <&padctl_default>;
1624 pinctrl-names = "default";
1625
1626 padctl_default: pinmux {
1627 usb3 {
1628 nvidia,lanes = "pcie-0", "pcie-1";
1629 nvidia,function = "usb3";
1630 nvidia,iddq = <0>;
1631 };
1632
1633 pcie {
1634 nvidia,lanes = "pcie-2", "pcie-3",
1635 "pcie-4";
1636 nvidia,function = "pcie";
1637 nvidia,iddq = <0>;
1638 };
1639
1640 sata {
1641 nvidia,lanes = "sata-0";
1642 nvidia,function = "sata";
1643 nvidia,iddq = <0>;
1644 };
1645 };
1646 };
1647
1622 /* SD card */ 1648 /* SD card */
1623 sdhci@0,700b0400 { 1649 sdhci@0,700b0400 {
1624 status = "okay"; 1650 status = "okay";
@@ -1633,6 +1659,7 @@
1633 sdhci@0,700b0600 { 1659 sdhci@0,700b0600 {
1634 status = "okay"; 1660 status = "okay";
1635 bus-width = <8>; 1661 bus-width = <8>;
1662 non-removable;
1636 }; 1663 };
1637 1664
1638 ahub@0,70300000 { 1665 ahub@0,70300000 {
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts
index f0bb84244025..70ad91d1a20b 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -682,7 +682,7 @@
682 regulator-max-microamp = <3500000>; 682 regulator-max-microamp = <3500000>;
683 regulator-always-on; 683 regulator-always-on;
684 regulator-boot-on; 684 regulator-boot-on;
685 ams,external-control = <2>; 685 ams,ext-control = <2>;
686 }; 686 };
687 687
688 sd1 { 688 sd1 {
@@ -693,7 +693,7 @@
693 regulator-max-microamp = <2500000>; 693 regulator-max-microamp = <2500000>;
694 regulator-always-on; 694 regulator-always-on;
695 regulator-boot-on; 695 regulator-boot-on;
696 ams,external-control = <1>; 696 ams,ext-control = <1>;
697 }; 697 };
698 698
699 vdd_1v35_lp0: sd2 { 699 vdd_1v35_lp0: sd2 {
@@ -742,7 +742,7 @@
742 regulator-max-microvolt = <1050000>; 742 regulator-max-microvolt = <1050000>;
743 regulator-boot-on; 743 regulator-boot-on;
744 regulator-always-on; 744 regulator-always-on;
745 ams,external-control = <1>; 745 ams,ext-control = <1>;
746 }; 746 };
747 747
748 ldo1 { 748 ldo1 {
@@ -816,7 +816,7 @@
816 spi@0,7000d400 { 816 spi@0,7000d400 {
817 status = "okay"; 817 status = "okay";
818 818
819 cros-ec@0 { 819 cros_ec: cros-ec@0 {
820 compatible = "google,cros-ec-spi"; 820 compatible = "google,cros-ec-spi";
821 spi-max-frequency = <4000000>; 821 spi-max-frequency = <4000000>;
822 interrupt-parent = <&gpio>; 822 interrupt-parent = <&gpio>;
@@ -825,96 +825,30 @@
825 825
826 google,cros-ec-spi-msg-delay = <2000>; 826 google,cros-ec-spi-msg-delay = <2000>;
827 827
828 cros-ec-keyb { 828 i2c-tunnel {
829 compatible = "google,cros-ec-keyb"; 829 compatible = "google,cros-ec-i2c-tunnel";
830 keypad,num-rows = <8>; 830 #address-cells = <1>;
831 keypad,num-columns = <13>; 831 #size-cells = <0>;
832 google,needs-ghost-filter; 832
833 833 google,remote-bus = <0>;
834 linux,keymap = < 834
835 MATRIX_KEY(0x00, 0x01, KEY_LEFTMETA) 835 charger: bq24735@9 {
836 MATRIX_KEY(0x00, 0x02, KEY_F1) 836 compatible = "ti,bq24735";
837 MATRIX_KEY(0x00, 0x03, KEY_B) 837 reg = <0x9>;
838 MATRIX_KEY(0x00, 0x04, KEY_F10) 838 interrupt-parent = <&gpio>;
839 MATRIX_KEY(0x00, 0x06, KEY_N) 839 interrupts = <TEGRA_GPIO(J, 0)
840 MATRIX_KEY(0x00, 0x08, KEY_EQUAL) 840 GPIO_ACTIVE_HIGH>;
841 MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT) 841 ti,ac-detect-gpios = <&gpio
842 842 TEGRA_GPIO(J, 0)
843 MATRIX_KEY(0x01, 0x01, KEY_ESC) 843 GPIO_ACTIVE_HIGH>;
844 MATRIX_KEY(0x01, 0x02, KEY_F4) 844 };
845 MATRIX_KEY(0x01, 0x03, KEY_G) 845
846 MATRIX_KEY(0x01, 0x04, KEY_F7) 846 battery: sbs-battery@b {
847 MATRIX_KEY(0x01, 0x06, KEY_H) 847 compatible = "sbs,sbs-battery";
848 MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE) 848 reg = <0xb>;
849 MATRIX_KEY(0x01, 0x09, KEY_F9) 849 sbs,i2c-retry-count = <2>;
850 MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE) 850 sbs,poll-retry-count = <1>;
851 851 };
852 MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
853 MATRIX_KEY(0x02, 0x01, KEY_TAB)
854 MATRIX_KEY(0x02, 0x02, KEY_F3)
855 MATRIX_KEY(0x02, 0x03, KEY_T)
856 MATRIX_KEY(0x02, 0x04, KEY_F6)
857 MATRIX_KEY(0x02, 0x05, KEY_RIGHTBRACE)
858 MATRIX_KEY(0x02, 0x06, KEY_Y)
859 MATRIX_KEY(0x02, 0x07, KEY_102ND)
860 MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
861 MATRIX_KEY(0x02, 0x09, KEY_F8)
862
863 MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
864 MATRIX_KEY(0x03, 0x02, KEY_F2)
865 MATRIX_KEY(0x03, 0x03, KEY_5)
866 MATRIX_KEY(0x03, 0x04, KEY_F5)
867 MATRIX_KEY(0x03, 0x06, KEY_6)
868 MATRIX_KEY(0x03, 0x08, KEY_MINUS)
869 MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
870
871 MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
872 MATRIX_KEY(0x04, 0x01, KEY_A)
873 MATRIX_KEY(0x04, 0x02, KEY_D)
874 MATRIX_KEY(0x04, 0x03, KEY_F)
875 MATRIX_KEY(0x04, 0x04, KEY_S)
876 MATRIX_KEY(0x04, 0x05, KEY_K)
877 MATRIX_KEY(0x04, 0x06, KEY_J)
878 MATRIX_KEY(0x04, 0x08, KEY_SEMICOLON)
879 MATRIX_KEY(0x04, 0x09, KEY_L)
880 MATRIX_KEY(0x04, 0x0a, KEY_BACKSLASH)
881 MATRIX_KEY(0x04, 0x0b, KEY_ENTER)
882
883 MATRIX_KEY(0x05, 0x01, KEY_Z)
884 MATRIX_KEY(0x05, 0x02, KEY_C)
885 MATRIX_KEY(0x05, 0x03, KEY_V)
886 MATRIX_KEY(0x05, 0x04, KEY_X)
887 MATRIX_KEY(0x05, 0x05, KEY_COMMA)
888 MATRIX_KEY(0x05, 0x06, KEY_M)
889 MATRIX_KEY(0x05, 0x07, KEY_LEFTSHIFT)
890 MATRIX_KEY(0x05, 0x08, KEY_SLASH)
891 MATRIX_KEY(0x05, 0x09, KEY_DOT)
892 MATRIX_KEY(0x05, 0x0b, KEY_SPACE)
893
894 MATRIX_KEY(0x06, 0x01, KEY_1)
895 MATRIX_KEY(0x06, 0x02, KEY_3)
896 MATRIX_KEY(0x06, 0x03, KEY_4)
897 MATRIX_KEY(0x06, 0x04, KEY_2)
898 MATRIX_KEY(0x06, 0x05, KEY_8)
899 MATRIX_KEY(0x06, 0x06, KEY_7)
900 MATRIX_KEY(0x06, 0x08, KEY_0)
901 MATRIX_KEY(0x06, 0x09, KEY_9)
902 MATRIX_KEY(0x06, 0x0a, KEY_LEFTALT)
903 MATRIX_KEY(0x06, 0x0b, KEY_DOWN)
904 MATRIX_KEY(0x06, 0x0c, KEY_RIGHT)
905
906 MATRIX_KEY(0x07, 0x01, KEY_Q)
907 MATRIX_KEY(0x07, 0x02, KEY_E)
908 MATRIX_KEY(0x07, 0x03, KEY_R)
909 MATRIX_KEY(0x07, 0x04, KEY_W)
910 MATRIX_KEY(0x07, 0x05, KEY_I)
911 MATRIX_KEY(0x07, 0x06, KEY_U)
912 MATRIX_KEY(0x07, 0x07, KEY_RIGHTSHIFT)
913 MATRIX_KEY(0x07, 0x08, KEY_P)
914 MATRIX_KEY(0x07, 0x09, KEY_O)
915 MATRIX_KEY(0x07, 0x0b, KEY_UP)
916 MATRIX_KEY(0x07, 0x0c, KEY_LEFT)
917 >;
918 }; 852 };
919 }; 853 };
920 }; 854 };
@@ -940,6 +874,10 @@
940 nvidia,sys-clock-req-active-high; 874 nvidia,sys-clock-req-active-high;
941 }; 875 };
942 876
877 hda@0,70030000 {
878 status = "okay";
879 };
880
943 sdhci@0,700b0400 { 881 sdhci@0,700b0400 {
944 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>; 882 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
945 power-gpios = <&gpio TEGRA_GPIO(R, 0) GPIO_ACTIVE_HIGH>; 883 power-gpios = <&gpio TEGRA_GPIO(R, 0) GPIO_ACTIVE_HIGH>;
@@ -1205,3 +1143,5 @@
1205 clock-names = "pll_a", "pll_a_out0", "mclk"; 1143 clock-names = "pll_a", "pll_a_out0", "mclk";
1206 }; 1144 };
1207}; 1145};
1146
1147#include "cros-ec-keyboard.dtsi"
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index 6e6bc4e8185c..03916efd6fa9 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -1,6 +1,7 @@
1#include <dt-bindings/clock/tegra124-car.h> 1#include <dt-bindings/clock/tegra124-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h> 2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/pinctrl/pinctrl-tegra.h> 3#include <dt-bindings/pinctrl/pinctrl-tegra.h>
4#include <dt-bindings/pinctrl/pinctrl-tegra-xusb.h>
4#include <dt-bindings/interrupt-controller/arm-gic.h> 5#include <dt-bindings/interrupt-controller/arm-gic.h>
5 6
6#include "skeleton.dtsi" 7#include "skeleton.dtsi"
@@ -102,6 +103,21 @@
102 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; 103 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
103 }; 104 };
104 105
106 gpu@0,57000000 {
107 compatible = "nvidia,gk20a";
108 reg = <0x0 0x57000000 0x0 0x01000000>,
109 <0x0 0x58000000 0x0 0x01000000>;
110 interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
111 <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
112 interrupt-names = "stall", "nonstall";
113 clocks = <&tegra_car TEGRA124_CLK_GPU>,
114 <&tegra_car TEGRA124_CLK_PLL_P_OUT5>;
115 clock-names = "gpu", "pwr";
116 resets = <&tegra_car 184>;
117 reset-names = "gpu";
118 status = "disabled";
119 };
120
105 timer@0,60005000 { 121 timer@0,60005000 {
106 compatible = "nvidia,tegra124-timer", "nvidia,tegra20-timer"; 122 compatible = "nvidia,tegra124-timer", "nvidia,tegra20-timer";
107 reg = <0x0 0x60005000 0x0 0x400>; 123 reg = <0x0 0x60005000 0x0 0x400>;
@@ -179,6 +195,12 @@
179 #dma-cells = <1>; 195 #dma-cells = <1>;
180 }; 196 };
181 197
198 apbmisc@0,70000800 {
199 compatible = "nvidia,tegra124-apbmisc", "nvidia,tegra20-apbmisc";
200 reg = <0x0 0x70000800 0x0 0x64>, /* Chip revision */
201 <0x0 0x7000E864 0x0 0x04>; /* Strapping options */
202 };
203
182 pinmux: pinmux@0,70000868 { 204 pinmux: pinmux@0,70000868 {
183 compatible = "nvidia,tegra124-pinmux"; 205 compatible = "nvidia,tegra124-pinmux";
184 reg = <0x0 0x70000868 0x0 0x164>, /* Pad control registers */ 206 reg = <0x0 0x70000868 0x0 0x164>, /* Pad control registers */
@@ -449,6 +471,39 @@
449 clock-names = "pclk", "clk32k_in"; 471 clock-names = "pclk", "clk32k_in";
450 }; 472 };
451 473
474 fuse@0,7000f800 {
475 compatible = "nvidia,tegra124-efuse";
476 reg = <0x0 0x7000f800 0x0 0x400>;
477 clocks = <&tegra_car TEGRA124_CLK_FUSE>;
478 clock-names = "fuse";
479 resets = <&tegra_car 39>;
480 reset-names = "fuse";
481 };
482
483 hda@0,70030000 {
484 compatible = "nvidia,tegra124-hda", "nvidia,tegra30-hda";
485 reg = <0x0 0x70030000 0x0 0x10000>;
486 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
487 clocks = <&tegra_car TEGRA124_CLK_HDA>,
488 <&tegra_car TEGRA124_CLK_HDA2HDMI>,
489 <&tegra_car TEGRA124_CLK_HDA2CODEC_2X>;
490 clock-names = "hda", "hda2hdmi", "hdacodec_2x";
491 resets = <&tegra_car 125>, /* hda */
492 <&tegra_car 128>, /* hda2hdmi */
493 <&tegra_car 111>; /* hda2codec_2x */
494 reset-names = "hda", "hda2hdmi", "hdacodec_2x";
495 status = "disabled";
496 };
497
498 padctl: padctl@0,7009f000 {
499 compatible = "nvidia,tegra124-xusb-padctl";
500 reg = <0x0 0x7009f000 0x0 0x1000>;
501 resets = <&tegra_car 142>;
502 reset-names = "padctl";
503
504 #phy-cells = <1>;
505 };
506
452 sdhci@0,700b0000 { 507 sdhci@0,700b0000 {
453 compatible = "nvidia,tegra124-sdhci"; 508 compatible = "nvidia,tegra124-sdhci";
454 reg = <0x0 0x700b0000 0x0 0x200>; 509 reg = <0x0 0x700b0000 0x0 0x200>;
@@ -613,6 +668,8 @@
613 <&tegra_car TEGRA124_CLK_PLL_U>, 668 <&tegra_car TEGRA124_CLK_PLL_U>,
614 <&tegra_car TEGRA124_CLK_USBD>; 669 <&tegra_car TEGRA124_CLK_USBD>;
615 clock-names = "reg", "pll_u", "utmi-pads"; 670 clock-names = "reg", "pll_u", "utmi-pads";
671 resets = <&tegra_car 59>, <&tegra_car 22>;
672 reset-names = "usb", "utmi-pads";
616 nvidia,hssync-start-delay = <0>; 673 nvidia,hssync-start-delay = <0>;
617 nvidia,idle-wait-delay = <17>; 674 nvidia,idle-wait-delay = <17>;
618 nvidia,elastic-limit = <16>; 675 nvidia,elastic-limit = <16>;
@@ -647,6 +704,8 @@
647 <&tegra_car TEGRA124_CLK_PLL_U>, 704 <&tegra_car TEGRA124_CLK_PLL_U>,
648 <&tegra_car TEGRA124_CLK_USBD>; 705 <&tegra_car TEGRA124_CLK_USBD>;
649 clock-names = "reg", "pll_u", "utmi-pads"; 706 clock-names = "reg", "pll_u", "utmi-pads";
707 resets = <&tegra_car 22>, <&tegra_car 22>;
708 reset-names = "usb", "utmi-pads";
650 nvidia,hssync-start-delay = <0>; 709 nvidia,hssync-start-delay = <0>;
651 nvidia,idle-wait-delay = <17>; 710 nvidia,idle-wait-delay = <17>;
652 nvidia,elastic-limit = <16>; 711 nvidia,elastic-limit = <16>;
@@ -657,6 +716,7 @@
657 nvidia,hssquelch-level = <2>; 716 nvidia,hssquelch-level = <2>;
658 nvidia,hsdiscon-level = <5>; 717 nvidia,hsdiscon-level = <5>;
659 nvidia,xcvr-hsslew = <12>; 718 nvidia,xcvr-hsslew = <12>;
719 nvidia,has-utmi-pad-registers;
660 status = "disabled"; 720 status = "disabled";
661 }; 721 };
662 722
@@ -681,6 +741,8 @@
681 <&tegra_car TEGRA124_CLK_PLL_U>, 741 <&tegra_car TEGRA124_CLK_PLL_U>,
682 <&tegra_car TEGRA124_CLK_USBD>; 742 <&tegra_car TEGRA124_CLK_USBD>;
683 clock-names = "reg", "pll_u", "utmi-pads"; 743 clock-names = "reg", "pll_u", "utmi-pads";
744 resets = <&tegra_car 58>, <&tegra_car 22>;
745 reset-names = "usb", "utmi-pads";
684 nvidia,hssync-start-delay = <0>; 746 nvidia,hssync-start-delay = <0>;
685 nvidia,idle-wait-delay = <17>; 747 nvidia,idle-wait-delay = <17>;
686 nvidia,elastic-limit = <16>; 748 nvidia,elastic-limit = <16>;
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index f45aad688d9b..a37279af687c 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -562,10 +562,14 @@
562 }; 562 };
563 563
564 pcie-controller@80003000 { 564 pcie-controller@80003000 {
565 pex-clk-supply = <&pci_clk_reg>;
566 vdd-supply = <&pci_vdd_reg>;
567 status = "okay"; 565 status = "okay";
568 566
567 avdd-pex-supply = <&pci_vdd_reg>;
568 vdd-pex-supply = <&pci_vdd_reg>;
569 avdd-pex-pll-supply = <&pci_vdd_reg>;
570 avdd-plle-supply = <&pci_vdd_reg>;
571 vddio-pex-clk-supply = <&pci_clk_reg>;
572
569 pci@1,0 { 573 pci@1,0 {
570 status = "okay"; 574 status = "okay";
571 }; 575 };
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts
index 6d3a4cbc36cc..1b7c56b33aca 100644
--- a/arch/arm/boot/dts/tegra20-medcom-wide.dts
+++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts
@@ -10,6 +10,15 @@
10 status = "okay"; 10 status = "okay";
11 }; 11 };
12 12
13 host1x@50000000 {
14 dc@54200000 {
15 rgb {
16 status = "okay";
17 nvidia,panel = <&panel>;
18 };
19 };
20 };
21
13 i2c@7000c000 { 22 i2c@7000c000 {
14 wm8903: wm8903@1a { 23 wm8903: wm8903@1a {
15 compatible = "wlf,wm8903"; 24 compatible = "wlf,wm8903";
@@ -30,7 +39,7 @@
30 }; 39 };
31 }; 40 };
32 41
33 backlight { 42 backlight: backlight {
34 compatible = "pwm-backlight"; 43 compatible = "pwm-backlight";
35 pwms = <&pwm 0 5000000>; 44 pwms = <&pwm 0 5000000>;
36 45
@@ -38,6 +47,15 @@
38 default-brightness-level = <6>; 47 default-brightness-level = <6>;
39 }; 48 };
40 49
50 panel: panel {
51 compatible = "innolux,n156bge-l21", "simple-panel";
52
53 power-supply = <&vdd_1v8_reg>, <&vdd_3v3_reg>;
54 enable-gpios = <&gpio TEGRA_GPIO(B, 2) GPIO_ACTIVE_HIGH>;
55
56 backlight = <&backlight>;
57 };
58
41 sound { 59 sound {
42 compatible = "ad,tegra-audio-wm8903-medcom-wide", 60 compatible = "ad,tegra-audio-wm8903-medcom-wide",
43 "nvidia,tegra-audio-wm8903"; 61 "nvidia,tegra-audio-wm8903";
@@ -64,4 +82,45 @@
64 <&tegra_car TEGRA20_CLK_CDEV1>; 82 <&tegra_car TEGRA20_CLK_CDEV1>;
65 clock-names = "pll_a", "pll_a_out0", "mclk"; 83 clock-names = "pll_a", "pll_a_out0", "mclk";
66 }; 84 };
85
86 regulators {
87 vcc_24v_reg: regulator@100 {
88 compatible = "regulator-fixed";
89 reg = <100>;
90 regulator-name = "vcc_24v";
91 regulator-min-microvolt = <24000000>;
92 regulator-max-microvolt = <24000000>;
93 regulator-always-on;
94 };
95
96 vdd_5v0_reg: regulator@101 {
97 compatible = "regulator-fixed";
98 reg = <101>;
99 regulator-name = "vdd_5v0";
100 vin-supply = <&vcc_24v_reg>;
101 regulator-min-microvolt = <5000000>;
102 regulator-max-microvolt = <5000000>;
103 regulator-always-on;
104 };
105
106 vdd_3v3_reg: regulator@102 {
107 compatible = "regulator-fixed";
108 reg = <102>;
109 regulator-name = "vdd_3v3";
110 vin-supply = <&vcc_24v_reg>;
111 regulator-min-microvolt = <3300000>;
112 regulator-max-microvolt = <3300000>;
113 regulator-always-on;
114 };
115
116 vdd_1v8_reg: regulator@103 {
117 compatible = "regulator-fixed";
118 reg = <103>;
119 regulator-name = "vdd_1v8";
120 vin-supply = <&vdd_3v3_reg>;
121 regulator-min-microvolt = <1800000>;
122 regulator-max-microvolt = <1800000>;
123 regulator-always-on;
124 };
125 };
67}; 126};
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index 9a39a8001f78..d4438e30de45 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -296,7 +296,7 @@
296 request-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>; 296 request-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
297 slave-addr = <138>; 297 slave-addr = <138>;
298 clocks = <&tegra_car TEGRA20_CLK_I2C3>, 298 clocks = <&tegra_car TEGRA20_CLK_I2C3>,
299 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 299 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
300 clock-names = "div-clk", "fast-clk"; 300 clock-names = "div-clk", "fast-clk";
301 resets = <&tegra_car 67>; 301 resets = <&tegra_car 67>;
302 reset-names = "i2c"; 302 reset-names = "i2c";
@@ -589,8 +589,8 @@
589 GPIO_ACTIVE_HIGH>; 589 GPIO_ACTIVE_HIGH>;
590 590
591 clocks = <&tegra_car TEGRA20_CLK_PLL_A>, 591 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
592 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>, 592 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
593 <&tegra_car TEGRA20_CLK_CDEV1>; 593 <&tegra_car TEGRA20_CLK_CDEV1>;
594 clock-names = "pll_a", "pll_a_out0", "mclk"; 594 clock-names = "pll_a", "pll_a_out0", "mclk";
595 }; 595 };
596}; 596};
diff --git a/arch/arm/boot/dts/tegra20-plutux.dts b/arch/arm/boot/dts/tegra20-plutux.dts
index 29051a2ae0ae..a10b415bbdee 100644
--- a/arch/arm/boot/dts/tegra20-plutux.dts
+++ b/arch/arm/boot/dts/tegra20-plutux.dts
@@ -58,4 +58,45 @@
58 <&tegra_car TEGRA20_CLK_CDEV1>; 58 <&tegra_car TEGRA20_CLK_CDEV1>;
59 clock-names = "pll_a", "pll_a_out0", "mclk"; 59 clock-names = "pll_a", "pll_a_out0", "mclk";
60 }; 60 };
61
62 regulators {
63 vcc_24v_reg: regulator@100 {
64 compatible = "regulator-fixed";
65 reg = <100>;
66 regulator-name = "vcc_24v";
67 regulator-min-microvolt = <24000000>;
68 regulator-max-microvolt = <24000000>;
69 regulator-always-on;
70 };
71
72 vdd_5v0_reg: regulator@101 {
73 compatible = "regulator-fixed";
74 reg = <101>;
75 regulator-name = "vdd_5v0";
76 vin-supply = <&vcc_24v_reg>;
77 regulator-min-microvolt = <5000000>;
78 regulator-max-microvolt = <5000000>;
79 regulator-always-on;
80 };
81
82 vdd_3v3_reg: regulator@102 {
83 compatible = "regulator-fixed";
84 reg = <102>;
85 regulator-name = "vdd_3v3";
86 vin-supply = <&vcc_24v_reg>;
87 regulator-min-microvolt = <3300000>;
88 regulator-max-microvolt = <3300000>;
89 regulator-always-on;
90 };
91
92 vdd_1v8_reg: regulator@103 {
93 compatible = "regulator-fixed";
94 reg = <103>;
95 regulator-name = "vdd_1v8";
96 vin-supply = <&vdd_3v3_reg>;
97 regulator-min-microvolt = <1800000>;
98 regulator-max-microvolt = <1800000>;
99 regulator-always-on;
100 };
101 };
61}; 102};
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index a1b0d965757f..80e7d386ce34 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -334,6 +334,7 @@
334 #gpio-cells = <2>; 334 #gpio-cells = <2>;
335 gpio-controller; 335 gpio-controller;
336 336
337 /* vdd_5v0_reg must be provided by the base board */
337 sys-supply = <&vdd_5v0_reg>; 338 sys-supply = <&vdd_5v0_reg>;
338 vin-sm0-supply = <&sys_reg>; 339 vin-sm0-supply = <&sys_reg>;
339 vin-sm1-supply = <&sys_reg>; 340 vin-sm1-supply = <&sys_reg>;
@@ -473,8 +474,11 @@
473 }; 474 };
474 475
475 pcie-controller@80003000 { 476 pcie-controller@80003000 {
476 pex-clk-supply = <&pci_clk_reg>; 477 avdd-pex-supply = <&pci_vdd_reg>;
477 vdd-supply = <&pci_vdd_reg>; 478 vdd-pex-supply = <&pci_vdd_reg>;
479 avdd-pex-pll-supply = <&pci_vdd_reg>;
480 avdd-plle-supply = <&pci_vdd_reg>;
481 vddio-pex-clk-supply = <&pci_clk_reg>;
478 }; 482 };
479 483
480 usb@c5008000 { 484 usb@c5008000 {
@@ -511,15 +515,6 @@
511 #address-cells = <1>; 515 #address-cells = <1>;
512 #size-cells = <0>; 516 #size-cells = <0>;
513 517
514 vdd_5v0_reg: regulator@0 {
515 compatible = "regulator-fixed";
516 reg = <0>;
517 regulator-name = "vdd_5v0";
518 regulator-min-microvolt = <5000000>;
519 regulator-max-microvolt = <5000000>;
520 regulator-always-on;
521 };
522
523 pci_vdd_reg: regulator@1 { 518 pci_vdd_reg: regulator@1 {
524 compatible = "regulator-fixed"; 519 compatible = "regulator-fixed";
525 reg = <1>; 520 reg = <1>;
diff --git a/arch/arm/boot/dts/tegra20-tec.dts b/arch/arm/boot/dts/tegra20-tec.dts
index 890562c667fb..c12d8bead2ee 100644
--- a/arch/arm/boot/dts/tegra20-tec.dts
+++ b/arch/arm/boot/dts/tegra20-tec.dts
@@ -67,4 +67,45 @@
67 <&tegra_car TEGRA20_CLK_CDEV1>; 67 <&tegra_car TEGRA20_CLK_CDEV1>;
68 clock-names = "pll_a", "pll_a_out0", "mclk"; 68 clock-names = "pll_a", "pll_a_out0", "mclk";
69 }; 69 };
70
71 regulators {
72 vcc_24v_reg: regulator@100 {
73 compatible = "regulator-fixed";
74 reg = <100>;
75 regulator-name = "vcc_24v";
76 regulator-min-microvolt = <24000000>;
77 regulator-max-microvolt = <24000000>;
78 regulator-always-on;
79 };
80
81 vdd_5v0_reg: regulator@101 {
82 compatible = "regulator-fixed";
83 reg = <101>;
84 regulator-name = "vdd_5v0";
85 vin-supply = <&vcc_24v_reg>;
86 regulator-min-microvolt = <5000000>;
87 regulator-max-microvolt = <5000000>;
88 regulator-always-on;
89 };
90
91 vdd_3v3_reg: regulator@102 {
92 compatible = "regulator-fixed";
93 reg = <102>;
94 regulator-name = "vdd_3v3";
95 vin-supply = <&vcc_24v_reg>;
96 regulator-min-microvolt = <3300000>;
97 regulator-max-microvolt = <3300000>;
98 regulator-always-on;
99 };
100
101 vdd_1v8_reg: regulator@103 {
102 compatible = "regulator-fixed";
103 reg = <103>;
104 regulator-name = "vdd_1v8";
105 vin-supply = <&vdd_3v3_reg>;
106 regulator-min-microvolt = <1800000>;
107 regulator-max-microvolt = <1800000>;
108 regulator-always-on;
109 };
110 };
70}; 111};
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 216fa6d50c65..5ad87979ab13 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -318,8 +318,12 @@
318 318
319 pcie-controller@80003000 { 319 pcie-controller@80003000 {
320 status = "okay"; 320 status = "okay";
321 pex-clk-supply = <&pci_clk_reg>; 321
322 vdd-supply = <&pci_vdd_reg>; 322 avdd-pex-supply = <&pci_vdd_reg>;
323 vdd-pex-supply = <&pci_vdd_reg>;
324 avdd-pex-pll-supply = <&pci_vdd_reg>;
325 avdd-plle-supply = <&pci_vdd_reg>;
326 vddio-pex-clk-supply = <&pci_clk_reg>;
323 327
324 pci@1,0 { 328 pci@1,0 {
325 status = "okay"; 329 status = "okay";
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index a7ddf70df50b..1908f6937e53 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -236,6 +236,12 @@
236 interrupt-controller; 236 interrupt-controller;
237 }; 237 };
238 238
239 apbmisc@70000800 {
240 compatible = "nvidia,tegra20-apbmisc";
241 reg = <0x70000800 0x64 /* Chip revision */
242 0x70000008 0x04>; /* Strapping options */
243 };
244
239 pinmux: pinmux@70000014 { 245 pinmux: pinmux@70000014 {
240 compatible = "nvidia,tegra20-pinmux"; 246 compatible = "nvidia,tegra20-pinmux";
241 reg = <0x70000014 0x10 /* Tri-state registers */ 247 reg = <0x70000014 0x10 /* Tri-state registers */
@@ -545,6 +551,15 @@
545 #size-cells = <0>; 551 #size-cells = <0>;
546 }; 552 };
547 553
554 fuse@7000f800 {
555 compatible = "nvidia,tegra20-efuse";
556 reg = <0x7000F800 0x400>;
557 clocks = <&tegra_car TEGRA20_CLK_FUSE>;
558 clock-names = "fuse";
559 resets = <&tegra_car 39>;
560 reset-names = "fuse";
561 };
562
548 pcie-controller@80003000 { 563 pcie-controller@80003000 {
549 compatible = "nvidia,tegra20-pcie"; 564 compatible = "nvidia,tegra20-pcie";
550 device_type = "pci"; 565 device_type = "pci";
@@ -630,6 +645,8 @@
630 <&tegra_car TEGRA20_CLK_CLK_M>, 645 <&tegra_car TEGRA20_CLK_CLK_M>,
631 <&tegra_car TEGRA20_CLK_USBD>; 646 <&tegra_car TEGRA20_CLK_USBD>;
632 clock-names = "reg", "pll_u", "timer", "utmi-pads"; 647 clock-names = "reg", "pll_u", "timer", "utmi-pads";
648 resets = <&tegra_car 22>, <&tegra_car 22>;
649 reset-names = "usb", "utmi-pads";
633 nvidia,has-legacy-mode; 650 nvidia,has-legacy-mode;
634 nvidia,hssync-start-delay = <9>; 651 nvidia,hssync-start-delay = <9>;
635 nvidia,idle-wait-delay = <17>; 652 nvidia,idle-wait-delay = <17>;
@@ -638,6 +655,7 @@
638 nvidia,xcvr-setup = <9>; 655 nvidia,xcvr-setup = <9>;
639 nvidia,xcvr-lsfslew = <1>; 656 nvidia,xcvr-lsfslew = <1>;
640 nvidia,xcvr-lsrslew = <1>; 657 nvidia,xcvr-lsrslew = <1>;
658 nvidia,has-utmi-pad-registers;
641 status = "disabled"; 659 status = "disabled";
642 }; 660 };
643 661
@@ -661,6 +679,8 @@
661 <&tegra_car TEGRA20_CLK_PLL_U>, 679 <&tegra_car TEGRA20_CLK_PLL_U>,
662 <&tegra_car TEGRA20_CLK_CDEV2>; 680 <&tegra_car TEGRA20_CLK_CDEV2>;
663 clock-names = "reg", "pll_u", "ulpi-link"; 681 clock-names = "reg", "pll_u", "ulpi-link";
682 resets = <&tegra_car 58>, <&tegra_car 22>;
683 reset-names = "usb", "utmi-pads";
664 status = "disabled"; 684 status = "disabled";
665 }; 685 };
666 686
@@ -685,6 +705,8 @@
685 <&tegra_car TEGRA20_CLK_CLK_M>, 705 <&tegra_car TEGRA20_CLK_CLK_M>,
686 <&tegra_car TEGRA20_CLK_USBD>; 706 <&tegra_car TEGRA20_CLK_USBD>;
687 clock-names = "reg", "pll_u", "timer", "utmi-pads"; 707 clock-names = "reg", "pll_u", "timer", "utmi-pads";
708 resets = <&tegra_car 59>, <&tegra_car 22>;
709 reset-names = "usb", "utmi-pads";
688 nvidia,hssync-start-delay = <9>; 710 nvidia,hssync-start-delay = <9>;
689 nvidia,idle-wait-delay = <17>; 711 nvidia,idle-wait-delay = <17>;
690 nvidia,elastic-limit = <16>; 712 nvidia,elastic-limit = <16>;
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts b/arch/arm/boot/dts/tegra30-apalis-eval.dts
new file mode 100644
index 000000000000..45d40f024585
--- /dev/null
+++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts
@@ -0,0 +1,260 @@
1/dts-v1/;
2
3#include <dt-bindings/input/input.h>
4#include "tegra30-apalis.dtsi"
5
6/ {
7 model = "Toradex Apalis T30 on Apalis Evaluation Board";
8 compatible = "toradex,apalis_t30-eval", "toradex,apalis_t30", "nvidia,tegra30";
9
10 aliases {
11 rtc0 = "/i2c@7000c000/rtc@68";
12 rtc1 = "/i2c@7000d000/tps65911@2d";
13 rtc2 = "/rtc@7000e000";
14 };
15
16 pcie-controller@00003000 {
17 status = "okay";
18
19 pci@1,0 {
20 status = "okay";
21 };
22
23 pci@2,0 {
24 status = "okay";
25 };
26
27 pci@3,0 {
28 status = "okay";
29 };
30 };
31
32 host1x@50000000 {
33 dc@54200000 {
34 rgb {
35 status = "okay";
36 nvidia,panel = <&panel>;
37 };
38 };
39 hdmi@54280000 {
40 status = "okay";
41 };
42 };
43
44 serial@70006000 {
45 status = "okay";
46 };
47
48 serial@70006040 {
49 compatible = "nvidia,tegra30-hsuart";
50 status = "okay";
51 };
52
53 serial@70006200 {
54 compatible = "nvidia,tegra30-hsuart";
55 status = "okay";
56 };
57
58 serial@70006300 {
59 compatible = "nvidia,tegra30-hsuart";
60 status = "okay";
61 };
62
63 pwm@7000a000 {
64 status = "okay";
65 };
66
67 /*
68 * GEN1_I2C: I2C1_SDA/SCL on MXM3 pin 209/211 (e.g. RTC on carrier
69 * board)
70 */
71 i2c@7000c000 {
72 status = "okay";
73 clock-frequency = <100000>;
74
75 pcie-switch@58 {
76 compatible = "plx,pex8605";
77 reg = <0x58>;
78 };
79
80 /* M41T0M6 real time clock on carrier board */
81 rtc@68 {
82 compatible = "st,m41t00";
83 reg = <0x68>;
84 };
85 };
86
87 /* GEN2_I2C: unused */
88
89 /*
90 * CAM_I2C: I2C3_SDA/SCL on MXM3 pin 201/203 (e.g. camera sensor on
91 * carrier board)
92 */
93 cami2c: i2c@7000c500 {
94 status = "okay";
95 clock-frequency = <400000>;
96 };
97
98 /* DDC: I2C2_SDA/SCL on MXM3 pin 205/207 (e.g. display EDID) */
99 hdmiddc: i2c@7000c700 {
100 status = "okay";
101 };
102
103 /* SPI1: Apalis SPI1 */
104 spi@7000d400 {
105 status = "okay";
106 spi-max-frequency = <25000000>;
107 spidev0: spidev@1 {
108 compatible = "spidev";
109 reg = <1>;
110 spi-max-frequency = <25000000>;
111 };
112 };
113
114 /* SPI5: Apalis SPI2 */
115 spi@7000dc00 {
116 status = "okay";
117 spi-max-frequency = <25000000>;
118 spidev1: spidev@2 {
119 compatible = "spidev";
120 reg = <2>;
121 spi-max-frequency = <25000000>;
122 };
123 };
124
125 sd1: sdhci@78000000 {
126 status = "okay";
127 bus-width = <4>;
128 /* SD1_CD# */
129 cd-gpios = <&gpio TEGRA_GPIO(CC, 5) GPIO_ACTIVE_LOW>;
130 no-1-8-v;
131 };
132
133 mmc1: sdhci@78000400 {
134 status = "okay";
135 bus-width = <8>;
136 /* MMC1_CD# */
137 cd-gpios = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_LOW>;
138 no-1-8-v;
139 };
140
141 /* EHCI instance 0: USB1_DP/N -> USBO1_DP/N */
142 usb@7d000000 {
143 status = "okay";
144 };
145
146 usb-phy@7d000000 {
147 status = "okay";
148 vbus-supply = <&usbo1_vbus_reg>;
149 };
150
151 /* EHCI instance 1: USB2_DP/N -> USBH2_DP/N */
152 usb@7d004000 {
153 status = "okay";
154 };
155
156 usb-phy@7d004000 {
157 status = "okay";
158 vbus-supply = <&usbh_vbus_reg>;
159 };
160
161 /* EHCI instance 2: USB3_DP/N -> USBH3_DP/N */
162 usb@7d008000 {
163 status = "okay";
164 };
165
166 usb-phy@7d008000 {
167 status = "okay";
168 vbus-supply = <&usbh_vbus_reg>;
169 };
170
171 backlight: backlight {
172 compatible = "pwm-backlight";
173
174 /* PWM0 */
175 pwms = <&pwm 0 5000000>;
176 brightness-levels = <255 231 223 207 191 159 127 0>;
177 default-brightness-level = <6>;
178 /* BKL1_ON */
179 enable-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
180 };
181
182 gpio-keys {
183 compatible = "gpio-keys";
184
185 power {
186 label = "Power";
187 gpios = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_LOW>;
188 linux,code = <KEY_POWER>;
189 debounce-interval = <10>;
190 gpio-key,wakeup;
191 };
192 };
193
194 panel: panel {
195 /*
196 * edt,et057090dhu: EDT 5.7" LCD TFT
197 * edt,et070080dh6: EDT 7.0" LCD TFT
198 */
199 compatible = "edt,et057090dhu", "simple-panel";
200
201 backlight = <&backlight>;
202 };
203
204 pwmleds {
205 compatible = "pwm-leds";
206
207 pwm1 {
208 label = "PWM1";
209 pwms = <&pwm 3 19600>;
210 max-brightness = <255>;
211 };
212
213 pwm2 {
214 label = "PWM2";
215 pwms = <&pwm 2 19600>;
216 max-brightness = <255>;
217 };
218
219 pwm3 {
220 label = "PWM3";
221 pwms = <&pwm 1 19600>;
222 max-brightness = <255>;
223 };
224 };
225
226 regulators {
227 sys_5v0_reg: regulator@1 {
228 compatible = "regulator-fixed";
229 reg = <1>;
230 regulator-name = "5v0";
231 regulator-min-microvolt = <5000000>;
232 regulator-max-microvolt = <5000000>;
233 regulator-always-on;
234 };
235
236 /* USBO1_EN */
237 usbo1_vbus_reg: regulator@2 {
238 compatible = "regulator-fixed";
239 reg = <2>;
240 regulator-name = "usbo1_vbus";
241 regulator-min-microvolt = <5000000>;
242 regulator-max-microvolt = <5000000>;
243 gpio = <&gpio TEGRA_GPIO(T, 5) GPIO_ACTIVE_HIGH>;
244 enable-active-high;
245 vin-supply = <&sys_5v0_reg>;
246 };
247
248 /* USBH_EN */
249 usbh_vbus_reg: regulator@3 {
250 compatible = "regulator-fixed";
251 reg = <3>;
252 regulator-name = "usbh_vbus";
253 regulator-min-microvolt = <5000000>;
254 regulator-max-microvolt = <5000000>;
255 gpio = <&gpio TEGRA_GPIO(DD, 1) GPIO_ACTIVE_HIGH>;
256 enable-active-high;
257 vin-supply = <&sys_5v0_reg>;
258 };
259 };
260};
diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi
new file mode 100644
index 000000000000..8adaa7871dd3
--- /dev/null
+++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
@@ -0,0 +1,678 @@
1#include "tegra30.dtsi"
2
3/*
4 * Toradex Apalis T30 Device Tree
5 * Compatible for Revisions 1GB: V1.0A; 2GB: V1.0B, V1.0C
6 */
7/ {
8 model = "Toradex Apalis T30";
9 compatible = "toradex,apalis_t30", "nvidia,tegra30";
10
11 pcie-controller@00003000 {
12 avdd-pexa-supply = <&vdd2_reg>;
13 vdd-pexa-supply = <&vdd2_reg>;
14 avdd-pexb-supply = <&vdd2_reg>;
15 vdd-pexb-supply = <&vdd2_reg>;
16 avdd-pex-pll-supply = <&vdd2_reg>;
17 avdd-plle-supply = <&ldo6_reg>;
18 vddio-pex-ctl-supply = <&sys_3v3_reg>;
19 hvdd-pex-supply = <&sys_3v3_reg>;
20
21 pci@1,0 {
22 nvidia,num-lanes = <4>;
23 };
24
25 pci@2,0 {
26 nvidia,num-lanes = <1>;
27 };
28
29 pci@3,0 {
30 nvidia,num-lanes = <1>;
31 };
32 };
33
34 host1x@50000000 {
35 hdmi@54280000 {
36 vdd-supply = <&sys_3v3_reg>;
37 pll-supply = <&vio_reg>;
38
39 nvidia,hpd-gpio =
40 <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
41 nvidia,ddc-i2c-bus = <&hdmiddc>;
42 };
43 };
44
45 pinmux@70000868 {
46 pinctrl-names = "default";
47 pinctrl-0 = <&state_default>;
48
49 state_default: pinmux {
50 /* Apalis BKL1_ON */
51 pv2 {
52 nvidia,pins = "pv2";
53 nvidia,function = "rsvd4";
54 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
55 nvidia,tristate = <TEGRA_PIN_DISABLE>;
56 };
57
58 /* Apalis BKL1_PWM */
59 uart3_rts_n_pc0 {
60 nvidia,pins = "uart3_rts_n_pc0";
61 nvidia,function = "pwm0";
62 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
63 nvidia,tristate = <TEGRA_PIN_DISABLE>;
64 };
65 /* BKL1_PWM_EN#, disable TPS65911 PMIC PWM backlight */
66 uart3_cts_n_pa1 {
67 nvidia,pins = "uart3_cts_n_pa1";
68 nvidia,function = "rsvd1";
69 nvidia,pull = <TEGRA_PIN_PULL_UP>;
70 nvidia,tristate = <TEGRA_PIN_DISABLE>;
71 };
72
73 /* Apalis CAN1 on SPI6 */
74 spi2_cs0_n_px3 {
75 nvidia,pins = "spi2_cs0_n_px3",
76 "spi2_miso_px1",
77 "spi2_mosi_px0",
78 "spi2_sck_px2";
79 nvidia,function = "spi6";
80 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
81 nvidia,tristate = <TEGRA_PIN_DISABLE>;
82 };
83 /* CAN_INT1 */
84 spi2_cs1_n_pw2 {
85 nvidia,pins = "spi2_cs1_n_pw2";
86 nvidia,function = "spi3";
87 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
88 nvidia,tristate = <TEGRA_PIN_DISABLE>;
89 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
90 };
91
92 /* Apalis CAN2 on SPI4 */
93 gmi_a16_pj7 {
94 nvidia,pins = "gmi_a16_pj7",
95 "gmi_a17_pb0",
96 "gmi_a18_pb1",
97 "gmi_a19_pk7";
98 nvidia,function = "spi4";
99 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
100 nvidia,tristate = <TEGRA_PIN_DISABLE>;
101 };
102 /* CAN_INT2 */
103 spi2_cs2_n_pw3 {
104 nvidia,pins = "spi2_cs2_n_pw3";
105 nvidia,function = "spi3";
106 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
107 nvidia,tristate = <TEGRA_PIN_DISABLE>;
108 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
109 };
110
111 /* Apalis I2C3 */
112 cam_i2c_scl_pbb1 {
113 nvidia,pins = "cam_i2c_scl_pbb1",
114 "cam_i2c_sda_pbb2";
115 nvidia,function = "i2c3";
116 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
117 nvidia,tristate = <TEGRA_PIN_DISABLE>;
118 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
119 nvidia,lock = <TEGRA_PIN_DISABLE>;
120 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
121 };
122
123 /* Apalis MMC1 */
124 sdmmc3_clk_pa6 {
125 nvidia,pins = "sdmmc3_clk_pa6",
126 "sdmmc3_cmd_pa7";
127 nvidia,function = "sdmmc3";
128 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
129 nvidia,tristate = <TEGRA_PIN_DISABLE>;
130 };
131 sdmmc3_dat0_pb7 {
132 nvidia,pins = "sdmmc3_dat0_pb7",
133 "sdmmc3_dat1_pb6",
134 "sdmmc3_dat2_pb5",
135 "sdmmc3_dat3_pb4",
136 "sdmmc3_dat4_pd1",
137 "sdmmc3_dat5_pd0",
138 "sdmmc3_dat6_pd3",
139 "sdmmc3_dat7_pd4";
140 nvidia,function = "sdmmc3";
141 nvidia,pull = <TEGRA_PIN_PULL_UP>;
142 nvidia,tristate = <TEGRA_PIN_DISABLE>;
143 };
144 /* Apalis MMC1_CD# */
145 pv3 {
146 nvidia,pins = "pv3";
147 nvidia,function = "rsvd2";
148 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
149 nvidia,tristate = <TEGRA_PIN_DISABLE>;
150 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
151 };
152
153 /* Apalis PWM1 */
154 gpio_pu6 {
155 nvidia,pins = "gpio_pu6";
156 nvidia,function = "pwm3";
157 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
158 nvidia,tristate = <TEGRA_PIN_DISABLE>;
159 };
160
161 /* Apalis PWM2 */
162 gpio_pu5 {
163 nvidia,pins = "gpio_pu5";
164 nvidia,function = "pwm2";
165 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
166 nvidia,tristate = <TEGRA_PIN_DISABLE>;
167 };
168
169 /* Apalis PWM3 */
170 gpio_pu4 {
171 nvidia,pins = "gpio_pu4";
172 nvidia,function = "pwm1";
173 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
174 nvidia,tristate = <TEGRA_PIN_DISABLE>;
175 };
176
177 /* Apalis PWM4 */
178 gpio_pu3 {
179 nvidia,pins = "gpio_pu3";
180 nvidia,function = "pwm0";
181 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
182 nvidia,tristate = <TEGRA_PIN_DISABLE>;
183 };
184
185 /* Apalis RESET_MOCI# */
186 gmi_rst_n_pi4 {
187 nvidia,pins = "gmi_rst_n_pi4";
188 nvidia,function = "gmi";
189 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
190 nvidia,tristate = <TEGRA_PIN_DISABLE>;
191 };
192
193 /* Apalis SD1 */
194 sdmmc1_clk_pz0 {
195 nvidia,pins = "sdmmc1_clk_pz0";
196 nvidia,function = "sdmmc1";
197 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
198 nvidia,tristate = <TEGRA_PIN_DISABLE>;
199 };
200 sdmmc1_cmd_pz1 {
201 nvidia,pins = "sdmmc1_cmd_pz1",
202 "sdmmc1_dat0_py7",
203 "sdmmc1_dat1_py6",
204 "sdmmc1_dat2_py5",
205 "sdmmc1_dat3_py4";
206 nvidia,function = "sdmmc1";
207 nvidia,pull = <TEGRA_PIN_PULL_UP>;
208 nvidia,tristate = <TEGRA_PIN_DISABLE>;
209 };
210 /* Apalis SD1_CD# */
211 clk2_req_pcc5 {
212 nvidia,pins = "clk2_req_pcc5";
213 nvidia,function = "rsvd2";
214 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
215 nvidia,tristate = <TEGRA_PIN_DISABLE>;
216 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
217 };
218
219 /* Apalis SPI1 */
220 spi1_sck_px5 {
221 nvidia,pins = "spi1_sck_px5",
222 "spi1_mosi_px4",
223 "spi1_miso_px7",
224 "spi1_cs0_n_px6";
225 nvidia,function = "spi1";
226 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
227 nvidia,tristate = <TEGRA_PIN_DISABLE>;
228 };
229
230 /* Apalis SPI2 */
231 lcd_sck_pz4 {
232 nvidia,pins = "lcd_sck_pz4",
233 "lcd_sdout_pn5",
234 "lcd_sdin_pz2",
235 "lcd_cs0_n_pn4";
236 nvidia,function = "spi5";
237 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
238 nvidia,tristate = <TEGRA_PIN_DISABLE>;
239 };
240
241 /* Apalis UART1 */
242 ulpi_data0 {
243 nvidia,pins = "ulpi_data0_po1",
244 "ulpi_data1_po2",
245 "ulpi_data2_po3",
246 "ulpi_data3_po4",
247 "ulpi_data4_po5",
248 "ulpi_data5_po6",
249 "ulpi_data6_po7",
250 "ulpi_data7_po0";
251 nvidia,function = "uarta";
252 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
253 nvidia,tristate = <TEGRA_PIN_DISABLE>;
254 };
255
256 /* Apalis UART2 */
257 ulpi_clk_py0 {
258 nvidia,pins = "ulpi_clk_py0",
259 "ulpi_dir_py1",
260 "ulpi_nxt_py2",
261 "ulpi_stp_py3";
262 nvidia,function = "uartd";
263 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
264 nvidia,tristate = <TEGRA_PIN_DISABLE>;
265 };
266
267 /* Apalis UART3 */
268 uart2_rxd_pc3 {
269 nvidia,pins = "uart2_rxd_pc3",
270 "uart2_txd_pc2";
271 nvidia,function = "uartb";
272 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
273 nvidia,tristate = <TEGRA_PIN_DISABLE>;
274 };
275
276 /* Apalis UART4 */
277 uart3_rxd_pw7 {
278 nvidia,pins = "uart3_rxd_pw7",
279 "uart3_txd_pw6";
280 nvidia,function = "uartc";
281 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
282 nvidia,tristate = <TEGRA_PIN_DISABLE>;
283 };
284
285 /* Apalis USBO1_EN */
286 gen2_i2c_scl_pt5 {
287 nvidia,pins = "gen2_i2c_scl_pt5";
288 nvidia,function = "rsvd4";
289 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
290 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
291 nvidia,tristate = <TEGRA_PIN_DISABLE>;
292 };
293
294 /* Apalis USBO1_OC# */
295 gen2_i2c_sda_pt6 {
296 nvidia,pins = "gen2_i2c_sda_pt6";
297 nvidia,function = "rsvd4";
298 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
299 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
300 nvidia,tristate = <TEGRA_PIN_DISABLE>;
301 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
302 };
303
304 /* Apalis WAKE1_MICO */
305 pv1 {
306 nvidia,pins = "pv1";
307 nvidia,function = "rsvd1";
308 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
309 nvidia,tristate = <TEGRA_PIN_DISABLE>;
310 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
311 };
312
313 /* eMMC (On-module) */
314 sdmmc4_clk_pcc4 {
315 nvidia,pins = "sdmmc4_clk_pcc4",
316 "sdmmc4_rst_n_pcc3";
317 nvidia,function = "sdmmc4";
318 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
319 nvidia,tristate = <TEGRA_PIN_DISABLE>;
320 };
321 sdmmc4_dat0_paa0 {
322 nvidia,pins = "sdmmc4_dat0_paa0",
323 "sdmmc4_dat1_paa1",
324 "sdmmc4_dat2_paa2",
325 "sdmmc4_dat3_paa3",
326 "sdmmc4_dat4_paa4",
327 "sdmmc4_dat5_paa5",
328 "sdmmc4_dat6_paa6",
329 "sdmmc4_dat7_paa7";
330 nvidia,function = "sdmmc4";
331 nvidia,pull = <TEGRA_PIN_PULL_UP>;
332 nvidia,tristate = <TEGRA_PIN_DISABLE>;
333 };
334
335 /* LVDS Transceiver Configuration */
336 pbb0 {
337 nvidia,pins = "pbb0",
338 "pbb7",
339 "pcc1",
340 "pcc2";
341 nvidia,function = "rsvd2";
342 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
343 nvidia,tristate = <TEGRA_PIN_DISABLE>;
344 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
345 nvidia,lock = <TEGRA_PIN_DISABLE>;
346 };
347 pbb3 {
348 nvidia,pins = "pbb3",
349 "pbb4",
350 "pbb5",
351 "pbb6";
352 nvidia,function = "displayb";
353 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
354 nvidia,tristate = <TEGRA_PIN_DISABLE>;
355 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
356 nvidia,lock = <TEGRA_PIN_DISABLE>;
357 };
358
359 /* Power I2C (On-module) */
360 pwr_i2c_scl_pz6 {
361 nvidia,pins = "pwr_i2c_scl_pz6",
362 "pwr_i2c_sda_pz7";
363 nvidia,function = "i2cpwr";
364 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
365 nvidia,tristate = <TEGRA_PIN_DISABLE>;
366 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
367 nvidia,lock = <TEGRA_PIN_DISABLE>;
368 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
369 };
370
371 /*
372 * THERMD_ALERT#, unlatched I2C address pin of LM95245
373 * temperature sensor therefore requires disabling for
374 * now
375 */
376 lcd_dc1_pd2 {
377 nvidia,pins = "lcd_dc1_pd2";
378 nvidia,function = "rsvd3";
379 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
380 nvidia,tristate = <TEGRA_PIN_DISABLE>;
381 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
382 };
383
384 /* TOUCH_PEN_INT# */
385 pv0 {
386 nvidia,pins = "pv0";
387 nvidia,function = "rsvd1";
388 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
389 nvidia,tristate = <TEGRA_PIN_DISABLE>;
390 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
391 };
392 };
393 };
394
395 hdmiddc: i2c@7000c700 {
396 clock-frequency = <100000>;
397 };
398
399 /*
400 * PWR_I2C: power I2C to audio codec, PMIC, temperature sensor and
401 * touch screen controller
402 */
403 i2c@7000d000 {
404 status = "okay";
405 clock-frequency = <100000>;
406
407 pmic: tps65911@2d {
408 compatible = "ti,tps65911";
409 reg = <0x2d>;
410
411 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
412 #interrupt-cells = <2>;
413 interrupt-controller;
414
415 ti,system-power-controller;
416
417 #gpio-cells = <2>;
418 gpio-controller;
419
420 vcc1-supply = <&sys_3v3_reg>;
421 vcc2-supply = <&sys_3v3_reg>;
422 vcc3-supply = <&vio_reg>;
423 vcc4-supply = <&sys_3v3_reg>;
424 vcc5-supply = <&sys_3v3_reg>;
425 vcc6-supply = <&vio_reg>;
426 vcc7-supply = <&sys_5v0_reg>;
427 vccio-supply = <&sys_3v3_reg>;
428
429 regulators {
430 /* SW1: +V1.35_VDDIO_DDR */
431 vdd1_reg: vdd1 {
432 regulator-name = "vddio_ddr_1v35";
433 regulator-min-microvolt = <1350000>;
434 regulator-max-microvolt = <1350000>;
435 regulator-always-on;
436 };
437
438 /* SW2: +V1.05 */
439 vdd2_reg: vdd2 {
440 regulator-name =
441 "vdd_pexa,vdd_pexb,vdd_sata";
442 regulator-min-microvolt = <1050000>;
443 regulator-max-microvolt = <1050000>;
444 };
445
446 /* SW CTRL: +V1.0_VDD_CPU */
447 vddctrl_reg: vddctrl {
448 regulator-name = "vdd_cpu,vdd_sys";
449 regulator-min-microvolt = <1150000>;
450 regulator-max-microvolt = <1150000>;
451 regulator-always-on;
452 };
453
454 /* SWIO: +V1.8 */
455 vio_reg: vio {
456 regulator-name = "vdd_1v8_gen";
457 regulator-min-microvolt = <1800000>;
458 regulator-max-microvolt = <1800000>;
459 regulator-always-on;
460 };
461
462 /* LDO1: unused */
463
464 /*
465 * EN_+V3.3 switching via FET:
466 * +V3.3_AUDIO_AVDD_S, +V3.3 and +V1.8_VDD_LAN
467 * see also v3_3 fixed supply
468 */
469 ldo2_reg: ldo2 {
470 regulator-name = "en_3v3";
471 regulator-min-microvolt = <3300000>;
472 regulator-max-microvolt = <3300000>;
473 regulator-always-on;
474 };
475
476 /* +V1.2_CSI */
477 ldo3_reg: ldo3 {
478 regulator-name =
479 "avdd_dsi_csi,pwrdet_mipi";
480 regulator-min-microvolt = <1200000>;
481 regulator-max-microvolt = <1200000>;
482 };
483
484 /* +V1.2_VDD_RTC */
485 ldo4_reg: ldo4 {
486 regulator-name = "vdd_rtc";
487 regulator-min-microvolt = <1200000>;
488 regulator-max-microvolt = <1200000>;
489 regulator-always-on;
490 };
491
492 /*
493 * +V2.8_AVDD_VDAC:
494 * only required for analog RGB
495 */
496 ldo5_reg: ldo5 {
497 regulator-name = "avdd_vdac";
498 regulator-min-microvolt = <2800000>;
499 regulator-max-microvolt = <2800000>;
500 regulator-always-on;
501 };
502
503 /*
504 * +V1.05_AVDD_PLLE: avdd_plle should be 1.05V
505 * but LDO6 can't set voltage in 50mV
506 * granularity
507 */
508 ldo6_reg: ldo6 {
509 regulator-name = "avdd_plle";
510 regulator-min-microvolt = <1100000>;
511 regulator-max-microvolt = <1100000>;
512 };
513
514 /* +V1.2_AVDD_PLL */
515 ldo7_reg: ldo7 {
516 regulator-name = "avdd_pll";
517 regulator-min-microvolt = <1200000>;
518 regulator-max-microvolt = <1200000>;
519 regulator-always-on;
520 };
521
522 /* +V1.0_VDD_DDR_HS */
523 ldo8_reg: ldo8 {
524 regulator-name = "vdd_ddr_hs";
525 regulator-min-microvolt = <1000000>;
526 regulator-max-microvolt = <1000000>;
527 regulator-always-on;
528 };
529 };
530 };
531
532 /* STMPE811 touch screen controller */
533 stmpe811@41 {
534 compatible = "st,stmpe811";
535 #address-cells = <1>;
536 #size-cells = <0>;
537 reg = <0x41>;
538 interrupts = <TEGRA_GPIO(V, 0) IRQ_TYPE_LEVEL_LOW>;
539 interrupt-parent = <&gpio>;
540 interrupt-controller;
541 id = <0>;
542 blocks = <0x5>;
543 irq-trigger = <0x1>;
544
545 stmpe_touchscreen {
546 compatible = "st,stmpe-ts";
547 reg = <0>;
548 /* 3.25 MHz ADC clock speed */
549 st,adc-freq = <1>;
550 /* 8 sample average control */
551 st,ave-ctrl = <3>;
552 /* 7 length fractional part in z */
553 st,fraction-z = <7>;
554 /*
555 * 50 mA typical 80 mA max touchscreen drivers
556 * current limit value
557 */
558 st,i-drive = <1>;
559 /* 12-bit ADC */
560 st,mod-12b = <1>;
561 /* internal ADC reference */
562 st,ref-sel = <0>;
563 /* ADC converstion time: 80 clocks */
564 st,sample-time = <4>;
565 /* 1 ms panel driver settling time */
566 st,settling = <3>;
567 /* 5 ms touch detect interrupt delay */
568 st,touch-det-delay = <5>;
569 };
570 };
571
572 /*
573 * LM95245 temperature sensor
574 * Note: OVERT_N directly connected to PMIC PWRDN
575 */
576 temp-sensor@4c {
577 compatible = "national,lm95245";
578 reg = <0x4c>;
579 };
580
581 /* SW: +V1.2_VDD_CORE */
582 tps62362@60 {
583 compatible = "ti,tps62362";
584 reg = <0x60>;
585
586 regulator-name = "tps62362-vout";
587 regulator-min-microvolt = <900000>;
588 regulator-max-microvolt = <1400000>;
589 regulator-boot-on;
590 regulator-always-on;
591 ti,vsel0-state-low;
592 /* VSEL1: EN_CORE_DVFS_N low for DVFS */
593 ti,vsel1-state-low;
594 };
595 };
596
597 /* SPI4: CAN2 */
598 spi@7000da00 {
599 status = "okay";
600 spi-max-frequency = <10000000>;
601
602 can@1 {
603 compatible = "microchip,mcp2515";
604 reg = <1>;
605 clocks = <&clk16m>;
606 interrupt-parent = <&gpio>;
607 interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_LOW>;
608 spi-max-frequency = <10000000>;
609 };
610 };
611
612 /* SPI6: CAN1 */
613 spi@7000de00 {
614 status = "okay";
615 spi-max-frequency = <10000000>;
616
617 can@0 {
618 compatible = "microchip,mcp2515";
619 reg = <0>;
620 clocks = <&clk16m>;
621 interrupt-parent = <&gpio>;
622 interrupts = <TEGRA_GPIO(W, 2) GPIO_ACTIVE_LOW>;
623 spi-max-frequency = <10000000>;
624 };
625 };
626
627 pmc@7000e400 {
628 nvidia,invert-interrupt;
629 nvidia,suspend-mode = <1>;
630 nvidia,cpu-pwr-good-time = <5000>;
631 nvidia,cpu-pwr-off-time = <5000>;
632 nvidia,core-pwr-good-time = <3845 3845>;
633 nvidia,core-pwr-off-time = <0>;
634 nvidia,core-power-req-active-high;
635 nvidia,sys-clock-req-active-high;
636 };
637
638 sdhci@78000600 {
639 status = "okay";
640 bus-width = <8>;
641 non-removable;
642 };
643
644 clocks {
645 compatible = "simple-bus";
646 #address-cells = <1>;
647 #size-cells = <0>;
648
649 clk32k_in: clk@0 {
650 compatible = "fixed-clock";
651 reg=<0>;
652 #clock-cells = <0>;
653 clock-frequency = <32768>;
654 };
655 clk16m: clk@1 {
656 compatible = "fixed-clock";
657 reg=<1>;
658 #clock-cells = <0>;
659 clock-frequency = <16000000>;
660 clock-output-names = "clk16m";
661 };
662 };
663
664 regulators {
665 compatible = "simple-bus";
666 #address-cells = <1>;
667 #size-cells = <0>;
668
669 sys_3v3_reg: regulator@100 {
670 compatible = "regulator-fixed";
671 reg = <100>;
672 regulator-name = "3v3";
673 regulator-min-microvolt = <3300000>;
674 regulator-max-microvolt = <3300000>;
675 regulator-always-on;
676 };
677 };
678};
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index 3189791a9289..cee8f2246fdb 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -17,9 +17,15 @@
17 17
18 pcie-controller@00003000 { 18 pcie-controller@00003000 {
19 status = "okay"; 19 status = "okay";
20 pex-clk-supply = <&sys_3v3_pexs_reg>; 20
21 vdd-supply = <&ldo1_reg>; 21 avdd-pexa-supply = <&ldo1_reg>;
22 avdd-supply = <&ldo2_reg>; 22 vdd-pexa-supply = <&ldo1_reg>;
23 avdd-pexb-supply = <&ldo1_reg>;
24 vdd-pexb-supply = <&ldo1_reg>;
25 avdd-pex-pll-supply = <&ldo1_reg>;
26 avdd-plle-supply = <&ldo1_reg>;
27 vddio-pex-ctl-supply = <&sys_3v3_reg>;
28 hvdd-pex-supply = <&sys_3v3_pexs_reg>;
23 29
24 pci@1,0 { 30 pci@1,0 {
25 status = "okay"; 31 status = "okay";
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index 0cf0848a82d8..206379546244 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -38,9 +38,14 @@
38 38
39 pcie-controller@00003000 { 39 pcie-controller@00003000 {
40 status = "okay"; 40 status = "okay";
41 pex-clk-supply = <&pex_hvdd_3v3_reg>; 41
42 vdd-supply = <&ldo1_reg>; 42 /* AVDD_PEXA and VDD_PEXA inputs are grounded on Cardhu. */
43 avdd-supply = <&ldo2_reg>; 43 avdd-pexb-supply = <&ldo1_reg>;
44 vdd-pexb-supply = <&ldo1_reg>;
45 avdd-pex-pll-supply = <&ldo1_reg>;
46 hvdd-pex-supply = <&pex_hvdd_3v3_reg>;
47 vddio-pex-ctl-supply = <&sys_3v3_reg>;
48 avdd-plle-supply = <&ldo2_reg>;
44 49
45 pci@1,0 { 50 pci@1,0 {
46 nvidia,num-lanes = <4>; 51 nvidia,num-lanes = <4>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index dec4fc823901..6b35c29278d7 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -335,6 +335,12 @@
335 interrupt-controller; 335 interrupt-controller;
336 }; 336 };
337 337
338 apbmisc@70000800 {
339 compatible = "nvidia,tegra30-apbmisc", "nvidia,tegra20-apbmisc";
340 reg = <0x70000800 0x64 /* Chip revision */
341 0x70000008 0x04>; /* Strapping options */
342 };
343
338 pinmux: pinmux@70000868 { 344 pinmux: pinmux@70000868 {
339 compatible = "nvidia,tegra30-pinmux"; 345 compatible = "nvidia,tegra30-pinmux";
340 reg = <0x70000868 0xd4 /* Pad control registers */ 346 reg = <0x70000868 0xd4 /* Pad control registers */
@@ -631,6 +637,15 @@
631 nvidia,ahb = <&ahb>; 637 nvidia,ahb = <&ahb>;
632 }; 638 };
633 639
640 fuse@7000f800 {
641 compatible = "nvidia,tegra30-efuse";
642 reg = <0x7000f800 0x400>;
643 clocks = <&tegra_car TEGRA30_CLK_FUSE>;
644 clock-names = "fuse";
645 resets = <&tegra_car 39>;
646 reset-names = "fuse";
647 };
648
634 ahub@70080000 { 649 ahub@70080000 {
635 compatible = "nvidia,tegra30-ahub"; 650 compatible = "nvidia,tegra30-ahub";
636 reg = <0x70080000 0x200 651 reg = <0x70080000 0x200
@@ -775,6 +790,8 @@
775 <&tegra_car TEGRA30_CLK_PLL_U>, 790 <&tegra_car TEGRA30_CLK_PLL_U>,
776 <&tegra_car TEGRA30_CLK_USBD>; 791 <&tegra_car TEGRA30_CLK_USBD>;
777 clock-names = "reg", "pll_u", "utmi-pads"; 792 clock-names = "reg", "pll_u", "utmi-pads";
793 resets = <&tegra_car 22>, <&tegra_car 22>;
794 reset-names = "usb", "utmi-pads";
778 nvidia,hssync-start-delay = <9>; 795 nvidia,hssync-start-delay = <9>;
779 nvidia,idle-wait-delay = <17>; 796 nvidia,idle-wait-delay = <17>;
780 nvidia,elastic-limit = <16>; 797 nvidia,elastic-limit = <16>;
@@ -786,6 +803,7 @@
786 nvidia,xcvr-hsslew = <32>; 803 nvidia,xcvr-hsslew = <32>;
787 nvidia,hssquelch-level = <2>; 804 nvidia,hssquelch-level = <2>;
788 nvidia,hsdiscon-level = <5>; 805 nvidia,hsdiscon-level = <5>;
806 nvidia,has-utmi-pad-registers;
789 status = "disabled"; 807 status = "disabled";
790 }; 808 };
791 809
@@ -809,6 +827,8 @@
809 <&tegra_car TEGRA30_CLK_PLL_U>, 827 <&tegra_car TEGRA30_CLK_PLL_U>,
810 <&tegra_car TEGRA30_CLK_USBD>; 828 <&tegra_car TEGRA30_CLK_USBD>;
811 clock-names = "reg", "pll_u", "utmi-pads"; 829 clock-names = "reg", "pll_u", "utmi-pads";
830 resets = <&tegra_car 58>, <&tegra_car 22>;
831 reset-names = "usb", "utmi-pads";
812 nvidia,hssync-start-delay = <9>; 832 nvidia,hssync-start-delay = <9>;
813 nvidia,idle-wait-delay = <17>; 833 nvidia,idle-wait-delay = <17>;
814 nvidia,elastic-limit = <16>; 834 nvidia,elastic-limit = <16>;
@@ -843,6 +863,8 @@
843 <&tegra_car TEGRA30_CLK_PLL_U>, 863 <&tegra_car TEGRA30_CLK_PLL_U>,
844 <&tegra_car TEGRA30_CLK_USBD>; 864 <&tegra_car TEGRA30_CLK_USBD>;
845 clock-names = "reg", "pll_u", "utmi-pads"; 865 clock-names = "reg", "pll_u", "utmi-pads";
866 resets = <&tegra_car 59>, <&tegra_car 22>;
867 reset-names = "usb", "utmi-pads";
846 nvidia,hssync-start-delay = <0>; 868 nvidia,hssync-start-delay = <0>;
847 nvidia,idle-wait-delay = <17>; 869 nvidia,idle-wait-delay = <17>;
848 nvidia,elastic-limit = <16>; 870 nvidia,elastic-limit = <16>;
diff --git a/arch/arm/boot/dts/tny_a9260_common.dtsi b/arch/arm/boot/dts/tny_a9260_common.dtsi
index 0e6d3de2e09e..ce7138c3af1b 100644
--- a/arch/arm/boot/dts/tny_a9260_common.dtsi
+++ b/arch/arm/boot/dts/tny_a9260_common.dtsi
@@ -24,6 +24,14 @@
24 compatible = "atmel,osc", "fixed-clock"; 24 compatible = "atmel,osc", "fixed-clock";
25 clock-frequency = <12000000>; 25 clock-frequency = <12000000>;
26 }; 26 };
27
28 slow_xtal {
29 clock-frequency = <32768>;
30 };
31
32 main_xtal {
33 clock-frequency = <12000000>;
34 };
27 }; 35 };
28 36
29 ahb { 37 ahb {
diff --git a/arch/arm/boot/dts/tny_a9263.dts b/arch/arm/boot/dts/tny_a9263.dts
index 0751a6a979a8..3043296345b7 100644
--- a/arch/arm/boot/dts/tny_a9263.dts
+++ b/arch/arm/boot/dts/tny_a9263.dts
@@ -29,6 +29,14 @@
29 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>; 30 clock-frequency = <12000000>;
31 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <12000000>;
39 };
32 }; 40 };
33 41
34 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/usb_a9260_common.dtsi b/arch/arm/boot/dts/usb_a9260_common.dtsi
index 285977682cf3..12edafefd44a 100644
--- a/arch/arm/boot/dts/usb_a9260_common.dtsi
+++ b/arch/arm/boot/dts/usb_a9260_common.dtsi
@@ -16,6 +16,14 @@
16 compatible = "atmel,osc", "fixed-clock"; 16 compatible = "atmel,osc", "fixed-clock";
17 clock-frequency = <12000000>; 17 clock-frequency = <12000000>;
18 }; 18 };
19
20 slow_xtal {
21 clock-frequency = <32768>;
22 };
23
24 main_xtal {
25 clock-frequency = <12000000>;
26 };
19 }; 27 };
20 28
21 ahb { 29 ahb {
diff --git a/arch/arm/boot/dts/usb_a9263.dts b/arch/arm/boot/dts/usb_a9263.dts
index 290e60383baf..68c0de36c339 100644
--- a/arch/arm/boot/dts/usb_a9263.dts
+++ b/arch/arm/boot/dts/usb_a9263.dts
@@ -29,6 +29,14 @@
29 compatible = "atmel,osc", "fixed-clock"; 29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>; 30 clock-frequency = <12000000>;
31 }; 31 };
32
33 slow_xtal {
34 clock-frequency = <32768>;
35 };
36
37 main_xtal {
38 clock-frequency = <12000000>;
39 };
32 }; 40 };
33 41
34 ahb { 42 ahb {
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index e01e5a081def..27d0d9c8adf3 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -15,10 +15,49 @@
15 i2c0 = &i2c0; 15 i2c0 = &i2c0;
16 }; 16 };
17 17
18 chosen {
19 stdout-path = &uart0;
20 };
21
18 memory { 22 memory {
19 reg = <0x0 0x08000000>; 23 reg = <0x0 0x08000000>;
20 }; 24 };
21 25
26 xtal24mhz: xtal24mhz@24M {
27 #clock-cells = <0>;
28 compatible = "fixed-clock";
29 clock-frequency = <24000000>;
30 };
31
32 core-module@10000000 {
33 compatible = "arm,core-module-versatile", "syscon";
34 reg = <0x10000000 0x200>;
35
36 /* OSC1 on AB, OSC4 on PB */
37 osc1: cm_aux_osc@24M {
38 #clock-cells = <0>;
39 compatible = "arm,versatile-cm-auxosc";
40 clocks = <&xtal24mhz>;
41 };
42
43 /* The timer clock is the 24 MHz oscillator divided to 1MHz */
44 timclk: timclk@1M {
45 #clock-cells = <0>;
46 compatible = "fixed-factor-clock";
47 clock-div = <24>;
48 clock-mult = <1>;
49 clocks = <&xtal24mhz>;
50 };
51
52 pclk: pclk@24M {
53 #clock-cells = <0>;
54 compatible = "fixed-factor-clock";
55 clock-div = <1>;
56 clock-mult = <1>;
57 clocks = <&xtal24mhz>;
58 };
59 };
60
22 flash@34000000 { 61 flash@34000000 {
23 compatible = "arm,versatile-flash"; 62 compatible = "arm,versatile-flash";
24 reg = <0x34000000 0x4000000>; 63 reg = <0x34000000 0x4000000>;
@@ -59,6 +98,8 @@
59 interrupt-controller; 98 interrupt-controller;
60 #interrupt-cells = <1>; 99 #interrupt-cells = <1>;
61 reg = <0x10140000 0x1000>; 100 reg = <0x10140000 0x1000>;
101 clear-mask = <0xffffffff>;
102 valid-mask = <0xffffffff>;
62 }; 103 };
63 104
64 sic: intc@10003000 { 105 sic: intc@10003000 {
@@ -68,69 +109,93 @@
68 reg = <0x10003000 0x1000>; 109 reg = <0x10003000 0x1000>;
69 interrupt-parent = <&vic>; 110 interrupt-parent = <&vic>;
70 interrupts = <31>; /* Cascaded to vic */ 111 interrupts = <31>; /* Cascaded to vic */
112 clear-mask = <0xffffffff>;
113 valid-mask = <0xffc203f8>;
71 }; 114 };
72 115
73 dma@10130000 { 116 dma@10130000 {
74 compatible = "arm,pl081", "arm,primecell"; 117 compatible = "arm,pl081", "arm,primecell";
75 reg = <0x10130000 0x1000>; 118 reg = <0x10130000 0x1000>;
76 interrupts = <17>; 119 interrupts = <17>;
120 clocks = <&pclk>;
121 clock-names = "apb_pclk";
77 }; 122 };
78 123
79 uart0: uart@101f1000 { 124 uart0: uart@101f1000 {
80 compatible = "arm,pl011", "arm,primecell"; 125 compatible = "arm,pl011", "arm,primecell";
81 reg = <0x101f1000 0x1000>; 126 reg = <0x101f1000 0x1000>;
82 interrupts = <12>; 127 interrupts = <12>;
128 clocks = <&xtal24mhz>, <&pclk>;
129 clock-names = "uartclk", "apb_pclk";
83 }; 130 };
84 131
85 uart1: uart@101f2000 { 132 uart1: uart@101f2000 {
86 compatible = "arm,pl011", "arm,primecell"; 133 compatible = "arm,pl011", "arm,primecell";
87 reg = <0x101f2000 0x1000>; 134 reg = <0x101f2000 0x1000>;
88 interrupts = <13>; 135 interrupts = <13>;
136 clocks = <&xtal24mhz>, <&pclk>;
137 clock-names = "uartclk", "apb_pclk";
89 }; 138 };
90 139
91 uart2: uart@101f3000 { 140 uart2: uart@101f3000 {
92 compatible = "arm,pl011", "arm,primecell"; 141 compatible = "arm,pl011", "arm,primecell";
93 reg = <0x101f3000 0x1000>; 142 reg = <0x101f3000 0x1000>;
94 interrupts = <14>; 143 interrupts = <14>;
144 clocks = <&xtal24mhz>, <&pclk>;
145 clock-names = "uartclk", "apb_pclk";
95 }; 146 };
96 147
97 smc@10100000 { 148 smc@10100000 {
98 compatible = "arm,primecell"; 149 compatible = "arm,primecell";
99 reg = <0x10100000 0x1000>; 150 reg = <0x10100000 0x1000>;
151 clocks = <&pclk>;
152 clock-names = "apb_pclk";
100 }; 153 };
101 154
102 mpmc@10110000 { 155 mpmc@10110000 {
103 compatible = "arm,primecell"; 156 compatible = "arm,primecell";
104 reg = <0x10110000 0x1000>; 157 reg = <0x10110000 0x1000>;
158 clocks = <&pclk>;
159 clock-names = "apb_pclk";
105 }; 160 };
106 161
107 display@10120000 { 162 display@10120000 {
108 compatible = "arm,pl110", "arm,primecell"; 163 compatible = "arm,pl110", "arm,primecell";
109 reg = <0x10120000 0x1000>; 164 reg = <0x10120000 0x1000>;
110 interrupts = <16>; 165 interrupts = <16>;
166 clocks = <&osc1>, <&pclk>;
167 clock-names = "clcd", "apb_pclk";
111 }; 168 };
112 169
113 sctl@101e0000 { 170 sctl@101e0000 {
114 compatible = "arm,primecell"; 171 compatible = "arm,primecell";
115 reg = <0x101e0000 0x1000>; 172 reg = <0x101e0000 0x1000>;
173 clocks = <&pclk>;
174 clock-names = "apb_pclk";
116 }; 175 };
117 176
118 watchdog@101e1000 { 177 watchdog@101e1000 {
119 compatible = "arm,primecell"; 178 compatible = "arm,primecell";
120 reg = <0x101e1000 0x1000>; 179 reg = <0x101e1000 0x1000>;
121 interrupts = <0>; 180 interrupts = <0>;
181 clocks = <&pclk>;
182 clock-names = "apb_pclk";
122 }; 183 };
123 184
124 timer@101e2000 { 185 timer@101e2000 {
125 compatible = "arm,sp804", "arm,primecell"; 186 compatible = "arm,sp804", "arm,primecell";
126 reg = <0x101e2000 0x1000>; 187 reg = <0x101e2000 0x1000>;
127 interrupts = <4>; 188 interrupts = <4>;
189 clocks = <&timclk>, <&timclk>, <&pclk>;
190 clock-names = "timer0", "timer1", "apb_pclk";
128 }; 191 };
129 192
130 timer@101e3000 { 193 timer@101e3000 {
131 compatible = "arm,sp804", "arm,primecell"; 194 compatible = "arm,sp804", "arm,primecell";
132 reg = <0x101e3000 0x1000>; 195 reg = <0x101e3000 0x1000>;
133 interrupts = <5>; 196 interrupts = <5>;
197 clocks = <&timclk>, <&timclk>, <&pclk>;
198 clock-names = "timer0", "timer1", "apb_pclk";
134 }; 199 };
135 200
136 gpio0: gpio@101e4000 { 201 gpio0: gpio@101e4000 {
@@ -141,6 +206,8 @@
141 #gpio-cells = <2>; 206 #gpio-cells = <2>;
142 interrupt-controller; 207 interrupt-controller;
143 #interrupt-cells = <2>; 208 #interrupt-cells = <2>;
209 clocks = <&pclk>;
210 clock-names = "apb_pclk";
144 }; 211 };
145 212
146 gpio1: gpio@101e5000 { 213 gpio1: gpio@101e5000 {
@@ -151,24 +218,32 @@
151 #gpio-cells = <2>; 218 #gpio-cells = <2>;
152 interrupt-controller; 219 interrupt-controller;
153 #interrupt-cells = <2>; 220 #interrupt-cells = <2>;
221 clocks = <&pclk>;
222 clock-names = "apb_pclk";
154 }; 223 };
155 224
156 rtc@101e8000 { 225 rtc@101e8000 {
157 compatible = "arm,pl030", "arm,primecell"; 226 compatible = "arm,pl030", "arm,primecell";
158 reg = <0x101e8000 0x1000>; 227 reg = <0x101e8000 0x1000>;
159 interrupts = <10>; 228 interrupts = <10>;
229 clocks = <&pclk>;
230 clock-names = "apb_pclk";
160 }; 231 };
161 232
162 sci@101f0000 { 233 sci@101f0000 {
163 compatible = "arm,primecell"; 234 compatible = "arm,primecell";
164 reg = <0x101f0000 0x1000>; 235 reg = <0x101f0000 0x1000>;
165 interrupts = <15>; 236 interrupts = <15>;
237 clocks = <&pclk>;
238 clock-names = "apb_pclk";
166 }; 239 };
167 240
168 ssp@101f4000 { 241 ssp@101f4000 {
169 compatible = "arm,pl022", "arm,primecell"; 242 compatible = "arm,pl022", "arm,primecell";
170 reg = <0x101f4000 0x1000>; 243 reg = <0x101f4000 0x1000>;
171 interrupts = <11>; 244 interrupts = <11>;
245 clocks = <&xtal24mhz>, <&pclk>;
246 clock-names = "SSPCLK", "apb_pclk";
172 }; 247 };
173 248
174 fpga { 249 fpga {
@@ -181,23 +256,31 @@
181 compatible = "arm,primecell"; 256 compatible = "arm,primecell";
182 reg = <0x4000 0x1000>; 257 reg = <0x4000 0x1000>;
183 interrupts = <24>; 258 interrupts = <24>;
259 clocks = <&pclk>;
260 clock-names = "apb_pclk";
184 }; 261 };
185 mmc@5000 { 262 mmc@5000 {
186 compatible = "arm,primecell"; 263 compatible = "arm,pl180", "arm,primecell";
187 reg = < 0x5000 0x1000>; 264 reg = < 0x5000 0x1000>;
188 interrupts-extended = <&vic 22 &sic 2>; 265 interrupts-extended = <&vic 22 &sic 2>;
266 clocks = <&xtal24mhz>, <&pclk>;
267 clock-names = "mclk", "apb_pclk";
189 }; 268 };
190 kmi@6000 { 269 kmi@6000 {
191 compatible = "arm,pl050", "arm,primecell"; 270 compatible = "arm,pl050", "arm,primecell";
192 reg = <0x6000 0x1000>; 271 reg = <0x6000 0x1000>;
193 interrupt-parent = <&sic>; 272 interrupt-parent = <&sic>;
194 interrupts = <3>; 273 interrupts = <3>;
274 clocks = <&xtal24mhz>, <&pclk>;
275 clock-names = "KMIREFCLK", "apb_pclk";
195 }; 276 };
196 kmi@7000 { 277 kmi@7000 {
197 compatible = "arm,pl050", "arm,primecell"; 278 compatible = "arm,pl050", "arm,primecell";
198 reg = <0x7000 0x1000>; 279 reg = <0x7000 0x1000>;
199 interrupt-parent = <&sic>; 280 interrupt-parent = <&sic>;
200 interrupts = <4>; 281 interrupts = <4>;
282 clocks = <&xtal24mhz>, <&pclk>;
283 clock-names = "KMIREFCLK", "apb_pclk";
201 }; 284 };
202 }; 285 };
203 }; 286 };
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
index 65f657711323..e36c1e82fea7 100644
--- a/arch/arm/boot/dts/versatile-pb.dts
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -13,6 +13,8 @@
13 #gpio-cells = <2>; 13 #gpio-cells = <2>;
14 interrupt-controller; 14 interrupt-controller;
15 #interrupt-cells = <2>; 15 #interrupt-cells = <2>;
16 clocks = <&pclk>;
17 clock-names = "apb_pclk";
16 }; 18 };
17 19
18 gpio3: gpio@101e7000 { 20 gpio3: gpio@101e7000 {
@@ -23,6 +25,8 @@
23 #gpio-cells = <2>; 25 #gpio-cells = <2>;
24 interrupt-controller; 26 interrupt-controller;
25 #interrupt-cells = <2>; 27 #interrupt-cells = <2>;
28 clocks = <&pclk>;
29 clock-names = "apb_pclk";
26 }; 30 };
27 31
28 fpga { 32 fpga {
@@ -31,20 +35,24 @@
31 reg = <0x9000 0x1000>; 35 reg = <0x9000 0x1000>;
32 interrupt-parent = <&sic>; 36 interrupt-parent = <&sic>;
33 interrupts = <6>; 37 interrupts = <6>;
38 clocks = <&xtal24mhz>, <&pclk>;
39 clock-names = "uartclk", "apb_pclk";
34 }; 40 };
35 sci@a000 { 41 sci@a000 {
36 compatible = "arm,primecell"; 42 compatible = "arm,primecell";
37 reg = <0xa000 0x1000>; 43 reg = <0xa000 0x1000>;
38 interrupt-parent = <&sic>; 44 interrupt-parent = <&sic>;
39 interrupts = <5>; 45 interrupts = <5>;
46 clocks = <&xtal24mhz>;
47 clock-names = "apb_pclk";
40 }; 48 };
41 mmc@b000 { 49 mmc@b000 {
42 compatible = "arm,primecell"; 50 compatible = "arm,pl180", "arm,primecell";
43 reg = <0xb000 0x1000>; 51 reg = <0xb000 0x1000>;
44 interrupts-extended = <&vic 23 &sic 2>; 52 interrupts-extended = <&vic 23 &sic 2>;
53 clocks = <&xtal24mhz>, <&pclk>;
54 clock-names = "mclk", "apb_pclk";
45 }; 55 };
46 }; 56 };
47 }; 57 };
48}; 58};
49
50#include <testcases.dtsi>
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
index 6cc314e7b8fb..583dd363c9dc 100644
--- a/arch/arm/boot/dts/vf610.dtsi
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -14,6 +14,8 @@
14 14
15/ { 15/ {
16 aliases { 16 aliases {
17 can0 = &can0;
18 can1 = &can1;
17 serial0 = &uart0; 19 serial0 = &uart0;
18 serial1 = &uart1; 20 serial1 = &uart1;
19 serial2 = &uart2; 21 serial2 = &uart2;
@@ -103,6 +105,16 @@
103 <&clks VF610_CLK_DMAMUX1>; 105 <&clks VF610_CLK_DMAMUX1>;
104 }; 106 };
105 107
108 can0: flexcan@40020000 {
109 compatible = "fsl,vf610-flexcan";
110 reg = <0x40020000 0x4000>;
111 interrupts = <0 58 IRQ_TYPE_LEVEL_HIGH>;
112 clocks = <&clks VF610_CLK_FLEXCAN0>,
113 <&clks VF610_CLK_FLEXCAN0>;
114 clock-names = "ipg", "per";
115 status = "disabled";
116 };
117
106 uart0: serial@40027000 { 118 uart0: serial@40027000 {
107 compatible = "fsl,vf610-lpuart"; 119 compatible = "fsl,vf610-lpuart";
108 reg = <0x40027000 0x1000>; 120 reg = <0x40027000 0x1000>;
@@ -362,7 +374,7 @@
362 374
363 esdhc1: esdhc@400b2000 { 375 esdhc1: esdhc@400b2000 {
364 compatible = "fsl,imx53-esdhc"; 376 compatible = "fsl,imx53-esdhc";
365 reg = <0x400b2000 0x4000>; 377 reg = <0x400b2000 0x1000>;
366 interrupts = <0 28 0x04>; 378 interrupts = <0 28 0x04>;
367 clocks = <&clks VF610_CLK_IPG_BUS>, 379 clocks = <&clks VF610_CLK_IPG_BUS>,
368 <&clks VF610_CLK_PLATFORM_BUS>, 380 <&clks VF610_CLK_PLATFORM_BUS>,
@@ -405,6 +417,17 @@
405 clock-names = "ipg", "ahb", "ptp"; 417 clock-names = "ipg", "ahb", "ptp";
406 status = "disabled"; 418 status = "disabled";
407 }; 419 };
420
421 can1: flexcan@400d4000 {
422 compatible = "fsl,vf610-flexcan";
423 reg = <0x400d4000 0x4000>;
424 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>;
425 clocks = <&clks VF610_CLK_FLEXCAN1>,
426 <&clks VF610_CLK_FLEXCAN1>;
427 clock-names = "ipg", "per";
428 status = "disabled";
429 };
430
408 }; 431 };
409 }; 432 };
410}; 433};
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 760bbc463c5b..6cc83d4c6c76 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -65,6 +65,48 @@
65 interrupt-parent = <&intc>; 65 interrupt-parent = <&intc>;
66 ranges; 66 ranges;
67 67
68 adc@f8007100 {
69 compatible = "xlnx,zynq-xadc-1.00.a";
70 reg = <0xf8007100 0x20>;
71 interrupts = <0 7 4>;
72 interrupt-parent = <&intc>;
73 clocks = <&clkc 12>;
74 };
75
76 can0: can@e0008000 {
77 compatible = "xlnx,zynq-can-1.0";
78 status = "disabled";
79 clocks = <&clkc 19>, <&clkc 36>;
80 clock-names = "can_clk", "pclk";
81 reg = <0xe0008000 0x1000>;
82 interrupts = <0 28 4>;
83 interrupt-parent = <&intc>;
84 tx-fifo-depth = <0x40>;
85 rx-fifo-depth = <0x40>;
86 };
87
88 can1: can@e0009000 {
89 compatible = "xlnx,zynq-can-1.0";
90 status = "disabled";
91 clocks = <&clkc 20>, <&clkc 37>;
92 clock-names = "can_clk", "pclk";
93 reg = <0xe0009000 0x1000>;
94 interrupts = <0 51 4>;
95 interrupt-parent = <&intc>;
96 tx-fifo-depth = <0x40>;
97 rx-fifo-depth = <0x40>;
98 };
99
100 gpio0: gpio@e000a000 {
101 compatible = "xlnx,zynq-gpio-1.0";
102 #gpio-cells = <2>;
103 clocks = <&clkc 42>;
104 gpio-controller;
105 interrupt-parent = <&intc>;
106 interrupts = <0 20 4>;
107 reg = <0xe000a000 0x1000>;
108 };
109
68 i2c0: i2c@e0004000 { 110 i2c0: i2c@e0004000 {
69 compatible = "cdns,i2c-r1p10"; 111 compatible = "cdns,i2c-r1p10";
70 status = "disabled"; 112 status = "disabled";
@@ -105,23 +147,47 @@
105 }; 147 };
106 148
107 uart0: serial@e0000000 { 149 uart0: serial@e0000000 {
108 compatible = "xlnx,xuartps"; 150 compatible = "xlnx,xuartps", "cdns,uart-r1p8";
109 status = "disabled"; 151 status = "disabled";
110 clocks = <&clkc 23>, <&clkc 40>; 152 clocks = <&clkc 23>, <&clkc 40>;
111 clock-names = "ref_clk", "aper_clk"; 153 clock-names = "uart_clk", "pclk";
112 reg = <0xE0000000 0x1000>; 154 reg = <0xE0000000 0x1000>;
113 interrupts = <0 27 4>; 155 interrupts = <0 27 4>;
114 }; 156 };
115 157
116 uart1: serial@e0001000 { 158 uart1: serial@e0001000 {
117 compatible = "xlnx,xuartps"; 159 compatible = "xlnx,xuartps", "cdns,uart-r1p8";
118 status = "disabled"; 160 status = "disabled";
119 clocks = <&clkc 24>, <&clkc 41>; 161 clocks = <&clkc 24>, <&clkc 41>;
120 clock-names = "ref_clk", "aper_clk"; 162 clock-names = "uart_clk", "pclk";
121 reg = <0xE0001000 0x1000>; 163 reg = <0xE0001000 0x1000>;
122 interrupts = <0 50 4>; 164 interrupts = <0 50 4>;
123 }; 165 };
124 166
167 spi0: spi@e0006000 {
168 compatible = "xlnx,zynq-spi-r1p6";
169 reg = <0xe0006000 0x1000>;
170 status = "disabled";
171 interrupt-parent = <&intc>;
172 interrupts = <0 26 4>;
173 clocks = <&clkc 25>, <&clkc 34>;
174 clock-names = "ref_clk", "pclk";
175 #address-cells = <1>;
176 #size-cells = <0>;
177 };
178
179 spi1: spi@e0007000 {
180 compatible = "xlnx,zynq-spi-r1p6";
181 reg = <0xe0007000 0x1000>;
182 status = "disabled";
183 interrupt-parent = <&intc>;
184 interrupts = <0 49 4>;
185 clocks = <&clkc 26>, <&clkc 35>;
186 clock-names = "ref_clk", "pclk";
187 #address-cells = <1>;
188 #size-cells = <0>;
189 };
190
125 gem0: ethernet@e000b000 { 191 gem0: ethernet@e000b000 {
126 compatible = "cdns,gem"; 192 compatible = "cdns,gem";
127 reg = <0xe000b000 0x4000>; 193 reg = <0xe000b000 0x4000>;
@@ -186,6 +252,22 @@
186 }; 252 };
187 }; 253 };
188 254
255 dmac_s: dmac@f8003000 {
256 compatible = "arm,pl330", "arm,primecell";
257 reg = <0xf8003000 0x1000>;
258 interrupt-parent = <&intc>;
259 interrupts = <0 13 4>,
260 <0 14 4>, <0 15 4>,
261 <0 16 4>, <0 17 4>,
262 <0 40 4>, <0 41 4>,
263 <0 42 4>, <0 43 4>;
264 #dma-cells = <1>;
265 #dma-channels = <8>;
266 #dma-requests = <4>;
267 clocks = <&clkc 27>;
268 clock-names = "apb_pclk";
269 };
270
189 devcfg: devcfg@f8007000 { 271 devcfg: devcfg@f8007000 {
190 compatible = "xlnx,zynq-devcfg-1.0"; 272 compatible = "xlnx,zynq-devcfg-1.0";
191 reg = <0xf8007000 0x100>; 273 reg = <0xf8007000 0x100>;
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts
new file mode 100644
index 000000000000..41afd9da6876
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-parallella.dts
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014 SUSE LINUX Products GmbH
3 *
4 * Derived from zynq-zed.dts:
5 *
6 * Copyright (C) 2011 Xilinx
7 * Copyright (C) 2012 National Instruments Corp.
8 * Copyright (C) 2013 Xilinx
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19/dts-v1/;
20/include/ "zynq-7000.dtsi"
21
22/ {
23 model = "Adapteva Parallella Board";
24 compatible = "adapteva,parallella", "xlnx,zynq-7000";
25
26 memory {
27 device_type = "memory";
28 reg = <0 0x40000000>;
29 };
30
31 chosen {
32 bootargs = "console=ttyPS0,115200 earlyprintk root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait";
33 linux,stdout-path = "/amba/serial@e0001000";
34 };
35};
36
37&gem0 {
38 status = "okay";
39 phy-mode = "rgmii-id";
40 phy-handle = <&ethernet_phy>;
41 #address-cells = <1>;
42 #size-cells = <0>;
43
44 ethernet_phy: ethernet-phy@0 {
45 /* Marvell 88E1318 */
46 compatible = "ethernet-phy-id0141.0e90",
47 "ethernet-phy-ieee802.3-c22";
48 reg = <0>;
49 marvell,reg-init = <0x3 0x10 0xff00 0x1e>,
50 <0x3 0x11 0xfff0 0xa>;
51 };
52};
53
54&i2c0 {
55 status = "okay";
56};
57
58&sdhci1 {
59 status = "okay";
60};
61
62&uart1 {
63 status = "okay";
64};
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 5e09cee33d42..835c3089c61c 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -29,6 +29,10 @@
29 29
30}; 30};
31 31
32&can0 {
33 status = "okay";
34};
35
32&gem0 { 36&gem0 {
33 status = "okay"; 37 status = "okay";
34 phy-mode = "rgmii"; 38 phy-mode = "rgmii";
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 490f3dced749..6eaddc47c43d 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -58,16 +58,6 @@ static int read_mpidr(void)
58} 58}
59 59
60/* 60/*
61 * Get a global nanosecond time stamp for tracing.
62 */
63static s64 get_ns(void)
64{
65 struct timespec ts;
66 getnstimeofday(&ts);
67 return timespec_to_ns(&ts);
68}
69
70/*
71 * bL switcher core code. 61 * bL switcher core code.
72 */ 62 */
73 63
@@ -224,7 +214,7 @@ static int bL_switch_to(unsigned int new_cluster_id)
224 */ 214 */
225 local_irq_disable(); 215 local_irq_disable();
226 local_fiq_disable(); 216 local_fiq_disable();
227 trace_cpu_migrate_begin(get_ns(), ob_mpidr); 217 trace_cpu_migrate_begin(ktime_get_real_ns(), ob_mpidr);
228 218
229 /* redirect GIC's SGIs to our counterpart */ 219 /* redirect GIC's SGIs to our counterpart */
230 gic_migrate_target(bL_gic_id[ib_cpu][ib_cluster]); 220 gic_migrate_target(bL_gic_id[ib_cpu][ib_cluster]);
@@ -267,7 +257,7 @@ static int bL_switch_to(unsigned int new_cluster_id)
267 tdev->evtdev->next_event, 1); 257 tdev->evtdev->next_event, 1);
268 } 258 }
269 259
270 trace_cpu_migrate_finish(get_ns(), ib_mpidr); 260 trace_cpu_migrate_finish(ktime_get_real_ns(), ib_mpidr);
271 local_fiq_enable(); 261 local_fiq_enable();
272 local_irq_enable(); 262 local_irq_enable();
273 263
@@ -558,7 +548,7 @@ int bL_switcher_get_logical_index(u32 mpidr)
558 548
559static void bL_switcher_trace_trigger_cpu(void *__always_unused info) 549static void bL_switcher_trace_trigger_cpu(void *__always_unused info)
560{ 550{
561 trace_cpu_migrate_current(get_ns(), read_mpidr()); 551 trace_cpu_migrate_current(ktime_get_real_ns(), read_mpidr());
562} 552}
563 553
564int bL_switcher_trace_trigger(void) 554int bL_switcher_trace_trigger(void)
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 485be42519b9..88099175fc56 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1414,6 +1414,34 @@ void edma_clear_event(unsigned channel)
1414} 1414}
1415EXPORT_SYMBOL(edma_clear_event); 1415EXPORT_SYMBOL(edma_clear_event);
1416 1416
1417/*
1418 * edma_assign_channel_eventq - move given channel to desired eventq
1419 * Arguments:
1420 * channel - channel number
1421 * eventq_no - queue to move the channel
1422 *
1423 * Can be used to move a channel to a selected event queue.
1424 */
1425void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no)
1426{
1427 unsigned ctlr;
1428
1429 ctlr = EDMA_CTLR(channel);
1430 channel = EDMA_CHAN_SLOT(channel);
1431
1432 if (channel >= edma_cc[ctlr]->num_channels)
1433 return;
1434
1435 /* default to low priority queue */
1436 if (eventq_no == EVENTQ_DEFAULT)
1437 eventq_no = edma_cc[ctlr]->default_queue;
1438 if (eventq_no >= edma_cc[ctlr]->num_tc)
1439 return;
1440
1441 map_dmach_queue(ctlr, channel, eventq_no);
1442}
1443EXPORT_SYMBOL(edma_assign_channel_eventq);
1444
1417static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, 1445static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
1418 struct edma *edma_cc) 1446 struct edma *edma_cc)
1419{ 1447{
@@ -1470,7 +1498,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
1470 queue_priority_map[i][1] = -1; 1498 queue_priority_map[i][1] = -1;
1471 1499
1472 pdata->queue_priority_mapping = queue_priority_map; 1500 pdata->queue_priority_mapping = queue_priority_map;
1473 pdata->default_queue = 0; 1501 /* Default queue has the lowest priority */
1502 pdata->default_queue = i - 1;
1474 1503
1475 return 0; 1504 return 0;
1476} 1505}
diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
index f91136ab447e..3c165fc2dce2 100644
--- a/arch/arm/common/mcpm_entry.c
+++ b/arch/arm/common/mcpm_entry.c
@@ -12,11 +12,13 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irqflags.h> 14#include <linux/irqflags.h>
15#include <linux/cpu_pm.h>
15 16
16#include <asm/mcpm.h> 17#include <asm/mcpm.h>
17#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
18#include <asm/idmap.h> 19#include <asm/idmap.h>
19#include <asm/cputype.h> 20#include <asm/cputype.h>
21#include <asm/suspend.h>
20 22
21extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER]; 23extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER];
22 24
@@ -146,6 +148,56 @@ int mcpm_cpu_powered_up(void)
146 return 0; 148 return 0;
147} 149}
148 150
151#ifdef CONFIG_ARM_CPU_SUSPEND
152
153static int __init nocache_trampoline(unsigned long _arg)
154{
155 void (*cache_disable)(void) = (void *)_arg;
156 unsigned int mpidr = read_cpuid_mpidr();
157 unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
158 unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
159 phys_reset_t phys_reset;
160
161 mcpm_set_entry_vector(cpu, cluster, cpu_resume);
162 setup_mm_for_reboot();
163
164 __mcpm_cpu_going_down(cpu, cluster);
165 BUG_ON(!__mcpm_outbound_enter_critical(cpu, cluster));
166 cache_disable();
167 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
168 __mcpm_cpu_down(cpu, cluster);
169
170 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
171 phys_reset(virt_to_phys(mcpm_entry_point));
172 BUG();
173}
174
175int __init mcpm_loopback(void (*cache_disable)(void))
176{
177 int ret;
178
179 /*
180 * We're going to soft-restart the current CPU through the
181 * low-level MCPM code by leveraging the suspend/resume
182 * infrastructure. Let's play it safe by using cpu_pm_enter()
183 * in case the CPU init code path resets the VFP or similar.
184 */
185 local_irq_disable();
186 local_fiq_disable();
187 ret = cpu_pm_enter();
188 if (!ret) {
189 ret = cpu_suspend((unsigned long)cache_disable, nocache_trampoline);
190 cpu_pm_exit();
191 }
192 local_fiq_enable();
193 local_irq_enable();
194 if (ret)
195 pr_err("%s returned %d\n", __func__, ret);
196 return ret;
197}
198
199#endif
200
149struct sync_struct mcpm_sync; 201struct sync_struct mcpm_sync;
150 202
151/* 203/*
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index fd6bff0c5b96..19211324772f 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -233,13 +233,13 @@ static void __init sp804_of_init(struct device_node *np)
233 if (IS_ERR(clk1)) 233 if (IS_ERR(clk1))
234 clk1 = NULL; 234 clk1 = NULL;
235 235
236 /* Get the 2nd clock if the timer has 2 timer clocks */ 236 /* Get the 2nd clock if the timer has 3 timer clocks */
237 if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) { 237 if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) {
238 clk2 = of_clk_get(np, 1); 238 clk2 = of_clk_get(np, 1);
239 if (IS_ERR(clk2)) { 239 if (IS_ERR(clk2)) {
240 pr_err("sp804: %s clock not found: %d\n", np->name, 240 pr_err("sp804: %s clock not found: %d\n", np->name,
241 (int)PTR_ERR(clk2)); 241 (int)PTR_ERR(clk2));
242 goto err; 242 clk2 = NULL;
243 } 243 }
244 } else 244 } else
245 clk2 = clk1; 245 clk2 = clk1;
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
index 065adddeee3e..d9675c68a399 100644
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -96,6 +96,7 @@ CONFIG_I2C_GPIO=y
96CONFIG_I2C_SH_MOBILE=y 96CONFIG_I2C_SH_MOBILE=y
97# CONFIG_HWMON is not set 97# CONFIG_HWMON is not set
98CONFIG_REGULATOR=y 98CONFIG_REGULATOR=y
99CONFIG_REGULATOR_GPIO=y
99CONFIG_MEDIA_SUPPORT=y 100CONFIG_MEDIA_SUPPORT=y
100CONFIG_VIDEO_DEV=y 101CONFIG_VIDEO_DEV=y
101CONFIG_MEDIA_CAMERA_SUPPORT=y 102CONFIG_MEDIA_CAMERA_SUPPORT=y
@@ -127,6 +128,9 @@ CONFIG_USB_ETH=m
127CONFIG_MMC=y 128CONFIG_MMC=y
128CONFIG_MMC_SDHI=y 129CONFIG_MMC_SDHI=y
129CONFIG_MMC_SH_MMCIF=y 130CONFIG_MMC_SH_MMCIF=y
131CONFIG_NEW_LEDS=y
132CONFIG_LEDS_CLASS=y
133CONFIG_LEDS_GPIO=y
130CONFIG_RTC_CLASS=y 134CONFIG_RTC_CLASS=y
131CONFIG_RTC_DRV_S35390A=y 135CONFIG_RTC_DRV_S35390A=y
132CONFIG_DMADEVICES=y 136CONFIG_DMADEVICES=y
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 4bf72264b175..fbebcbce1e8c 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -27,6 +27,7 @@ CONFIG_PARTITION_ADVANCED=y
27CONFIG_ARCH_BCM=y 27CONFIG_ARCH_BCM=y
28CONFIG_ARCH_BCM_MOBILE=y 28CONFIG_ARCH_BCM_MOBILE=y
29CONFIG_ARM_THUMBEE=y 29CONFIG_ARM_THUMBEE=y
30CONFIG_SMP=y
30CONFIG_PREEMPT=y 31CONFIG_PREEMPT=y
31CONFIG_AEABI=y 32CONFIG_AEABI=y
32# CONFIG_COMPACTION is not set 33# CONFIG_COMPACTION is not set
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index e07a227ec0db..fc7d1683bf67 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -8,15 +8,17 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_PARTITION_ADVANCED=y 9CONFIG_PARTITION_ADVANCED=y
10CONFIG_ARCH_EXYNOS=y 10CONFIG_ARCH_EXYNOS=y
11CONFIG_S3C_LOWLEVEL_UART_PORT=3 11CONFIG_ARCH_EXYNOS3=y
12CONFIG_S3C24XX_PWM=y 12CONFIG_EXYNOS5420_MCPM=y
13CONFIG_ARCH_EXYNOS5=y
14CONFIG_MACH_EXYNOS4_DT=y
15CONFIG_SMP=y 13CONFIG_SMP=y
14CONFIG_BIG_LITTLE=y
15CONFIG_BL_SWITCHER=y
16CONFIG_BL_SWITCHER_DUMMY_IF=y
16CONFIG_NR_CPUS=8 17CONFIG_NR_CPUS=8
17CONFIG_PREEMPT=y 18CONFIG_PREEMPT=y
18CONFIG_AEABI=y 19CONFIG_AEABI=y
19CONFIG_HIGHMEM=y 20CONFIG_HIGHMEM=y
21CONFIG_CMA=y
20CONFIG_ZBOOT_ROM_TEXT=0x0 22CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0 23CONFIG_ZBOOT_ROM_BSS=0x0
22CONFIG_ARM_APPENDED_DTB=y 24CONFIG_ARM_APPENDED_DTB=y
@@ -24,6 +26,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
24CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc mem=256M" 26CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc mem=256M"
25CONFIG_VFP=y 27CONFIG_VFP=y
26CONFIG_NEON=y 28CONFIG_NEON=y
29CONFIG_PM_RUNTIME=y
27CONFIG_NET=y 30CONFIG_NET=y
28CONFIG_PACKET=y 31CONFIG_PACKET=y
29CONFIG_UNIX=y 32CONFIG_UNIX=y
@@ -34,6 +37,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
34CONFIG_DEVTMPFS=y 37CONFIG_DEVTMPFS=y
35CONFIG_DEVTMPFS_MOUNT=y 38CONFIG_DEVTMPFS_MOUNT=y
36CONFIG_PROC_DEVICETREE=y 39CONFIG_PROC_DEVICETREE=y
40CONFIG_DMA_CMA=y
41CONFIG_CMA_SIZE_MBYTES=64
37CONFIG_BLK_DEV_LOOP=y 42CONFIG_BLK_DEV_LOOP=y
38CONFIG_BLK_DEV_CRYPTOLOOP=y 43CONFIG_BLK_DEV_CRYPTOLOOP=y
39CONFIG_BLK_DEV_RAM=y 44CONFIG_BLK_DEV_RAM=y
@@ -66,11 +71,22 @@ CONFIG_I2C=y
66CONFIG_I2C_MUX=y 71CONFIG_I2C_MUX=y
67CONFIG_I2C_ARB_GPIO_CHALLENGE=y 72CONFIG_I2C_ARB_GPIO_CHALLENGE=y
68CONFIG_I2C_EXYNOS5=y 73CONFIG_I2C_EXYNOS5=y
74CONFIG_I2C_CROS_EC_TUNNEL=y
75CONFIG_SPI=y
76CONFIG_SPI_S3C64XX=y
69CONFIG_I2C_S3C2410=y 77CONFIG_I2C_S3C2410=y
70CONFIG_DEBUG_GPIO=y 78CONFIG_DEBUG_GPIO=y
79CONFIG_POWER_SUPPLY=y
80CONFIG_CHARGER_TPS65090=y
71# CONFIG_HWMON is not set 81# CONFIG_HWMON is not set
82CONFIG_THERMAL=y
83CONFIG_EXYNOS_THERMAL=y
84CONFIG_EXYNOS_THERMAL_CORE=y
85CONFIG_WATCHDOG=y
86CONFIG_S3C2410_WATCHDOG=y
72CONFIG_MFD_CROS_EC=y 87CONFIG_MFD_CROS_EC=y
73CONFIG_MFD_CROS_EC_I2C=y 88CONFIG_MFD_CROS_EC_I2C=y
89CONFIG_MFD_CROS_EC_SPI=y
74CONFIG_MFD_MAX77686=y 90CONFIG_MFD_MAX77686=y
75CONFIG_MFD_MAX8997=y 91CONFIG_MFD_MAX8997=y
76CONFIG_MFD_SEC_CORE=y 92CONFIG_MFD_SEC_CORE=y
@@ -80,6 +96,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
80CONFIG_REGULATOR_GPIO=y 96CONFIG_REGULATOR_GPIO=y
81CONFIG_REGULATOR_MAX8997=y 97CONFIG_REGULATOR_MAX8997=y
82CONFIG_REGULATOR_MAX77686=y 98CONFIG_REGULATOR_MAX77686=y
99CONFIG_REGULATOR_S2MPA01=y
83CONFIG_REGULATOR_S2MPS11=y 100CONFIG_REGULATOR_S2MPS11=y
84CONFIG_REGULATOR_S5M8767=y 101CONFIG_REGULATOR_S5M8767=y
85CONFIG_REGULATOR_TPS65090=y 102CONFIG_REGULATOR_TPS65090=y
@@ -88,28 +105,50 @@ CONFIG_FB_MODE_HELPERS=y
88CONFIG_FB_SIMPLE=y 105CONFIG_FB_SIMPLE=y
89CONFIG_EXYNOS_VIDEO=y 106CONFIG_EXYNOS_VIDEO=y
90CONFIG_EXYNOS_MIPI_DSI=y 107CONFIG_EXYNOS_MIPI_DSI=y
91CONFIG_EXYNOS_DP=y
92CONFIG_FRAMEBUFFER_CONSOLE=y 108CONFIG_FRAMEBUFFER_CONSOLE=y
93CONFIG_FONTS=y 109CONFIG_FONTS=y
94CONFIG_FONT_7x14=y 110CONFIG_FONT_7x14=y
95CONFIG_LOGO=y 111CONFIG_LOGO=y
112CONFIG_SOUND=y
113CONFIG_SND=y
114CONFIG_SND_SOC=y
115CONFIG_SND_SOC_SAMSUNG=y
116CONFIG_SND_SOC_SNOW=y
96CONFIG_USB=y 117CONFIG_USB=y
118CONFIG_USB_XHCI_HCD=y
97CONFIG_USB_EHCI_HCD=y 119CONFIG_USB_EHCI_HCD=y
98CONFIG_USB_EHCI_EXYNOS=y 120CONFIG_USB_EHCI_EXYNOS=y
121CONFIG_USB_OHCI_HCD=y
122CONFIG_USB_OHCI_EXYNOS=y
99CONFIG_USB_STORAGE=y 123CONFIG_USB_STORAGE=y
100CONFIG_USB_DWC3=y 124CONFIG_USB_DWC3=y
101CONFIG_USB_PHY=y 125CONFIG_USB_HSIC_USB3503=y
102CONFIG_SAMSUNG_USB2PHY=y
103CONFIG_SAMSUNG_USB3PHY=y
104CONFIG_MMC=y 126CONFIG_MMC=y
105CONFIG_MMC_SDHCI=y 127CONFIG_MMC_SDHCI=y
106CONFIG_MMC_SDHCI_S3C=y 128CONFIG_MMC_SDHCI_S3C=y
129CONFIG_MMC_SDHCI_S3C_DMA=y
107CONFIG_MMC_DW=y 130CONFIG_MMC_DW=y
108CONFIG_MMC_DW_IDMAC=y 131CONFIG_MMC_DW_IDMAC=y
109CONFIG_MMC_DW_EXYNOS=y 132CONFIG_MMC_DW_EXYNOS=y
110CONFIG_RTC_CLASS=y 133CONFIG_RTC_CLASS=y
134CONFIG_RTC_DRV_MAX77686=y
135CONFIG_RTC_DRV_S5M=y
111CONFIG_RTC_DRV_S3C=y 136CONFIG_RTC_DRV_S3C=y
137CONFIG_DMADEVICES=y
138CONFIG_PL330_DMA=y
112CONFIG_COMMON_CLK_MAX77686=y 139CONFIG_COMMON_CLK_MAX77686=y
140CONFIG_COMMON_CLK_S2MPS11=y
141CONFIG_EXYNOS_IOMMU=y
142CONFIG_IIO=y
143CONFIG_EXYNOS_ADC=y
144CONFIG_PWM=y
145CONFIG_PWM_SAMSUNG=y
146CONFIG_PHY_EXYNOS5250_SATA=y
147CONFIG_PHY_SAMSUNG_USB2=y
148CONFIG_PHY_EXYNOS4210_USB2=y
149CONFIG_PHY_EXYNOS4X12_USB2=y
150CONFIG_PHY_EXYNOS5250_USB2=y
151CONFIG_PHY_EXYNOS5_USBDRD=y
113CONFIG_EXT2_FS=y 152CONFIG_EXT2_FS=y
114CONFIG_EXT3_FS=y 153CONFIG_EXT3_FS=y
115CONFIG_EXT4_FS=y 154CONFIG_EXT4_FS=y
@@ -123,6 +162,7 @@ CONFIG_NLS_CODEPAGE_437=y
123CONFIG_NLS_ASCII=y 162CONFIG_NLS_ASCII=y
124CONFIG_NLS_ISO8859_1=y 163CONFIG_NLS_ISO8859_1=y
125CONFIG_PRINTK_TIME=y 164CONFIG_PRINTK_TIME=y
165CONFIG_DEBUG_FS=y
126CONFIG_MAGIC_SYSRQ=y 166CONFIG_MAGIC_SYSRQ=y
127CONFIG_DEBUG_KERNEL=y 167CONFIG_DEBUG_KERNEL=y
128CONFIG_DETECT_HUNG_TASK=y 168CONFIG_DETECT_HUNG_TASK=y
diff --git a/arch/arm/configs/genmai_defconfig b/arch/arm/configs/genmai_defconfig
deleted file mode 100644
index d238fafb6762..000000000000
--- a/arch/arm/configs/genmai_defconfig
+++ /dev/null
@@ -1,122 +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
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
15CONFIG_ARCH_SHMOBILE_LEGACY=y
16CONFIG_ARCH_R7S72100=y
17CONFIG_MACH_GENMAI=y
18# CONFIG_SH_TIMER_CMT is not set
19# CONFIG_SH_TIMER_MTU2 is not set
20# CONFIG_SH_TIMER_TMU is not set
21# CONFIG_EM_TIMER_STI is not set
22CONFIG_ARM_ERRATA_430973=y
23CONFIG_ARM_ERRATA_458693=y
24CONFIG_ARM_ERRATA_460075=y
25CONFIG_ARM_ERRATA_743622=y
26CONFIG_ARM_ERRATA_754322=y
27CONFIG_AEABI=y
28# CONFIG_OABI_COMPAT is not set
29CONFIG_FORCE_MAX_ZONEORDER=13
30CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_ARM_APPENDED_DTB=y
33CONFIG_KEXEC=y
34CONFIG_AUTO_ZRELADDR=y
35CONFIG_VFP=y
36CONFIG_NEON=y
37# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
38CONFIG_PM_RUNTIME=y
39CONFIG_NET=y
40CONFIG_PACKET=y
41CONFIG_UNIX=y
42CONFIG_INET=y
43CONFIG_IP_PNP=y
44CONFIG_IP_PNP_DHCP=y
45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
47# CONFIG_INET_XFRM_MODE_BEET is not set
48# CONFIG_INET_LRO is not set
49# CONFIG_INET_DIAG is not set
50# CONFIG_IPV6 is not set
51# CONFIG_WIRELESS is not set
52CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
53CONFIG_DEVTMPFS=y
54CONFIG_DEVTMPFS_MOUNT=y
55CONFIG_EEPROM_AT24=y
56CONFIG_NETDEVICES=y
57# CONFIG_NET_CORE is not set
58# CONFIG_NET_VENDOR_ARC is not set
59# CONFIG_NET_CADENCE is not set
60# CONFIG_NET_VENDOR_BROADCOM is not set
61# CONFIG_NET_VENDOR_CIRRUS is not set
62# CONFIG_NET_VENDOR_FARADAY is not set
63# CONFIG_NET_VENDOR_INTEL is not set
64# CONFIG_NET_VENDOR_MARVELL is not set
65# CONFIG_NET_VENDOR_MICREL is not set
66# CONFIG_NET_VENDOR_NATSEMI is not set
67CONFIG_SH_ETH=y
68# CONFIG_NET_VENDOR_SEEQ is not set
69# CONFIG_NET_VENDOR_SMSC is not set
70# CONFIG_NET_VENDOR_STMICRO is not set
71# CONFIG_NET_VENDOR_VIA is not set
72# CONFIG_NET_VENDOR_WIZNET is not set
73# CONFIG_WLAN is not set
74# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
75CONFIG_INPUT_EVDEV=y
76# CONFIG_KEYBOARD_ATKBD is not set
77# CONFIG_INPUT_MOUSE is not set
78# CONFIG_SERIO is not set
79# CONFIG_LEGACY_PTYS is not set
80CONFIG_SERIAL_SH_SCI=y
81CONFIG_SERIAL_SH_SCI_NR_UARTS=10
82CONFIG_SERIAL_SH_SCI_CONSOLE=y
83# CONFIG_HW_RANDOM is not set
84CONFIG_I2C_CHARDEV=y
85CONFIG_I2C_RIIC=y
86CONFIG_SPI=y
87CONFIG_SPI_RSPI=y
88# CONFIG_HWMON is not set
89CONFIG_THERMAL=y
90CONFIG_RCAR_THERMAL=y
91CONFIG_REGULATOR=y
92CONFIG_REGULATOR_FIXED_VOLTAGE=y
93CONFIG_DRM=y
94CONFIG_DRM_RCAR_DU=y
95# CONFIG_USB_SUPPORT is not set
96CONFIG_MMC=y
97CONFIG_MMC_SDHI=y
98CONFIG_MMC_SH_MMCIF=y
99CONFIG_NEW_LEDS=y
100CONFIG_LEDS_CLASS=y
101CONFIG_RTC_CLASS=y
102CONFIG_DMADEVICES=y
103CONFIG_SH_DMAE=y
104# CONFIG_IOMMU_SUPPORT is not set
105# CONFIG_DNOTIFY is not set
106CONFIG_MSDOS_FS=y
107CONFIG_VFAT_FS=y
108CONFIG_TMPFS=y
109CONFIG_CONFIGFS_FS=y
110# CONFIG_MISC_FILESYSTEMS is not set
111CONFIG_NFS_FS=y
112CONFIG_NFS_V3_ACL=y
113CONFIG_NFS_V4=y
114CONFIG_NFS_V4_1=y
115CONFIG_ROOT_NFS=y
116CONFIG_NLS_CODEPAGE_437=y
117CONFIG_NLS_ISO8859_1=y
118# CONFIG_ENABLE_WARN_DEPRECATED is not set
119# CONFIG_ENABLE_MUST_CHECK is not set
120# CONFIG_ARM_UNWIND is not set
121# CONFIG_CRYPTO_ANSI_CPRNG is not set
122# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/hi3xxx_defconfig b/arch/arm/configs/hi3xxx_defconfig
index f186bdfa2369..9630687e7d07 100644
--- a/arch/arm/configs/hi3xxx_defconfig
+++ b/arch/arm/configs/hi3xxx_defconfig
@@ -3,7 +3,9 @@ CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_RD_LZMA=y 5CONFIG_RD_LZMA=y
6CONFIG_ARCH_HISI=y
6CONFIG_ARCH_HI3xxx=y 7CONFIG_ARCH_HI3xxx=y
8CONFIG_ARCH_HIX5HD2=y
7CONFIG_SMP=y 9CONFIG_SMP=y
8CONFIG_PREEMPT=y 10CONFIG_PREEMPT=y
9CONFIG_AEABI=y 11CONFIG_AEABI=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index bada59d93b67..63bde0efc041 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -1,6 +1,7 @@
1# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
4CONFIG_NO_HZ=y 5CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y 6CONFIG_HIGH_RES_TIMERS=y
6CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
@@ -35,10 +36,8 @@ CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2=y
35CONFIG_MACH_EUKREA_CPUIMX27_USEUART4=y 36CONFIG_MACH_EUKREA_CPUIMX27_USEUART4=y
36CONFIG_MACH_MX27_3DS=y 37CONFIG_MACH_MX27_3DS=y
37CONFIG_MACH_IMX27_VISSTRIM_M10=y 38CONFIG_MACH_IMX27_VISSTRIM_M10=y
38CONFIG_MACH_IMX27LITE=y
39CONFIG_MACH_PCA100=y 39CONFIG_MACH_PCA100=y
40CONFIG_MACH_MXT_TD60=y 40CONFIG_MACH_MXT_TD60=y
41CONFIG_MACH_IMX27IPCAM=y
42CONFIG_MACH_IMX27_DT=y 41CONFIG_MACH_IMX27_DT=y
43CONFIG_PREEMPT=y 42CONFIG_PREEMPT=y
44CONFIG_AEABI=y 43CONFIG_AEABI=y
@@ -159,6 +158,8 @@ CONFIG_USB_CHIPIDEA=y
159CONFIG_USB_CHIPIDEA_UDC=y 158CONFIG_USB_CHIPIDEA_UDC=y
160CONFIG_USB_CHIPIDEA_HOST=y 159CONFIG_USB_CHIPIDEA_HOST=y
161CONFIG_NOP_USB_XCEIV=y 160CONFIG_NOP_USB_XCEIV=y
161CONFIG_USB_GADGET=y
162CONFIG_USB_ETH=m
162CONFIG_MMC=y 163CONFIG_MMC=y
163CONFIG_MMC_SDHCI=y 164CONFIG_MMC_SDHCI=y
164CONFIG_MMC_SDHCI_PLTFM=y 165CONFIG_MMC_SDHCI_PLTFM=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 59b7e45142d8..16cfec4385c8 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -1,5 +1,6 @@
1CONFIG_KERNEL_LZO=y 1CONFIG_KERNEL_LZO=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_FHANDLE=y
3CONFIG_NO_HZ=y 4CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y 5CONFIG_HIGH_RES_TIMERS=y
5CONFIG_LOG_BUF_SHIFT=18 6CONFIG_LOG_BUF_SHIFT=18
@@ -31,11 +32,12 @@ CONFIG_MACH_IMX35_DT=y
31CONFIG_MACH_PCM043=y 32CONFIG_MACH_PCM043=y
32CONFIG_MACH_MX35_3DS=y 33CONFIG_MACH_MX35_3DS=y
33CONFIG_MACH_VPR200=y 34CONFIG_MACH_VPR200=y
34CONFIG_MACH_IMX51_DT=y 35CONFIG_SOC_IMX51=y
35CONFIG_SOC_IMX50=y 36CONFIG_SOC_IMX50=y
36CONFIG_SOC_IMX53=y 37CONFIG_SOC_IMX53=y
37CONFIG_SOC_IMX6Q=y 38CONFIG_SOC_IMX6Q=y
38CONFIG_SOC_IMX6SL=y 39CONFIG_SOC_IMX6SL=y
40CONFIG_SOC_IMX6SX=y
39CONFIG_SOC_VF610=y 41CONFIG_SOC_VF610=y
40CONFIG_PCI=y 42CONFIG_PCI=y
41CONFIG_PCI_IMX6=y 43CONFIG_PCI_IMX6=y
@@ -67,6 +69,8 @@ CONFIG_IP_PNP_DHCP=y
67# CONFIG_INET_LRO is not set 69# CONFIG_INET_LRO is not set
68CONFIG_IPV6=y 70CONFIG_IPV6=y
69CONFIG_NETFILTER=y 71CONFIG_NETFILTER=y
72CONFIG_CAN=y
73CONFIG_CAN_FLEXCAN=y
70CONFIG_CFG80211=y 74CONFIG_CFG80211=y
71CONFIG_MAC80211=y 75CONFIG_MAC80211=y
72CONFIG_RFKILL=y 76CONFIG_RFKILL=y
@@ -160,6 +164,7 @@ CONFIG_SPI=y
160CONFIG_SPI_IMX=y 164CONFIG_SPI_IMX=y
161CONFIG_GPIO_SYSFS=y 165CONFIG_GPIO_SYSFS=y
162CONFIG_GPIO_MC9S08DZ60=y 166CONFIG_GPIO_MC9S08DZ60=y
167CONFIG_GPIO_STMPE=y
163# CONFIG_HWMON is not set 168# CONFIG_HWMON is not set
164CONFIG_WATCHDOG=y 169CONFIG_WATCHDOG=y
165CONFIG_IMX2_WDT=y 170CONFIG_IMX2_WDT=y
@@ -242,6 +247,7 @@ CONFIG_RTC_DRV_SNVS=y
242CONFIG_DMADEVICES=y 247CONFIG_DMADEVICES=y
243CONFIG_IMX_SDMA=y 248CONFIG_IMX_SDMA=y
244CONFIG_MXS_DMA=y 249CONFIG_MXS_DMA=y
250CONFIG_FSL_EDMA=y
245CONFIG_STAGING=y 251CONFIG_STAGING=y
246CONFIG_DRM_IMX=y 252CONFIG_DRM_IMX=y
247CONFIG_DRM_IMX_FB_HELPER=y 253CONFIG_DRM_IMX_FB_HELPER=y
@@ -288,6 +294,7 @@ CONFIG_NLS_ASCII=y
288CONFIG_NLS_ISO8859_1=y 294CONFIG_NLS_ISO8859_1=y
289CONFIG_NLS_ISO8859_15=m 295CONFIG_NLS_ISO8859_15=m
290CONFIG_NLS_UTF8=y 296CONFIG_NLS_UTF8=y
297CONFIG_PRINTK_TIME=y
291CONFIG_DEBUG_FS=y 298CONFIG_DEBUG_FS=y
292CONFIG_MAGIC_SYSRQ=y 299CONFIG_MAGIC_SYSRQ=y
293# CONFIG_SCHED_DEBUG is not set 300# CONFIG_SCHED_DEBUG is not set
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
deleted file mode 100644
index b9e480c10b10..000000000000
--- a/arch/arm/configs/kirkwood_defconfig
+++ /dev/null
@@ -1,181 +0,0 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_LOG_BUF_SHIFT=19
5CONFIG_PROFILING=y
6CONFIG_OPROFILE=y
7CONFIG_KPROBES=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_ARCH_KIRKWOOD=y
12CONFIG_MACH_D2NET_V2=y
13CONFIG_MACH_NET2BIG_V2=y
14CONFIG_MACH_NET5BIG_V2=y
15CONFIG_MACH_OPENRD_BASE=y
16CONFIG_MACH_OPENRD_CLIENT=y
17CONFIG_MACH_OPENRD_ULTIMATE=y
18CONFIG_MACH_RD88F6192_NAS=y
19CONFIG_MACH_RD88F6281=y
20CONFIG_MACH_T5325=y
21CONFIG_MACH_TS219=y
22CONFIG_MACH_TS41X=y
23CONFIG_ARCH_KIRKWOOD_DT=y
24CONFIG_MACH_MV88F6281GTW_GE_DT=y
25# CONFIG_CPU_FEROCEON_OLD_ID is not set
26CONFIG_PCI_MVEBU=y
27CONFIG_PREEMPT=y
28CONFIG_AEABI=y
29# CONFIG_OABI_COMPAT is not set
30CONFIG_HIGHMEM=y
31CONFIG_ZBOOT_ROM_TEXT=0x0
32CONFIG_ZBOOT_ROM_BSS=0x0
33CONFIG_CPU_FREQ=y
34CONFIG_CPU_FREQ_STAT_DETAILS=y
35CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
36CONFIG_CPU_IDLE=y
37CONFIG_NET=y
38CONFIG_PACKET=y
39CONFIG_UNIX=y
40CONFIG_INET=y
41CONFIG_IP_MULTICAST=y
42CONFIG_IP_PNP=y
43CONFIG_IP_PNP_DHCP=y
44CONFIG_IP_PNP_BOOTP=y
45# CONFIG_IPV6 is not set
46CONFIG_NET_PKTGEN=m
47CONFIG_CFG80211=y
48CONFIG_MAC80211=y
49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
50CONFIG_MTD=y
51CONFIG_MTD_CMDLINE_PARTS=y
52CONFIG_MTD_BLOCK=y
53CONFIG_MTD_CFI=y
54CONFIG_MTD_JEDECPROBE=y
55CONFIG_MTD_CFI_ADV_OPTIONS=y
56CONFIG_MTD_CFI_GEOMETRY=y
57# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
58CONFIG_MTD_CFI_INTELEXT=y
59CONFIG_MTD_CFI_STAA=y
60CONFIG_MTD_PHYSMAP=y
61CONFIG_MTD_M25P80=y
62CONFIG_MTD_NAND=y
63CONFIG_MTD_NAND_ORION=y
64CONFIG_MTD_SPI_NOR=y
65CONFIG_BLK_DEV_LOOP=y
66CONFIG_EEPROM_AT24=y
67# CONFIG_SCSI_PROC_FS is not set
68CONFIG_BLK_DEV_SD=y
69CONFIG_BLK_DEV_SR=m
70CONFIG_CHR_DEV_SG=m
71CONFIG_ATA=y
72CONFIG_SATA_AHCI=y
73CONFIG_SATA_MV=y
74CONFIG_NETDEVICES=y
75CONFIG_NET_DSA_MV88E6123_61_65=y
76CONFIG_MV643XX_ETH=y
77CONFIG_R8169=y
78CONFIG_MARVELL_PHY=y
79CONFIG_LIBERTAS=y
80CONFIG_LIBERTAS_SDIO=y
81CONFIG_INPUT_EVDEV=y
82CONFIG_KEYBOARD_GPIO=y
83# CONFIG_INPUT_MOUSE is not set
84CONFIG_LEGACY_PTY_COUNT=16
85# CONFIG_DEVKMEM is not set
86CONFIG_SERIAL_8250=y
87CONFIG_SERIAL_8250_CONSOLE=y
88CONFIG_SERIAL_8250_RUNTIME_UARTS=2
89CONFIG_SERIAL_OF_PLATFORM=y
90# CONFIG_HW_RANDOM is not set
91CONFIG_I2C=y
92# CONFIG_I2C_COMPAT is not set
93CONFIG_I2C_CHARDEV=y
94CONFIG_I2C_MV64XXX=y
95CONFIG_SPI=y
96CONFIG_SPI_ORION=y
97CONFIG_GPIO_SYSFS=y
98CONFIG_SENSORS_ADT7475=y
99CONFIG_SENSORS_LM63=y
100CONFIG_SENSORS_LM75=y
101CONFIG_SENSORS_LM85=y
102CONFIG_THERMAL=y
103CONFIG_WATCHDOG=y
104CONFIG_ORION_WATCHDOG=y
105CONFIG_HID_DRAGONRISE=y
106CONFIG_HID_GYRATION=y
107CONFIG_HID_TWINHAN=y
108CONFIG_HID_NTRIG=y
109CONFIG_HID_PANTHERLORD=y
110CONFIG_HID_PETALYNX=y
111CONFIG_HID_SAMSUNG=y
112CONFIG_HID_SONY=y
113CONFIG_HID_SUNPLUS=y
114CONFIG_HID_GREENASIA=y
115CONFIG_HID_SMARTJOYPLUS=y
116CONFIG_HID_TOPSEED=y
117CONFIG_HID_THRUSTMASTER=y
118CONFIG_HID_ZEROPLUS=y
119CONFIG_USB=y
120CONFIG_USB_XHCI_HCD=y
121CONFIG_USB_EHCI_HCD=y
122CONFIG_USB_EHCI_ROOT_HUB_TT=y
123CONFIG_USB_PRINTER=m
124CONFIG_USB_STORAGE=y
125CONFIG_USB_STORAGE_DATAFAB=y
126CONFIG_USB_STORAGE_FREECOM=y
127CONFIG_USB_STORAGE_SDDR09=y
128CONFIG_USB_STORAGE_SDDR55=y
129CONFIG_USB_STORAGE_JUMPSHOT=y
130CONFIG_MMC=y
131CONFIG_SDIO_UART=y
132CONFIG_MMC_MVSDIO=y
133CONFIG_NEW_LEDS=y
134CONFIG_LEDS_CLASS=y
135CONFIG_LEDS_GPIO=y
136CONFIG_LEDS_TRIGGERS=y
137CONFIG_LEDS_TRIGGER_TIMER=y
138CONFIG_LEDS_TRIGGER_HEARTBEAT=y
139CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
140CONFIG_RTC_CLASS=y
141CONFIG_RTC_DRV_RS5C372=y
142CONFIG_RTC_DRV_PCF8563=y
143CONFIG_RTC_DRV_S35390A=y
144CONFIG_RTC_DRV_MV=y
145CONFIG_DMADEVICES=y
146CONFIG_MV_XOR=y
147CONFIG_EXT2_FS=y
148CONFIG_EXT3_FS=y
149# CONFIG_EXT3_FS_XATTR is not set
150CONFIG_EXT4_FS=y
151CONFIG_ISO9660_FS=m
152CONFIG_JOLIET=y
153CONFIG_UDF_FS=m
154CONFIG_MSDOS_FS=y
155CONFIG_VFAT_FS=y
156CONFIG_TMPFS=y
157CONFIG_JFFS2_FS=y
158CONFIG_CRAMFS=y
159CONFIG_NFS_FS=y
160CONFIG_ROOT_NFS=y
161CONFIG_NLS_CODEPAGE_437=y
162CONFIG_NLS_CODEPAGE_850=y
163CONFIG_NLS_ISO8859_1=y
164CONFIG_NLS_ISO8859_2=y
165CONFIG_NLS_UTF8=y
166CONFIG_DEBUG_INFO=y
167CONFIG_DEBUG_FS=y
168CONFIG_MAGIC_SYSRQ=y
169CONFIG_DEBUG_KERNEL=y
170# CONFIG_SCHED_DEBUG is not set
171# CONFIG_DEBUG_PREEMPT is not set
172# CONFIG_FTRACE is not set
173CONFIG_DEBUG_USER=y
174CONFIG_DEBUG_LL=y
175CONFIG_CRYPTO_CBC=m
176CONFIG_CRYPTO_PCBC=m
177# CONFIG_CRYPTO_ANSI_CPRNG is not set
178CONFIG_CRYPTO_DEV_MV_CESA=y
179CONFIG_CRC_CCITT=y
180CONFIG_CRC16=y
181CONFIG_LIBCRC32C=y
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 7f52dad97f51..dd18c9e527d6 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -45,7 +45,6 @@ CONFIG_RFKILL=y
45CONFIG_BLK_DEV_LOOP=y 45CONFIG_BLK_DEV_LOOP=y
46CONFIG_BLK_DEV_RAM=y 46CONFIG_BLK_DEV_RAM=y
47CONFIG_SCSI=y 47CONFIG_SCSI=y
48CONFIG_SCSI_TGT=y
49CONFIG_BLK_DEV_SD=y 48CONFIG_BLK_DEV_SD=y
50CONFIG_CHR_DEV_SG=y 49CONFIG_CHR_DEV_SG=y
51CONFIG_CHR_DEV_SCH=y 50CONFIG_CHR_DEV_SCH=y
diff --git a/arch/arm/configs/multi_v5_defconfig b/arch/arm/configs/multi_v5_defconfig
index 5ebfa8bf8509..018bef9fa7e8 100644
--- a/arch/arm/configs/multi_v5_defconfig
+++ b/arch/arm/configs/multi_v5_defconfig
@@ -11,6 +11,7 @@ CONFIG_MODULE_UNLOAD=y
11# CONFIG_ARCH_MULTI_V7 is not set 11# CONFIG_ARCH_MULTI_V7 is not set
12CONFIG_ARCH_MVEBU=y 12CONFIG_ARCH_MVEBU=y
13CONFIG_MACH_KIRKWOOD=y 13CONFIG_MACH_KIRKWOOD=y
14CONFIG_MACH_NETXBIG=y
14CONFIG_ARCH_MXC=y 15CONFIG_ARCH_MXC=y
15CONFIG_MACH_IMX25_DT=y 16CONFIG_MACH_IMX25_DT=y
16CONFIG_MACH_IMX27_DT=y 17CONFIG_MACH_IMX27_DT=y
@@ -94,6 +95,7 @@ CONFIG_POWER_RESET=y
94CONFIG_POWER_RESET_GPIO=y 95CONFIG_POWER_RESET_GPIO=y
95CONFIG_POWER_RESET_QNAP=y 96CONFIG_POWER_RESET_QNAP=y
96CONFIG_SENSORS_ADT7475=y 97CONFIG_SENSORS_ADT7475=y
98CONFIG_SENSORS_G762=y
97CONFIG_SENSORS_LM63=y 99CONFIG_SENSORS_LM63=y
98CONFIG_SENSORS_LM75=y 100CONFIG_SENSORS_LM75=y
99CONFIG_SENSORS_LM85=y 101CONFIG_SENSORS_LM85=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 534836497998..5fb95fb758d9 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -19,15 +19,18 @@ CONFIG_MACH_DOVE=y
19CONFIG_ARCH_BCM=y 19CONFIG_ARCH_BCM=y
20CONFIG_ARCH_BCM_MOBILE=y 20CONFIG_ARCH_BCM_MOBILE=y
21CONFIG_ARCH_BCM_5301X=y 21CONFIG_ARCH_BCM_5301X=y
22CONFIG_ARCH_BRCMSTB=y
22CONFIG_ARCH_BERLIN=y 23CONFIG_ARCH_BERLIN=y
23CONFIG_MACH_BERLIN_BG2=y 24CONFIG_MACH_BERLIN_BG2=y
24CONFIG_MACH_BERLIN_BG2CD=y 25CONFIG_MACH_BERLIN_BG2CD=y
25CONFIG_MACH_BERLIN_BG2Q=y 26CONFIG_MACH_BERLIN_BG2Q=y
26CONFIG_ARCH_HIGHBANK=y 27CONFIG_ARCH_HIGHBANK=y
28CONFIG_ARCH_HISI=y
27CONFIG_ARCH_HI3xxx=y 29CONFIG_ARCH_HI3xxx=y
30CONFIG_ARCH_HIX5HD2=y
28CONFIG_ARCH_KEYSTONE=y 31CONFIG_ARCH_KEYSTONE=y
29CONFIG_ARCH_MXC=y 32CONFIG_ARCH_MXC=y
30CONFIG_MACH_IMX51_DT=y 33CONFIG_SOC_IMX51=y
31CONFIG_SOC_IMX53=y 34CONFIG_SOC_IMX53=y
32CONFIG_SOC_IMX6Q=y 35CONFIG_SOC_IMX6Q=y
33CONFIG_SOC_IMX6SL=y 36CONFIG_SOC_IMX6SL=y
@@ -66,7 +69,6 @@ CONFIG_ARCH_VEXPRESS=y
66CONFIG_ARCH_VEXPRESS_CA9X4=y 69CONFIG_ARCH_VEXPRESS_CA9X4=y
67CONFIG_ARCH_WM8850=y 70CONFIG_ARCH_WM8850=y
68CONFIG_ARCH_ZYNQ=y 71CONFIG_ARCH_ZYNQ=y
69CONFIG_NEON=y
70CONFIG_TRUSTED_FOUNDATIONS=y 72CONFIG_TRUSTED_FOUNDATIONS=y
71CONFIG_PCI=y 73CONFIG_PCI=y
72CONFIG_PCI_MSI=y 74CONFIG_PCI_MSI=y
@@ -83,6 +85,7 @@ CONFIG_CPU_FREQ=y
83CONFIG_CPU_FREQ_STAT_DETAILS=y 85CONFIG_CPU_FREQ_STAT_DETAILS=y
84CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 86CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
85CONFIG_CPU_IDLE=y 87CONFIG_CPU_IDLE=y
88CONFIG_NEON=y
86CONFIG_NET=y 89CONFIG_NET=y
87CONFIG_PACKET=y 90CONFIG_PACKET=y
88CONFIG_UNIX=y 91CONFIG_UNIX=y
@@ -127,6 +130,7 @@ CONFIG_BLK_DEV_SR=y
127CONFIG_SCSI_MULTI_LUN=y 130CONFIG_SCSI_MULTI_LUN=y
128CONFIG_ATA=y 131CONFIG_ATA=y
129CONFIG_SATA_AHCI_PLATFORM=y 132CONFIG_SATA_AHCI_PLATFORM=y
133CONFIG_AHCI_ST=y
130CONFIG_AHCI_SUNXI=y 134CONFIG_AHCI_SUNXI=y
131CONFIG_SATA_HIGHBANK=y 135CONFIG_SATA_HIGHBANK=y
132CONFIG_SATA_MV=y 136CONFIG_SATA_MV=y
@@ -134,6 +138,7 @@ CONFIG_NETDEVICES=y
134CONFIG_SUN4I_EMAC=y 138CONFIG_SUN4I_EMAC=y
135CONFIG_MACB=y 139CONFIG_MACB=y
136CONFIG_NET_CALXEDA_XGMAC=y 140CONFIG_NET_CALXEDA_XGMAC=y
141CONFIG_IGB=y
137CONFIG_MV643XX_ETH=y 142CONFIG_MV643XX_ETH=y
138CONFIG_MVNETA=y 143CONFIG_MVNETA=y
139CONFIG_KS8851=y 144CONFIG_KS8851=y
@@ -155,8 +160,11 @@ CONFIG_INPUT_EVDEV=y
155CONFIG_KEYBOARD_GPIO=y 160CONFIG_KEYBOARD_GPIO=y
156CONFIG_KEYBOARD_TEGRA=y 161CONFIG_KEYBOARD_TEGRA=y
157CONFIG_KEYBOARD_SPEAR=y 162CONFIG_KEYBOARD_SPEAR=y
163CONFIG_KEYBOARD_ST_KEYSCAN=y
158CONFIG_KEYBOARD_CROS_EC=y 164CONFIG_KEYBOARD_CROS_EC=y
159CONFIG_MOUSE_PS2_ELANTECH=y 165CONFIG_MOUSE_PS2_ELANTECH=y
166CONFIG_INPUT_TOUCHSCREEN=y
167CONFIG_TOUCHSCREEN_STMPE=y
160CONFIG_INPUT_MISC=y 168CONFIG_INPUT_MISC=y
161CONFIG_INPUT_MPU3050=y 169CONFIG_INPUT_MPU3050=y
162CONFIG_SERIO_AMBAKMI=y 170CONFIG_SERIO_AMBAKMI=y
@@ -195,6 +203,7 @@ CONFIG_I2C_EXYNOS5=y
195CONFIG_I2C_MV64XXX=y 203CONFIG_I2C_MV64XXX=y
196CONFIG_I2C_SIRF=y 204CONFIG_I2C_SIRF=y
197CONFIG_I2C_TEGRA=y 205CONFIG_I2C_TEGRA=y
206CONFIG_I2C_ST=y
198CONFIG_SPI=y 207CONFIG_SPI=y
199CONFIG_SPI_OMAP24XX=y 208CONFIG_SPI_OMAP24XX=y
200CONFIG_SPI_ORION=y 209CONFIG_SPI_ORION=y
@@ -222,8 +231,11 @@ CONFIG_POWER_RESET_AS3722=y
222CONFIG_POWER_RESET_GPIO=y 231CONFIG_POWER_RESET_GPIO=y
223CONFIG_POWER_RESET_SUN6I=y 232CONFIG_POWER_RESET_SUN6I=y
224CONFIG_SENSORS_LM90=y 233CONFIG_SENSORS_LM90=y
234CONFIG_SENSORS_LM95245=y
225CONFIG_THERMAL=y 235CONFIG_THERMAL=y
226CONFIG_ARMADA_THERMAL=y 236CONFIG_ARMADA_THERMAL=y
237CONFIG_ST_THERMAL_SYSCFG=y
238CONFIG_ST_THERMAL_MEMMAP=y
227CONFIG_WATCHDOG=y 239CONFIG_WATCHDOG=y
228CONFIG_ORION_WATCHDOG=y 240CONFIG_ORION_WATCHDOG=y
229CONFIG_SUNXI_WATCHDOG=y 241CONFIG_SUNXI_WATCHDOG=y
@@ -233,6 +245,7 @@ CONFIG_MFD_CROS_EC=y
233CONFIG_MFD_CROS_EC_SPI=y 245CONFIG_MFD_CROS_EC_SPI=y
234CONFIG_MFD_MAX8907=y 246CONFIG_MFD_MAX8907=y
235CONFIG_MFD_SEC_CORE=y 247CONFIG_MFD_SEC_CORE=y
248CONFIG_MFD_STMPE=y
236CONFIG_MFD_PALMAS=y 249CONFIG_MFD_PALMAS=y
237CONFIG_MFD_TPS65090=y 250CONFIG_MFD_TPS65090=y
238CONFIG_MFD_TPS6586X=y 251CONFIG_MFD_TPS6586X=y
@@ -311,12 +324,16 @@ CONFIG_MMC_SDHCI_SPEAR=y
311CONFIG_MMC_SDHCI_S3C=y 324CONFIG_MMC_SDHCI_S3C=y
312CONFIG_MMC_SDHCI_S3C_DMA=y 325CONFIG_MMC_SDHCI_S3C_DMA=y
313CONFIG_MMC_SDHCI_BCM_KONA=y 326CONFIG_MMC_SDHCI_BCM_KONA=y
327CONFIG_MMC_SDHCI_ST=y
314CONFIG_MMC_OMAP=y 328CONFIG_MMC_OMAP=y
315CONFIG_MMC_OMAP_HS=y 329CONFIG_MMC_OMAP_HS=y
316CONFIG_MMC_MVSDIO=y 330CONFIG_MMC_MVSDIO=y
317CONFIG_MMC_SUNXI=y 331CONFIG_MMC_SUNXI=y
318CONFIG_MMC_DW=y 332CONFIG_MMC_DW=y
319CONFIG_MMC_DW_EXYNOS=y 333CONFIG_MMC_DW_EXYNOS=y
334CONFIG_NEW_LEDS=y
335CONFIG_LEDS_CLASS=y
336CONFIG_LEDS_PWM=y
320CONFIG_EDAC=y 337CONFIG_EDAC=y
321CONFIG_EDAC_MM_EDAC=y 338CONFIG_EDAC_MM_EDAC=y
322CONFIG_EDAC_HIGHBANK_MC=y 339CONFIG_EDAC_HIGHBANK_MC=y
@@ -368,6 +385,8 @@ CONFIG_PWM=y
368CONFIG_PWM_TEGRA=y 385CONFIG_PWM_TEGRA=y
369CONFIG_PWM_VT8500=y 386CONFIG_PWM_VT8500=y
370CONFIG_OMAP_USB2=y 387CONFIG_OMAP_USB2=y
388CONFIG_TI_PIPE3=y
389CONFIG_PHY_MIPHY365X=y
371CONFIG_PHY_SUN4I_USB=y 390CONFIG_PHY_SUN4I_USB=y
372CONFIG_EXT4_FS=y 391CONFIG_EXT4_FS=y
373CONFIG_VFAT_FS=y 392CONFIG_VFAT_FS=y
diff --git a/arch/arm/configs/mvebu_v5_defconfig b/arch/arm/configs/mvebu_v5_defconfig
index 27c732fdf21e..22058e18dfaa 100644
--- a/arch/arm/configs/mvebu_v5_defconfig
+++ b/arch/arm/configs/mvebu_v5_defconfig
@@ -12,6 +12,7 @@ CONFIG_MODULE_UNLOAD=y
12# CONFIG_ARCH_MULTI_V7 is not set 12# CONFIG_ARCH_MULTI_V7 is not set
13CONFIG_ARCH_MVEBU=y 13CONFIG_ARCH_MVEBU=y
14CONFIG_MACH_KIRKWOOD=y 14CONFIG_MACH_KIRKWOOD=y
15CONFIG_MACH_NETXBIG=y
15# CONFIG_CPU_FEROCEON_OLD_ID is not set 16# CONFIG_CPU_FEROCEON_OLD_ID is not set
16CONFIG_PCI_MVEBU=y 17CONFIG_PCI_MVEBU=y
17CONFIG_PREEMPT=y 18CONFIG_PREEMPT=y
@@ -19,6 +20,8 @@ CONFIG_AEABI=y
19CONFIG_HIGHMEM=y 20CONFIG_HIGHMEM=y
20CONFIG_ZBOOT_ROM_TEXT=0x0 21CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0 22CONFIG_ZBOOT_ROM_BSS=0x0
23CONFIG_ARM_APPENDED_DTB=y
24CONFIG_ARM_ATAG_DTB_COMPAT=y
22CONFIG_CPU_FREQ=y 25CONFIG_CPU_FREQ=y
23CONFIG_CPU_FREQ_STAT_DETAILS=y 26CONFIG_CPU_FREQ_STAT_DETAILS=y
24CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
@@ -36,6 +39,8 @@ CONFIG_NET_PKTGEN=m
36CONFIG_CFG80211=y 39CONFIG_CFG80211=y
37CONFIG_MAC80211=y 40CONFIG_MAC80211=y
38CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 41CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
42CONFIG_DEVTMPFS=y
43CONFIG_DEVTMPFS_MOUNT=y
39CONFIG_MTD=y 44CONFIG_MTD=y
40CONFIG_MTD_CMDLINE_PARTS=y 45CONFIG_MTD_CMDLINE_PARTS=y
41CONFIG_MTD_BLOCK=y 46CONFIG_MTD_BLOCK=y
@@ -89,6 +94,7 @@ CONFIG_POWER_RESET=y
89CONFIG_POWER_RESET_GPIO=y 94CONFIG_POWER_RESET_GPIO=y
90CONFIG_POWER_RESET_QNAP=y 95CONFIG_POWER_RESET_QNAP=y
91CONFIG_SENSORS_ADT7475=y 96CONFIG_SENSORS_ADT7475=y
97CONFIG_SENSORS_G762=y
92CONFIG_SENSORS_LM63=y 98CONFIG_SENSORS_LM63=y
93CONFIG_SENSORS_LM75=y 99CONFIG_SENSORS_LM75=y
94CONFIG_SENSORS_LM85=y 100CONFIG_SENSORS_LM85=y
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig
index b0bfefa23902..fdfda1fa9521 100644
--- a/arch/arm/configs/mvebu_v7_defconfig
+++ b/arch/arm/configs/mvebu_v7_defconfig
@@ -29,6 +29,10 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
29CONFIG_ZBOOT_ROM_BSS=0x0 29CONFIG_ZBOOT_ROM_BSS=0x0
30CONFIG_ARM_APPENDED_DTB=y 30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y 31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_CPU_IDLE=y
33CONFIG_ARM_MVEBU_V7_CPUIDLE=y
34CONFIG_CPU_FREQ=y
35CONFIG_CPUFREQ_GENERIC=y
32CONFIG_VFP=y 36CONFIG_VFP=y
33CONFIG_NET=y 37CONFIG_NET=y
34CONFIG_INET=y 38CONFIG_INET=y
@@ -46,6 +50,7 @@ CONFIG_AHCI_MVEBU=y
46CONFIG_SATA_MV=y 50CONFIG_SATA_MV=y
47CONFIG_NETDEVICES=y 51CONFIG_NETDEVICES=y
48CONFIG_MVNETA=y 52CONFIG_MVNETA=y
53CONFIG_MVPP2=y
49CONFIG_MARVELL_PHY=y 54CONFIG_MARVELL_PHY=y
50CONFIG_MWIFIEX=y 55CONFIG_MWIFIEX=y
51CONFIG_MWIFIEX_SDIO=y 56CONFIG_MWIFIEX_SDIO=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index a9f992335eb2..c7906c2fd645 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -1,4 +1,5 @@
1CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_FHANDLE=y
2CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
4CONFIG_TASKSTATS=y 5CONFIG_TASKSTATS=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index ce541bb3c2de..115cda9f3260 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -26,8 +26,6 @@ CONFIG_ARCH_OMAP=y
26CONFIG_ARCH_OMAP1=y 26CONFIG_ARCH_OMAP1=y
27CONFIG_OMAP_RESET_CLOCKS=y 27CONFIG_OMAP_RESET_CLOCKS=y
28# CONFIG_OMAP_MUX is not set 28# CONFIG_OMAP_MUX is not set
29CONFIG_MAILBOX=y
30CONFIG_OMAP1_MBOX=y
31CONFIG_OMAP_32K_TIMER=y 29CONFIG_OMAP_32K_TIMER=y
32CONFIG_OMAP_DM_TIMER=y 30CONFIG_OMAP_DM_TIMER=y
33CONFIG_ARCH_OMAP730=y 31CONFIG_ARCH_OMAP730=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 536a137863cb..f650f00e8cee 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -180,6 +180,7 @@ CONFIG_TWL4030_WATCHDOG=y
180CONFIG_MFD_SYSCON=y 180CONFIG_MFD_SYSCON=y
181CONFIG_MFD_PALMAS=y 181CONFIG_MFD_PALMAS=y
182CONFIG_MFD_TPS65217=y 182CONFIG_MFD_TPS65217=y
183CONFIG_MFD_TPS65218=y
183CONFIG_MFD_TPS65910=y 184CONFIG_MFD_TPS65910=y
184CONFIG_TWL6040_CORE=y 185CONFIG_TWL6040_CORE=y
185CONFIG_REGULATOR_FIXED_VOLTAGE=y 186CONFIG_REGULATOR_FIXED_VOLTAGE=y
@@ -188,6 +189,7 @@ CONFIG_REGULATOR_TI_ABB=y
188CONFIG_REGULATOR_TPS65023=y 189CONFIG_REGULATOR_TPS65023=y
189CONFIG_REGULATOR_TPS6507X=y 190CONFIG_REGULATOR_TPS6507X=y
190CONFIG_REGULATOR_TPS65217=y 191CONFIG_REGULATOR_TPS65217=y
192CONFIG_REGULATOR_TPS65218=y
191CONFIG_REGULATOR_TPS65910=y 193CONFIG_REGULATOR_TPS65910=y
192CONFIG_REGULATOR_TWL4030=y 194CONFIG_REGULATOR_TWL4030=y
193CONFIG_REGULATOR_PBIAS=y 195CONFIG_REGULATOR_PBIAS=y
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index eb4d204bff47..f3142369f594 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -225,7 +225,6 @@ CONFIG_BLK_DEV_IDECD=y
225CONFIG_BLK_DEV_IDETAPE=m 225CONFIG_BLK_DEV_IDETAPE=m
226CONFIG_BLK_DEV_PLATFORM=y 226CONFIG_BLK_DEV_PLATFORM=y
227CONFIG_SCSI=y 227CONFIG_SCSI=y
228CONFIG_SCSI_TGT=m
229CONFIG_BLK_DEV_SD=y 228CONFIG_BLK_DEV_SD=y
230CONFIG_CHR_DEV_ST=m 229CONFIG_CHR_DEV_ST=m
231CONFIG_BLK_DEV_SR=m 230CONFIG_BLK_DEV_SR=m
diff --git a/arch/arm/configs/s5p64x0_defconfig b/arch/arm/configs/s5p64x0_defconfig
deleted file mode 100644
index ad6b61b0bd11..000000000000
--- a/arch/arm/configs/s5p64x0_defconfig
+++ /dev/null
@@ -1,68 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSFS_DEPRECATED_V2=y
3CONFIG_BLK_DEV_INITRD=y
4CONFIG_KALLSYMS_ALL=y
5CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y
7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_ARCH_S5P64X0=y
9CONFIG_S3C_BOOT_ERROR_RESET=y
10CONFIG_S3C_LOWLEVEL_UART_PORT=1
11CONFIG_MACH_SMDK6440=y
12CONFIG_MACH_SMDK6450=y
13CONFIG_NO_HZ=y
14CONFIG_HIGH_RES_TIMERS=y
15CONFIG_CPU_32v6K=y
16CONFIG_AEABI=y
17CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
18CONFIG_FPE_NWFPE=y
19CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
20# CONFIG_PREVENT_FIRMWARE_BUILD is not set
21CONFIG_BLK_DEV_RAM=y
22CONFIG_BLK_DEV_RAM_SIZE=8192
23# CONFIG_MISC_DEVICES is not set
24CONFIG_SCSI=y
25CONFIG_BLK_DEV_SD=y
26CONFIG_CHR_DEV_SG=y
27CONFIG_INPUT_EVDEV=y
28CONFIG_INPUT_TOUCHSCREEN=y
29CONFIG_SERIAL_8250=y
30CONFIG_SERIAL_8250_NR_UARTS=3
31CONFIG_SERIAL_SAMSUNG=y
32CONFIG_SERIAL_SAMSUNG_CONSOLE=y
33CONFIG_HW_RANDOM=y
34# CONFIG_HWMON is not set
35CONFIG_DISPLAY_SUPPORT=y
36# CONFIG_VGA_CONSOLE is not set
37# CONFIG_HID_SUPPORT is not set
38# CONFIG_USB_SUPPORT is not set
39CONFIG_EXT2_FS=y
40CONFIG_EXT3_FS=y
41CONFIG_EXT3_FS_POSIX_ACL=y
42CONFIG_EXT3_FS_SECURITY=y
43CONFIG_INOTIFY=y
44CONFIG_MSDOS_FS=y
45CONFIG_VFAT_FS=y
46CONFIG_TMPFS=y
47CONFIG_TMPFS_POSIX_ACL=y
48CONFIG_CRAMFS=y
49CONFIG_ROMFS_FS=y
50CONFIG_NLS_CODEPAGE_437=y
51CONFIG_NLS_ASCII=y
52CONFIG_NLS_ISO8859_1=y
53CONFIG_MAGIC_SYSRQ=y
54CONFIG_DEBUG_KERNEL=y
55CONFIG_DEBUG_RT_MUTEXES=y
56CONFIG_DEBUG_SPINLOCK=y
57CONFIG_DEBUG_MUTEXES=y
58CONFIG_DEBUG_SPINLOCK_SLEEP=y
59CONFIG_DEBUG_INFO=y
60# CONFIG_RCU_CPU_STALL_DETECTOR is not set
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62CONFIG_DEBUG_USER=y
63CONFIG_DEBUG_ERRORS=y
64CONFIG_DEBUG_LL=y
65CONFIG_DEBUG_S3C_UART=1
66CONFIG_CRYPTO=y
67# CONFIG_CRYPTO_ANSI_CPRNG is not set
68CONFIG_CRC_CCITT=y
diff --git a/arch/arm/configs/s5pc100_defconfig b/arch/arm/configs/s5pc100_defconfig
deleted file mode 100644
index 41bafc94dd85..000000000000
--- a/arch/arm/configs/s5pc100_defconfig
+++ /dev/null
@@ -1,49 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSFS_DEPRECATED_V2=y
3CONFIG_BLK_DEV_INITRD=y
4CONFIG_KALLSYMS_ALL=y
5CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y
7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_ARCH_S5PC100=y
9CONFIG_MACH_SMDKC100=y
10CONFIG_AEABI=y
11CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=cramfs init=/linuxrc console=ttySAC2,115200 mem=128M"
12CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
13CONFIG_BLK_DEV_LOOP=y
14CONFIG_BLK_DEV_RAM=y
15CONFIG_BLK_DEV_RAM_SIZE=8192
16CONFIG_EEPROM_AT24=y
17CONFIG_SERIAL_8250=y
18CONFIG_SERIAL_SAMSUNG=y
19CONFIG_SERIAL_SAMSUNG_CONSOLE=y
20CONFIG_HW_RANDOM=y
21CONFIG_I2C=y
22CONFIG_I2C_CHARDEV=y
23# CONFIG_VGA_CONSOLE is not set
24CONFIG_MMC=y
25CONFIG_MMC_DEBUG=y
26CONFIG_MMC_UNSAFE_RESUME=y
27CONFIG_SDIO_UART=y
28CONFIG_MMC_SDHCI=y
29CONFIG_EXT2_FS=y
30CONFIG_EXT3_FS=y
31CONFIG_EXT3_FS_POSIX_ACL=y
32CONFIG_EXT3_FS_SECURITY=y
33CONFIG_INOTIFY=y
34CONFIG_TMPFS=y
35CONFIG_TMPFS_POSIX_ACL=y
36CONFIG_CRAMFS=y
37CONFIG_ROMFS_FS=y
38CONFIG_MAGIC_SYSRQ=y
39CONFIG_DEBUG_KERNEL=y
40CONFIG_DEBUG_RT_MUTEXES=y
41CONFIG_DEBUG_SPINLOCK=y
42CONFIG_DEBUG_MUTEXES=y
43CONFIG_DEBUG_SPINLOCK_SLEEP=y
44CONFIG_DEBUG_INFO=y
45# CONFIG_RCU_CPU_STALL_DETECTOR is not set
46CONFIG_SYSCTL_SYSCALL_CHECK=y
47CONFIG_DEBUG_USER=y
48CONFIG_DEBUG_ERRORS=y
49CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
index 6d6437cbbc52..3b136144cc83 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -10,16 +10,20 @@ CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_ARCH_SHMOBILE_MULTI=y 11CONFIG_ARCH_SHMOBILE_MULTI=y
12CONFIG_ARCH_EMEV2=y 12CONFIG_ARCH_EMEV2=y
13CONFIG_ARCH_R7S72100=y
14CONFIG_ARCH_R8A7779=y
13CONFIG_ARCH_R8A7790=y 15CONFIG_ARCH_R8A7790=y
14CONFIG_ARCH_R8A7791=y 16CONFIG_ARCH_R8A7791=y
15CONFIG_MACH_KOELSCH=y 17CONFIG_MACH_KOELSCH=y
16CONFIG_MACH_LAGER=y 18CONFIG_MACH_LAGER=y
19CONFIG_MACH_MARZEN=y
17# CONFIG_SWP_EMULATE is not set 20# CONFIG_SWP_EMULATE is not set
18CONFIG_CPU_BPREDICT_DISABLE=y 21CONFIG_CPU_BPREDICT_DISABLE=y
19CONFIG_PL310_ERRATA_588369=y 22CONFIG_PL310_ERRATA_588369=y
20CONFIG_ARM_ERRATA_754322=y 23CONFIG_ARM_ERRATA_754322=y
21CONFIG_PCI=y 24CONFIG_PCI=y
22CONFIG_PCI_RCAR_GEN2=y 25CONFIG_PCI_RCAR_GEN2=y
26CONFIG_PCI_RCAR_GEN2_PCIE=y
23CONFIG_SMP=y 27CONFIG_SMP=y
24CONFIG_SCHED_MC=y 28CONFIG_SCHED_MC=y
25CONFIG_HAVE_ARM_ARCH_TIMER=y 29CONFIG_HAVE_ARM_ARCH_TIMER=y
@@ -33,6 +37,7 @@ CONFIG_KEXEC=y
33CONFIG_VFP=y 37CONFIG_VFP=y
34CONFIG_NEON=y 38CONFIG_NEON=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 39# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
40CONFIG_PM_RUNTIME=y
36CONFIG_NET=y 41CONFIG_NET=y
37CONFIG_PACKET=y 42CONFIG_PACKET=y
38CONFIG_UNIX=y 43CONFIG_UNIX=y
@@ -82,6 +87,7 @@ CONFIG_I2C_RCAR=y
82CONFIG_SPI=y 87CONFIG_SPI=y
83CONFIG_SPI_RSPI=y 88CONFIG_SPI_RSPI=y
84CONFIG_SPI_SH_MSIOF=y 89CONFIG_SPI_SH_MSIOF=y
90CONFIG_SPI_SH_HSPI=y
85CONFIG_GPIO_EM=y 91CONFIG_GPIO_EM=y
86CONFIG_GPIO_RCAR=y 92CONFIG_GPIO_RCAR=y
87# CONFIG_HWMON is not set 93# CONFIG_HWMON is not set
@@ -109,12 +115,14 @@ CONFIG_SND=y
109CONFIG_SND_SOC=y 115CONFIG_SND_SOC=y
110CONFIG_SND_SOC_RCAR=y 116CONFIG_SND_SOC_RCAR=y
111CONFIG_USB=y 117CONFIG_USB=y
112CONFIG_USB_RCAR_GEN2_PHY=y
113CONFIG_USB_EHCI_HCD=y 118CONFIG_USB_EHCI_HCD=y
114CONFIG_USB_OHCI_HCD=y 119CONFIG_USB_OHCI_HCD=y
115CONFIG_USB_RENESAS_USBHS=y 120CONFIG_USB_RENESAS_USBHS=y
121CONFIG_USB_RCAR_PHY=y
122CONFIG_USB_RCAR_GEN2_PHY=y
116CONFIG_USB_GADGET=y 123CONFIG_USB_GADGET=y
117CONFIG_USB_RENESAS_USBHS_UDC=y 124CONFIG_USB_RENESAS_USBHS_UDC=y
125CONFIG_USB_ETH=y
118CONFIG_MMC=y 126CONFIG_MMC=y
119CONFIG_MMC_SDHI=y 127CONFIG_MMC_SDHI=y
120CONFIG_MMC_SH_MMCIF=y 128CONFIG_MMC_SH_MMCIF=y
@@ -141,3 +149,16 @@ CONFIG_NLS_ISO8859_1=y
141# CONFIG_ENABLE_WARN_DEPRECATED is not set 149# CONFIG_ENABLE_WARN_DEPRECATED is not set
142# CONFIG_ENABLE_MUST_CHECK is not set 150# CONFIG_ENABLE_MUST_CHECK is not set
143# CONFIG_ARM_UNWIND is not set 151# CONFIG_ARM_UNWIND is not set
152CONFIG_CPU_FREQ=y
153CONFIG_CPU_FREQ_GOV_COMMON=y
154CONFIG_CPU_FREQ_STAT=y
155CONFIG_CPU_FREQ_STAT_DETAILS=y
156CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
157CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
158CONFIG_CPU_FREQ_GOV_POWERSAVE=y
159CONFIG_CPU_FREQ_GOV_USERSPACE=y
160CONFIG_CPU_FREQ_GOV_ONDEMAND=y
161CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
162CONFIG_CPU_THERMAL=y
163CONFIG_GENERIC_CPUFREQ_CPU0=y
164CONFIG_REGULATOR_DA9210=y
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig
index e3a05e8801d8..d7a5855a5db8 100644
--- a/arch/arm/configs/socfpga_defconfig
+++ b/arch/arm/configs/socfpga_defconfig
@@ -11,6 +11,7 @@ CONFIG_PROFILING=y
11CONFIG_OPROFILE=y 11CONFIG_OPROFILE=y
12CONFIG_MODULES=y 12CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
14CONFIG_HOTPLUG=y
14# CONFIG_LBDAF is not set 15# CONFIG_LBDAF is not set
15# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set 17# CONFIG_IOSCHED_DEADLINE is not set
@@ -40,6 +41,15 @@ CONFIG_IP_PNP=y
40CONFIG_IP_PNP_DHCP=y 41CONFIG_IP_PNP_DHCP=y
41CONFIG_IP_PNP_BOOTP=y 42CONFIG_IP_PNP_BOOTP=y
42CONFIG_IP_PNP_RARP=y 43CONFIG_IP_PNP_RARP=y
44CONFIG_CAN=y
45CONFIG_CAN_RAW=y
46CONFIG_CAN_BCM=y
47CONFIG_CAN_GW=y
48CONFIG_CAN_DEV=y
49CONFIG_CAN_CALC_BITTIMING=y
50CONFIG_CAN_C_CAN=y
51CONFIG_CAN_C_CAN_PLATFORM=y
52CONFIG_CAN_DEBUG_DEVICES=y
43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
44CONFIG_DEVTMPFS=y 54CONFIG_DEVTMPFS=y
45CONFIG_PROC_DEVICETREE=y 55CONFIG_PROC_DEVICETREE=y
@@ -55,6 +65,14 @@ CONFIG_STMMAC_ETH=y
55CONFIG_MICREL_PHY=y 65CONFIG_MICREL_PHY=y
56# CONFIG_STMMAC_PHY_ID_ZERO_WORKAROUND is not set 66# CONFIG_STMMAC_PHY_ID_ZERO_WORKAROUND is not set
57CONFIG_INPUT_EVDEV=y 67CONFIG_INPUT_EVDEV=y
68CONFIG_DWMAC_SOCFPGA=y
69CONFIG_PPS=y
70CONFIG_NETWORK_PHY_TIMESTAMPING=y
71CONFIG_PTP_1588_CLOCK=y
72CONFIG_VLAN_8021Q=y
73CONFIG_VLAN_8021Q_GVRP=y
74CONFIG_GARP=y
75CONFIG_IPV6=y
58# CONFIG_SERIO_SERPORT is not set 76# CONFIG_SERIO_SERPORT is not set
59CONFIG_SERIO_AMBAKMI=y 77CONFIG_SERIO_AMBAKMI=y
60CONFIG_LEGACY_PTY_COUNT=16 78CONFIG_LEGACY_PTY_COUNT=16
@@ -63,7 +81,12 @@ CONFIG_SERIAL_8250_CONSOLE=y
63CONFIG_SERIAL_8250_NR_UARTS=2 81CONFIG_SERIAL_8250_NR_UARTS=2
64CONFIG_SERIAL_8250_RUNTIME_UARTS=2 82CONFIG_SERIAL_8250_RUNTIME_UARTS=2
65CONFIG_SERIAL_8250_DW=y 83CONFIG_SERIAL_8250_DW=y
84CONFIG_GPIOLIB=y
85CONFIG_GPIO_SYSFS=y
86CONFIG_GPIO_DWAPB=y
66# CONFIG_RTC_HCTOSYS is not set 87# CONFIG_RTC_HCTOSYS is not set
88CONFIG_WATCHDOG=y
89CONFIG_DW_WATCHDOG=y
67CONFIG_EXT2_FS=y 90CONFIG_EXT2_FS=y
68CONFIG_EXT2_FS_XATTR=y 91CONFIG_EXT2_FS_XATTR=y
69CONFIG_EXT2_FS_POSIX_ACL=y 92CONFIG_EXT2_FS_POSIX_ACL=y
@@ -72,6 +95,7 @@ CONFIG_NFS_FS=y
72CONFIG_ROOT_NFS=y 95CONFIG_ROOT_NFS=y
73# CONFIG_DNOTIFY is not set 96# CONFIG_DNOTIFY is not set
74# CONFIG_INOTIFY_USER is not set 97# CONFIG_INOTIFY_USER is not set
98CONFIG_FHANDLE=y
75CONFIG_VFAT_FS=y 99CONFIG_VFAT_FS=y
76CONFIG_NTFS_FS=y 100CONFIG_NTFS_FS=y
77CONFIG_NTFS_RW=y 101CONFIG_NTFS_RW=y
@@ -86,5 +110,16 @@ CONFIG_DEBUG_INFO=y
86CONFIG_ENABLE_DEFAULT_TRACERS=y 110CONFIG_ENABLE_DEFAULT_TRACERS=y
87CONFIG_DEBUG_USER=y 111CONFIG_DEBUG_USER=y
88CONFIG_XZ_DEC=y 112CONFIG_XZ_DEC=y
113CONFIG_I2C=y
114CONFIG_I2C_DESIGNWARE_CORE=y
115CONFIG_I2C_DESIGNWARE_PLATFORM=y
116CONFIG_I2C_CHARDEV=y
89CONFIG_MMC=y 117CONFIG_MMC=y
90CONFIG_MMC_DW=y 118CONFIG_MMC_DW=y
119CONFIG_PM=y
120CONFIG_SUSPEND=y
121CONFIG_MMC_UNSAFE_RESUME=y
122CONFIG_USB=y
123CONFIG_USB_DWC2=y
124CONFIG_USB_DWC2_HOST=y
125CONFIG_USB_DWC2_PLATFORM=y
diff --git a/arch/arm/configs/spear13xx_defconfig b/arch/arm/configs/spear13xx_defconfig
index 82eaa552ed14..d271b263f35d 100644
--- a/arch/arm/configs/spear13xx_defconfig
+++ b/arch/arm/configs/spear13xx_defconfig
@@ -11,13 +11,24 @@ CONFIG_ARCH_SPEAR13XX=y
11CONFIG_MACH_SPEAR1310=y 11CONFIG_MACH_SPEAR1310=y
12CONFIG_MACH_SPEAR1340=y 12CONFIG_MACH_SPEAR1340=y
13# CONFIG_SWP_EMULATE is not set 13# CONFIG_SWP_EMULATE is not set
14CONFIG_PCI=y
15CONFIG_PCI_MSI=y
16CONFIG_PCIE_SPEAR13XX=y
14CONFIG_SMP=y 17CONFIG_SMP=y
15# CONFIG_SMP_ON_UP is not set 18# CONFIG_SMP_ON_UP is not set
16# CONFIG_ARM_CPU_TOPOLOGY is not set 19# CONFIG_ARM_CPU_TOPOLOGY is not set
20CONFIG_AEABI=y
17CONFIG_ARM_APPENDED_DTB=y 21CONFIG_ARM_APPENDED_DTB=y
18CONFIG_ARM_ATAG_DTB_COMPAT=y 22CONFIG_ARM_ATAG_DTB_COMPAT=y
23CONFIG_VFP=y
19CONFIG_BINFMT_MISC=y 24CONFIG_BINFMT_MISC=y
20CONFIG_NET=y 25CONFIG_NET=y
26CONFIG_UNIX=y
27CONFIG_INET=y
28CONFIG_IP_PNP=y
29CONFIG_IP_PNP_DHCP=y
30CONFIG_IP_PNP_BOOTP=y
31CONFIG_NET_IPIP=y
21CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
22CONFIG_MTD=y 33CONFIG_MTD=y
23CONFIG_MTD_OF_PARTS=y 34CONFIG_MTD_OF_PARTS=y
@@ -27,6 +38,7 @@ CONFIG_MTD_NAND=y
27CONFIG_MTD_NAND_FSMC=y 38CONFIG_MTD_NAND_FSMC=y
28CONFIG_BLK_DEV_RAM=y 39CONFIG_BLK_DEV_RAM=y
29CONFIG_BLK_DEV_RAM_SIZE=16384 40CONFIG_BLK_DEV_RAM_SIZE=16384
41CONFIG_BLK_DEV_SD=y
30CONFIG_ATA=y 42CONFIG_ATA=y
31# CONFIG_SATA_PMP is not set 43# CONFIG_SATA_PMP is not set
32CONFIG_SATA_AHCI_PLATFORM=y 44CONFIG_SATA_AHCI_PLATFORM=y
@@ -66,6 +78,7 @@ CONFIG_USB=y
66# CONFIG_USB_DEVICE_CLASS is not set 78# CONFIG_USB_DEVICE_CLASS is not set
67CONFIG_USB_EHCI_HCD=y 79CONFIG_USB_EHCI_HCD=y
68CONFIG_USB_OHCI_HCD=y 80CONFIG_USB_OHCI_HCD=y
81CONFIG_USB_STORAGE=y
69CONFIG_MMC=y 82CONFIG_MMC=y
70CONFIG_MMC_SDHCI=y 83CONFIG_MMC_SDHCI=y
71CONFIG_MMC_SDHCI_SPEAR=y 84CONFIG_MMC_SDHCI_SPEAR=y
@@ -79,11 +92,14 @@ CONFIG_EXT2_FS_SECURITY=y
79CONFIG_EXT3_FS=y 92CONFIG_EXT3_FS=y
80CONFIG_EXT3_FS_SECURITY=y 93CONFIG_EXT3_FS_SECURITY=y
81CONFIG_AUTOFS4_FS=m 94CONFIG_AUTOFS4_FS=m
95CONFIG_FUSE_FS=y
82CONFIG_MSDOS_FS=m 96CONFIG_MSDOS_FS=m
83CONFIG_VFAT_FS=m 97CONFIG_VFAT_FS=m
84CONFIG_FAT_DEFAULT_IOCHARSET="ascii" 98CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
85CONFIG_TMPFS=y 99CONFIG_TMPFS=y
86CONFIG_JFFS2_FS=y 100CONFIG_JFFS2_FS=y
101CONFIG_NFS_FS=y
102CONFIG_ROOT_NFS=y
87CONFIG_NLS_DEFAULT="utf8" 103CONFIG_NLS_DEFAULT="utf8"
88CONFIG_NLS_CODEPAGE_437=y 104CONFIG_NLS_CODEPAGE_437=y
89CONFIG_NLS_ASCII=m 105CONFIG_NLS_ASCII=m
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index fb25e2982f64..285c433a9aad 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -23,14 +23,11 @@ CONFIG_MODULE_FORCE_UNLOAD=y
23CONFIG_PARTITION_ADVANCED=y 23CONFIG_PARTITION_ADVANCED=y
24# CONFIG_IOSCHED_DEADLINE is not set 24# CONFIG_IOSCHED_DEADLINE is not set
25# CONFIG_IOSCHED_CFQ is not set 25# CONFIG_IOSCHED_CFQ is not set
26CONFIG_GPIO_PCA953X=y
27CONFIG_ARCH_TEGRA=y 26CONFIG_ARCH_TEGRA=y
28CONFIG_ARCH_TEGRA_2x_SOC=y 27CONFIG_ARCH_TEGRA_2x_SOC=y
29CONFIG_ARCH_TEGRA_3x_SOC=y 28CONFIG_ARCH_TEGRA_3x_SOC=y
30CONFIG_ARCH_TEGRA_114_SOC=y 29CONFIG_ARCH_TEGRA_114_SOC=y
31CONFIG_ARCH_TEGRA_124_SOC=y 30CONFIG_ARCH_TEGRA_124_SOC=y
32CONFIG_TEGRA_EMC_SCALING_ENABLE=y
33CONFIG_TRUSTED_FOUNDATIONS=y
34CONFIG_PCI=y 31CONFIG_PCI=y
35CONFIG_PCI_MSI=y 32CONFIG_PCI_MSI=y
36CONFIG_PCI_TEGRA=y 33CONFIG_PCI_TEGRA=y
@@ -74,9 +71,6 @@ CONFIG_IPV6_MIP6=y
74CONFIG_IPV6_TUNNEL=y 71CONFIG_IPV6_TUNNEL=y
75CONFIG_IPV6_MULTIPLE_TABLES=y 72CONFIG_IPV6_MULTIPLE_TABLES=y
76CONFIG_CAN=y 73CONFIG_CAN=y
77CONFIG_CAN_RAW=y
78CONFIG_CAN_BCM=y
79CONFIG_CAN_DEV=y
80CONFIG_CAN_MCP251X=y 74CONFIG_CAN_MCP251X=y
81CONFIG_BT=y 75CONFIG_BT=y
82CONFIG_BT_RFCOMM=y 76CONFIG_BT_RFCOMM=y
@@ -96,7 +90,6 @@ CONFIG_CMA_SIZE_MBYTES=64
96CONFIG_MTD=y 90CONFIG_MTD=y
97CONFIG_MTD_M25P80=y 91CONFIG_MTD_M25P80=y
98CONFIG_MTD_SPI_NOR=y 92CONFIG_MTD_SPI_NOR=y
99CONFIG_PROC_DEVICETREE=y
100CONFIG_BLK_DEV_LOOP=y 93CONFIG_BLK_DEV_LOOP=y
101CONFIG_AD525X_DPOT=y 94CONFIG_AD525X_DPOT=y
102CONFIG_AD525X_DPOT_I2C=y 95CONFIG_AD525X_DPOT_I2C=y
@@ -111,6 +104,7 @@ CONFIG_SCSI_MULTI_LUN=y
111# CONFIG_SCSI_LOWLEVEL is not set 104# CONFIG_SCSI_LOWLEVEL is not set
112CONFIG_NETDEVICES=y 105CONFIG_NETDEVICES=y
113CONFIG_DUMMY=y 106CONFIG_DUMMY=y
107CONFIG_IGB=y
114CONFIG_R8169=y 108CONFIG_R8169=y
115CONFIG_USB_PEGASUS=y 109CONFIG_USB_PEGASUS=y
116CONFIG_USB_USBNET=y 110CONFIG_USB_USBNET=y
@@ -125,6 +119,8 @@ CONFIG_KEYBOARD_GPIO=y
125CONFIG_KEYBOARD_TEGRA=y 119CONFIG_KEYBOARD_TEGRA=y
126CONFIG_KEYBOARD_CROS_EC=y 120CONFIG_KEYBOARD_CROS_EC=y
127CONFIG_MOUSE_PS2_ELANTECH=y 121CONFIG_MOUSE_PS2_ELANTECH=y
122CONFIG_INPUT_TOUCHSCREEN=y
123CONFIG_TOUCHSCREEN_STMPE=y
128CONFIG_INPUT_MISC=y 124CONFIG_INPUT_MISC=y
129CONFIG_INPUT_MPU3050=y 125CONFIG_INPUT_MPU3050=y
130# CONFIG_LEGACY_PTYS is not set 126# CONFIG_LEGACY_PTYS is not set
@@ -135,6 +131,7 @@ CONFIG_SERIAL_TEGRA=y
135CONFIG_SERIAL_OF_PLATFORM=y 131CONFIG_SERIAL_OF_PLATFORM=y
136# CONFIG_HW_RANDOM is not set 132# CONFIG_HW_RANDOM is not set
137# CONFIG_I2C_COMPAT is not set 133# CONFIG_I2C_COMPAT is not set
134CONFIG_I2C_CHARDEV=y
138CONFIG_I2C_MUX_PCA954x=y 135CONFIG_I2C_MUX_PCA954x=y
139CONFIG_I2C_MUX_PINCTRL=y 136CONFIG_I2C_MUX_PINCTRL=y
140CONFIG_I2C_TEGRA=y 137CONFIG_I2C_TEGRA=y
@@ -144,6 +141,7 @@ CONFIG_SPI_TEGRA20_SFLASH=y
144CONFIG_SPI_TEGRA20_SLINK=y 141CONFIG_SPI_TEGRA20_SLINK=y
145CONFIG_PINCTRL_AS3722=y 142CONFIG_PINCTRL_AS3722=y
146CONFIG_PINCTRL_PALMAS=y 143CONFIG_PINCTRL_PALMAS=y
144CONFIG_GPIO_PCA953X=y
147CONFIG_GPIO_PCA953X_IRQ=y 145CONFIG_GPIO_PCA953X_IRQ=y
148CONFIG_GPIO_PALMAS=y 146CONFIG_GPIO_PALMAS=y
149CONFIG_GPIO_TPS6586X=y 147CONFIG_GPIO_TPS6586X=y
@@ -155,10 +153,12 @@ CONFIG_POWER_RESET=y
155CONFIG_POWER_RESET_AS3722=y 153CONFIG_POWER_RESET_AS3722=y
156CONFIG_POWER_RESET_GPIO=y 154CONFIG_POWER_RESET_GPIO=y
157CONFIG_SENSORS_LM90=y 155CONFIG_SENSORS_LM90=y
156CONFIG_SENSORS_LM95245=y
158CONFIG_MFD_AS3722=y 157CONFIG_MFD_AS3722=y
159CONFIG_MFD_CROS_EC=y 158CONFIG_MFD_CROS_EC=y
160CONFIG_MFD_CROS_EC_SPI=y 159CONFIG_MFD_CROS_EC_SPI=y
161CONFIG_MFD_MAX8907=y 160CONFIG_MFD_MAX8907=y
161CONFIG_MFD_STMPE=y
162CONFIG_MFD_PALMAS=y 162CONFIG_MFD_PALMAS=y
163CONFIG_MFD_TPS65090=y 163CONFIG_MFD_TPS65090=y
164CONFIG_MFD_TPS6586X=y 164CONFIG_MFD_TPS6586X=y
@@ -221,6 +221,7 @@ CONFIG_MMC_SDHCI_TEGRA=y
221CONFIG_NEW_LEDS=y 221CONFIG_NEW_LEDS=y
222CONFIG_LEDS_CLASS=y 222CONFIG_LEDS_CLASS=y
223CONFIG_LEDS_GPIO=y 223CONFIG_LEDS_GPIO=y
224CONFIG_LEDS_PWM=y
224CONFIG_LEDS_TRIGGERS=y 225CONFIG_LEDS_TRIGGERS=y
225CONFIG_LEDS_TRIGGER_TIMER=y 226CONFIG_LEDS_TRIGGER_TIMER=y
226CONFIG_LEDS_TRIGGER_ONESHOT=y 227CONFIG_LEDS_TRIGGER_ONESHOT=y
@@ -291,5 +292,4 @@ CONFIG_DEBUG_LL=y
291CONFIG_EARLY_PRINTK=y 292CONFIG_EARLY_PRINTK=y
292CONFIG_CRYPTO_TWOFISH=y 293CONFIG_CRYPTO_TWOFISH=y
293# CONFIG_CRYPTO_ANSI_CPRNG is not set 294# CONFIG_CRYPTO_ANSI_CPRNG is not set
294CONFIG_CRYPTO_DEV_TEGRA_AES=y
295CONFIG_CRC_CCITT=y 295CONFIG_CRC_CCITT=y
diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
index 81cda39860c5..b48fa341648d 100644
--- a/arch/arm/crypto/Makefile
+++ b/arch/arm/crypto/Makefile
@@ -5,10 +5,14 @@
5obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o 5obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o
6obj-$(CONFIG_CRYPTO_AES_ARM_BS) += aes-arm-bs.o 6obj-$(CONFIG_CRYPTO_AES_ARM_BS) += aes-arm-bs.o
7obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o 7obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o
8obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) += sha1-arm-neon.o
9obj-$(CONFIG_CRYPTO_SHA512_ARM_NEON) += sha512-arm-neon.o
8 10
9aes-arm-y := aes-armv4.o aes_glue.o 11aes-arm-y := aes-armv4.o aes_glue.o
10aes-arm-bs-y := aesbs-core.o aesbs-glue.o 12aes-arm-bs-y := aesbs-core.o aesbs-glue.o
11sha1-arm-y := sha1-armv4-large.o sha1_glue.o 13sha1-arm-y := sha1-armv4-large.o sha1_glue.o
14sha1-arm-neon-y := sha1-armv7-neon.o sha1_neon_glue.o
15sha512-arm-neon-y := sha512-armv7-neon.o sha512_neon_glue.o
12 16
13quiet_cmd_perl = PERL $@ 17quiet_cmd_perl = PERL $@
14 cmd_perl = $(PERL) $(<) > $(@) 18 cmd_perl = $(PERL) $(<) > $(@)
diff --git a/arch/arm/crypto/aes-armv4.S b/arch/arm/crypto/aes-armv4.S
index 3a14ea8fe97e..ebb9761fb572 100644
--- a/arch/arm/crypto/aes-armv4.S
+++ b/arch/arm/crypto/aes-armv4.S
@@ -35,6 +35,7 @@
35@ that is being targetted. 35@ that is being targetted.
36 36
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <asm/assembler.h>
38 39
39.text 40.text
40 41
@@ -648,7 +649,7 @@ _armv4_AES_set_encrypt_key:
648 649
649.Ldone: mov r0,#0 650.Ldone: mov r0,#0
650 ldmia sp!,{r4-r12,lr} 651 ldmia sp!,{r4-r12,lr}
651.Labrt: mov pc,lr 652.Labrt: ret lr
652ENDPROC(private_AES_set_encrypt_key) 653ENDPROC(private_AES_set_encrypt_key)
653 654
654.align 5 655.align 5
diff --git a/arch/arm/crypto/sha1-armv7-neon.S b/arch/arm/crypto/sha1-armv7-neon.S
new file mode 100644
index 000000000000..50013c0e2864
--- /dev/null
+++ b/arch/arm/crypto/sha1-armv7-neon.S
@@ -0,0 +1,634 @@
1/* sha1-armv7-neon.S - ARM/NEON accelerated SHA-1 transform function
2 *
3 * Copyright © 2013-2014 Jussi Kivilinna <jussi.kivilinna@iki.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 */
10
11#include <linux/linkage.h>
12
13
14.syntax unified
15.code 32
16.fpu neon
17
18.text
19
20
21/* Context structure */
22
23#define state_h0 0
24#define state_h1 4
25#define state_h2 8
26#define state_h3 12
27#define state_h4 16
28
29
30/* Constants */
31
32#define K1 0x5A827999
33#define K2 0x6ED9EBA1
34#define K3 0x8F1BBCDC
35#define K4 0xCA62C1D6
36.align 4
37.LK_VEC:
38.LK1: .long K1, K1, K1, K1
39.LK2: .long K2, K2, K2, K2
40.LK3: .long K3, K3, K3, K3
41.LK4: .long K4, K4, K4, K4
42
43
44/* Register macros */
45
46#define RSTATE r0
47#define RDATA r1
48#define RNBLKS r2
49#define ROLDSTACK r3
50#define RWK lr
51
52#define _a r4
53#define _b r5
54#define _c r6
55#define _d r7
56#define _e r8
57
58#define RT0 r9
59#define RT1 r10
60#define RT2 r11
61#define RT3 r12
62
63#define W0 q0
64#define W1 q1
65#define W2 q2
66#define W3 q3
67#define W4 q4
68#define W5 q5
69#define W6 q6
70#define W7 q7
71
72#define tmp0 q8
73#define tmp1 q9
74#define tmp2 q10
75#define tmp3 q11
76
77#define qK1 q12
78#define qK2 q13
79#define qK3 q14
80#define qK4 q15
81
82
83/* Round function macros. */
84
85#define WK_offs(i) (((i) & 15) * 4)
86
87#define _R_F1(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
88 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
89 ldr RT3, [sp, WK_offs(i)]; \
90 pre1(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
91 bic RT0, d, b; \
92 add e, e, a, ror #(32 - 5); \
93 and RT1, c, b; \
94 pre2(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
95 add RT0, RT0, RT3; \
96 add e, e, RT1; \
97 ror b, #(32 - 30); \
98 pre3(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
99 add e, e, RT0;
100
101#define _R_F2(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
102 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
103 ldr RT3, [sp, WK_offs(i)]; \
104 pre1(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
105 eor RT0, d, b; \
106 add e, e, a, ror #(32 - 5); \
107 eor RT0, RT0, c; \
108 pre2(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
109 add e, e, RT3; \
110 ror b, #(32 - 30); \
111 pre3(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
112 add e, e, RT0; \
113
114#define _R_F3(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
115 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
116 ldr RT3, [sp, WK_offs(i)]; \
117 pre1(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
118 eor RT0, b, c; \
119 and RT1, b, c; \
120 add e, e, a, ror #(32 - 5); \
121 pre2(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
122 and RT0, RT0, d; \
123 add RT1, RT1, RT3; \
124 add e, e, RT0; \
125 ror b, #(32 - 30); \
126 pre3(i16,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28); \
127 add e, e, RT1;
128
129#define _R_F4(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
130 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
131 _R_F2(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
132 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28)
133
134#define _R(a,b,c,d,e,f,i,pre1,pre2,pre3,i16,\
135 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
136 _R_##f(a,b,c,d,e,i,pre1,pre2,pre3,i16,\
137 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28)
138
139#define R(a,b,c,d,e,f,i) \
140 _R_##f(a,b,c,d,e,i,dummy,dummy,dummy,i16,\
141 W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28)
142
143#define dummy(...)
144
145
146/* Input expansion macros. */
147
148/********* Precalc macros for rounds 0-15 *************************************/
149
150#define W_PRECALC_00_15() \
151 add RWK, sp, #(WK_offs(0)); \
152 \
153 vld1.32 {tmp0, tmp1}, [RDATA]!; \
154 vrev32.8 W0, tmp0; /* big => little */ \
155 vld1.32 {tmp2, tmp3}, [RDATA]!; \
156 vadd.u32 tmp0, W0, curK; \
157 vrev32.8 W7, tmp1; /* big => little */ \
158 vrev32.8 W6, tmp2; /* big => little */ \
159 vadd.u32 tmp1, W7, curK; \
160 vrev32.8 W5, tmp3; /* big => little */ \
161 vadd.u32 tmp2, W6, curK; \
162 vst1.32 {tmp0, tmp1}, [RWK]!; \
163 vadd.u32 tmp3, W5, curK; \
164 vst1.32 {tmp2, tmp3}, [RWK]; \
165
166#define WPRECALC_00_15_0(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
167 vld1.32 {tmp0, tmp1}, [RDATA]!; \
168
169#define WPRECALC_00_15_1(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
170 add RWK, sp, #(WK_offs(0)); \
171
172#define WPRECALC_00_15_2(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
173 vrev32.8 W0, tmp0; /* big => little */ \
174
175#define WPRECALC_00_15_3(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
176 vld1.32 {tmp2, tmp3}, [RDATA]!; \
177
178#define WPRECALC_00_15_4(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
179 vadd.u32 tmp0, W0, curK; \
180
181#define WPRECALC_00_15_5(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
182 vrev32.8 W7, tmp1; /* big => little */ \
183
184#define WPRECALC_00_15_6(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
185 vrev32.8 W6, tmp2; /* big => little */ \
186
187#define WPRECALC_00_15_7(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
188 vadd.u32 tmp1, W7, curK; \
189
190#define WPRECALC_00_15_8(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
191 vrev32.8 W5, tmp3; /* big => little */ \
192
193#define WPRECALC_00_15_9(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
194 vadd.u32 tmp2, W6, curK; \
195
196#define WPRECALC_00_15_10(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
197 vst1.32 {tmp0, tmp1}, [RWK]!; \
198
199#define WPRECALC_00_15_11(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
200 vadd.u32 tmp3, W5, curK; \
201
202#define WPRECALC_00_15_12(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
203 vst1.32 {tmp2, tmp3}, [RWK]; \
204
205
206/********* Precalc macros for rounds 16-31 ************************************/
207
208#define WPRECALC_16_31_0(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
209 veor tmp0, tmp0; \
210 vext.8 W, W_m16, W_m12, #8; \
211
212#define WPRECALC_16_31_1(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
213 add RWK, sp, #(WK_offs(i)); \
214 vext.8 tmp0, W_m04, tmp0, #4; \
215
216#define WPRECALC_16_31_2(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
217 veor tmp0, tmp0, W_m16; \
218 veor.32 W, W, W_m08; \
219
220#define WPRECALC_16_31_3(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
221 veor tmp1, tmp1; \
222 veor W, W, tmp0; \
223
224#define WPRECALC_16_31_4(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
225 vshl.u32 tmp0, W, #1; \
226
227#define WPRECALC_16_31_5(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
228 vext.8 tmp1, tmp1, W, #(16-12); \
229 vshr.u32 W, W, #31; \
230
231#define WPRECALC_16_31_6(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
232 vorr tmp0, tmp0, W; \
233 vshr.u32 W, tmp1, #30; \
234
235#define WPRECALC_16_31_7(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
236 vshl.u32 tmp1, tmp1, #2; \
237
238#define WPRECALC_16_31_8(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
239 veor tmp0, tmp0, W; \
240
241#define WPRECALC_16_31_9(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
242 veor W, tmp0, tmp1; \
243
244#define WPRECALC_16_31_10(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
245 vadd.u32 tmp0, W, curK; \
246
247#define WPRECALC_16_31_11(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
248 vst1.32 {tmp0}, [RWK];
249
250
251/********* Precalc macros for rounds 32-79 ************************************/
252
253#define WPRECALC_32_79_0(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
254 veor W, W_m28; \
255
256#define WPRECALC_32_79_1(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
257 vext.8 tmp0, W_m08, W_m04, #8; \
258
259#define WPRECALC_32_79_2(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
260 veor W, W_m16; \
261
262#define WPRECALC_32_79_3(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
263 veor W, tmp0; \
264
265#define WPRECALC_32_79_4(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
266 add RWK, sp, #(WK_offs(i&~3)); \
267
268#define WPRECALC_32_79_5(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
269 vshl.u32 tmp1, W, #2; \
270
271#define WPRECALC_32_79_6(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
272 vshr.u32 tmp0, W, #30; \
273
274#define WPRECALC_32_79_7(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
275 vorr W, tmp0, tmp1; \
276
277#define WPRECALC_32_79_8(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
278 vadd.u32 tmp0, W, curK; \
279
280#define WPRECALC_32_79_9(i,W,W_m04,W_m08,W_m12,W_m16,W_m20,W_m24,W_m28) \
281 vst1.32 {tmp0}, [RWK];
282
283
284/*
285 * Transform nblks*64 bytes (nblks*16 32-bit words) at DATA.
286 *
287 * unsigned int
288 * sha1_transform_neon (void *ctx, const unsigned char *data,
289 * unsigned int nblks)
290 */
291.align 3
292ENTRY(sha1_transform_neon)
293 /* input:
294 * r0: ctx, CTX
295 * r1: data (64*nblks bytes)
296 * r2: nblks
297 */
298
299 cmp RNBLKS, #0;
300 beq .Ldo_nothing;
301
302 push {r4-r12, lr};
303 /*vpush {q4-q7};*/
304
305 adr RT3, .LK_VEC;
306
307 mov ROLDSTACK, sp;
308
309 /* Align stack. */
310 sub RT0, sp, #(16*4);
311 and RT0, #(~(16-1));
312 mov sp, RT0;
313
314 vld1.32 {qK1-qK2}, [RT3]!; /* Load K1,K2 */
315
316 /* Get the values of the chaining variables. */
317 ldm RSTATE, {_a-_e};
318
319 vld1.32 {qK3-qK4}, [RT3]; /* Load K3,K4 */
320
321#undef curK
322#define curK qK1
323 /* Precalc 0-15. */
324 W_PRECALC_00_15();
325
326.Loop:
327 /* Transform 0-15 + Precalc 16-31. */
328 _R( _a, _b, _c, _d, _e, F1, 0,
329 WPRECALC_16_31_0, WPRECALC_16_31_1, WPRECALC_16_31_2, 16,
330 W4, W5, W6, W7, W0, _, _, _ );
331 _R( _e, _a, _b, _c, _d, F1, 1,
332 WPRECALC_16_31_3, WPRECALC_16_31_4, WPRECALC_16_31_5, 16,
333 W4, W5, W6, W7, W0, _, _, _ );
334 _R( _d, _e, _a, _b, _c, F1, 2,
335 WPRECALC_16_31_6, WPRECALC_16_31_7, WPRECALC_16_31_8, 16,
336 W4, W5, W6, W7, W0, _, _, _ );
337 _R( _c, _d, _e, _a, _b, F1, 3,
338 WPRECALC_16_31_9, WPRECALC_16_31_10,WPRECALC_16_31_11,16,
339 W4, W5, W6, W7, W0, _, _, _ );
340
341#undef curK
342#define curK qK2
343 _R( _b, _c, _d, _e, _a, F1, 4,
344 WPRECALC_16_31_0, WPRECALC_16_31_1, WPRECALC_16_31_2, 20,
345 W3, W4, W5, W6, W7, _, _, _ );
346 _R( _a, _b, _c, _d, _e, F1, 5,
347 WPRECALC_16_31_3, WPRECALC_16_31_4, WPRECALC_16_31_5, 20,
348 W3, W4, W5, W6, W7, _, _, _ );
349 _R( _e, _a, _b, _c, _d, F1, 6,
350 WPRECALC_16_31_6, WPRECALC_16_31_7, WPRECALC_16_31_8, 20,
351 W3, W4, W5, W6, W7, _, _, _ );
352 _R( _d, _e, _a, _b, _c, F1, 7,
353 WPRECALC_16_31_9, WPRECALC_16_31_10,WPRECALC_16_31_11,20,
354 W3, W4, W5, W6, W7, _, _, _ );
355
356 _R( _c, _d, _e, _a, _b, F1, 8,
357 WPRECALC_16_31_0, WPRECALC_16_31_1, WPRECALC_16_31_2, 24,
358 W2, W3, W4, W5, W6, _, _, _ );
359 _R( _b, _c, _d, _e, _a, F1, 9,
360 WPRECALC_16_31_3, WPRECALC_16_31_4, WPRECALC_16_31_5, 24,
361 W2, W3, W4, W5, W6, _, _, _ );
362 _R( _a, _b, _c, _d, _e, F1, 10,
363 WPRECALC_16_31_6, WPRECALC_16_31_7, WPRECALC_16_31_8, 24,
364 W2, W3, W4, W5, W6, _, _, _ );
365 _R( _e, _a, _b, _c, _d, F1, 11,
366 WPRECALC_16_31_9, WPRECALC_16_31_10,WPRECALC_16_31_11,24,
367 W2, W3, W4, W5, W6, _, _, _ );
368
369 _R( _d, _e, _a, _b, _c, F1, 12,
370 WPRECALC_16_31_0, WPRECALC_16_31_1, WPRECALC_16_31_2, 28,
371 W1, W2, W3, W4, W5, _, _, _ );
372 _R( _c, _d, _e, _a, _b, F1, 13,
373 WPRECALC_16_31_3, WPRECALC_16_31_4, WPRECALC_16_31_5, 28,
374 W1, W2, W3, W4, W5, _, _, _ );
375 _R( _b, _c, _d, _e, _a, F1, 14,
376 WPRECALC_16_31_6, WPRECALC_16_31_7, WPRECALC_16_31_8, 28,
377 W1, W2, W3, W4, W5, _, _, _ );
378 _R( _a, _b, _c, _d, _e, F1, 15,
379 WPRECALC_16_31_9, WPRECALC_16_31_10,WPRECALC_16_31_11,28,
380 W1, W2, W3, W4, W5, _, _, _ );
381
382 /* Transform 16-63 + Precalc 32-79. */
383 _R( _e, _a, _b, _c, _d, F1, 16,
384 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 32,
385 W0, W1, W2, W3, W4, W5, W6, W7);
386 _R( _d, _e, _a, _b, _c, F1, 17,
387 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 32,
388 W0, W1, W2, W3, W4, W5, W6, W7);
389 _R( _c, _d, _e, _a, _b, F1, 18,
390 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 32,
391 W0, W1, W2, W3, W4, W5, W6, W7);
392 _R( _b, _c, _d, _e, _a, F1, 19,
393 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 32,
394 W0, W1, W2, W3, W4, W5, W6, W7);
395
396 _R( _a, _b, _c, _d, _e, F2, 20,
397 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 36,
398 W7, W0, W1, W2, W3, W4, W5, W6);
399 _R( _e, _a, _b, _c, _d, F2, 21,
400 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 36,
401 W7, W0, W1, W2, W3, W4, W5, W6);
402 _R( _d, _e, _a, _b, _c, F2, 22,
403 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 36,
404 W7, W0, W1, W2, W3, W4, W5, W6);
405 _R( _c, _d, _e, _a, _b, F2, 23,
406 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 36,
407 W7, W0, W1, W2, W3, W4, W5, W6);
408
409#undef curK
410#define curK qK3
411 _R( _b, _c, _d, _e, _a, F2, 24,
412 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 40,
413 W6, W7, W0, W1, W2, W3, W4, W5);
414 _R( _a, _b, _c, _d, _e, F2, 25,
415 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 40,
416 W6, W7, W0, W1, W2, W3, W4, W5);
417 _R( _e, _a, _b, _c, _d, F2, 26,
418 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 40,
419 W6, W7, W0, W1, W2, W3, W4, W5);
420 _R( _d, _e, _a, _b, _c, F2, 27,
421 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 40,
422 W6, W7, W0, W1, W2, W3, W4, W5);
423
424 _R( _c, _d, _e, _a, _b, F2, 28,
425 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 44,
426 W5, W6, W7, W0, W1, W2, W3, W4);
427 _R( _b, _c, _d, _e, _a, F2, 29,
428 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 44,
429 W5, W6, W7, W0, W1, W2, W3, W4);
430 _R( _a, _b, _c, _d, _e, F2, 30,
431 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 44,
432 W5, W6, W7, W0, W1, W2, W3, W4);
433 _R( _e, _a, _b, _c, _d, F2, 31,
434 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 44,
435 W5, W6, W7, W0, W1, W2, W3, W4);
436
437 _R( _d, _e, _a, _b, _c, F2, 32,
438 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 48,
439 W4, W5, W6, W7, W0, W1, W2, W3);
440 _R( _c, _d, _e, _a, _b, F2, 33,
441 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 48,
442 W4, W5, W6, W7, W0, W1, W2, W3);
443 _R( _b, _c, _d, _e, _a, F2, 34,
444 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 48,
445 W4, W5, W6, W7, W0, W1, W2, W3);
446 _R( _a, _b, _c, _d, _e, F2, 35,
447 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 48,
448 W4, W5, W6, W7, W0, W1, W2, W3);
449
450 _R( _e, _a, _b, _c, _d, F2, 36,
451 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 52,
452 W3, W4, W5, W6, W7, W0, W1, W2);
453 _R( _d, _e, _a, _b, _c, F2, 37,
454 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 52,
455 W3, W4, W5, W6, W7, W0, W1, W2);
456 _R( _c, _d, _e, _a, _b, F2, 38,
457 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 52,
458 W3, W4, W5, W6, W7, W0, W1, W2);
459 _R( _b, _c, _d, _e, _a, F2, 39,
460 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 52,
461 W3, W4, W5, W6, W7, W0, W1, W2);
462
463 _R( _a, _b, _c, _d, _e, F3, 40,
464 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 56,
465 W2, W3, W4, W5, W6, W7, W0, W1);
466 _R( _e, _a, _b, _c, _d, F3, 41,
467 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 56,
468 W2, W3, W4, W5, W6, W7, W0, W1);
469 _R( _d, _e, _a, _b, _c, F3, 42,
470 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 56,
471 W2, W3, W4, W5, W6, W7, W0, W1);
472 _R( _c, _d, _e, _a, _b, F3, 43,
473 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 56,
474 W2, W3, W4, W5, W6, W7, W0, W1);
475
476#undef curK
477#define curK qK4
478 _R( _b, _c, _d, _e, _a, F3, 44,
479 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 60,
480 W1, W2, W3, W4, W5, W6, W7, W0);
481 _R( _a, _b, _c, _d, _e, F3, 45,
482 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 60,
483 W1, W2, W3, W4, W5, W6, W7, W0);
484 _R( _e, _a, _b, _c, _d, F3, 46,
485 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 60,
486 W1, W2, W3, W4, W5, W6, W7, W0);
487 _R( _d, _e, _a, _b, _c, F3, 47,
488 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 60,
489 W1, W2, W3, W4, W5, W6, W7, W0);
490
491 _R( _c, _d, _e, _a, _b, F3, 48,
492 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 64,
493 W0, W1, W2, W3, W4, W5, W6, W7);
494 _R( _b, _c, _d, _e, _a, F3, 49,
495 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 64,
496 W0, W1, W2, W3, W4, W5, W6, W7);
497 _R( _a, _b, _c, _d, _e, F3, 50,
498 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 64,
499 W0, W1, W2, W3, W4, W5, W6, W7);
500 _R( _e, _a, _b, _c, _d, F3, 51,
501 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 64,
502 W0, W1, W2, W3, W4, W5, W6, W7);
503
504 _R( _d, _e, _a, _b, _c, F3, 52,
505 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 68,
506 W7, W0, W1, W2, W3, W4, W5, W6);
507 _R( _c, _d, _e, _a, _b, F3, 53,
508 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 68,
509 W7, W0, W1, W2, W3, W4, W5, W6);
510 _R( _b, _c, _d, _e, _a, F3, 54,
511 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 68,
512 W7, W0, W1, W2, W3, W4, W5, W6);
513 _R( _a, _b, _c, _d, _e, F3, 55,
514 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 68,
515 W7, W0, W1, W2, W3, W4, W5, W6);
516
517 _R( _e, _a, _b, _c, _d, F3, 56,
518 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 72,
519 W6, W7, W0, W1, W2, W3, W4, W5);
520 _R( _d, _e, _a, _b, _c, F3, 57,
521 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 72,
522 W6, W7, W0, W1, W2, W3, W4, W5);
523 _R( _c, _d, _e, _a, _b, F3, 58,
524 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 72,
525 W6, W7, W0, W1, W2, W3, W4, W5);
526 _R( _b, _c, _d, _e, _a, F3, 59,
527 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 72,
528 W6, W7, W0, W1, W2, W3, W4, W5);
529
530 subs RNBLKS, #1;
531
532 _R( _a, _b, _c, _d, _e, F4, 60,
533 WPRECALC_32_79_0, WPRECALC_32_79_1, WPRECALC_32_79_2, 76,
534 W5, W6, W7, W0, W1, W2, W3, W4);
535 _R( _e, _a, _b, _c, _d, F4, 61,
536 WPRECALC_32_79_3, WPRECALC_32_79_4, WPRECALC_32_79_5, 76,
537 W5, W6, W7, W0, W1, W2, W3, W4);
538 _R( _d, _e, _a, _b, _c, F4, 62,
539 WPRECALC_32_79_6, dummy, WPRECALC_32_79_7, 76,
540 W5, W6, W7, W0, W1, W2, W3, W4);
541 _R( _c, _d, _e, _a, _b, F4, 63,
542 WPRECALC_32_79_8, dummy, WPRECALC_32_79_9, 76,
543 W5, W6, W7, W0, W1, W2, W3, W4);
544
545 beq .Lend;
546
547 /* Transform 64-79 + Precalc 0-15 of next block. */
548#undef curK
549#define curK qK1
550 _R( _b, _c, _d, _e, _a, F4, 64,
551 WPRECALC_00_15_0, dummy, dummy, _, _, _, _, _, _, _, _, _ );
552 _R( _a, _b, _c, _d, _e, F4, 65,
553 WPRECALC_00_15_1, dummy, dummy, _, _, _, _, _, _, _, _, _ );
554 _R( _e, _a, _b, _c, _d, F4, 66,
555 WPRECALC_00_15_2, dummy, dummy, _, _, _, _, _, _, _, _, _ );
556 _R( _d, _e, _a, _b, _c, F4, 67,
557 WPRECALC_00_15_3, dummy, dummy, _, _, _, _, _, _, _, _, _ );
558
559 _R( _c, _d, _e, _a, _b, F4, 68,
560 dummy, dummy, dummy, _, _, _, _, _, _, _, _, _ );
561 _R( _b, _c, _d, _e, _a, F4, 69,
562 dummy, dummy, dummy, _, _, _, _, _, _, _, _, _ );
563 _R( _a, _b, _c, _d, _e, F4, 70,
564 WPRECALC_00_15_4, dummy, dummy, _, _, _, _, _, _, _, _, _ );
565 _R( _e, _a, _b, _c, _d, F4, 71,
566 WPRECALC_00_15_5, dummy, dummy, _, _, _, _, _, _, _, _, _ );
567
568 _R( _d, _e, _a, _b, _c, F4, 72,
569 dummy, dummy, dummy, _, _, _, _, _, _, _, _, _ );
570 _R( _c, _d, _e, _a, _b, F4, 73,
571 dummy, dummy, dummy, _, _, _, _, _, _, _, _, _ );
572 _R( _b, _c, _d, _e, _a, F4, 74,
573 WPRECALC_00_15_6, dummy, dummy, _, _, _, _, _, _, _, _, _ );
574 _R( _a, _b, _c, _d, _e, F4, 75,
575 WPRECALC_00_15_7, dummy, dummy, _, _, _, _, _, _, _, _, _ );
576
577 _R( _e, _a, _b, _c, _d, F4, 76,
578 WPRECALC_00_15_8, dummy, dummy, _, _, _, _, _, _, _, _, _ );
579 _R( _d, _e, _a, _b, _c, F4, 77,
580 WPRECALC_00_15_9, dummy, dummy, _, _, _, _, _, _, _, _, _ );
581 _R( _c, _d, _e, _a, _b, F4, 78,
582 WPRECALC_00_15_10, dummy, dummy, _, _, _, _, _, _, _, _, _ );
583 _R( _b, _c, _d, _e, _a, F4, 79,
584 WPRECALC_00_15_11, dummy, WPRECALC_00_15_12, _, _, _, _, _, _, _, _, _ );
585
586 /* Update the chaining variables. */
587 ldm RSTATE, {RT0-RT3};
588 add _a, RT0;
589 ldr RT0, [RSTATE, #state_h4];
590 add _b, RT1;
591 add _c, RT2;
592 add _d, RT3;
593 add _e, RT0;
594 stm RSTATE, {_a-_e};
595
596 b .Loop;
597
598.Lend:
599 /* Transform 64-79 */
600 R( _b, _c, _d, _e, _a, F4, 64 );
601 R( _a, _b, _c, _d, _e, F4, 65 );
602 R( _e, _a, _b, _c, _d, F4, 66 );
603 R( _d, _e, _a, _b, _c, F4, 67 );
604 R( _c, _d, _e, _a, _b, F4, 68 );
605 R( _b, _c, _d, _e, _a, F4, 69 );
606 R( _a, _b, _c, _d, _e, F4, 70 );
607 R( _e, _a, _b, _c, _d, F4, 71 );
608 R( _d, _e, _a, _b, _c, F4, 72 );
609 R( _c, _d, _e, _a, _b, F4, 73 );
610 R( _b, _c, _d, _e, _a, F4, 74 );
611 R( _a, _b, _c, _d, _e, F4, 75 );
612 R( _e, _a, _b, _c, _d, F4, 76 );
613 R( _d, _e, _a, _b, _c, F4, 77 );
614 R( _c, _d, _e, _a, _b, F4, 78 );
615 R( _b, _c, _d, _e, _a, F4, 79 );
616
617 mov sp, ROLDSTACK;
618
619 /* Update the chaining variables. */
620 ldm RSTATE, {RT0-RT3};
621 add _a, RT0;
622 ldr RT0, [RSTATE, #state_h4];
623 add _b, RT1;
624 add _c, RT2;
625 add _d, RT3;
626 /*vpop {q4-q7};*/
627 add _e, RT0;
628 stm RSTATE, {_a-_e};
629
630 pop {r4-r12, pc};
631
632.Ldo_nothing:
633 bx lr
634ENDPROC(sha1_transform_neon)
diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c
index 76cd976230bc..84f2a756588b 100644
--- a/arch/arm/crypto/sha1_glue.c
+++ b/arch/arm/crypto/sha1_glue.c
@@ -23,32 +23,27 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <crypto/sha.h> 24#include <crypto/sha.h>
25#include <asm/byteorder.h> 25#include <asm/byteorder.h>
26#include <asm/crypto/sha1.h>
26 27
27struct SHA1_CTX {
28 uint32_t h0,h1,h2,h3,h4;
29 u64 count;
30 u8 data[SHA1_BLOCK_SIZE];
31};
32 28
33asmlinkage void sha1_block_data_order(struct SHA1_CTX *digest, 29asmlinkage void sha1_block_data_order(u32 *digest,
34 const unsigned char *data, unsigned int rounds); 30 const unsigned char *data, unsigned int rounds);
35 31
36 32
37static int sha1_init(struct shash_desc *desc) 33static int sha1_init(struct shash_desc *desc)
38{ 34{
39 struct SHA1_CTX *sctx = shash_desc_ctx(desc); 35 struct sha1_state *sctx = shash_desc_ctx(desc);
40 memset(sctx, 0, sizeof(*sctx)); 36
41 sctx->h0 = SHA1_H0; 37 *sctx = (struct sha1_state){
42 sctx->h1 = SHA1_H1; 38 .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },
43 sctx->h2 = SHA1_H2; 39 };
44 sctx->h3 = SHA1_H3; 40
45 sctx->h4 = SHA1_H4;
46 return 0; 41 return 0;
47} 42}
48 43
49 44
50static int __sha1_update(struct SHA1_CTX *sctx, const u8 *data, 45static int __sha1_update(struct sha1_state *sctx, const u8 *data,
51 unsigned int len, unsigned int partial) 46 unsigned int len, unsigned int partial)
52{ 47{
53 unsigned int done = 0; 48 unsigned int done = 0;
54 49
@@ -56,43 +51,44 @@ static int __sha1_update(struct SHA1_CTX *sctx, const u8 *data,
56 51
57 if (partial) { 52 if (partial) {
58 done = SHA1_BLOCK_SIZE - partial; 53 done = SHA1_BLOCK_SIZE - partial;
59 memcpy(sctx->data + partial, data, done); 54 memcpy(sctx->buffer + partial, data, done);
60 sha1_block_data_order(sctx, sctx->data, 1); 55 sha1_block_data_order(sctx->state, sctx->buffer, 1);
61 } 56 }
62 57
63 if (len - done >= SHA1_BLOCK_SIZE) { 58 if (len - done >= SHA1_BLOCK_SIZE) {
64 const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE; 59 const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE;
65 sha1_block_data_order(sctx, data + done, rounds); 60 sha1_block_data_order(sctx->state, data + done, rounds);
66 done += rounds * SHA1_BLOCK_SIZE; 61 done += rounds * SHA1_BLOCK_SIZE;
67 } 62 }
68 63
69 memcpy(sctx->data, data + done, len - done); 64 memcpy(sctx->buffer, data + done, len - done);
70 return 0; 65 return 0;
71} 66}
72 67
73 68
74static int sha1_update(struct shash_desc *desc, const u8 *data, 69int sha1_update_arm(struct shash_desc *desc, const u8 *data,
75 unsigned int len) 70 unsigned int len)
76{ 71{
77 struct SHA1_CTX *sctx = shash_desc_ctx(desc); 72 struct sha1_state *sctx = shash_desc_ctx(desc);
78 unsigned int partial = sctx->count % SHA1_BLOCK_SIZE; 73 unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
79 int res; 74 int res;
80 75
81 /* Handle the fast case right here */ 76 /* Handle the fast case right here */
82 if (partial + len < SHA1_BLOCK_SIZE) { 77 if (partial + len < SHA1_BLOCK_SIZE) {
83 sctx->count += len; 78 sctx->count += len;
84 memcpy(sctx->data + partial, data, len); 79 memcpy(sctx->buffer + partial, data, len);
85 return 0; 80 return 0;
86 } 81 }
87 res = __sha1_update(sctx, data, len, partial); 82 res = __sha1_update(sctx, data, len, partial);
88 return res; 83 return res;
89} 84}
85EXPORT_SYMBOL_GPL(sha1_update_arm);
90 86
91 87
92/* Add padding and return the message digest. */ 88/* Add padding and return the message digest. */
93static int sha1_final(struct shash_desc *desc, u8 *out) 89static int sha1_final(struct shash_desc *desc, u8 *out)
94{ 90{
95 struct SHA1_CTX *sctx = shash_desc_ctx(desc); 91 struct sha1_state *sctx = shash_desc_ctx(desc);
96 unsigned int i, index, padlen; 92 unsigned int i, index, padlen;
97 __be32 *dst = (__be32 *)out; 93 __be32 *dst = (__be32 *)out;
98 __be64 bits; 94 __be64 bits;
@@ -106,7 +102,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
106 /* We need to fill a whole block for __sha1_update() */ 102 /* We need to fill a whole block for __sha1_update() */
107 if (padlen <= 56) { 103 if (padlen <= 56) {
108 sctx->count += padlen; 104 sctx->count += padlen;
109 memcpy(sctx->data + index, padding, padlen); 105 memcpy(sctx->buffer + index, padding, padlen);
110 } else { 106 } else {
111 __sha1_update(sctx, padding, padlen, index); 107 __sha1_update(sctx, padding, padlen, index);
112 } 108 }
@@ -114,7 +110,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
114 110
115 /* Store state in digest */ 111 /* Store state in digest */
116 for (i = 0; i < 5; i++) 112 for (i = 0; i < 5; i++)
117 dst[i] = cpu_to_be32(((u32 *)sctx)[i]); 113 dst[i] = cpu_to_be32(sctx->state[i]);
118 114
119 /* Wipe context */ 115 /* Wipe context */
120 memset(sctx, 0, sizeof(*sctx)); 116 memset(sctx, 0, sizeof(*sctx));
@@ -124,7 +120,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
124 120
125static int sha1_export(struct shash_desc *desc, void *out) 121static int sha1_export(struct shash_desc *desc, void *out)
126{ 122{
127 struct SHA1_CTX *sctx = shash_desc_ctx(desc); 123 struct sha1_state *sctx = shash_desc_ctx(desc);
128 memcpy(out, sctx, sizeof(*sctx)); 124 memcpy(out, sctx, sizeof(*sctx));
129 return 0; 125 return 0;
130} 126}
@@ -132,7 +128,7 @@ static int sha1_export(struct shash_desc *desc, void *out)
132 128
133static int sha1_import(struct shash_desc *desc, const void *in) 129static int sha1_import(struct shash_desc *desc, const void *in)
134{ 130{
135 struct SHA1_CTX *sctx = shash_desc_ctx(desc); 131 struct sha1_state *sctx = shash_desc_ctx(desc);
136 memcpy(sctx, in, sizeof(*sctx)); 132 memcpy(sctx, in, sizeof(*sctx));
137 return 0; 133 return 0;
138} 134}
@@ -141,12 +137,12 @@ static int sha1_import(struct shash_desc *desc, const void *in)
141static struct shash_alg alg = { 137static struct shash_alg alg = {
142 .digestsize = SHA1_DIGEST_SIZE, 138 .digestsize = SHA1_DIGEST_SIZE,
143 .init = sha1_init, 139 .init = sha1_init,
144 .update = sha1_update, 140 .update = sha1_update_arm,
145 .final = sha1_final, 141 .final = sha1_final,
146 .export = sha1_export, 142 .export = sha1_export,
147 .import = sha1_import, 143 .import = sha1_import,
148 .descsize = sizeof(struct SHA1_CTX), 144 .descsize = sizeof(struct sha1_state),
149 .statesize = sizeof(struct SHA1_CTX), 145 .statesize = sizeof(struct sha1_state),
150 .base = { 146 .base = {
151 .cra_name = "sha1", 147 .cra_name = "sha1",
152 .cra_driver_name= "sha1-asm", 148 .cra_driver_name= "sha1-asm",
diff --git a/arch/arm/crypto/sha1_neon_glue.c b/arch/arm/crypto/sha1_neon_glue.c
new file mode 100644
index 000000000000..6f1b411b1d55
--- /dev/null
+++ b/arch/arm/crypto/sha1_neon_glue.c
@@ -0,0 +1,197 @@
1/*
2 * Glue code for the SHA1 Secure Hash Algorithm assembler implementation using
3 * ARM NEON instructions.
4 *
5 * Copyright © 2014 Jussi Kivilinna <jussi.kivilinna@iki.fi>
6 *
7 * This file is based on sha1_generic.c and sha1_ssse3_glue.c:
8 * Copyright (c) Alan Smithee.
9 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
10 * Copyright (c) Jean-Francois Dive <jef@linuxbe.org>
11 * Copyright (c) Mathias Krause <minipli@googlemail.com>
12 * Copyright (c) Chandramouli Narayanan <mouli@linux.intel.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option)
17 * any later version.
18 *
19 */
20
21#include <crypto/internal/hash.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/mm.h>
25#include <linux/cryptohash.h>
26#include <linux/types.h>
27#include <crypto/sha.h>
28#include <asm/byteorder.h>
29#include <asm/neon.h>
30#include <asm/simd.h>
31#include <asm/crypto/sha1.h>
32
33
34asmlinkage void sha1_transform_neon(void *state_h, const char *data,
35 unsigned int rounds);
36
37
38static int sha1_neon_init(struct shash_desc *desc)
39{
40 struct sha1_state *sctx = shash_desc_ctx(desc);
41
42 *sctx = (struct sha1_state){
43 .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },
44 };
45
46 return 0;
47}
48
49static int __sha1_neon_update(struct shash_desc *desc, const u8 *data,
50 unsigned int len, unsigned int partial)
51{
52 struct sha1_state *sctx = shash_desc_ctx(desc);
53 unsigned int done = 0;
54
55 sctx->count += len;
56
57 if (partial) {
58 done = SHA1_BLOCK_SIZE - partial;
59 memcpy(sctx->buffer + partial, data, done);
60 sha1_transform_neon(sctx->state, sctx->buffer, 1);
61 }
62
63 if (len - done >= SHA1_BLOCK_SIZE) {
64 const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE;
65
66 sha1_transform_neon(sctx->state, data + done, rounds);
67 done += rounds * SHA1_BLOCK_SIZE;
68 }
69
70 memcpy(sctx->buffer, data + done, len - done);
71
72 return 0;
73}
74
75static int sha1_neon_update(struct shash_desc *desc, const u8 *data,
76 unsigned int len)
77{
78 struct sha1_state *sctx = shash_desc_ctx(desc);
79 unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
80 int res;
81
82 /* Handle the fast case right here */
83 if (partial + len < SHA1_BLOCK_SIZE) {
84 sctx->count += len;
85 memcpy(sctx->buffer + partial, data, len);
86
87 return 0;
88 }
89
90 if (!may_use_simd()) {
91 res = sha1_update_arm(desc, data, len);
92 } else {
93 kernel_neon_begin();
94 res = __sha1_neon_update(desc, data, len, partial);
95 kernel_neon_end();
96 }
97
98 return res;
99}
100
101
102/* Add padding and return the message digest. */
103static int sha1_neon_final(struct shash_desc *desc, u8 *out)
104{
105 struct sha1_state *sctx = shash_desc_ctx(desc);
106 unsigned int i, index, padlen;
107 __be32 *dst = (__be32 *)out;
108 __be64 bits;
109 static const u8 padding[SHA1_BLOCK_SIZE] = { 0x80, };
110
111 bits = cpu_to_be64(sctx->count << 3);
112
113 /* Pad out to 56 mod 64 and append length */
114 index = sctx->count % SHA1_BLOCK_SIZE;
115 padlen = (index < 56) ? (56 - index) : ((SHA1_BLOCK_SIZE+56) - index);
116 if (!may_use_simd()) {
117 sha1_update_arm(desc, padding, padlen);
118 sha1_update_arm(desc, (const u8 *)&bits, sizeof(bits));
119 } else {
120 kernel_neon_begin();
121 /* We need to fill a whole block for __sha1_neon_update() */
122 if (padlen <= 56) {
123 sctx->count += padlen;
124 memcpy(sctx->buffer + index, padding, padlen);
125 } else {
126 __sha1_neon_update(desc, padding, padlen, index);
127 }
128 __sha1_neon_update(desc, (const u8 *)&bits, sizeof(bits), 56);
129 kernel_neon_end();
130 }
131
132 /* Store state in digest */
133 for (i = 0; i < 5; i++)
134 dst[i] = cpu_to_be32(sctx->state[i]);
135
136 /* Wipe context */
137 memset(sctx, 0, sizeof(*sctx));
138
139 return 0;
140}
141
142static int sha1_neon_export(struct shash_desc *desc, void *out)
143{
144 struct sha1_state *sctx = shash_desc_ctx(desc);
145
146 memcpy(out, sctx, sizeof(*sctx));
147
148 return 0;
149}
150
151static int sha1_neon_import(struct shash_desc *desc, const void *in)
152{
153 struct sha1_state *sctx = shash_desc_ctx(desc);
154
155 memcpy(sctx, in, sizeof(*sctx));
156
157 return 0;
158}
159
160static struct shash_alg alg = {
161 .digestsize = SHA1_DIGEST_SIZE,
162 .init = sha1_neon_init,
163 .update = sha1_neon_update,
164 .final = sha1_neon_final,
165 .export = sha1_neon_export,
166 .import = sha1_neon_import,
167 .descsize = sizeof(struct sha1_state),
168 .statesize = sizeof(struct sha1_state),
169 .base = {
170 .cra_name = "sha1",
171 .cra_driver_name = "sha1-neon",
172 .cra_priority = 250,
173 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
174 .cra_blocksize = SHA1_BLOCK_SIZE,
175 .cra_module = THIS_MODULE,
176 }
177};
178
179static int __init sha1_neon_mod_init(void)
180{
181 if (!cpu_has_neon())
182 return -ENODEV;
183
184 return crypto_register_shash(&alg);
185}
186
187static void __exit sha1_neon_mod_fini(void)
188{
189 crypto_unregister_shash(&alg);
190}
191
192module_init(sha1_neon_mod_init);
193module_exit(sha1_neon_mod_fini);
194
195MODULE_LICENSE("GPL");
196MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, NEON accelerated");
197MODULE_ALIAS("sha1");
diff --git a/arch/arm/crypto/sha512-armv7-neon.S b/arch/arm/crypto/sha512-armv7-neon.S
new file mode 100644
index 000000000000..fe99472e507c
--- /dev/null
+++ b/arch/arm/crypto/sha512-armv7-neon.S
@@ -0,0 +1,455 @@
1/* sha512-armv7-neon.S - ARM/NEON assembly implementation of SHA-512 transform
2 *
3 * Copyright © 2013-2014 Jussi Kivilinna <jussi.kivilinna@iki.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 */
10
11#include <linux/linkage.h>
12
13
14.syntax unified
15.code 32
16.fpu neon
17
18.text
19
20/* structure of SHA512_CONTEXT */
21#define hd_a 0
22#define hd_b ((hd_a) + 8)
23#define hd_c ((hd_b) + 8)
24#define hd_d ((hd_c) + 8)
25#define hd_e ((hd_d) + 8)
26#define hd_f ((hd_e) + 8)
27#define hd_g ((hd_f) + 8)
28
29/* register macros */
30#define RK %r2
31
32#define RA d0
33#define RB d1
34#define RC d2
35#define RD d3
36#define RE d4
37#define RF d5
38#define RG d6
39#define RH d7
40
41#define RT0 d8
42#define RT1 d9
43#define RT2 d10
44#define RT3 d11
45#define RT4 d12
46#define RT5 d13
47#define RT6 d14
48#define RT7 d15
49
50#define RT01q q4
51#define RT23q q5
52#define RT45q q6
53#define RT67q q7
54
55#define RW0 d16
56#define RW1 d17
57#define RW2 d18
58#define RW3 d19
59#define RW4 d20
60#define RW5 d21
61#define RW6 d22
62#define RW7 d23
63#define RW8 d24
64#define RW9 d25
65#define RW10 d26
66#define RW11 d27
67#define RW12 d28
68#define RW13 d29
69#define RW14 d30
70#define RW15 d31
71
72#define RW01q q8
73#define RW23q q9
74#define RW45q q10
75#define RW67q q11
76#define RW89q q12
77#define RW1011q q13
78#define RW1213q q14
79#define RW1415q q15
80
81/***********************************************************************
82 * ARM assembly implementation of sha512 transform
83 ***********************************************************************/
84#define rounds2_0_63(ra, rb, rc, rd, re, rf, rg, rh, rw0, rw1, rw01q, rw2, \
85 rw23q, rw1415q, rw9, rw10, interleave_op, arg1) \
86 /* t1 = h + Sum1 (e) + Ch (e, f, g) + k[t] + w[t]; */ \
87 vshr.u64 RT2, re, #14; \
88 vshl.u64 RT3, re, #64 - 14; \
89 interleave_op(arg1); \
90 vshr.u64 RT4, re, #18; \
91 vshl.u64 RT5, re, #64 - 18; \
92 vld1.64 {RT0}, [RK]!; \
93 veor.64 RT23q, RT23q, RT45q; \
94 vshr.u64 RT4, re, #41; \
95 vshl.u64 RT5, re, #64 - 41; \
96 vadd.u64 RT0, RT0, rw0; \
97 veor.64 RT23q, RT23q, RT45q; \
98 vmov.64 RT7, re; \
99 veor.64 RT1, RT2, RT3; \
100 vbsl.64 RT7, rf, rg; \
101 \
102 vadd.u64 RT1, RT1, rh; \
103 vshr.u64 RT2, ra, #28; \
104 vshl.u64 RT3, ra, #64 - 28; \
105 vadd.u64 RT1, RT1, RT0; \
106 vshr.u64 RT4, ra, #34; \
107 vshl.u64 RT5, ra, #64 - 34; \
108 vadd.u64 RT1, RT1, RT7; \
109 \
110 /* h = Sum0 (a) + Maj (a, b, c); */ \
111 veor.64 RT23q, RT23q, RT45q; \
112 vshr.u64 RT4, ra, #39; \
113 vshl.u64 RT5, ra, #64 - 39; \
114 veor.64 RT0, ra, rb; \
115 veor.64 RT23q, RT23q, RT45q; \
116 vbsl.64 RT0, rc, rb; \
117 vadd.u64 rd, rd, RT1; /* d+=t1; */ \
118 veor.64 rh, RT2, RT3; \
119 \
120 /* t1 = g + Sum1 (d) + Ch (d, e, f) + k[t] + w[t]; */ \
121 vshr.u64 RT2, rd, #14; \
122 vshl.u64 RT3, rd, #64 - 14; \
123 vadd.u64 rh, rh, RT0; \
124 vshr.u64 RT4, rd, #18; \
125 vshl.u64 RT5, rd, #64 - 18; \
126 vadd.u64 rh, rh, RT1; /* h+=t1; */ \
127 vld1.64 {RT0}, [RK]!; \
128 veor.64 RT23q, RT23q, RT45q; \
129 vshr.u64 RT4, rd, #41; \
130 vshl.u64 RT5, rd, #64 - 41; \
131 vadd.u64 RT0, RT0, rw1; \
132 veor.64 RT23q, RT23q, RT45q; \
133 vmov.64 RT7, rd; \
134 veor.64 RT1, RT2, RT3; \
135 vbsl.64 RT7, re, rf; \
136 \
137 vadd.u64 RT1, RT1, rg; \
138 vshr.u64 RT2, rh, #28; \
139 vshl.u64 RT3, rh, #64 - 28; \
140 vadd.u64 RT1, RT1, RT0; \
141 vshr.u64 RT4, rh, #34; \
142 vshl.u64 RT5, rh, #64 - 34; \
143 vadd.u64 RT1, RT1, RT7; \
144 \
145 /* g = Sum0 (h) + Maj (h, a, b); */ \
146 veor.64 RT23q, RT23q, RT45q; \
147 vshr.u64 RT4, rh, #39; \
148 vshl.u64 RT5, rh, #64 - 39; \
149 veor.64 RT0, rh, ra; \
150 veor.64 RT23q, RT23q, RT45q; \
151 vbsl.64 RT0, rb, ra; \
152 vadd.u64 rc, rc, RT1; /* c+=t1; */ \
153 veor.64 rg, RT2, RT3; \
154 \
155 /* w[0] += S1 (w[14]) + w[9] + S0 (w[1]); */ \
156 /* w[1] += S1 (w[15]) + w[10] + S0 (w[2]); */ \
157 \
158 /**** S0(w[1:2]) */ \
159 \
160 /* w[0:1] += w[9:10] */ \
161 /* RT23q = rw1:rw2 */ \
162 vext.u64 RT23q, rw01q, rw23q, #1; \
163 vadd.u64 rw0, rw9; \
164 vadd.u64 rg, rg, RT0; \
165 vadd.u64 rw1, rw10;\
166 vadd.u64 rg, rg, RT1; /* g+=t1; */ \
167 \
168 vshr.u64 RT45q, RT23q, #1; \
169 vshl.u64 RT67q, RT23q, #64 - 1; \
170 vshr.u64 RT01q, RT23q, #8; \
171 veor.u64 RT45q, RT45q, RT67q; \
172 vshl.u64 RT67q, RT23q, #64 - 8; \
173 veor.u64 RT45q, RT45q, RT01q; \
174 vshr.u64 RT01q, RT23q, #7; \
175 veor.u64 RT45q, RT45q, RT67q; \
176 \
177 /**** S1(w[14:15]) */ \
178 vshr.u64 RT23q, rw1415q, #6; \
179 veor.u64 RT01q, RT01q, RT45q; \
180 vshr.u64 RT45q, rw1415q, #19; \
181 vshl.u64 RT67q, rw1415q, #64 - 19; \
182 veor.u64 RT23q, RT23q, RT45q; \
183 vshr.u64 RT45q, rw1415q, #61; \
184 veor.u64 RT23q, RT23q, RT67q; \
185 vshl.u64 RT67q, rw1415q, #64 - 61; \
186 veor.u64 RT23q, RT23q, RT45q; \
187 vadd.u64 rw01q, RT01q; /* w[0:1] += S(w[1:2]) */ \
188 veor.u64 RT01q, RT23q, RT67q;
189#define vadd_RT01q(rw01q) \
190 /* w[0:1] += S(w[14:15]) */ \
191 vadd.u64 rw01q, RT01q;
192
193#define dummy(_) /*_*/
194
195#define rounds2_64_79(ra, rb, rc, rd, re, rf, rg, rh, rw0, rw1, \
196 interleave_op1, arg1, interleave_op2, arg2) \
197 /* t1 = h + Sum1 (e) + Ch (e, f, g) + k[t] + w[t]; */ \
198 vshr.u64 RT2, re, #14; \
199 vshl.u64 RT3, re, #64 - 14; \
200 interleave_op1(arg1); \
201 vshr.u64 RT4, re, #18; \
202 vshl.u64 RT5, re, #64 - 18; \
203 interleave_op2(arg2); \
204 vld1.64 {RT0}, [RK]!; \
205 veor.64 RT23q, RT23q, RT45q; \
206 vshr.u64 RT4, re, #41; \
207 vshl.u64 RT5, re, #64 - 41; \
208 vadd.u64 RT0, RT0, rw0; \
209 veor.64 RT23q, RT23q, RT45q; \
210 vmov.64 RT7, re; \
211 veor.64 RT1, RT2, RT3; \
212 vbsl.64 RT7, rf, rg; \
213 \
214 vadd.u64 RT1, RT1, rh; \
215 vshr.u64 RT2, ra, #28; \
216 vshl.u64 RT3, ra, #64 - 28; \
217 vadd.u64 RT1, RT1, RT0; \
218 vshr.u64 RT4, ra, #34; \
219 vshl.u64 RT5, ra, #64 - 34; \
220 vadd.u64 RT1, RT1, RT7; \
221 \
222 /* h = Sum0 (a) + Maj (a, b, c); */ \
223 veor.64 RT23q, RT23q, RT45q; \
224 vshr.u64 RT4, ra, #39; \
225 vshl.u64 RT5, ra, #64 - 39; \
226 veor.64 RT0, ra, rb; \
227 veor.64 RT23q, RT23q, RT45q; \
228 vbsl.64 RT0, rc, rb; \
229 vadd.u64 rd, rd, RT1; /* d+=t1; */ \
230 veor.64 rh, RT2, RT3; \
231 \
232 /* t1 = g + Sum1 (d) + Ch (d, e, f) + k[t] + w[t]; */ \
233 vshr.u64 RT2, rd, #14; \
234 vshl.u64 RT3, rd, #64 - 14; \
235 vadd.u64 rh, rh, RT0; \
236 vshr.u64 RT4, rd, #18; \
237 vshl.u64 RT5, rd, #64 - 18; \
238 vadd.u64 rh, rh, RT1; /* h+=t1; */ \
239 vld1.64 {RT0}, [RK]!; \
240 veor.64 RT23q, RT23q, RT45q; \
241 vshr.u64 RT4, rd, #41; \
242 vshl.u64 RT5, rd, #64 - 41; \
243 vadd.u64 RT0, RT0, rw1; \
244 veor.64 RT23q, RT23q, RT45q; \
245 vmov.64 RT7, rd; \
246 veor.64 RT1, RT2, RT3; \
247 vbsl.64 RT7, re, rf; \
248 \
249 vadd.u64 RT1, RT1, rg; \
250 vshr.u64 RT2, rh, #28; \
251 vshl.u64 RT3, rh, #64 - 28; \
252 vadd.u64 RT1, RT1, RT0; \
253 vshr.u64 RT4, rh, #34; \
254 vshl.u64 RT5, rh, #64 - 34; \
255 vadd.u64 RT1, RT1, RT7; \
256 \
257 /* g = Sum0 (h) + Maj (h, a, b); */ \
258 veor.64 RT23q, RT23q, RT45q; \
259 vshr.u64 RT4, rh, #39; \
260 vshl.u64 RT5, rh, #64 - 39; \
261 veor.64 RT0, rh, ra; \
262 veor.64 RT23q, RT23q, RT45q; \
263 vbsl.64 RT0, rb, ra; \
264 vadd.u64 rc, rc, RT1; /* c+=t1; */ \
265 veor.64 rg, RT2, RT3;
266#define vadd_rg_RT0(rg) \
267 vadd.u64 rg, rg, RT0;
268#define vadd_rg_RT1(rg) \
269 vadd.u64 rg, rg, RT1; /* g+=t1; */
270
271.align 3
272ENTRY(sha512_transform_neon)
273 /* Input:
274 * %r0: SHA512_CONTEXT
275 * %r1: data
276 * %r2: u64 k[] constants
277 * %r3: nblks
278 */
279 push {%lr};
280
281 mov %lr, #0;
282
283 /* Load context to d0-d7 */
284 vld1.64 {RA-RD}, [%r0]!;
285 vld1.64 {RE-RH}, [%r0];
286 sub %r0, #(4*8);
287
288 /* Load input to w[16], d16-d31 */
289 /* NOTE: Assumes that on ARMv7 unaligned accesses are always allowed. */
290 vld1.64 {RW0-RW3}, [%r1]!;
291 vld1.64 {RW4-RW7}, [%r1]!;
292 vld1.64 {RW8-RW11}, [%r1]!;
293 vld1.64 {RW12-RW15}, [%r1]!;
294#ifdef __ARMEL__
295 /* byteswap */
296 vrev64.8 RW01q, RW01q;
297 vrev64.8 RW23q, RW23q;
298 vrev64.8 RW45q, RW45q;
299 vrev64.8 RW67q, RW67q;
300 vrev64.8 RW89q, RW89q;
301 vrev64.8 RW1011q, RW1011q;
302 vrev64.8 RW1213q, RW1213q;
303 vrev64.8 RW1415q, RW1415q;
304#endif
305
306 /* EABI says that d8-d15 must be preserved by callee. */
307 /*vpush {RT0-RT7};*/
308
309.Loop:
310 rounds2_0_63(RA, RB, RC, RD, RE, RF, RG, RH, RW0, RW1, RW01q, RW2,
311 RW23q, RW1415q, RW9, RW10, dummy, _);
312 b .Lenter_rounds;
313
314.Loop_rounds:
315 rounds2_0_63(RA, RB, RC, RD, RE, RF, RG, RH, RW0, RW1, RW01q, RW2,
316 RW23q, RW1415q, RW9, RW10, vadd_RT01q, RW1415q);
317.Lenter_rounds:
318 rounds2_0_63(RG, RH, RA, RB, RC, RD, RE, RF, RW2, RW3, RW23q, RW4,
319 RW45q, RW01q, RW11, RW12, vadd_RT01q, RW01q);
320 rounds2_0_63(RE, RF, RG, RH, RA, RB, RC, RD, RW4, RW5, RW45q, RW6,
321 RW67q, RW23q, RW13, RW14, vadd_RT01q, RW23q);
322 rounds2_0_63(RC, RD, RE, RF, RG, RH, RA, RB, RW6, RW7, RW67q, RW8,
323 RW89q, RW45q, RW15, RW0, vadd_RT01q, RW45q);
324 rounds2_0_63(RA, RB, RC, RD, RE, RF, RG, RH, RW8, RW9, RW89q, RW10,
325 RW1011q, RW67q, RW1, RW2, vadd_RT01q, RW67q);
326 rounds2_0_63(RG, RH, RA, RB, RC, RD, RE, RF, RW10, RW11, RW1011q, RW12,
327 RW1213q, RW89q, RW3, RW4, vadd_RT01q, RW89q);
328 add %lr, #16;
329 rounds2_0_63(RE, RF, RG, RH, RA, RB, RC, RD, RW12, RW13, RW1213q, RW14,
330 RW1415q, RW1011q, RW5, RW6, vadd_RT01q, RW1011q);
331 cmp %lr, #64;
332 rounds2_0_63(RC, RD, RE, RF, RG, RH, RA, RB, RW14, RW15, RW1415q, RW0,
333 RW01q, RW1213q, RW7, RW8, vadd_RT01q, RW1213q);
334 bne .Loop_rounds;
335
336 subs %r3, #1;
337
338 rounds2_64_79(RA, RB, RC, RD, RE, RF, RG, RH, RW0, RW1,
339 vadd_RT01q, RW1415q, dummy, _);
340 rounds2_64_79(RG, RH, RA, RB, RC, RD, RE, RF, RW2, RW3,
341 vadd_rg_RT0, RG, vadd_rg_RT1, RG);
342 beq .Lhandle_tail;
343 vld1.64 {RW0-RW3}, [%r1]!;
344 rounds2_64_79(RE, RF, RG, RH, RA, RB, RC, RD, RW4, RW5,
345 vadd_rg_RT0, RE, vadd_rg_RT1, RE);
346 rounds2_64_79(RC, RD, RE, RF, RG, RH, RA, RB, RW6, RW7,
347 vadd_rg_RT0, RC, vadd_rg_RT1, RC);
348#ifdef __ARMEL__
349 vrev64.8 RW01q, RW01q;
350 vrev64.8 RW23q, RW23q;
351#endif
352 vld1.64 {RW4-RW7}, [%r1]!;
353 rounds2_64_79(RA, RB, RC, RD, RE, RF, RG, RH, RW8, RW9,
354 vadd_rg_RT0, RA, vadd_rg_RT1, RA);
355 rounds2_64_79(RG, RH, RA, RB, RC, RD, RE, RF, RW10, RW11,
356 vadd_rg_RT0, RG, vadd_rg_RT1, RG);
357#ifdef __ARMEL__
358 vrev64.8 RW45q, RW45q;
359 vrev64.8 RW67q, RW67q;
360#endif
361 vld1.64 {RW8-RW11}, [%r1]!;
362 rounds2_64_79(RE, RF, RG, RH, RA, RB, RC, RD, RW12, RW13,
363 vadd_rg_RT0, RE, vadd_rg_RT1, RE);
364 rounds2_64_79(RC, RD, RE, RF, RG, RH, RA, RB, RW14, RW15,
365 vadd_rg_RT0, RC, vadd_rg_RT1, RC);
366#ifdef __ARMEL__
367 vrev64.8 RW89q, RW89q;
368 vrev64.8 RW1011q, RW1011q;
369#endif
370 vld1.64 {RW12-RW15}, [%r1]!;
371 vadd_rg_RT0(RA);
372 vadd_rg_RT1(RA);
373
374 /* Load context */
375 vld1.64 {RT0-RT3}, [%r0]!;
376 vld1.64 {RT4-RT7}, [%r0];
377 sub %r0, #(4*8);
378
379#ifdef __ARMEL__
380 vrev64.8 RW1213q, RW1213q;
381 vrev64.8 RW1415q, RW1415q;
382#endif
383
384 vadd.u64 RA, RT0;
385 vadd.u64 RB, RT1;
386 vadd.u64 RC, RT2;
387 vadd.u64 RD, RT3;
388 vadd.u64 RE, RT4;
389 vadd.u64 RF, RT5;
390 vadd.u64 RG, RT6;
391 vadd.u64 RH, RT7;
392
393 /* Store the first half of context */
394 vst1.64 {RA-RD}, [%r0]!;
395 sub RK, $(8*80);
396 vst1.64 {RE-RH}, [%r0]; /* Store the last half of context */
397 mov %lr, #0;
398 sub %r0, #(4*8);
399
400 b .Loop;
401
402.Lhandle_tail:
403 rounds2_64_79(RE, RF, RG, RH, RA, RB, RC, RD, RW4, RW5,
404 vadd_rg_RT0, RE, vadd_rg_RT1, RE);
405 rounds2_64_79(RC, RD, RE, RF, RG, RH, RA, RB, RW6, RW7,
406 vadd_rg_RT0, RC, vadd_rg_RT1, RC);
407 rounds2_64_79(RA, RB, RC, RD, RE, RF, RG, RH, RW8, RW9,
408 vadd_rg_RT0, RA, vadd_rg_RT1, RA);
409 rounds2_64_79(RG, RH, RA, RB, RC, RD, RE, RF, RW10, RW11,
410 vadd_rg_RT0, RG, vadd_rg_RT1, RG);
411 rounds2_64_79(RE, RF, RG, RH, RA, RB, RC, RD, RW12, RW13,
412 vadd_rg_RT0, RE, vadd_rg_RT1, RE);
413 rounds2_64_79(RC, RD, RE, RF, RG, RH, RA, RB, RW14, RW15,
414 vadd_rg_RT0, RC, vadd_rg_RT1, RC);
415
416 /* Load context to d16-d23 */
417 vld1.64 {RW0-RW3}, [%r0]!;
418 vadd_rg_RT0(RA);
419 vld1.64 {RW4-RW7}, [%r0];
420 vadd_rg_RT1(RA);
421 sub %r0, #(4*8);
422
423 vadd.u64 RA, RW0;
424 vadd.u64 RB, RW1;
425 vadd.u64 RC, RW2;
426 vadd.u64 RD, RW3;
427 vadd.u64 RE, RW4;
428 vadd.u64 RF, RW5;
429 vadd.u64 RG, RW6;
430 vadd.u64 RH, RW7;
431
432 /* Store the first half of context */
433 vst1.64 {RA-RD}, [%r0]!;
434
435 /* Clear used registers */
436 /* d16-d31 */
437 veor.u64 RW01q, RW01q;
438 veor.u64 RW23q, RW23q;
439 veor.u64 RW45q, RW45q;
440 veor.u64 RW67q, RW67q;
441 vst1.64 {RE-RH}, [%r0]; /* Store the last half of context */
442 veor.u64 RW89q, RW89q;
443 veor.u64 RW1011q, RW1011q;
444 veor.u64 RW1213q, RW1213q;
445 veor.u64 RW1415q, RW1415q;
446 /* d8-d15 */
447 /*vpop {RT0-RT7};*/
448 /* d0-d7 (q0-q3) */
449 veor.u64 %q0, %q0;
450 veor.u64 %q1, %q1;
451 veor.u64 %q2, %q2;
452 veor.u64 %q3, %q3;
453
454 pop {%pc};
455ENDPROC(sha512_transform_neon)
diff --git a/arch/arm/crypto/sha512_neon_glue.c b/arch/arm/crypto/sha512_neon_glue.c
new file mode 100644
index 000000000000..0d2758ff5e12
--- /dev/null
+++ b/arch/arm/crypto/sha512_neon_glue.c
@@ -0,0 +1,305 @@
1/*
2 * Glue code for the SHA512 Secure Hash Algorithm assembly implementation
3 * using NEON instructions.
4 *
5 * Copyright © 2014 Jussi Kivilinna <jussi.kivilinna@iki.fi>
6 *
7 * This file is based on sha512_ssse3_glue.c:
8 * Copyright (C) 2013 Intel Corporation
9 * Author: Tim Chen <tim.c.chen@linux.intel.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
14 * any later version.
15 *
16 */
17
18#include <crypto/internal/hash.h>
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/mm.h>
22#include <linux/cryptohash.h>
23#include <linux/types.h>
24#include <linux/string.h>
25#include <crypto/sha.h>
26#include <asm/byteorder.h>
27#include <asm/simd.h>
28#include <asm/neon.h>
29
30
31static const u64 sha512_k[] = {
32 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
33 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
34 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
35 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
36 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL,
37 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
38 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL,
39 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
40 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
41 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
42 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL,
43 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
44 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL,
45 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
46 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
47 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
48 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL,
49 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
50 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL,
51 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
52 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
53 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
54 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL,
55 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
56 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL,
57 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
58 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
59 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
60 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL,
61 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
62 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL,
63 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
64 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
65 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
66 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL,
67 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
68 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL,
69 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
70 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
71 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
72};
73
74
75asmlinkage void sha512_transform_neon(u64 *digest, const void *data,
76 const u64 k[], unsigned int num_blks);
77
78
79static int sha512_neon_init(struct shash_desc *desc)
80{
81 struct sha512_state *sctx = shash_desc_ctx(desc);
82
83 sctx->state[0] = SHA512_H0;
84 sctx->state[1] = SHA512_H1;
85 sctx->state[2] = SHA512_H2;
86 sctx->state[3] = SHA512_H3;
87 sctx->state[4] = SHA512_H4;
88 sctx->state[5] = SHA512_H5;
89 sctx->state[6] = SHA512_H6;
90 sctx->state[7] = SHA512_H7;
91 sctx->count[0] = sctx->count[1] = 0;
92
93 return 0;
94}
95
96static int __sha512_neon_update(struct shash_desc *desc, const u8 *data,
97 unsigned int len, unsigned int partial)
98{
99 struct sha512_state *sctx = shash_desc_ctx(desc);
100 unsigned int done = 0;
101
102 sctx->count[0] += len;
103 if (sctx->count[0] < len)
104 sctx->count[1]++;
105
106 if (partial) {
107 done = SHA512_BLOCK_SIZE - partial;
108 memcpy(sctx->buf + partial, data, done);
109 sha512_transform_neon(sctx->state, sctx->buf, sha512_k, 1);
110 }
111
112 if (len - done >= SHA512_BLOCK_SIZE) {
113 const unsigned int rounds = (len - done) / SHA512_BLOCK_SIZE;
114
115 sha512_transform_neon(sctx->state, data + done, sha512_k,
116 rounds);
117
118 done += rounds * SHA512_BLOCK_SIZE;
119 }
120
121 memcpy(sctx->buf, data + done, len - done);
122
123 return 0;
124}
125
126static int sha512_neon_update(struct shash_desc *desc, const u8 *data,
127 unsigned int len)
128{
129 struct sha512_state *sctx = shash_desc_ctx(desc);
130 unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
131 int res;
132
133 /* Handle the fast case right here */
134 if (partial + len < SHA512_BLOCK_SIZE) {
135 sctx->count[0] += len;
136 if (sctx->count[0] < len)
137 sctx->count[1]++;
138 memcpy(sctx->buf + partial, data, len);
139
140 return 0;
141 }
142
143 if (!may_use_simd()) {
144 res = crypto_sha512_update(desc, data, len);
145 } else {
146 kernel_neon_begin();
147 res = __sha512_neon_update(desc, data, len, partial);
148 kernel_neon_end();
149 }
150
151 return res;
152}
153
154
155/* Add padding and return the message digest. */
156static int sha512_neon_final(struct shash_desc *desc, u8 *out)
157{
158 struct sha512_state *sctx = shash_desc_ctx(desc);
159 unsigned int i, index, padlen;
160 __be64 *dst = (__be64 *)out;
161 __be64 bits[2];
162 static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, };
163
164 /* save number of bits */
165 bits[1] = cpu_to_be64(sctx->count[0] << 3);
166 bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
167
168 /* Pad out to 112 mod 128 and append length */
169 index = sctx->count[0] & 0x7f;
170 padlen = (index < 112) ? (112 - index) : ((128+112) - index);
171
172 if (!may_use_simd()) {
173 crypto_sha512_update(desc, padding, padlen);
174 crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits));
175 } else {
176 kernel_neon_begin();
177 /* We need to fill a whole block for __sha512_neon_update() */
178 if (padlen <= 112) {
179 sctx->count[0] += padlen;
180 if (sctx->count[0] < padlen)
181 sctx->count[1]++;
182 memcpy(sctx->buf + index, padding, padlen);
183 } else {
184 __sha512_neon_update(desc, padding, padlen, index);
185 }
186 __sha512_neon_update(desc, (const u8 *)&bits,
187 sizeof(bits), 112);
188 kernel_neon_end();
189 }
190
191 /* Store state in digest */
192 for (i = 0; i < 8; i++)
193 dst[i] = cpu_to_be64(sctx->state[i]);
194
195 /* Wipe context */
196 memset(sctx, 0, sizeof(*sctx));
197
198 return 0;
199}
200
201static int sha512_neon_export(struct shash_desc *desc, void *out)
202{
203 struct sha512_state *sctx = shash_desc_ctx(desc);
204
205 memcpy(out, sctx, sizeof(*sctx));
206
207 return 0;
208}
209
210static int sha512_neon_import(struct shash_desc *desc, const void *in)
211{
212 struct sha512_state *sctx = shash_desc_ctx(desc);
213
214 memcpy(sctx, in, sizeof(*sctx));
215
216 return 0;
217}
218
219static int sha384_neon_init(struct shash_desc *desc)
220{
221 struct sha512_state *sctx = shash_desc_ctx(desc);
222
223 sctx->state[0] = SHA384_H0;
224 sctx->state[1] = SHA384_H1;
225 sctx->state[2] = SHA384_H2;
226 sctx->state[3] = SHA384_H3;
227 sctx->state[4] = SHA384_H4;
228 sctx->state[5] = SHA384_H5;
229 sctx->state[6] = SHA384_H6;
230 sctx->state[7] = SHA384_H7;
231
232 sctx->count[0] = sctx->count[1] = 0;
233
234 return 0;
235}
236
237static int sha384_neon_final(struct shash_desc *desc, u8 *hash)
238{
239 u8 D[SHA512_DIGEST_SIZE];
240
241 sha512_neon_final(desc, D);
242
243 memcpy(hash, D, SHA384_DIGEST_SIZE);
244 memset(D, 0, SHA512_DIGEST_SIZE);
245
246 return 0;
247}
248
249static struct shash_alg algs[] = { {
250 .digestsize = SHA512_DIGEST_SIZE,
251 .init = sha512_neon_init,
252 .update = sha512_neon_update,
253 .final = sha512_neon_final,
254 .export = sha512_neon_export,
255 .import = sha512_neon_import,
256 .descsize = sizeof(struct sha512_state),
257 .statesize = sizeof(struct sha512_state),
258 .base = {
259 .cra_name = "sha512",
260 .cra_driver_name = "sha512-neon",
261 .cra_priority = 250,
262 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
263 .cra_blocksize = SHA512_BLOCK_SIZE,
264 .cra_module = THIS_MODULE,
265 }
266}, {
267 .digestsize = SHA384_DIGEST_SIZE,
268 .init = sha384_neon_init,
269 .update = sha512_neon_update,
270 .final = sha384_neon_final,
271 .export = sha512_neon_export,
272 .import = sha512_neon_import,
273 .descsize = sizeof(struct sha512_state),
274 .statesize = sizeof(struct sha512_state),
275 .base = {
276 .cra_name = "sha384",
277 .cra_driver_name = "sha384-neon",
278 .cra_priority = 250,
279 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
280 .cra_blocksize = SHA384_BLOCK_SIZE,
281 .cra_module = THIS_MODULE,
282 }
283} };
284
285static int __init sha512_neon_mod_init(void)
286{
287 if (!cpu_has_neon())
288 return -ENODEV;
289
290 return crypto_register_shashes(algs, ARRAY_SIZE(algs));
291}
292
293static void __exit sha512_neon_mod_fini(void)
294{
295 crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
296}
297
298module_init(sha512_neon_mod_init);
299module_exit(sha512_neon_mod_fini);
300
301MODULE_LICENSE("GPL");
302MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, NEON accelerated");
303
304MODULE_ALIAS("sha512");
305MODULE_ALIAS("sha384");
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index f5a357601983..70cd84eb7fda 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -22,6 +22,7 @@ generic-y += poll.h
22generic-y += preempt.h 22generic-y += preempt.h
23generic-y += resource.h 23generic-y += resource.h
24generic-y += rwsem.h 24generic-y += rwsem.h
25generic-y += scatterlist.h
25generic-y += sections.h 26generic-y += sections.h
26generic-y += segment.h 27generic-y += segment.h
27generic-y += sembuf.h 28generic-y += sembuf.h
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 57f0584e8d97..f67fd3afebdf 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -24,6 +24,8 @@
24#include <asm/domain.h> 24#include <asm/domain.h>
25#include <asm/opcodes-virt.h> 25#include <asm/opcodes-virt.h>
26#include <asm/asm-offsets.h> 26#include <asm/asm-offsets.h>
27#include <asm/page.h>
28#include <asm/thread_info.h>
27 29
28#define IOMEM(x) (x) 30#define IOMEM(x) (x)
29 31
@@ -179,10 +181,10 @@
179 * Get current thread_info. 181 * Get current thread_info.
180 */ 182 */
181 .macro get_thread_info, rd 183 .macro get_thread_info, rd
182 ARM( mov \rd, sp, lsr #13 ) 184 ARM( mov \rd, sp, lsr #THREAD_SIZE_ORDER + PAGE_SHIFT )
183 THUMB( mov \rd, sp ) 185 THUMB( mov \rd, sp )
184 THUMB( lsr \rd, \rd, #13 ) 186 THUMB( lsr \rd, \rd, #THREAD_SIZE_ORDER + PAGE_SHIFT )
185 mov \rd, \rd, lsl #13 187 mov \rd, \rd, lsl #THREAD_SIZE_ORDER + PAGE_SHIFT
186 .endm 188 .endm
187 189
188/* 190/*
@@ -425,4 +427,25 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
425#endif 427#endif
426 .endm 428 .endm
427 429
430 .irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
431 .macro ret\c, reg
432#if __LINUX_ARM_ARCH__ < 6
433 mov\c pc, \reg
434#else
435 .ifeqs "\reg", "lr"
436 bx\c \reg
437 .else
438 mov\c pc, \reg
439 .endif
440#endif
441 .endm
442 .endr
443
444 .macro ret.w, reg
445 ret \reg
446#ifdef CONFIG_THUMB2_KERNEL
447 nop
448#endif
449 .endm
450
428#endif /* __ASM_ASSEMBLER_H__ */ 451#endif /* __ASM_ASSEMBLER_H__ */
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 8c2b7321a478..963a2515906d 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -62,17 +62,18 @@
62#define ARM_CPU_IMP_ARM 0x41 62#define ARM_CPU_IMP_ARM 0x41
63#define ARM_CPU_IMP_INTEL 0x69 63#define ARM_CPU_IMP_INTEL 0x69
64 64
65#define ARM_CPU_PART_ARM1136 0xB360 65/* ARM implemented processors */
66#define ARM_CPU_PART_ARM1156 0xB560 66#define ARM_CPU_PART_ARM1136 0x4100b360
67#define ARM_CPU_PART_ARM1176 0xB760 67#define ARM_CPU_PART_ARM1156 0x4100b560
68#define ARM_CPU_PART_ARM11MPCORE 0xB020 68#define ARM_CPU_PART_ARM1176 0x4100b760
69#define ARM_CPU_PART_CORTEX_A8 0xC080 69#define ARM_CPU_PART_ARM11MPCORE 0x4100b020
70#define ARM_CPU_PART_CORTEX_A9 0xC090 70#define ARM_CPU_PART_CORTEX_A8 0x4100c080
71#define ARM_CPU_PART_CORTEX_A5 0xC050 71#define ARM_CPU_PART_CORTEX_A9 0x4100c090
72#define ARM_CPU_PART_CORTEX_A15 0xC0F0 72#define ARM_CPU_PART_CORTEX_A5 0x4100c050
73#define ARM_CPU_PART_CORTEX_A7 0xC070 73#define ARM_CPU_PART_CORTEX_A7 0x4100c070
74#define ARM_CPU_PART_CORTEX_A12 0xC0D0 74#define ARM_CPU_PART_CORTEX_A12 0x4100c0d0
75#define ARM_CPU_PART_CORTEX_A17 0xC0E0 75#define ARM_CPU_PART_CORTEX_A17 0x4100c0e0
76#define ARM_CPU_PART_CORTEX_A15 0x4100c0f0
76 77
77#define ARM_CPU_XSCALE_ARCH_MASK 0xe000 78#define ARM_CPU_XSCALE_ARCH_MASK 0xe000
78#define ARM_CPU_XSCALE_ARCH_V1 0x2000 79#define ARM_CPU_XSCALE_ARCH_V1 0x2000
@@ -171,14 +172,24 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
171 return (read_cpuid_id() & 0xFF000000) >> 24; 172 return (read_cpuid_id() & 0xFF000000) >> 24;
172} 173}
173 174
174static inline unsigned int __attribute_const__ read_cpuid_part_number(void) 175/*
176 * The CPU part number is meaningless without referring to the CPU
177 * implementer: implementers are free to define their own part numbers
178 * which are permitted to clash with other implementer part numbers.
179 */
180static inline unsigned int __attribute_const__ read_cpuid_part(void)
181{
182 return read_cpuid_id() & 0xff00fff0;
183}
184
185static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void)
175{ 186{
176 return read_cpuid_id() & 0xFFF0; 187 return read_cpuid_id() & 0xFFF0;
177} 188}
178 189
179static inline unsigned int __attribute_const__ xscale_cpu_arch_version(void) 190static inline unsigned int __attribute_const__ xscale_cpu_arch_version(void)
180{ 191{
181 return read_cpuid_part_number() & ARM_CPU_XSCALE_ARCH_MASK; 192 return read_cpuid_id() & ARM_CPU_XSCALE_ARCH_MASK;
182} 193}
183 194
184static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) 195static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
diff --git a/arch/arm/include/asm/crypto/sha1.h b/arch/arm/include/asm/crypto/sha1.h
new file mode 100644
index 000000000000..75e6a417416b
--- /dev/null
+++ b/arch/arm/include/asm/crypto/sha1.h
@@ -0,0 +1,10 @@
1#ifndef ASM_ARM_CRYPTO_SHA1_H
2#define ASM_ARM_CRYPTO_SHA1_H
3
4#include <linux/crypto.h>
5#include <crypto/sha.h>
6
7extern int sha1_update_arm(struct shash_desc *desc, const u8 *data,
8 unsigned int len);
9
10#endif
diff --git a/arch/arm/include/asm/entry-macro-multi.S b/arch/arm/include/asm/entry-macro-multi.S
index 88d61815f0c0..469a2b30fa27 100644
--- a/arch/arm/include/asm/entry-macro-multi.S
+++ b/arch/arm/include/asm/entry-macro-multi.S
@@ -35,5 +35,5 @@
35\symbol_name: 35\symbol_name:
36 mov r8, lr 36 mov r8, lr
37 arch_irq_handler_default 37 arch_irq_handler_default
38 mov pc, r8 38 ret r8
39 .endm 39 .endm
diff --git a/arch/arm/include/asm/glue-proc.h b/arch/arm/include/asm/glue-proc.h
index 74a8b84f3cb1..74be7c22035a 100644
--- a/arch/arm/include/asm/glue-proc.h
+++ b/arch/arm/include/asm/glue-proc.h
@@ -221,15 +221,6 @@
221# endif 221# endif
222#endif 222#endif
223 223
224#ifdef CONFIG_CPU_V7
225# ifdef CPU_NAME
226# undef MULTI_CPU
227# define MULTI_CPU
228# else
229# define CPU_NAME cpu_v7
230# endif
231#endif
232
233#ifdef CONFIG_CPU_V7M 224#ifdef CONFIG_CPU_V7M
234# ifdef CPU_NAME 225# ifdef CPU_NAME
235# undef MULTI_CPU 226# undef MULTI_CPU
@@ -248,6 +239,15 @@
248# endif 239# endif
249#endif 240#endif
250 241
242#ifdef CONFIG_CPU_V7
243/*
244 * Cortex-A9 needs a different suspend/resume function, so we need
245 * multiple CPU support for ARMv7 anyway.
246 */
247# undef MULTI_CPU
248# define MULTI_CPU
249#endif
250
251#ifndef MULTI_CPU 251#ifndef MULTI_CPU
252#define cpu_proc_init __glue(CPU_NAME,_proc_init) 252#define cpu_proc_init __glue(CPU_NAME,_proc_init)
253#define cpu_proc_fin __glue(CPU_NAME,_proc_fin) 253#define cpu_proc_fin __glue(CPU_NAME,_proc_fin)
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 477e0206e016..504dcddebfcc 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -5,12 +5,6 @@
5#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO 5#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
6#endif 6#endif
7 7
8/* not all ARM platforms necessarily support this API ... */
9#ifdef CONFIG_NEED_MACH_GPIO_H
10#include <mach/gpio.h>
11#endif
12
13#ifndef __ARM_GPIOLIB_COMPLEX
14/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */ 8/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
15#include <asm-generic/gpio.h> 9#include <asm-generic/gpio.h>
16 10
@@ -18,7 +12,6 @@
18#define gpio_get_value __gpio_get_value 12#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value 13#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep 14#define gpio_cansleep __gpio_cansleep
21#endif
22 15
23/* 16/*
24 * Provide a default gpio_to_irq() which should satisfy every case. 17 * Provide a default gpio_to_irq() which should satisfy every case.
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index 53b3c4a50d5c..3a67bec72d0c 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -61,6 +61,24 @@
61#define ARM_EXCEPTION_FIQ 6 61#define ARM_EXCEPTION_FIQ 6
62#define ARM_EXCEPTION_HVC 7 62#define ARM_EXCEPTION_HVC 7
63 63
64/*
65 * The rr_lo_hi macro swaps a pair of registers depending on
66 * current endianness. It is used in conjunction with ldrd and strd
67 * instructions that load/store a 64-bit value from/to memory to/from
68 * a pair of registers which are used with the mrrc and mcrr instructions.
69 * If used with the ldrd/strd instructions, the a1 parameter is the first
70 * source/destination register and the a2 parameter is the second
71 * source/destination register. Note that the ldrd/strd instructions
72 * already swap the bytes within the words correctly according to the
73 * endianness setting, but the order of the registers need to be effectively
74 * swapped when used with the mrrc/mcrr instructions.
75 */
76#ifdef CONFIG_CPU_ENDIAN_BE8
77#define rr_lo_hi(a1, a2) a2, a1
78#else
79#define rr_lo_hi(a1, a2) a1, a2
80#endif
81
64#ifndef __ASSEMBLY__ 82#ifndef __ASSEMBLY__
65struct kvm; 83struct kvm;
66struct kvm_vcpu; 84struct kvm_vcpu;
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index 0fa90c962ac8..69b746955fca 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -185,9 +185,16 @@ static inline unsigned long vcpu_data_guest_to_host(struct kvm_vcpu *vcpu,
185 default: 185 default:
186 return be32_to_cpu(data); 186 return be32_to_cpu(data);
187 } 187 }
188 } else {
189 switch (len) {
190 case 1:
191 return data & 0xff;
192 case 2:
193 return le16_to_cpu(data & 0xffff);
194 default:
195 return le32_to_cpu(data);
196 }
188 } 197 }
189
190 return data; /* Leave LE untouched */
191} 198}
192 199
193static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu, 200static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
@@ -203,9 +210,16 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
203 default: 210 default:
204 return cpu_to_be32(data); 211 return cpu_to_be32(data);
205 } 212 }
213 } else {
214 switch (len) {
215 case 1:
216 return data & 0xff;
217 case 2:
218 return cpu_to_le16(data & 0xffff);
219 default:
220 return cpu_to_le32(data);
221 }
206 } 222 }
207
208 return data; /* Leave LE untouched */
209} 223}
210 224
211#endif /* __ARM_KVM_EMULATE_H__ */ 225#endif /* __ARM_KVM_EMULATE_H__ */
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 193ceaf01bfd..6dfb404f6c46 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -225,10 +225,12 @@ static inline int kvm_arch_dev_ioctl_check_extension(long ext)
225 return 0; 225 return 0;
226} 226}
227 227
228static inline void vgic_arch_setup(const struct vgic_params *vgic)
229{
230 BUG_ON(vgic->type != VGIC_V2);
231}
232
228int kvm_perf_init(void); 233int kvm_perf_init(void);
229int kvm_perf_teardown(void); 234int kvm_perf_teardown(void);
230 235
231u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
232int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
233
234#endif /* __ARM_KVM_HOST_H__ */ 236#endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 5c7aa3c1519f..5cc0b0f5f72f 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -127,6 +127,18 @@ static inline void kvm_set_s2pmd_writable(pmd_t *pmd)
127 (__boundary - 1 < (end) - 1)? __boundary: (end); \ 127 (__boundary - 1 < (end) - 1)? __boundary: (end); \
128}) 128})
129 129
130static inline bool kvm_page_empty(void *ptr)
131{
132 struct page *ptr_page = virt_to_page(ptr);
133 return page_count(ptr_page) == 1;
134}
135
136
137#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
138#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
139#define kvm_pud_table_empty(pudp) (0)
140
141
130struct kvm; 142struct kvm;
131 143
132#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l)) 144#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l))
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
index 94060adba174..57ff7f2a3084 100644
--- a/arch/arm/include/asm/mcpm.h
+++ b/arch/arm/include/asm/mcpm.h
@@ -217,6 +217,22 @@ int __mcpm_cluster_state(unsigned int cluster);
217int __init mcpm_sync_init( 217int __init mcpm_sync_init(
218 void (*power_up_setup)(unsigned int affinity_level)); 218 void (*power_up_setup)(unsigned int affinity_level));
219 219
220/**
221 * mcpm_loopback - make a run through the MCPM low-level code
222 *
223 * @cache_disable: pointer to function performing cache disabling
224 *
225 * This exercises the MCPM machinery by soft resetting the CPU and branching
226 * to the MCPM low-level entry code before returning to the caller.
227 * The @cache_disable function must do the necessary cache disabling to
228 * let the regular kernel init code turn it back on as if the CPU was
229 * hotplugged in. The MCPM state machine is set as if the cluster was
230 * initialized meaning the power_up_setup callback passed to mcpm_sync_init()
231 * will be invoked for all affinity levels. This may be useful to initialize
232 * some resources such as enabling the CCI that requires the cache to be off, or simply for testing purposes.
233 */
234int __init mcpm_loopback(void (*cache_disable)(void));
235
220void __init mcpm_smp_set_ops(void); 236void __init mcpm_smp_set_ops(void);
221 237
222#else 238#else
diff --git a/arch/arm/include/asm/mcs_spinlock.h b/arch/arm/include/asm/mcs_spinlock.h
new file mode 100644
index 000000000000..f652ad65840a
--- /dev/null
+++ b/arch/arm/include/asm/mcs_spinlock.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_MCS_LOCK_H
2#define __ASM_MCS_LOCK_H
3
4#ifdef CONFIG_SMP
5#include <asm/spinlock.h>
6
7/* MCS spin-locking. */
8#define arch_mcs_spin_lock_contended(lock) \
9do { \
10 /* Ensure prior stores are observed before we enter wfe. */ \
11 smp_mb(); \
12 while (!(smp_load_acquire(lock))) \
13 wfe(); \
14} while (0) \
15
16#define arch_mcs_spin_unlock_contended(lock) \
17do { \
18 smp_store_release(lock, 1); \
19 dsb_sev(); \
20} while (0)
21
22#endif /* CONFIG_SMP */
23#endif /* __ASM_MCS_LOCK_H */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 2b751464d6ff..e731018869a7 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -91,9 +91,7 @@
91 * of this define that was meant to. 91 * of this define that was meant to.
92 * Fortunately, there is no reference for this in noMMU mode, for now. 92 * Fortunately, there is no reference for this in noMMU mode, for now.
93 */ 93 */
94#ifndef TASK_SIZE 94#define TASK_SIZE UL(0xffffffff)
95#define TASK_SIZE (CONFIG_DRAM_SIZE)
96#endif
97 95
98#ifndef TASK_UNMAPPED_BASE 96#ifndef TASK_UNMAPPED_BASE
99#define TASK_UNMAPPED_BASE UL(0x00000000) 97#define TASK_UNMAPPED_BASE UL(0x00000000)
@@ -150,13 +148,11 @@
150 148
151/* 149/*
152 * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical 150 * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical
153 * memory. This is used for XIP and NoMMU kernels, or by kernels which 151 * memory. This is used for XIP and NoMMU kernels, and on platforms that don't
154 * have their own mach/memory.h. Assembly code must always use 152 * have CONFIG_ARM_PATCH_PHYS_VIRT. Assembly code must always use
155 * PLAT_PHYS_OFFSET and not PHYS_OFFSET. 153 * PLAT_PHYS_OFFSET and not PHYS_OFFSET.
156 */ 154 */
157#ifndef PLAT_PHYS_OFFSET
158#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) 155#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
159#endif
160 156
161#ifndef __ASSEMBLY__ 157#ifndef __ASSEMBLY__
162 158
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index 755877527cf9..c3a83691af8e 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -12,15 +12,6 @@
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/*
16 * The ARMv7 CPU PMU supports up to 32 event counters.
17 */
18#define ARMPMU_MAX_HWEVENTS 32
19
20#define HW_OP_UNSUPPORTED 0xFFFF
21#define C(_x) PERF_COUNT_HW_CACHE_##_x
22#define CACHE_OP_UNSUPPORTED 0xFFFF
23
24#ifdef CONFIG_HW_PERF_EVENTS 15#ifdef CONFIG_HW_PERF_EVENTS
25struct pt_regs; 16struct pt_regs;
26extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 17extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h
index 626989fec4d3..9fd61c72a33a 100644
--- a/arch/arm/include/asm/pgtable-3level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-3level-hwdef.h
@@ -43,7 +43,7 @@
43#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2) 43#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
44#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3) 44#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
45#define PMD_SECT_USER (_AT(pmdval_t, 1) << 6) /* AP[1] */ 45#define PMD_SECT_USER (_AT(pmdval_t, 1) << 6) /* AP[1] */
46#define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7) /* AP[2] */ 46#define PMD_SECT_AP2 (_AT(pmdval_t, 1) << 7) /* read only */
47#define PMD_SECT_S (_AT(pmdval_t, 3) << 8) 47#define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
48#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10) 48#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
49#define PMD_SECT_nG (_AT(pmdval_t, 1) << 11) 49#define PMD_SECT_nG (_AT(pmdval_t, 1) << 11)
@@ -72,6 +72,7 @@
72#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1) 72#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1)
73#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */ 73#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */
74#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */ 74#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */
75#define PTE_AP2 (_AT(pteval_t, 1) << 7) /* AP[2] */
75#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 76#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
76#define PTE_EXT_AF (_AT(pteval_t, 1) << 10) /* Access Flag */ 77#define PTE_EXT_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
77#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* nG */ 78#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* nG */
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 85c60adc8b60..06e0bc0f8b00 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -79,18 +79,19 @@
79#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */ 79#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */
80#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 80#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
81#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 81#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
82#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
83#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 82#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
84#define L_PTE_YOUNG (_AT(pteval_t, 1) << 10) /* AF */ 83#define L_PTE_YOUNG (_AT(pteval_t, 1) << 10) /* AF */
85#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */ 84#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */
86#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */ 85#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55)
87#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */ 86#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56)
88#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */ 87#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */
88#define L_PTE_RDONLY (_AT(pteval_t, 1) << 58) /* READ ONLY */
89 89
90#define PMD_SECT_VALID (_AT(pmdval_t, 1) << 0) 90#define L_PMD_SECT_VALID (_AT(pmdval_t, 1) << 0)
91#define PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55) 91#define L_PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55)
92#define PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 56) 92#define L_PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 56)
93#define PMD_SECT_NONE (_AT(pmdval_t, 1) << 57) 93#define L_PMD_SECT_NONE (_AT(pmdval_t, 1) << 57)
94#define L_PMD_SECT_RDONLY (_AT(pteval_t, 1) << 58)
94 95
95/* 96/*
96 * To be used in assembly code with the upper page attributes. 97 * To be used in assembly code with the upper page attributes.
@@ -207,27 +208,32 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
207#define pte_huge(pte) (pte_val(pte) && !(pte_val(pte) & PTE_TABLE_BIT)) 208#define pte_huge(pte) (pte_val(pte) && !(pte_val(pte) & PTE_TABLE_BIT))
208#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT)) 209#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT))
209 210
210#define pmd_young(pmd) (pmd_val(pmd) & PMD_SECT_AF) 211#define pmd_isset(pmd, val) ((u32)(val) == (val) ? pmd_val(pmd) & (val) \
212 : !!(pmd_val(pmd) & (val)))
213#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val)))
214
215#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
211 216
212#define __HAVE_ARCH_PMD_WRITE 217#define __HAVE_ARCH_PMD_WRITE
213#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY)) 218#define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY))
219#define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY))
214 220
215#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd)) 221#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd))
216#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd)) 222#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
217 223
218#ifdef CONFIG_TRANSPARENT_HUGEPAGE 224#ifdef CONFIG_TRANSPARENT_HUGEPAGE
219#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) 225#define pmd_trans_huge(pmd) (pmd_val(pmd) && !pmd_table(pmd))
220#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING) 226#define pmd_trans_splitting(pmd) (pmd_isset((pmd), L_PMD_SECT_SPLITTING))
221#endif 227#endif
222 228
223#define PMD_BIT_FUNC(fn,op) \ 229#define PMD_BIT_FUNC(fn,op) \
224static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; } 230static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; }
225 231
226PMD_BIT_FUNC(wrprotect, |= PMD_SECT_RDONLY); 232PMD_BIT_FUNC(wrprotect, |= L_PMD_SECT_RDONLY);
227PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF); 233PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF);
228PMD_BIT_FUNC(mksplitting, |= PMD_SECT_SPLITTING); 234PMD_BIT_FUNC(mksplitting, |= L_PMD_SECT_SPLITTING);
229PMD_BIT_FUNC(mkwrite, &= ~PMD_SECT_RDONLY); 235PMD_BIT_FUNC(mkwrite, &= ~L_PMD_SECT_RDONLY);
230PMD_BIT_FUNC(mkdirty, |= PMD_SECT_DIRTY); 236PMD_BIT_FUNC(mkdirty, |= L_PMD_SECT_DIRTY);
231PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF); 237PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
232 238
233#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT)) 239#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
@@ -241,8 +247,8 @@ PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
241 247
242static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) 248static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
243{ 249{
244 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_XN | PMD_SECT_RDONLY | 250 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_XN | L_PMD_SECT_RDONLY |
245 PMD_SECT_VALID | PMD_SECT_NONE; 251 L_PMD_SECT_VALID | L_PMD_SECT_NONE;
246 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask); 252 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask);
247 return pmd; 253 return pmd;
248} 254}
@@ -253,8 +259,13 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
253 BUG_ON(addr >= TASK_SIZE); 259 BUG_ON(addr >= TASK_SIZE);
254 260
255 /* create a faulting entry if PROT_NONE protected */ 261 /* create a faulting entry if PROT_NONE protected */
256 if (pmd_val(pmd) & PMD_SECT_NONE) 262 if (pmd_val(pmd) & L_PMD_SECT_NONE)
257 pmd_val(pmd) &= ~PMD_SECT_VALID; 263 pmd_val(pmd) &= ~L_PMD_SECT_VALID;
264
265 if (pmd_write(pmd) && pmd_dirty(pmd))
266 pmd_val(pmd) &= ~PMD_SECT_AP2;
267 else
268 pmd_val(pmd) |= PMD_SECT_AP2;
258 269
259 *pmdp = __pmd(pmd_val(pmd) | PMD_SECT_nG); 270 *pmdp = __pmd(pmd_val(pmd) | PMD_SECT_nG);
260 flush_pmd_entry(pmdp); 271 flush_pmd_entry(pmdp);
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 5478e5d6ad89..01baef07cd0c 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -214,18 +214,22 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
214 214
215#define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0) 215#define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0)
216 216
217#define pte_isset(pte, val) ((u32)(val) == (val) ? pte_val(pte) & (val) \
218 : !!(pte_val(pte) & (val)))
219#define pte_isclear(pte, val) (!(pte_val(pte) & (val)))
220
217#define pte_none(pte) (!pte_val(pte)) 221#define pte_none(pte) (!pte_val(pte))
218#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) 222#define pte_present(pte) (pte_isset((pte), L_PTE_PRESENT))
219#define pte_valid(pte) (pte_val(pte) & L_PTE_VALID) 223#define pte_valid(pte) (pte_isset((pte), L_PTE_VALID))
220#define pte_accessible(mm, pte) (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte)) 224#define pte_accessible(mm, pte) (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte))
221#define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) 225#define pte_write(pte) (pte_isclear((pte), L_PTE_RDONLY))
222#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) 226#define pte_dirty(pte) (pte_isset((pte), L_PTE_DIRTY))
223#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) 227#define pte_young(pte) (pte_isset((pte), L_PTE_YOUNG))
224#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) 228#define pte_exec(pte) (pte_isclear((pte), L_PTE_XN))
225#define pte_special(pte) (0) 229#define pte_special(pte) (0)
226 230
227#define pte_valid_user(pte) \ 231#define pte_valid_user(pte) \
228 (pte_valid(pte) && (pte_val(pte) & L_PTE_USER) && pte_young(pte)) 232 (pte_valid(pte) && pte_isset((pte), L_PTE_USER) && pte_young(pte))
229 233
230#if __LINUX_ARM_ARCH__ < 6 234#if __LINUX_ARM_ARCH__ < 6
231static inline void __sync_icache_dcache(pte_t pteval) 235static inline void __sync_icache_dcache(pte_t pteval)
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index ae1919be8f98..0b648c541293 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -42,6 +42,25 @@ struct arm_pmu_platdata {
42 42
43#ifdef CONFIG_HW_PERF_EVENTS 43#ifdef CONFIG_HW_PERF_EVENTS
44 44
45/*
46 * The ARMv7 CPU PMU supports up to 32 event counters.
47 */
48#define ARMPMU_MAX_HWEVENTS 32
49
50#define HW_OP_UNSUPPORTED 0xFFFF
51#define C(_x) PERF_COUNT_HW_CACHE_##_x
52#define CACHE_OP_UNSUPPORTED 0xFFFF
53
54#define PERF_MAP_ALL_UNSUPPORTED \
55 [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED
56
57#define PERF_CACHE_MAP_ALL_UNSUPPORTED \
58[0 ... C(MAX) - 1] = { \
59 [0 ... C(OP_MAX) - 1] = { \
60 [0 ... C(RESULT_MAX) - 1] = CACHE_OP_UNSUPPORTED, \
61 }, \
62}
63
45/* The events for a given PMU register set. */ 64/* The events for a given PMU register set. */
46struct pmu_hw_events { 65struct pmu_hw_events {
47 /* 66 /*
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index c877654fe3bf..601264d983fa 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -84,6 +84,12 @@ static inline long regs_return_value(struct pt_regs *regs)
84 84
85#define instruction_pointer(regs) (regs)->ARM_pc 85#define instruction_pointer(regs) (regs)->ARM_pc
86 86
87#ifdef CONFIG_THUMB2_KERNEL
88#define frame_pointer(regs) (regs)->ARM_r7
89#else
90#define frame_pointer(regs) (regs)->ARM_fp
91#endif
92
87static inline void instruction_pointer_set(struct pt_regs *regs, 93static inline void instruction_pointer_set(struct pt_regs *regs,
88 unsigned long val) 94 unsigned long val)
89{ 95{
diff --git a/arch/arm/include/asm/scatterlist.h b/arch/arm/include/asm/scatterlist.h
deleted file mode 100644
index cefdb8f898a1..000000000000
--- a/arch/arm/include/asm/scatterlist.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASMARM_SCATTERLIST_H
2#define _ASMARM_SCATTERLIST_H
3
4#ifdef CONFIG_ARM_HAS_SG_CHAIN
5#define ARCH_HAS_SG_CHAIN
6#endif
7
8#include <asm/memory.h>
9#include <asm/types.h>
10#include <asm-generic/scatterlist.h>
11
12#endif /* _ASMARM_SCATTERLIST_H */
diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 0393fbab8dd5..bfe163c40024 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -11,7 +11,7 @@
11 11
12static inline bool scu_a9_has_base(void) 12static inline bool scu_a9_has_base(void)
13{ 13{
14 return read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9; 14 return read_cpuid_part() == ARM_CPU_PART_CORTEX_A9;
15} 15}
16 16
17static inline unsigned long scu_a9_get_base(void) 17static inline unsigned long scu_a9_get_base(void)
diff --git a/arch/arm/include/asm/stacktrace.h b/arch/arm/include/asm/stacktrace.h
index 4d0a16441b29..7722201ead19 100644
--- a/arch/arm/include/asm/stacktrace.h
+++ b/arch/arm/include/asm/stacktrace.h
@@ -1,13 +1,28 @@
1#ifndef __ASM_STACKTRACE_H 1#ifndef __ASM_STACKTRACE_H
2#define __ASM_STACKTRACE_H 2#define __ASM_STACKTRACE_H
3 3
4#include <asm/ptrace.h>
5
4struct stackframe { 6struct stackframe {
7 /*
8 * FP member should hold R7 when CONFIG_THUMB2_KERNEL is enabled
9 * and R11 otherwise.
10 */
5 unsigned long fp; 11 unsigned long fp;
6 unsigned long sp; 12 unsigned long sp;
7 unsigned long lr; 13 unsigned long lr;
8 unsigned long pc; 14 unsigned long pc;
9}; 15};
10 16
17static __always_inline
18void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame)
19{
20 frame->fp = frame_pointer(regs);
21 frame->sp = regs->ARM_sp;
22 frame->lr = regs->ARM_lr;
23 frame->pc = regs->ARM_pc;
24}
25
11extern int unwind_frame(struct stackframe *frame); 26extern int unwind_frame(struct stackframe *frame);
12extern void walk_stackframe(struct stackframe *frame, 27extern void walk_stackframe(struct stackframe *frame,
13 int (*fn)(struct stackframe *, void *), void *data); 28 int (*fn)(struct stackframe *, void *), void *data);
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index e4e4208a9130..fc44d3761f9e 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -14,9 +14,10 @@
14 14
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <asm/fpstate.h> 16#include <asm/fpstate.h>
17#include <asm/page.h>
17 18
18#define THREAD_SIZE_ORDER 1 19#define THREAD_SIZE_ORDER 1
19#define THREAD_SIZE 8192 20#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
20#define THREAD_START_SP (THREAD_SIZE - 8) 21#define THREAD_START_SP (THREAD_SIZE - 8)
21 22
22#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 75d95799b6e6..a4cd7af475e9 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -107,6 +107,8 @@ static inline void set_fs(mm_segment_t fs)
107extern int __get_user_1(void *); 107extern int __get_user_1(void *);
108extern int __get_user_2(void *); 108extern int __get_user_2(void *);
109extern int __get_user_4(void *); 109extern int __get_user_4(void *);
110extern int __get_user_lo8(void *);
111extern int __get_user_8(void *);
110 112
111#define __GUP_CLOBBER_1 "lr", "cc" 113#define __GUP_CLOBBER_1 "lr", "cc"
112#ifdef CONFIG_CPU_USE_DOMAINS 114#ifdef CONFIG_CPU_USE_DOMAINS
@@ -115,6 +117,8 @@ extern int __get_user_4(void *);
115#define __GUP_CLOBBER_2 "lr", "cc" 117#define __GUP_CLOBBER_2 "lr", "cc"
116#endif 118#endif
117#define __GUP_CLOBBER_4 "lr", "cc" 119#define __GUP_CLOBBER_4 "lr", "cc"
120#define __GUP_CLOBBER_lo8 "lr", "cc"
121#define __GUP_CLOBBER_8 "lr", "cc"
118 122
119#define __get_user_x(__r2,__p,__e,__l,__s) \ 123#define __get_user_x(__r2,__p,__e,__l,__s) \
120 __asm__ __volatile__ ( \ 124 __asm__ __volatile__ ( \
@@ -125,11 +129,19 @@ extern int __get_user_4(void *);
125 : "0" (__p), "r" (__l) \ 129 : "0" (__p), "r" (__l) \
126 : __GUP_CLOBBER_##__s) 130 : __GUP_CLOBBER_##__s)
127 131
132/* narrowing a double-word get into a single 32bit word register: */
133#ifdef __ARMEB__
134#define __get_user_xb(__r2, __p, __e, __l, __s) \
135 __get_user_x(__r2, __p, __e, __l, lo8)
136#else
137#define __get_user_xb __get_user_x
138#endif
139
128#define __get_user_check(x,p) \ 140#define __get_user_check(x,p) \
129 ({ \ 141 ({ \
130 unsigned long __limit = current_thread_info()->addr_limit - 1; \ 142 unsigned long __limit = current_thread_info()->addr_limit - 1; \
131 register const typeof(*(p)) __user *__p asm("r0") = (p);\ 143 register const typeof(*(p)) __user *__p asm("r0") = (p);\
132 register unsigned long __r2 asm("r2"); \ 144 register typeof(x) __r2 asm("r2"); \
133 register unsigned long __l asm("r1") = __limit; \ 145 register unsigned long __l asm("r1") = __limit; \
134 register int __e asm("r0"); \ 146 register int __e asm("r0"); \
135 switch (sizeof(*(__p))) { \ 147 switch (sizeof(*(__p))) { \
@@ -142,6 +154,12 @@ extern int __get_user_4(void *);
142 case 4: \ 154 case 4: \
143 __get_user_x(__r2, __p, __e, __l, 4); \ 155 __get_user_x(__r2, __p, __e, __l, 4); \
144 break; \ 156 break; \
157 case 8: \
158 if (sizeof((x)) < 8) \
159 __get_user_xb(__r2, __p, __e, __l, 4); \
160 else \
161 __get_user_x(__r2, __p, __e, __l, 8); \
162 break; \
145 default: __e = __get_user_bad(); break; \ 163 default: __e = __get_user_bad(); break; \
146 } \ 164 } \
147 x = (typeof(*(p))) __r2; \ 165 x = (typeof(*(p))) __r2; \
@@ -224,7 +242,7 @@ static inline void set_fs(mm_segment_t fs)
224#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 242#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
225 243
226#define user_addr_max() \ 244#define user_addr_max() \
227 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) 245 (segment_eq(get_fs(), KERNEL_DS) ? ~0UL : get_fs())
228 246
229/* 247/*
230 * The "__xxx" versions of the user access functions do not verify the 248 * The "__xxx" versions of the user access functions do not verify the
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 43876245fc57..32640c431a08 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -15,7 +15,17 @@
15 15
16#include <uapi/asm/unistd.h> 16#include <uapi/asm/unistd.h>
17 17
18#define __NR_syscalls (384) 18/*
19 * This may need to be greater than __NR_last_syscall+1 in order to
20 * account for the padding in the syscall table
21 */
22#define __NR_syscalls (388)
23
24/*
25 * *NOTE*: This is a ghost syscall private to the kernel. Only the
26 * __kuser_cmpxchg code in entry-armv.S should be aware of its
27 * existence. Don't ever use this from user code.
28 */
19#define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0) 29#define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0)
20 30
21#define __ARCH_WANT_STAT64 31#define __ARCH_WANT_STAT64
diff --git a/arch/arm/include/debug/clps711x.S b/arch/arm/include/debug/clps711x.S
new file mode 100644
index 000000000000..abe225436686
--- /dev/null
+++ b/arch/arm/include/debug/clps711x.S
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#ifndef CONFIG_DEBUG_CLPS711X_UART2
11#define CLPS711X_UART_PADDR (0x80000000 + 0x0000)
12#define CLPS711X_UART_VADDR (0xfeff0000 + 0x0000)
13#else
14#define CLPS711X_UART_PADDR (0x80000000 + 0x1000)
15#define CLPS711X_UART_VADDR (0xfeff0000 + 0x1000)
16#endif
17
18#define SYSFLG (0x0140)
19#define SYSFLG_UBUSY (1 << 11)
20#define UARTDR (0x0480)
21
22 .macro addruart, rp, rv, tmp
23 ldr \rv, =CLPS711X_UART_VADDR
24 ldr \rp, =CLPS711X_UART_PADDR
25 .endm
26
27 .macro waituart,rd,rx
28 .endm
29
30 .macro senduart,rd,rx
31 str \rd, [\rx, #UARTDR]
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #SYSFLG]
36 tst \rd, #SYSFLG_UBUSY
37 bne 1001b
38 .endm
diff --git a/arch/arm/mach-s5pv210/include/mach/debug-macro.S b/arch/arm/include/debug/s5pv210.S
index 30b511a580aa..4f1a73e2c1a1 100644
--- a/arch/arm/mach-s5pv210/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/s5pv210.S
@@ -1,9 +1,6 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/debug-macro.S 1/*
2 * 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * http://www.samsung.com
4 * http://www.samsung.com/
5 *
6 * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
7 * 4 *
8 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
@@ -12,8 +9,9 @@
12 9
13/* pull in the relevant register and map files. */ 10/* pull in the relevant register and map files. */
14 11
15#include <linux/serial_s3c.h> 12#define S3C_ADDR_BASE 0xF6000000
16#include <mach/map.h> 13#define S3C_VA_UART S3C_ADDR_BASE + 0x01000000
14#define S5PV210_PA_UART 0xe2900000
17 15
18 /* note, for the boot process to work we have to keep the UART 16 /* note, for the boot process to work we have to keep the UART
19 * virtual address aligned to an 1MiB boundary for the L1 17 * virtual address aligned to an 1MiB boundary for the L1
@@ -22,8 +20,8 @@
22 */ 20 */
23 21
24 .macro addruart, rp, rv, tmp 22 .macro addruart, rp, rv, tmp
25 ldr \rp, = S3C_PA_UART 23 ldr \rp, =S5PV210_PA_UART
26 ldr \rv, = S3C_VA_UART 24 ldr \rv, =S3C_VA_UART
27#if CONFIG_DEBUG_S3C_UART != 0 25#if CONFIG_DEBUG_S3C_UART != 0
28 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART) 26 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
29 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART) 27 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
@@ -33,9 +31,4 @@
33#define fifo_full fifo_full_s5pv210 31#define fifo_full fifo_full_s5pv210
34#define fifo_level fifo_level_s5pv210 32#define fifo_level fifo_level_s5pv210
35 33
36/* include the reset of the code which will do the work, we're only
37 * compiling for a single cpu processor type so the default of s3c2440
38 * will be fine with us.
39 */
40
41#include <debug/samsung.S> 34#include <debug/samsung.S>
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index ba94446c72d9..3aaa75cae90c 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -409,11 +409,9 @@
409#define __NR_sched_setattr (__NR_SYSCALL_BASE+380) 409#define __NR_sched_setattr (__NR_SYSCALL_BASE+380)
410#define __NR_sched_getattr (__NR_SYSCALL_BASE+381) 410#define __NR_sched_getattr (__NR_SYSCALL_BASE+381)
411#define __NR_renameat2 (__NR_SYSCALL_BASE+382) 411#define __NR_renameat2 (__NR_SYSCALL_BASE+382)
412 412#define __NR_seccomp (__NR_SYSCALL_BASE+383)
413/* 413#define __NR_getrandom (__NR_SYSCALL_BASE+384)
414 * This may need to be greater than __NR_last_syscall+1 in order to 414#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
415 * account for the padding in the syscall table
416 */
417 415
418/* 416/*
419 * The following SWIs are ARM private. 417 * The following SWIs are ARM private.
@@ -426,12 +424,6 @@
426#define __ARM_NR_set_tls (__ARM_NR_BASE+5) 424#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
427 425
428/* 426/*
429 * *NOTE*: This is a ghost syscall private to the kernel. Only the
430 * __kuser_cmpxchg code in entry-armv.S should be aware of its
431 * existence. Don't ever use this from user code.
432 */
433
434/*
435 * The following syscalls are obsolete and no longer available for EABI. 427 * The following syscalls are obsolete and no longer available for EABI.
436 */ 428 */
437#if !defined(__KERNEL__) 429#if !defined(__KERNEL__)
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 85598b5d1efd..713e807621d2 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -182,13 +182,13 @@ int main(void)
182 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc)); 182 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc));
183#ifdef CONFIG_KVM_ARM_VGIC 183#ifdef CONFIG_KVM_ARM_VGIC
184 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu)); 184 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu));
185 DEFINE(VGIC_CPU_HCR, offsetof(struct vgic_cpu, vgic_hcr)); 185 DEFINE(VGIC_V2_CPU_HCR, offsetof(struct vgic_cpu, vgic_v2.vgic_hcr));
186 DEFINE(VGIC_CPU_VMCR, offsetof(struct vgic_cpu, vgic_vmcr)); 186 DEFINE(VGIC_V2_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v2.vgic_vmcr));
187 DEFINE(VGIC_CPU_MISR, offsetof(struct vgic_cpu, vgic_misr)); 187 DEFINE(VGIC_V2_CPU_MISR, offsetof(struct vgic_cpu, vgic_v2.vgic_misr));
188 DEFINE(VGIC_CPU_EISR, offsetof(struct vgic_cpu, vgic_eisr)); 188 DEFINE(VGIC_V2_CPU_EISR, offsetof(struct vgic_cpu, vgic_v2.vgic_eisr));
189 DEFINE(VGIC_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_elrsr)); 189 DEFINE(VGIC_V2_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_v2.vgic_elrsr));
190 DEFINE(VGIC_CPU_APR, offsetof(struct vgic_cpu, vgic_apr)); 190 DEFINE(VGIC_V2_CPU_APR, offsetof(struct vgic_cpu, vgic_v2.vgic_apr));
191 DEFINE(VGIC_CPU_LR, offsetof(struct vgic_cpu, vgic_lr)); 191 DEFINE(VGIC_V2_CPU_LR, offsetof(struct vgic_cpu, vgic_v2.vgic_lr));
192 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr)); 192 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr));
193#ifdef CONFIG_KVM_ARM_TIMER 193#ifdef CONFIG_KVM_ARM_TIMER
194 DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl)); 194 DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl));
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 8f51bdcdacbb..9f899d8fdcca 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -392,6 +392,9 @@
392/* 380 */ CALL(sys_sched_setattr) 392/* 380 */ CALL(sys_sched_setattr)
393 CALL(sys_sched_getattr) 393 CALL(sys_sched_getattr)
394 CALL(sys_renameat2) 394 CALL(sys_renameat2)
395 CALL(sys_seccomp)
396 CALL(sys_getrandom)
397/* 385 */ CALL(sys_memfd_create)
395#ifndef syscalls_counted 398#ifndef syscalls_counted
396.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 399.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
397#define syscalls_counted 400#define syscalls_counted
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 14f7c3b14632..78c91b5f97d4 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -90,7 +90,7 @@ ENTRY(printascii)
90 ldrneb r1, [r0], #1 90 ldrneb r1, [r0], #1
91 teqne r1, #0 91 teqne r1, #0
92 bne 1b 92 bne 1b
93 mov pc, lr 93 ret lr
94ENDPROC(printascii) 94ENDPROC(printascii)
95 95
96ENTRY(printch) 96ENTRY(printch)
@@ -105,7 +105,7 @@ ENTRY(debug_ll_addr)
105 addruart r2, r3, ip 105 addruart r2, r3, ip
106 str r2, [r0] 106 str r2, [r0]
107 str r3, [r1] 107 str r3, [r1]
108 mov pc, lr 108 ret lr
109ENDPROC(debug_ll_addr) 109ENDPROC(debug_ll_addr)
110#endif 110#endif
111 111
@@ -116,7 +116,7 @@ ENTRY(printascii)
116 mov r0, #0x04 @ SYS_WRITE0 116 mov r0, #0x04 @ SYS_WRITE0
117 ARM( svc #0x123456 ) 117 ARM( svc #0x123456 )
118 THUMB( svc #0xab ) 118 THUMB( svc #0xab )
119 mov pc, lr 119 ret lr
120ENDPROC(printascii) 120ENDPROC(printascii)
121 121
122ENTRY(printch) 122ENTRY(printch)
@@ -125,14 +125,14 @@ ENTRY(printch)
125 mov r0, #0x03 @ SYS_WRITEC 125 mov r0, #0x03 @ SYS_WRITEC
126 ARM( svc #0x123456 ) 126 ARM( svc #0x123456 )
127 THUMB( svc #0xab ) 127 THUMB( svc #0xab )
128 mov pc, lr 128 ret lr
129ENDPROC(printch) 129ENDPROC(printch)
130 130
131ENTRY(debug_ll_addr) 131ENTRY(debug_ll_addr)
132 mov r2, #0 132 mov r2, #0
133 str r2, [r0] 133 str r2, [r0]
134 str r2, [r1] 134 str r2, [r1]
135 mov pc, lr 135 ret lr
136ENDPROC(debug_ll_addr) 136ENDPROC(debug_ll_addr)
137 137
138#endif 138#endif
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 52a949a8077d..36276cdccfbc 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -224,7 +224,7 @@ svc_preempt:
2241: bl preempt_schedule_irq @ irq en/disable is done inside 2241: bl preempt_schedule_irq @ irq en/disable is done inside
225 ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS 225 ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS
226 tst r0, #_TIF_NEED_RESCHED 226 tst r0, #_TIF_NEED_RESCHED
227 moveq pc, r8 @ go again 227 reteq r8 @ go again
228 b 1b 228 b 1b
229#endif 229#endif
230 230
@@ -490,7 +490,7 @@ ENDPROC(__und_usr)
490 .pushsection .fixup, "ax" 490 .pushsection .fixup, "ax"
491 .align 2 491 .align 2
4924: str r4, [sp, #S_PC] @ retry current instruction 4924: str r4, [sp, #S_PC] @ retry current instruction
493 mov pc, r9 493 ret r9
494 .popsection 494 .popsection
495 .pushsection __ex_table,"a" 495 .pushsection __ex_table,"a"
496 .long 1b, 4b 496 .long 1b, 4b
@@ -552,7 +552,7 @@ call_fpe:
552#endif 552#endif
553 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 553 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
554 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 554 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2
555 moveq pc, lr 555 reteq lr
556 and r8, r0, #0x00000f00 @ mask out CP number 556 and r8, r0, #0x00000f00 @ mask out CP number
557 THUMB( lsr r8, r8, #8 ) 557 THUMB( lsr r8, r8, #8 )
558 mov r7, #1 558 mov r7, #1
@@ -571,33 +571,33 @@ call_fpe:
571 THUMB( add pc, r8 ) 571 THUMB( add pc, r8 )
572 nop 572 nop
573 573
574 movw_pc lr @ CP#0 574 ret.w lr @ CP#0
575 W(b) do_fpe @ CP#1 (FPE) 575 W(b) do_fpe @ CP#1 (FPE)
576 W(b) do_fpe @ CP#2 (FPE) 576 W(b) do_fpe @ CP#2 (FPE)
577 movw_pc lr @ CP#3 577 ret.w lr @ CP#3
578#ifdef CONFIG_CRUNCH 578#ifdef CONFIG_CRUNCH
579 b crunch_task_enable @ CP#4 (MaverickCrunch) 579 b crunch_task_enable @ CP#4 (MaverickCrunch)
580 b crunch_task_enable @ CP#5 (MaverickCrunch) 580 b crunch_task_enable @ CP#5 (MaverickCrunch)
581 b crunch_task_enable @ CP#6 (MaverickCrunch) 581 b crunch_task_enable @ CP#6 (MaverickCrunch)
582#else 582#else
583 movw_pc lr @ CP#4 583 ret.w lr @ CP#4
584 movw_pc lr @ CP#5 584 ret.w lr @ CP#5
585 movw_pc lr @ CP#6 585 ret.w lr @ CP#6
586#endif 586#endif
587 movw_pc lr @ CP#7 587 ret.w lr @ CP#7
588 movw_pc lr @ CP#8 588 ret.w lr @ CP#8
589 movw_pc lr @ CP#9 589 ret.w lr @ CP#9
590#ifdef CONFIG_VFP 590#ifdef CONFIG_VFP
591 W(b) do_vfp @ CP#10 (VFP) 591 W(b) do_vfp @ CP#10 (VFP)
592 W(b) do_vfp @ CP#11 (VFP) 592 W(b) do_vfp @ CP#11 (VFP)
593#else 593#else
594 movw_pc lr @ CP#10 (VFP) 594 ret.w lr @ CP#10 (VFP)
595 movw_pc lr @ CP#11 (VFP) 595 ret.w lr @ CP#11 (VFP)
596#endif 596#endif
597 movw_pc lr @ CP#12 597 ret.w lr @ CP#12
598 movw_pc lr @ CP#13 598 ret.w lr @ CP#13
599 movw_pc lr @ CP#14 (Debug) 599 ret.w lr @ CP#14 (Debug)
600 movw_pc lr @ CP#15 (Control) 600 ret.w lr @ CP#15 (Control)
601 601
602#ifdef NEED_CPU_ARCHITECTURE 602#ifdef NEED_CPU_ARCHITECTURE
603 .align 2 603 .align 2
@@ -649,7 +649,7 @@ ENTRY(fp_enter)
649 .popsection 649 .popsection
650 650
651ENTRY(no_fp) 651ENTRY(no_fp)
652 mov pc, lr 652 ret lr
653ENDPROC(no_fp) 653ENDPROC(no_fp)
654 654
655__und_usr_fault_32: 655__und_usr_fault_32:
@@ -745,7 +745,7 @@ ENDPROC(__switch_to)
745#ifdef CONFIG_ARM_THUMB 745#ifdef CONFIG_ARM_THUMB
746 bx \reg 746 bx \reg
747#else 747#else
748 mov pc, \reg 748 ret \reg
749#endif 749#endif
750 .endm 750 .endm
751 751
@@ -837,7 +837,7 @@ kuser_cmpxchg64_fixup:
837#if __LINUX_ARM_ARCH__ < 6 837#if __LINUX_ARM_ARCH__ < 6
838 bcc kuser_cmpxchg32_fixup 838 bcc kuser_cmpxchg32_fixup
839#endif 839#endif
840 mov pc, lr 840 ret lr
841 .previous 841 .previous
842 842
843#else 843#else
@@ -905,7 +905,7 @@ kuser_cmpxchg32_fixup:
905 subs r8, r4, r7 905 subs r8, r4, r7
906 rsbcss r8, r8, #(2b - 1b) 906 rsbcss r8, r8, #(2b - 1b)
907 strcs r7, [sp, #S_PC] 907 strcs r7, [sp, #S_PC]
908 mov pc, lr 908 ret lr
909 .previous 909 .previous
910 910
911#else 911#else
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 7139d4a7dea7..e52fe5a2d843 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <asm/assembler.h>
11#include <asm/unistd.h> 12#include <asm/unistd.h>
12#include <asm/ftrace.h> 13#include <asm/ftrace.h>
13#include <asm/unwind.h> 14#include <asm/unwind.h>
@@ -88,7 +89,7 @@ ENTRY(ret_from_fork)
88 cmp r5, #0 89 cmp r5, #0
89 movne r0, r4 90 movne r0, r4
90 adrne lr, BSYM(1f) 91 adrne lr, BSYM(1f)
91 movne pc, r5 92 retne r5
921: get_thread_info tsk 931: get_thread_info tsk
93 b ret_slow_syscall 94 b ret_slow_syscall
94ENDPROC(ret_from_fork) 95ENDPROC(ret_from_fork)
@@ -290,7 +291,7 @@ ENDPROC(ftrace_graph_caller_old)
290 291
291.macro mcount_exit 292.macro mcount_exit
292 ldmia sp!, {r0-r3, ip, lr} 293 ldmia sp!, {r0-r3, ip, lr}
293 mov pc, ip 294 ret ip
294.endm 295.endm
295 296
296ENTRY(__gnu_mcount_nc) 297ENTRY(__gnu_mcount_nc)
@@ -298,7 +299,7 @@ UNWIND(.fnstart)
298#ifdef CONFIG_DYNAMIC_FTRACE 299#ifdef CONFIG_DYNAMIC_FTRACE
299 mov ip, lr 300 mov ip, lr
300 ldmia sp!, {lr} 301 ldmia sp!, {lr}
301 mov pc, ip 302 ret ip
302#else 303#else
303 __mcount 304 __mcount
304#endif 305#endif
@@ -333,12 +334,12 @@ return_to_handler:
333 bl ftrace_return_to_handler 334 bl ftrace_return_to_handler
334 mov lr, r0 @ r0 has real ret addr 335 mov lr, r0 @ r0 has real ret addr
335 ldmia sp!, {r0-r3} 336 ldmia sp!, {r0-r3}
336 mov pc, lr 337 ret lr
337#endif 338#endif
338 339
339ENTRY(ftrace_stub) 340ENTRY(ftrace_stub)
340.Lftrace_stub: 341.Lftrace_stub:
341 mov pc, lr 342 ret lr
342ENDPROC(ftrace_stub) 343ENDPROC(ftrace_stub)
343 344
344#endif /* CONFIG_FUNCTION_TRACER */ 345#endif /* CONFIG_FUNCTION_TRACER */
@@ -561,7 +562,7 @@ sys_mmap2:
561 streq r5, [sp, #4] 562 streq r5, [sp, #4]
562 beq sys_mmap_pgoff 563 beq sys_mmap_pgoff
563 mov r0, #-EINVAL 564 mov r0, #-EINVAL
564 mov pc, lr 565 ret lr
565#else 566#else
566 str r5, [sp, #4] 567 str r5, [sp, #4]
567 b sys_mmap_pgoff 568 b sys_mmap_pgoff
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 5d702f8900b1..8db307d0954b 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -240,12 +240,6 @@
240 movs pc, lr @ return & move spsr_svc into cpsr 240 movs pc, lr @ return & move spsr_svc into cpsr
241 .endm 241 .endm
242 242
243 @
244 @ 32-bit wide "mov pc, reg"
245 @
246 .macro movw_pc, reg
247 mov pc, \reg
248 .endm
249#else /* CONFIG_THUMB2_KERNEL */ 243#else /* CONFIG_THUMB2_KERNEL */
250 .macro svc_exit, rpsr, irq = 0 244 .macro svc_exit, rpsr, irq = 0
251 .if \irq != 0 245 .if \irq != 0
@@ -304,14 +298,6 @@
304 movs pc, lr @ return & move spsr_svc into cpsr 298 movs pc, lr @ return & move spsr_svc into cpsr
305 .endm 299 .endm
306#endif /* ifdef CONFIG_CPU_V7M / else */ 300#endif /* ifdef CONFIG_CPU_V7M / else */
307
308 @
309 @ 32-bit wide "mov pc, reg"
310 @
311 .macro movw_pc, reg
312 mov pc, \reg
313 nop
314 .endm
315#endif /* !CONFIG_THUMB2_KERNEL */ 301#endif /* !CONFIG_THUMB2_KERNEL */
316 302
317/* 303/*
diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S
index 207f9d652010..8dd26e1a9bd6 100644
--- a/arch/arm/kernel/fiqasm.S
+++ b/arch/arm/kernel/fiqasm.S
@@ -32,7 +32,7 @@ ENTRY(__set_fiq_regs)
32 ldr lr, [r0] 32 ldr lr, [r0]
33 msr cpsr_c, r1 @ return to SVC mode 33 msr cpsr_c, r1 @ return to SVC mode
34 mov r0, r0 @ avoid hazard prior to ARMv4 34 mov r0, r0 @ avoid hazard prior to ARMv4
35 mov pc, lr 35 ret lr
36ENDPROC(__set_fiq_regs) 36ENDPROC(__set_fiq_regs)
37 37
38ENTRY(__get_fiq_regs) 38ENTRY(__get_fiq_regs)
@@ -45,5 +45,5 @@ ENTRY(__get_fiq_regs)
45 str lr, [r0] 45 str lr, [r0]
46 msr cpsr_c, r1 @ return to SVC mode 46 msr cpsr_c, r1 @ return to SVC mode
47 mov r0, r0 @ avoid hazard prior to ARMv4 47 mov r0, r0 @ avoid hazard prior to ARMv4
48 mov pc, lr 48 ret lr
49ENDPROC(__get_fiq_regs) 49ENDPROC(__get_fiq_regs)
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 572a38335c96..8733012d231f 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12 */ 12 */
13#include <asm/assembler.h>
13 14
14#define ATAG_CORE 0x54410001 15#define ATAG_CORE 0x54410001
15#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2) 16#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2)
@@ -61,10 +62,10 @@ __vet_atags:
61 cmp r5, r6 62 cmp r5, r6
62 bne 1f 63 bne 1f
63 64
642: mov pc, lr @ atag/dtb pointer is ok 652: ret lr @ atag/dtb pointer is ok
65 66
661: mov r2, #0 671: mov r2, #0
67 mov pc, lr 68 ret lr
68ENDPROC(__vet_atags) 69ENDPROC(__vet_atags)
69 70
70/* 71/*
@@ -162,7 +163,7 @@ __lookup_processor_type:
162 cmp r5, r6 163 cmp r5, r6
163 blo 1b 164 blo 1b
164 mov r5, #0 @ unknown processor 165 mov r5, #0 @ unknown processor
1652: mov pc, lr 1662: ret lr
166ENDPROC(__lookup_processor_type) 167ENDPROC(__lookup_processor_type)
167 168
168/* 169/*
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 716249cc2ee1..cc176b67c134 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -82,7 +82,7 @@ ENTRY(stext)
82 adr lr, BSYM(1f) @ return (PIC) address 82 adr lr, BSYM(1f) @ return (PIC) address
83 ARM( add pc, r10, #PROCINFO_INITFUNC ) 83 ARM( add pc, r10, #PROCINFO_INITFUNC )
84 THUMB( add r12, r10, #PROCINFO_INITFUNC ) 84 THUMB( add r12, r10, #PROCINFO_INITFUNC )
85 THUMB( mov pc, r12 ) 85 THUMB( ret r12 )
86 1: b __after_proc_init 86 1: b __after_proc_init
87ENDPROC(stext) 87ENDPROC(stext)
88 88
@@ -119,7 +119,7 @@ ENTRY(secondary_startup)
119 mov r13, r12 @ __secondary_switched address 119 mov r13, r12 @ __secondary_switched address
120 ARM( add pc, r10, #PROCINFO_INITFUNC ) 120 ARM( add pc, r10, #PROCINFO_INITFUNC )
121 THUMB( add r12, r10, #PROCINFO_INITFUNC ) 121 THUMB( add r12, r10, #PROCINFO_INITFUNC )
122 THUMB( mov pc, r12 ) 122 THUMB( ret r12 )
123ENDPROC(secondary_startup) 123ENDPROC(secondary_startup)
124 124
125ENTRY(__secondary_switched) 125ENTRY(__secondary_switched)
@@ -164,7 +164,7 @@ __after_proc_init:
164#endif 164#endif
165 mcr p15, 0, r0, c1, c0, 0 @ write control reg 165 mcr p15, 0, r0, c1, c0, 0 @ write control reg
166#endif /* CONFIG_CPU_CP15 */ 166#endif /* CONFIG_CPU_CP15 */
167 mov pc, r13 167 ret r13
168ENDPROC(__after_proc_init) 168ENDPROC(__after_proc_init)
169 .ltorg 169 .ltorg
170 170
@@ -254,7 +254,7 @@ ENTRY(__setup_mpu)
254 orr r0, r0, #CR_M @ Set SCTRL.M (MPU on) 254 orr r0, r0, #CR_M @ Set SCTRL.M (MPU on)
255 mcr p15, 0, r0, c1, c0, 0 @ Enable MPU 255 mcr p15, 0, r0, c1, c0, 0 @ Enable MPU
256 isb 256 isb
257 mov pc,lr 257 ret lr
258ENDPROC(__setup_mpu) 258ENDPROC(__setup_mpu)
259#endif 259#endif
260#include "head-common.S" 260#include "head-common.S"
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 2c35f0ff2fdc..664eee8c4a26 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -140,7 +140,7 @@ ENTRY(stext)
140 mov r8, r4 @ set TTBR1 to swapper_pg_dir 140 mov r8, r4 @ set TTBR1 to swapper_pg_dir
141 ARM( add pc, r10, #PROCINFO_INITFUNC ) 141 ARM( add pc, r10, #PROCINFO_INITFUNC )
142 THUMB( add r12, r10, #PROCINFO_INITFUNC ) 142 THUMB( add r12, r10, #PROCINFO_INITFUNC )
143 THUMB( mov pc, r12 ) 143 THUMB( ret r12 )
1441: b __enable_mmu 1441: b __enable_mmu
145ENDPROC(stext) 145ENDPROC(stext)
146 .ltorg 146 .ltorg
@@ -335,7 +335,7 @@ __create_page_tables:
335 sub r4, r4, #0x1000 @ point to the PGD table 335 sub r4, r4, #0x1000 @ point to the PGD table
336 mov r4, r4, lsr #ARCH_PGD_SHIFT 336 mov r4, r4, lsr #ARCH_PGD_SHIFT
337#endif 337#endif
338 mov pc, lr 338 ret lr
339ENDPROC(__create_page_tables) 339ENDPROC(__create_page_tables)
340 .ltorg 340 .ltorg
341 .align 341 .align
@@ -383,7 +383,7 @@ ENTRY(secondary_startup)
383 ARM( add pc, r10, #PROCINFO_INITFUNC ) @ initialise processor 383 ARM( add pc, r10, #PROCINFO_INITFUNC ) @ initialise processor
384 @ (return control reg) 384 @ (return control reg)
385 THUMB( add r12, r10, #PROCINFO_INITFUNC ) 385 THUMB( add r12, r10, #PROCINFO_INITFUNC )
386 THUMB( mov pc, r12 ) 386 THUMB( ret r12 )
387ENDPROC(secondary_startup) 387ENDPROC(secondary_startup)
388 388
389 /* 389 /*
@@ -468,7 +468,7 @@ ENTRY(__turn_mmu_on)
468 instr_sync 468 instr_sync
469 mov r3, r3 469 mov r3, r3
470 mov r3, r13 470 mov r3, r13
471 mov pc, r3 471 ret r3
472__turn_mmu_on_end: 472__turn_mmu_on_end:
473ENDPROC(__turn_mmu_on) 473ENDPROC(__turn_mmu_on)
474 .popsection 474 .popsection
@@ -487,7 +487,7 @@ __fixup_smp:
487 orr r4, r4, #0x0000b000 487 orr r4, r4, #0x0000b000
488 orr r4, r4, #0x00000020 @ val 0x4100b020 488 orr r4, r4, #0x00000020 @ val 0x4100b020
489 teq r3, r4 @ ARM 11MPCore? 489 teq r3, r4 @ ARM 11MPCore?
490 moveq pc, lr @ yes, assume SMP 490 reteq lr @ yes, assume SMP
491 491
492 mrc p15, 0, r0, c0, c0, 5 @ read MPIDR 492 mrc p15, 0, r0, c0, c0, 5 @ read MPIDR
493 and r0, r0, #0xc0000000 @ multiprocessing extensions and 493 and r0, r0, #0xc0000000 @ multiprocessing extensions and
@@ -500,7 +500,7 @@ __fixup_smp:
500 orr r4, r4, #0x0000c000 500 orr r4, r4, #0x0000c000
501 orr r4, r4, #0x00000090 501 orr r4, r4, #0x00000090
502 teq r3, r4 @ Check for ARM Cortex-A9 502 teq r3, r4 @ Check for ARM Cortex-A9
503 movne pc, lr @ Not ARM Cortex-A9, 503 retne lr @ Not ARM Cortex-A9,
504 504
505 @ If a future SoC *does* use 0x0 as the PERIPH_BASE, then the 505 @ If a future SoC *does* use 0x0 as the PERIPH_BASE, then the
506 @ below address check will need to be #ifdef'd or equivalent 506 @ below address check will need to be #ifdef'd or equivalent
@@ -512,7 +512,7 @@ __fixup_smp:
512ARM_BE8(rev r0, r0) @ byteswap if big endian 512ARM_BE8(rev r0, r0) @ byteswap if big endian
513 and r0, r0, #0x3 @ number of CPUs 513 and r0, r0, #0x3 @ number of CPUs
514 teq r0, #0x0 @ is 1? 514 teq r0, #0x0 @ is 1?
515 movne pc, lr 515 retne lr
516 516
517__fixup_smp_on_up: 517__fixup_smp_on_up:
518 adr r0, 1f 518 adr r0, 1f
@@ -539,7 +539,7 @@ smp_on_up:
539 .text 539 .text
540__do_fixup_smp_on_up: 540__do_fixup_smp_on_up:
541 cmp r4, r5 541 cmp r4, r5
542 movhs pc, lr 542 reths lr
543 ldmia r4!, {r0, r6} 543 ldmia r4!, {r0, r6}
544 ARM( str r6, [r0, r3] ) 544 ARM( str r6, [r0, r3] )
545 THUMB( add r0, r0, r3 ) 545 THUMB( add r0, r0, r3 )
@@ -672,7 +672,7 @@ ARM_BE8(rev16 ip, ip)
6722: cmp r4, r5 6722: cmp r4, r5
673 ldrcc r7, [r4], #4 @ use branch for delay slot 673 ldrcc r7, [r4], #4 @ use branch for delay slot
674 bcc 1b 674 bcc 1b
675 mov pc, lr 675 ret lr
676#endif 676#endif
677ENDPROC(__fixup_a_pv_table) 677ENDPROC(__fixup_a_pv_table)
678 678
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index 797b1a6a4906..2a55373f49bf 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -99,7 +99,7 @@ ENTRY(__hyp_stub_install_secondary)
99 * immediately. 99 * immediately.
100 */ 100 */
101 compare_cpu_mode_with_primary r4, r5, r6, r7 101 compare_cpu_mode_with_primary r4, r5, r6, r7
102 movne pc, lr 102 retne lr
103 103
104 /* 104 /*
105 * Once we have given up on one CPU, we do not try to install the 105 * Once we have given up on one CPU, we do not try to install the
@@ -111,7 +111,7 @@ ENTRY(__hyp_stub_install_secondary)
111 */ 111 */
112 112
113 cmp r4, #HYP_MODE 113 cmp r4, #HYP_MODE
114 movne pc, lr @ give up if the CPU is not in HYP mode 114 retne lr @ give up if the CPU is not in HYP mode
115 115
116/* 116/*
117 * Configure HSCTLR to set correct exception endianness/instruction set 117 * Configure HSCTLR to set correct exception endianness/instruction set
@@ -134,9 +134,7 @@ ENTRY(__hyp_stub_install_secondary)
134 mcr p15, 4, r7, c1, c1, 3 @ HSTR 134 mcr p15, 4, r7, c1, c1, 3 @ HSTR
135 135
136THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE 136THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
137#ifdef CONFIG_CPU_BIG_ENDIAN 137ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE
138 orr r7, #(1 << 9) @ HSCTLR.EE
139#endif
140 mcr p15, 4, r7, c1, c0, 0 @ HSCTLR 138 mcr p15, 4, r7, c1, c0, 0 @ HSCTLR
141 139
142 mrc p15, 4, r7, c1, c1, 1 @ HDCR 140 mrc p15, 4, r7, c1, c1, 1 @ HDCR
@@ -201,7 +199,7 @@ ENDPROC(__hyp_get_vectors)
201 @ fall through 199 @ fall through
202ENTRY(__hyp_set_vectors) 200ENTRY(__hyp_set_vectors)
203 __HVC(0) 201 __HVC(0)
204 mov pc, lr 202 ret lr
205ENDPROC(__hyp_set_vectors) 203ENDPROC(__hyp_set_vectors)
206 204
207#ifndef ZIMAGE 205#ifndef ZIMAGE
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S
index 2b32978ae905..ad58e565fe98 100644
--- a/arch/arm/kernel/iwmmxt.S
+++ b/arch/arm/kernel/iwmmxt.S
@@ -100,7 +100,7 @@ ENTRY(iwmmxt_task_enable)
100 get_thread_info r10 100 get_thread_info r10
101#endif 101#endif
1024: dec_preempt_count r10, r3 1024: dec_preempt_count r10, r3
103 mov pc, r9 @ normal exit from exception 103 ret r9 @ normal exit from exception
104 104
105concan_save: 105concan_save:
106 106
@@ -144,7 +144,7 @@ concan_dump:
144 wstrd wR15, [r1, #MMX_WR15] 144 wstrd wR15, [r1, #MMX_WR15]
145 145
1462: teq r0, #0 @ anything to load? 1462: teq r0, #0 @ anything to load?
147 moveq pc, lr @ if not, return 147 reteq lr @ if not, return
148 148
149concan_load: 149concan_load:
150 150
@@ -177,10 +177,10 @@ concan_load:
177 @ clear CUP/MUP (only if r1 != 0) 177 @ clear CUP/MUP (only if r1 != 0)
178 teq r1, #0 178 teq r1, #0
179 mov r2, #0 179 mov r2, #0
180 moveq pc, lr 180 reteq lr
181 181
182 tmcr wCon, r2 182 tmcr wCon, r2
183 mov pc, lr 183 ret lr
184 184
185/* 185/*
186 * Back up Concan regs to save area and disable access to them 186 * Back up Concan regs to save area and disable access to them
@@ -266,7 +266,7 @@ ENTRY(iwmmxt_task_copy)
266 mov r3, lr @ preserve return address 266 mov r3, lr @ preserve return address
267 bl concan_dump 267 bl concan_dump
268 msr cpsr_c, ip @ restore interrupt mode 268 msr cpsr_c, ip @ restore interrupt mode
269 mov pc, r3 269 ret r3
270 270
271/* 271/*
272 * Restore Concan state from given memory address 272 * Restore Concan state from given memory address
@@ -302,7 +302,7 @@ ENTRY(iwmmxt_task_restore)
302 mov r3, lr @ preserve return address 302 mov r3, lr @ preserve return address
303 bl concan_load 303 bl concan_load
304 msr cpsr_c, ip @ restore interrupt mode 304 msr cpsr_c, ip @ restore interrupt mode
305 mov pc, r3 305 ret r3
306 306
307/* 307/*
308 * Concan handling on task switch 308 * Concan handling on task switch
@@ -324,7 +324,7 @@ ENTRY(iwmmxt_task_switch)
324 add r3, r0, #TI_IWMMXT_STATE @ get next task Concan save area 324 add r3, r0, #TI_IWMMXT_STATE @ get next task Concan save area
325 ldr r2, [r2] @ get current Concan owner 325 ldr r2, [r2] @ get current Concan owner
326 teq r2, r3 @ next task owns it? 326 teq r2, r3 @ next task owns it?
327 movne pc, lr @ no: leave Concan disabled 327 retne lr @ no: leave Concan disabled
328 328
3291: @ flip Concan access 3291: @ flip Concan access
330 XSC(eor r1, r1, #0x3) 330 XSC(eor r1, r1, #0x3)
@@ -351,7 +351,7 @@ ENTRY(iwmmxt_task_release)
351 eors r0, r0, r1 @ if equal... 351 eors r0, r0, r1 @ if equal...
352 streq r0, [r3] @ then clear ownership 352 streq r0, [r3] @ then clear ownership
353 msr cpsr_c, r2 @ restore interrupts 353 msr cpsr_c, r2 @ restore interrupts
354 mov pc, lr 354 ret lr
355 355
356 .data 356 .data
357concan_owner: 357concan_owner:
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 4238bcba9d60..266cba46db3e 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -560,11 +560,16 @@ user_backtrace(struct frame_tail __user *tail,
560 struct perf_callchain_entry *entry) 560 struct perf_callchain_entry *entry)
561{ 561{
562 struct frame_tail buftail; 562 struct frame_tail buftail;
563 unsigned long err;
563 564
564 /* Also check accessibility of one struct frame_tail beyond */
565 if (!access_ok(VERIFY_READ, tail, sizeof(buftail))) 565 if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
566 return NULL; 566 return NULL;
567 if (__copy_from_user_inatomic(&buftail, tail, sizeof(buftail))) 567
568 pagefault_disable();
569 err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
570 pagefault_enable();
571
572 if (err)
568 return NULL; 573 return NULL;
569 574
570 perf_callchain_store(entry, buftail.lr); 575 perf_callchain_store(entry, buftail.lr);
@@ -590,6 +595,10 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
590 } 595 }
591 596
592 perf_callchain_store(entry, regs->ARM_pc); 597 perf_callchain_store(entry, regs->ARM_pc);
598
599 if (!current->mm)
600 return;
601
593 tail = (struct frame_tail __user *)regs->ARM_fp - 1; 602 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
594 603
595 while ((entry->nr < PERF_MAX_STACK_DEPTH) && 604 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
@@ -621,10 +630,7 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
621 return; 630 return;
622 } 631 }
623 632
624 fr.fp = regs->ARM_fp; 633 arm_get_current_stackframe(regs, &fr);
625 fr.sp = regs->ARM_sp;
626 fr.lr = regs->ARM_lr;
627 fr.pc = regs->ARM_pc;
628 walk_stackframe(&fr, callchain_trace, entry); 634 walk_stackframe(&fr, callchain_trace, entry);
629} 635}
630 636
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index af9e35e8836f..e6a6edbec613 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -233,14 +233,17 @@ static struct of_device_id cpu_pmu_of_device_ids[] = {
233 {.compatible = "arm,cortex-a7-pmu", .data = armv7_a7_pmu_init}, 233 {.compatible = "arm,cortex-a7-pmu", .data = armv7_a7_pmu_init},
234 {.compatible = "arm,cortex-a5-pmu", .data = armv7_a5_pmu_init}, 234 {.compatible = "arm,cortex-a5-pmu", .data = armv7_a5_pmu_init},
235 {.compatible = "arm,arm11mpcore-pmu", .data = armv6mpcore_pmu_init}, 235 {.compatible = "arm,arm11mpcore-pmu", .data = armv6mpcore_pmu_init},
236 {.compatible = "arm,arm1176-pmu", .data = armv6pmu_init}, 236 {.compatible = "arm,arm1176-pmu", .data = armv6_1176_pmu_init},
237 {.compatible = "arm,arm1136-pmu", .data = armv6pmu_init}, 237 {.compatible = "arm,arm1136-pmu", .data = armv6_1136_pmu_init},
238 {.compatible = "qcom,krait-pmu", .data = krait_pmu_init}, 238 {.compatible = "qcom,krait-pmu", .data = krait_pmu_init},
239 {}, 239 {},
240}; 240};
241 241
242static struct platform_device_id cpu_pmu_plat_device_ids[] = { 242static struct platform_device_id cpu_pmu_plat_device_ids[] = {
243 {.name = "arm-pmu"}, 243 {.name = "arm-pmu"},
244 {.name = "armv6-pmu"},
245 {.name = "armv7-pmu"},
246 {.name = "xscale-pmu"},
244 {}, 247 {},
245}; 248};
246 249
@@ -250,40 +253,43 @@ static struct platform_device_id cpu_pmu_plat_device_ids[] = {
250static int probe_current_pmu(struct arm_pmu *pmu) 253static int probe_current_pmu(struct arm_pmu *pmu)
251{ 254{
252 int cpu = get_cpu(); 255 int cpu = get_cpu();
253 unsigned long implementor = read_cpuid_implementor();
254 unsigned long part_number = read_cpuid_part_number();
255 int ret = -ENODEV; 256 int ret = -ENODEV;
256 257
257 pr_info("probing PMU on CPU %d\n", cpu); 258 pr_info("probing PMU on CPU %d\n", cpu);
258 259
260 switch (read_cpuid_part()) {
259 /* ARM Ltd CPUs. */ 261 /* ARM Ltd CPUs. */
260 if (implementor == ARM_CPU_IMP_ARM) { 262 case ARM_CPU_PART_ARM1136:
261 switch (part_number) { 263 ret = armv6_1136_pmu_init(pmu);
262 case ARM_CPU_PART_ARM1136: 264 break;
263 case ARM_CPU_PART_ARM1156: 265 case ARM_CPU_PART_ARM1156:
264 case ARM_CPU_PART_ARM1176: 266 ret = armv6_1156_pmu_init(pmu);
265 ret = armv6pmu_init(pmu); 267 break;
266 break; 268 case ARM_CPU_PART_ARM1176:
267 case ARM_CPU_PART_ARM11MPCORE: 269 ret = armv6_1176_pmu_init(pmu);
268 ret = armv6mpcore_pmu_init(pmu); 270 break;
269 break; 271 case ARM_CPU_PART_ARM11MPCORE:
270 case ARM_CPU_PART_CORTEX_A8: 272 ret = armv6mpcore_pmu_init(pmu);
271 ret = armv7_a8_pmu_init(pmu); 273 break;
272 break; 274 case ARM_CPU_PART_CORTEX_A8:
273 case ARM_CPU_PART_CORTEX_A9: 275 ret = armv7_a8_pmu_init(pmu);
274 ret = armv7_a9_pmu_init(pmu); 276 break;
275 break; 277 case ARM_CPU_PART_CORTEX_A9:
276 } 278 ret = armv7_a9_pmu_init(pmu);
277 /* Intel CPUs [xscale]. */ 279 break;
278 } else if (implementor == ARM_CPU_IMP_INTEL) { 280
279 switch (xscale_cpu_arch_version()) { 281 default:
280 case ARM_CPU_XSCALE_ARCH_V1: 282 if (read_cpuid_implementor() == ARM_CPU_IMP_INTEL) {
281 ret = xscale1pmu_init(pmu); 283 switch (xscale_cpu_arch_version()) {
282 break; 284 case ARM_CPU_XSCALE_ARCH_V1:
283 case ARM_CPU_XSCALE_ARCH_V2: 285 ret = xscale1pmu_init(pmu);
284 ret = xscale2pmu_init(pmu); 286 break;
285 break; 287 case ARM_CPU_XSCALE_ARCH_V2:
288 ret = xscale2pmu_init(pmu);
289 break;
290 }
286 } 291 }
292 break;
287 } 293 }
288 294
289 put_cpu(); 295 put_cpu();
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index 03664b0e8fa4..abfeb04f3213 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -65,13 +65,11 @@ enum armv6_counters {
65 * accesses/misses in hardware. 65 * accesses/misses in hardware.
66 */ 66 */
67static const unsigned armv6_perf_map[PERF_COUNT_HW_MAX] = { 67static const unsigned armv6_perf_map[PERF_COUNT_HW_MAX] = {
68 PERF_MAP_ALL_UNSUPPORTED,
68 [PERF_COUNT_HW_CPU_CYCLES] = ARMV6_PERFCTR_CPU_CYCLES, 69 [PERF_COUNT_HW_CPU_CYCLES] = ARMV6_PERFCTR_CPU_CYCLES,
69 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV6_PERFCTR_INSTR_EXEC, 70 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV6_PERFCTR_INSTR_EXEC,
70 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
71 [PERF_COUNT_HW_CACHE_MISSES] = HW_OP_UNSUPPORTED,
72 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6_PERFCTR_BR_EXEC, 71 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6_PERFCTR_BR_EXEC,
73 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV6_PERFCTR_BR_MISPREDICT, 72 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV6_PERFCTR_BR_MISPREDICT,
74 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
75 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6_PERFCTR_IBUF_STALL, 73 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6_PERFCTR_IBUF_STALL,
76 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6_PERFCTR_LSU_FULL_STALL, 74 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6_PERFCTR_LSU_FULL_STALL,
77}; 75};
@@ -79,116 +77,31 @@ static const unsigned armv6_perf_map[PERF_COUNT_HW_MAX] = {
79static const unsigned armv6_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 77static const unsigned armv6_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
80 [PERF_COUNT_HW_CACHE_OP_MAX] 78 [PERF_COUNT_HW_CACHE_OP_MAX]
81 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 79 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
82 [C(L1D)] = { 80 PERF_CACHE_MAP_ALL_UNSUPPORTED,
83 /* 81
84 * The performance counters don't differentiate between read 82 /*
85 * and write accesses/misses so this isn't strictly correct, 83 * The performance counters don't differentiate between read and write
86 * but it's the best we can do. Writes and reads get 84 * accesses/misses so this isn't strictly correct, but it's the best we
87 * combined. 85 * can do. Writes and reads get combined.
88 */ 86 */
89 [C(OP_READ)] = { 87 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS,
90 [C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS, 88 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS,
91 [C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS, 89 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS,
92 }, 90 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS,
93 [C(OP_WRITE)] = { 91
94 [C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS, 92 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_ICACHE_MISS,
95 [C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS, 93
96 }, 94 /*
97 [C(OP_PREFETCH)] = { 95 * The ARM performance counters can count micro DTLB misses, micro ITLB
98 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 96 * misses and main TLB misses. There isn't an event for TLB misses, so
99 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 97 * use the micro misses here and if users want the main TLB misses they
100 }, 98 * can use a raw counter.
101 }, 99 */
102 [C(L1I)] = { 100 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
103 [C(OP_READ)] = { 101 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
104 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 102
105 [C(RESULT_MISS)] = ARMV6_PERFCTR_ICACHE_MISS, 103 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
106 }, 104 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
107 [C(OP_WRITE)] = {
108 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
109 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
110 },
111 [C(OP_PREFETCH)] = {
112 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
113 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
114 },
115 },
116 [C(LL)] = {
117 [C(OP_READ)] = {
118 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
119 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
120 },
121 [C(OP_WRITE)] = {
122 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
123 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
124 },
125 [C(OP_PREFETCH)] = {
126 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
127 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
128 },
129 },
130 [C(DTLB)] = {
131 /*
132 * The ARM performance counters can count micro DTLB misses,
133 * micro ITLB misses and main TLB misses. There isn't an event
134 * for TLB misses, so use the micro misses here and if users
135 * want the main TLB misses they can use a raw counter.
136 */
137 [C(OP_READ)] = {
138 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
139 [C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
140 },
141 [C(OP_WRITE)] = {
142 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
143 [C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
144 },
145 [C(OP_PREFETCH)] = {
146 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
147 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
148 },
149 },
150 [C(ITLB)] = {
151 [C(OP_READ)] = {
152 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
153 [C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
154 },
155 [C(OP_WRITE)] = {
156 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
157 [C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
158 },
159 [C(OP_PREFETCH)] = {
160 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
161 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
162 },
163 },
164 [C(BPU)] = {
165 [C(OP_READ)] = {
166 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
167 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
168 },
169 [C(OP_WRITE)] = {
170 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
171 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
172 },
173 [C(OP_PREFETCH)] = {
174 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
175 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
176 },
177 },
178 [C(NODE)] = {
179 [C(OP_READ)] = {
180 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
181 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
182 },
183 [C(OP_WRITE)] = {
184 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
185 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
186 },
187 [C(OP_PREFETCH)] = {
188 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
189 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
190 },
191 },
192}; 105};
193 106
194enum armv6mpcore_perf_types { 107enum armv6mpcore_perf_types {
@@ -220,13 +133,11 @@ enum armv6mpcore_perf_types {
220 * accesses/misses in hardware. 133 * accesses/misses in hardware.
221 */ 134 */
222static const unsigned armv6mpcore_perf_map[PERF_COUNT_HW_MAX] = { 135static const unsigned armv6mpcore_perf_map[PERF_COUNT_HW_MAX] = {
136 PERF_MAP_ALL_UNSUPPORTED,
223 [PERF_COUNT_HW_CPU_CYCLES] = ARMV6MPCORE_PERFCTR_CPU_CYCLES, 137 [PERF_COUNT_HW_CPU_CYCLES] = ARMV6MPCORE_PERFCTR_CPU_CYCLES,
224 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_INSTR_EXEC, 138 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_INSTR_EXEC,
225 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
226 [PERF_COUNT_HW_CACHE_MISSES] = HW_OP_UNSUPPORTED,
227 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_BR_EXEC, 139 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_BR_EXEC,
228 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV6MPCORE_PERFCTR_BR_MISPREDICT, 140 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV6MPCORE_PERFCTR_BR_MISPREDICT,
229 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
230 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6MPCORE_PERFCTR_IBUF_STALL, 141 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6MPCORE_PERFCTR_IBUF_STALL,
231 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6MPCORE_PERFCTR_LSU_FULL_STALL, 142 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6MPCORE_PERFCTR_LSU_FULL_STALL,
232}; 143};
@@ -234,114 +145,26 @@ static const unsigned armv6mpcore_perf_map[PERF_COUNT_HW_MAX] = {
234static const unsigned armv6mpcore_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 145static const unsigned armv6mpcore_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
235 [PERF_COUNT_HW_CACHE_OP_MAX] 146 [PERF_COUNT_HW_CACHE_OP_MAX]
236 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 147 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
237 [C(L1D)] = { 148 PERF_CACHE_MAP_ALL_UNSUPPORTED,
238 [C(OP_READ)] = { 149
239 [C(RESULT_ACCESS)] = 150 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS,
240 ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS, 151 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DCACHE_RDMISS,
241 [C(RESULT_MISS)] = 152 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS,
242 ARMV6MPCORE_PERFCTR_DCACHE_RDMISS, 153 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DCACHE_WRMISS,
243 }, 154
244 [C(OP_WRITE)] = { 155 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ICACHE_MISS,
245 [C(RESULT_ACCESS)] = 156
246 ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS, 157 /*
247 [C(RESULT_MISS)] = 158 * The ARM performance counters can count micro DTLB misses, micro ITLB
248 ARMV6MPCORE_PERFCTR_DCACHE_WRMISS, 159 * misses and main TLB misses. There isn't an event for TLB misses, so
249 }, 160 * use the micro misses here and if users want the main TLB misses they
250 [C(OP_PREFETCH)] = { 161 * can use a raw counter.
251 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 162 */
252 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 163 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
253 }, 164 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
254 }, 165
255 [C(L1I)] = { 166 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
256 [C(OP_READ)] = { 167 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
257 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
258 [C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ICACHE_MISS,
259 },
260 [C(OP_WRITE)] = {
261 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
262 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
263 },
264 [C(OP_PREFETCH)] = {
265 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
266 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
267 },
268 },
269 [C(LL)] = {
270 [C(OP_READ)] = {
271 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
272 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
273 },
274 [C(OP_WRITE)] = {
275 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
276 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
277 },
278 [C(OP_PREFETCH)] = {
279 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
280 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
281 },
282 },
283 [C(DTLB)] = {
284 /*
285 * The ARM performance counters can count micro DTLB misses,
286 * micro ITLB misses and main TLB misses. There isn't an event
287 * for TLB misses, so use the micro misses here and if users
288 * want the main TLB misses they can use a raw counter.
289 */
290 [C(OP_READ)] = {
291 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
292 [C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
293 },
294 [C(OP_WRITE)] = {
295 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
296 [C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
297 },
298 [C(OP_PREFETCH)] = {
299 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
300 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
301 },
302 },
303 [C(ITLB)] = {
304 [C(OP_READ)] = {
305 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
306 [C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
307 },
308 [C(OP_WRITE)] = {
309 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
310 [C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
311 },
312 [C(OP_PREFETCH)] = {
313 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
314 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
315 },
316 },
317 [C(BPU)] = {
318 [C(OP_READ)] = {
319 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
320 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
321 },
322 [C(OP_WRITE)] = {
323 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
324 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
325 },
326 [C(OP_PREFETCH)] = {
327 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
328 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
329 },
330 },
331 [C(NODE)] = {
332 [C(OP_READ)] = {
333 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
334 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
335 },
336 [C(OP_WRITE)] = {
337 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
338 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
339 },
340 [C(OP_PREFETCH)] = {
341 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
342 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
343 },
344 },
345}; 168};
346 169
347static inline unsigned long 170static inline unsigned long
@@ -653,9 +476,8 @@ static int armv6_map_event(struct perf_event *event)
653 &armv6_perf_cache_map, 0xFF); 476 &armv6_perf_cache_map, 0xFF);
654} 477}
655 478
656static int armv6pmu_init(struct arm_pmu *cpu_pmu) 479static void armv6pmu_init(struct arm_pmu *cpu_pmu)
657{ 480{
658 cpu_pmu->name = "v6";
659 cpu_pmu->handle_irq = armv6pmu_handle_irq; 481 cpu_pmu->handle_irq = armv6pmu_handle_irq;
660 cpu_pmu->enable = armv6pmu_enable_event; 482 cpu_pmu->enable = armv6pmu_enable_event;
661 cpu_pmu->disable = armv6pmu_disable_event; 483 cpu_pmu->disable = armv6pmu_disable_event;
@@ -667,7 +489,26 @@ static int armv6pmu_init(struct arm_pmu *cpu_pmu)
667 cpu_pmu->map_event = armv6_map_event; 489 cpu_pmu->map_event = armv6_map_event;
668 cpu_pmu->num_events = 3; 490 cpu_pmu->num_events = 3;
669 cpu_pmu->max_period = (1LLU << 32) - 1; 491 cpu_pmu->max_period = (1LLU << 32) - 1;
492}
493
494static int armv6_1136_pmu_init(struct arm_pmu *cpu_pmu)
495{
496 armv6pmu_init(cpu_pmu);
497 cpu_pmu->name = "armv6_1136";
498 return 0;
499}
670 500
501static int armv6_1156_pmu_init(struct arm_pmu *cpu_pmu)
502{
503 armv6pmu_init(cpu_pmu);
504 cpu_pmu->name = "armv6_1156";
505 return 0;
506}
507
508static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu)
509{
510 armv6pmu_init(cpu_pmu);
511 cpu_pmu->name = "armv6_1176";
671 return 0; 512 return 0;
672} 513}
673 514
@@ -687,7 +528,7 @@ static int armv6mpcore_map_event(struct perf_event *event)
687 528
688static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) 529static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
689{ 530{
690 cpu_pmu->name = "v6mpcore"; 531 cpu_pmu->name = "armv6_11mpcore";
691 cpu_pmu->handle_irq = armv6pmu_handle_irq; 532 cpu_pmu->handle_irq = armv6pmu_handle_irq;
692 cpu_pmu->enable = armv6pmu_enable_event; 533 cpu_pmu->enable = armv6pmu_enable_event;
693 cpu_pmu->disable = armv6mpcore_pmu_disable_event; 534 cpu_pmu->disable = armv6mpcore_pmu_disable_event;
@@ -703,7 +544,17 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
703 return 0; 544 return 0;
704} 545}
705#else 546#else
706static int armv6pmu_init(struct arm_pmu *cpu_pmu) 547static int armv6_1136_pmu_init(struct arm_pmu *cpu_pmu)
548{
549 return -ENODEV;
550}
551
552static int armv6_1156_pmu_init(struct arm_pmu *cpu_pmu)
553{
554 return -ENODEV;
555}
556
557static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu)
707{ 558{
708 return -ENODEV; 559 return -ENODEV;
709} 560}
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 1d37568c547a..116758b77f93 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -148,137 +148,62 @@ enum krait_perf_types {
148 * accesses/misses in hardware. 148 * accesses/misses in hardware.
149 */ 149 */
150static const unsigned armv7_a8_perf_map[PERF_COUNT_HW_MAX] = { 150static const unsigned armv7_a8_perf_map[PERF_COUNT_HW_MAX] = {
151 PERF_MAP_ALL_UNSUPPORTED,
151 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 152 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
152 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 153 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
153 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 154 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
154 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 155 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
155 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 156 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
156 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 157 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
157 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
158 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A8_PERFCTR_STALL_ISIDE, 158 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A8_PERFCTR_STALL_ISIDE,
159 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
160}; 159};
161 160
162static const unsigned armv7_a8_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 161static const unsigned armv7_a8_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
163 [PERF_COUNT_HW_CACHE_OP_MAX] 162 [PERF_COUNT_HW_CACHE_OP_MAX]
164 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 163 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
165 [C(L1D)] = { 164 PERF_CACHE_MAP_ALL_UNSUPPORTED,
166 /* 165
167 * The performance counters don't differentiate between read 166 /*
168 * and write accesses/misses so this isn't strictly correct, 167 * The performance counters don't differentiate between read and write
169 * but it's the best we can do. Writes and reads get 168 * accesses/misses so this isn't strictly correct, but it's the best we
170 * combined. 169 * can do. Writes and reads get combined.
171 */ 170 */
172 [C(OP_READ)] = { 171 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
173 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 172 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
174 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 173 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
175 }, 174 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
176 [C(OP_WRITE)] = { 175
177 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 176 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L1_ICACHE_ACCESS,
178 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 177 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
179 }, 178
180 [C(OP_PREFETCH)] = { 179 [C(LL)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L2_CACHE_ACCESS,
181 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 180 [C(LL)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_A8_PERFCTR_L2_CACHE_REFILL,
182 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 181 [C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L2_CACHE_ACCESS,
183 }, 182 [C(LL)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_A8_PERFCTR_L2_CACHE_REFILL,
184 }, 183
185 [C(L1I)] = { 184 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
186 [C(OP_READ)] = { 185 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
187 [C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L1_ICACHE_ACCESS, 186
188 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 187 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
189 }, 188 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
190 [C(OP_WRITE)] = { 189
191 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 190 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
192 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 191 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
193 }, 192 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
194 [C(OP_PREFETCH)] = { 193 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
195 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
196 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
197 },
198 },
199 [C(LL)] = {
200 [C(OP_READ)] = {
201 [C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L2_CACHE_ACCESS,
202 [C(RESULT_MISS)] = ARMV7_A8_PERFCTR_L2_CACHE_REFILL,
203 },
204 [C(OP_WRITE)] = {
205 [C(RESULT_ACCESS)] = ARMV7_A8_PERFCTR_L2_CACHE_ACCESS,
206 [C(RESULT_MISS)] = ARMV7_A8_PERFCTR_L2_CACHE_REFILL,
207 },
208 [C(OP_PREFETCH)] = {
209 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
210 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
211 },
212 },
213 [C(DTLB)] = {
214 [C(OP_READ)] = {
215 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
216 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
217 },
218 [C(OP_WRITE)] = {
219 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
220 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
221 },
222 [C(OP_PREFETCH)] = {
223 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
224 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
225 },
226 },
227 [C(ITLB)] = {
228 [C(OP_READ)] = {
229 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
230 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
231 },
232 [C(OP_WRITE)] = {
233 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
234 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
235 },
236 [C(OP_PREFETCH)] = {
237 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
238 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
239 },
240 },
241 [C(BPU)] = {
242 [C(OP_READ)] = {
243 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
244 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
245 },
246 [C(OP_WRITE)] = {
247 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
248 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
249 },
250 [C(OP_PREFETCH)] = {
251 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
252 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
253 },
254 },
255 [C(NODE)] = {
256 [C(OP_READ)] = {
257 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
258 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
259 },
260 [C(OP_WRITE)] = {
261 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
262 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
263 },
264 [C(OP_PREFETCH)] = {
265 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
266 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
267 },
268 },
269}; 194};
270 195
271/* 196/*
272 * Cortex-A9 HW events mapping 197 * Cortex-A9 HW events mapping
273 */ 198 */
274static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = { 199static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
200 PERF_MAP_ALL_UNSUPPORTED,
275 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 201 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
276 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_A9_PERFCTR_INSTR_CORE_RENAME, 202 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_A9_PERFCTR_INSTR_CORE_RENAME,
277 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 203 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
278 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 204 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
279 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 205 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
280 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 206 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
281 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
282 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A9_PERFCTR_STALL_ICACHE, 207 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV7_A9_PERFCTR_STALL_ICACHE,
283 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV7_A9_PERFCTR_STALL_DISPATCH, 208 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV7_A9_PERFCTR_STALL_DISPATCH,
284}; 209};
@@ -286,238 +211,83 @@ static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
286static const unsigned armv7_a9_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 211static const unsigned armv7_a9_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
287 [PERF_COUNT_HW_CACHE_OP_MAX] 212 [PERF_COUNT_HW_CACHE_OP_MAX]
288 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 213 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
289 [C(L1D)] = { 214 PERF_CACHE_MAP_ALL_UNSUPPORTED,
290 /* 215
291 * The performance counters don't differentiate between read 216 /*
292 * and write accesses/misses so this isn't strictly correct, 217 * The performance counters don't differentiate between read and write
293 * but it's the best we can do. Writes and reads get 218 * accesses/misses so this isn't strictly correct, but it's the best we
294 * combined. 219 * can do. Writes and reads get combined.
295 */ 220 */
296 [C(OP_READ)] = { 221 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
297 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 222 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
298 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 223 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
299 }, 224 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
300 [C(OP_WRITE)] = { 225
301 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 226 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
302 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 227
303 }, 228 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
304 [C(OP_PREFETCH)] = { 229 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
305 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 230
306 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 231 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
307 }, 232 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
308 }, 233
309 [C(L1I)] = { 234 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
310 [C(OP_READ)] = { 235 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
311 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 236 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
312 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 237 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
313 },
314 [C(OP_WRITE)] = {
315 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
316 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
317 },
318 [C(OP_PREFETCH)] = {
319 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
320 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
321 },
322 },
323 [C(LL)] = {
324 [C(OP_READ)] = {
325 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
326 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
327 },
328 [C(OP_WRITE)] = {
329 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
330 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
331 },
332 [C(OP_PREFETCH)] = {
333 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
334 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
335 },
336 },
337 [C(DTLB)] = {
338 [C(OP_READ)] = {
339 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
340 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
341 },
342 [C(OP_WRITE)] = {
343 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
344 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
345 },
346 [C(OP_PREFETCH)] = {
347 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
348 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
349 },
350 },
351 [C(ITLB)] = {
352 [C(OP_READ)] = {
353 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
354 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
355 },
356 [C(OP_WRITE)] = {
357 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
358 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
359 },
360 [C(OP_PREFETCH)] = {
361 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
362 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
363 },
364 },
365 [C(BPU)] = {
366 [C(OP_READ)] = {
367 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
368 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
369 },
370 [C(OP_WRITE)] = {
371 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
372 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
373 },
374 [C(OP_PREFETCH)] = {
375 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
376 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
377 },
378 },
379 [C(NODE)] = {
380 [C(OP_READ)] = {
381 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
382 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
383 },
384 [C(OP_WRITE)] = {
385 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
386 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
387 },
388 [C(OP_PREFETCH)] = {
389 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
390 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
391 },
392 },
393}; 238};
394 239
395/* 240/*
396 * Cortex-A5 HW events mapping 241 * Cortex-A5 HW events mapping
397 */ 242 */
398static const unsigned armv7_a5_perf_map[PERF_COUNT_HW_MAX] = { 243static const unsigned armv7_a5_perf_map[PERF_COUNT_HW_MAX] = {
244 PERF_MAP_ALL_UNSUPPORTED,
399 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 245 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
400 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 246 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
401 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 247 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
402 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 248 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
403 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 249 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
404 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 250 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
405 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
406 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED,
407 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
408}; 251};
409 252
410static const unsigned armv7_a5_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 253static const unsigned armv7_a5_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
411 [PERF_COUNT_HW_CACHE_OP_MAX] 254 [PERF_COUNT_HW_CACHE_OP_MAX]
412 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 255 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
413 [C(L1D)] = { 256 PERF_CACHE_MAP_ALL_UNSUPPORTED,
414 [C(OP_READ)] = { 257
415 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 258 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
416 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 259 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
417 }, 260 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
418 [C(OP_WRITE)] = { 261 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
419 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 262 [C(L1D)][C(OP_PREFETCH)][C(RESULT_ACCESS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL,
420 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 263 [C(L1D)][C(OP_PREFETCH)][C(RESULT_MISS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL_DROP,
421 }, 264
422 [C(OP_PREFETCH)] = { 265 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
423 [C(RESULT_ACCESS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL, 266 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
424 [C(RESULT_MISS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL_DROP, 267 /*
425 }, 268 * The prefetch counters don't differentiate between the I side and the
426 }, 269 * D side.
427 [C(L1I)] = { 270 */
428 [C(OP_READ)] = { 271 [C(L1I)][C(OP_PREFETCH)][C(RESULT_ACCESS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL,
429 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, 272 [C(L1I)][C(OP_PREFETCH)][C(RESULT_MISS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL_DROP,
430 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 273
431 }, 274 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
432 [C(OP_WRITE)] = { 275 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
433 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 276
434 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 277 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
435 }, 278 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
436 /* 279
437 * The prefetch counters don't differentiate between the I 280 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
438 * side and the D side. 281 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
439 */ 282 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
440 [C(OP_PREFETCH)] = { 283 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
441 [C(RESULT_ACCESS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL,
442 [C(RESULT_MISS)] = ARMV7_A5_PERFCTR_PREFETCH_LINEFILL_DROP,
443 },
444 },
445 [C(LL)] = {
446 [C(OP_READ)] = {
447 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
448 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
449 },
450 [C(OP_WRITE)] = {
451 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
452 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
453 },
454 [C(OP_PREFETCH)] = {
455 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
456 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
457 },
458 },
459 [C(DTLB)] = {
460 [C(OP_READ)] = {
461 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
462 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
463 },
464 [C(OP_WRITE)] = {
465 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
466 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
467 },
468 [C(OP_PREFETCH)] = {
469 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
470 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
471 },
472 },
473 [C(ITLB)] = {
474 [C(OP_READ)] = {
475 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
476 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
477 },
478 [C(OP_WRITE)] = {
479 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
480 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
481 },
482 [C(OP_PREFETCH)] = {
483 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
484 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
485 },
486 },
487 [C(BPU)] = {
488 [C(OP_READ)] = {
489 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
490 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
491 },
492 [C(OP_WRITE)] = {
493 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
494 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
495 },
496 [C(OP_PREFETCH)] = {
497 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
498 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
499 },
500 },
501 [C(NODE)] = {
502 [C(OP_READ)] = {
503 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
504 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
505 },
506 [C(OP_WRITE)] = {
507 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
508 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
509 },
510 [C(OP_PREFETCH)] = {
511 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
512 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
513 },
514 },
515}; 284};
516 285
517/* 286/*
518 * Cortex-A15 HW events mapping 287 * Cortex-A15 HW events mapping
519 */ 288 */
520static const unsigned armv7_a15_perf_map[PERF_COUNT_HW_MAX] = { 289static const unsigned armv7_a15_perf_map[PERF_COUNT_HW_MAX] = {
290 PERF_MAP_ALL_UNSUPPORTED,
521 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 291 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
522 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 292 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
523 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 293 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
@@ -525,123 +295,48 @@ static const unsigned armv7_a15_perf_map[PERF_COUNT_HW_MAX] = {
525 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_A15_PERFCTR_PC_WRITE_SPEC, 295 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_A15_PERFCTR_PC_WRITE_SPEC,
526 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 296 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
527 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, 297 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES,
528 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED,
529 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
530}; 298};
531 299
532static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 300static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
533 [PERF_COUNT_HW_CACHE_OP_MAX] 301 [PERF_COUNT_HW_CACHE_OP_MAX]
534 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 302 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
535 [C(L1D)] = { 303 PERF_CACHE_MAP_ALL_UNSUPPORTED,
536 [C(OP_READ)] = { 304
537 [C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L1_DCACHE_ACCESS_READ, 305 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L1_DCACHE_ACCESS_READ,
538 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L1_DCACHE_REFILL_READ, 306 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L1_DCACHE_REFILL_READ,
539 }, 307 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L1_DCACHE_ACCESS_WRITE,
540 [C(OP_WRITE)] = { 308 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L1_DCACHE_REFILL_WRITE,
541 [C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L1_DCACHE_ACCESS_WRITE, 309
542 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L1_DCACHE_REFILL_WRITE, 310 /*
543 }, 311 * Not all performance counters differentiate between read and write
544 [C(OP_PREFETCH)] = { 312 * accesses/misses so we're not always strictly correct, but it's the
545 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 313 * best we can do. Writes and reads get combined in these cases.
546 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 314 */
547 }, 315 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
548 }, 316 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
549 [C(L1I)] = { 317
550 /* 318 [C(LL)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L2_CACHE_ACCESS_READ,
551 * Not all performance counters differentiate between read 319 [C(LL)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L2_CACHE_REFILL_READ,
552 * and write accesses/misses so we're not always strictly 320 [C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L2_CACHE_ACCESS_WRITE,
553 * correct, but it's the best we can do. Writes and reads get 321 [C(LL)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L2_CACHE_REFILL_WRITE,
554 * combined in these cases. 322
555 */ 323 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_DTLB_REFILL_L1_READ,
556 [C(OP_READ)] = { 324 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_A15_PERFCTR_DTLB_REFILL_L1_WRITE,
557 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, 325
558 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 326 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
559 }, 327 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
560 [C(OP_WRITE)] = { 328
561 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 329 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
562 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 330 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
563 }, 331 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
564 [C(OP_PREFETCH)] = { 332 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
565 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
566 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
567 },
568 },
569 [C(LL)] = {
570 [C(OP_READ)] = {
571 [C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L2_CACHE_ACCESS_READ,
572 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L2_CACHE_REFILL_READ,
573 },
574 [C(OP_WRITE)] = {
575 [C(RESULT_ACCESS)] = ARMV7_A15_PERFCTR_L2_CACHE_ACCESS_WRITE,
576 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_L2_CACHE_REFILL_WRITE,
577 },
578 [C(OP_PREFETCH)] = {
579 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
580 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
581 },
582 },
583 [C(DTLB)] = {
584 [C(OP_READ)] = {
585 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
586 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_DTLB_REFILL_L1_READ,
587 },
588 [C(OP_WRITE)] = {
589 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
590 [C(RESULT_MISS)] = ARMV7_A15_PERFCTR_DTLB_REFILL_L1_WRITE,
591 },
592 [C(OP_PREFETCH)] = {
593 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
594 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
595 },
596 },
597 [C(ITLB)] = {
598 [C(OP_READ)] = {
599 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
600 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
601 },
602 [C(OP_WRITE)] = {
603 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
604 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
605 },
606 [C(OP_PREFETCH)] = {
607 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
608 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
609 },
610 },
611 [C(BPU)] = {
612 [C(OP_READ)] = {
613 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
614 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
615 },
616 [C(OP_WRITE)] = {
617 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
618 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
619 },
620 [C(OP_PREFETCH)] = {
621 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
622 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
623 },
624 },
625 [C(NODE)] = {
626 [C(OP_READ)] = {
627 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
628 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
629 },
630 [C(OP_WRITE)] = {
631 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
632 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
633 },
634 [C(OP_PREFETCH)] = {
635 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
636 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
637 },
638 },
639}; 333};
640 334
641/* 335/*
642 * Cortex-A7 HW events mapping 336 * Cortex-A7 HW events mapping
643 */ 337 */
644static const unsigned armv7_a7_perf_map[PERF_COUNT_HW_MAX] = { 338static const unsigned armv7_a7_perf_map[PERF_COUNT_HW_MAX] = {
339 PERF_MAP_ALL_UNSUPPORTED,
645 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 340 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
646 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 341 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
647 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 342 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
@@ -649,123 +344,48 @@ static const unsigned armv7_a7_perf_map[PERF_COUNT_HW_MAX] = {
649 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 344 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
650 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 345 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
651 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, 346 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES,
652 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED,
653 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
654}; 347};
655 348
656static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 349static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
657 [PERF_COUNT_HW_CACHE_OP_MAX] 350 [PERF_COUNT_HW_CACHE_OP_MAX]
658 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 351 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
659 [C(L1D)] = { 352 PERF_CACHE_MAP_ALL_UNSUPPORTED,
660 /* 353
661 * The performance counters don't differentiate between read 354 /*
662 * and write accesses/misses so this isn't strictly correct, 355 * The performance counters don't differentiate between read and write
663 * but it's the best we can do. Writes and reads get 356 * accesses/misses so this isn't strictly correct, but it's the best we
664 * combined. 357 * can do. Writes and reads get combined.
665 */ 358 */
666 [C(OP_READ)] = { 359 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
667 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 360 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
668 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 361 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
669 }, 362 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
670 [C(OP_WRITE)] = { 363
671 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 364 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
672 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 365 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
673 }, 366
674 [C(OP_PREFETCH)] = { 367 [C(LL)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
675 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 368 [C(LL)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
676 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 369 [C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
677 }, 370 [C(LL)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
678 }, 371
679 [C(L1I)] = { 372 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
680 [C(OP_READ)] = { 373 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
681 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, 374
682 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 375 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
683 }, 376 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
684 [C(OP_WRITE)] = { 377
685 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 378 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
686 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 379 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
687 }, 380 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
688 [C(OP_PREFETCH)] = { 381 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
689 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
690 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
691 },
692 },
693 [C(LL)] = {
694 [C(OP_READ)] = {
695 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
696 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
697 },
698 [C(OP_WRITE)] = {
699 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
700 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
701 },
702 [C(OP_PREFETCH)] = {
703 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
704 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
705 },
706 },
707 [C(DTLB)] = {
708 [C(OP_READ)] = {
709 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
710 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
711 },
712 [C(OP_WRITE)] = {
713 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
714 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
715 },
716 [C(OP_PREFETCH)] = {
717 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
718 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
719 },
720 },
721 [C(ITLB)] = {
722 [C(OP_READ)] = {
723 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
724 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
725 },
726 [C(OP_WRITE)] = {
727 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
728 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
729 },
730 [C(OP_PREFETCH)] = {
731 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
732 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
733 },
734 },
735 [C(BPU)] = {
736 [C(OP_READ)] = {
737 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
738 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
739 },
740 [C(OP_WRITE)] = {
741 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
742 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
743 },
744 [C(OP_PREFETCH)] = {
745 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
746 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
747 },
748 },
749 [C(NODE)] = {
750 [C(OP_READ)] = {
751 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
752 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
753 },
754 [C(OP_WRITE)] = {
755 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
756 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
757 },
758 [C(OP_PREFETCH)] = {
759 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
760 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
761 },
762 },
763}; 382};
764 383
765/* 384/*
766 * Cortex-A12 HW events mapping 385 * Cortex-A12 HW events mapping
767 */ 386 */
768static const unsigned armv7_a12_perf_map[PERF_COUNT_HW_MAX] = { 387static const unsigned armv7_a12_perf_map[PERF_COUNT_HW_MAX] = {
388 PERF_MAP_ALL_UNSUPPORTED,
769 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 389 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
770 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 390 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
771 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 391 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
@@ -773,138 +393,60 @@ static const unsigned armv7_a12_perf_map[PERF_COUNT_HW_MAX] = {
773 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_A12_PERFCTR_PC_WRITE_SPEC, 393 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_A12_PERFCTR_PC_WRITE_SPEC,
774 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 394 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
775 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, 395 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES,
776 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED,
777 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
778}; 396};
779 397
780static const unsigned armv7_a12_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 398static const unsigned armv7_a12_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
781 [PERF_COUNT_HW_CACHE_OP_MAX] 399 [PERF_COUNT_HW_CACHE_OP_MAX]
782 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 400 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
783 [C(L1D)] = { 401 PERF_CACHE_MAP_ALL_UNSUPPORTED,
784 [C(OP_READ)] = { 402
785 [C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L1_DCACHE_ACCESS_READ, 403 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L1_DCACHE_ACCESS_READ,
786 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 404 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
787 }, 405 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L1_DCACHE_ACCESS_WRITE,
788 [C(OP_WRITE)] = { 406 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
789 [C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L1_DCACHE_ACCESS_WRITE, 407
790 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 408 /*
791 }, 409 * Not all performance counters differentiate between read and write
792 [C(OP_PREFETCH)] = { 410 * accesses/misses so we're not always strictly correct, but it's the
793 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 411 * best we can do. Writes and reads get combined in these cases.
794 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 412 */
795 }, 413 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
796 }, 414 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
797 [C(L1I)] = { 415
798 /* 416 [C(LL)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L2_CACHE_ACCESS_READ,
799 * Not all performance counters differentiate between read 417 [C(LL)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
800 * and write accesses/misses so we're not always strictly 418 [C(LL)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L2_CACHE_ACCESS_WRITE,
801 * correct, but it's the best we can do. Writes and reads get 419 [C(LL)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
802 * combined in these cases. 420
803 */ 421 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
804 [C(OP_READ)] = { 422 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
805 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, 423 [C(DTLB)][C(OP_PREFETCH)][C(RESULT_MISS)] = ARMV7_A12_PERFCTR_PF_TLB_REFILL,
806 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, 424
807 }, 425 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
808 [C(OP_WRITE)] = { 426 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
809 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 427
810 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 428 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
811 }, 429 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
812 [C(OP_PREFETCH)] = { 430 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
813 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 431 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
814 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
815 },
816 },
817 [C(LL)] = {
818 [C(OP_READ)] = {
819 [C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L2_CACHE_ACCESS_READ,
820 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
821 },
822 [C(OP_WRITE)] = {
823 [C(RESULT_ACCESS)] = ARMV7_A12_PERFCTR_L2_CACHE_ACCESS_WRITE,
824 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
825 },
826 [C(OP_PREFETCH)] = {
827 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
828 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
829 },
830 },
831 [C(DTLB)] = {
832 [C(OP_READ)] = {
833 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
834 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
835 },
836 [C(OP_WRITE)] = {
837 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
838 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
839 },
840 [C(OP_PREFETCH)] = {
841 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
842 [C(RESULT_MISS)] = ARMV7_A12_PERFCTR_PF_TLB_REFILL,
843 },
844 },
845 [C(ITLB)] = {
846 [C(OP_READ)] = {
847 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
848 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
849 },
850 [C(OP_WRITE)] = {
851 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
852 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
853 },
854 [C(OP_PREFETCH)] = {
855 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
856 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
857 },
858 },
859 [C(BPU)] = {
860 [C(OP_READ)] = {
861 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
862 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
863 },
864 [C(OP_WRITE)] = {
865 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
866 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
867 },
868 [C(OP_PREFETCH)] = {
869 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
870 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
871 },
872 },
873 [C(NODE)] = {
874 [C(OP_READ)] = {
875 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
876 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
877 },
878 [C(OP_WRITE)] = {
879 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
880 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
881 },
882 [C(OP_PREFETCH)] = {
883 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
884 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
885 },
886 },
887}; 432};
888 433
889/* 434/*
890 * Krait HW events mapping 435 * Krait HW events mapping
891 */ 436 */
892static const unsigned krait_perf_map[PERF_COUNT_HW_MAX] = { 437static const unsigned krait_perf_map[PERF_COUNT_HW_MAX] = {
438 PERF_MAP_ALL_UNSUPPORTED,
893 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 439 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
894 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 440 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
895 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
896 [PERF_COUNT_HW_CACHE_MISSES] = HW_OP_UNSUPPORTED,
897 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 441 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
898 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 442 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
899 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES, 443 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES,
900}; 444};
901 445
902static const unsigned krait_perf_map_no_branch[PERF_COUNT_HW_MAX] = { 446static const unsigned krait_perf_map_no_branch[PERF_COUNT_HW_MAX] = {
447 PERF_MAP_ALL_UNSUPPORTED,
903 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 448 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
904 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, 449 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
905 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
906 [PERF_COUNT_HW_CACHE_MISSES] = HW_OP_UNSUPPORTED,
907 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = HW_OP_UNSUPPORTED,
908 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 450 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
909 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES, 451 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES,
910}; 452};
@@ -912,110 +454,31 @@ static const unsigned krait_perf_map_no_branch[PERF_COUNT_HW_MAX] = {
912static const unsigned krait_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 454static const unsigned krait_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
913 [PERF_COUNT_HW_CACHE_OP_MAX] 455 [PERF_COUNT_HW_CACHE_OP_MAX]
914 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 456 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
915 [C(L1D)] = { 457 PERF_CACHE_MAP_ALL_UNSUPPORTED,
916 /* 458
917 * The performance counters don't differentiate between read 459 /*
918 * and write accesses/misses so this isn't strictly correct, 460 * The performance counters don't differentiate between read and write
919 * but it's the best we can do. Writes and reads get 461 * accesses/misses so this isn't strictly correct, but it's the best we
920 * combined. 462 * can do. Writes and reads get combined.
921 */ 463 */
922 [C(OP_READ)] = { 464 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
923 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 465 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
924 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 466 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
925 }, 467 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
926 [C(OP_WRITE)] = { 468
927 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, 469 [C(L1I)][C(OP_READ)][C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ICACHE_ACCESS,
928 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, 470 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = KRAIT_PERFCTR_L1_ICACHE_MISS,
929 }, 471
930 [C(OP_PREFETCH)] = { 472 [C(DTLB)][C(OP_READ)][C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_DTLB_ACCESS,
931 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 473 [C(DTLB)][C(OP_WRITE)][C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_DTLB_ACCESS,
932 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 474
933 }, 475 [C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ITLB_ACCESS,
934 }, 476 [C(ITLB)][C(OP_WRITE)][C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ITLB_ACCESS,
935 [C(L1I)] = { 477
936 [C(OP_READ)] = { 478 [C(BPU)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
937 [C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ICACHE_ACCESS, 479 [C(BPU)][C(OP_READ)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
938 [C(RESULT_MISS)] = KRAIT_PERFCTR_L1_ICACHE_MISS, 480 [C(BPU)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
939 }, 481 [C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
940 [C(OP_WRITE)] = {
941 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
942 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
943 },
944 [C(OP_PREFETCH)] = {
945 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
946 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
947 },
948 },
949 [C(LL)] = {
950 [C(OP_READ)] = {
951 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
952 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
953 },
954 [C(OP_WRITE)] = {
955 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
956 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
957 },
958 [C(OP_PREFETCH)] = {
959 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
960 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
961 },
962 },
963 [C(DTLB)] = {
964 [C(OP_READ)] = {
965 [C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_DTLB_ACCESS,
966 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
967 },
968 [C(OP_WRITE)] = {
969 [C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_DTLB_ACCESS,
970 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
971 },
972 [C(OP_PREFETCH)] = {
973 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
974 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
975 },
976 },
977 [C(ITLB)] = {
978 [C(OP_READ)] = {
979 [C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ITLB_ACCESS,
980 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
981 },
982 [C(OP_WRITE)] = {
983 [C(RESULT_ACCESS)] = KRAIT_PERFCTR_L1_ITLB_ACCESS,
984 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
985 },
986 [C(OP_PREFETCH)] = {
987 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
988 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
989 },
990 },
991 [C(BPU)] = {
992 [C(OP_READ)] = {
993 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
994 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
995 },
996 [C(OP_WRITE)] = {
997 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
998 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
999 },
1000 [C(OP_PREFETCH)] = {
1001 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
1002 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
1003 },
1004 },
1005 [C(NODE)] = {
1006 [C(OP_READ)] = {
1007 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
1008 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
1009 },
1010 [C(OP_WRITE)] = {
1011 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
1012 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
1013 },
1014 [C(OP_PREFETCH)] = {
1015 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
1016 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
1017 },
1018 },
1019}; 482};
1020 483
1021/* 484/*
@@ -1545,7 +1008,7 @@ static u32 armv7_read_num_pmnc_events(void)
1545static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu) 1008static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1546{ 1009{
1547 armv7pmu_init(cpu_pmu); 1010 armv7pmu_init(cpu_pmu);
1548 cpu_pmu->name = "ARMv7 Cortex-A8"; 1011 cpu_pmu->name = "armv7_cortex_a8";
1549 cpu_pmu->map_event = armv7_a8_map_event; 1012 cpu_pmu->map_event = armv7_a8_map_event;
1550 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1013 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1551 return 0; 1014 return 0;
@@ -1554,7 +1017,7 @@ static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1554static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu) 1017static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1555{ 1018{
1556 armv7pmu_init(cpu_pmu); 1019 armv7pmu_init(cpu_pmu);
1557 cpu_pmu->name = "ARMv7 Cortex-A9"; 1020 cpu_pmu->name = "armv7_cortex_a9";
1558 cpu_pmu->map_event = armv7_a9_map_event; 1021 cpu_pmu->map_event = armv7_a9_map_event;
1559 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1022 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1560 return 0; 1023 return 0;
@@ -1563,7 +1026,7 @@ static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1563static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu) 1026static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1564{ 1027{
1565 armv7pmu_init(cpu_pmu); 1028 armv7pmu_init(cpu_pmu);
1566 cpu_pmu->name = "ARMv7 Cortex-A5"; 1029 cpu_pmu->name = "armv7_cortex_a5";
1567 cpu_pmu->map_event = armv7_a5_map_event; 1030 cpu_pmu->map_event = armv7_a5_map_event;
1568 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1031 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1569 return 0; 1032 return 0;
@@ -1572,7 +1035,7 @@ static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1572static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu) 1035static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1573{ 1036{
1574 armv7pmu_init(cpu_pmu); 1037 armv7pmu_init(cpu_pmu);
1575 cpu_pmu->name = "ARMv7 Cortex-A15"; 1038 cpu_pmu->name = "armv7_cortex_a15";
1576 cpu_pmu->map_event = armv7_a15_map_event; 1039 cpu_pmu->map_event = armv7_a15_map_event;
1577 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1040 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1578 cpu_pmu->set_event_filter = armv7pmu_set_event_filter; 1041 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
@@ -1582,7 +1045,7 @@ static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1582static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu) 1045static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1583{ 1046{
1584 armv7pmu_init(cpu_pmu); 1047 armv7pmu_init(cpu_pmu);
1585 cpu_pmu->name = "ARMv7 Cortex-A7"; 1048 cpu_pmu->name = "armv7_cortex_a7";
1586 cpu_pmu->map_event = armv7_a7_map_event; 1049 cpu_pmu->map_event = armv7_a7_map_event;
1587 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1050 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1588 cpu_pmu->set_event_filter = armv7pmu_set_event_filter; 1051 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
@@ -1592,7 +1055,7 @@ static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1592static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu) 1055static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu)
1593{ 1056{
1594 armv7pmu_init(cpu_pmu); 1057 armv7pmu_init(cpu_pmu);
1595 cpu_pmu->name = "ARMv7 Cortex-A12"; 1058 cpu_pmu->name = "armv7_cortex_a12";
1596 cpu_pmu->map_event = armv7_a12_map_event; 1059 cpu_pmu->map_event = armv7_a12_map_event;
1597 cpu_pmu->num_events = armv7_read_num_pmnc_events(); 1060 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1598 cpu_pmu->set_event_filter = armv7pmu_set_event_filter; 1061 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
@@ -1602,7 +1065,7 @@ static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu)
1602static int armv7_a17_pmu_init(struct arm_pmu *cpu_pmu) 1065static int armv7_a17_pmu_init(struct arm_pmu *cpu_pmu)
1603{ 1066{
1604 armv7_a12_pmu_init(cpu_pmu); 1067 armv7_a12_pmu_init(cpu_pmu);
1605 cpu_pmu->name = "ARMv7 Cortex-A17"; 1068 cpu_pmu->name = "armv7_cortex_a17";
1606 return 0; 1069 return 0;
1607} 1070}
1608 1071
@@ -1823,6 +1286,7 @@ static void krait_pmu_disable_event(struct perf_event *event)
1823 unsigned long flags; 1286 unsigned long flags;
1824 struct hw_perf_event *hwc = &event->hw; 1287 struct hw_perf_event *hwc = &event->hw;
1825 int idx = hwc->idx; 1288 int idx = hwc->idx;
1289 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1826 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1290 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
1827 1291
1828 /* Disable counter and interrupt */ 1292 /* Disable counter and interrupt */
@@ -1848,6 +1312,7 @@ static void krait_pmu_enable_event(struct perf_event *event)
1848 unsigned long flags; 1312 unsigned long flags;
1849 struct hw_perf_event *hwc = &event->hw; 1313 struct hw_perf_event *hwc = &event->hw;
1850 int idx = hwc->idx; 1314 int idx = hwc->idx;
1315 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1851 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1316 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
1852 1317
1853 /* 1318 /*
@@ -1981,7 +1446,7 @@ static void krait_pmu_clear_event_idx(struct pmu_hw_events *cpuc,
1981static int krait_pmu_init(struct arm_pmu *cpu_pmu) 1446static int krait_pmu_init(struct arm_pmu *cpu_pmu)
1982{ 1447{
1983 armv7pmu_init(cpu_pmu); 1448 armv7pmu_init(cpu_pmu);
1984 cpu_pmu->name = "ARMv7 Krait"; 1449 cpu_pmu->name = "armv7_krait";
1985 /* Some early versions of Krait don't support PC write events */ 1450 /* Some early versions of Krait don't support PC write events */
1986 if (of_property_read_bool(cpu_pmu->plat_device->dev.of_node, 1451 if (of_property_read_bool(cpu_pmu->plat_device->dev.of_node,
1987 "qcom,no-pc-write")) 1452 "qcom,no-pc-write"))
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 63990c42fac9..08da0af550b7 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -48,118 +48,31 @@ enum xscale_counters {
48}; 48};
49 49
50static const unsigned xscale_perf_map[PERF_COUNT_HW_MAX] = { 50static const unsigned xscale_perf_map[PERF_COUNT_HW_MAX] = {
51 PERF_MAP_ALL_UNSUPPORTED,
51 [PERF_COUNT_HW_CPU_CYCLES] = XSCALE_PERFCTR_CCNT, 52 [PERF_COUNT_HW_CPU_CYCLES] = XSCALE_PERFCTR_CCNT,
52 [PERF_COUNT_HW_INSTRUCTIONS] = XSCALE_PERFCTR_INSTRUCTION, 53 [PERF_COUNT_HW_INSTRUCTIONS] = XSCALE_PERFCTR_INSTRUCTION,
53 [PERF_COUNT_HW_CACHE_REFERENCES] = HW_OP_UNSUPPORTED,
54 [PERF_COUNT_HW_CACHE_MISSES] = HW_OP_UNSUPPORTED,
55 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = XSCALE_PERFCTR_BRANCH, 54 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = XSCALE_PERFCTR_BRANCH,
56 [PERF_COUNT_HW_BRANCH_MISSES] = XSCALE_PERFCTR_BRANCH_MISS, 55 [PERF_COUNT_HW_BRANCH_MISSES] = XSCALE_PERFCTR_BRANCH_MISS,
57 [PERF_COUNT_HW_BUS_CYCLES] = HW_OP_UNSUPPORTED,
58 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = XSCALE_PERFCTR_ICACHE_NO_DELIVER, 56 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = XSCALE_PERFCTR_ICACHE_NO_DELIVER,
59 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
60}; 57};
61 58
62static const unsigned xscale_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] 59static const unsigned xscale_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
63 [PERF_COUNT_HW_CACHE_OP_MAX] 60 [PERF_COUNT_HW_CACHE_OP_MAX]
64 [PERF_COUNT_HW_CACHE_RESULT_MAX] = { 61 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
65 [C(L1D)] = { 62 PERF_CACHE_MAP_ALL_UNSUPPORTED,
66 [C(OP_READ)] = { 63
67 [C(RESULT_ACCESS)] = XSCALE_PERFCTR_DCACHE_ACCESS, 64 [C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = XSCALE_PERFCTR_DCACHE_ACCESS,
68 [C(RESULT_MISS)] = XSCALE_PERFCTR_DCACHE_MISS, 65 [C(L1D)][C(OP_READ)][C(RESULT_MISS)] = XSCALE_PERFCTR_DCACHE_MISS,
69 }, 66 [C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = XSCALE_PERFCTR_DCACHE_ACCESS,
70 [C(OP_WRITE)] = { 67 [C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = XSCALE_PERFCTR_DCACHE_MISS,
71 [C(RESULT_ACCESS)] = XSCALE_PERFCTR_DCACHE_ACCESS, 68
72 [C(RESULT_MISS)] = XSCALE_PERFCTR_DCACHE_MISS, 69 [C(L1I)][C(OP_READ)][C(RESULT_MISS)] = XSCALE_PERFCTR_ICACHE_MISS,
73 }, 70
74 [C(OP_PREFETCH)] = { 71 [C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = XSCALE_PERFCTR_DTLB_MISS,
75 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, 72 [C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = XSCALE_PERFCTR_DTLB_MISS,
76 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, 73
77 }, 74 [C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = XSCALE_PERFCTR_ITLB_MISS,
78 }, 75 [C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = XSCALE_PERFCTR_ITLB_MISS,
79 [C(L1I)] = {
80 [C(OP_READ)] = {
81 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
82 [C(RESULT_MISS)] = XSCALE_PERFCTR_ICACHE_MISS,
83 },
84 [C(OP_WRITE)] = {
85 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
86 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
87 },
88 [C(OP_PREFETCH)] = {
89 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
90 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
91 },
92 },
93 [C(LL)] = {
94 [C(OP_READ)] = {
95 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
96 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
97 },
98 [C(OP_WRITE)] = {
99 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
100 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
101 },
102 [C(OP_PREFETCH)] = {
103 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
104 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
105 },
106 },
107 [C(DTLB)] = {
108 [C(OP_READ)] = {
109 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
110 [C(RESULT_MISS)] = XSCALE_PERFCTR_DTLB_MISS,
111 },
112 [C(OP_WRITE)] = {
113 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
114 [C(RESULT_MISS)] = XSCALE_PERFCTR_DTLB_MISS,
115 },
116 [C(OP_PREFETCH)] = {
117 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
118 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
119 },
120 },
121 [C(ITLB)] = {
122 [C(OP_READ)] = {
123 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
124 [C(RESULT_MISS)] = XSCALE_PERFCTR_ITLB_MISS,
125 },
126 [C(OP_WRITE)] = {
127 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
128 [C(RESULT_MISS)] = XSCALE_PERFCTR_ITLB_MISS,
129 },
130 [C(OP_PREFETCH)] = {
131 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
132 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
133 },
134 },
135 [C(BPU)] = {
136 [C(OP_READ)] = {
137 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
138 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
139 },
140 [C(OP_WRITE)] = {
141 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
142 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
143 },
144 [C(OP_PREFETCH)] = {
145 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
146 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
147 },
148 },
149 [C(NODE)] = {
150 [C(OP_READ)] = {
151 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
152 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
153 },
154 [C(OP_WRITE)] = {
155 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
156 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
157 },
158 [C(OP_PREFETCH)] = {
159 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
160 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
161 },
162 },
163}; 76};
164 77
165#define XSCALE_PMU_ENABLE 0x001 78#define XSCALE_PMU_ENABLE 0x001
@@ -442,7 +355,7 @@ static int xscale_map_event(struct perf_event *event)
442 355
443static int xscale1pmu_init(struct arm_pmu *cpu_pmu) 356static int xscale1pmu_init(struct arm_pmu *cpu_pmu)
444{ 357{
445 cpu_pmu->name = "xscale1"; 358 cpu_pmu->name = "armv5_xscale1";
446 cpu_pmu->handle_irq = xscale1pmu_handle_irq; 359 cpu_pmu->handle_irq = xscale1pmu_handle_irq;
447 cpu_pmu->enable = xscale1pmu_enable_event; 360 cpu_pmu->enable = xscale1pmu_enable_event;
448 cpu_pmu->disable = xscale1pmu_disable_event; 361 cpu_pmu->disable = xscale1pmu_disable_event;
@@ -812,7 +725,7 @@ static inline void xscale2pmu_write_counter(struct perf_event *event, u32 val)
812 725
813static int xscale2pmu_init(struct arm_pmu *cpu_pmu) 726static int xscale2pmu_init(struct arm_pmu *cpu_pmu)
814{ 727{
815 cpu_pmu->name = "xscale2"; 728 cpu_pmu->name = "armv5_xscale2";
816 cpu_pmu->handle_irq = xscale2pmu_handle_irq; 729 cpu_pmu->handle_irq = xscale2pmu_handle_irq;
817 cpu_pmu->enable = xscale2pmu_enable_event; 730 cpu_pmu->enable = xscale2pmu_enable_event;
818 cpu_pmu->disable = xscale2pmu_disable_event; 731 cpu_pmu->disable = xscale2pmu_disable_event;
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 95858966d84e..35e72585ec1d 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -3,6 +3,7 @@
3 */ 3 */
4 4
5#include <linux/linkage.h> 5#include <linux/linkage.h>
6#include <asm/assembler.h>
6#include <asm/kexec.h> 7#include <asm/kexec.h>
7 8
8 .align 3 /* not needed for this code, but keeps fncpy() happy */ 9 .align 3 /* not needed for this code, but keeps fncpy() happy */
@@ -59,7 +60,7 @@ ENTRY(relocate_new_kernel)
59 mov r0,#0 60 mov r0,#0
60 ldr r1,kexec_mach_type 61 ldr r1,kexec_mach_type
61 ldr r2,kexec_boot_atags 62 ldr r2,kexec_boot_atags
62 ARM( mov pc, lr ) 63 ARM( ret lr )
63 THUMB( bx lr ) 64 THUMB( bx lr )
64 65
65 .align 66 .align
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 8a16ee5d8a95..84db893dedc2 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -393,19 +393,34 @@ static void __init cpuid_init_hwcaps(void)
393 elf_hwcap |= HWCAP_LPAE; 393 elf_hwcap |= HWCAP_LPAE;
394} 394}
395 395
396static void __init feat_v6_fixup(void) 396static void __init elf_hwcap_fixup(void)
397{ 397{
398 int id = read_cpuid_id(); 398 unsigned id = read_cpuid_id();
399 399 unsigned sync_prim;
400 if ((id & 0xff0f0000) != 0x41070000)
401 return;
402 400
403 /* 401 /*
404 * HWCAP_TLS is available only on 1136 r1p0 and later, 402 * HWCAP_TLS is available only on 1136 r1p0 and later,
405 * see also kuser_get_tls_init. 403 * see also kuser_get_tls_init.
406 */ 404 */
407 if ((((id >> 4) & 0xfff) == 0xb36) && (((id >> 20) & 3) == 0)) 405 if (read_cpuid_part() == ARM_CPU_PART_ARM1136 &&
406 ((id >> 20) & 3) == 0) {
408 elf_hwcap &= ~HWCAP_TLS; 407 elf_hwcap &= ~HWCAP_TLS;
408 return;
409 }
410
411 /* Verify if CPUID scheme is implemented */
412 if ((id & 0x000f0000) != 0x000f0000)
413 return;
414
415 /*
416 * If the CPU supports LDREX/STREX and LDREXB/STREXB,
417 * avoid advertising SWP; it may not be atomic with
418 * multiprocessing cores.
419 */
420 sync_prim = ((read_cpuid_ext(CPUID_EXT_ISAR3) >> 8) & 0xf0) |
421 ((read_cpuid_ext(CPUID_EXT_ISAR4) >> 20) & 0x0f);
422 if (sync_prim >= 0x13)
423 elf_hwcap &= ~HWCAP_SWP;
409} 424}
410 425
411/* 426/*
@@ -609,7 +624,7 @@ static void __init setup_processor(void)
609#endif 624#endif
610 erratum_a15_798181_init(); 625 erratum_a15_798181_init();
611 626
612 feat_v6_fixup(); 627 elf_hwcap_fixup();
613 628
614 cacheid_init(); 629 cacheid_init();
615 cpu_init(); 630 cpu_init();
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
index 1b880db2a033..e1e60e5a7a27 100644
--- a/arch/arm/kernel/sleep.S
+++ b/arch/arm/kernel/sleep.S
@@ -107,7 +107,7 @@ ENTRY(cpu_resume_mmu)
107 instr_sync 107 instr_sync
108 mov r0, r0 108 mov r0, r0
109 mov r0, r0 109 mov r0, r0
110 mov pc, r3 @ jump to virtual address 110 ret r3 @ jump to virtual address
111ENDPROC(cpu_resume_mmu) 111ENDPROC(cpu_resume_mmu)
112 .popsection 112 .popsection
113cpu_resume_after_mmu: 113cpu_resume_after_mmu:
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 7c4fada440f0..9388a3d479e1 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -47,6 +47,9 @@
47#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
48#include <asm/mpu.h> 48#include <asm/mpu.h>
49 49
50#define CREATE_TRACE_POINTS
51#include <trace/events/ipi.h>
52
50/* 53/*
51 * as from 2.5, kernels no longer have an init_tasks structure 54 * as from 2.5, kernels no longer have an init_tasks structure
52 * so we need some other way of telling a new secondary core 55 * so we need some other way of telling a new secondary core
@@ -430,38 +433,15 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
430 } 433 }
431} 434}
432 435
433static void (*smp_cross_call)(const struct cpumask *, unsigned int); 436static void (*__smp_cross_call)(const struct cpumask *, unsigned int);
434 437
435void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) 438void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
436{ 439{
437 if (!smp_cross_call) 440 if (!__smp_cross_call)
438 smp_cross_call = fn; 441 __smp_cross_call = fn;
439}
440
441void arch_send_call_function_ipi_mask(const struct cpumask *mask)
442{
443 smp_cross_call(mask, IPI_CALL_FUNC);
444}
445
446void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
447{
448 smp_cross_call(mask, IPI_WAKEUP);
449}
450
451void arch_send_call_function_single_ipi(int cpu)
452{
453 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
454} 442}
455 443
456#ifdef CONFIG_IRQ_WORK 444static const char *ipi_types[NR_IPI] __tracepoint_string = {
457void arch_irq_work_raise(void)
458{
459 if (is_smp())
460 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
461}
462#endif
463
464static const char *ipi_types[NR_IPI] = {
465#define S(x,s) [x] = s 445#define S(x,s) [x] = s
466 S(IPI_WAKEUP, "CPU wakeup interrupts"), 446 S(IPI_WAKEUP, "CPU wakeup interrupts"),
467 S(IPI_TIMER, "Timer broadcast interrupts"), 447 S(IPI_TIMER, "Timer broadcast interrupts"),
@@ -473,6 +453,12 @@ static const char *ipi_types[NR_IPI] = {
473 S(IPI_COMPLETION, "completion interrupts"), 453 S(IPI_COMPLETION, "completion interrupts"),
474}; 454};
475 455
456static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
457{
458 trace_ipi_raise(target, ipi_types[ipinr]);
459 __smp_cross_call(target, ipinr);
460}
461
476void show_ipi_list(struct seq_file *p, int prec) 462void show_ipi_list(struct seq_file *p, int prec)
477{ 463{
478 unsigned int cpu, i; 464 unsigned int cpu, i;
@@ -499,6 +485,29 @@ u64 smp_irq_stat_cpu(unsigned int cpu)
499 return sum; 485 return sum;
500} 486}
501 487
488void arch_send_call_function_ipi_mask(const struct cpumask *mask)
489{
490 smp_cross_call(mask, IPI_CALL_FUNC);
491}
492
493void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
494{
495 smp_cross_call(mask, IPI_WAKEUP);
496}
497
498void arch_send_call_function_single_ipi(int cpu)
499{
500 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
501}
502
503#ifdef CONFIG_IRQ_WORK
504void arch_irq_work_raise(void)
505{
506 if (is_smp())
507 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
508}
509#endif
510
502#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 511#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
503void tick_broadcast(const struct cpumask *mask) 512void tick_broadcast(const struct cpumask *mask)
504{ 513{
@@ -556,8 +565,10 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
556 unsigned int cpu = smp_processor_id(); 565 unsigned int cpu = smp_processor_id();
557 struct pt_regs *old_regs = set_irq_regs(regs); 566 struct pt_regs *old_regs = set_irq_regs(regs);
558 567
559 if (ipinr < NR_IPI) 568 if ((unsigned)ipinr < NR_IPI) {
569 trace_ipi_entry(ipi_types[ipinr]);
560 __inc_irq_stat(cpu, ipi_irqs[ipinr]); 570 __inc_irq_stat(cpu, ipi_irqs[ipinr]);
571 }
561 572
562 switch (ipinr) { 573 switch (ipinr) {
563 case IPI_WAKEUP: 574 case IPI_WAKEUP:
@@ -612,6 +623,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
612 cpu, ipinr); 623 cpu, ipinr);
613 break; 624 break;
614 } 625 }
626
627 if ((unsigned)ipinr < NR_IPI)
628 trace_ipi_exit(ipi_types[ipinr]);
615 set_irq_regs(old_regs); 629 set_irq_regs(old_regs);
616} 630}
617 631
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 1aafa0d785eb..72f9241ad5db 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -17,6 +17,8 @@
17#include <asm/cputype.h> 17#include <asm/cputype.h>
18 18
19#define SCU_CTRL 0x00 19#define SCU_CTRL 0x00
20#define SCU_ENABLE (1 << 0)
21#define SCU_STANDBY_ENABLE (1 << 5)
20#define SCU_CONFIG 0x04 22#define SCU_CONFIG 0x04
21#define SCU_CPU_STATUS 0x08 23#define SCU_CPU_STATUS 0x08
22#define SCU_INVALIDATE 0x0c 24#define SCU_INVALIDATE 0x0c
@@ -50,10 +52,16 @@ void scu_enable(void __iomem *scu_base)
50 52
51 scu_ctrl = readl_relaxed(scu_base + SCU_CTRL); 53 scu_ctrl = readl_relaxed(scu_base + SCU_CTRL);
52 /* already enabled? */ 54 /* already enabled? */
53 if (scu_ctrl & 1) 55 if (scu_ctrl & SCU_ENABLE)
54 return; 56 return;
55 57
56 scu_ctrl |= 1; 58 scu_ctrl |= SCU_ENABLE;
59
60 /* Cortex-A9 earlier than r2p0 has no standby bit in SCU */
61 if ((read_cpuid_id() & 0xff0ffff0) == 0x410fc090 &&
62 (read_cpuid_id() & 0x00f0000f) >= 0x00200000)
63 scu_ctrl |= SCU_STANDBY_ENABLE;
64
57 writel_relaxed(scu_ctrl, scu_base + SCU_CTRL); 65 writel_relaxed(scu_ctrl, scu_base + SCU_CTRL);
58 66
59 /* 67 /*
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index 95d063620b76..2e72be4f623e 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -92,15 +92,19 @@ void erratum_a15_798181_init(void)
92 unsigned int midr = read_cpuid_id(); 92 unsigned int midr = read_cpuid_id();
93 unsigned int revidr = read_cpuid(CPUID_REVIDR); 93 unsigned int revidr = read_cpuid(CPUID_REVIDR);
94 94
95 /* Cortex-A15 r0p0..r3p2 w/o ECO fix affected */ 95 /* Brahma-B15 r0p0..r0p2 affected
96 if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2 || 96 * Cortex-A15 r0p0..r3p2 w/o ECO fix affected */
97 (revidr & 0x210) == 0x210) { 97 if ((midr & 0xff0ffff0) == 0x420f00f0 && midr <= 0x420f00f2)
98 return;
99 }
100 if (revidr & 0x10)
101 erratum_a15_798181_handler = erratum_a15_798181_partial;
102 else
103 erratum_a15_798181_handler = erratum_a15_798181_broadcast; 98 erratum_a15_798181_handler = erratum_a15_798181_broadcast;
99 else if ((midr & 0xff0ffff0) == 0x410fc0f0 && midr <= 0x413fc0f2 &&
100 (revidr & 0x210) != 0x210) {
101 if (revidr & 0x10)
102 erratum_a15_798181_handler =
103 erratum_a15_798181_partial;
104 else
105 erratum_a15_798181_handler =
106 erratum_a15_798181_broadcast;
107 }
104} 108}
105#endif 109#endif
106 110
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index b1b89882b113..67ca8578c6d8 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -27,6 +27,7 @@
27#include <linux/perf_event.h> 27#include <linux/perf_event.h>
28 28
29#include <asm/opcodes.h> 29#include <asm/opcodes.h>
30#include <asm/system_info.h>
30#include <asm/traps.h> 31#include <asm/traps.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32 33
@@ -266,6 +267,9 @@ static struct undef_hook swp_hook = {
266 */ 267 */
267static int __init swp_emulation_init(void) 268static int __init swp_emulation_init(void)
268{ 269{
270 if (cpu_architecture() < CPU_ARCH_ARMv7)
271 return 0;
272
269#ifdef CONFIG_PROC_FS 273#ifdef CONFIG_PROC_FS
270 if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) 274 if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
271 return -ENOMEM; 275 return -ENOMEM;
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 829a96d4a179..0cc7e58c47cc 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -50,10 +50,7 @@ unsigned long profile_pc(struct pt_regs *regs)
50 if (!in_lock_functions(regs->ARM_pc)) 50 if (!in_lock_functions(regs->ARM_pc))
51 return regs->ARM_pc; 51 return regs->ARM_pc;
52 52
53 frame.fp = regs->ARM_fp; 53 arm_get_current_stackframe(regs, &frame);
54 frame.sp = regs->ARM_sp;
55 frame.lr = regs->ARM_lr;
56 frame.pc = regs->ARM_pc;
57 do { 54 do {
58 int ret = unwind_frame(&frame); 55 int ret = unwind_frame(&frame);
59 if (ret < 0) 56 if (ret < 0)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index abd2fc067736..c8e4bb714944 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -31,11 +31,13 @@
31#include <asm/exception.h> 31#include <asm/exception.h>
32#include <asm/unistd.h> 32#include <asm/unistd.h>
33#include <asm/traps.h> 33#include <asm/traps.h>
34#include <asm/ptrace.h>
34#include <asm/unwind.h> 35#include <asm/unwind.h>
35#include <asm/tls.h> 36#include <asm/tls.h>
36#include <asm/system_misc.h> 37#include <asm/system_misc.h>
37#include <asm/opcodes.h> 38#include <asm/opcodes.h>
38 39
40
39static const char *handler[]= { 41static const char *handler[]= {
40 "prefetch abort", 42 "prefetch abort",
41 "data abort", 43 "data abort",
@@ -184,7 +186,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
184 tsk = current; 186 tsk = current;
185 187
186 if (regs) { 188 if (regs) {
187 fp = regs->ARM_fp; 189 fp = frame_pointer(regs);
188 mode = processor_mode(regs); 190 mode = processor_mode(regs);
189 } else if (tsk != current) { 191 } else if (tsk != current) {
190 fp = thread_saved_fp(tsk); 192 fp = thread_saved_fp(tsk);
@@ -719,7 +721,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
719 dump_instr("", regs); 721 dump_instr("", regs);
720 if (user_mode(regs)) { 722 if (user_mode(regs)) {
721 __show_regs(regs); 723 __show_regs(regs);
722 c_backtrace(regs->ARM_fp, processor_mode(regs)); 724 c_backtrace(frame_pointer(regs), processor_mode(regs));
723 } 725 }
724 } 726 }
725#endif 727#endif
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index e67682f02cb2..a61a1dfbb0db 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -479,12 +479,10 @@ void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk)
479 tsk = current; 479 tsk = current;
480 480
481 if (regs) { 481 if (regs) {
482 frame.fp = regs->ARM_fp; 482 arm_get_current_stackframe(regs, &frame);
483 frame.sp = regs->ARM_sp;
484 frame.lr = regs->ARM_lr;
485 /* PC might be corrupted, use LR in that case. */ 483 /* PC might be corrupted, use LR in that case. */
486 frame.pc = kernel_text_address(regs->ARM_pc) 484 if (!kernel_text_address(regs->ARM_pc))
487 ? regs->ARM_pc : regs->ARM_lr; 485 frame.pc = regs->ARM_lr;
488 } else if (tsk == current) { 486 } else if (tsk == current) {
489 frame.fp = (unsigned long)__builtin_frame_address(0); 487 frame.fp = (unsigned long)__builtin_frame_address(0);
490 frame.sp = current_sp; 488 frame.sp = current_sp;
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 7bcee5c9b604..6f57cb94367f 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -318,7 +318,6 @@ SECTIONS
318 _end = .; 318 _end = .;
319 319
320 STABS_DEBUG 320 STABS_DEBUG
321 .comment 0 : { *(.comment) }
322} 321}
323 322
324/* 323/*
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index 4be5bb150bdd..466bd299b1a8 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -23,7 +23,7 @@ config KVM
23 select HAVE_KVM_CPU_RELAX_INTERCEPT 23 select HAVE_KVM_CPU_RELAX_INTERCEPT
24 select KVM_MMIO 24 select KVM_MMIO
25 select KVM_ARM_HOST 25 select KVM_ARM_HOST
26 depends on ARM_VIRT_EXT && ARM_LPAE && !CPU_BIG_ENDIAN 26 depends on ARM_VIRT_EXT && ARM_LPAE
27 ---help--- 27 ---help---
28 Support hosting virtualized guest machines. You will also 28 Support hosting virtualized guest machines. You will also
29 need to select one or more of the processor modules below. 29 need to select one or more of the processor modules below.
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 789bca9e64a7..f7057ed045b6 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -21,4 +21,5 @@ obj-y += kvm-arm.o init.o interrupts.o
21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o 21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
22obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o 22obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o
23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o 23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
24obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2.o
24obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o 25obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 3c82b37c0f9e..a99e0cdf8ba2 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -155,16 +155,6 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
155 return VM_FAULT_SIGBUS; 155 return VM_FAULT_SIGBUS;
156} 156}
157 157
158void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
159 struct kvm_memory_slot *dont)
160{
161}
162
163int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
164 unsigned long npages)
165{
166 return 0;
167}
168 158
169/** 159/**
170 * kvm_arch_destroy_vm - destroy the VM data structure 160 * kvm_arch_destroy_vm - destroy the VM data structure
@@ -184,7 +174,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
184 } 174 }
185} 175}
186 176
187int kvm_dev_ioctl_check_extension(long ext) 177int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
188{ 178{
189 int r; 179 int r;
190 switch (ext) { 180 switch (ext) {
@@ -225,33 +215,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
225 return -EINVAL; 215 return -EINVAL;
226} 216}
227 217
228void kvm_arch_memslots_updated(struct kvm *kvm)
229{
230}
231
232int kvm_arch_prepare_memory_region(struct kvm *kvm,
233 struct kvm_memory_slot *memslot,
234 struct kvm_userspace_memory_region *mem,
235 enum kvm_mr_change change)
236{
237 return 0;
238}
239
240void kvm_arch_commit_memory_region(struct kvm *kvm,
241 struct kvm_userspace_memory_region *mem,
242 const struct kvm_memory_slot *old,
243 enum kvm_mr_change change)
244{
245}
246
247void kvm_arch_flush_shadow_all(struct kvm *kvm)
248{
249}
250
251void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
252 struct kvm_memory_slot *slot)
253{
254}
255 218
256struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) 219struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
257{ 220{
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index c58a35116f63..37a0fe1bb9bb 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -44,6 +44,31 @@ static u32 cache_levels;
44/* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */ 44/* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */
45#define CSSELR_MAX 12 45#define CSSELR_MAX 12
46 46
47/*
48 * kvm_vcpu_arch.cp15 holds cp15 registers as an array of u32, but some
49 * of cp15 registers can be viewed either as couple of two u32 registers
50 * or one u64 register. Current u64 register encoding is that least
51 * significant u32 word is followed by most significant u32 word.
52 */
53static inline void vcpu_cp15_reg64_set(struct kvm_vcpu *vcpu,
54 const struct coproc_reg *r,
55 u64 val)
56{
57 vcpu->arch.cp15[r->reg] = val & 0xffffffff;
58 vcpu->arch.cp15[r->reg + 1] = val >> 32;
59}
60
61static inline u64 vcpu_cp15_reg64_get(struct kvm_vcpu *vcpu,
62 const struct coproc_reg *r)
63{
64 u64 val;
65
66 val = vcpu->arch.cp15[r->reg + 1];
67 val = val << 32;
68 val = val | vcpu->arch.cp15[r->reg];
69 return val;
70}
71
47int kvm_handle_cp10_id(struct kvm_vcpu *vcpu, struct kvm_run *run) 72int kvm_handle_cp10_id(struct kvm_vcpu *vcpu, struct kvm_run *run)
48{ 73{
49 kvm_inject_undefined(vcpu); 74 kvm_inject_undefined(vcpu);
@@ -682,17 +707,23 @@ static struct coproc_reg invariant_cp15[] = {
682 { CRn( 0), CRm( 0), Op1( 1), Op2( 7), is32, NULL, get_AIDR }, 707 { CRn( 0), CRm( 0), Op1( 1), Op2( 7), is32, NULL, get_AIDR },
683}; 708};
684 709
710/*
711 * Reads a register value from a userspace address to a kernel
712 * variable. Make sure that register size matches sizeof(*__val).
713 */
685static int reg_from_user(void *val, const void __user *uaddr, u64 id) 714static int reg_from_user(void *val, const void __user *uaddr, u64 id)
686{ 715{
687 /* This Just Works because we are little endian. */
688 if (copy_from_user(val, uaddr, KVM_REG_SIZE(id)) != 0) 716 if (copy_from_user(val, uaddr, KVM_REG_SIZE(id)) != 0)
689 return -EFAULT; 717 return -EFAULT;
690 return 0; 718 return 0;
691} 719}
692 720
721/*
722 * Writes a register value to a userspace address from a kernel variable.
723 * Make sure that register size matches sizeof(*__val).
724 */
693static int reg_to_user(void __user *uaddr, const void *val, u64 id) 725static int reg_to_user(void __user *uaddr, const void *val, u64 id)
694{ 726{
695 /* This Just Works because we are little endian. */
696 if (copy_to_user(uaddr, val, KVM_REG_SIZE(id)) != 0) 727 if (copy_to_user(uaddr, val, KVM_REG_SIZE(id)) != 0)
697 return -EFAULT; 728 return -EFAULT;
698 return 0; 729 return 0;
@@ -702,6 +733,7 @@ static int get_invariant_cp15(u64 id, void __user *uaddr)
702{ 733{
703 struct coproc_params params; 734 struct coproc_params params;
704 const struct coproc_reg *r; 735 const struct coproc_reg *r;
736 int ret;
705 737
706 if (!index_to_params(id, &params)) 738 if (!index_to_params(id, &params))
707 return -ENOENT; 739 return -ENOENT;
@@ -710,7 +742,15 @@ static int get_invariant_cp15(u64 id, void __user *uaddr)
710 if (!r) 742 if (!r)
711 return -ENOENT; 743 return -ENOENT;
712 744
713 return reg_to_user(uaddr, &r->val, id); 745 ret = -ENOENT;
746 if (KVM_REG_SIZE(id) == 4) {
747 u32 val = r->val;
748
749 ret = reg_to_user(uaddr, &val, id);
750 } else if (KVM_REG_SIZE(id) == 8) {
751 ret = reg_to_user(uaddr, &r->val, id);
752 }
753 return ret;
714} 754}
715 755
716static int set_invariant_cp15(u64 id, void __user *uaddr) 756static int set_invariant_cp15(u64 id, void __user *uaddr)
@@ -718,7 +758,7 @@ static int set_invariant_cp15(u64 id, void __user *uaddr)
718 struct coproc_params params; 758 struct coproc_params params;
719 const struct coproc_reg *r; 759 const struct coproc_reg *r;
720 int err; 760 int err;
721 u64 val = 0; /* Make sure high bits are 0 for 32-bit regs */ 761 u64 val;
722 762
723 if (!index_to_params(id, &params)) 763 if (!index_to_params(id, &params))
724 return -ENOENT; 764 return -ENOENT;
@@ -726,7 +766,16 @@ static int set_invariant_cp15(u64 id, void __user *uaddr)
726 if (!r) 766 if (!r)
727 return -ENOENT; 767 return -ENOENT;
728 768
729 err = reg_from_user(&val, uaddr, id); 769 err = -ENOENT;
770 if (KVM_REG_SIZE(id) == 4) {
771 u32 val32;
772
773 err = reg_from_user(&val32, uaddr, id);
774 if (!err)
775 val = val32;
776 } else if (KVM_REG_SIZE(id) == 8) {
777 err = reg_from_user(&val, uaddr, id);
778 }
730 if (err) 779 if (err)
731 return err; 780 return err;
732 781
@@ -1004,6 +1053,7 @@ int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
1004{ 1053{
1005 const struct coproc_reg *r; 1054 const struct coproc_reg *r;
1006 void __user *uaddr = (void __user *)(long)reg->addr; 1055 void __user *uaddr = (void __user *)(long)reg->addr;
1056 int ret;
1007 1057
1008 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX) 1058 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX)
1009 return demux_c15_get(reg->id, uaddr); 1059 return demux_c15_get(reg->id, uaddr);
@@ -1015,14 +1065,24 @@ int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
1015 if (!r) 1065 if (!r)
1016 return get_invariant_cp15(reg->id, uaddr); 1066 return get_invariant_cp15(reg->id, uaddr);
1017 1067
1018 /* Note: copies two regs if size is 64 bit. */ 1068 ret = -ENOENT;
1019 return reg_to_user(uaddr, &vcpu->arch.cp15[r->reg], reg->id); 1069 if (KVM_REG_SIZE(reg->id) == 8) {
1070 u64 val;
1071
1072 val = vcpu_cp15_reg64_get(vcpu, r);
1073 ret = reg_to_user(uaddr, &val, reg->id);
1074 } else if (KVM_REG_SIZE(reg->id) == 4) {
1075 ret = reg_to_user(uaddr, &vcpu->arch.cp15[r->reg], reg->id);
1076 }
1077
1078 return ret;
1020} 1079}
1021 1080
1022int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) 1081int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
1023{ 1082{
1024 const struct coproc_reg *r; 1083 const struct coproc_reg *r;
1025 void __user *uaddr = (void __user *)(long)reg->addr; 1084 void __user *uaddr = (void __user *)(long)reg->addr;
1085 int ret;
1026 1086
1027 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX) 1087 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX)
1028 return demux_c15_set(reg->id, uaddr); 1088 return demux_c15_set(reg->id, uaddr);
@@ -1034,8 +1094,18 @@ int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
1034 if (!r) 1094 if (!r)
1035 return set_invariant_cp15(reg->id, uaddr); 1095 return set_invariant_cp15(reg->id, uaddr);
1036 1096
1037 /* Note: copies two regs if size is 64 bit */ 1097 ret = -ENOENT;
1038 return reg_from_user(&vcpu->arch.cp15[r->reg], uaddr, reg->id); 1098 if (KVM_REG_SIZE(reg->id) == 8) {
1099 u64 val;
1100
1101 ret = reg_from_user(&val, uaddr, reg->id);
1102 if (!ret)
1103 vcpu_cp15_reg64_set(vcpu, r, val);
1104 } else if (KVM_REG_SIZE(reg->id) == 4) {
1105 ret = reg_from_user(&vcpu->arch.cp15[r->reg], uaddr, reg->id);
1106 }
1107
1108 return ret;
1039} 1109}
1040 1110
1041static unsigned int num_demux_regs(void) 1111static unsigned int num_demux_regs(void)
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index b23a59c1c522..813e49258690 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -124,16 +124,6 @@ static bool is_timer_reg(u64 index)
124 return false; 124 return false;
125} 125}
126 126
127int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
128{
129 return 0;
130}
131
132u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
133{
134 return 0;
135}
136
137#else 127#else
138 128
139#define NUM_TIMER_REGS 3 129#define NUM_TIMER_REGS 3
@@ -274,13 +264,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
274 264
275int __attribute_const__ kvm_target_cpu(void) 265int __attribute_const__ kvm_target_cpu(void)
276{ 266{
277 unsigned long implementor = read_cpuid_implementor(); 267 switch (read_cpuid_part()) {
278 unsigned long part_number = read_cpuid_part_number();
279
280 if (implementor != ARM_CPU_IMP_ARM)
281 return -EINVAL;
282
283 switch (part_number) {
284 case ARM_CPU_PART_CORTEX_A7: 268 case ARM_CPU_PART_CORTEX_A7:
285 return KVM_ARM_TARGET_CORTEX_A7; 269 return KVM_ARM_TARGET_CORTEX_A7;
286 case ARM_CPU_PART_CORTEX_A15: 270 case ARM_CPU_PART_CORTEX_A15:
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
index 1b9844d369cc..991415d978b6 100644
--- a/arch/arm/kvm/init.S
+++ b/arch/arm/kvm/init.S
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/linkage.h> 19#include <linux/linkage.h>
20#include <asm/assembler.h>
20#include <asm/unified.h> 21#include <asm/unified.h>
21#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
22#include <asm/kvm_asm.h> 23#include <asm/kvm_asm.h>
@@ -71,7 +72,7 @@ __do_hyp_init:
71 bne phase2 @ Yes, second stage init 72 bne phase2 @ Yes, second stage init
72 73
73 @ Set the HTTBR to point to the hypervisor PGD pointer passed 74 @ Set the HTTBR to point to the hypervisor PGD pointer passed
74 mcrr p15, 4, r2, r3, c2 75 mcrr p15, 4, rr_lo_hi(r2, r3), c2
75 76
76 @ Set the HTCR and VTCR to the same shareability and cacheability 77 @ Set the HTCR and VTCR to the same shareability and cacheability
77 @ settings as the non-secure TTBCR and with T0SZ == 0. 78 @ settings as the non-secure TTBCR and with T0SZ == 0.
@@ -134,10 +135,10 @@ phase2:
134 ldr r0, =TRAMPOLINE_VA 135 ldr r0, =TRAMPOLINE_VA
135 adr r1, target 136 adr r1, target
136 bfi r0, r1, #0, #PAGE_SHIFT 137 bfi r0, r1, #0, #PAGE_SHIFT
137 mov pc, r0 138 ret r0
138 139
139target: @ We're now in the trampoline code, switch page tables 140target: @ We're now in the trampoline code, switch page tables
140 mcrr p15, 4, r2, r3, c2 141 mcrr p15, 4, rr_lo_hi(r2, r3), c2
141 isb 142 isb
142 143
143 @ Invalidate the old TLBs 144 @ Invalidate the old TLBs
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
index 0d68d4073068..01dcb0e752d9 100644
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -52,7 +52,7 @@ ENTRY(__kvm_tlb_flush_vmid_ipa)
52 dsb ishst 52 dsb ishst
53 add r0, r0, #KVM_VTTBR 53 add r0, r0, #KVM_VTTBR
54 ldrd r2, r3, [r0] 54 ldrd r2, r3, [r0]
55 mcrr p15, 6, r2, r3, c2 @ Write VTTBR 55 mcrr p15, 6, rr_lo_hi(r2, r3), c2 @ Write VTTBR
56 isb 56 isb
57 mcr p15, 0, r0, c8, c3, 0 @ TLBIALLIS (rt ignored) 57 mcr p15, 0, r0, c8, c3, 0 @ TLBIALLIS (rt ignored)
58 dsb ish 58 dsb ish
@@ -135,7 +135,7 @@ ENTRY(__kvm_vcpu_run)
135 ldr r1, [vcpu, #VCPU_KVM] 135 ldr r1, [vcpu, #VCPU_KVM]
136 add r1, r1, #KVM_VTTBR 136 add r1, r1, #KVM_VTTBR
137 ldrd r2, r3, [r1] 137 ldrd r2, r3, [r1]
138 mcrr p15, 6, r2, r3, c2 @ Write VTTBR 138 mcrr p15, 6, rr_lo_hi(r2, r3), c2 @ Write VTTBR
139 139
140 @ We're all done, just restore the GPRs and go to the guest 140 @ We're all done, just restore the GPRs and go to the guest
141 restore_guest_regs 141 restore_guest_regs
@@ -199,8 +199,13 @@ after_vfp_restore:
199 199
200 restore_host_regs 200 restore_host_regs
201 clrex @ Clear exclusive monitor 201 clrex @ Clear exclusive monitor
202#ifndef CONFIG_CPU_ENDIAN_BE8
202 mov r0, r1 @ Return the return code 203 mov r0, r1 @ Return the return code
203 mov r1, #0 @ Clear upper bits in return value 204 mov r1, #0 @ Clear upper bits in return value
205#else
206 @ r1 already has return code
207 mov r0, #0 @ Clear upper bits in return value
208#endif /* CONFIG_CPU_ENDIAN_BE8 */
204 bx lr @ return to IOCTL 209 bx lr @ return to IOCTL
205 210
206/******************************************************************** 211/********************************************************************
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 76af93025574..98c8c5b9a87f 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -1,4 +1,5 @@
1#include <linux/irqchip/arm-gic.h> 1#include <linux/irqchip/arm-gic.h>
2#include <asm/assembler.h>
2 3
3#define VCPU_USR_REG(_reg_nr) (VCPU_USR_REGS + (_reg_nr * 4)) 4#define VCPU_USR_REG(_reg_nr) (VCPU_USR_REGS + (_reg_nr * 4))
4#define VCPU_USR_SP (VCPU_USR_REG(13)) 5#define VCPU_USR_SP (VCPU_USR_REG(13))
@@ -420,15 +421,23 @@ vcpu .req r0 @ vcpu pointer always in r0
420 ldr r8, [r2, #GICH_ELRSR0] 421 ldr r8, [r2, #GICH_ELRSR0]
421 ldr r9, [r2, #GICH_ELRSR1] 422 ldr r9, [r2, #GICH_ELRSR1]
422 ldr r10, [r2, #GICH_APR] 423 ldr r10, [r2, #GICH_APR]
423 424ARM_BE8(rev r3, r3 )
424 str r3, [r11, #VGIC_CPU_HCR] 425ARM_BE8(rev r4, r4 )
425 str r4, [r11, #VGIC_CPU_VMCR] 426ARM_BE8(rev r5, r5 )
426 str r5, [r11, #VGIC_CPU_MISR] 427ARM_BE8(rev r6, r6 )
427 str r6, [r11, #VGIC_CPU_EISR] 428ARM_BE8(rev r7, r7 )
428 str r7, [r11, #(VGIC_CPU_EISR + 4)] 429ARM_BE8(rev r8, r8 )
429 str r8, [r11, #VGIC_CPU_ELRSR] 430ARM_BE8(rev r9, r9 )
430 str r9, [r11, #(VGIC_CPU_ELRSR + 4)] 431ARM_BE8(rev r10, r10 )
431 str r10, [r11, #VGIC_CPU_APR] 432
433 str r3, [r11, #VGIC_V2_CPU_HCR]
434 str r4, [r11, #VGIC_V2_CPU_VMCR]
435 str r5, [r11, #VGIC_V2_CPU_MISR]
436 str r6, [r11, #VGIC_V2_CPU_EISR]
437 str r7, [r11, #(VGIC_V2_CPU_EISR + 4)]
438 str r8, [r11, #VGIC_V2_CPU_ELRSR]
439 str r9, [r11, #(VGIC_V2_CPU_ELRSR + 4)]
440 str r10, [r11, #VGIC_V2_CPU_APR]
432 441
433 /* Clear GICH_HCR */ 442 /* Clear GICH_HCR */
434 mov r5, #0 443 mov r5, #0
@@ -436,9 +445,10 @@ vcpu .req r0 @ vcpu pointer always in r0
436 445
437 /* Save list registers */ 446 /* Save list registers */
438 add r2, r2, #GICH_LR0 447 add r2, r2, #GICH_LR0
439 add r3, r11, #VGIC_CPU_LR 448 add r3, r11, #VGIC_V2_CPU_LR
440 ldr r4, [r11, #VGIC_CPU_NR_LR] 449 ldr r4, [r11, #VGIC_CPU_NR_LR]
4411: ldr r6, [r2], #4 4501: ldr r6, [r2], #4
451ARM_BE8(rev r6, r6 )
442 str r6, [r3], #4 452 str r6, [r3], #4
443 subs r4, r4, #1 453 subs r4, r4, #1
444 bne 1b 454 bne 1b
@@ -463,9 +473,12 @@ vcpu .req r0 @ vcpu pointer always in r0
463 add r11, vcpu, #VCPU_VGIC_CPU 473 add r11, vcpu, #VCPU_VGIC_CPU
464 474
465 /* We only restore a minimal set of registers */ 475 /* We only restore a minimal set of registers */
466 ldr r3, [r11, #VGIC_CPU_HCR] 476 ldr r3, [r11, #VGIC_V2_CPU_HCR]
467 ldr r4, [r11, #VGIC_CPU_VMCR] 477 ldr r4, [r11, #VGIC_V2_CPU_VMCR]
468 ldr r8, [r11, #VGIC_CPU_APR] 478 ldr r8, [r11, #VGIC_V2_CPU_APR]
479ARM_BE8(rev r3, r3 )
480ARM_BE8(rev r4, r4 )
481ARM_BE8(rev r8, r8 )
469 482
470 str r3, [r2, #GICH_HCR] 483 str r3, [r2, #GICH_HCR]
471 str r4, [r2, #GICH_VMCR] 484 str r4, [r2, #GICH_VMCR]
@@ -473,9 +486,10 @@ vcpu .req r0 @ vcpu pointer always in r0
473 486
474 /* Restore list registers */ 487 /* Restore list registers */
475 add r2, r2, #GICH_LR0 488 add r2, r2, #GICH_LR0
476 add r3, r11, #VGIC_CPU_LR 489 add r3, r11, #VGIC_V2_CPU_LR
477 ldr r4, [r11, #VGIC_CPU_NR_LR] 490 ldr r4, [r11, #VGIC_CPU_NR_LR]
4781: ldr r6, [r3], #4 4911: ldr r6, [r3], #4
492ARM_BE8(rev r6, r6 )
479 str r6, [r2], #4 493 str r6, [r2], #4
480 subs r4, r4, #1 494 subs r4, r4, #1
481 bne 1b 495 bne 1b
@@ -506,7 +520,7 @@ vcpu .req r0 @ vcpu pointer always in r0
506 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL 520 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL
507 isb 521 isb
508 522
509 mrrc p15, 3, r2, r3, c14 @ CNTV_CVAL 523 mrrc p15, 3, rr_lo_hi(r2, r3), c14 @ CNTV_CVAL
510 ldr r4, =VCPU_TIMER_CNTV_CVAL 524 ldr r4, =VCPU_TIMER_CNTV_CVAL
511 add r5, vcpu, r4 525 add r5, vcpu, r4
512 strd r2, r3, [r5] 526 strd r2, r3, [r5]
@@ -546,12 +560,12 @@ vcpu .req r0 @ vcpu pointer always in r0
546 560
547 ldr r2, [r4, #KVM_TIMER_CNTVOFF] 561 ldr r2, [r4, #KVM_TIMER_CNTVOFF]
548 ldr r3, [r4, #(KVM_TIMER_CNTVOFF + 4)] 562 ldr r3, [r4, #(KVM_TIMER_CNTVOFF + 4)]
549 mcrr p15, 4, r2, r3, c14 @ CNTVOFF 563 mcrr p15, 4, rr_lo_hi(r2, r3), c14 @ CNTVOFF
550 564
551 ldr r4, =VCPU_TIMER_CNTV_CVAL 565 ldr r4, =VCPU_TIMER_CNTV_CVAL
552 add r5, vcpu, r4 566 add r5, vcpu, r4
553 ldrd r2, r3, [r5] 567 ldrd r2, r3, [r5]
554 mcrr p15, 3, r2, r3, c14 @ CNTV_CVAL 568 mcrr p15, 3, rr_lo_hi(r2, r3), c14 @ CNTV_CVAL
555 isb 569 isb
556 570
557 ldr r2, [vcpu, #VCPU_TIMER_CNTV_CTL] 571 ldr r2, [vcpu, #VCPU_TIMER_CNTV_CTL]
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 16f804938b8f..16e7994bf347 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -90,104 +90,115 @@ static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc)
90 return p; 90 return p;
91} 91}
92 92
93static bool page_empty(void *ptr) 93static void clear_pgd_entry(struct kvm *kvm, pgd_t *pgd, phys_addr_t addr)
94{ 94{
95 struct page *ptr_page = virt_to_page(ptr); 95 pud_t *pud_table __maybe_unused = pud_offset(pgd, 0);
96 return page_count(ptr_page) == 1; 96 pgd_clear(pgd);
97 kvm_tlb_flush_vmid_ipa(kvm, addr);
98 pud_free(NULL, pud_table);
99 put_page(virt_to_page(pgd));
97} 100}
98 101
99static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr) 102static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr)
100{ 103{
101 if (pud_huge(*pud)) { 104 pmd_t *pmd_table = pmd_offset(pud, 0);
102 pud_clear(pud); 105 VM_BUG_ON(pud_huge(*pud));
103 kvm_tlb_flush_vmid_ipa(kvm, addr); 106 pud_clear(pud);
104 } else { 107 kvm_tlb_flush_vmid_ipa(kvm, addr);
105 pmd_t *pmd_table = pmd_offset(pud, 0); 108 pmd_free(NULL, pmd_table);
106 pud_clear(pud);
107 kvm_tlb_flush_vmid_ipa(kvm, addr);
108 pmd_free(NULL, pmd_table);
109 }
110 put_page(virt_to_page(pud)); 109 put_page(virt_to_page(pud));
111} 110}
112 111
113static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr) 112static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr)
114{ 113{
115 if (kvm_pmd_huge(*pmd)) { 114 pte_t *pte_table = pte_offset_kernel(pmd, 0);
116 pmd_clear(pmd); 115 VM_BUG_ON(kvm_pmd_huge(*pmd));
117 kvm_tlb_flush_vmid_ipa(kvm, addr); 116 pmd_clear(pmd);
118 } else { 117 kvm_tlb_flush_vmid_ipa(kvm, addr);
119 pte_t *pte_table = pte_offset_kernel(pmd, 0); 118 pte_free_kernel(NULL, pte_table);
120 pmd_clear(pmd);
121 kvm_tlb_flush_vmid_ipa(kvm, addr);
122 pte_free_kernel(NULL, pte_table);
123 }
124 put_page(virt_to_page(pmd)); 119 put_page(virt_to_page(pmd));
125} 120}
126 121
127static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr) 122static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
123 phys_addr_t addr, phys_addr_t end)
128{ 124{
129 if (pte_present(*pte)) { 125 phys_addr_t start_addr = addr;
130 kvm_set_pte(pte, __pte(0)); 126 pte_t *pte, *start_pte;
131 put_page(virt_to_page(pte)); 127
132 kvm_tlb_flush_vmid_ipa(kvm, addr); 128 start_pte = pte = pte_offset_kernel(pmd, addr);
133 } 129 do {
130 if (!pte_none(*pte)) {
131 kvm_set_pte(pte, __pte(0));
132 put_page(virt_to_page(pte));
133 kvm_tlb_flush_vmid_ipa(kvm, addr);
134 }
135 } while (pte++, addr += PAGE_SIZE, addr != end);
136
137 if (kvm_pte_table_empty(start_pte))
138 clear_pmd_entry(kvm, pmd, start_addr);
134} 139}
135 140
136static void unmap_range(struct kvm *kvm, pgd_t *pgdp, 141static void unmap_pmds(struct kvm *kvm, pud_t *pud,
137 unsigned long long start, u64 size) 142 phys_addr_t addr, phys_addr_t end)
138{ 143{
139 pgd_t *pgd; 144 phys_addr_t next, start_addr = addr;
140 pud_t *pud; 145 pmd_t *pmd, *start_pmd;
141 pmd_t *pmd;
142 pte_t *pte;
143 unsigned long long addr = start, end = start + size;
144 u64 next;
145
146 while (addr < end) {
147 pgd = pgdp + pgd_index(addr);
148 pud = pud_offset(pgd, addr);
149 pte = NULL;
150 if (pud_none(*pud)) {
151 addr = kvm_pud_addr_end(addr, end);
152 continue;
153 }
154 146
155 if (pud_huge(*pud)) { 147 start_pmd = pmd = pmd_offset(pud, addr);
156 /* 148 do {
157 * If we are dealing with a huge pud, just clear it and 149 next = kvm_pmd_addr_end(addr, end);
158 * move on. 150 if (!pmd_none(*pmd)) {
159 */ 151 if (kvm_pmd_huge(*pmd)) {
160 clear_pud_entry(kvm, pud, addr); 152 pmd_clear(pmd);
161 addr = kvm_pud_addr_end(addr, end); 153 kvm_tlb_flush_vmid_ipa(kvm, addr);
162 continue; 154 put_page(virt_to_page(pmd));
155 } else {
156 unmap_ptes(kvm, pmd, addr, next);
157 }
163 } 158 }
159 } while (pmd++, addr = next, addr != end);
164 160
165 pmd = pmd_offset(pud, addr); 161 if (kvm_pmd_table_empty(start_pmd))
166 if (pmd_none(*pmd)) { 162 clear_pud_entry(kvm, pud, start_addr);
167 addr = kvm_pmd_addr_end(addr, end); 163}
168 continue;
169 }
170 164
171 if (!kvm_pmd_huge(*pmd)) { 165static void unmap_puds(struct kvm *kvm, pgd_t *pgd,
172 pte = pte_offset_kernel(pmd, addr); 166 phys_addr_t addr, phys_addr_t end)
173 clear_pte_entry(kvm, pte, addr); 167{
174 next = addr + PAGE_SIZE; 168 phys_addr_t next, start_addr = addr;
175 } 169 pud_t *pud, *start_pud;
176 170
177 /* 171 start_pud = pud = pud_offset(pgd, addr);
178 * If the pmd entry is to be cleared, walk back up the ladder 172 do {
179 */ 173 next = kvm_pud_addr_end(addr, end);
180 if (kvm_pmd_huge(*pmd) || (pte && page_empty(pte))) { 174 if (!pud_none(*pud)) {
181 clear_pmd_entry(kvm, pmd, addr); 175 if (pud_huge(*pud)) {
182 next = kvm_pmd_addr_end(addr, end); 176 pud_clear(pud);
183 if (page_empty(pmd) && !page_empty(pud)) { 177 kvm_tlb_flush_vmid_ipa(kvm, addr);
184 clear_pud_entry(kvm, pud, addr); 178 put_page(virt_to_page(pud));
185 next = kvm_pud_addr_end(addr, end); 179 } else {
180 unmap_pmds(kvm, pud, addr, next);
186 } 181 }
187 } 182 }
183 } while (pud++, addr = next, addr != end);
188 184
189 addr = next; 185 if (kvm_pud_table_empty(start_pud))
190 } 186 clear_pgd_entry(kvm, pgd, start_addr);
187}
188
189
190static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
191 phys_addr_t start, u64 size)
192{
193 pgd_t *pgd;
194 phys_addr_t addr = start, end = start + size;
195 phys_addr_t next;
196
197 pgd = pgdp + pgd_index(addr);
198 do {
199 next = kvm_pgd_addr_end(addr, end);
200 unmap_puds(kvm, pgd, addr, next);
201 } while (pgd++, addr = next, addr != end);
191} 202}
192 203
193static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd, 204static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
@@ -748,6 +759,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
748 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache; 759 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
749 struct vm_area_struct *vma; 760 struct vm_area_struct *vma;
750 pfn_t pfn; 761 pfn_t pfn;
762 pgprot_t mem_type = PAGE_S2;
751 763
752 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu)); 764 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu));
753 if (fault_status == FSC_PERM && !write_fault) { 765 if (fault_status == FSC_PERM && !write_fault) {
@@ -798,6 +810,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
798 if (is_error_pfn(pfn)) 810 if (is_error_pfn(pfn))
799 return -EFAULT; 811 return -EFAULT;
800 812
813 if (kvm_is_mmio_pfn(pfn))
814 mem_type = PAGE_S2_DEVICE;
815
801 spin_lock(&kvm->mmu_lock); 816 spin_lock(&kvm->mmu_lock);
802 if (mmu_notifier_retry(kvm, mmu_seq)) 817 if (mmu_notifier_retry(kvm, mmu_seq))
803 goto out_unlock; 818 goto out_unlock;
@@ -805,7 +820,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
805 hugetlb = transparent_hugepage_adjust(&pfn, &fault_ipa); 820 hugetlb = transparent_hugepage_adjust(&pfn, &fault_ipa);
806 821
807 if (hugetlb) { 822 if (hugetlb) {
808 pmd_t new_pmd = pfn_pmd(pfn, PAGE_S2); 823 pmd_t new_pmd = pfn_pmd(pfn, mem_type);
809 new_pmd = pmd_mkhuge(new_pmd); 824 new_pmd = pmd_mkhuge(new_pmd);
810 if (writable) { 825 if (writable) {
811 kvm_set_s2pmd_writable(&new_pmd); 826 kvm_set_s2pmd_writable(&new_pmd);
@@ -814,13 +829,14 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
814 coherent_cache_guest_page(vcpu, hva & PMD_MASK, PMD_SIZE); 829 coherent_cache_guest_page(vcpu, hva & PMD_MASK, PMD_SIZE);
815 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd); 830 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd);
816 } else { 831 } else {
817 pte_t new_pte = pfn_pte(pfn, PAGE_S2); 832 pte_t new_pte = pfn_pte(pfn, mem_type);
818 if (writable) { 833 if (writable) {
819 kvm_set_s2pte_writable(&new_pte); 834 kvm_set_s2pte_writable(&new_pte);
820 kvm_set_pfn_dirty(pfn); 835 kvm_set_pfn_dirty(pfn);
821 } 836 }
822 coherent_cache_guest_page(vcpu, hva, PAGE_SIZE); 837 coherent_cache_guest_page(vcpu, hva, PAGE_SIZE);
823 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, false); 838 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte,
839 mem_type == PAGE_S2_DEVICE);
824 } 840 }
825 841
826 842
@@ -1100,3 +1116,49 @@ out:
1100 free_hyp_pgds(); 1116 free_hyp_pgds();
1101 return err; 1117 return err;
1102} 1118}
1119
1120void kvm_arch_commit_memory_region(struct kvm *kvm,
1121 struct kvm_userspace_memory_region *mem,
1122 const struct kvm_memory_slot *old,
1123 enum kvm_mr_change change)
1124{
1125 gpa_t gpa = old->base_gfn << PAGE_SHIFT;
1126 phys_addr_t size = old->npages << PAGE_SHIFT;
1127 if (change == KVM_MR_DELETE || change == KVM_MR_MOVE) {
1128 spin_lock(&kvm->mmu_lock);
1129 unmap_stage2_range(kvm, gpa, size);
1130 spin_unlock(&kvm->mmu_lock);
1131 }
1132}
1133
1134int kvm_arch_prepare_memory_region(struct kvm *kvm,
1135 struct kvm_memory_slot *memslot,
1136 struct kvm_userspace_memory_region *mem,
1137 enum kvm_mr_change change)
1138{
1139 return 0;
1140}
1141
1142void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1143 struct kvm_memory_slot *dont)
1144{
1145}
1146
1147int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1148 unsigned long npages)
1149{
1150 return 0;
1151}
1152
1153void kvm_arch_memslots_updated(struct kvm *kvm)
1154{
1155}
1156
1157void kvm_arch_flush_shadow_all(struct kvm *kvm)
1158{
1159}
1160
1161void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
1162 struct kvm_memory_slot *slot)
1163{
1164}
diff --git a/arch/arm/lib/ashldi3.S b/arch/arm/lib/ashldi3.S
index 638deb13da1c..b05e95840651 100644
--- a/arch/arm/lib/ashldi3.S
+++ b/arch/arm/lib/ashldi3.S
@@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA. */
27 27
28 28
29#include <linux/linkage.h> 29#include <linux/linkage.h>
30#include <asm/assembler.h>
30 31
31#ifdef __ARMEB__ 32#ifdef __ARMEB__
32#define al r1 33#define al r1
@@ -47,7 +48,7 @@ ENTRY(__aeabi_llsl)
47 THUMB( lsrmi r3, al, ip ) 48 THUMB( lsrmi r3, al, ip )
48 THUMB( orrmi ah, ah, r3 ) 49 THUMB( orrmi ah, ah, r3 )
49 mov al, al, lsl r2 50 mov al, al, lsl r2
50 mov pc, lr 51 ret lr
51 52
52ENDPROC(__ashldi3) 53ENDPROC(__ashldi3)
53ENDPROC(__aeabi_llsl) 54ENDPROC(__aeabi_llsl)
diff --git a/arch/arm/lib/ashrdi3.S b/arch/arm/lib/ashrdi3.S
index 015e8aa5a1d1..275d7d2341a4 100644
--- a/arch/arm/lib/ashrdi3.S
+++ b/arch/arm/lib/ashrdi3.S
@@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA. */
27 27
28 28
29#include <linux/linkage.h> 29#include <linux/linkage.h>
30#include <asm/assembler.h>
30 31
31#ifdef __ARMEB__ 32#ifdef __ARMEB__
32#define al r1 33#define al r1
@@ -47,7 +48,7 @@ ENTRY(__aeabi_lasr)
47 THUMB( lslmi r3, ah, ip ) 48 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 ) 49 THUMB( orrmi al, al, r3 )
49 mov ah, ah, asr r2 50 mov ah, ah, asr r2
50 mov pc, lr 51 ret lr
51 52
52ENDPROC(__ashrdi3) 53ENDPROC(__ashrdi3)
53ENDPROC(__aeabi_lasr) 54ENDPROC(__aeabi_lasr)
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index 4102be617fce..fab5a50503ae 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -25,7 +25,7 @@
25ENTRY(c_backtrace) 25ENTRY(c_backtrace)
26 26
27#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK) 27#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK)
28 mov pc, lr 28 ret lr
29ENDPROC(c_backtrace) 29ENDPROC(c_backtrace)
30#else 30#else
31 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location... 31 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index 9f12ed1eea86..7d807cfd8ef5 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -1,3 +1,4 @@
1#include <asm/assembler.h>
1#include <asm/unwind.h> 2#include <asm/unwind.h>
2 3
3#if __LINUX_ARM_ARCH__ >= 6 4#if __LINUX_ARM_ARCH__ >= 6
@@ -70,7 +71,7 @@ UNWIND( .fnstart )
70 \instr r2, r2, r3 71 \instr r2, r2, r3
71 str r2, [r1, r0, lsl #2] 72 str r2, [r1, r0, lsl #2]
72 restore_irqs ip 73 restore_irqs ip
73 mov pc, lr 74 ret lr
74UNWIND( .fnend ) 75UNWIND( .fnend )
75ENDPROC(\name ) 76ENDPROC(\name )
76 .endm 77 .endm
@@ -98,7 +99,7 @@ UNWIND( .fnstart )
98 \store r2, [r1] 99 \store r2, [r1]
99 moveq r0, #0 100 moveq r0, #0
100 restore_irqs ip 101 restore_irqs ip
101 mov pc, lr 102 ret lr
102UNWIND( .fnend ) 103UNWIND( .fnend )
103ENDPROC(\name ) 104ENDPROC(\name )
104 .endm 105 .endm
diff --git a/arch/arm/lib/bswapsdi2.S b/arch/arm/lib/bswapsdi2.S
index 9fcdd154eff9..07cda737bb11 100644
--- a/arch/arm/lib/bswapsdi2.S
+++ b/arch/arm/lib/bswapsdi2.S
@@ -1,4 +1,5 @@
1#include <linux/linkage.h> 1#include <linux/linkage.h>
2#include <asm/assembler.h>
2 3
3#if __LINUX_ARM_ARCH__ >= 6 4#if __LINUX_ARM_ARCH__ >= 6
4ENTRY(__bswapsi2) 5ENTRY(__bswapsi2)
@@ -18,7 +19,7 @@ ENTRY(__bswapsi2)
18 mov r3, r3, lsr #8 19 mov r3, r3, lsr #8
19 bic r3, r3, #0xff00 20 bic r3, r3, #0xff00
20 eor r0, r3, r0, ror #8 21 eor r0, r3, r0, ror #8
21 mov pc, lr 22 ret lr
22ENDPROC(__bswapsi2) 23ENDPROC(__bswapsi2)
23 24
24ENTRY(__bswapdi2) 25ENTRY(__bswapdi2)
@@ -31,6 +32,6 @@ ENTRY(__bswapdi2)
31 bic r1, r1, #0xff00 32 bic r1, r1, #0xff00
32 eor r1, r1, r0, ror #8 33 eor r1, r1, r0, ror #8
33 eor r0, r3, ip, ror #8 34 eor r0, r3, ip, ror #8
34 mov pc, lr 35 ret lr
35ENDPROC(__bswapdi2) 36ENDPROC(__bswapdi2)
36#endif 37#endif
diff --git a/arch/arm/lib/call_with_stack.S b/arch/arm/lib/call_with_stack.S
index 916c80f13ae7..ed1a421813cb 100644
--- a/arch/arm/lib/call_with_stack.S
+++ b/arch/arm/lib/call_with_stack.S
@@ -36,9 +36,9 @@ ENTRY(call_with_stack)
36 mov r0, r1 36 mov r0, r1
37 37
38 adr lr, BSYM(1f) 38 adr lr, BSYM(1f)
39 mov pc, r2 39 ret r2
40 40
411: ldr lr, [sp] 411: ldr lr, [sp]
42 ldr sp, [sp, #4] 42 ldr sp, [sp, #4]
43 mov pc, lr 43 ret lr
44ENDPROC(call_with_stack) 44ENDPROC(call_with_stack)
diff --git a/arch/arm/lib/csumpartial.S b/arch/arm/lib/csumpartial.S
index 31d3cb34740d..984e0f29d548 100644
--- a/arch/arm/lib/csumpartial.S
+++ b/arch/arm/lib/csumpartial.S
@@ -97,7 +97,7 @@ td3 .req lr
97#endif 97#endif
98#endif 98#endif
99 adcnes sum, sum, td0 @ update checksum 99 adcnes sum, sum, td0 @ update checksum
100 mov pc, lr 100 ret lr
101 101
102ENTRY(csum_partial) 102ENTRY(csum_partial)
103 stmfd sp!, {buf, lr} 103 stmfd sp!, {buf, lr}
diff --git a/arch/arm/lib/csumpartialcopygeneric.S b/arch/arm/lib/csumpartialcopygeneric.S
index d6e742d24007..10b45909610c 100644
--- a/arch/arm/lib/csumpartialcopygeneric.S
+++ b/arch/arm/lib/csumpartialcopygeneric.S
@@ -7,6 +7,7 @@
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#include <asm/assembler.h>
10 11
11/* 12/*
12 * unsigned int 13 * unsigned int
@@ -40,7 +41,7 @@ sum .req r3
40 adcs sum, sum, ip, put_byte_1 @ update checksum 41 adcs sum, sum, ip, put_byte_1 @ update checksum
41 strb ip, [dst], #1 42 strb ip, [dst], #1
42 tst dst, #2 43 tst dst, #2
43 moveq pc, lr @ dst is now 32bit aligned 44 reteq lr @ dst is now 32bit aligned
44 45
45.Ldst_16bit: load2b r8, ip 46.Ldst_16bit: load2b r8, ip
46 sub len, len, #2 47 sub len, len, #2
@@ -48,7 +49,7 @@ sum .req r3
48 strb r8, [dst], #1 49 strb r8, [dst], #1
49 adcs sum, sum, ip, put_byte_1 50 adcs sum, sum, ip, put_byte_1
50 strb ip, [dst], #1 51 strb ip, [dst], #1
51 mov pc, lr @ dst is now 32bit aligned 52 ret lr @ dst is now 32bit aligned
52 53
53 /* 54 /*
54 * Handle 0 to 7 bytes, with any alignment of source and 55 * Handle 0 to 7 bytes, with any alignment of source and
diff --git a/arch/arm/lib/delay-loop.S b/arch/arm/lib/delay-loop.S
index bc1033b897b4..518bf6e93f78 100644
--- a/arch/arm/lib/delay-loop.S
+++ b/arch/arm/lib/delay-loop.S
@@ -35,7 +35,7 @@ ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06
35 mul r0, r2, r0 @ max = 2^32-1 35 mul r0, r2, r0 @ max = 2^32-1
36 add r0, r0, r1, lsr #32-6 36 add r0, r0, r1, lsr #32-6
37 movs r0, r0, lsr #6 37 movs r0, r0, lsr #6
38 moveq pc, lr 38 reteq lr
39 39
40/* 40/*
41 * loops = r0 * HZ * loops_per_jiffy / 1000000 41 * loops = r0 * HZ * loops_per_jiffy / 1000000
@@ -46,23 +46,23 @@ ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06
46ENTRY(__loop_delay) 46ENTRY(__loop_delay)
47 subs r0, r0, #1 47 subs r0, r0, #1
48#if 0 48#if 0
49 movls pc, lr 49 retls lr
50 subs r0, r0, #1 50 subs r0, r0, #1
51 movls pc, lr 51 retls lr
52 subs r0, r0, #1 52 subs r0, r0, #1
53 movls pc, lr 53 retls lr
54 subs r0, r0, #1 54 subs r0, r0, #1
55 movls pc, lr 55 retls lr
56 subs r0, r0, #1 56 subs r0, r0, #1
57 movls pc, lr 57 retls lr
58 subs r0, r0, #1 58 subs r0, r0, #1
59 movls pc, lr 59 retls lr
60 subs r0, r0, #1 60 subs r0, r0, #1
61 movls pc, lr 61 retls lr
62 subs r0, r0, #1 62 subs r0, r0, #1
63#endif 63#endif
64 bhi __loop_delay 64 bhi __loop_delay
65 mov pc, lr 65 ret lr
66ENDPROC(__loop_udelay) 66ENDPROC(__loop_udelay)
67ENDPROC(__loop_const_udelay) 67ENDPROC(__loop_const_udelay)
68ENDPROC(__loop_delay) 68ENDPROC(__loop_delay)
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 5306de350133..312d43eb686a 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -19,6 +19,7 @@
19 * Author: Will Deacon <will.deacon@arm.com> 19 * Author: Will Deacon <will.deacon@arm.com>
20 */ 20 */
21 21
22#include <linux/clocksource.h>
22#include <linux/delay.h> 23#include <linux/delay.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
@@ -36,6 +37,7 @@ struct arm_delay_ops arm_delay_ops = {
36 37
37static const struct delay_timer *delay_timer; 38static const struct delay_timer *delay_timer;
38static bool delay_calibrated; 39static bool delay_calibrated;
40static u64 delay_res;
39 41
40int read_current_timer(unsigned long *timer_val) 42int read_current_timer(unsigned long *timer_val)
41{ 43{
@@ -47,6 +49,11 @@ int read_current_timer(unsigned long *timer_val)
47} 49}
48EXPORT_SYMBOL_GPL(read_current_timer); 50EXPORT_SYMBOL_GPL(read_current_timer);
49 51
52static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift)
53{
54 return (cyc * mult) >> shift;
55}
56
50static void __timer_delay(unsigned long cycles) 57static void __timer_delay(unsigned long cycles)
51{ 58{
52 cycles_t start = get_cycles(); 59 cycles_t start = get_cycles();
@@ -69,18 +76,24 @@ static void __timer_udelay(unsigned long usecs)
69 76
70void __init register_current_timer_delay(const struct delay_timer *timer) 77void __init register_current_timer_delay(const struct delay_timer *timer)
71{ 78{
72 if (!delay_calibrated) { 79 u32 new_mult, new_shift;
73 pr_info("Switching to timer-based delay loop\n"); 80 u64 res;
81
82 clocks_calc_mult_shift(&new_mult, &new_shift, timer->freq,
83 NSEC_PER_SEC, 3600);
84 res = cyc_to_ns(1ULL, new_mult, new_shift);
85
86 if (!delay_calibrated && (!delay_res || (res < delay_res))) {
87 pr_info("Switching to timer-based delay loop, resolution %lluns\n", res);
74 delay_timer = timer; 88 delay_timer = timer;
75 lpj_fine = timer->freq / HZ; 89 lpj_fine = timer->freq / HZ;
90 delay_res = res;
76 91
77 /* cpufreq may scale loops_per_jiffy, so keep a private copy */ 92 /* cpufreq may scale loops_per_jiffy, so keep a private copy */
78 arm_delay_ops.ticks_per_jiffy = lpj_fine; 93 arm_delay_ops.ticks_per_jiffy = lpj_fine;
79 arm_delay_ops.delay = __timer_delay; 94 arm_delay_ops.delay = __timer_delay;
80 arm_delay_ops.const_udelay = __timer_const_udelay; 95 arm_delay_ops.const_udelay = __timer_const_udelay;
81 arm_delay_ops.udelay = __timer_udelay; 96 arm_delay_ops.udelay = __timer_udelay;
82
83 delay_calibrated = true;
84 } else { 97 } else {
85 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); 98 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
86 } 99 }
@@ -91,3 +104,8 @@ unsigned long calibrate_delay_is_known(void)
91 delay_calibrated = true; 104 delay_calibrated = true;
92 return lpj_fine; 105 return lpj_fine;
93} 106}
107
108void calibration_delay_done(void)
109{
110 delay_calibrated = true;
111}
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S
index e55c4842c290..a9eafe4981eb 100644
--- a/arch/arm/lib/div64.S
+++ b/arch/arm/lib/div64.S
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/assembler.h>
16#include <asm/unwind.h> 17#include <asm/unwind.h>
17 18
18#ifdef __ARMEB__ 19#ifdef __ARMEB__
@@ -97,7 +98,7 @@ UNWIND(.fnstart)
97 mov yl, #0 98 mov yl, #0
98 cmpeq xl, r4 99 cmpeq xl, r4
99 movlo xh, xl 100 movlo xh, xl
100 movlo pc, lr 101 retlo lr
101 102
102 @ The division loop for lower bit positions. 103 @ The division loop for lower bit positions.
103 @ Here we shift remainer bits leftwards rather than moving the 104 @ Here we shift remainer bits leftwards rather than moving the
@@ -111,14 +112,14 @@ UNWIND(.fnstart)
111 subcs xh, xh, r4 112 subcs xh, xh, r4
112 movs ip, ip, lsr #1 113 movs ip, ip, lsr #1
113 bne 4b 114 bne 4b
114 mov pc, lr 115 ret lr
115 116
116 @ The top part of remainder became zero. If carry is set 117 @ The top part of remainder became zero. If carry is set
117 @ (the 33th bit) this is a false positive so resume the loop. 118 @ (the 33th bit) this is a false positive so resume the loop.
118 @ Otherwise, if lower part is also null then we are done. 119 @ Otherwise, if lower part is also null then we are done.
1196: bcs 5b 1206: bcs 5b
120 cmp xl, #0 121 cmp xl, #0
121 moveq pc, lr 122 reteq lr
122 123
123 @ We still have remainer bits in the low part. Bring them up. 124 @ We still have remainer bits in the low part. Bring them up.
124 125
@@ -144,7 +145,7 @@ UNWIND(.fnstart)
144 movs ip, ip, lsr #1 145 movs ip, ip, lsr #1
145 mov xh, #1 146 mov xh, #1
146 bne 4b 147 bne 4b
147 mov pc, lr 148 ret lr
148 149
1498: @ Division by a power of 2: determine what that divisor order is 1508: @ Division by a power of 2: determine what that divisor order is
150 @ then simply shift values around 151 @ then simply shift values around
@@ -184,13 +185,13 @@ UNWIND(.fnstart)
184 THUMB( orr yl, yl, xh ) 185 THUMB( orr yl, yl, xh )
185 mov xh, xl, lsl ip 186 mov xh, xl, lsl ip
186 mov xh, xh, lsr ip 187 mov xh, xh, lsr ip
187 mov pc, lr 188 ret lr
188 189
189 @ eq -> division by 1: obvious enough... 190 @ eq -> division by 1: obvious enough...
1909: moveq yl, xl 1919: moveq yl, xl
191 moveq yh, xh 192 moveq yh, xh
192 moveq xh, #0 193 moveq xh, #0
193 moveq pc, lr 194 reteq lr
194UNWIND(.fnend) 195UNWIND(.fnend)
195 196
196UNWIND(.fnstart) 197UNWIND(.fnstart)
diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S
index 64f6bc1a9132..7848780e8834 100644
--- a/arch/arm/lib/findbit.S
+++ b/arch/arm/lib/findbit.S
@@ -35,7 +35,7 @@ ENTRY(_find_first_zero_bit_le)
352: cmp r2, r1 @ any more? 352: cmp r2, r1 @ any more?
36 blo 1b 36 blo 1b
373: mov r0, r1 @ no free bits 373: mov r0, r1 @ no free bits
38 mov pc, lr 38 ret lr
39ENDPROC(_find_first_zero_bit_le) 39ENDPROC(_find_first_zero_bit_le)
40 40
41/* 41/*
@@ -76,7 +76,7 @@ ENTRY(_find_first_bit_le)
762: cmp r2, r1 @ any more? 762: cmp r2, r1 @ any more?
77 blo 1b 77 blo 1b
783: mov r0, r1 @ no free bits 783: mov r0, r1 @ no free bits
79 mov pc, lr 79 ret lr
80ENDPROC(_find_first_bit_le) 80ENDPROC(_find_first_bit_le)
81 81
82/* 82/*
@@ -114,7 +114,7 @@ ENTRY(_find_first_zero_bit_be)
1142: cmp r2, r1 @ any more? 1142: cmp r2, r1 @ any more?
115 blo 1b 115 blo 1b
1163: mov r0, r1 @ no free bits 1163: mov r0, r1 @ no free bits
117 mov pc, lr 117 ret lr
118ENDPROC(_find_first_zero_bit_be) 118ENDPROC(_find_first_zero_bit_be)
119 119
120ENTRY(_find_next_zero_bit_be) 120ENTRY(_find_next_zero_bit_be)
@@ -148,7 +148,7 @@ ENTRY(_find_first_bit_be)
1482: cmp r2, r1 @ any more? 1482: cmp r2, r1 @ any more?
149 blo 1b 149 blo 1b
1503: mov r0, r1 @ no free bits 1503: mov r0, r1 @ no free bits
151 mov pc, lr 151 ret lr
152ENDPROC(_find_first_bit_be) 152ENDPROC(_find_first_bit_be)
153 153
154ENTRY(_find_next_bit_be) 154ENTRY(_find_next_bit_be)
@@ -192,5 +192,5 @@ ENDPROC(_find_next_bit_be)
192#endif 192#endif
193 cmp r1, r0 @ Clamp to maxbit 193 cmp r1, r0 @ Clamp to maxbit
194 movlo r0, r1 194 movlo r0, r1
195 mov pc, lr 195 ret lr
196 196
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 9b06bb41fca6..938600098b88 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -18,7 +18,7 @@
18 * Inputs: r0 contains the address 18 * Inputs: r0 contains the address
19 * r1 contains the address limit, which must be preserved 19 * r1 contains the address limit, which must be preserved
20 * Outputs: r0 is the error code 20 * Outputs: r0 is the error code
21 * r2 contains the zero-extended value 21 * r2, r3 contains the zero-extended value
22 * lr corrupted 22 * lr corrupted
23 * 23 *
24 * No other registers must be altered. (see <asm/uaccess.h> 24 * No other registers must be altered. (see <asm/uaccess.h>
@@ -36,7 +36,7 @@ ENTRY(__get_user_1)
36 check_uaccess r0, 1, r1, r2, __get_user_bad 36 check_uaccess r0, 1, r1, r2, __get_user_bad
371: TUSER(ldrb) r2, [r0] 371: TUSER(ldrb) r2, [r0]
38 mov r0, #0 38 mov r0, #0
39 mov pc, lr 39 ret lr
40ENDPROC(__get_user_1) 40ENDPROC(__get_user_1)
41 41
42ENTRY(__get_user_2) 42ENTRY(__get_user_2)
@@ -56,25 +56,60 @@ rb .req r0
56 orr r2, rb, r2, lsl #8 56 orr r2, rb, r2, lsl #8
57#endif 57#endif
58 mov r0, #0 58 mov r0, #0
59 mov pc, lr 59 ret lr
60ENDPROC(__get_user_2) 60ENDPROC(__get_user_2)
61 61
62ENTRY(__get_user_4) 62ENTRY(__get_user_4)
63 check_uaccess r0, 4, r1, r2, __get_user_bad 63 check_uaccess r0, 4, r1, r2, __get_user_bad
644: TUSER(ldr) r2, [r0] 644: TUSER(ldr) r2, [r0]
65 mov r0, #0 65 mov r0, #0
66 mov pc, lr 66 ret lr
67ENDPROC(__get_user_4) 67ENDPROC(__get_user_4)
68 68
69ENTRY(__get_user_8)
70 check_uaccess r0, 8, r1, r2, __get_user_bad
71#ifdef CONFIG_THUMB2_KERNEL
725: TUSER(ldr) r2, [r0]
736: TUSER(ldr) r3, [r0, #4]
74#else
755: TUSER(ldr) r2, [r0], #4
766: TUSER(ldr) r3, [r0]
77#endif
78 mov r0, #0
79 ret lr
80ENDPROC(__get_user_8)
81
82#ifdef __ARMEB__
83ENTRY(__get_user_lo8)
84 check_uaccess r0, 8, r1, r2, __get_user_bad
85#ifdef CONFIG_CPU_USE_DOMAINS
86 add r0, r0, #4
877: ldrt r2, [r0]
88#else
897: ldr r2, [r0, #4]
90#endif
91 mov r0, #0
92 ret lr
93ENDPROC(__get_user_lo8)
94#endif
95
96__get_user_bad8:
97 mov r3, #0
69__get_user_bad: 98__get_user_bad:
70 mov r2, #0 99 mov r2, #0
71 mov r0, #-EFAULT 100 mov r0, #-EFAULT
72 mov pc, lr 101 ret lr
73ENDPROC(__get_user_bad) 102ENDPROC(__get_user_bad)
103ENDPROC(__get_user_bad8)
74 104
75.pushsection __ex_table, "a" 105.pushsection __ex_table, "a"
76 .long 1b, __get_user_bad 106 .long 1b, __get_user_bad
77 .long 2b, __get_user_bad 107 .long 2b, __get_user_bad
78 .long 3b, __get_user_bad 108 .long 3b, __get_user_bad
79 .long 4b, __get_user_bad 109 .long 4b, __get_user_bad
110 .long 5b, __get_user_bad8
111 .long 6b, __get_user_bad8
112#ifdef __ARMEB__
113 .long 7b, __get_user_bad
114#endif
80.popsection 115.popsection
diff --git a/arch/arm/lib/io-readsb.S b/arch/arm/lib/io-readsb.S
index 9f4238987fe9..c31b2f3153f1 100644
--- a/arch/arm/lib/io-readsb.S
+++ b/arch/arm/lib/io-readsb.S
@@ -25,7 +25,7 @@
25 25
26ENTRY(__raw_readsb) 26ENTRY(__raw_readsb)
27 teq r2, #0 @ do we have to check for the zero len? 27 teq r2, #0 @ do we have to check for the zero len?
28 moveq pc, lr 28 reteq lr
29 ands ip, r1, #3 29 ands ip, r1, #3
30 bne .Linsb_align 30 bne .Linsb_align
31 31
diff --git a/arch/arm/lib/io-readsl.S b/arch/arm/lib/io-readsl.S
index 7a7430950c79..2ed86fa5465f 100644
--- a/arch/arm/lib/io-readsl.S
+++ b/arch/arm/lib/io-readsl.S
@@ -12,7 +12,7 @@
12 12
13ENTRY(__raw_readsl) 13ENTRY(__raw_readsl)
14 teq r2, #0 @ do we have to check for the zero len? 14 teq r2, #0 @ do we have to check for the zero len?
15 moveq pc, lr 15 reteq lr
16 ands ip, r1, #3 16 ands ip, r1, #3
17 bne 3f 17 bne 3f
18 18
@@ -33,7 +33,7 @@ ENTRY(__raw_readsl)
33 stmcsia r1!, {r3, ip} 33 stmcsia r1!, {r3, ip}
34 ldrne r3, [r0, #0] 34 ldrne r3, [r0, #0]
35 strne r3, [r1, #0] 35 strne r3, [r1, #0]
36 mov pc, lr 36 ret lr
37 37
383: ldr r3, [r0] 383: ldr r3, [r0]
39 cmp ip, #2 39 cmp ip, #2
@@ -75,5 +75,5 @@ ENTRY(__raw_readsl)
75 strb r3, [r1, #1] 75 strb r3, [r1, #1]
768: mov r3, ip, get_byte_0 768: mov r3, ip, get_byte_0
77 strb r3, [r1, #0] 77 strb r3, [r1, #0]
78 mov pc, lr 78 ret lr
79ENDPROC(__raw_readsl) 79ENDPROC(__raw_readsl)
diff --git a/arch/arm/lib/io-readsw-armv3.S b/arch/arm/lib/io-readsw-armv3.S
index 88487c8c4f23..413da9914529 100644
--- a/arch/arm/lib/io-readsw-armv3.S
+++ b/arch/arm/lib/io-readsw-armv3.S
@@ -27,11 +27,11 @@
27 strb r3, [r1], #1 27 strb r3, [r1], #1
28 28
29 subs r2, r2, #1 29 subs r2, r2, #1
30 moveq pc, lr 30 reteq lr
31 31
32ENTRY(__raw_readsw) 32ENTRY(__raw_readsw)
33 teq r2, #0 @ do we have to check for the zero len? 33 teq r2, #0 @ do we have to check for the zero len?
34 moveq pc, lr 34 reteq lr
35 tst r1, #3 35 tst r1, #3
36 bne .Linsw_align 36 bne .Linsw_align
37 37
diff --git a/arch/arm/lib/io-readsw-armv4.S b/arch/arm/lib/io-readsw-armv4.S
index 1f393d42593d..d9a45e9692ae 100644
--- a/arch/arm/lib/io-readsw-armv4.S
+++ b/arch/arm/lib/io-readsw-armv4.S
@@ -26,7 +26,7 @@
26 26
27ENTRY(__raw_readsw) 27ENTRY(__raw_readsw)
28 teq r2, #0 28 teq r2, #0
29 moveq pc, lr 29 reteq lr
30 tst r1, #3 30 tst r1, #3
31 bne .Linsw_align 31 bne .Linsw_align
32 32
diff --git a/arch/arm/lib/io-writesb.S b/arch/arm/lib/io-writesb.S
index 68b92f4acaeb..a46bbc9b168b 100644
--- a/arch/arm/lib/io-writesb.S
+++ b/arch/arm/lib/io-writesb.S
@@ -45,7 +45,7 @@
45 45
46ENTRY(__raw_writesb) 46ENTRY(__raw_writesb)
47 teq r2, #0 @ do we have to check for the zero len? 47 teq r2, #0 @ do we have to check for the zero len?
48 moveq pc, lr 48 reteq lr
49 ands ip, r1, #3 49 ands ip, r1, #3
50 bne .Loutsb_align 50 bne .Loutsb_align
51 51
diff --git a/arch/arm/lib/io-writesl.S b/arch/arm/lib/io-writesl.S
index d0d104a0dd11..4ea2435988c1 100644
--- a/arch/arm/lib/io-writesl.S
+++ b/arch/arm/lib/io-writesl.S
@@ -12,7 +12,7 @@
12 12
13ENTRY(__raw_writesl) 13ENTRY(__raw_writesl)
14 teq r2, #0 @ do we have to check for the zero len? 14 teq r2, #0 @ do we have to check for the zero len?
15 moveq pc, lr 15 reteq lr
16 ands ip, r1, #3 16 ands ip, r1, #3
17 bne 3f 17 bne 3f
18 18
@@ -33,7 +33,7 @@ ENTRY(__raw_writesl)
33 ldrne r3, [r1, #0] 33 ldrne r3, [r1, #0]
34 strcs ip, [r0, #0] 34 strcs ip, [r0, #0]
35 strne r3, [r0, #0] 35 strne r3, [r0, #0]
36 mov pc, lr 36 ret lr
37 37
383: bic r1, r1, #3 383: bic r1, r1, #3
39 ldr r3, [r1], #4 39 ldr r3, [r1], #4
@@ -47,7 +47,7 @@ ENTRY(__raw_writesl)
47 orr ip, ip, r3, lspush #16 47 orr ip, ip, r3, lspush #16
48 str ip, [r0] 48 str ip, [r0]
49 bne 4b 49 bne 4b
50 mov pc, lr 50 ret lr
51 51
525: mov ip, r3, lspull #8 525: mov ip, r3, lspull #8
53 ldr r3, [r1], #4 53 ldr r3, [r1], #4
@@ -55,7 +55,7 @@ ENTRY(__raw_writesl)
55 orr ip, ip, r3, lspush #24 55 orr ip, ip, r3, lspush #24
56 str ip, [r0] 56 str ip, [r0]
57 bne 5b 57 bne 5b
58 mov pc, lr 58 ret lr
59 59
606: mov ip, r3, lspull #24 606: mov ip, r3, lspull #24
61 ldr r3, [r1], #4 61 ldr r3, [r1], #4
@@ -63,5 +63,5 @@ ENTRY(__raw_writesl)
63 orr ip, ip, r3, lspush #8 63 orr ip, ip, r3, lspush #8
64 str ip, [r0] 64 str ip, [r0]
65 bne 6b 65 bne 6b
66 mov pc, lr 66 ret lr
67ENDPROC(__raw_writesl) 67ENDPROC(__raw_writesl)
diff --git a/arch/arm/lib/io-writesw-armv3.S b/arch/arm/lib/io-writesw-armv3.S
index 49b800419e32..121789eb6802 100644
--- a/arch/arm/lib/io-writesw-armv3.S
+++ b/arch/arm/lib/io-writesw-armv3.S
@@ -28,11 +28,11 @@
28 orr r3, r3, r3, lsl #16 28 orr r3, r3, r3, lsl #16
29 str r3, [r0] 29 str r3, [r0]
30 subs r2, r2, #1 30 subs r2, r2, #1
31 moveq pc, lr 31 reteq lr
32 32
33ENTRY(__raw_writesw) 33ENTRY(__raw_writesw)
34 teq r2, #0 @ do we have to check for the zero len? 34 teq r2, #0 @ do we have to check for the zero len?
35 moveq pc, lr 35 reteq lr
36 tst r1, #3 36 tst r1, #3
37 bne .Loutsw_align 37 bne .Loutsw_align
38 38
diff --git a/arch/arm/lib/io-writesw-armv4.S b/arch/arm/lib/io-writesw-armv4.S
index ff4f71b579ee..269f90c51ad2 100644
--- a/arch/arm/lib/io-writesw-armv4.S
+++ b/arch/arm/lib/io-writesw-armv4.S
@@ -31,7 +31,7 @@
31 31
32ENTRY(__raw_writesw) 32ENTRY(__raw_writesw)
33 teq r2, #0 33 teq r2, #0
34 moveq pc, lr 34 reteq lr
35 ands r3, r1, #3 35 ands r3, r1, #3
36 bne .Loutsw_align 36 bne .Loutsw_align
37 37
@@ -96,5 +96,5 @@ ENTRY(__raw_writesw)
96 tst r2, #1 96 tst r2, #1
973: movne ip, r3, lsr #8 973: movne ip, r3, lsr #8
98 strneh ip, [r0] 98 strneh ip, [r0]
99 mov pc, lr 99 ret lr
100ENDPROC(__raw_writesw) 100ENDPROC(__raw_writesw)
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S
index c562f649734c..947567ff67f9 100644
--- a/arch/arm/lib/lib1funcs.S
+++ b/arch/arm/lib/lib1funcs.S
@@ -210,7 +210,7 @@ ENTRY(__aeabi_uidiv)
210UNWIND(.fnstart) 210UNWIND(.fnstart)
211 211
212 subs r2, r1, #1 212 subs r2, r1, #1
213 moveq pc, lr 213 reteq lr
214 bcc Ldiv0 214 bcc Ldiv0
215 cmp r0, r1 215 cmp r0, r1
216 bls 11f 216 bls 11f
@@ -220,16 +220,16 @@ UNWIND(.fnstart)
220 ARM_DIV_BODY r0, r1, r2, r3 220 ARM_DIV_BODY r0, r1, r2, r3
221 221
222 mov r0, r2 222 mov r0, r2
223 mov pc, lr 223 ret lr
224 224
22511: moveq r0, #1 22511: moveq r0, #1
226 movne r0, #0 226 movne r0, #0
227 mov pc, lr 227 ret lr
228 228
22912: ARM_DIV2_ORDER r1, r2 22912: ARM_DIV2_ORDER r1, r2
230 230
231 mov r0, r0, lsr r2 231 mov r0, r0, lsr r2
232 mov pc, lr 232 ret lr
233 233
234UNWIND(.fnend) 234UNWIND(.fnend)
235ENDPROC(__udivsi3) 235ENDPROC(__udivsi3)
@@ -244,11 +244,11 @@ UNWIND(.fnstart)
244 moveq r0, #0 244 moveq r0, #0
245 tsthi r1, r2 @ see if divisor is power of 2 245 tsthi r1, r2 @ see if divisor is power of 2
246 andeq r0, r0, r2 246 andeq r0, r0, r2
247 movls pc, lr 247 retls lr
248 248
249 ARM_MOD_BODY r0, r1, r2, r3 249 ARM_MOD_BODY r0, r1, r2, r3
250 250
251 mov pc, lr 251 ret lr
252 252
253UNWIND(.fnend) 253UNWIND(.fnend)
254ENDPROC(__umodsi3) 254ENDPROC(__umodsi3)
@@ -274,23 +274,23 @@ UNWIND(.fnstart)
274 274
275 cmp ip, #0 275 cmp ip, #0
276 rsbmi r0, r0, #0 276 rsbmi r0, r0, #0
277 mov pc, lr 277 ret lr
278 278
27910: teq ip, r0 @ same sign ? 27910: teq ip, r0 @ same sign ?
280 rsbmi r0, r0, #0 280 rsbmi r0, r0, #0
281 mov pc, lr 281 ret lr
282 282
28311: movlo r0, #0 28311: movlo r0, #0
284 moveq r0, ip, asr #31 284 moveq r0, ip, asr #31
285 orreq r0, r0, #1 285 orreq r0, r0, #1
286 mov pc, lr 286 ret lr
287 287
28812: ARM_DIV2_ORDER r1, r2 28812: ARM_DIV2_ORDER r1, r2
289 289
290 cmp ip, #0 290 cmp ip, #0
291 mov r0, r3, lsr r2 291 mov r0, r3, lsr r2
292 rsbmi r0, r0, #0 292 rsbmi r0, r0, #0
293 mov pc, lr 293 ret lr
294 294
295UNWIND(.fnend) 295UNWIND(.fnend)
296ENDPROC(__divsi3) 296ENDPROC(__divsi3)
@@ -315,7 +315,7 @@ UNWIND(.fnstart)
315 315
31610: cmp ip, #0 31610: cmp ip, #0
317 rsbmi r0, r0, #0 317 rsbmi r0, r0, #0
318 mov pc, lr 318 ret lr
319 319
320UNWIND(.fnend) 320UNWIND(.fnend)
321ENDPROC(__modsi3) 321ENDPROC(__modsi3)
@@ -331,7 +331,7 @@ UNWIND(.save {r0, r1, ip, lr} )
331 ldmfd sp!, {r1, r2, ip, lr} 331 ldmfd sp!, {r1, r2, ip, lr}
332 mul r3, r0, r2 332 mul r3, r0, r2
333 sub r1, r1, r3 333 sub r1, r1, r3
334 mov pc, lr 334 ret lr
335 335
336UNWIND(.fnend) 336UNWIND(.fnend)
337ENDPROC(__aeabi_uidivmod) 337ENDPROC(__aeabi_uidivmod)
@@ -344,7 +344,7 @@ UNWIND(.save {r0, r1, ip, lr} )
344 ldmfd sp!, {r1, r2, ip, lr} 344 ldmfd sp!, {r1, r2, ip, lr}
345 mul r3, r0, r2 345 mul r3, r0, r2
346 sub r1, r1, r3 346 sub r1, r1, r3
347 mov pc, lr 347 ret lr
348 348
349UNWIND(.fnend) 349UNWIND(.fnend)
350ENDPROC(__aeabi_idivmod) 350ENDPROC(__aeabi_idivmod)
diff --git a/arch/arm/lib/lshrdi3.S b/arch/arm/lib/lshrdi3.S
index f83d449141f7..922dcd88b02b 100644
--- a/arch/arm/lib/lshrdi3.S
+++ b/arch/arm/lib/lshrdi3.S
@@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA. */
27 27
28 28
29#include <linux/linkage.h> 29#include <linux/linkage.h>
30#include <asm/assembler.h>
30 31
31#ifdef __ARMEB__ 32#ifdef __ARMEB__
32#define al r1 33#define al r1
@@ -47,7 +48,7 @@ ENTRY(__aeabi_llsr)
47 THUMB( lslmi r3, ah, ip ) 48 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 ) 49 THUMB( orrmi al, al, r3 )
49 mov ah, ah, lsr r2 50 mov ah, ah, lsr r2
50 mov pc, lr 51 ret lr
51 52
52ENDPROC(__lshrdi3) 53ENDPROC(__lshrdi3)
53ENDPROC(__aeabi_llsr) 54ENDPROC(__aeabi_llsr)
diff --git a/arch/arm/lib/memchr.S b/arch/arm/lib/memchr.S
index 1da86991d700..74a5bed6d999 100644
--- a/arch/arm/lib/memchr.S
+++ b/arch/arm/lib/memchr.S
@@ -22,5 +22,5 @@ ENTRY(memchr)
22 bne 1b 22 bne 1b
23 sub r0, r0, #1 23 sub r0, r0, #1
242: movne r0, #0 242: movne r0, #0
25 mov pc, lr 25 ret lr
26ENDPROC(memchr) 26ENDPROC(memchr)
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 94b0650ea98f..671455c854fa 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -110,7 +110,7 @@ ENTRY(memset)
110 strneb r1, [ip], #1 110 strneb r1, [ip], #1
111 tst r2, #1 111 tst r2, #1
112 strneb r1, [ip], #1 112 strneb r1, [ip], #1
113 mov pc, lr 113 ret lr
114 114
1156: subs r2, r2, #4 @ 1 do we have enough 1156: subs r2, r2, #4 @ 1 do we have enough
116 blt 5b @ 1 bytes to align with? 116 blt 5b @ 1 bytes to align with?
diff --git a/arch/arm/lib/memzero.S b/arch/arm/lib/memzero.S
index 3fbdef5f802a..385ccb306fa2 100644
--- a/arch/arm/lib/memzero.S
+++ b/arch/arm/lib/memzero.S
@@ -121,5 +121,5 @@ ENTRY(__memzero)
121 strneb r2, [r0], #1 @ 1 121 strneb r2, [r0], #1 @ 1
122 tst r1, #1 @ 1 a byte left over 122 tst r1, #1 @ 1 a byte left over
123 strneb r2, [r0], #1 @ 1 123 strneb r2, [r0], #1 @ 1
124 mov pc, lr @ 1 124 ret lr @ 1
125ENDPROC(__memzero) 125ENDPROC(__memzero)
diff --git a/arch/arm/lib/muldi3.S b/arch/arm/lib/muldi3.S
index 36c91b4957e2..204305956925 100644
--- a/arch/arm/lib/muldi3.S
+++ b/arch/arm/lib/muldi3.S
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h>
14 15
15#ifdef __ARMEB__ 16#ifdef __ARMEB__
16#define xh r0 17#define xh r0
@@ -41,7 +42,7 @@ ENTRY(__aeabi_lmul)
41 adc xh, xh, yh, lsr #16 42 adc xh, xh, yh, lsr #16
42 adds xl, xl, ip, lsl #16 43 adds xl, xl, ip, lsl #16
43 adc xh, xh, ip, lsr #16 44 adc xh, xh, ip, lsr #16
44 mov pc, lr 45 ret lr
45 46
46ENDPROC(__muldi3) 47ENDPROC(__muldi3)
47ENDPROC(__aeabi_lmul) 48ENDPROC(__aeabi_lmul)
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index 3d73dcb959b0..38d660d3705f 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -36,7 +36,7 @@ ENTRY(__put_user_1)
36 check_uaccess r0, 1, r1, ip, __put_user_bad 36 check_uaccess r0, 1, r1, ip, __put_user_bad
371: TUSER(strb) r2, [r0] 371: TUSER(strb) r2, [r0]
38 mov r0, #0 38 mov r0, #0
39 mov pc, lr 39 ret lr
40ENDPROC(__put_user_1) 40ENDPROC(__put_user_1)
41 41
42ENTRY(__put_user_2) 42ENTRY(__put_user_2)
@@ -60,14 +60,14 @@ ENTRY(__put_user_2)
60#endif 60#endif
61#endif /* CONFIG_THUMB2_KERNEL */ 61#endif /* CONFIG_THUMB2_KERNEL */
62 mov r0, #0 62 mov r0, #0
63 mov pc, lr 63 ret lr
64ENDPROC(__put_user_2) 64ENDPROC(__put_user_2)
65 65
66ENTRY(__put_user_4) 66ENTRY(__put_user_4)
67 check_uaccess r0, 4, r1, ip, __put_user_bad 67 check_uaccess r0, 4, r1, ip, __put_user_bad
684: TUSER(str) r2, [r0] 684: TUSER(str) r2, [r0]
69 mov r0, #0 69 mov r0, #0
70 mov pc, lr 70 ret lr
71ENDPROC(__put_user_4) 71ENDPROC(__put_user_4)
72 72
73ENTRY(__put_user_8) 73ENTRY(__put_user_8)
@@ -80,12 +80,12 @@ ENTRY(__put_user_8)
806: TUSER(str) r3, [r0] 806: TUSER(str) r3, [r0]
81#endif 81#endif
82 mov r0, #0 82 mov r0, #0
83 mov pc, lr 83 ret lr
84ENDPROC(__put_user_8) 84ENDPROC(__put_user_8)
85 85
86__put_user_bad: 86__put_user_bad:
87 mov r0, #-EFAULT 87 mov r0, #-EFAULT
88 mov pc, lr 88 ret lr
89ENDPROC(__put_user_bad) 89ENDPROC(__put_user_bad)
90 90
91.pushsection __ex_table, "a" 91.pushsection __ex_table, "a"
diff --git a/arch/arm/lib/strchr.S b/arch/arm/lib/strchr.S
index d8f2a1c1aea4..013d64c71e8d 100644
--- a/arch/arm/lib/strchr.S
+++ b/arch/arm/lib/strchr.S
@@ -23,5 +23,5 @@ ENTRY(strchr)
23 teq r2, r1 23 teq r2, r1
24 movne r0, #0 24 movne r0, #0
25 subeq r0, r0, #1 25 subeq r0, r0, #1
26 mov pc, lr 26 ret lr
27ENDPROC(strchr) 27ENDPROC(strchr)
diff --git a/arch/arm/lib/strrchr.S b/arch/arm/lib/strrchr.S
index 302f20cd2423..3cec1c7482c4 100644
--- a/arch/arm/lib/strrchr.S
+++ b/arch/arm/lib/strrchr.S
@@ -22,5 +22,5 @@ ENTRY(strrchr)
22 teq r2, #0 22 teq r2, #0
23 bne 1b 23 bne 1b
24 mov r0, r3 24 mov r0, r3
25 mov pc, lr 25 ret lr
26ENDPROC(strrchr) 26ENDPROC(strrchr)
diff --git a/arch/arm/lib/ucmpdi2.S b/arch/arm/lib/ucmpdi2.S
index f0df6a91db04..ad4a6309141a 100644
--- a/arch/arm/lib/ucmpdi2.S
+++ b/arch/arm/lib/ucmpdi2.S
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h>
14 15
15#ifdef __ARMEB__ 16#ifdef __ARMEB__
16#define xh r0 17#define xh r0
@@ -31,7 +32,7 @@ ENTRY(__ucmpdi2)
31 movlo r0, #0 32 movlo r0, #0
32 moveq r0, #1 33 moveq r0, #1
33 movhi r0, #2 34 movhi r0, #2
34 mov pc, lr 35 ret lr
35 36
36ENDPROC(__ucmpdi2) 37ENDPROC(__ucmpdi2)
37 38
@@ -44,7 +45,7 @@ ENTRY(__aeabi_ulcmp)
44 movlo r0, #-1 45 movlo r0, #-1
45 moveq r0, #0 46 moveq r0, #0
46 movhi r0, #1 47 movhi r0, #1
47 mov pc, lr 48 ret lr
48 49
49ENDPROC(__aeabi_ulcmp) 50ENDPROC(__aeabi_ulcmp)
50 51
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 45b55e0f0db6..6cc6f7aebdae 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -113,14 +113,12 @@ config SOC_AT91RM9200
113 select HAVE_AT91_DBGU0 113 select HAVE_AT91_DBGU0
114 select MULTI_IRQ_HANDLER 114 select MULTI_IRQ_HANDLER
115 select SPARSE_IRQ 115 select SPARSE_IRQ
116 select AT91_USE_OLD_CLK
117 select HAVE_AT91_USB_CLK 116 select HAVE_AT91_USB_CLK
118 117
119config SOC_AT91SAM9260 118config SOC_AT91SAM9260
120 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 119 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
121 select HAVE_AT91_DBGU0 120 select HAVE_AT91_DBGU0
122 select SOC_AT91SAM9 121 select SOC_AT91SAM9
123 select AT91_USE_OLD_CLK
124 select HAVE_AT91_USB_CLK 122 select HAVE_AT91_USB_CLK
125 help 123 help
126 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 124 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
@@ -140,7 +138,6 @@ config SOC_AT91SAM9263
140 select HAVE_AT91_DBGU1 138 select HAVE_AT91_DBGU1
141 select HAVE_FB_ATMEL 139 select HAVE_FB_ATMEL
142 select SOC_AT91SAM9 140 select SOC_AT91SAM9
143 select AT91_USE_OLD_CLK
144 select HAVE_AT91_USB_CLK 141 select HAVE_AT91_USB_CLK
145 142
146config SOC_AT91SAM9RL 143config SOC_AT91SAM9RL
@@ -155,7 +152,6 @@ config SOC_AT91SAM9G45
155 select HAVE_AT91_DBGU1 152 select HAVE_AT91_DBGU1
156 select HAVE_FB_ATMEL 153 select HAVE_FB_ATMEL
157 select SOC_AT91SAM9 154 select SOC_AT91SAM9
158 select AT91_USE_OLD_CLK
159 select HAVE_AT91_UTMI 155 select HAVE_AT91_UTMI
160 select HAVE_AT91_USB_CLK 156 select HAVE_AT91_USB_CLK
161 help 157 help
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 787bb50a4dff..038702ee8bc6 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -26,10 +26,11 @@
26#include "at91_aic.h" 26#include "at91_aic.h"
27#include "soc.h" 27#include "soc.h"
28#include "generic.h" 28#include "generic.h"
29#include "clock.h"
30#include "sam9_smc.h" 29#include "sam9_smc.h"
31#include "pm.h" 30#include "pm.h"
32 31
32#if defined(CONFIG_OLD_CLK_AT91)
33#include "clock.h"
33/* -------------------------------------------------------------------- 34/* --------------------------------------------------------------------
34 * Clocks 35 * Clocks
35 * -------------------------------------------------------------------- */ 36 * -------------------------------------------------------------------- */
@@ -277,6 +278,9 @@ static void __init at91rm9200_register_clocks(void)
277 clk_register(&pck2); 278 clk_register(&pck2);
278 clk_register(&pck3); 279 clk_register(&pck3);
279} 280}
281#else
282#define at91rm9200_register_clocks NULL
283#endif
280 284
281/* -------------------------------------------------------------------- 285/* --------------------------------------------------------------------
282 * GPIO 286 * GPIO
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 3f4bb58aea54..74f1eaf97801 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -15,7 +15,7 @@
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio/driver.h> 18#include <linux/gpio/machine.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/i2c-gpio.h> 20#include <linux/i2c-gpio.h>
21 21
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index c3d22be73b7c..3477ba94c4c5 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -27,10 +27,11 @@
27#include "at91_rstc.h" 27#include "at91_rstc.h"
28#include "soc.h" 28#include "soc.h"
29#include "generic.h" 29#include "generic.h"
30#include "clock.h"
31#include "sam9_smc.h" 30#include "sam9_smc.h"
32#include "pm.h" 31#include "pm.h"
33 32
33#if defined(CONFIG_OLD_CLK_AT91)
34#include "clock.h"
34/* -------------------------------------------------------------------- 35/* --------------------------------------------------------------------
35 * Clocks 36 * Clocks
36 * -------------------------------------------------------------------- */ 37 * -------------------------------------------------------------------- */
@@ -288,6 +289,9 @@ static void __init at91sam9260_register_clocks(void)
288 clk_register(&pck0); 289 clk_register(&pck0);
289 clk_register(&pck1); 290 clk_register(&pck1);
290} 291}
292#else
293#define at91sam9260_register_clocks NULL
294#endif
291 295
292/* -------------------------------------------------------------------- 296/* --------------------------------------------------------------------
293 * GPIO 297 * GPIO
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index f30290572293..810fa5f15a51 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -25,10 +25,11 @@
25#include "at91_rstc.h" 25#include "at91_rstc.h"
26#include "soc.h" 26#include "soc.h"
27#include "generic.h" 27#include "generic.h"
28#include "clock.h"
29#include "sam9_smc.h" 28#include "sam9_smc.h"
30#include "pm.h" 29#include "pm.h"
31 30
31#if defined(CONFIG_OLD_CLK_AT91)
32#include "clock.h"
32/* -------------------------------------------------------------------- 33/* --------------------------------------------------------------------
33 * Clocks 34 * Clocks
34 * -------------------------------------------------------------------- */ 35 * -------------------------------------------------------------------- */
@@ -199,6 +200,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
199 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 200 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
200 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), 201 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
201 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk), 202 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
203 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
202 /* fake hclk clock */ 204 /* fake hclk clock */
203 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 205 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
204 CLKDEV_CON_ID("pioA", &pioA_clk), 206 CLKDEV_CON_ID("pioA", &pioA_clk),
@@ -280,6 +282,9 @@ static void __init at91sam9263_register_clocks(void)
280 clk_register(&pck2); 282 clk_register(&pck2);
281 clk_register(&pck3); 283 clk_register(&pck3);
282} 284}
285#else
286#define at91sam9263_register_clocks NULL
287#endif
283 288
284/* -------------------------------------------------------------------- 289/* --------------------------------------------------------------------
285 * GPIO 290 * GPIO
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 309390d8e2f8..cef0e2f57068 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -1131,9 +1131,7 @@ static void __init at91_add_device_watchdog(void) {}
1131 * PWM 1131 * PWM
1132 * --------------------------------------------------------------------*/ 1132 * --------------------------------------------------------------------*/
1133 1133
1134#if defined(CONFIG_ATMEL_PWM) 1134#if IS_ENABLED(CONFIG_PWM_ATMEL)
1135static u32 pwm_mask;
1136
1137static struct resource pwm_resources[] = { 1135static struct resource pwm_resources[] = {
1138 [0] = { 1136 [0] = {
1139 .start = AT91SAM9263_BASE_PWMC, 1137 .start = AT91SAM9263_BASE_PWMC,
@@ -1148,11 +1146,8 @@ static struct resource pwm_resources[] = {
1148}; 1146};
1149 1147
1150static struct platform_device at91sam9263_pwm0_device = { 1148static struct platform_device at91sam9263_pwm0_device = {
1151 .name = "atmel_pwm", 1149 .name = "at91sam9rl-pwm",
1152 .id = -1, 1150 .id = -1,
1153 .dev = {
1154 .platform_data = &pwm_mask,
1155 },
1156 .resource = pwm_resources, 1151 .resource = pwm_resources,
1157 .num_resources = ARRAY_SIZE(pwm_resources), 1152 .num_resources = ARRAY_SIZE(pwm_resources),
1158}; 1153};
@@ -1171,8 +1166,6 @@ void __init at91_add_device_pwm(u32 mask)
1171 if (mask & (1 << AT91_PWM3)) 1166 if (mask & (1 << AT91_PWM3))
1172 at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */ 1167 at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */
1173 1168
1174 pwm_mask = mask;
1175
1176 platform_device_register(&at91sam9263_pwm0_device); 1169 platform_device_register(&at91sam9263_pwm0_device);
1177} 1170}
1178#else 1171#else
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 9d3d544ac19c..9d45496e4932 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -25,10 +25,11 @@
25#include "at91_aic.h" 25#include "at91_aic.h"
26#include "soc.h" 26#include "soc.h"
27#include "generic.h" 27#include "generic.h"
28#include "clock.h"
29#include "sam9_smc.h" 28#include "sam9_smc.h"
30#include "pm.h" 29#include "pm.h"
31 30
31#if defined(CONFIG_OLD_CLK_AT91)
32#include "clock.h"
32/* -------------------------------------------------------------------- 33/* --------------------------------------------------------------------
33 * Clocks 34 * Clocks
34 * -------------------------------------------------------------------- */ 35 * -------------------------------------------------------------------- */
@@ -251,6 +252,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
251 CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk), 252 CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
252 CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk), 253 CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
253 CLKDEV_CON_DEV_ID(NULL, "atmel_aes", &aestdessha_clk), 254 CLKDEV_CON_DEV_ID(NULL, "atmel_aes", &aestdessha_clk),
255 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
254 /* more usart lookup table for DT entries */ 256 /* more usart lookup table for DT entries */
255 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), 257 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
256 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk), 258 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
@@ -331,6 +333,9 @@ static void __init at91sam9g45_register_clocks(void)
331 clk_register(&pck0); 333 clk_register(&pck0);
332 clk_register(&pck1); 334 clk_register(&pck1);
333} 335}
336#else
337#define at91sam9g45_register_clocks NULL
338#endif
334 339
335/* -------------------------------------------------------------------- 340/* --------------------------------------------------------------------
336 * GPIO 341 * GPIO
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 391ab6bb536a..21ab782cc8e9 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1334,9 +1334,7 @@ static void __init at91_add_device_watchdog(void) {}
1334 * PWM 1334 * PWM
1335 * --------------------------------------------------------------------*/ 1335 * --------------------------------------------------------------------*/
1336 1336
1337#if defined(CONFIG_ATMEL_PWM) || defined(CONFIG_ATMEL_PWM_MODULE) 1337#if IS_ENABLED(CONFIG_PWM_ATMEL)
1338static u32 pwm_mask;
1339
1340static struct resource pwm_resources[] = { 1338static struct resource pwm_resources[] = {
1341 [0] = { 1339 [0] = {
1342 .start = AT91SAM9G45_BASE_PWMC, 1340 .start = AT91SAM9G45_BASE_PWMC,
@@ -1351,11 +1349,8 @@ static struct resource pwm_resources[] = {
1351}; 1349};
1352 1350
1353static struct platform_device at91sam9g45_pwm0_device = { 1351static struct platform_device at91sam9g45_pwm0_device = {
1354 .name = "atmel_pwm", 1352 .name = "at91sam9rl-pwm",
1355 .id = -1, 1353 .id = -1,
1356 .dev = {
1357 .platform_data = &pwm_mask,
1358 },
1359 .resource = pwm_resources, 1354 .resource = pwm_resources,
1360 .num_resources = ARRAY_SIZE(pwm_resources), 1355 .num_resources = ARRAY_SIZE(pwm_resources),
1361}; 1356};
@@ -1374,8 +1369,6 @@ void __init at91_add_device_pwm(u32 mask)
1374 if (mask & (1 << AT91_PWM3)) 1369 if (mask & (1 << AT91_PWM3))
1375 at91_set_B_periph(AT91_PIN_PD0, 1); /* enable PWM3 */ 1370 at91_set_B_periph(AT91_PIN_PD0, 1); /* enable PWM3 */
1376 1371
1377 pwm_mask = mask;
1378
1379 platform_device_register(&at91sam9g45_pwm0_device); 1372 platform_device_register(&at91sam9g45_pwm0_device);
1380} 1373}
1381#else 1374#else
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index a79960f57e6a..878d5015daab 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -200,6 +200,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
200 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk), 200 CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk),
201 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk), 201 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
202 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk), 202 CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
203 CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
203 CLKDEV_CON_ID("pioA", &pioA_clk), 204 CLKDEV_CON_ID("pioA", &pioA_clk),
204 CLKDEV_CON_ID("pioB", &pioB_clk), 205 CLKDEV_CON_ID("pioB", &pioB_clk),
205 CLKDEV_CON_ID("pioC", &pioC_clk), 206 CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 0b1d71a7d9bf..37d1c9ed4562 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -799,9 +799,7 @@ static void __init at91_add_device_watchdog(void) {}
799 * PWM 799 * PWM
800 * --------------------------------------------------------------------*/ 800 * --------------------------------------------------------------------*/
801 801
802#if defined(CONFIG_ATMEL_PWM) 802#if IS_ENABLED(CONFIG_PWM_ATMEL)
803static u32 pwm_mask;
804
805static struct resource pwm_resources[] = { 803static struct resource pwm_resources[] = {
806 [0] = { 804 [0] = {
807 .start = AT91SAM9RL_BASE_PWMC, 805 .start = AT91SAM9RL_BASE_PWMC,
@@ -816,11 +814,8 @@ static struct resource pwm_resources[] = {
816}; 814};
817 815
818static struct platform_device at91sam9rl_pwm0_device = { 816static struct platform_device at91sam9rl_pwm0_device = {
819 .name = "atmel_pwm", 817 .name = "at91sam9rl-pwm",
820 .id = -1, 818 .id = -1,
821 .dev = {
822 .platform_data = &pwm_mask,
823 },
824 .resource = pwm_resources, 819 .resource = pwm_resources,
825 .num_resources = ARRAY_SIZE(pwm_resources), 820 .num_resources = ARRAY_SIZE(pwm_resources),
826}; 821};
@@ -839,8 +834,6 @@ void __init at91_add_device_pwm(u32 mask)
839 if (mask & (1 << AT91_PWM3)) 834 if (mask & (1 << AT91_PWM3))
840 at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */ 835 at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */
841 836
842 pwm_mask = mask;
843
844 platform_device_register(&at91sam9rl_pwm0_device); 837 platform_device_register(&at91sam9rl_pwm0_device);
845} 838}
846#else 839#else
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index cd2726ee5add..fc446097f410 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -32,6 +32,8 @@
32#include <linux/gpio_keys.h> 32#include <linux/gpio_keys.h>
33#include <linux/input.h> 33#include <linux/input.h>
34#include <linux/leds.h> 34#include <linux/leds.h>
35#include <linux/pwm.h>
36#include <linux/leds_pwm.h>
35 37
36#include <video/atmel_lcdc.h> 38#include <video/atmel_lcdc.h>
37 39
@@ -369,21 +371,47 @@ static struct gpio_led ek_leds[] = {
369 .name = "ds3", 371 .name = "ds3",
370 .gpio = AT91_PIN_PB7, 372 .gpio = AT91_PIN_PB7,
371 .default_trigger = "heartbeat", 373 .default_trigger = "heartbeat",
374 },
375#if !IS_ENABLED(CONFIG_LEDS_PWM)
376 {
377 .name = "ds1",
378 .gpio = AT91_PIN_PB8,
379 .active_low = 1,
380 .default_trigger = "none",
372 } 381 }
382#endif
373}; 383};
374 384
375/* 385/*
376 * PWM Leds 386 * PWM Leds
377 */ 387 */
378static struct gpio_led ek_pwm_led[] = { 388static struct pwm_lookup pwm_lookup[] = {
379 /* For now only DS1 is PWM-driven (by pwm1) */ 389 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "ds1",
390 5000, PWM_POLARITY_INVERSED),
391};
392
393#if IS_ENABLED(CONFIG_LEDS_PWM)
394static struct led_pwm pwm_leds[] = {
380 { 395 {
381 .name = "ds1", 396 .name = "ds1",
382 .gpio = 1, /* is PWM channel number */ 397 .max_brightness = 255,
383 .active_low = 1, 398 },
384 .default_trigger = "none", 399};
385 } 400
401static struct led_pwm_platform_data pwm_data = {
402 .num_leds = ARRAY_SIZE(pwm_leds),
403 .leds = pwm_leds,
404};
405
406static struct platform_device leds_pwm = {
407 .name = "leds_pwm",
408 .id = -1,
409 .dev = {
410 .platform_data = &pwm_data,
411 },
386}; 412};
413#endif
414
387 415
388/* 416/*
389 * CAN 417 * CAN
@@ -403,6 +431,12 @@ static struct at91_can_data ek_can_data = {
403 .transceiver_switch = sam9263ek_transceiver_switch, 431 .transceiver_switch = sam9263ek_transceiver_switch,
404}; 432};
405 433
434static struct platform_device *devices[] __initdata = {
435#if IS_ENABLED(CONFIG_LEDS_PWM)
436 &leds_pwm,
437#endif
438};
439
406static void __init ek_board_init(void) 440static void __init ek_board_init(void)
407{ 441{
408 /* Serial */ 442 /* Serial */
@@ -437,9 +471,14 @@ static void __init ek_board_init(void)
437 at91_add_device_ac97(&ek_ac97_data); 471 at91_add_device_ac97(&ek_ac97_data);
438 /* LEDs */ 472 /* LEDs */
439 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 473 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
440 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 474 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
475#if IS_ENABLED(CONFIG_LEDS_PWM)
476 at91_add_device_pwm(1 << AT91_PWM1);
477#endif
441 /* CAN */ 478 /* CAN */
442 at91_add_device_can(&ek_can_data); 479 at91_add_device_can(&ek_can_data);
480 /* Other platform devices */
481 platform_add_devices(devices, ARRAY_SIZE(devices));
443} 482}
444 483
445MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 484MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 1ea61328f30d..b227732b0c83 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -26,6 +26,8 @@
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/pwm.h>
30#include <linux/leds_pwm.h>
29 31
30#include <linux/platform_data/at91_adc.h> 32#include <linux/platform_data/at91_adc.h>
31 33
@@ -416,7 +418,7 @@ static struct gpio_led ek_leds[] = {
416 .active_low = 1, 418 .active_low = 1,
417 .default_trigger = "nand-disk", 419 .default_trigger = "nand-disk",
418 }, 420 },
419#if !(defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE)) 421#if !IS_ENABLED(CONFIG_LEDS_PWM)
420 { /* "right" led, green, userled1, pwm1 */ 422 { /* "right" led, green, userled1, pwm1 */
421 .name = "d7", 423 .name = "d7",
422 .gpio = AT91_PIN_PD31, 424 .gpio = AT91_PIN_PD31,
@@ -430,22 +432,41 @@ static struct gpio_led ek_leds[] = {
430/* 432/*
431 * PWM Leds 433 * PWM Leds
432 */ 434 */
433static struct gpio_led ek_pwm_led[] = { 435static struct pwm_lookup pwm_lookup[] = {
434#if defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE) 436 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "d7",
437 5000, PWM_POLARITY_INVERSED),
438};
439
440#if IS_ENABLED(CONFIG_LEDS_PWM)
441static struct led_pwm pwm_leds[] = {
435 { /* "right" led, green, userled1, pwm1 */ 442 { /* "right" led, green, userled1, pwm1 */
436 .name = "d7", 443 .name = "d7",
437 .gpio = 1, /* is PWM channel number */ 444 .max_brightness = 255,
438 .active_low = 1,
439 .default_trigger = "none",
440 }, 445 },
441#endif
442}; 446};
443 447
448static struct led_pwm_platform_data pwm_data = {
449 .num_leds = ARRAY_SIZE(pwm_leds),
450 .leds = pwm_leds,
451};
452
453static struct platform_device leds_pwm = {
454 .name = "leds_pwm",
455 .id = -1,
456 .dev = {
457 .platform_data = &pwm_data,
458 },
459};
460#endif
461
444static struct platform_device *devices[] __initdata = { 462static struct platform_device *devices[] __initdata = {
445#if defined(CONFIG_SOC_CAMERA_OV2640) || \ 463#if defined(CONFIG_SOC_CAMERA_OV2640) || \
446 defined(CONFIG_SOC_CAMERA_OV2640_MODULE) 464 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
447 &isi_ov2640, 465 &isi_ov2640,
448#endif 466#endif
467#if IS_ENABLED(CONFIG_LEDS_PWM)
468 &leds_pwm,
469#endif
449}; 470};
450 471
451static void __init ek_board_init(void) 472static void __init ek_board_init(void)
@@ -486,7 +507,10 @@ static void __init ek_board_init(void)
486 at91_add_device_ac97(&ek_ac97_data); 507 at91_add_device_ac97(&ek_ac97_data);
487 /* LEDs */ 508 /* LEDs */
488 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 509 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
489 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 510 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
511#if IS_ENABLED(CONFIG_LEDS_PWM)
512 at91_add_device_pwm(1 << AT91_PWM1);
513#endif
490 /* Other platform devices */ 514 /* Other platform devices */
491 platform_add_devices(devices, ARRAY_SIZE(devices)); 515 platform_add_devices(devices, ARRAY_SIZE(devices));
492} 516}
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 4e773b55bc2d..836e9a537e0c 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -123,6 +123,5 @@ extern void __init at91_add_device_can(struct at91_can_data *data);
123 123
124 /* LEDs */ 124 /* LEDs */
125extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); 125extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
126extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
127 126
128#endif 127#endif
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 77c4d8fd03fd..eb22e3357e87 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -54,40 +54,3 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr)
54void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} 54void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
55#endif 55#endif
56 56
57
58/* ------------------------------------------------------------------------- */
59
60#if defined (CONFIG_LEDS_ATMEL_PWM)
61
62/*
63 * PWM Leds
64 */
65
66static struct gpio_led_platform_data pwm_led_data;
67
68static struct platform_device at91_pwm_leds_device = {
69 .name = "leds-atmel-pwm",
70 .id = -1,
71 .dev.platform_data = &pwm_led_data,
72};
73
74void __init at91_pwm_leds(struct gpio_led *leds, int nr)
75{
76 int i;
77 u32 pwm_mask = 0;
78
79 if (!nr)
80 return;
81
82 for (i = 0; i < nr; i++)
83 pwm_mask |= (1 << leds[i].gpio);
84
85 pwm_led_data.leds = leds;
86 pwm_led_data.num_leds = nr;
87
88 at91_add_device_pwm(pwm_mask);
89 platform_device_register(&at91_pwm_leds_device);
90}
91#else
92void __init at91_pwm_leds(struct gpio_led *leds, int nr){}
93#endif
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 41c839167e87..fc938005ad39 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -9,7 +9,6 @@ config ARCH_BCM_MOBILE
9 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 9 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
10 select ARCH_REQUIRE_GPIOLIB 10 select ARCH_REQUIRE_GPIOLIB
11 select ARM_ERRATA_754322 11 select ARM_ERRATA_754322
12 select ARM_ERRATA_764369 if SMP
13 select ARM_ERRATA_775420 12 select ARM_ERRATA_775420
14 select ARM_GIC 13 select ARM_GIC
15 select GPIO_BCM_KONA 14 select GPIO_BCM_KONA
@@ -26,16 +25,18 @@ menu "Broadcom Mobile SoC Selection"
26config ARCH_BCM_281XX 25config ARCH_BCM_281XX
27 bool "Broadcom BCM281XX SoC family" 26 bool "Broadcom BCM281XX SoC family"
28 default y 27 default y
28 select HAVE_SMP
29 help 29 help
30 Enable support for the the BCM281XX family, which includes 30 Enable support for the BCM281XX family, which includes
31 BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155 31 BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155
32 variants. 32 variants.
33 33
34config ARCH_BCM_21664 34config ARCH_BCM_21664
35 bool "Broadcom BCM21664 SoC family" 35 bool "Broadcom BCM21664 SoC family"
36 default y 36 default y
37 select HAVE_SMP
37 help 38 help
38 Enable support for the the BCM21664 family, which includes 39 Enable support for the BCM21664 family, which includes
39 BCM21663 and BCM21664 variants. 40 BCM21663 and BCM21664 variants.
40 41
41config ARCH_BCM_MOBILE_L2_CACHE 42config ARCH_BCM_MOBILE_L2_CACHE
@@ -49,6 +50,17 @@ config ARCH_BCM_MOBILE_SMC
49 bool 50 bool
50 depends on ARCH_BCM_281XX || ARCH_BCM_21664 51 depends on ARCH_BCM_281XX || ARCH_BCM_21664
51 52
53config ARCH_BCM_MOBILE_SMP
54 bool "Broadcom mobile SoC SMP support"
55 depends on (ARCH_BCM_281XX || ARCH_BCM_21664) && SMP
56 default y
57 select HAVE_ARM_SCU
58 select ARM_ERRATA_764369
59 help
60 SMP support for the BCM281XX and BCM21664 SoC families.
61 Provided as an option so SMP support for SoCs of this type
62 can be disabled for an SMP-enabled kernel.
63
52endmenu 64endmenu
53 65
54endif 66endif
@@ -87,4 +99,20 @@ config ARCH_BCM_5301X
87 different SoC or with the older BCM47XX and BCM53XX based 99 different SoC or with the older BCM47XX and BCM53XX based
88 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx 100 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
89 101
102config ARCH_BRCMSTB
103 bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
104 depends on MMU
105 select ARM_GIC
106 select MIGHT_HAVE_PCI
107 select HAVE_SMP
108 select HAVE_ARM_ARCH_TIMER
109 select BRCMSTB_GISB_ARB
110 select BRCMSTB_L2_IRQ
111 help
112 Say Y if you intend to run the kernel on a Broadcom ARM-based STB
113 chipset.
114
115 This enables support for Broadcom ARM-based set-top box chipsets,
116 including the 7445 family of chips.
117
90endif 118endif
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 731292114975..67c492aabf4d 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -16,6 +16,9 @@ obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o
16# BCM21664 16# BCM21664
17obj-$(CONFIG_ARCH_BCM_21664) += board_bcm21664.o 17obj-$(CONFIG_ARCH_BCM_21664) += board_bcm21664.o
18 18
19# BCM281XX and BCM21664 SMP support
20obj-$(CONFIG_ARCH_BCM_MOBILE_SMP) += kona_smp.o
21
19# BCM281XX and BCM21664 L2 cache control 22# BCM281XX and BCM21664 L2 cache control
20obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o 23obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o
21 24
@@ -30,3 +33,8 @@ obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o
30 33
31# BCM5301X 34# BCM5301X
32obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o 35obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
36
37ifeq ($(CONFIG_ARCH_BRCMSTB),y)
38obj-y += brcmstb.o
39obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o
40endif
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
index f0521cc0640d..82ad5687771f 100644
--- a/arch/arm/mach-bcm/board_bcm21664.c
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -60,8 +60,7 @@ static void bcm21664_restart(enum reboot_mode mode, const char *cmd)
60 60
61static void __init bcm21664_init(void) 61static void __init bcm21664_init(void)
62{ 62{
63 of_platform_populate(NULL, of_default_bus_match_table, NULL, 63 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
64 &platform_bus);
65 kona_l2_cache_init(); 64 kona_l2_cache_init();
66} 65}
67 66
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 1ac59fc0cb15..2e367bd7c600 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -58,8 +58,7 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
58 58
59static void __init bcm281xx_init(void) 59static void __init bcm281xx_init(void)
60{ 60{
61 of_platform_populate(NULL, of_default_bus_match_table, NULL, 61 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
62 &platform_bus);
63 kona_l2_cache_init(); 62 kona_l2_cache_init();
64} 63}
65 64
diff --git a/arch/arm/mach-bcm/brcmstb.c b/arch/arm/mach-bcm/brcmstb.c
new file mode 100644
index 000000000000..60a5afa06ed7
--- /dev/null
+++ b/arch/arm/mach-bcm/brcmstb.c
@@ -0,0 +1,28 @@
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#include <linux/init.h>
15#include <linux/of_platform.h>
16
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19
20static const char *brcmstb_match[] __initconst = {
21 "brcm,bcm7445",
22 "brcm,brcmstb",
23 NULL
24};
25
26DT_MACHINE_START(BRCMSTB, "Broadcom STB (Flattened Device Tree)")
27 .dt_compat = brcmstb_match,
28MACHINE_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/kona_smp.c b/arch/arm/mach-bcm/kona_smp.c
new file mode 100644
index 000000000000..66a0465528a5
--- /dev/null
+++ b/arch/arm/mach-bcm/kona_smp.c
@@ -0,0 +1,202 @@
1/*
2 * Copyright (C) 2014 Broadcom Corporation
3 * Copyright 2014 Linaro Limited
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation version 2.
8 *
9 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
10 * kind, whether express or implied; without even the implied warranty
11 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/io.h>
18#include <linux/of.h>
19#include <linux/sched.h>
20
21#include <asm/smp.h>
22#include <asm/smp_plat.h>
23#include <asm/smp_scu.h>
24
25/* Size of mapped Cortex A9 SCU address space */
26#define CORTEX_A9_SCU_SIZE 0x58
27
28#define SECONDARY_TIMEOUT_NS NSEC_PER_MSEC /* 1 msec (in nanoseconds) */
29#define BOOT_ADDR_CPUID_MASK 0x3
30
31/* Name of device node property defining secondary boot register location */
32#define OF_SECONDARY_BOOT "secondary-boot-reg"
33
34/* I/O address of register used to coordinate secondary core startup */
35static u32 secondary_boot;
36
37/*
38 * Enable the Cortex A9 Snoop Control Unit
39 *
40 * By the time this is called we already know there are multiple
41 * cores present. We assume we're running on a Cortex A9 processor,
42 * so any trouble getting the base address register or getting the
43 * SCU base is a problem.
44 *
45 * Return 0 if successful or an error code otherwise.
46 */
47static int __init scu_a9_enable(void)
48{
49 unsigned long config_base;
50 void __iomem *scu_base;
51
52 if (!scu_a9_has_base()) {
53 pr_err("no configuration base address register!\n");
54 return -ENXIO;
55 }
56
57 /* Config base address register value is zero for uniprocessor */
58 config_base = scu_a9_get_base();
59 if (!config_base) {
60 pr_err("hardware reports only one core\n");
61 return -ENOENT;
62 }
63
64 scu_base = ioremap((phys_addr_t)config_base, CORTEX_A9_SCU_SIZE);
65 if (!scu_base) {
66 pr_err("failed to remap config base (%lu/%u) for SCU\n",
67 config_base, CORTEX_A9_SCU_SIZE);
68 return -ENOMEM;
69 }
70
71 scu_enable(scu_base);
72
73 iounmap(scu_base); /* That's the last we'll need of this */
74
75 return 0;
76}
77
78static void __init bcm_smp_prepare_cpus(unsigned int max_cpus)
79{
80 static cpumask_t only_cpu_0 = { CPU_BITS_CPU0 };
81 struct device_node *node;
82 int ret;
83
84 BUG_ON(secondary_boot); /* We're called only once */
85
86 /*
87 * This function is only called via smp_ops->smp_prepare_cpu().
88 * That only happens if a "/cpus" device tree node exists
89 * and has an "enable-method" property that selects the SMP
90 * operations defined herein.
91 */
92 node = of_find_node_by_path("/cpus");
93 BUG_ON(!node);
94
95 /*
96 * Our secondary enable method requires a "secondary-boot-reg"
97 * property to specify a register address used to request the
98 * ROM code boot a secondary code. If we have any trouble
99 * getting this we fall back to uniprocessor mode.
100 */
101 if (of_property_read_u32(node, OF_SECONDARY_BOOT, &secondary_boot)) {
102 pr_err("%s: missing/invalid " OF_SECONDARY_BOOT " property\n",
103 node->name);
104 ret = -ENOENT; /* Arrange to disable SMP */
105 goto out;
106 }
107
108 /*
109 * Enable the SCU on Cortex A9 based SoCs. If -ENOENT is
110 * returned, the SoC reported a uniprocessor configuration.
111 * We bail on any other error.
112 */
113 ret = scu_a9_enable();
114out:
115 of_node_put(node);
116 if (ret) {
117 /* Update the CPU present map to reflect uniprocessor mode */
118 BUG_ON(ret != -ENOENT);
119 pr_warn("disabling SMP\n");
120 init_cpu_present(&only_cpu_0);
121 }
122}
123
124/*
125 * The ROM code has the secondary cores looping, waiting for an event.
126 * When an event occurs each core examines the bottom two bits of the
127 * secondary boot register. When a core finds those bits contain its
128 * own core id, it performs initialization, including computing its boot
129 * address by clearing the boot register value's bottom two bits. The
130 * core signals that it is beginning its execution by writing its boot
131 * address back to the secondary boot register, and finally jumps to
132 * that address.
133 *
134 * So to start a core executing we need to:
135 * - Encode the (hardware) CPU id with the bottom bits of the secondary
136 * start address.
137 * - Write that value into the secondary boot register.
138 * - Generate an event to wake up the secondary CPU(s).
139 * - Wait for the secondary boot register to be re-written, which
140 * indicates the secondary core has started.
141 */
142static int bcm_boot_secondary(unsigned int cpu, struct task_struct *idle)
143{
144 void __iomem *boot_reg;
145 phys_addr_t boot_func;
146 u64 start_clock;
147 u32 cpu_id;
148 u32 boot_val;
149 bool timeout = false;
150
151 cpu_id = cpu_logical_map(cpu);
152 if (cpu_id & ~BOOT_ADDR_CPUID_MASK) {
153 pr_err("bad cpu id (%u > %u)\n", cpu_id, BOOT_ADDR_CPUID_MASK);
154 return -EINVAL;
155 }
156
157 if (!secondary_boot) {
158 pr_err("required secondary boot register not specified\n");
159 return -EINVAL;
160 }
161
162 boot_reg = ioremap_nocache((phys_addr_t)secondary_boot, sizeof(u32));
163 if (!boot_reg) {
164 pr_err("unable to map boot register for cpu %u\n", cpu_id);
165 return -ENOSYS;
166 }
167
168 /*
169 * Secondary cores will start in secondary_startup(),
170 * defined in "arch/arm/kernel/head.S"
171 */
172 boot_func = virt_to_phys(secondary_startup);
173 BUG_ON(boot_func & BOOT_ADDR_CPUID_MASK);
174 BUG_ON(boot_func > (phys_addr_t)U32_MAX);
175
176 /* The core to start is encoded in the low bits */
177 boot_val = (u32)boot_func | cpu_id;
178 writel_relaxed(boot_val, boot_reg);
179
180 sev();
181
182 /* The low bits will be cleared once the core has started */
183 start_clock = local_clock();
184 while (!timeout && readl_relaxed(boot_reg) == boot_val)
185 timeout = local_clock() - start_clock > SECONDARY_TIMEOUT_NS;
186
187 iounmap(boot_reg);
188
189 if (!timeout)
190 return 0;
191
192 pr_err("timeout waiting for cpu %u to start\n", cpu_id);
193
194 return -ENOSYS;
195}
196
197static struct smp_operations bcm_smp_ops __initdata = {
198 .smp_prepare_cpus = bcm_smp_prepare_cpus,
199 .smp_boot_secondary = bcm_boot_secondary,
200};
201CPU_METHOD_OF_DECLARE(bcm_smp_bcm281xx, "brcm,bcm11351-cpu-method",
202 &bcm_smp_ops);
diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
new file mode 100644
index 000000000000..af780e9c23a6
--- /dev/null
+++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
@@ -0,0 +1,363 @@
1/*
2 * Broadcom STB CPU SMP and hotplug support for ARM
3 *
4 * Copyright (C) 2013-2014 Broadcom Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/delay.h>
17#include <linux/errno.h>
18#include <linux/init.h>
19#include <linux/io.h>
20#include <linux/of_address.h>
21#include <linux/of_platform.h>
22#include <linux/printk.h>
23#include <linux/regmap.h>
24#include <linux/smp.h>
25#include <linux/mfd/syscon.h>
26#include <linux/spinlock.h>
27
28#include <asm/cacheflush.h>
29#include <asm/cp15.h>
30#include <asm/mach-types.h>
31#include <asm/smp_plat.h>
32
33#include "brcmstb.h"
34
35enum {
36 ZONE_MAN_CLKEN_MASK = BIT(0),
37 ZONE_MAN_RESET_CNTL_MASK = BIT(1),
38 ZONE_MAN_MEM_PWR_MASK = BIT(4),
39 ZONE_RESERVED_1_MASK = BIT(5),
40 ZONE_MAN_ISO_CNTL_MASK = BIT(6),
41 ZONE_MANUAL_CONTROL_MASK = BIT(7),
42 ZONE_PWR_DN_REQ_MASK = BIT(9),
43 ZONE_PWR_UP_REQ_MASK = BIT(10),
44 ZONE_BLK_RST_ASSERT_MASK = BIT(12),
45 ZONE_PWR_OFF_STATE_MASK = BIT(25),
46 ZONE_PWR_ON_STATE_MASK = BIT(26),
47 ZONE_DPG_PWR_STATE_MASK = BIT(28),
48 ZONE_MEM_PWR_STATE_MASK = BIT(29),
49 ZONE_RESET_STATE_MASK = BIT(31),
50 CPU0_PWR_ZONE_CTRL_REG = 1,
51 CPU_RESET_CONFIG_REG = 2,
52};
53
54static void __iomem *cpubiuctrl_block;
55static void __iomem *hif_cont_block;
56static u32 cpu0_pwr_zone_ctrl_reg;
57static u32 cpu_rst_cfg_reg;
58static u32 hif_cont_reg;
59
60#ifdef CONFIG_HOTPLUG_CPU
61static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state);
62
63static int per_cpu_sw_state_rd(u32 cpu)
64{
65 sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
66 return per_cpu(per_cpu_sw_state, cpu);
67}
68
69static void per_cpu_sw_state_wr(u32 cpu, int val)
70{
71 per_cpu(per_cpu_sw_state, cpu) = val;
72 dmb();
73 sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu)));
74 dsb_sev();
75}
76#else
77static inline void per_cpu_sw_state_wr(u32 cpu, int val) { }
78#endif
79
80static void __iomem *pwr_ctrl_get_base(u32 cpu)
81{
82 void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg;
83 base += (cpu_logical_map(cpu) * 4);
84 return base;
85}
86
87static u32 pwr_ctrl_rd(u32 cpu)
88{
89 void __iomem *base = pwr_ctrl_get_base(cpu);
90 return readl_relaxed(base);
91}
92
93static void pwr_ctrl_wr(u32 cpu, u32 val)
94{
95 void __iomem *base = pwr_ctrl_get_base(cpu);
96 writel(val, base);
97}
98
99static void cpu_rst_cfg_set(u32 cpu, int set)
100{
101 u32 val;
102 val = readl_relaxed(cpubiuctrl_block + cpu_rst_cfg_reg);
103 if (set)
104 val |= BIT(cpu_logical_map(cpu));
105 else
106 val &= ~BIT(cpu_logical_map(cpu));
107 writel_relaxed(val, cpubiuctrl_block + cpu_rst_cfg_reg);
108}
109
110static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr)
111{
112 const int reg_ofs = cpu_logical_map(cpu) * 8;
113 writel_relaxed(0, hif_cont_block + hif_cont_reg + reg_ofs);
114 writel_relaxed(boot_addr, hif_cont_block + hif_cont_reg + 4 + reg_ofs);
115}
116
117static void brcmstb_cpu_boot(u32 cpu)
118{
119 pr_info("SMP: Booting CPU%d...\n", cpu);
120
121 /*
122 * set the reset vector to point to the secondary_startup
123 * routine
124 */
125 cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup));
126
127 /* unhalt the cpu */
128 cpu_rst_cfg_set(cpu, 0);
129}
130
131static void brcmstb_cpu_power_on(u32 cpu)
132{
133 /*
134 * The secondary cores power was cut, so we must go through
135 * power-on initialization.
136 */
137 u32 tmp;
138
139 pr_info("SMP: Powering up CPU%d...\n", cpu);
140
141 /* Request zone power up */
142 pwr_ctrl_wr(cpu, ZONE_PWR_UP_REQ_MASK);
143
144 /* Wait for the power up FSM to complete */
145 do {
146 tmp = pwr_ctrl_rd(cpu);
147 } while (!(tmp & ZONE_PWR_ON_STATE_MASK));
148
149 per_cpu_sw_state_wr(cpu, 1);
150}
151
152static int brcmstb_cpu_get_power_state(u32 cpu)
153{
154 int tmp = pwr_ctrl_rd(cpu);
155 return (tmp & ZONE_RESET_STATE_MASK) ? 0 : 1;
156}
157
158#ifdef CONFIG_HOTPLUG_CPU
159
160static void brcmstb_cpu_die(u32 cpu)
161{
162 v7_exit_coherency_flush(all);
163
164 /* Prevent all interrupts from reaching this CPU. */
165 arch_local_irq_disable();
166
167 /*
168 * Final full barrier to ensure everything before this instruction has
169 * quiesced.
170 */
171 isb();
172 dsb();
173
174 per_cpu_sw_state_wr(cpu, 0);
175
176 /* Sit and wait to die */
177 wfi();
178
179 /* We should never get here... */
180 panic("Spurious interrupt on CPU %d received!\n", cpu);
181}
182
183static int brcmstb_cpu_kill(u32 cpu)
184{
185 u32 tmp;
186
187 pr_info("SMP: Powering down CPU%d...\n", cpu);
188
189 while (per_cpu_sw_state_rd(cpu))
190 ;
191
192 /* Program zone reset */
193 pwr_ctrl_wr(cpu, ZONE_RESET_STATE_MASK | ZONE_BLK_RST_ASSERT_MASK |
194 ZONE_PWR_DN_REQ_MASK);
195
196 /* Verify zone reset */
197 tmp = pwr_ctrl_rd(cpu);
198 if (!(tmp & ZONE_RESET_STATE_MASK))
199 pr_err("%s: Zone reset bit for CPU %d not asserted!\n",
200 __func__, cpu);
201
202 /* Wait for power down */
203 do {
204 tmp = pwr_ctrl_rd(cpu);
205 } while (!(tmp & ZONE_PWR_OFF_STATE_MASK));
206
207 /* Settle-time from Broadcom-internal DVT reference code */
208 udelay(7);
209
210 /* Assert reset on the CPU */
211 cpu_rst_cfg_set(cpu, 1);
212
213 return 1;
214}
215
216#endif /* CONFIG_HOTPLUG_CPU */
217
218static int __init setup_hifcpubiuctrl_regs(struct device_node *np)
219{
220 int rc = 0;
221 char *name;
222 struct device_node *syscon_np = NULL;
223
224 name = "syscon-cpu";
225
226 syscon_np = of_parse_phandle(np, name, 0);
227 if (!syscon_np) {
228 pr_err("can't find phandle %s\n", name);
229 rc = -EINVAL;
230 goto cleanup;
231 }
232
233 cpubiuctrl_block = of_iomap(syscon_np, 0);
234 if (!cpubiuctrl_block) {
235 pr_err("iomap failed for cpubiuctrl_block\n");
236 rc = -EINVAL;
237 goto cleanup;
238 }
239
240 rc = of_property_read_u32_index(np, name, CPU0_PWR_ZONE_CTRL_REG,
241 &cpu0_pwr_zone_ctrl_reg);
242 if (rc) {
243 pr_err("failed to read 1st entry from %s property (%d)\n", name,
244 rc);
245 rc = -EINVAL;
246 goto cleanup;
247 }
248
249 rc = of_property_read_u32_index(np, name, CPU_RESET_CONFIG_REG,
250 &cpu_rst_cfg_reg);
251 if (rc) {
252 pr_err("failed to read 2nd entry from %s property (%d)\n", name,
253 rc);
254 rc = -EINVAL;
255 goto cleanup;
256 }
257
258cleanup:
259 if (syscon_np)
260 of_node_put(syscon_np);
261
262 return rc;
263}
264
265static int __init setup_hifcont_regs(struct device_node *np)
266{
267 int rc = 0;
268 char *name;
269 struct device_node *syscon_np = NULL;
270
271 name = "syscon-cont";
272
273 syscon_np = of_parse_phandle(np, name, 0);
274 if (!syscon_np) {
275 pr_err("can't find phandle %s\n", name);
276 rc = -EINVAL;
277 goto cleanup;
278 }
279
280 hif_cont_block = of_iomap(syscon_np, 0);
281 if (!hif_cont_block) {
282 pr_err("iomap failed for hif_cont_block\n");
283 rc = -EINVAL;
284 goto cleanup;
285 }
286
287 /* offset is at top of hif_cont_block */
288 hif_cont_reg = 0;
289
290cleanup:
291 if (syscon_np)
292 of_node_put(syscon_np);
293
294 return rc;
295}
296
297static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus)
298{
299 int rc;
300 struct device_node *np;
301 char *name;
302
303 name = "brcm,brcmstb-smpboot";
304 np = of_find_compatible_node(NULL, NULL, name);
305 if (!np) {
306 pr_err("can't find compatible node %s\n", name);
307 return;
308 }
309
310 rc = setup_hifcpubiuctrl_regs(np);
311 if (rc)
312 return;
313
314 rc = setup_hifcont_regs(np);
315 if (rc)
316 return;
317}
318
319static DEFINE_SPINLOCK(boot_lock);
320
321static void brcmstb_secondary_init(unsigned int cpu)
322{
323 /*
324 * Synchronise with the boot thread.
325 */
326 spin_lock(&boot_lock);
327 spin_unlock(&boot_lock);
328}
329
330static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle)
331{
332 /*
333 * set synchronisation state between this boot processor
334 * and the secondary one
335 */
336 spin_lock(&boot_lock);
337
338 /* Bring up power to the core if necessary */
339 if (brcmstb_cpu_get_power_state(cpu) == 0)
340 brcmstb_cpu_power_on(cpu);
341
342 brcmstb_cpu_boot(cpu);
343
344 /*
345 * now the secondary core is starting up let it run its
346 * calibrations, then wait for it to finish
347 */
348 spin_unlock(&boot_lock);
349
350 return 0;
351}
352
353static struct smp_operations brcmstb_smp_ops __initdata = {
354 .smp_prepare_cpus = brcmstb_cpu_ctrl_setup,
355 .smp_secondary_init = brcmstb_secondary_init,
356 .smp_boot_secondary = brcmstb_boot_secondary,
357#ifdef CONFIG_HOTPLUG_CPU
358 .cpu_kill = brcmstb_cpu_kill,
359 .cpu_die = brcmstb_cpu_die,
360#endif
361};
362
363CPU_METHOD_OF_DECLARE(brcmstb_smp, "brcm,brahma-b15", &brcmstb_smp_ops);
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 2631cfc5ab0d..24f85be71671 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -13,7 +13,9 @@ config MACH_BERLIN_BG2
13 bool "Marvell Armada 1500 (BG2)" 13 bool "Marvell Armada 1500 (BG2)"
14 select CACHE_L2X0 14 select CACHE_L2X0
15 select CPU_PJ4B 15 select CPU_PJ4B
16 select HAVE_ARM_SCU if SMP
16 select HAVE_ARM_TWD if SMP 17 select HAVE_ARM_TWD if SMP
18 select HAVE_SMP
17 select PINCTRL_BERLIN_BG2 19 select PINCTRL_BERLIN_BG2
18 20
19config MACH_BERLIN_BG2CD 21config MACH_BERLIN_BG2CD
@@ -25,6 +27,7 @@ config MACH_BERLIN_BG2CD
25config MACH_BERLIN_BG2Q 27config MACH_BERLIN_BG2Q
26 bool "Marvell Armada 1500 Pro (BG2-Q)" 28 bool "Marvell Armada 1500 Pro (BG2-Q)"
27 select CACHE_L2X0 29 select CACHE_L2X0
30 select HAVE_ARM_SCU if SMP
28 select HAVE_ARM_TWD if SMP 31 select HAVE_ARM_TWD if SMP
29 select PINCTRL_BERLIN_BG2Q 32 select PINCTRL_BERLIN_BG2Q
30 33
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
index ab69fe956f49..c0719ecd1890 100644
--- a/arch/arm/mach-berlin/Makefile
+++ b/arch/arm/mach-berlin/Makefile
@@ -1 +1,2 @@
1obj-y += berlin.o 1obj-y += berlin.o
2obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/mach-berlin/headsmp.S b/arch/arm/mach-berlin/headsmp.S
new file mode 100644
index 000000000000..4a4c56a58ad3
--- /dev/null
+++ b/arch/arm/mach-berlin/headsmp.S
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2014 Marvell Technology Group Ltd.
3 *
4 * Antoine Ténart <antoine.tenart@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/linkage.h>
12#include <linux/init.h>
13#include <asm/assembler.h>
14
15ENTRY(berlin_secondary_startup)
16 ARM_BE8(setend be)
17 bl v7_invalidate_l1
18 b secondary_startup
19ENDPROC(berlin_secondary_startup)
20
21/*
22 * If the following instruction is set in the reset exception vector, CPUs
23 * will fetch the value of the software reset address vector when being
24 * reset.
25 */
26.global boot_inst
27boot_inst:
28 ldr pc, [pc, #140]
29
30 .align
diff --git a/arch/arm/mach-berlin/platsmp.c b/arch/arm/mach-berlin/platsmp.c
new file mode 100644
index 000000000000..702e7982015a
--- /dev/null
+++ b/arch/arm/mach-berlin/platsmp.c
@@ -0,0 +1,99 @@
1/*
2 * Copyright (C) 2014 Marvell Technology Group Ltd.
3 *
4 * Antoine Ténart <antoine.tenart@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/io.h>
12#include <linux/delay.h>
13#include <linux/of.h>
14#include <linux/of_address.h>
15
16#include <asm/cacheflush.h>
17#include <asm/smp_plat.h>
18#include <asm/smp_scu.h>
19
20#define CPU_RESET 0x00
21
22#define RESET_VECT 0x00
23#define SW_RESET_ADDR 0x94
24
25extern void berlin_secondary_startup(void);
26extern u32 boot_inst;
27
28static void __iomem *cpu_ctrl;
29
30static inline void berlin_perform_reset_cpu(unsigned int cpu)
31{
32 u32 val;
33
34 val = readl(cpu_ctrl + CPU_RESET);
35 val |= BIT(cpu_logical_map(cpu));
36 writel(val, cpu_ctrl + CPU_RESET);
37}
38
39static int berlin_boot_secondary(unsigned int cpu, struct task_struct *idle)
40{
41 if (!cpu_ctrl)
42 return -EFAULT;
43
44 /*
45 * Reset the CPU, making it to execute the instruction in the reset
46 * exception vector.
47 */
48 berlin_perform_reset_cpu(cpu);
49
50 return 0;
51}
52
53static void __init berlin_smp_prepare_cpus(unsigned int max_cpus)
54{
55 struct device_node *np;
56 void __iomem *scu_base;
57 void __iomem *vectors_base;
58
59 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
60 scu_base = of_iomap(np, 0);
61 of_node_put(np);
62 if (!scu_base)
63 return;
64
65 np = of_find_compatible_node(NULL, NULL, "marvell,berlin-cpu-ctrl");
66 cpu_ctrl = of_iomap(np, 0);
67 of_node_put(np);
68 if (!cpu_ctrl)
69 goto unmap_scu;
70
71 vectors_base = ioremap(CONFIG_VECTORS_BASE, SZ_32K);
72 if (!vectors_base)
73 goto unmap_scu;
74
75 scu_enable(scu_base);
76 flush_cache_all();
77
78 /*
79 * Write the first instruction the CPU will execute after being reset
80 * in the reset exception vector.
81 */
82 writel(boot_inst, vectors_base + RESET_VECT);
83
84 /*
85 * Write the secondary startup address into the SW reset address
86 * vector. This is used by boot_inst.
87 */
88 writel(virt_to_phys(berlin_secondary_startup), vectors_base + SW_RESET_ADDR);
89
90 iounmap(vectors_base);
91unmap_scu:
92 iounmap(scu_base);
93}
94
95static struct smp_operations berlin_smp_ops __initdata = {
96 .smp_prepare_cpus = berlin_smp_prepare_cpus,
97 .smp_boot_secondary = berlin_boot_secondary,
98};
99CPU_METHOD_OF_DECLARE(berlin_smp, "marvell,berlin-smp", &berlin_smp_ops);
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index d62ca16d5394..45abf6bd5f68 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -266,7 +266,6 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
266 /* Maintainer: Thomas Gleixner */ 266 /* Maintainer: Thomas Gleixner */
267 .atag_offset = 0x20000, 267 .atag_offset = 0x20000,
268 .map_io = clps711x_map_io, 268 .map_io = clps711x_map_io,
269 .init_early = clps711x_init_early,
270 .init_irq = clps711x_init_irq, 269 .init_irq = clps711x_init_irq,
271 .init_time = clps711x_timer_init, 270 .init_time = clps711x_timer_init,
272 .init_machine = autcpu12_init, 271 .init_machine = autcpu12_init,
diff --git a/arch/arm/mach-clps711x/board-cdb89712.c b/arch/arm/mach-clps711x/board-cdb89712.c
index e261a47f2aff..1ec378c334e5 100644
--- a/arch/arm/mach-clps711x/board-cdb89712.c
+++ b/arch/arm/mach-clps711x/board-cdb89712.c
@@ -140,7 +140,6 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
140 /* Maintainer: Ray Lehtiniemi */ 140 /* Maintainer: Ray Lehtiniemi */
141 .atag_offset = 0x100, 141 .atag_offset = 0x100,
142 .map_io = clps711x_map_io, 142 .map_io = clps711x_map_io,
143 .init_early = clps711x_init_early,
144 .init_irq = clps711x_init_irq, 143 .init_irq = clps711x_init_irq,
145 .init_time = clps711x_timer_init, 144 .init_time = clps711x_timer_init,
146 .init_machine = cdb89712_init, 145 .init_machine = cdb89712_init,
diff --git a/arch/arm/mach-clps711x/board-clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c
index 94a7add88a3f..f9ca22b646bf 100644
--- a/arch/arm/mach-clps711x/board-clep7312.c
+++ b/arch/arm/mach-clps711x/board-clep7312.c
@@ -25,6 +25,7 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26 26
27#include "common.h" 27#include "common.h"
28#include "devices.h"
28 29
29static void __init 30static void __init
30fixup_clep7312(struct tag *tags, char **cmdline) 31fixup_clep7312(struct tag *tags, char **cmdline)
@@ -37,8 +38,8 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
37 .atag_offset = 0x0100, 38 .atag_offset = 0x0100,
38 .fixup = fixup_clep7312, 39 .fixup = fixup_clep7312,
39 .map_io = clps711x_map_io, 40 .map_io = clps711x_map_io,
40 .init_early = clps711x_init_early,
41 .init_irq = clps711x_init_irq, 41 .init_irq = clps711x_init_irq,
42 .init_time = clps711x_timer_init, 42 .init_time = clps711x_timer_init,
43 .init_machine = clps711x_devices_init,
43 .restart = clps711x_restart, 44 .restart = clps711x_restart,
44MACHINE_END 45MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index f9828f89972a..fdf54d40909a 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -148,26 +148,21 @@ fixup_edb7211(struct tag *tags, char **cmdline)
148 memblock_add(0xc1000000, SZ_8M); 148 memblock_add(0xc1000000, SZ_8M);
149} 149}
150 150
151static void __init edb7211_init(void)
152{
153 clps711x_devices_init();
154}
155
156static void __init edb7211_init_late(void) 151static void __init edb7211_init_late(void)
157{ 152{
158 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); 153 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
159 154
160 platform_device_register(&edb7211_flash_pdev); 155 platform_device_register(&edb7211_flash_pdev);
161 platform_device_register_data(&platform_bus, "platform-lcd", 0, 156 platform_device_register_data(NULL, "platform-lcd", 0,
162 &edb7211_lcd_power_pdata, 157 &edb7211_lcd_power_pdata,
163 sizeof(edb7211_lcd_power_pdata)); 158 sizeof(edb7211_lcd_power_pdata));
164 platform_device_register_data(&platform_bus, "generic-bl", 0, 159 platform_device_register_data(NULL, "generic-bl", 0,
165 &edb7211_lcd_backlight_pdata, 160 &edb7211_lcd_backlight_pdata,
166 sizeof(edb7211_lcd_backlight_pdata)); 161 sizeof(edb7211_lcd_backlight_pdata));
167 platform_device_register_simple("video-clps711x", 0, NULL, 0); 162 platform_device_register_simple("video-clps711x", 0, NULL, 0);
168 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, 163 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
169 ARRAY_SIZE(edb7211_cs8900_resource)); 164 ARRAY_SIZE(edb7211_cs8900_resource));
170 platform_device_register_data(&platform_bus, "i2c-gpio", 0, 165 platform_device_register_data(NULL, "i2c-gpio", 0,
171 &edb7211_i2c_pdata, 166 &edb7211_i2c_pdata,
172 sizeof(edb7211_i2c_pdata)); 167 sizeof(edb7211_i2c_pdata));
173} 168}
@@ -178,10 +173,9 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
178 .fixup = fixup_edb7211, 173 .fixup = fixup_edb7211,
179 .reserve = edb7211_reserve, 174 .reserve = edb7211_reserve,
180 .map_io = clps711x_map_io, 175 .map_io = clps711x_map_io,
181 .init_early = clps711x_init_early,
182 .init_irq = clps711x_init_irq, 176 .init_irq = clps711x_init_irq,
183 .init_time = clps711x_timer_init, 177 .init_time = clps711x_timer_init,
184 .init_machine = edb7211_init, 178 .init_machine = clps711x_devices_init,
185 .init_late = edb7211_init_late, 179 .init_late = edb7211_init_late,
186 .restart = clps711x_restart, 180 .restart = clps711x_restart,
187MACHINE_END 181MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index 0cf0e51e6546..e68dd629bda2 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -348,14 +348,14 @@ static void __init p720t_init_late(void)
348{ 348{
349 WARN_ON(gpio_request_array(p720t_gpios, ARRAY_SIZE(p720t_gpios))); 349 WARN_ON(gpio_request_array(p720t_gpios, ARRAY_SIZE(p720t_gpios)));
350 350
351 platform_device_register_data(&platform_bus, "platform-lcd", 0, 351 platform_device_register_data(NULL, "platform-lcd", 0,
352 &p720t_lcd_power_pdata, 352 &p720t_lcd_power_pdata,
353 sizeof(p720t_lcd_power_pdata)); 353 sizeof(p720t_lcd_power_pdata));
354 platform_device_register_data(&platform_bus, "generic-bl", 0, 354 platform_device_register_data(NULL, "generic-bl", 0,
355 &p720t_lcd_backlight_pdata, 355 &p720t_lcd_backlight_pdata,
356 sizeof(p720t_lcd_backlight_pdata)); 356 sizeof(p720t_lcd_backlight_pdata));
357 platform_device_register_simple("video-clps711x", 0, NULL, 0); 357 platform_device_register_simple("video-clps711x", 0, NULL, 0);
358 platform_device_register_data(&platform_bus, "leds-gpio", 0, 358 platform_device_register_data(NULL, "leds-gpio", 0,
359 &p720t_gpio_led_pdata, 359 &p720t_gpio_led_pdata,
360 sizeof(p720t_gpio_led_pdata)); 360 sizeof(p720t_gpio_led_pdata));
361} 361}
@@ -365,7 +365,6 @@ MACHINE_START(P720T, "ARM-Prospector720T")
365 .atag_offset = 0x100, 365 .atag_offset = 0x100,
366 .fixup = fixup_p720t, 366 .fixup = fixup_p720t,
367 .map_io = clps711x_map_io, 367 .map_io = clps711x_map_io,
368 .init_early = clps711x_init_early,
369 .init_irq = clps711x_init_irq, 368 .init_irq = clps711x_init_irq,
370 .init_time = clps711x_timer_init, 369 .init_time = clps711x_timer_init,
371 .init_machine = p720t_init, 370 .init_machine = p720t_init,
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index aee81fa46ccf..2a6323b15782 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -193,15 +193,3 @@ void clps711x_restart(enum reboot_mode mode, const char *cmd)
193{ 193{
194 soft_restart(0); 194 soft_restart(0);
195} 195}
196
197static void clps711x_idle(void)
198{
199 clps_writel(1, HALT);
200 asm("mov r0, r0");
201 asm("mov r0, r0");
202}
203
204void __init clps711x_init_early(void)
205{
206 arm_pm_idle = clps711x_idle;
207}
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index 7489139d5d63..f88189963898 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -13,7 +13,6 @@ extern void clps711x_map_io(void);
13extern void clps711x_init_irq(void); 13extern void clps711x_init_irq(void);
14extern void clps711x_timer_init(void); 14extern void clps711x_timer_init(void);
15extern void clps711x_restart(enum reboot_mode mode, const char *cmd); 15extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
16extern void clps711x_init_early(void);
17 16
18/* drivers/irqchip/irq-clps711x.c */ 17/* drivers/irqchip/irq-clps711x.c */
19void clps711x_intc_init(phys_addr_t, resource_size_t); 18void clps711x_intc_init(phys_addr_t, resource_size_t);
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 2001488a5ef2..0c689d3a6710 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -14,6 +14,15 @@
14 14
15#include <mach/hardware.h> 15#include <mach/hardware.h>
16 16
17static const struct resource clps711x_cpuidle_res __initconst =
18 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128);
19
20static void __init clps711x_add_cpuidle(void)
21{
22 platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE,
23 &clps711x_cpuidle_res, 1);
24}
25
17static const phys_addr_t clps711x_gpios[][2] __initconst = { 26static const phys_addr_t clps711x_gpios[][2] __initconst = {
18 { PADR, PADDR }, 27 { PADR, PADDR },
19 { PBDR, PBDDR }, 28 { PBDR, PBDDR },
@@ -83,6 +92,7 @@ static void __init clps711x_add_uart(void)
83 92
84void __init clps711x_devices_init(void) 93void __init clps711x_devices_init(void)
85{ 94{
95 clps711x_add_cpuidle();
86 clps711x_add_gpio(); 96 clps711x_add_gpio();
87 clps711x_add_syscon(); 97 clps711x_add_syscon();
88 clps711x_add_uart(); 98 clps711x_add_uart();
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
deleted file mode 100644
index cb3684f8dae0..000000000000
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ /dev/null
@@ -1,38 +0,0 @@
1/* arch/arm/mach-clps711x/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include <mach/hardware.h>
15
16 .macro addruart, rp, rv, tmp
17#ifndef CONFIG_DEBUG_CLPS711X_UART2
18 mov \rp, #0x0000 @ UART1
19#else
20 mov \rp, #0x1000 @ UART2
21#endif
22 orr \rv, \rp, #CLPS711X_VIRT_BASE
23 orr \rp, \rp, #CLPS711X_PHYS_BASE
24 .endm
25
26 .macro senduart,rd,rx
27 str \rd, [\rx, #0x0480] @ UARTDR
28 .endm
29
30 .macro waituart,rd,rx
31 .endm
32
33 .macro busyuart,rd,rx
341001: ldr \rd, [\rx, #0x0140] @ SYSFLGx
35 tst \rd, #1 << 11 @ UBUSYx
36 bne 1001b
37 .endm
38
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index 5d6afda1c0e8..833129c9f798 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -24,10 +24,7 @@
24 24
25#include <mach/clps711x.h> 25#include <mach/clps711x.h>
26 26
27#define IO_ADDRESS(x) (0xdc000000 + (((x) & 0x03ffffff) | \ 27#define CLPS711X_VIRT_BASE IOMEM(0xfeff0000)
28 (((x) >> 2) & 0x3c000000)))
29
30#define CLPS711X_VIRT_BASE IOMEM(IO_ADDRESS(CLPS711X_PHYS_BASE))
31 28
32#ifndef __ASSEMBLY__ 29#ifndef __ASSEMBLY__
33#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off)) 30#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off))
diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S
index d4e9316ecacb..a5336a5e2739 100644
--- a/arch/arm/mach-davinci/sleep.S
+++ b/arch/arm/mach-davinci/sleep.S
@@ -213,7 +213,7 @@ ddr2clk_stop_done:
213 cmp ip, r0 213 cmp ip, r0
214 bne ddr2clk_stop_done 214 bne ddr2clk_stop_done
215 215
216 mov pc, lr 216 ret lr
217ENDPROC(davinci_ddr_psc_config) 217ENDPROC(davinci_ddr_psc_config)
218 218
219CACHE_FLUSH: 219CACHE_FLUSH:
diff --git a/arch/arm/mach-ebsa110/include/mach/memory.h b/arch/arm/mach-ebsa110/include/mach/memory.h
index 8e49066ad850..866f8a1c6ff7 100644
--- a/arch/arm/mach-ebsa110/include/mach/memory.h
+++ b/arch/arm/mach-ebsa110/include/mach/memory.h
@@ -17,11 +17,6 @@
17#define __ASM_ARCH_MEMORY_H 17#define __ASM_ARCH_MEMORY_H
18 18
19/* 19/*
20 * Physical DRAM offset.
21 */
22#define PLAT_PHYS_OFFSET UL(0x00000000)
23
24/*
25 * Cache flushing area - SRAM 20 * Cache flushing area - SRAM
26 */ 21 */
27#define FLUSH_BASE_PHYS 0x40000000 22#define FLUSH_BASE_PHYS 0x40000000
diff --git a/arch/arm/mach-ep93xx/crunch-bits.S b/arch/arm/mach-ep93xx/crunch-bits.S
index e96923a3017b..ee0be2af5c61 100644
--- a/arch/arm/mach-ep93xx/crunch-bits.S
+++ b/arch/arm/mach-ep93xx/crunch-bits.S
@@ -198,7 +198,7 @@ crunch_load:
198 get_thread_info r10 198 get_thread_info r10
199#endif 199#endif
2002: dec_preempt_count r10, r3 2002: dec_preempt_count r10, r3
201 mov pc, lr 201 ret lr
202 202
203/* 203/*
204 * Back up crunch regs to save area and disable access to them 204 * Back up crunch regs to save area and disable access to them
@@ -277,7 +277,7 @@ ENTRY(crunch_task_copy)
277 mov r3, lr @ preserve return address 277 mov r3, lr @ preserve return address
278 bl crunch_save 278 bl crunch_save
279 msr cpsr_c, ip @ restore interrupt mode 279 msr cpsr_c, ip @ restore interrupt mode
280 mov pc, r3 280 ret r3
281 281
282/* 282/*
283 * Restore crunch state from given memory address 283 * Restore crunch state from given memory address
@@ -310,4 +310,4 @@ ENTRY(crunch_task_restore)
310 mov r3, lr @ preserve return address 310 mov r3, lr @ preserve return address
311 bl crunch_load 311 bl crunch_load
312 msr cpsr_c, ip @ restore interrupt mode 312 msr cpsr_c, ip @ restore interrupt mode
313 mov pc, r3 313 ret r3
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h
deleted file mode 100644
index c9400cf0051c..000000000000
--- a/arch/arm/mach-ep93xx/include/mach/memory.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#if defined(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET)
9#define PLAT_PHYS_OFFSET UL(0x00000000)
10#elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET)
11#define PLAT_PHYS_OFFSET UL(0xc0000000)
12#elif defined(CONFIG_EP93XX_SDCE1_PHYS_OFFSET)
13#define PLAT_PHYS_OFFSET UL(0xd0000000)
14#elif defined(CONFIG_EP93XX_SDCE2_PHYS_OFFSET)
15#define PLAT_PHYS_OFFSET UL(0xe0000000)
16#elif defined(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET)
17#define PLAT_PHYS_OFFSET UL(0xf0000000)
18#else
19#error "Kconfig bug: No EP93xx PHYS_OFFSET set"
20#endif
21
22#endif
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 8f9b66c4ac78..2d0240f241b8 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -100,7 +100,6 @@ config SOC_EXYNOS5440
100 default y 100 default y
101 depends on ARCH_EXYNOS5 101 depends on ARCH_EXYNOS5
102 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 102 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
103 select ARCH_HAS_OPP
104 select HAVE_ARM_ARCH_TIMER 103 select HAVE_ARM_ARCH_TIMER
105 select AUTO_ZRELADDR 104 select AUTO_ZRELADDR
106 select MIGHT_HAVE_PCI 105 select MIGHT_HAVE_PCI
@@ -119,6 +118,7 @@ config EXYNOS5420_MCPM
119 bool "Exynos5420 Multi-Cluster PM support" 118 bool "Exynos5420 Multi-Cluster PM support"
120 depends on MCPM && SOC_EXYNOS5420 119 depends on MCPM && SOC_EXYNOS5420
121 select ARM_CCI 120 select ARM_CCI
121 select ARM_CPU_SUSPEND
122 help 122 help
123 This is needed to provide CPU and cluster power management 123 This is needed to provide CPU and cluster power management
124 on Exynos5420 implementing big.LITTLE. 124 on Exynos5420 implementing big.LITTLE.
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 1ee91763fa7c..47b904b3b973 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -111,25 +111,14 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
111#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \ 111#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
112 soc_is_exynos5420() || soc_is_exynos5800()) 112 soc_is_exynos5420() || soc_is_exynos5800())
113 113
114void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
115
116struct map_desc;
117extern void __iomem *sysram_ns_base_addr; 114extern void __iomem *sysram_ns_base_addr;
118extern void __iomem *sysram_base_addr; 115extern void __iomem *sysram_base_addr;
119void exynos_init_io(void); 116extern void __iomem *pmu_base_addr;
120void exynos_restart(enum reboot_mode mode, const char *cmd);
121void exynos_sysram_init(void); 117void exynos_sysram_init(void);
122void exynos_cpuidle_init(void);
123void exynos_cpufreq_init(void);
124void exynos_init_late(void);
125 118
126void exynos_firmware_init(void); 119void exynos_firmware_init(void);
127 120
128#ifdef CONFIG_PINCTRL_EXYNOS
129extern u32 exynos_get_eint_wake_mask(void); 121extern u32 exynos_get_eint_wake_mask(void);
130#else
131static inline u32 exynos_get_eint_wake_mask(void) { return 0xffffffff; }
132#endif
133 122
134#ifdef CONFIG_PM_SLEEP 123#ifdef CONFIG_PM_SLEEP
135extern void __init exynos_pm_init(void); 124extern void __init exynos_pm_init(void);
@@ -145,7 +134,7 @@ extern void exynos_cpu_die(unsigned int cpu);
145 134
146/* PMU(Power Management Unit) support */ 135/* PMU(Power Management Unit) support */
147 136
148#define PMU_TABLE_END NULL 137#define PMU_TABLE_END (-1U)
149 138
150enum sys_powerdown { 139enum sys_powerdown {
151 SYS_AFTR, 140 SYS_AFTR,
@@ -155,7 +144,7 @@ enum sys_powerdown {
155}; 144};
156 145
157struct exynos_pmu_conf { 146struct exynos_pmu_conf {
158 void __iomem *reg; 147 unsigned int offset;
159 unsigned int val[NUM_SYS_POWERDOWN]; 148 unsigned int val[NUM_SYS_POWERDOWN];
160}; 149};
161 150
@@ -171,4 +160,14 @@ extern void exynos_enter_aftr(void);
171extern void s5p_init_cpu(void __iomem *cpuid_addr); 160extern void s5p_init_cpu(void __iomem *cpuid_addr);
172extern unsigned int samsung_rev(void); 161extern unsigned int samsung_rev(void);
173 162
163static inline void pmu_raw_writel(u32 val, u32 offset)
164{
165 __raw_writel(val, pmu_base_addr + offset);
166}
167
168static inline u32 pmu_raw_readl(u32 offset)
169{
170 return __raw_readl(pmu_base_addr + offset);
171}
172
174#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ 173#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 66c9b9614f3c..6a24e111d6e1 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -19,6 +19,7 @@
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/pm_domain.h> 21#include <linux/pm_domain.h>
22#include <linux/irqchip.h>
22 23
23#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
@@ -29,6 +30,9 @@
29#include "common.h" 30#include "common.h"
30#include "mfc.h" 31#include "mfc.h"
31#include "regs-pmu.h" 32#include "regs-pmu.h"
33#include "regs-sys.h"
34
35void __iomem *pmu_base_addr;
32 36
33static struct map_desc exynos4_iodesc[] __initdata = { 37static struct map_desc exynos4_iodesc[] __initdata = {
34 { 38 {
@@ -57,11 +61,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
57 .length = SZ_4K, 61 .length = SZ_4K,
58 .type = MT_DEVICE, 62 .type = MT_DEVICE,
59 }, { 63 }, {
60 .virtual = (unsigned long)S5P_VA_PMU,
61 .pfn = __phys_to_pfn(EXYNOS4_PA_PMU),
62 .length = SZ_64K,
63 .type = MT_DEVICE,
64 }, {
65 .virtual = (unsigned long)S5P_VA_COMBINER_BASE, 64 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
66 .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER), 65 .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER),
67 .length = SZ_4K, 66 .length = SZ_4K,
@@ -135,19 +134,14 @@ static struct map_desc exynos5_iodesc[] __initdata = {
135 .pfn = __phys_to_pfn(EXYNOS5_PA_CMU), 134 .pfn = __phys_to_pfn(EXYNOS5_PA_CMU),
136 .length = 144 * SZ_1K, 135 .length = 144 * SZ_1K,
137 .type = MT_DEVICE, 136 .type = MT_DEVICE,
138 }, {
139 .virtual = (unsigned long)S5P_VA_PMU,
140 .pfn = __phys_to_pfn(EXYNOS5_PA_PMU),
141 .length = SZ_64K,
142 .type = MT_DEVICE,
143 }, 137 },
144}; 138};
145 139
146void exynos_restart(enum reboot_mode mode, const char *cmd) 140static void exynos_restart(enum reboot_mode mode, const char *cmd)
147{ 141{
148 struct device_node *np; 142 struct device_node *np;
149 u32 val = 0x1; 143 u32 val = 0x1;
150 void __iomem *addr = EXYNOS_SWRESET; 144 void __iomem *addr = pmu_base_addr + EXYNOS_SWRESET;
151 145
152 if (of_machine_is_compatible("samsung,exynos5440")) { 146 if (of_machine_is_compatible("samsung,exynos5440")) {
153 u32 status; 147 u32 status;
@@ -171,17 +165,6 @@ static struct platform_device exynos_cpuidle = {
171 .id = -1, 165 .id = -1,
172}; 166};
173 167
174void __init exynos_cpuidle_init(void)
175{
176 if (soc_is_exynos4210() || soc_is_exynos5250())
177 platform_device_register(&exynos_cpuidle);
178}
179
180void __init exynos_cpufreq_init(void)
181{
182 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
183}
184
185void __iomem *sysram_base_addr; 168void __iomem *sysram_base_addr;
186void __iomem *sysram_ns_base_addr; 169void __iomem *sysram_ns_base_addr;
187 170
@@ -204,7 +187,7 @@ void __init exynos_sysram_init(void)
204 } 187 }
205} 188}
206 189
207void __init exynos_init_late(void) 190static void __init exynos_init_late(void)
208{ 191{
209 if (of_machine_is_compatible("samsung,exynos5440")) 192 if (of_machine_is_compatible("samsung,exynos5440"))
210 /* to be supported later */ 193 /* to be supported later */
@@ -251,7 +234,7 @@ static void __init exynos_map_io(void)
251 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); 234 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
252} 235}
253 236
254void __init exynos_init_io(void) 237static void __init exynos_init_io(void)
255{ 238{
256 debug_ll_io_init(); 239 debug_ll_io_init();
257 240
@@ -263,6 +246,41 @@ void __init exynos_init_io(void)
263 exynos_map_io(); 246 exynos_map_io();
264} 247}
265 248
249static const struct of_device_id exynos_dt_pmu_match[] = {
250 { .compatible = "samsung,exynos3250-pmu" },
251 { .compatible = "samsung,exynos4210-pmu" },
252 { .compatible = "samsung,exynos4212-pmu" },
253 { .compatible = "samsung,exynos4412-pmu" },
254 { .compatible = "samsung,exynos5250-pmu" },
255 { .compatible = "samsung,exynos5260-pmu" },
256 { .compatible = "samsung,exynos5410-pmu" },
257 { .compatible = "samsung,exynos5420-pmu" },
258 { /*sentinel*/ },
259};
260
261static void exynos_map_pmu(void)
262{
263 struct device_node *np;
264
265 np = of_find_matching_node(NULL, exynos_dt_pmu_match);
266 if (np)
267 pmu_base_addr = of_iomap(np, 0);
268
269 if (!pmu_base_addr)
270 panic("failed to find exynos pmu register\n");
271}
272
273static void __init exynos_init_irq(void)
274{
275 irqchip_init();
276 /*
277 * Since platsmp.c needs pmu base address by the time
278 * DT is not unflatten so we can't use DT APIs before
279 * init_irq
280 */
281 exynos_map_pmu();
282}
283
266static void __init exynos_dt_machine_init(void) 284static void __init exynos_dt_machine_init(void)
267{ 285{
268 struct device_node *i2c_np; 286 struct device_node *i2c_np;
@@ -298,8 +316,11 @@ static void __init exynos_dt_machine_init(void)
298 if (!IS_ENABLED(CONFIG_SMP)) 316 if (!IS_ENABLED(CONFIG_SMP))
299 exynos_sysram_init(); 317 exynos_sysram_init();
300 318
301 exynos_cpuidle_init(); 319 if (of_machine_is_compatible("samsung,exynos4210") ||
302 exynos_cpufreq_init(); 320 of_machine_is_compatible("samsung,exynos5250"))
321 platform_device_register(&exynos_cpuidle);
322
323 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
303 324
304 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 325 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
305} 326}
@@ -352,6 +373,7 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
352 .smp = smp_ops(exynos_smp_ops), 373 .smp = smp_ops(exynos_smp_ops),
353 .map_io = exynos_init_io, 374 .map_io = exynos_init_io,
354 .init_early = exynos_firmware_init, 375 .init_early = exynos_firmware_init,
376 .init_irq = exynos_init_irq,
355 .init_machine = exynos_dt_machine_init, 377 .init_machine = exynos_dt_machine_init,
356 .init_late = exynos_init_late, 378 .init_late = exynos_init_late,
357 .dt_compat = exynos_dt_compat, 379 .dt_compat = exynos_dt_compat,
diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S
index cdd9d91e9933..b54f9701e421 100644
--- a/arch/arm/mach-exynos/headsmp.S
+++ b/arch/arm/mach-exynos/headsmp.S
@@ -1,5 +1,4 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/headsmp.S
3 * 2 *
4 * Cloned from linux/arch/arm/mach-realview/headsmp.S 3 * Cloned from linux/arch/arm/mach-realview/headsmp.S
5 * 4 *
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 920a4baa53cd..4d86961a7957 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -1,5 +1,4 @@
1/* linux arch/arm/mach-exynos4/hotplug.c 1/*
2 *
3 * Cloned from linux/arch/arm/mach-realview/hotplug.c 2 * Cloned from linux/arch/arm/mach-realview/hotplug.c
4 * 3 *
5 * Copyright (C) 2002 ARM Ltd. 4 * Copyright (C) 2002 ARM Ltd.
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 548269a60634..f0b7e92bad6c 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/mach-exynos/include/mach/map.h 1/*
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 3 * http://www.samsung.com/
5 * 4 *
@@ -28,9 +27,6 @@
28#define EXYNOS4_PA_SYSCON 0x10010000 27#define EXYNOS4_PA_SYSCON 0x10010000
29#define EXYNOS5_PA_SYSCON 0x10050100 28#define EXYNOS5_PA_SYSCON 0x10050100
30 29
31#define EXYNOS4_PA_PMU 0x10020000
32#define EXYNOS5_PA_PMU 0x10040000
33
34#define EXYNOS4_PA_CMU 0x10030000 30#define EXYNOS4_PA_CMU 0x10030000
35#define EXYNOS5_PA_CMU 0x10010000 31#define EXYNOS5_PA_CMU 0x10010000
36 32
diff --git a/arch/arm/mach-exynos/include/mach/memory.h b/arch/arm/mach-exynos/include/mach/memory.h
index 2a4cdb7cb326..e19df1f18c0d 100644
--- a/arch/arm/mach-exynos/include/mach/memory.h
+++ b/arch/arm/mach-exynos/include/mach/memory.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/mach-exynos4/include/mach/memory.h 1/*
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index ace0ed617476..b2f8b60cf0e9 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -26,6 +26,10 @@
26#define EXYNOS5420_CPUS_PER_CLUSTER 4 26#define EXYNOS5420_CPUS_PER_CLUSTER 4
27#define EXYNOS5420_NR_CLUSTERS 2 27#define EXYNOS5420_NR_CLUSTERS 2
28 28
29#define EXYNOS5420_ENABLE_AUTOMATIC_CORE_DOWN BIT(9)
30#define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29)
31#define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30)
32
29/* 33/*
30 * The common v7_exit_coherency_flush API could not be used because of the 34 * The common v7_exit_coherency_flush API could not be used because of the
31 * Erratum 799270 workaround. This macro is the same as the common one (in 35 * Erratum 799270 workaround. This macro is the same as the common one (in
@@ -51,7 +55,7 @@
51 "dsb\n\t" \ 55 "dsb\n\t" \
52 "ldmfd sp!, {fp, ip}" \ 56 "ldmfd sp!, {fp, ip}" \
53 : \ 57 : \
54 : "Ir" (S5P_INFORM0) \ 58 : "Ir" (pmu_base_addr + S5P_INFORM0) \
55 : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ 59 : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
56 "r9", "r10", "lr", "memory") 60 "r9", "r10", "lr", "memory")
57 61
@@ -73,36 +77,9 @@ cpu_use_count[EXYNOS5420_CPUS_PER_CLUSTER][EXYNOS5420_NR_CLUSTERS];
73 77
74#define exynos_cluster_unused(cluster) !exynos_cluster_usecnt(cluster) 78#define exynos_cluster_unused(cluster) !exynos_cluster_usecnt(cluster)
75 79
76static int exynos_cluster_power_control(unsigned int cluster, int enable)
77{
78 unsigned int tries = 100;
79 unsigned int val;
80
81 if (enable) {
82 exynos_cluster_power_up(cluster);
83 val = S5P_CORE_LOCAL_PWR_EN;
84 } else {
85 exynos_cluster_power_down(cluster);
86 val = 0;
87 }
88
89 /* Wait until cluster power control is applied */
90 while (tries--) {
91 if (exynos_cluster_power_state(cluster) == val)
92 return 0;
93
94 cpu_relax();
95 }
96 pr_debug("timed out waiting for cluster %u to power %s\n", cluster,
97 enable ? "on" : "off");
98
99 return -ETIMEDOUT;
100}
101
102static int exynos_power_up(unsigned int cpu, unsigned int cluster) 80static int exynos_power_up(unsigned int cpu, unsigned int cluster)
103{ 81{
104 unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER); 82 unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
105 int err = 0;
106 83
107 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); 84 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
108 if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER || 85 if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
@@ -126,12 +103,9 @@ static int exynos_power_up(unsigned int cpu, unsigned int cluster)
126 * cores. 103 * cores.
127 */ 104 */
128 if (was_cluster_down) 105 if (was_cluster_down)
129 err = exynos_cluster_power_control(cluster, 1); 106 exynos_cluster_power_up(cluster);
130 107
131 if (!err) 108 exynos_cpu_power_up(cpunr);
132 exynos_cpu_power_up(cpunr);
133 else
134 exynos_cluster_power_control(cluster, 0);
135 } else if (cpu_use_count[cpu][cluster] != 2) { 109 } else if (cpu_use_count[cpu][cluster] != 2) {
136 /* 110 /*
137 * The only possible values are: 111 * The only possible values are:
@@ -147,7 +121,7 @@ static int exynos_power_up(unsigned int cpu, unsigned int cluster)
147 arch_spin_unlock(&exynos_mcpm_lock); 121 arch_spin_unlock(&exynos_mcpm_lock);
148 local_irq_enable(); 122 local_irq_enable();
149 123
150 return err; 124 return 0;
151} 125}
152 126
153/* 127/*
@@ -178,9 +152,10 @@ static void exynos_power_down(void)
178 if (cpu_use_count[cpu][cluster] == 0) { 152 if (cpu_use_count[cpu][cluster] == 0) {
179 exynos_cpu_power_down(cpunr); 153 exynos_cpu_power_down(cpunr);
180 154
181 if (exynos_cluster_unused(cluster)) 155 if (exynos_cluster_unused(cluster)) {
182 /* TODO: Turn off the cluster here to save power. */ 156 exynos_cluster_power_down(cluster);
183 last_man = true; 157 last_man = true;
158 }
184 } else if (cpu_use_count[cpu][cluster] == 1) { 159 } else if (cpu_use_count[cpu][cluster] == 1) {
185 /* 160 /*
186 * A power_up request went ahead of us. 161 * A power_up request went ahead of us.
@@ -196,7 +171,7 @@ static void exynos_power_down(void)
196 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) { 171 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
197 arch_spin_unlock(&exynos_mcpm_lock); 172 arch_spin_unlock(&exynos_mcpm_lock);
198 173
199 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A15) { 174 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A15) {
200 /* 175 /*
201 * On the Cortex-A15 we need to disable 176 * On the Cortex-A15 we need to disable
202 * L2 prefetching before flushing the cache. 177 * L2 prefetching before flushing the cache.
@@ -257,10 +232,46 @@ static int exynos_wait_for_powerdown(unsigned int cpu, unsigned int cluster)
257 return -ETIMEDOUT; /* timeout */ 232 return -ETIMEDOUT; /* timeout */
258} 233}
259 234
235static void exynos_powered_up(void)
236{
237 unsigned int mpidr, cpu, cluster;
238
239 mpidr = read_cpuid_mpidr();
240 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
241 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
242
243 arch_spin_lock(&exynos_mcpm_lock);
244 if (cpu_use_count[cpu][cluster] == 0)
245 cpu_use_count[cpu][cluster] = 1;
246 arch_spin_unlock(&exynos_mcpm_lock);
247}
248
249static void exynos_suspend(u64 residency)
250{
251 unsigned int mpidr, cpunr;
252
253 exynos_power_down();
254
255 /*
256 * Execution reaches here only if cpu did not power down.
257 * Hence roll back the changes done in exynos_power_down function.
258 *
259 * CAUTION: "This function requires the stack data to be visible through
260 * power down and can only be executed on processors like A15 and A7
261 * that hit the cache with the C bit clear in the SCTLR register."
262 */
263 mpidr = read_cpuid_mpidr();
264 cpunr = exynos_pmu_cpunr(mpidr);
265
266 exynos_cpu_power_up(cpunr);
267}
268
260static const struct mcpm_platform_ops exynos_power_ops = { 269static const struct mcpm_platform_ops exynos_power_ops = {
261 .power_up = exynos_power_up, 270 .power_up = exynos_power_up,
262 .power_down = exynos_power_down, 271 .power_down = exynos_power_down,
263 .wait_for_powerdown = exynos_wait_for_powerdown, 272 .wait_for_powerdown = exynos_wait_for_powerdown,
273 .suspend = exynos_suspend,
274 .powered_up = exynos_powered_up,
264}; 275};
265 276
266static void __init exynos_mcpm_usage_count_init(void) 277static void __init exynos_mcpm_usage_count_init(void)
@@ -289,6 +300,19 @@ static void __naked exynos_pm_power_up_setup(unsigned int affinity_level)
289 "b cci_enable_port_for_self"); 300 "b cci_enable_port_for_self");
290} 301}
291 302
303static void __init exynos_cache_off(void)
304{
305 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A15) {
306 /* disable L2 prefetching on the Cortex-A15 */
307 asm volatile(
308 "mcr p15, 1, %0, c15, c0, 3\n\t"
309 "isb\n\t"
310 "dsb"
311 : : "r" (0x400));
312 }
313 exynos_v7_exit_coherency_flush(all);
314}
315
292static const struct of_device_id exynos_dt_mcpm_match[] = { 316static const struct of_device_id exynos_dt_mcpm_match[] = {
293 { .compatible = "samsung,exynos5420" }, 317 { .compatible = "samsung,exynos5420" },
294 { .compatible = "samsung,exynos5800" }, 318 { .compatible = "samsung,exynos5800" },
@@ -299,6 +323,7 @@ static int __init exynos_mcpm_init(void)
299{ 323{
300 struct device_node *node; 324 struct device_node *node;
301 void __iomem *ns_sram_base_addr; 325 void __iomem *ns_sram_base_addr;
326 unsigned int value, i;
302 int ret; 327 int ret;
303 328
304 node = of_find_matching_node(NULL, exynos_dt_mcpm_match); 329 node = of_find_matching_node(NULL, exynos_dt_mcpm_match);
@@ -325,13 +350,15 @@ static int __init exynos_mcpm_init(void)
325 * To increase the stability of KFC reset we need to program 350 * To increase the stability of KFC reset we need to program
326 * the PMU SPARE3 register 351 * the PMU SPARE3 register
327 */ 352 */
328 __raw_writel(EXYNOS5420_SWRESET_KFC_SEL, S5P_PMU_SPARE3); 353 pmu_raw_writel(EXYNOS5420_SWRESET_KFC_SEL, S5P_PMU_SPARE3);
329 354
330 exynos_mcpm_usage_count_init(); 355 exynos_mcpm_usage_count_init();
331 356
332 ret = mcpm_platform_register(&exynos_power_ops); 357 ret = mcpm_platform_register(&exynos_power_ops);
333 if (!ret) 358 if (!ret)
334 ret = mcpm_sync_init(exynos_pm_power_up_setup); 359 ret = mcpm_sync_init(exynos_pm_power_up_setup);
360 if (!ret)
361 ret = mcpm_loopback(exynos_cache_off); /* turn on the CCI */
335 if (ret) { 362 if (ret) {
336 iounmap(ns_sram_base_addr); 363 iounmap(ns_sram_base_addr);
337 return ret; 364 return ret;
@@ -342,6 +369,26 @@ static int __init exynos_mcpm_init(void)
342 pr_info("Exynos MCPM support installed\n"); 369 pr_info("Exynos MCPM support installed\n");
343 370
344 /* 371 /*
372 * On Exynos5420/5800 for the A15 and A7 clusters:
373 *
374 * EXYNOS5420_ENABLE_AUTOMATIC_CORE_DOWN ensures that all the cores
375 * in a cluster are turned off before turning off the cluster L2.
376 *
377 * EXYNOS5420_USE_ARM_CORE_DOWN_STATE ensures that a cores is powered
378 * off before waking it up.
379 *
380 * EXYNOS5420_USE_L2_COMMON_UP_STATE ensures that cluster L2 will be
381 * turned on before the first man is powered up.
382 */
383 for (i = 0; i < EXYNOS5420_NR_CLUSTERS; i++) {
384 value = pmu_raw_readl(EXYNOS_COMMON_OPTION(i));
385 value |= EXYNOS5420_ENABLE_AUTOMATIC_CORE_DOWN |
386 EXYNOS5420_USE_ARM_CORE_DOWN_STATE |
387 EXYNOS5420_USE_L2_COMMON_UP_STATE;
388 pmu_raw_writel(value, EXYNOS_COMMON_OPTION(i));
389 }
390
391 /*
345 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr 392 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
346 * as part of secondary_cpu_start(). Let's redirect it to the 393 * as part of secondary_cpu_start(). Let's redirect it to the
347 * mcpm_entry_point(). 394 * mcpm_entry_point().
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 50b9aad5e27b..a9f1cf759949 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -1,5 +1,4 @@
1/* linux/arch/arm/mach-exynos4/platsmp.c 1 /*
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
@@ -27,15 +26,83 @@
27#include <asm/smp_scu.h> 26#include <asm/smp_scu.h>
28#include <asm/firmware.h> 27#include <asm/firmware.h>
29 28
29#include <mach/map.h>
30
30#include "common.h" 31#include "common.h"
31#include "regs-pmu.h" 32#include "regs-pmu.h"
32 33
33extern void exynos4_secondary_startup(void); 34extern void exynos4_secondary_startup(void);
34 35
36/**
37 * exynos_core_power_down : power down the specified cpu
38 * @cpu : the cpu to power down
39 *
40 * Power down the specified cpu. The sequence must be finished by a
41 * call to cpu_do_idle()
42 *
43 */
44void exynos_cpu_power_down(int cpu)
45{
46 pmu_raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
47}
48
49/**
50 * exynos_cpu_power_up : power up the specified cpu
51 * @cpu : the cpu to power up
52 *
53 * Power up the specified cpu
54 */
55void exynos_cpu_power_up(int cpu)
56{
57 pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN,
58 EXYNOS_ARM_CORE_CONFIGURATION(cpu));
59}
60
61/**
62 * exynos_cpu_power_state : returns the power state of the cpu
63 * @cpu : the cpu to retrieve the power state from
64 *
65 */
66int exynos_cpu_power_state(int cpu)
67{
68 return (pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(cpu)) &
69 S5P_CORE_LOCAL_PWR_EN);
70}
71
72/**
73 * exynos_cluster_power_down : power down the specified cluster
74 * @cluster : the cluster to power down
75 */
76void exynos_cluster_power_down(int cluster)
77{
78 pmu_raw_writel(0, EXYNOS_COMMON_CONFIGURATION(cluster));
79}
80
81/**
82 * exynos_cluster_power_up : power up the specified cluster
83 * @cluster : the cluster to power up
84 */
85void exynos_cluster_power_up(int cluster)
86{
87 pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN,
88 EXYNOS_COMMON_CONFIGURATION(cluster));
89}
90
91/**
92 * exynos_cluster_power_state : returns the power state of the cluster
93 * @cluster : the cluster to retrieve the power state from
94 *
95 */
96int exynos_cluster_power_state(int cluster)
97{
98 return (pmu_raw_readl(EXYNOS_COMMON_STATUS(cluster)) &
99 S5P_CORE_LOCAL_PWR_EN);
100}
101
35static inline void __iomem *cpu_boot_reg_base(void) 102static inline void __iomem *cpu_boot_reg_base(void)
36{ 103{
37 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) 104 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
38 return S5P_INFORM5; 105 return pmu_base_addr + S5P_INFORM5;
39 return sysram_base_addr; 106 return sysram_base_addr;
40} 107}
41 108
@@ -190,7 +257,7 @@ static void __init exynos_smp_init_cpus(void)
190 void __iomem *scu_base = scu_base_addr(); 257 void __iomem *scu_base = scu_base_addr();
191 unsigned int i, ncores; 258 unsigned int i, ncores;
192 259
193 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 260 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
194 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 261 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
195 else 262 else
196 /* 263 /*
@@ -216,7 +283,7 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
216 283
217 exynos_sysram_init(); 284 exynos_sysram_init();
218 285
219 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 286 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
220 scu_enable(scu_base_addr()); 287 scu_enable(scu_base_addr());
221 288
222 /* 289 /*
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 202ca73e49c4..abefacb45976 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -28,13 +28,13 @@
28#include <asm/suspend.h> 28#include <asm/suspend.h>
29 29
30#include <plat/pm-common.h> 30#include <plat/pm-common.h>
31#include <plat/pll.h>
32#include <plat/regs-srom.h> 31#include <plat/regs-srom.h>
33 32
34#include <mach/map.h> 33#include <mach/map.h>
35 34
36#include "common.h" 35#include "common.h"
37#include "regs-pmu.h" 36#include "regs-pmu.h"
37#include "regs-sys.h"
38 38
39/** 39/**
40 * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping 40 * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping
@@ -100,102 +100,20 @@ static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
100 return -ENOENT; 100 return -ENOENT;
101} 101}
102 102
103/**
104 * exynos_core_power_down : power down the specified cpu
105 * @cpu : the cpu to power down
106 *
107 * Power down the specified cpu. The sequence must be finished by a
108 * call to cpu_do_idle()
109 *
110 */
111void exynos_cpu_power_down(int cpu)
112{
113 __raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu));
114}
115
116/**
117 * exynos_cpu_power_up : power up the specified cpu
118 * @cpu : the cpu to power up
119 *
120 * Power up the specified cpu
121 */
122void exynos_cpu_power_up(int cpu)
123{
124 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
125 EXYNOS_ARM_CORE_CONFIGURATION(cpu));
126}
127
128/**
129 * exynos_cpu_power_state : returns the power state of the cpu
130 * @cpu : the cpu to retrieve the power state from
131 *
132 */
133int exynos_cpu_power_state(int cpu)
134{
135 return (__raw_readl(EXYNOS_ARM_CORE_STATUS(cpu)) &
136 S5P_CORE_LOCAL_PWR_EN);
137}
138
139/**
140 * exynos_cluster_power_down : power down the specified cluster
141 * @cluster : the cluster to power down
142 */
143void exynos_cluster_power_down(int cluster)
144{
145 __raw_writel(0, EXYNOS_COMMON_CONFIGURATION(cluster));
146}
147
148/**
149 * exynos_cluster_power_up : power up the specified cluster
150 * @cluster : the cluster to power up
151 */
152void exynos_cluster_power_up(int cluster)
153{
154 __raw_writel(S5P_CORE_LOCAL_PWR_EN,
155 EXYNOS_COMMON_CONFIGURATION(cluster));
156}
157
158/**
159 * exynos_cluster_power_state : returns the power state of the cluster
160 * @cluster : the cluster to retrieve the power state from
161 *
162 */
163int exynos_cluster_power_state(int cluster)
164{
165 return (__raw_readl(EXYNOS_COMMON_STATUS(cluster)) &
166 S5P_CORE_LOCAL_PWR_EN);
167}
168
169#define EXYNOS_BOOT_VECTOR_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 103#define EXYNOS_BOOT_VECTOR_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
170 S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \ 104 pmu_base_addr + S5P_INFORM7 : \
171 (sysram_base_addr + 0x24) : S5P_INFORM0)) 105 (samsung_rev() == EXYNOS4210_REV_1_0 ? \
106 (sysram_base_addr + 0x24) : \
107 pmu_base_addr + S5P_INFORM0))
172#define EXYNOS_BOOT_VECTOR_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 108#define EXYNOS_BOOT_VECTOR_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
173 S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \ 109 pmu_base_addr + S5P_INFORM6 : \
174 (sysram_base_addr + 0x20) : S5P_INFORM1)) 110 (samsung_rev() == EXYNOS4210_REV_1_0 ? \
111 (sysram_base_addr + 0x20) : \
112 pmu_base_addr + S5P_INFORM1))
175 113
176#define S5P_CHECK_AFTR 0xFCBA0D10 114#define S5P_CHECK_AFTR 0xFCBA0D10
177#define S5P_CHECK_SLEEP 0x00000BAD 115#define S5P_CHECK_SLEEP 0x00000BAD
178 116
179/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
180static void exynos_set_wakeupmask(long mask)
181{
182 __raw_writel(mask, S5P_WAKEUP_MASK);
183}
184
185static void exynos_cpu_set_boot_vector(long flags)
186{
187 __raw_writel(virt_to_phys(exynos_cpu_resume), EXYNOS_BOOT_VECTOR_ADDR);
188 __raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG);
189}
190
191void exynos_enter_aftr(void)
192{
193 exynos_set_wakeupmask(0x0000ff3e);
194 exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
195 /* Set value of power down register for aftr mode */
196 exynos_sys_powerdown_conf(SYS_AFTR);
197}
198
199/* For Cortex-A9 Diagnostic and Power control register */ 117/* For Cortex-A9 Diagnostic and Power control register */
200static unsigned int save_arm_register[2]; 118static unsigned int save_arm_register[2];
201 119
@@ -235,6 +153,82 @@ static void exynos_cpu_restore_register(void)
235 : "cc"); 153 : "cc");
236} 154}
237 155
156static void exynos_pm_central_suspend(void)
157{
158 unsigned long tmp;
159
160 /* Setting Central Sequence Register for power down mode */
161 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
162 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
163 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
164}
165
166static int exynos_pm_central_resume(void)
167{
168 unsigned long tmp;
169
170 /*
171 * If PMU failed while entering sleep mode, WFI will be
172 * ignored by PMU and then exiting cpu_do_idle().
173 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
174 * in this situation.
175 */
176 tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
177 if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
178 tmp |= S5P_CENTRAL_LOWPWR_CFG;
179 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
180 /* clear the wakeup state register */
181 pmu_raw_writel(0x0, S5P_WAKEUP_STAT);
182 /* No need to perform below restore code */
183 return -1;
184 }
185
186 return 0;
187}
188
189/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
190static void exynos_set_wakeupmask(long mask)
191{
192 pmu_raw_writel(mask, S5P_WAKEUP_MASK);
193}
194
195static void exynos_cpu_set_boot_vector(long flags)
196{
197 __raw_writel(virt_to_phys(exynos_cpu_resume), EXYNOS_BOOT_VECTOR_ADDR);
198 __raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG);
199}
200
201static int exynos_aftr_finisher(unsigned long flags)
202{
203 exynos_set_wakeupmask(0x0000ff3e);
204 exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
205 /* Set value of power down register for aftr mode */
206 exynos_sys_powerdown_conf(SYS_AFTR);
207 cpu_do_idle();
208
209 return 1;
210}
211
212void exynos_enter_aftr(void)
213{
214 cpu_pm_enter();
215
216 exynos_pm_central_suspend();
217 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
218 exynos_cpu_save_register();
219
220 cpu_suspend(0, exynos_aftr_finisher);
221
222 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
223 scu_enable(S5P_VA_SCU);
224 exynos_cpu_restore_register();
225 }
226
227 exynos_pm_central_resume();
228
229 cpu_pm_exit();
230}
231
238static int exynos_cpu_suspend(unsigned long arg) 232static int exynos_cpu_suspend(unsigned long arg)
239{ 233{
240#ifdef CONFIG_CACHE_L2X0 234#ifdef CONFIG_CACHE_L2X0
@@ -256,37 +250,27 @@ static void exynos_pm_prepare(void)
256 unsigned int tmp; 250 unsigned int tmp;
257 251
258 /* Set wake-up mask registers */ 252 /* Set wake-up mask registers */
259 __raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK); 253 pmu_raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
260 __raw_writel(exynos_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK); 254 pmu_raw_writel(exynos_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
261 255
262 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save)); 256 s3c_pm_do_save(exynos_core_save, ARRAY_SIZE(exynos_core_save));
263 257
264 if (soc_is_exynos5250()) { 258 if (soc_is_exynos5250()) {
265 s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save)); 259 s3c_pm_do_save(exynos5_sys_save, ARRAY_SIZE(exynos5_sys_save));
266 /* Disable USE_RETENTION of JPEG_MEM_OPTION */ 260 /* Disable USE_RETENTION of JPEG_MEM_OPTION */
267 tmp = __raw_readl(EXYNOS5_JPEG_MEM_OPTION); 261 tmp = pmu_raw_readl(EXYNOS5_JPEG_MEM_OPTION);
268 tmp &= ~EXYNOS5_OPTION_USE_RETENTION; 262 tmp &= ~EXYNOS5_OPTION_USE_RETENTION;
269 __raw_writel(tmp, EXYNOS5_JPEG_MEM_OPTION); 263 pmu_raw_writel(tmp, EXYNOS5_JPEG_MEM_OPTION);
270 } 264 }
271 265
272 /* Set value of power down register for sleep mode */ 266 /* Set value of power down register for sleep mode */
273 267
274 exynos_sys_powerdown_conf(SYS_SLEEP); 268 exynos_sys_powerdown_conf(SYS_SLEEP);
275 __raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1); 269 pmu_raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1);
276 270
277 /* ensure at least INFORM0 has the resume address */ 271 /* ensure at least INFORM0 has the resume address */
278 272
279 __raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0); 273 pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
280}
281
282static void exynos_pm_central_suspend(void)
283{
284 unsigned long tmp;
285
286 /* Setting Central Sequence Register for power down mode */
287 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
288 tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
289 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
290} 274}
291 275
292static int exynos_pm_suspend(void) 276static int exynos_pm_suspend(void)
@@ -298,54 +282,31 @@ static int exynos_pm_suspend(void)
298 /* Setting SEQ_OPTION register */ 282 /* Setting SEQ_OPTION register */
299 283
300 tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); 284 tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
301 __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); 285 pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
302 286
303 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 287 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
304 exynos_cpu_save_register(); 288 exynos_cpu_save_register();
305 289
306 return 0; 290 return 0;
307} 291}
308 292
309static int exynos_pm_central_resume(void)
310{
311 unsigned long tmp;
312
313 /*
314 * If PMU failed while entering sleep mode, WFI will be
315 * ignored by PMU and then exiting cpu_do_idle().
316 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
317 * in this situation.
318 */
319 tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
320 if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
321 tmp |= S5P_CENTRAL_LOWPWR_CFG;
322 __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
323 /* clear the wakeup state register */
324 __raw_writel(0x0, S5P_WAKEUP_STAT);
325 /* No need to perform below restore code */
326 return -1;
327 }
328
329 return 0;
330}
331
332static void exynos_pm_resume(void) 293static void exynos_pm_resume(void)
333{ 294{
334 if (exynos_pm_central_resume()) 295 if (exynos_pm_central_resume())
335 goto early_wakeup; 296 goto early_wakeup;
336 297
337 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 298 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
338 exynos_cpu_restore_register(); 299 exynos_cpu_restore_register();
339 300
340 /* For release retention */ 301 /* For release retention */
341 302
342 __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION); 303 pmu_raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION);
343 __raw_writel((1 << 28), S5P_PAD_RET_GPIO_OPTION); 304 pmu_raw_writel((1 << 28), S5P_PAD_RET_GPIO_OPTION);
344 __raw_writel((1 << 28), S5P_PAD_RET_UART_OPTION); 305 pmu_raw_writel((1 << 28), S5P_PAD_RET_UART_OPTION);
345 __raw_writel((1 << 28), S5P_PAD_RET_MMCA_OPTION); 306 pmu_raw_writel((1 << 28), S5P_PAD_RET_MMCA_OPTION);
346 __raw_writel((1 << 28), S5P_PAD_RET_MMCB_OPTION); 307 pmu_raw_writel((1 << 28), S5P_PAD_RET_MMCB_OPTION);
347 __raw_writel((1 << 28), S5P_PAD_RET_EBIA_OPTION); 308 pmu_raw_writel((1 << 28), S5P_PAD_RET_EBIA_OPTION);
348 __raw_writel((1 << 28), S5P_PAD_RET_EBIB_OPTION); 309 pmu_raw_writel((1 << 28), S5P_PAD_RET_EBIB_OPTION);
349 310
350 if (soc_is_exynos5250()) 311 if (soc_is_exynos5250())
351 s3c_pm_do_restore(exynos5_sys_save, 312 s3c_pm_do_restore(exynos5_sys_save,
@@ -353,13 +314,13 @@ static void exynos_pm_resume(void)
353 314
354 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); 315 s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
355 316
356 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 317 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
357 scu_enable(S5P_VA_SCU); 318 scu_enable(S5P_VA_SCU);
358 319
359early_wakeup: 320early_wakeup:
360 321
361 /* Clear SLEEP mode set in INFORM1 */ 322 /* Clear SLEEP mode set in INFORM1 */
362 __raw_writel(0x0, S5P_INFORM1); 323 pmu_raw_writel(0x0, S5P_INFORM1);
363 324
364 return; 325 return;
365} 326}
@@ -403,7 +364,7 @@ static int exynos_suspend_enter(suspend_state_t state)
403 s3c_pm_restore_uarts(); 364 s3c_pm_restore_uarts();
404 365
405 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__, 366 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
406 __raw_readl(S5P_WAKEUP_STAT)); 367 pmu_raw_readl(S5P_WAKEUP_STAT));
407 368
408 s3c_pm_check_restore(); 369 s3c_pm_check_restore();
409 370
@@ -431,52 +392,17 @@ static const struct platform_suspend_ops exynos_suspend_ops = {
431 .valid = suspend_valid_only_mem, 392 .valid = suspend_valid_only_mem,
432}; 393};
433 394
434static int exynos_cpu_pm_notifier(struct notifier_block *self,
435 unsigned long cmd, void *v)
436{
437 int cpu = smp_processor_id();
438
439 switch (cmd) {
440 case CPU_PM_ENTER:
441 if (cpu == 0) {
442 exynos_pm_central_suspend();
443 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
444 exynos_cpu_save_register();
445 }
446 break;
447
448 case CPU_PM_EXIT:
449 if (cpu == 0) {
450 if (read_cpuid_part_number() ==
451 ARM_CPU_PART_CORTEX_A9) {
452 scu_enable(S5P_VA_SCU);
453 exynos_cpu_restore_register();
454 }
455 exynos_pm_central_resume();
456 }
457 break;
458 }
459
460 return NOTIFY_OK;
461}
462
463static struct notifier_block exynos_cpu_pm_notifier_block = {
464 .notifier_call = exynos_cpu_pm_notifier,
465};
466
467void __init exynos_pm_init(void) 395void __init exynos_pm_init(void)
468{ 396{
469 u32 tmp; 397 u32 tmp;
470 398
471 cpu_pm_register_notifier(&exynos_cpu_pm_notifier_block);
472
473 /* Platform-specific GIC callback */ 399 /* Platform-specific GIC callback */
474 gic_arch_extn.irq_set_wake = exynos_irq_set_wake; 400 gic_arch_extn.irq_set_wake = exynos_irq_set_wake;
475 401
476 /* All wakeup disable */ 402 /* All wakeup disable */
477 tmp = __raw_readl(S5P_WAKEUP_MASK); 403 tmp = pmu_raw_readl(S5P_WAKEUP_MASK);
478 tmp |= ((0xFF << 8) | (0x1F << 1)); 404 tmp |= ((0xFF << 8) | (0x1F << 1));
479 __raw_writel(tmp, S5P_WAKEUP_MASK); 405 pmu_raw_writel(tmp, S5P_WAKEUP_MASK);
480 406
481 register_syscore_ops(&exynos_pm_syscore_ops); 407 register_syscore_ops(&exynos_pm_syscore_ops);
482 suspend_set_ops(&exynos_suspend_ops); 408 suspend_set_ops(&exynos_suspend_ops);
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 797cb134bfff..fd76e1b5a471 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -23,8 +23,7 @@
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/sched.h> 24#include <linux/sched.h>
25 25
26#include "regs-pmu.h" 26#define INT_LOCAL_PWR_EN 0x7
27
28#define MAX_CLK_PER_DOMAIN 4 27#define MAX_CLK_PER_DOMAIN 4
29 28
30/* 29/*
@@ -63,13 +62,13 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
63 } 62 }
64 } 63 }
65 64
66 pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0; 65 pwr = power_on ? INT_LOCAL_PWR_EN : 0;
67 __raw_writel(pwr, base); 66 __raw_writel(pwr, base);
68 67
69 /* Wait max 1ms */ 68 /* Wait max 1ms */
70 timeout = 10; 69 timeout = 10;
71 70
72 while ((__raw_readl(base + 0x4) & S5P_INT_LOCAL_PWR_EN) != pwr) { 71 while ((__raw_readl(base + 0x4) & INT_LOCAL_PWR_EN) != pwr) {
73 if (!timeout) { 72 if (!timeout) {
74 op = (power_on) ? "enable" : "disable"; 73 op = (power_on) ? "enable" : "disable";
75 pr_err("Power domain %s %s failed\n", domain->name, op); 74 pr_err("Power domain %s %s failed\n", domain->name, op);
@@ -231,7 +230,7 @@ static __init int exynos4_pm_init_power_domain(void)
231no_clk: 230no_clk:
232 platform_set_drvdata(pdev, pd); 231 platform_set_drvdata(pdev, pd);
233 232
234 on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; 233 on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN;
235 234
236 pm_genpd_init(&pd->pd, NULL, !on); 235 pm_genpd_init(&pd->pd, NULL, !on);
237 } 236 }
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index fb0deda3b3a4..ff9d23f0a7d9 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bug.h>
15 14
16#include "common.h" 15#include "common.h"
17#include "regs-pmu.h" 16#include "regs-pmu.h"
@@ -19,7 +18,7 @@
19static const struct exynos_pmu_conf *exynos_pmu_config; 18static const struct exynos_pmu_conf *exynos_pmu_config;
20 19
21static const struct exynos_pmu_conf exynos4210_pmu_config[] = { 20static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
22 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ 21 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
23 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, 22 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
24 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, 23 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
25 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, 24 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
@@ -213,7 +212,7 @@ static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
213}; 212};
214 213
215static const struct exynos_pmu_conf exynos5250_pmu_config[] = { 214static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
216 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ 215 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
217 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 216 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
218 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 217 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
219 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 218 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
@@ -316,7 +315,7 @@ static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
316 { PMU_TABLE_END,}, 315 { PMU_TABLE_END,},
317}; 316};
318 317
319static void __iomem * const exynos5_list_both_cnt_feed[] = { 318static unsigned int const exynos5_list_both_cnt_feed[] = {
320 EXYNOS5_ARM_CORE0_OPTION, 319 EXYNOS5_ARM_CORE0_OPTION,
321 EXYNOS5_ARM_CORE1_OPTION, 320 EXYNOS5_ARM_CORE1_OPTION,
322 EXYNOS5_ARM_COMMON_OPTION, 321 EXYNOS5_ARM_COMMON_OPTION,
@@ -330,7 +329,7 @@ static void __iomem * const exynos5_list_both_cnt_feed[] = {
330 EXYNOS5_TOP_PWR_SYSMEM_OPTION, 329 EXYNOS5_TOP_PWR_SYSMEM_OPTION,
331}; 330};
332 331
333static void __iomem * const exynos5_list_diable_wfi_wfe[] = { 332static unsigned int const exynos5_list_diable_wfi_wfe[] = {
334 EXYNOS5_ARM_CORE1_OPTION, 333 EXYNOS5_ARM_CORE1_OPTION,
335 EXYNOS5_FSYS_ARM_OPTION, 334 EXYNOS5_FSYS_ARM_OPTION,
336 EXYNOS5_ISP_ARM_OPTION, 335 EXYNOS5_ISP_ARM_OPTION,
@@ -345,27 +344,27 @@ static void exynos5_init_pmu(void)
345 * Enable both SC_FEEDBACK and SC_COUNTER 344 * Enable both SC_FEEDBACK and SC_COUNTER
346 */ 345 */
347 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) { 346 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_both_cnt_feed) ; i++) {
348 tmp = __raw_readl(exynos5_list_both_cnt_feed[i]); 347 tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]);
349 tmp |= (EXYNOS5_USE_SC_FEEDBACK | 348 tmp |= (EXYNOS5_USE_SC_FEEDBACK |
350 EXYNOS5_USE_SC_COUNTER); 349 EXYNOS5_USE_SC_COUNTER);
351 __raw_writel(tmp, exynos5_list_both_cnt_feed[i]); 350 pmu_raw_writel(tmp, exynos5_list_both_cnt_feed[i]);
352 } 351 }
353 352
354 /* 353 /*
355 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable 354 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
356 */ 355 */
357 tmp = __raw_readl(EXYNOS5_ARM_COMMON_OPTION); 356 tmp = pmu_raw_readl(EXYNOS5_ARM_COMMON_OPTION);
358 tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN; 357 tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
359 __raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION); 358 pmu_raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION);
360 359
361 /* 360 /*
362 * Disable WFI/WFE on XXX_OPTION 361 * Disable WFI/WFE on XXX_OPTION
363 */ 362 */
364 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) { 363 for (i = 0 ; i < ARRAY_SIZE(exynos5_list_diable_wfi_wfe) ; i++) {
365 tmp = __raw_readl(exynos5_list_diable_wfi_wfe[i]); 364 tmp = pmu_raw_readl(exynos5_list_diable_wfi_wfe[i]);
366 tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE | 365 tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE |
367 EXYNOS5_OPTION_USE_STANDBYWFI); 366 EXYNOS5_OPTION_USE_STANDBYWFI);
368 __raw_writel(tmp, exynos5_list_diable_wfi_wfe[i]); 367 pmu_raw_writel(tmp, exynos5_list_diable_wfi_wfe[i]);
369 } 368 }
370} 369}
371 370
@@ -376,14 +375,14 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode)
376 if (soc_is_exynos5250()) 375 if (soc_is_exynos5250())
377 exynos5_init_pmu(); 376 exynos5_init_pmu();
378 377
379 for (i = 0; (exynos_pmu_config[i].reg != PMU_TABLE_END) ; i++) 378 for (i = 0; (exynos_pmu_config[i].offset != PMU_TABLE_END) ; i++)
380 __raw_writel(exynos_pmu_config[i].val[mode], 379 pmu_raw_writel(exynos_pmu_config[i].val[mode],
381 exynos_pmu_config[i].reg); 380 exynos_pmu_config[i].offset);
382 381
383 if (soc_is_exynos4412()) { 382 if (soc_is_exynos4412()) {
384 for (i = 0; exynos4412_pmu_config[i].reg != PMU_TABLE_END ; i++) 383 for (i = 0; exynos4412_pmu_config[i].offset != PMU_TABLE_END ; i++)
385 __raw_writel(exynos4412_pmu_config[i].val[mode], 384 pmu_raw_writel(exynos4412_pmu_config[i].val[mode],
386 exynos4412_pmu_config[i].reg); 385 exynos4412_pmu_config[i].offset);
387 } 386 }
388} 387}
389 388
@@ -404,13 +403,13 @@ static int __init exynos_pmu_init(void)
404 * When SYS_WDTRESET is set, watchdog timer reset request 403 * When SYS_WDTRESET is set, watchdog timer reset request
405 * is ignored by power management unit. 404 * is ignored by power management unit.
406 */ 405 */
407 value = __raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE); 406 value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE);
408 value &= ~EXYNOS5_SYS_WDTRESET; 407 value &= ~EXYNOS5_SYS_WDTRESET;
409 __raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE); 408 pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE);
410 409
411 value = __raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST); 410 value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST);
412 value &= ~EXYNOS5_SYS_WDTRESET; 411 value &= ~EXYNOS5_SYS_WDTRESET;
413 __raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST); 412 pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST);
414 413
415 exynos_pmu_config = exynos5250_pmu_config; 414 exynos_pmu_config = exynos5250_pmu_config;
416 pr_info("EXYNOS5250 PMU Initialize\n"); 415 pr_info("EXYNOS5250 PMU Initialize\n");
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 1d13b08708f0..96a1569262b5 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -12,304 +12,298 @@
12#ifndef __ASM_ARCH_REGS_PMU_H 12#ifndef __ASM_ARCH_REGS_PMU_H
13#define __ASM_ARCH_REGS_PMU_H __FILE__ 13#define __ASM_ARCH_REGS_PMU_H __FILE__
14 14
15#include <mach/map.h> 15#define S5P_CENTRAL_SEQ_CONFIGURATION 0x0200
16
17#define S5P_PMUREG(x) (S5P_VA_PMU + (x))
18#define S5P_SYSREG(x) (S3C_VA_SYS + (x))
19
20#define S5P_CENTRAL_SEQ_CONFIGURATION S5P_PMUREG(0x0200)
21 16
22#define S5P_CENTRAL_LOWPWR_CFG (1 << 16) 17#define S5P_CENTRAL_LOWPWR_CFG (1 << 16)
23 18
24#define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208) 19#define S5P_CENTRAL_SEQ_OPTION 0x0208
25 20
26#define S5P_USE_STANDBY_WFI0 (1 << 16) 21#define S5P_USE_STANDBY_WFI0 (1 << 16)
27#define S5P_USE_STANDBY_WFE0 (1 << 24) 22#define S5P_USE_STANDBY_WFE0 (1 << 24)
28 23
29#define EXYNOS_SWRESET S5P_PMUREG(0x0400) 24#define EXYNOS_SWRESET 0x0400
30#define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4) 25#define EXYNOS5440_SWRESET 0x00C4
31 26
32#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 27#define S5P_WAKEUP_STAT 0x0600
33#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) 28#define S5P_EINT_WAKEUP_MASK 0x0604
34#define S5P_WAKEUP_MASK S5P_PMUREG(0x0608) 29#define S5P_WAKEUP_MASK 0x0608
35 30
36#define S5P_INFORM0 S5P_PMUREG(0x0800) 31#define S5P_INFORM0 0x0800
37#define S5P_INFORM1 S5P_PMUREG(0x0804) 32#define S5P_INFORM1 0x0804
38#define S5P_INFORM5 S5P_PMUREG(0x0814) 33#define S5P_INFORM5 0x0814
39#define S5P_INFORM6 S5P_PMUREG(0x0818) 34#define S5P_INFORM6 0x0818
40#define S5P_INFORM7 S5P_PMUREG(0x081C) 35#define S5P_INFORM7 0x081C
41#define S5P_PMU_SPARE3 S5P_PMUREG(0x090C) 36#define S5P_PMU_SPARE3 0x090C
42 37
43#define S5P_ARM_CORE0_LOWPWR S5P_PMUREG(0x1000) 38#define S5P_ARM_CORE0_LOWPWR 0x1000
44#define S5P_DIS_IRQ_CORE0 S5P_PMUREG(0x1004) 39#define S5P_DIS_IRQ_CORE0 0x1004
45#define S5P_DIS_IRQ_CENTRAL0 S5P_PMUREG(0x1008) 40#define S5P_DIS_IRQ_CENTRAL0 0x1008
46#define S5P_ARM_CORE1_LOWPWR S5P_PMUREG(0x1010) 41#define S5P_ARM_CORE1_LOWPWR 0x1010
47#define S5P_DIS_IRQ_CORE1 S5P_PMUREG(0x1014) 42#define S5P_DIS_IRQ_CORE1 0x1014
48#define S5P_DIS_IRQ_CENTRAL1 S5P_PMUREG(0x1018) 43#define S5P_DIS_IRQ_CENTRAL1 0x1018
49#define S5P_ARM_COMMON_LOWPWR S5P_PMUREG(0x1080) 44#define S5P_ARM_COMMON_LOWPWR 0x1080
50#define S5P_L2_0_LOWPWR S5P_PMUREG(0x10C0) 45#define S5P_L2_0_LOWPWR 0x10C0
51#define S5P_L2_1_LOWPWR S5P_PMUREG(0x10C4) 46#define S5P_L2_1_LOWPWR 0x10C4
52#define S5P_CMU_ACLKSTOP_LOWPWR S5P_PMUREG(0x1100) 47#define S5P_CMU_ACLKSTOP_LOWPWR 0x1100
53#define S5P_CMU_SCLKSTOP_LOWPWR S5P_PMUREG(0x1104) 48#define S5P_CMU_SCLKSTOP_LOWPWR 0x1104
54#define S5P_CMU_RESET_LOWPWR S5P_PMUREG(0x110C) 49#define S5P_CMU_RESET_LOWPWR 0x110C
55#define S5P_APLL_SYSCLK_LOWPWR S5P_PMUREG(0x1120) 50#define S5P_APLL_SYSCLK_LOWPWR 0x1120
56#define S5P_MPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1124) 51#define S5P_MPLL_SYSCLK_LOWPWR 0x1124
57#define S5P_VPLL_SYSCLK_LOWPWR S5P_PMUREG(0x1128) 52#define S5P_VPLL_SYSCLK_LOWPWR 0x1128
58#define S5P_EPLL_SYSCLK_LOWPWR S5P_PMUREG(0x112C) 53#define S5P_EPLL_SYSCLK_LOWPWR 0x112C
59#define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR S5P_PMUREG(0x1138) 54#define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR 0x1138
60#define S5P_CMU_RESET_GPSALIVE_LOWPWR S5P_PMUREG(0x113C) 55#define S5P_CMU_RESET_GPSALIVE_LOWPWR 0x113C
61#define S5P_CMU_CLKSTOP_CAM_LOWPWR S5P_PMUREG(0x1140) 56#define S5P_CMU_CLKSTOP_CAM_LOWPWR 0x1140
62#define S5P_CMU_CLKSTOP_TV_LOWPWR S5P_PMUREG(0x1144) 57#define S5P_CMU_CLKSTOP_TV_LOWPWR 0x1144
63#define S5P_CMU_CLKSTOP_MFC_LOWPWR S5P_PMUREG(0x1148) 58#define S5P_CMU_CLKSTOP_MFC_LOWPWR 0x1148
64#define S5P_CMU_CLKSTOP_G3D_LOWPWR S5P_PMUREG(0x114C) 59#define S5P_CMU_CLKSTOP_G3D_LOWPWR 0x114C
65#define S5P_CMU_CLKSTOP_LCD0_LOWPWR S5P_PMUREG(0x1150) 60#define S5P_CMU_CLKSTOP_LCD0_LOWPWR 0x1150
66#define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR S5P_PMUREG(0x1158) 61#define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR 0x1158
67#define S5P_CMU_CLKSTOP_GPS_LOWPWR S5P_PMUREG(0x115C) 62#define S5P_CMU_CLKSTOP_GPS_LOWPWR 0x115C
68#define S5P_CMU_RESET_CAM_LOWPWR S5P_PMUREG(0x1160) 63#define S5P_CMU_RESET_CAM_LOWPWR 0x1160
69#define S5P_CMU_RESET_TV_LOWPWR S5P_PMUREG(0x1164) 64#define S5P_CMU_RESET_TV_LOWPWR 0x1164
70#define S5P_CMU_RESET_MFC_LOWPWR S5P_PMUREG(0x1168) 65#define S5P_CMU_RESET_MFC_LOWPWR 0x1168
71#define S5P_CMU_RESET_G3D_LOWPWR S5P_PMUREG(0x116C) 66#define S5P_CMU_RESET_G3D_LOWPWR 0x116C
72#define S5P_CMU_RESET_LCD0_LOWPWR S5P_PMUREG(0x1170) 67#define S5P_CMU_RESET_LCD0_LOWPWR 0x1170
73#define S5P_CMU_RESET_MAUDIO_LOWPWR S5P_PMUREG(0x1178) 68#define S5P_CMU_RESET_MAUDIO_LOWPWR 0x1178
74#define S5P_CMU_RESET_GPS_LOWPWR S5P_PMUREG(0x117C) 69#define S5P_CMU_RESET_GPS_LOWPWR 0x117C
75#define S5P_TOP_BUS_LOWPWR S5P_PMUREG(0x1180) 70#define S5P_TOP_BUS_LOWPWR 0x1180
76#define S5P_TOP_RETENTION_LOWPWR S5P_PMUREG(0x1184) 71#define S5P_TOP_RETENTION_LOWPWR 0x1184
77#define S5P_TOP_PWR_LOWPWR S5P_PMUREG(0x1188) 72#define S5P_TOP_PWR_LOWPWR 0x1188
78#define S5P_LOGIC_RESET_LOWPWR S5P_PMUREG(0x11A0) 73#define S5P_LOGIC_RESET_LOWPWR 0x11A0
79#define S5P_ONENAND_MEM_LOWPWR S5P_PMUREG(0x11C0) 74#define S5P_ONENAND_MEM_LOWPWR 0x11C0
80#define S5P_G2D_ACP_MEM_LOWPWR S5P_PMUREG(0x11C8) 75#define S5P_G2D_ACP_MEM_LOWPWR 0x11C8
81#define S5P_USBOTG_MEM_LOWPWR S5P_PMUREG(0x11CC) 76#define S5P_USBOTG_MEM_LOWPWR 0x11CC
82#define S5P_HSMMC_MEM_LOWPWR S5P_PMUREG(0x11D0) 77#define S5P_HSMMC_MEM_LOWPWR 0x11D0
83#define S5P_CSSYS_MEM_LOWPWR S5P_PMUREG(0x11D4) 78#define S5P_CSSYS_MEM_LOWPWR 0x11D4
84#define S5P_SECSS_MEM_LOWPWR S5P_PMUREG(0x11D8) 79#define S5P_SECSS_MEM_LOWPWR 0x11D8
85#define S5P_PAD_RETENTION_DRAM_LOWPWR S5P_PMUREG(0x1200) 80#define S5P_PAD_RETENTION_DRAM_LOWPWR 0x1200
86#define S5P_PAD_RETENTION_MAUDIO_LOWPWR S5P_PMUREG(0x1204) 81#define S5P_PAD_RETENTION_MAUDIO_LOWPWR 0x1204
87#define S5P_PAD_RETENTION_GPIO_LOWPWR S5P_PMUREG(0x1220) 82#define S5P_PAD_RETENTION_GPIO_LOWPWR 0x1220
88#define S5P_PAD_RETENTION_UART_LOWPWR S5P_PMUREG(0x1224) 83#define S5P_PAD_RETENTION_UART_LOWPWR 0x1224
89#define S5P_PAD_RETENTION_MMCA_LOWPWR S5P_PMUREG(0x1228) 84#define S5P_PAD_RETENTION_MMCA_LOWPWR 0x1228
90#define S5P_PAD_RETENTION_MMCB_LOWPWR S5P_PMUREG(0x122C) 85#define S5P_PAD_RETENTION_MMCB_LOWPWR 0x122C
91#define S5P_PAD_RETENTION_EBIA_LOWPWR S5P_PMUREG(0x1230) 86#define S5P_PAD_RETENTION_EBIA_LOWPWR 0x1230
92#define S5P_PAD_RETENTION_EBIB_LOWPWR S5P_PMUREG(0x1234) 87#define S5P_PAD_RETENTION_EBIB_LOWPWR 0x1234
93#define S5P_PAD_RETENTION_ISOLATION_LOWPWR S5P_PMUREG(0x1240) 88#define S5P_PAD_RETENTION_ISOLATION_LOWPWR 0x1240
94#define S5P_PAD_RETENTION_ALV_SEL_LOWPWR S5P_PMUREG(0x1260) 89#define S5P_PAD_RETENTION_ALV_SEL_LOWPWR 0x1260
95#define S5P_XUSBXTI_LOWPWR S5P_PMUREG(0x1280) 90#define S5P_XUSBXTI_LOWPWR 0x1280
96#define S5P_XXTI_LOWPWR S5P_PMUREG(0x1284) 91#define S5P_XXTI_LOWPWR 0x1284
97#define S5P_EXT_REGULATOR_LOWPWR S5P_PMUREG(0x12C0) 92#define S5P_EXT_REGULATOR_LOWPWR 0x12C0
98#define S5P_GPIO_MODE_LOWPWR S5P_PMUREG(0x1300) 93#define S5P_GPIO_MODE_LOWPWR 0x1300
99#define S5P_GPIO_MODE_MAUDIO_LOWPWR S5P_PMUREG(0x1340) 94#define S5P_GPIO_MODE_MAUDIO_LOWPWR 0x1340
100#define S5P_CAM_LOWPWR S5P_PMUREG(0x1380) 95#define S5P_CAM_LOWPWR 0x1380
101#define S5P_TV_LOWPWR S5P_PMUREG(0x1384) 96#define S5P_TV_LOWPWR 0x1384
102#define S5P_MFC_LOWPWR S5P_PMUREG(0x1388) 97#define S5P_MFC_LOWPWR 0x1388
103#define S5P_G3D_LOWPWR S5P_PMUREG(0x138C) 98#define S5P_G3D_LOWPWR 0x138C
104#define S5P_LCD0_LOWPWR S5P_PMUREG(0x1390) 99#define S5P_LCD0_LOWPWR 0x1390
105#define S5P_MAUDIO_LOWPWR S5P_PMUREG(0x1398) 100#define S5P_MAUDIO_LOWPWR 0x1398
106#define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) 101#define S5P_GPS_LOWPWR 0x139C
107#define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) 102#define S5P_GPS_ALIVE_LOWPWR 0x13A0
108 103
109#define EXYNOS_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) 104#define EXYNOS_ARM_CORE0_CONFIGURATION 0x2000
110#define EXYNOS_ARM_CORE_CONFIGURATION(_nr) \ 105#define EXYNOS_ARM_CORE_CONFIGURATION(_nr) \
111 (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr))) 106 (EXYNOS_ARM_CORE0_CONFIGURATION + (0x80 * (_nr)))
112#define EXYNOS_ARM_CORE_STATUS(_nr) \ 107#define EXYNOS_ARM_CORE_STATUS(_nr) \
113 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4) 108 (EXYNOS_ARM_CORE_CONFIGURATION(_nr) + 0x4)
114 109
115#define EXYNOS_ARM_COMMON_CONFIGURATION S5P_PMUREG(0x2500) 110#define EXYNOS_ARM_COMMON_CONFIGURATION 0x2500
116#define EXYNOS_COMMON_CONFIGURATION(_nr) \ 111#define EXYNOS_COMMON_CONFIGURATION(_nr) \
117 (EXYNOS_ARM_COMMON_CONFIGURATION + (0x80 * (_nr))) 112 (EXYNOS_ARM_COMMON_CONFIGURATION + (0x80 * (_nr)))
118#define EXYNOS_COMMON_STATUS(_nr) \ 113#define EXYNOS_COMMON_STATUS(_nr) \
119 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x4) 114 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x4)
115#define EXYNOS_COMMON_OPTION(_nr) \
116 (EXYNOS_COMMON_CONFIGURATION(_nr) + 0x8)
120 117
121#define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) 118#define S5P_PAD_RET_MAUDIO_OPTION 0x3028
122#define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) 119#define S5P_PAD_RET_GPIO_OPTION 0x3108
123#define S5P_PAD_RET_UART_OPTION S5P_PMUREG(0x3128) 120#define S5P_PAD_RET_UART_OPTION 0x3128
124#define S5P_PAD_RET_MMCA_OPTION S5P_PMUREG(0x3148) 121#define S5P_PAD_RET_MMCA_OPTION 0x3148
125#define S5P_PAD_RET_MMCB_OPTION S5P_PMUREG(0x3168) 122#define S5P_PAD_RET_MMCB_OPTION 0x3168
126#define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) 123#define S5P_PAD_RET_EBIA_OPTION 0x3188
127#define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) 124#define S5P_PAD_RET_EBIB_OPTION 0x31A8
128 125
129#define S5P_CORE_LOCAL_PWR_EN 0x3 126#define S5P_CORE_LOCAL_PWR_EN 0x3
130#define S5P_INT_LOCAL_PWR_EN 0x7
131 127
132/* Only for EXYNOS4210 */ 128/* Only for EXYNOS4210 */
133#define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) 129#define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154
134#define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) 130#define S5P_CMU_RESET_LCD1_LOWPWR 0x1174
135#define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) 131#define S5P_MODIMIF_MEM_LOWPWR 0x11C4
136#define S5P_PCIE_MEM_LOWPWR S5P_PMUREG(0x11E0) 132#define S5P_PCIE_MEM_LOWPWR 0x11E0
137#define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) 133#define S5P_SATA_MEM_LOWPWR 0x11E4
138#define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) 134#define S5P_LCD1_LOWPWR 0x1394
139 135
140/* Only for EXYNOS4x12 */ 136/* Only for EXYNOS4x12 */
141#define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050) 137#define S5P_ISP_ARM_LOWPWR 0x1050
142#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054) 138#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR 0x1054
143#define S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR S5P_PMUREG(0x1058) 139#define S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR 0x1058
144#define S5P_CMU_ACLKSTOP_COREBLK_LOWPWR S5P_PMUREG(0x1110) 140#define S5P_CMU_ACLKSTOP_COREBLK_LOWPWR 0x1110
145#define S5P_CMU_SCLKSTOP_COREBLK_LOWPWR S5P_PMUREG(0x1114) 141#define S5P_CMU_SCLKSTOP_COREBLK_LOWPWR 0x1114
146#define S5P_CMU_RESET_COREBLK_LOWPWR S5P_PMUREG(0x111C) 142#define S5P_CMU_RESET_COREBLK_LOWPWR 0x111C
147#define S5P_MPLLUSER_SYSCLK_LOWPWR S5P_PMUREG(0x1130) 143#define S5P_MPLLUSER_SYSCLK_LOWPWR 0x1130
148#define S5P_CMU_CLKSTOP_ISP_LOWPWR S5P_PMUREG(0x1154) 144#define S5P_CMU_CLKSTOP_ISP_LOWPWR 0x1154
149#define S5P_CMU_RESET_ISP_LOWPWR S5P_PMUREG(0x1174) 145#define S5P_CMU_RESET_ISP_LOWPWR 0x1174
150#define S5P_TOP_BUS_COREBLK_LOWPWR S5P_PMUREG(0x1190) 146#define S5P_TOP_BUS_COREBLK_LOWPWR 0x1190
151#define S5P_TOP_RETENTION_COREBLK_LOWPWR S5P_PMUREG(0x1194) 147#define S5P_TOP_RETENTION_COREBLK_LOWPWR 0x1194
152#define S5P_TOP_PWR_COREBLK_LOWPWR S5P_PMUREG(0x1198) 148#define S5P_TOP_PWR_COREBLK_LOWPWR 0x1198
153#define S5P_OSCCLK_GATE_LOWPWR S5P_PMUREG(0x11A4) 149#define S5P_OSCCLK_GATE_LOWPWR 0x11A4
154#define S5P_LOGIC_RESET_COREBLK_LOWPWR S5P_PMUREG(0x11B0) 150#define S5P_LOGIC_RESET_COREBLK_LOWPWR 0x11B0
155#define S5P_OSCCLK_GATE_COREBLK_LOWPWR S5P_PMUREG(0x11B4) 151#define S5P_OSCCLK_GATE_COREBLK_LOWPWR 0x11B4
156#define S5P_HSI_MEM_LOWPWR S5P_PMUREG(0x11C4) 152#define S5P_HSI_MEM_LOWPWR 0x11C4
157#define S5P_ROTATOR_MEM_LOWPWR S5P_PMUREG(0x11DC) 153#define S5P_ROTATOR_MEM_LOWPWR 0x11DC
158#define S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR S5P_PMUREG(0x123C) 154#define S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR 0x123C
159#define S5P_PAD_ISOLATION_COREBLK_LOWPWR S5P_PMUREG(0x1250) 155#define S5P_PAD_ISOLATION_COREBLK_LOWPWR 0x1250
160#define S5P_GPIO_MODE_COREBLK_LOWPWR S5P_PMUREG(0x1320) 156#define S5P_GPIO_MODE_COREBLK_LOWPWR 0x1320
161#define S5P_TOP_ASB_RESET_LOWPWR S5P_PMUREG(0x1344) 157#define S5P_TOP_ASB_RESET_LOWPWR 0x1344
162#define S5P_TOP_ASB_ISOLATION_LOWPWR S5P_PMUREG(0x1348) 158#define S5P_TOP_ASB_ISOLATION_LOWPWR 0x1348
163#define S5P_ISP_LOWPWR S5P_PMUREG(0x1394) 159#define S5P_ISP_LOWPWR 0x1394
164#define S5P_DRAM_FREQ_DOWN_LOWPWR S5P_PMUREG(0x13B0) 160#define S5P_DRAM_FREQ_DOWN_LOWPWR 0x13B0
165#define S5P_DDRPHY_DLLOFF_LOWPWR S5P_PMUREG(0x13B4) 161#define S5P_DDRPHY_DLLOFF_LOWPWR 0x13B4
166#define S5P_CMU_SYSCLK_ISP_LOWPWR S5P_PMUREG(0x13B8) 162#define S5P_CMU_SYSCLK_ISP_LOWPWR 0x13B8
167#define S5P_CMU_SYSCLK_GPS_LOWPWR S5P_PMUREG(0x13BC) 163#define S5P_CMU_SYSCLK_GPS_LOWPWR 0x13BC
168#define S5P_LPDDR_PHY_DLL_LOCK_LOWPWR S5P_PMUREG(0x13C0) 164#define S5P_LPDDR_PHY_DLL_LOCK_LOWPWR 0x13C0
169 165
170#define S5P_ARM_L2_0_OPTION S5P_PMUREG(0x2608) 166#define S5P_ARM_L2_0_OPTION 0x2608
171#define S5P_ARM_L2_1_OPTION S5P_PMUREG(0x2628) 167#define S5P_ARM_L2_1_OPTION 0x2628
172#define S5P_ONENAND_MEM_OPTION S5P_PMUREG(0x2E08) 168#define S5P_ONENAND_MEM_OPTION 0x2E08
173#define S5P_HSI_MEM_OPTION S5P_PMUREG(0x2E28) 169#define S5P_HSI_MEM_OPTION 0x2E28
174#define S5P_G2D_ACP_MEM_OPTION S5P_PMUREG(0x2E48) 170#define S5P_G2D_ACP_MEM_OPTION 0x2E48
175#define S5P_USBOTG_MEM_OPTION S5P_PMUREG(0x2E68) 171#define S5P_USBOTG_MEM_OPTION 0x2E68
176#define S5P_HSMMC_MEM_OPTION S5P_PMUREG(0x2E88) 172#define S5P_HSMMC_MEM_OPTION 0x2E88
177#define S5P_CSSYS_MEM_OPTION S5P_PMUREG(0x2EA8) 173#define S5P_CSSYS_MEM_OPTION 0x2EA8
178#define S5P_SECSS_MEM_OPTION S5P_PMUREG(0x2EC8) 174#define S5P_SECSS_MEM_OPTION 0x2EC8
179#define S5P_ROTATOR_MEM_OPTION S5P_PMUREG(0x2F48) 175#define S5P_ROTATOR_MEM_OPTION 0x2F48
180 176
181/* Only for EXYNOS4412 */ 177/* Only for EXYNOS4412 */
182#define S5P_ARM_CORE2_LOWPWR S5P_PMUREG(0x1020) 178#define S5P_ARM_CORE2_LOWPWR 0x1020
183#define S5P_DIS_IRQ_CORE2 S5P_PMUREG(0x1024) 179#define S5P_DIS_IRQ_CORE2 0x1024
184#define S5P_DIS_IRQ_CENTRAL2 S5P_PMUREG(0x1028) 180#define S5P_DIS_IRQ_CENTRAL2 0x1028
185#define S5P_ARM_CORE3_LOWPWR S5P_PMUREG(0x1030) 181#define S5P_ARM_CORE3_LOWPWR 0x1030
186#define S5P_DIS_IRQ_CORE3 S5P_PMUREG(0x1034) 182#define S5P_DIS_IRQ_CORE3 0x1034
187#define S5P_DIS_IRQ_CENTRAL3 S5P_PMUREG(0x1038) 183#define S5P_DIS_IRQ_CENTRAL3 0x1038
188 184
189/* For EXYNOS5 */ 185/* For EXYNOS5 */
190 186
191#define EXYNOS5_SYS_I2C_CFG S5P_SYSREG(0x0234) 187#define EXYNOS5_AUTO_WDTRESET_DISABLE 0x0408
192 188#define EXYNOS5_MASK_WDTRESET_REQUEST 0x040C
193#define EXYNOS5_AUTO_WDTRESET_DISABLE S5P_PMUREG(0x0408)
194#define EXYNOS5_MASK_WDTRESET_REQUEST S5P_PMUREG(0x040C)
195 189
196#define EXYNOS5_SYS_WDTRESET (1 << 20) 190#define EXYNOS5_SYS_WDTRESET (1 << 20)
197 191
198#define EXYNOS5_ARM_CORE0_SYS_PWR_REG S5P_PMUREG(0x1000) 192#define EXYNOS5_ARM_CORE0_SYS_PWR_REG 0x1000
199#define EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG S5P_PMUREG(0x1004) 193#define EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG 0x1004
200#define EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG S5P_PMUREG(0x1008) 194#define EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG 0x1008
201#define EXYNOS5_ARM_CORE1_SYS_PWR_REG S5P_PMUREG(0x1010) 195#define EXYNOS5_ARM_CORE1_SYS_PWR_REG 0x1010
202#define EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG S5P_PMUREG(0x1014) 196#define EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG 0x1014
203#define EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG S5P_PMUREG(0x1018) 197#define EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG 0x1018
204#define EXYNOS5_FSYS_ARM_SYS_PWR_REG S5P_PMUREG(0x1040) 198#define EXYNOS5_FSYS_ARM_SYS_PWR_REG 0x1040
205#define EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG S5P_PMUREG(0x1048) 199#define EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG 0x1048
206#define EXYNOS5_ISP_ARM_SYS_PWR_REG S5P_PMUREG(0x1050) 200#define EXYNOS5_ISP_ARM_SYS_PWR_REG 0x1050
207#define EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG S5P_PMUREG(0x1054) 201#define EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG 0x1054
208#define EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG S5P_PMUREG(0x1058) 202#define EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG 0x1058
209#define EXYNOS5_ARM_COMMON_SYS_PWR_REG S5P_PMUREG(0x1080) 203#define EXYNOS5_ARM_COMMON_SYS_PWR_REG 0x1080
210#define EXYNOS5_ARM_L2_SYS_PWR_REG S5P_PMUREG(0x10C0) 204#define EXYNOS5_ARM_L2_SYS_PWR_REG 0x10C0
211#define EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG S5P_PMUREG(0x1100) 205#define EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG 0x1100
212#define EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG S5P_PMUREG(0x1104) 206#define EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG 0x1104
213#define EXYNOS5_CMU_RESET_SYS_PWR_REG S5P_PMUREG(0x110C) 207#define EXYNOS5_CMU_RESET_SYS_PWR_REG 0x110C
214#define EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1120) 208#define EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG 0x1120
215#define EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1124) 209#define EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG 0x1124
216#define EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x112C) 210#define EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG 0x112C
217#define EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG S5P_PMUREG(0x1130) 211#define EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG 0x1130
218#define EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG S5P_PMUREG(0x1134) 212#define EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG 0x1134
219#define EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG S5P_PMUREG(0x1138) 213#define EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG 0x1138
220#define EXYNOS5_APLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1140) 214#define EXYNOS5_APLL_SYSCLK_SYS_PWR_REG 0x1140
221#define EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1144) 215#define EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG 0x1144
222#define EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1148) 216#define EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG 0x1148
223#define EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x114C) 217#define EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG 0x114C
224#define EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1150) 218#define EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG 0x1150
225#define EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1154) 219#define EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG 0x1154
226#define EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1164) 220#define EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG 0x1164
227#define EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG S5P_PMUREG(0x1170) 221#define EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG 0x1170
228#define EXYNOS5_TOP_BUS_SYS_PWR_REG S5P_PMUREG(0x1180) 222#define EXYNOS5_TOP_BUS_SYS_PWR_REG 0x1180
229#define EXYNOS5_TOP_RETENTION_SYS_PWR_REG S5P_PMUREG(0x1184) 223#define EXYNOS5_TOP_RETENTION_SYS_PWR_REG 0x1184
230#define EXYNOS5_TOP_PWR_SYS_PWR_REG S5P_PMUREG(0x1188) 224#define EXYNOS5_TOP_PWR_SYS_PWR_REG 0x1188
231#define EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1190) 225#define EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG 0x1190
232#define EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1194) 226#define EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG 0x1194
233#define EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1198) 227#define EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG 0x1198
234#define EXYNOS5_LOGIC_RESET_SYS_PWR_REG S5P_PMUREG(0x11A0) 228#define EXYNOS5_LOGIC_RESET_SYS_PWR_REG 0x11A0
235#define EXYNOS5_OSCCLK_GATE_SYS_PWR_REG S5P_PMUREG(0x11A4) 229#define EXYNOS5_OSCCLK_GATE_SYS_PWR_REG 0x11A4
236#define EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x11B0) 230#define EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG 0x11B0
237#define EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x11B4) 231#define EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG 0x11B4
238#define EXYNOS5_USBOTG_MEM_SYS_PWR_REG S5P_PMUREG(0x11C0) 232#define EXYNOS5_USBOTG_MEM_SYS_PWR_REG 0x11C0
239#define EXYNOS5_G2D_MEM_SYS_PWR_REG S5P_PMUREG(0x11C8) 233#define EXYNOS5_G2D_MEM_SYS_PWR_REG 0x11C8
240#define EXYNOS5_USBDRD_MEM_SYS_PWR_REG S5P_PMUREG(0x11CC) 234#define EXYNOS5_USBDRD_MEM_SYS_PWR_REG 0x11CC
241#define EXYNOS5_SDMMC_MEM_SYS_PWR_REG S5P_PMUREG(0x11D0) 235#define EXYNOS5_SDMMC_MEM_SYS_PWR_REG 0x11D0
242#define EXYNOS5_CSSYS_MEM_SYS_PWR_REG S5P_PMUREG(0x11D4) 236#define EXYNOS5_CSSYS_MEM_SYS_PWR_REG 0x11D4
243#define EXYNOS5_SECSS_MEM_SYS_PWR_REG S5P_PMUREG(0x11D8) 237#define EXYNOS5_SECSS_MEM_SYS_PWR_REG 0x11D8
244#define EXYNOS5_ROTATOR_MEM_SYS_PWR_REG S5P_PMUREG(0x11DC) 238#define EXYNOS5_ROTATOR_MEM_SYS_PWR_REG 0x11DC
245#define EXYNOS5_INTRAM_MEM_SYS_PWR_REG S5P_PMUREG(0x11E0) 239#define EXYNOS5_INTRAM_MEM_SYS_PWR_REG 0x11E0
246#define EXYNOS5_INTROM_MEM_SYS_PWR_REG S5P_PMUREG(0x11E4) 240#define EXYNOS5_INTROM_MEM_SYS_PWR_REG 0x11E4
247#define EXYNOS5_JPEG_MEM_SYS_PWR_REG S5P_PMUREG(0x11E8) 241#define EXYNOS5_JPEG_MEM_SYS_PWR_REG 0x11E8
248#define EXYNOS5_HSI_MEM_SYS_PWR_REG S5P_PMUREG(0x11EC) 242#define EXYNOS5_HSI_MEM_SYS_PWR_REG 0x11EC
249#define EXYNOS5_MCUIOP_MEM_SYS_PWR_REG S5P_PMUREG(0x11F4) 243#define EXYNOS5_MCUIOP_MEM_SYS_PWR_REG 0x11F4
250#define EXYNOS5_SATA_MEM_SYS_PWR_REG S5P_PMUREG(0x11FC) 244#define EXYNOS5_SATA_MEM_SYS_PWR_REG 0x11FC
251#define EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG S5P_PMUREG(0x1200) 245#define EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG 0x1200
252#define EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG S5P_PMUREG(0x1204) 246#define EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG 0x1204
253#define EXYNOS5_PAD_RETENTION_EFNAND_SYS_PWR_REG S5P_PMUREG(0x1208) 247#define EXYNOS5_PAD_RETENTION_EFNAND_SYS_PWR_REG 0x1208
254#define EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG S5P_PMUREG(0x1220) 248#define EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG 0x1220
255#define EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG S5P_PMUREG(0x1224) 249#define EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG 0x1224
256#define EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG S5P_PMUREG(0x1228) 250#define EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG 0x1228
257#define EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG S5P_PMUREG(0x122C) 251#define EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG 0x122C
258#define EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG S5P_PMUREG(0x1230) 252#define EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG 0x1230
259#define EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG S5P_PMUREG(0x1234) 253#define EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG 0x1234
260#define EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG S5P_PMUREG(0x1238) 254#define EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG 0x1238
261#define EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x123C) 255#define EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG 0x123C
262#define EXYNOS5_PAD_ISOLATION_SYS_PWR_REG S5P_PMUREG(0x1240) 256#define EXYNOS5_PAD_ISOLATION_SYS_PWR_REG 0x1240
263#define EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1250) 257#define EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG 0x1250
264#define EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG S5P_PMUREG(0x1260) 258#define EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG 0x1260
265#define EXYNOS5_XUSBXTI_SYS_PWR_REG S5P_PMUREG(0x1280) 259#define EXYNOS5_XUSBXTI_SYS_PWR_REG 0x1280
266#define EXYNOS5_XXTI_SYS_PWR_REG S5P_PMUREG(0x1284) 260#define EXYNOS5_XXTI_SYS_PWR_REG 0x1284
267#define EXYNOS5_EXT_REGULATOR_SYS_PWR_REG S5P_PMUREG(0x12C0) 261#define EXYNOS5_EXT_REGULATOR_SYS_PWR_REG 0x12C0
268#define EXYNOS5_GPIO_MODE_SYS_PWR_REG S5P_PMUREG(0x1300) 262#define EXYNOS5_GPIO_MODE_SYS_PWR_REG 0x1300
269#define EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG S5P_PMUREG(0x1320) 263#define EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG 0x1320
270#define EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG S5P_PMUREG(0x1340) 264#define EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG 0x1340
271#define EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG S5P_PMUREG(0x1344) 265#define EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG 0x1344
272#define EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG S5P_PMUREG(0x1348) 266#define EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG 0x1348
273#define EXYNOS5_GSCL_SYS_PWR_REG S5P_PMUREG(0x1400) 267#define EXYNOS5_GSCL_SYS_PWR_REG 0x1400
274#define EXYNOS5_ISP_SYS_PWR_REG S5P_PMUREG(0x1404) 268#define EXYNOS5_ISP_SYS_PWR_REG 0x1404
275#define EXYNOS5_MFC_SYS_PWR_REG S5P_PMUREG(0x1408) 269#define EXYNOS5_MFC_SYS_PWR_REG 0x1408
276#define EXYNOS5_G3D_SYS_PWR_REG S5P_PMUREG(0x140C) 270#define EXYNOS5_G3D_SYS_PWR_REG 0x140C
277#define EXYNOS5_DISP1_SYS_PWR_REG S5P_PMUREG(0x1414) 271#define EXYNOS5_DISP1_SYS_PWR_REG 0x1414
278#define EXYNOS5_MAU_SYS_PWR_REG S5P_PMUREG(0x1418) 272#define EXYNOS5_MAU_SYS_PWR_REG 0x1418
279#define EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG S5P_PMUREG(0x1480) 273#define EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG 0x1480
280#define EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG S5P_PMUREG(0x1484) 274#define EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG 0x1484
281#define EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG S5P_PMUREG(0x1488) 275#define EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG 0x1488
282#define EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG S5P_PMUREG(0x148C) 276#define EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG 0x148C
283#define EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG S5P_PMUREG(0x1494) 277#define EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG 0x1494
284#define EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG S5P_PMUREG(0x1498) 278#define EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG 0x1498
285#define EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG S5P_PMUREG(0x14C0) 279#define EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG 0x14C0
286#define EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG S5P_PMUREG(0x14C4) 280#define EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG 0x14C4
287#define EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG S5P_PMUREG(0x14C8) 281#define EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG 0x14C8
288#define EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG S5P_PMUREG(0x14CC) 282#define EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG 0x14CC
289#define EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG S5P_PMUREG(0x14D4) 283#define EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG 0x14D4
290#define EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG S5P_PMUREG(0x14D8) 284#define EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG 0x14D8
291#define EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG S5P_PMUREG(0x1580) 285#define EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG 0x1580
292#define EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG S5P_PMUREG(0x1584) 286#define EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG 0x1584
293#define EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG S5P_PMUREG(0x1588) 287#define EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG 0x1588
294#define EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG S5P_PMUREG(0x158C) 288#define EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG 0x158C
295#define EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG S5P_PMUREG(0x1594) 289#define EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG 0x1594
296#define EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG S5P_PMUREG(0x1598) 290#define EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG 0x1598
297 291
298#define EXYNOS5_ARM_CORE0_OPTION S5P_PMUREG(0x2008) 292#define EXYNOS5_ARM_CORE0_OPTION 0x2008
299#define EXYNOS5_ARM_CORE1_OPTION S5P_PMUREG(0x2088) 293#define EXYNOS5_ARM_CORE1_OPTION 0x2088
300#define EXYNOS5_FSYS_ARM_OPTION S5P_PMUREG(0x2208) 294#define EXYNOS5_FSYS_ARM_OPTION 0x2208
301#define EXYNOS5_ISP_ARM_OPTION S5P_PMUREG(0x2288) 295#define EXYNOS5_ISP_ARM_OPTION 0x2288
302#define EXYNOS5_ARM_COMMON_OPTION S5P_PMUREG(0x2408) 296#define EXYNOS5_ARM_COMMON_OPTION 0x2408
303#define EXYNOS5_ARM_L2_OPTION S5P_PMUREG(0x2608) 297#define EXYNOS5_ARM_L2_OPTION 0x2608
304#define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48) 298#define EXYNOS5_TOP_PWR_OPTION 0x2C48
305#define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8) 299#define EXYNOS5_TOP_PWR_SYSMEM_OPTION 0x2CC8
306#define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48) 300#define EXYNOS5_JPEG_MEM_OPTION 0x2F48
307#define EXYNOS5_GSCL_OPTION S5P_PMUREG(0x4008) 301#define EXYNOS5_GSCL_OPTION 0x4008
308#define EXYNOS5_ISP_OPTION S5P_PMUREG(0x4028) 302#define EXYNOS5_ISP_OPTION 0x4028
309#define EXYNOS5_MFC_OPTION S5P_PMUREG(0x4048) 303#define EXYNOS5_MFC_OPTION 0x4048
310#define EXYNOS5_G3D_OPTION S5P_PMUREG(0x4068) 304#define EXYNOS5_G3D_OPTION 0x4068
311#define EXYNOS5_DISP1_OPTION S5P_PMUREG(0x40A8) 305#define EXYNOS5_DISP1_OPTION 0x40A8
312#define EXYNOS5_MAU_OPTION S5P_PMUREG(0x40C8) 306#define EXYNOS5_MAU_OPTION 0x40C8
313 307
314#define EXYNOS5_USE_SC_FEEDBACK (1 << 1) 308#define EXYNOS5_USE_SC_FEEDBACK (1 << 1)
315#define EXYNOS5_USE_SC_COUNTER (1 << 0) 309#define EXYNOS5_USE_SC_COUNTER (1 << 0)
@@ -323,4 +317,13 @@
323 317
324#define EXYNOS5420_SWRESET_KFC_SEL 0x3 318#define EXYNOS5420_SWRESET_KFC_SEL 0x3
325 319
320#include <asm/cputype.h>
321#define MAX_CPUS_IN_CLUSTER 4
322
323static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
324{
325 return ((MPIDR_AFFINITY_LEVEL(mpidr, 1) * MAX_CPUS_IN_CLUSTER)
326 + MPIDR_AFFINITY_LEVEL(mpidr, 0));
327}
328
326#endif /* __ASM_ARCH_REGS_PMU_H */ 329#endif /* __ASM_ARCH_REGS_PMU_H */
diff --git a/arch/arm/mach-exynos/regs-sys.h b/arch/arm/mach-exynos/regs-sys.h
new file mode 100644
index 000000000000..84332b0dd7a6
--- /dev/null
+++ b/arch/arm/mach-exynos/regs-sys.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS - system register definition
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_REGS_SYS_H
13#define __ASM_ARCH_REGS_SYS_H __FILE__
14
15#include <mach/map.h>
16
17#define S5P_SYSREG(x) (S3C_VA_SYS + (x))
18
19/* For EXYNOS5 */
20#define EXYNOS5_SYS_I2C_CFG S5P_SYSREG(0x0234)
21
22#endif /* __ASM_ARCH_REGS_SYS_H */
diff --git a/arch/arm/mach-footbridge/include/mach/memory.h b/arch/arm/mach-footbridge/include/mach/memory.h
index 5c6df377f969..6f2ecccdf323 100644
--- a/arch/arm/mach-footbridge/include/mach/memory.h
+++ b/arch/arm/mach-footbridge/include/mach/memory.h
@@ -59,11 +59,6 @@ extern unsigned long __bus_to_pfn(unsigned long);
59 */ 59 */
60#define FLUSH_BASE 0xf9000000 60#define FLUSH_BASE 0xf9000000
61 61
62/*
63 * Physical DRAM offset.
64 */
65#define PLAT_PHYS_OFFSET UL(0x00000000)
66
67#define FLUSH_BASE_PHYS 0x50000000 62#define FLUSH_BASE_PHYS 0x50000000
68 63
69#endif 64#endif
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index a5960e2ac090..31aa866c3317 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -2,7 +2,6 @@ config ARCH_HIGHBANK
2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7
3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
4 select ARCH_HAS_HOLES_MEMORYMODEL 4 select ARCH_HAS_HOLES_MEMORYMODEL
5 select ARCH_HAS_OPP
6 select ARCH_SUPPORTS_BIG_ENDIAN 5 select ARCH_SUPPORTS_BIG_ENDIAN
7 select ARM_AMBA 6 select ARM_AMBA
8 select ARM_ERRATA_764369 if SMP 7 select ARM_ERRATA_764369 if SMP
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
index feee4dbb0760..984882943f77 100644
--- a/arch/arm/mach-hisi/Kconfig
+++ b/arch/arm/mach-hisi/Kconfig
@@ -1,12 +1,36 @@
1config ARCH_HI3xxx 1config ARCH_HISI
2 bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 2 bool "Hisilicon SoC Support"
3 depends on ARCH_MULTIPLATFORM
3 select ARM_AMBA 4 select ARM_AMBA
4 select ARM_GIC 5 select ARM_GIC
5 select ARM_TIMER_SP804 6 select ARM_TIMER_SP804
7 select POWER_RESET
8 select POWER_RESET_HISI
9 select POWER_SUPPLY
10
11if ARCH_HISI
12
13menu "Hisilicon platform type"
14
15config ARCH_HI3xxx
16 bool "Hisilicon Hi36xx family" if ARCH_MULTI_V7
17 select CACHE_L2X0
18 select HAVE_ARM_SCU if SMP
19 select HAVE_ARM_TWD if SMP
20 select PINCTRL
21 select PINCTRL_SINGLE
22 help
23 Support for Hisilicon Hi36xx SoC family
24
25config ARCH_HIX5HD2
26 bool "Hisilicon X5HD2 family" if ARCH_MULTI_V7
6 select CACHE_L2X0 27 select CACHE_L2X0
7 select HAVE_ARM_SCU if SMP 28 select HAVE_ARM_SCU if SMP
8 select HAVE_ARM_TWD if SMP 29 select HAVE_ARM_TWD if SMP
9 select PINCTRL 30 select PINCTRL
10 select PINCTRL_SINGLE 31 select PINCTRL_SINGLE
11 help 32 help
12 Support for Hisilicon Hi36xx/Hi37xx processor family 33 Support for Hisilicon HIX5HD2 SoC family
34endmenu
35
36endif
diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile
index 2ae1b59267c2..ee2506b9cde3 100644
--- a/arch/arm/mach-hisi/Makefile
+++ b/arch/arm/mach-hisi/Makefile
@@ -3,4 +3,4 @@
3# 3#
4 4
5obj-y += hisilicon.o 5obj-y += hisilicon.o
6obj-$(CONFIG_SMP) += platsmp.o hotplug.o 6obj-$(CONFIG_SMP) += platsmp.o hotplug.o headsmp.o
diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h
index af23ec204538..88b1f487d065 100644
--- a/arch/arm/mach-hisi/core.h
+++ b/arch/arm/mach-hisi/core.h
@@ -12,4 +12,9 @@ extern void hi3xxx_cpu_die(unsigned int cpu);
12extern int hi3xxx_cpu_kill(unsigned int cpu); 12extern int hi3xxx_cpu_kill(unsigned int cpu);
13extern void hi3xxx_set_cpu(int cpu, bool enable); 13extern void hi3xxx_set_cpu(int cpu, bool enable);
14 14
15extern void hix5hd2_secondary_startup(void);
16extern struct smp_operations hix5hd2_smp_ops;
17extern void hix5hd2_set_cpu(int cpu, bool enable);
18extern void hix5hd2_cpu_die(unsigned int cpu);
19
15#endif 20#endif
diff --git a/arch/arm/mach-hisi/headsmp.S b/arch/arm/mach-hisi/headsmp.S
new file mode 100644
index 000000000000..278889c00b77
--- /dev/null
+++ b/arch/arm/mach-hisi/headsmp.S
@@ -0,0 +1,16 @@
1/*
2 * Copyright (c) 2014 Hisilicon Limited.
3 * Copyright (c) 2014 Linaro 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 version 2 as
7 * published by the Free Software Foundation.
8 */
9#include <linux/linkage.h>
10#include <linux/init.h>
11
12 __CPUINIT
13
14ENTRY(hix5hd2_secondary_startup)
15 bl v7_invalidate_l1
16 b secondary_startup
diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
index 741faf3e7100..7cda6dda3cd0 100644
--- a/arch/arm/mach-hisi/hisilicon.c
+++ b/arch/arm/mach-hisi/hisilicon.c
@@ -14,16 +14,10 @@
14#include <linux/clk-provider.h> 14#include <linux/clk-provider.h>
15#include <linux/clocksource.h> 15#include <linux/clocksource.h>
16#include <linux/irqchip.h> 16#include <linux/irqchip.h>
17#include <linux/of_address.h>
18#include <linux/of_platform.h>
19
20#include <asm/proc-fns.h>
21 17
22#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 19#include <asm/mach/map.h>
24 20
25#include "core.h"
26
27#define HI3620_SYSCTRL_PHYS_BASE 0xfc802000 21#define HI3620_SYSCTRL_PHYS_BASE 0xfc802000
28#define HI3620_SYSCTRL_VIRT_BASE 0xfe802000 22#define HI3620_SYSCTRL_VIRT_BASE 0xfe802000
29 23
@@ -51,32 +45,6 @@ static void __init hi3620_map_io(void)
51 iotable_init(hi3620_io_desc, ARRAY_SIZE(hi3620_io_desc)); 45 iotable_init(hi3620_io_desc, ARRAY_SIZE(hi3620_io_desc));
52} 46}
53 47
54static void hi3xxx_restart(enum reboot_mode mode, const char *cmd)
55{
56 struct device_node *np;
57 void __iomem *base;
58 int offset;
59
60 np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
61 if (!np) {
62 pr_err("failed to find hisilicon,sysctrl node\n");
63 return;
64 }
65 base = of_iomap(np, 0);
66 if (!base) {
67 pr_err("failed to map address in hisilicon,sysctrl node\n");
68 return;
69 }
70 if (of_property_read_u32(np, "reboot-offset", &offset) < 0) {
71 pr_err("failed to find reboot-offset property\n");
72 return;
73 }
74 writel_relaxed(0xdeadbeef, base + offset);
75
76 while (1)
77 cpu_do_idle();
78}
79
80static const char *hi3xxx_compat[] __initconst = { 48static const char *hi3xxx_compat[] __initconst = {
81 "hisilicon,hi3620-hi4511", 49 "hisilicon,hi3620-hi4511",
82 NULL, 50 NULL,
@@ -85,6 +53,13 @@ static const char *hi3xxx_compat[] __initconst = {
85DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") 53DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)")
86 .map_io = hi3620_map_io, 54 .map_io = hi3620_map_io,
87 .dt_compat = hi3xxx_compat, 55 .dt_compat = hi3xxx_compat,
88 .smp = smp_ops(hi3xxx_smp_ops), 56MACHINE_END
89 .restart = hi3xxx_restart, 57
58static const char *hix5hd2_compat[] __initconst = {
59 "hisilicon,hix5hd2",
60 NULL,
61};
62
63DT_MACHINE_START(HIX5HD2_DT, "Hisilicon HIX5HD2 (Flattened Device Tree)")
64 .dt_compat = hix5hd2_compat,
90MACHINE_END 65MACHINE_END
diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c
index abd441b0c604..84e6919f68c7 100644
--- a/arch/arm/mach-hisi/hotplug.c
+++ b/arch/arm/mach-hisi/hotplug.c
@@ -57,6 +57,14 @@
57#define CPU0_NEON_SRST_REQ_EN (1 << 4) 57#define CPU0_NEON_SRST_REQ_EN (1 << 4)
58#define CPU0_SRST_REQ_EN (1 << 0) 58#define CPU0_SRST_REQ_EN (1 << 0)
59 59
60#define HIX5HD2_PERI_CRG20 0x50
61#define CRG20_CPU1_RESET (1 << 17)
62
63#define HIX5HD2_PERI_PMC0 0x1000
64#define PMC0_CPU1_WAIT_MTCOMS_ACK (1 << 8)
65#define PMC0_CPU1_PMC_ENABLE (1 << 7)
66#define PMC0_CPU1_POWERDOWN (1 << 3)
67
60enum { 68enum {
61 HI3620_CTRL, 69 HI3620_CTRL,
62 ERROR_CTRL, 70 ERROR_CTRL,
@@ -157,6 +165,50 @@ void hi3xxx_set_cpu(int cpu, bool enable)
157 set_cpu_hi3620(cpu, enable); 165 set_cpu_hi3620(cpu, enable);
158} 166}
159 167
168static bool hix5hd2_hotplug_init(void)
169{
170 struct device_node *np;
171
172 np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
173 if (np) {
174 ctrl_base = of_iomap(np, 0);
175 return true;
176 }
177 return false;
178}
179
180void hix5hd2_set_cpu(int cpu, bool enable)
181{
182 u32 val = 0;
183
184 if (!ctrl_base)
185 if (!hix5hd2_hotplug_init())
186 BUG();
187
188 if (enable) {
189 /* power on cpu1 */
190 val = readl_relaxed(ctrl_base + HIX5HD2_PERI_PMC0);
191 val &= ~(PMC0_CPU1_WAIT_MTCOMS_ACK | PMC0_CPU1_POWERDOWN);
192 val |= PMC0_CPU1_PMC_ENABLE;
193 writel_relaxed(val, ctrl_base + HIX5HD2_PERI_PMC0);
194 /* unreset */
195 val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
196 val &= ~CRG20_CPU1_RESET;
197 writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
198 } else {
199 /* power down cpu1 */
200 val = readl_relaxed(ctrl_base + HIX5HD2_PERI_PMC0);
201 val |= PMC0_CPU1_PMC_ENABLE | PMC0_CPU1_POWERDOWN;
202 val &= ~PMC0_CPU1_WAIT_MTCOMS_ACK;
203 writel_relaxed(val, ctrl_base + HIX5HD2_PERI_PMC0);
204
205 /* reset */
206 val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
207 val |= CRG20_CPU1_RESET;
208 writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
209 }
210}
211
160static inline void cpu_enter_lowpower(void) 212static inline void cpu_enter_lowpower(void)
161{ 213{
162 unsigned int v; 214 unsigned int v;
@@ -199,4 +251,10 @@ int hi3xxx_cpu_kill(unsigned int cpu)
199 hi3xxx_set_cpu(cpu, false); 251 hi3xxx_set_cpu(cpu, false);
200 return 1; 252 return 1;
201} 253}
254
255void hix5hd2_cpu_die(unsigned int cpu)
256{
257 flush_cache_all();
258 hix5hd2_set_cpu(cpu, false);
259}
202#endif 260#endif
diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
index 471f1ee3be2b..575dd8285f1f 100644
--- a/arch/arm/mach-hisi/platsmp.c
+++ b/arch/arm/mach-hisi/platsmp.c
@@ -17,6 +17,8 @@
17 17
18#include "core.h" 18#include "core.h"
19 19
20#define HIX5HD2_BOOT_ADDRESS 0xffff0000
21
20static void __iomem *ctrl_base; 22static void __iomem *ctrl_base;
21 23
22void hi3xxx_set_cpu_jump(int cpu, void *jump_addr) 24void hi3xxx_set_cpu_jump(int cpu, void *jump_addr)
@@ -35,11 +37,9 @@ int hi3xxx_get_cpu_jump(int cpu)
35 return readl_relaxed(ctrl_base + ((cpu - 1) << 2)); 37 return readl_relaxed(ctrl_base + ((cpu - 1) << 2));
36} 38}
37 39
38static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) 40static void __init hisi_enable_scu_a9(void)
39{ 41{
40 struct device_node *np = NULL;
41 unsigned long base = 0; 42 unsigned long base = 0;
42 u32 offset = 0;
43 void __iomem *scu_base = NULL; 43 void __iomem *scu_base = NULL;
44 44
45 if (scu_a9_has_base()) { 45 if (scu_a9_has_base()) {
@@ -52,6 +52,14 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
52 scu_enable(scu_base); 52 scu_enable(scu_base);
53 iounmap(scu_base); 53 iounmap(scu_base);
54 } 54 }
55}
56
57static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
58{
59 struct device_node *np = NULL;
60 u32 offset = 0;
61
62 hisi_enable_scu_a9();
55 if (!ctrl_base) { 63 if (!ctrl_base) {
56 np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); 64 np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
57 if (!np) { 65 if (!np) {
@@ -87,3 +95,42 @@ struct smp_operations hi3xxx_smp_ops __initdata = {
87 .cpu_kill = hi3xxx_cpu_kill, 95 .cpu_kill = hi3xxx_cpu_kill,
88#endif 96#endif
89}; 97};
98
99static void __init hix5hd2_smp_prepare_cpus(unsigned int max_cpus)
100{
101 hisi_enable_scu_a9();
102}
103
104void hix5hd2_set_scu_boot_addr(phys_addr_t start_addr, phys_addr_t jump_addr)
105{
106 void __iomem *virt;
107
108 virt = ioremap(start_addr, PAGE_SIZE);
109
110 writel_relaxed(0xe51ff004, virt); /* ldr pc, [rc, #-4] */
111 writel_relaxed(jump_addr, virt + 4); /* pc jump phy address */
112 iounmap(virt);
113}
114
115static int hix5hd2_boot_secondary(unsigned int cpu, struct task_struct *idle)
116{
117 phys_addr_t jumpaddr;
118
119 jumpaddr = virt_to_phys(hix5hd2_secondary_startup);
120 hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr);
121 hix5hd2_set_cpu(cpu, true);
122 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
123 return 0;
124}
125
126
127struct smp_operations hix5hd2_smp_ops __initdata = {
128 .smp_prepare_cpus = hix5hd2_smp_prepare_cpus,
129 .smp_boot_secondary = hix5hd2_boot_secondary,
130#ifdef CONFIG_HOTPLUG_CPU
131 .cpu_die = hix5hd2_cpu_die,
132#endif
133};
134
135CPU_METHOD_OF_DECLARE(hi3xxx_smp, "hisilicon,hi3620-smp", &hi3xxx_smp_ops);
136CPU_METHOD_OF_DECLARE(hix5hd2_smp, "hisilicon,hix5hd2-smp", &hix5hd2_smp_ops);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 4b5185748f74..9de84a215abd 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,6 +1,5 @@
1menuconfig ARCH_MXC 1menuconfig ARCH_MXC
2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
3 select ARCH_HAS_OPP
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select ARM_CPU_SUSPEND if PM 4 select ARM_CPU_SUSPEND if PM
6 select CLKSRC_MMIO 5 select CLKSRC_MMIO
@@ -65,18 +64,8 @@ config IMX_HAVE_IOMUX_V1
65config ARCH_MXC_IOMUX_V3 64config ARCH_MXC_IOMUX_V3
66 bool 65 bool
67 66
68config ARCH_MX1
69 bool
70
71config ARCH_MX25
72 bool
73
74config MACH_MX27
75 bool
76
77config SOC_IMX1 67config SOC_IMX1
78 bool 68 bool
79 select ARCH_MX1
80 select CPU_ARM920T 69 select CPU_ARM920T
81 select IMX_HAVE_IOMUX_V1 70 select IMX_HAVE_IOMUX_V1
82 select MXC_AVIC 71 select MXC_AVIC
@@ -89,7 +78,6 @@ config SOC_IMX21
89 78
90config SOC_IMX25 79config SOC_IMX25
91 bool 80 bool
92 select ARCH_MX25
93 select ARCH_MXC_IOMUX_V3 81 select ARCH_MXC_IOMUX_V3
94 select CPU_ARM926T 82 select CPU_ARM926T
95 select MXC_AVIC 83 select MXC_AVIC
@@ -100,7 +88,6 @@ config SOC_IMX27
100 select ARCH_HAS_OPP 88 select ARCH_HAS_OPP
101 select CPU_ARM926T 89 select CPU_ARM926T
102 select IMX_HAVE_IOMUX_V1 90 select IMX_HAVE_IOMUX_V1
103 select MACH_MX27
104 select MXC_AVIC 91 select MXC_AVIC
105 select PINCTRL_IMX27 92 select PINCTRL_IMX27
106 93
@@ -119,18 +106,6 @@ config SOC_IMX35
119 select PINCTRL_IMX35 106 select PINCTRL_IMX35
120 select SMP_ON_UP if SMP 107 select SMP_ON_UP if SMP
121 108
122config SOC_IMX5
123 bool
124 select ARCH_HAS_OPP
125 select ARCH_MXC_IOMUX_V3
126 select MXC_TZIC
127
128config SOC_IMX51
129 bool
130 select HAVE_IMX_SRC
131 select PINCTRL_IMX51
132 select SOC_IMX5
133
134if ARCH_MULTI_V4T 109if ARCH_MULTI_V4T
135 110
136comment "MX1 platforms:" 111comment "MX1 platforms:"
@@ -366,15 +341,6 @@ config MACH_IMX27_VISSTRIM_M10
366 This includes specific configurations for the board and its 341 This includes specific configurations for the board and its
367 peripherals. 342 peripherals.
368 343
369config MACH_IMX27LITE
370 bool "LogicPD MX27 LITEKIT platform"
371 select IMX_HAVE_PLATFORM_IMX_SSI
372 select IMX_HAVE_PLATFORM_IMX_UART
373 select SOC_IMX27
374 help
375 Include support for MX27 LITEKIT platform. This includes specific
376 configurations for the board and its peripherals.
377
378config MACH_PCA100 344config MACH_PCA100
379 bool "Phytec phyCARD-s (pca100)" 345 bool "Phytec phyCARD-s (pca100)"
380 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 346 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
@@ -406,15 +372,6 @@ config MACH_MXT_TD60
406 Include support for i-MXT (aka td60) platform. This 372 Include support for i-MXT (aka td60) platform. This
407 includes specific configurations for the module and its peripherals. 373 includes specific configurations for the module and its peripherals.
408 374
409config MACH_IMX27IPCAM
410 bool "IMX27 IPCAM platform"
411 select IMX_HAVE_PLATFORM_IMX2_WDT
412 select IMX_HAVE_PLATFORM_IMX_UART
413 select SOC_IMX27
414 help
415 Include support for IMX27 IPCAM platform. This includes specific
416 configurations for the board and its peripherals.
417
418config MACH_IMX27_DT 375config MACH_IMX27_DT
419 bool "Support i.MX27 platforms from device tree" 376 bool "Support i.MX27 platforms from device tree"
420 select SOC_IMX27 377 select SOC_IMX27
@@ -700,24 +657,29 @@ if ARCH_MULTI_V7
700 657
701comment "Device tree only" 658comment "Device tree only"
702 659
660config SOC_IMX5
661 bool
662 select ARCH_HAS_OPP
663 select HAVE_IMX_SRC
664 select MXC_TZIC
665
703config SOC_IMX50 666config SOC_IMX50
704 bool "i.MX50 support" 667 bool "i.MX50 support"
705 select HAVE_IMX_SRC
706 select PINCTRL_IMX50 668 select PINCTRL_IMX50
707 select SOC_IMX5 669 select SOC_IMX5
708 670
709 help 671 help
710 This enables support for Freescale i.MX50 processor. 672 This enables support for Freescale i.MX50 processor.
711 673
712config MACH_IMX51_DT 674config SOC_IMX51
713 bool "i.MX51 support" 675 bool "i.MX51 support"
714 select SOC_IMX51 676 select PINCTRL_IMX51
677 select SOC_IMX5
715 help 678 help
716 This enables support for Freescale i.MX51 processor 679 This enables support for Freescale i.MX51 processor
717 680
718config SOC_IMX53 681config SOC_IMX53
719 bool "i.MX53 support" 682 bool "i.MX53 support"
720 select HAVE_IMX_SRC
721 select PINCTRL_IMX53 683 select PINCTRL_IMX53
722 select SOC_IMX5 684 select SOC_IMX5
723 685
@@ -734,8 +696,6 @@ config SOC_IMX6
734 select HAVE_IMX_MMDC 696 select HAVE_IMX_MMDC
735 select HAVE_IMX_SRC 697 select HAVE_IMX_SRC
736 select MFD_SYSCON 698 select MFD_SYSCON
737 select PL310_ERRATA_588369 if CACHE_L2X0
738 select PL310_ERRATA_727915 if CACHE_L2X0
739 select PL310_ERRATA_769419 if CACHE_L2X0 699 select PL310_ERRATA_769419 if CACHE_L2X0
740 700
741config SOC_IMX6Q 701config SOC_IMX6Q
@@ -771,8 +731,6 @@ config SOC_VF610
771 select ARM_GIC 731 select ARM_GIC
772 select PINCTRL_VF610 732 select PINCTRL_VF610
773 select VF_PIT_TIMER 733 select VF_PIT_TIMER
774 select PL310_ERRATA_588369 if CACHE_L2X0
775 select PL310_ERRATA_727915 if CACHE_L2X0
776 select PL310_ERRATA_769419 if CACHE_L2X0 734 select PL310_ERRATA_769419 if CACHE_L2X0
777 735
778 help 736 help
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index bbe93bbfd003..ac88599ca080 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-
12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o 12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o
13 13
14imx5-pm-$(CONFIG_PM) += pm-imx5.o 14imx5-pm-$(CONFIG_PM) += pm-imx5.o
15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y) 15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o clk-imx51-imx53.o $(imx5-pm-y)
16 16
17obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \ 17obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \
18 clk-pfd.o clk-busy.o clk.o \ 18 clk-pfd.o clk-busy.o clk.o \
@@ -31,6 +31,8 @@ ifeq ($(CONFIG_CPU_IDLE),y)
31obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o 31obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
32obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o 32obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
33obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o 33obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o
34# i.MX6SX reuses i.MX6Q cpuidle driver
35obj-$(CONFIG_SOC_IMX6SX) += cpuidle-imx6q.o
34endif 36endif
35 37
36ifdef CONFIG_SND_IMX_SOC 38ifdef CONFIG_SND_IMX_SOC
@@ -38,9 +40,6 @@ obj-y += ssi-fiq.o
38obj-y += ssi-fiq-ksym.o 40obj-y += ssi-fiq-ksym.o
39endif 41endif
40 42
41# Support for CMOS sensor interface
42obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o
43
44# i.MX1 based machines 43# i.MX1 based machines
45obj-$(CONFIG_ARCH_MX1ADS) += mach-mx1ads.o 44obj-$(CONFIG_ARCH_MX1ADS) += mach-mx1ads.o
46obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o 45obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o
@@ -60,13 +59,11 @@ obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
60obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o 59obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o
61obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o 60obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
62obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o 61obj-$(CONFIG_MACH_MX27_3DS) += mach-mx27_3ds.o
63obj-$(CONFIG_MACH_IMX27LITE) += mach-imx27lite.o
64obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o 62obj-$(CONFIG_MACH_IMX27_VISSTRIM_M10) += mach-imx27_visstrim_m10.o
65obj-$(CONFIG_MACH_CPUIMX27) += mach-cpuimx27.o 63obj-$(CONFIG_MACH_CPUIMX27) += mach-cpuimx27.o
66obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o 64obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o
67obj-$(CONFIG_MACH_PCA100) += mach-pca100.o 65obj-$(CONFIG_MACH_PCA100) += mach-pca100.o
68obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o 66obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o
69obj-$(CONFIG_MACH_IMX27IPCAM) += mach-imx27ipcam.o
70obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o 67obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o
71 68
72# i.MX31 based machines 69# i.MX31 based machines
@@ -109,8 +106,8 @@ obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
109endif 106endif
110obj-$(CONFIG_SOC_IMX6) += pm-imx6.o 107obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
111 108
112obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
113obj-$(CONFIG_SOC_IMX50) += mach-imx50.o 109obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
110obj-$(CONFIG_SOC_IMX51) += mach-imx51.o
114obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 111obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
115 112
116obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o 113obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 7f739be3de2c..37c307a8d896 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -15,100 +15,103 @@
15 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
16 */ 16 */
17 17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/clk.h> 18#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/clkdev.h> 19#include <linux/clkdev.h>
20#include <linux/clk-provider.h>
23#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/init.h>
23#include <linux/of.h>
24#include <linux/of_address.h>
25#include <dt-bindings/clock/imx1-clock.h>
24 26
25#include "clk.h" 27#include "clk.h"
26#include "common.h" 28#include "common.h"
27#include "hardware.h" 29#include "hardware.h"
28 30
29/* CCM register addresses */
30#define IO_ADDR_CCM(off) (MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR + (off)))
31
32#define CCM_CSCR IO_ADDR_CCM(0x0)
33#define CCM_MPCTL0 IO_ADDR_CCM(0x4)
34#define CCM_SPCTL0 IO_ADDR_CCM(0xc)
35#define CCM_PCDR IO_ADDR_CCM(0x20)
36
37/* SCM register addresses */
38#define IO_ADDR_SCM(off) (MX1_IO_ADDRESS(MX1_SCM_BASE_ADDR + (off)))
39
40#define SCM_GCCR IO_ADDR_SCM(0xc)
41
42static const char *prem_sel_clks[] = { "clk32_premult", "clk16m", }; 31static const char *prem_sel_clks[] = { "clk32_premult", "clk16m", };
43static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m", 32static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m",
44 "prem", "fclk", }; 33 "prem", "fclk", };
45 34
46enum imx1_clks { 35static struct clk *clk[IMX1_CLK_MAX];
47 dummy, clk32, clk16m_ext, clk16m, clk32_premult, prem, mpll, mpll_gate, 36static struct clk_onecell_data clk_data;
48 spll, spll_gate, mcu, fclk, hclk, clk48m, per1, per2, per3, clko,
49 uart3_gate, ssi2_gate, brom_gate, dma_gate, csi_gate, mma_gate,
50 usbd_gate, clk_max
51};
52 37
53static struct clk *clk[clk_max]; 38static void __iomem *ccm __initdata;
39#define CCM_CSCR (ccm + 0x0000)
40#define CCM_MPCTL0 (ccm + 0x0004)
41#define CCM_SPCTL0 (ccm + 0x000c)
42#define CCM_PCDR (ccm + 0x0020)
43#define SCM_GCCR (ccm + 0x0810)
54 44
55int __init mx1_clocks_init(unsigned long fref) 45static void __init _mx1_clocks_init(unsigned long fref)
56{ 46{
57 int i; 47 clk[IMX1_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
48 clk[IMX1_CLK_CLK32] = imx_obtain_fixed_clock("clk32", fref);
49 clk[IMX1_CLK_CLK16M_EXT] = imx_clk_fixed("clk16m_ext", 16000000);
50 clk[IMX1_CLK_CLK16M] = imx_clk_gate("clk16m", "clk16m_ext", CCM_CSCR, 17);
51 clk[IMX1_CLK_CLK32_PREMULT] = imx_clk_fixed_factor("clk32_premult", "clk32", 512, 1);
52 clk[IMX1_CLK_PREM] = imx_clk_mux("prem", CCM_CSCR, 16, 1, prem_sel_clks, ARRAY_SIZE(prem_sel_clks));
53 clk[IMX1_CLK_MPLL] = imx_clk_pllv1("mpll", "clk32_premult", CCM_MPCTL0);
54 clk[IMX1_CLK_MPLL_GATE] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0);
55 clk[IMX1_CLK_SPLL] = imx_clk_pllv1("spll", "prem", CCM_SPCTL0);
56 clk[IMX1_CLK_SPLL_GATE] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
57 clk[IMX1_CLK_MCU] = imx_clk_divider("mcu", "clk32_premult", CCM_CSCR, 15, 1);
58 clk[IMX1_CLK_FCLK] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 15, 1);
59 clk[IMX1_CLK_HCLK] = imx_clk_divider("hclk", "spll_gate", CCM_CSCR, 10, 4);
60 clk[IMX1_CLK_CLK48M] = imx_clk_divider("clk48m", "spll_gate", CCM_CSCR, 26, 3);
61 clk[IMX1_CLK_PER1] = imx_clk_divider("per1", "spll_gate", CCM_PCDR, 0, 4);
62 clk[IMX1_CLK_PER2] = imx_clk_divider("per2", "spll_gate", CCM_PCDR, 4, 4);
63 clk[IMX1_CLK_PER3] = imx_clk_divider("per3", "spll_gate", CCM_PCDR, 16, 7);
64 clk[IMX1_CLK_CLKO] = imx_clk_mux("clko", CCM_CSCR, 29, 3, clko_sel_clks, ARRAY_SIZE(clko_sel_clks));
65 clk[IMX1_CLK_UART3_GATE] = imx_clk_gate("uart3_gate", "hclk", SCM_GCCR, 6);
66 clk[IMX1_CLK_SSI2_GATE] = imx_clk_gate("ssi2_gate", "hclk", SCM_GCCR, 5);
67 clk[IMX1_CLK_BROM_GATE] = imx_clk_gate("brom_gate", "hclk", SCM_GCCR, 4);
68 clk[IMX1_CLK_DMA_GATE] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 3);
69 clk[IMX1_CLK_CSI_GATE] = imx_clk_gate("csi_gate", "hclk", SCM_GCCR, 2);
70 clk[IMX1_CLK_MMA_GATE] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1);
71 clk[IMX1_CLK_USBD_GATE] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0);
72
73 imx_check_clocks(clk, ARRAY_SIZE(clk));
74}
58 75
59 clk[dummy] = imx_clk_fixed("dummy", 0); 76int __init mx1_clocks_init(unsigned long fref)
60 clk[clk32] = imx_clk_fixed("clk32", fref); 77{
61 clk[clk16m_ext] = imx_clk_fixed("clk16m_ext", 16000000); 78 ccm = MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR);
62 clk[clk16m] = imx_clk_gate("clk16m", "clk16m_ext", CCM_CSCR, 17);
63 clk[clk32_premult] = imx_clk_fixed_factor("clk32_premult", "clk32", 512, 1);
64 clk[prem] = imx_clk_mux("prem", CCM_CSCR, 16, 1, prem_sel_clks,
65 ARRAY_SIZE(prem_sel_clks));
66 clk[mpll] = imx_clk_pllv1("mpll", "clk32_premult", CCM_MPCTL0);
67 clk[mpll_gate] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0);
68 clk[spll] = imx_clk_pllv1("spll", "prem", CCM_SPCTL0);
69 clk[spll_gate] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
70 clk[mcu] = imx_clk_divider("mcu", "clk32_premult", CCM_CSCR, 15, 1);
71 clk[fclk] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 15, 1);
72 clk[hclk] = imx_clk_divider("hclk", "spll_gate", CCM_CSCR, 10, 4);
73 clk[clk48m] = imx_clk_divider("clk48m", "spll_gate", CCM_CSCR, 26, 3);
74 clk[per1] = imx_clk_divider("per1", "spll_gate", CCM_PCDR, 0, 4);
75 clk[per2] = imx_clk_divider("per2", "spll_gate", CCM_PCDR, 4, 4);
76 clk[per3] = imx_clk_divider("per3", "spll_gate", CCM_PCDR, 16, 7);
77 clk[clko] = imx_clk_mux("clko", CCM_CSCR, 29, 3, clko_sel_clks,
78 ARRAY_SIZE(clko_sel_clks));
79 clk[uart3_gate] = imx_clk_gate("uart3_gate", "hclk", SCM_GCCR, 6);
80 clk[ssi2_gate] = imx_clk_gate("ssi2_gate", "hclk", SCM_GCCR, 5);
81 clk[brom_gate] = imx_clk_gate("brom_gate", "hclk", SCM_GCCR, 4);
82 clk[dma_gate] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 3);
83 clk[csi_gate] = imx_clk_gate("csi_gate", "hclk", SCM_GCCR, 2);
84 clk[mma_gate] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1);
85 clk[usbd_gate] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0);
86 79
87 for (i = 0; i < ARRAY_SIZE(clk); i++) 80 _mx1_clocks_init(fref);
88 if (IS_ERR(clk[i]))
89 pr_err("imx1 clk %d: register failed with %ld\n",
90 i, PTR_ERR(clk[i]));
91 81
92 clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma"); 82 clk_register_clkdev(clk[IMX1_CLK_PER1], "per", "imx-gpt.0");
93 clk_register_clkdev(clk[hclk], "ipg", "imx1-dma"); 83 clk_register_clkdev(clk[IMX1_CLK_HCLK], "ipg", "imx-gpt.0");
94 clk_register_clkdev(clk[per1], "per", "imx-gpt.0"); 84 clk_register_clkdev(clk[IMX1_CLK_DMA_GATE], "ahb", "imx1-dma");
95 clk_register_clkdev(clk[hclk], "ipg", "imx-gpt.0"); 85 clk_register_clkdev(clk[IMX1_CLK_HCLK], "ipg", "imx1-dma");
96 clk_register_clkdev(clk[per1], "per", "imx1-uart.0"); 86 clk_register_clkdev(clk[IMX1_CLK_PER1], "per", "imx1-uart.0");
97 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.0"); 87 clk_register_clkdev(clk[IMX1_CLK_HCLK], "ipg", "imx1-uart.0");
98 clk_register_clkdev(clk[per1], "per", "imx1-uart.1"); 88 clk_register_clkdev(clk[IMX1_CLK_PER1], "per", "imx1-uart.1");
99 clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1"); 89 clk_register_clkdev(clk[IMX1_CLK_HCLK], "ipg", "imx1-uart.1");
100 clk_register_clkdev(clk[per1], "per", "imx1-uart.2"); 90 clk_register_clkdev(clk[IMX1_CLK_PER1], "per", "imx1-uart.2");
101 clk_register_clkdev(clk[uart3_gate], "ipg", "imx1-uart.2"); 91 clk_register_clkdev(clk[IMX1_CLK_UART3_GATE], "ipg", "imx1-uart.2");
102 clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0"); 92 clk_register_clkdev(clk[IMX1_CLK_HCLK], NULL, "imx1-i2c.0");
103 clk_register_clkdev(clk[per2], "per", "imx1-cspi.0"); 93 clk_register_clkdev(clk[IMX1_CLK_PER2], "per", "imx1-cspi.0");
104 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0"); 94 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-cspi.0");
105 clk_register_clkdev(clk[per2], "per", "imx1-cspi.1"); 95 clk_register_clkdev(clk[IMX1_CLK_PER2], "per", "imx1-cspi.1");
106 clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.1"); 96 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-cspi.1");
107 clk_register_clkdev(clk[per2], "per", "imx1-fb.0"); 97 clk_register_clkdev(clk[IMX1_CLK_PER2], "per", "imx1-fb.0");
108 clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0"); 98 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-fb.0");
109 clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0"); 99 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ahb", "imx1-fb.0");
110 100
111 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT); 101 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
112 102
113 return 0; 103 return 0;
114} 104}
105
106static void __init mx1_clocks_init_dt(struct device_node *np)
107{
108 ccm = of_iomap(np, 0);
109 BUG_ON(!ccm);
110
111 _mx1_clocks_init(32768);
112
113 clk_data.clks = clk;
114 clk_data.clk_num = ARRAY_SIZE(clk);
115 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
116}
117CLK_OF_DECLARE(imx1_ccm, "fsl,imx1-ccm", mx1_clocks_init_dt);
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index bdc2e4630a08..4b4c75339aa6 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -7,178 +7,165 @@
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2 8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version. 9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */ 10 */
20 11
21#include <linux/clk.h> 12#include <linux/clk.h>
22#include <linux/clkdev.h>
23#include <linux/clk-provider.h> 13#include <linux/clk-provider.h>
24#include <linux/io.h> 14#include <linux/clkdev.h>
25#include <linux/module.h> 15#include <linux/of.h>
26#include <linux/err.h> 16#include <linux/of_address.h>
17#include <dt-bindings/clock/imx21-clock.h>
27 18
28#include "clk.h" 19#include "clk.h"
29#include "common.h" 20#include "common.h"
30#include "hardware.h" 21#include "hardware.h"
31 22
32#define IO_ADDR_CCM(off) (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off))) 23static void __iomem *ccm __initdata;
33 24
34/* Register offsets */ 25/* Register offsets */
35#define CCM_CSCR IO_ADDR_CCM(0x0) 26#define CCM_CSCR (ccm + 0x00)
36#define CCM_MPCTL0 IO_ADDR_CCM(0x4) 27#define CCM_MPCTL0 (ccm + 0x04)
37#define CCM_MPCTL1 IO_ADDR_CCM(0x8) 28#define CCM_SPCTL0 (ccm + 0x0c)
38#define CCM_SPCTL0 IO_ADDR_CCM(0xc) 29#define CCM_PCDR0 (ccm + 0x18)
39#define CCM_SPCTL1 IO_ADDR_CCM(0x10) 30#define CCM_PCDR1 (ccm + 0x1c)
40#define CCM_OSC26MCTL IO_ADDR_CCM(0x14) 31#define CCM_PCCR0 (ccm + 0x20)
41#define CCM_PCDR0 IO_ADDR_CCM(0x18) 32#define CCM_PCCR1 (ccm + 0x24)
42#define CCM_PCDR1 IO_ADDR_CCM(0x1c) 33
43#define CCM_PCCR0 IO_ADDR_CCM(0x20) 34static const char *mpll_osc_sel_clks[] = { "ckih_gate", "ckih_div1p5", };
44#define CCM_PCCR1 IO_ADDR_CCM(0x24) 35static const char *mpll_sel_clks[] = { "fpm_gate", "mpll_osc_sel", };
45#define CCM_CCSR IO_ADDR_CCM(0x28) 36static const char *spll_sel_clks[] = { "fpm_gate", "mpll_osc_sel", };
46#define CCM_PMCTL IO_ADDR_CCM(0x2c) 37static const char *ssi_sel_clks[] = { "spll_gate", "mpll_gate", };
47#define CCM_PMCOUNT IO_ADDR_CCM(0x30) 38
48#define CCM_WKGDCTL IO_ADDR_CCM(0x34) 39static struct clk *clk[IMX21_CLK_MAX];
49 40static struct clk_onecell_data clk_data;
50static const char *mpll_sel_clks[] = { "fpm", "ckih", }; 41
51static const char *spll_sel_clks[] = { "fpm", "ckih", }; 42static void __init _mx21_clocks_init(unsigned long lref, unsigned long href)
52 43{
53enum imx21_clks { 44 BUG_ON(!ccm);
54 ckil, ckih, fpm, mpll_sel, spll_sel, mpll, spll, fclk, hclk, ipg, per1, 45
55 per2, per3, per4, uart1_ipg_gate, uart2_ipg_gate, uart3_ipg_gate, 46 clk[IMX21_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
56 uart4_ipg_gate, gpt1_ipg_gate, gpt2_ipg_gate, gpt3_ipg_gate, 47 clk[IMX21_CLK_CKIL] = imx_obtain_fixed_clock("ckil", lref);
57 pwm_ipg_gate, sdhc1_ipg_gate, sdhc2_ipg_gate, lcdc_ipg_gate, 48 clk[IMX21_CLK_CKIH] = imx_obtain_fixed_clock("ckih", href);
58 lcdc_hclk_gate, cspi3_ipg_gate, cspi2_ipg_gate, cspi1_ipg_gate, 49 clk[IMX21_CLK_FPM] = imx_clk_fixed_factor("fpm", "ckil", 512, 1);
59 per4_gate, csi_hclk_gate, usb_div, usb_gate, usb_hclk_gate, ssi1_gate, 50 clk[IMX21_CLK_CKIH_DIV1P5] = imx_clk_fixed_factor("ckih_div1p5", "ckih_gate", 2, 3);
60 ssi2_gate, nfc_div, nfc_gate, dma_gate, dma_hclk_gate, brom_gate, 51
61 emma_gate, emma_hclk_gate, slcdc_gate, slcdc_hclk_gate, wdog_gate, 52 clk[IMX21_CLK_MPLL_GATE] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0);
62 gpio_gate, i2c_gate, kpp_gate, owire_gate, rtc_gate, clk_max 53 clk[IMX21_CLK_SPLL_GATE] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
63}; 54 clk[IMX21_CLK_FPM_GATE] = imx_clk_gate("fpm_gate", "fpm", CCM_CSCR, 2);
64 55 clk[IMX21_CLK_CKIH_GATE] = imx_clk_gate_dis("ckih_gate", "ckih", CCM_CSCR, 3);
65static struct clk *clk[clk_max]; 56 clk[IMX21_CLK_MPLL_OSC_SEL] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1, mpll_osc_sel_clks, ARRAY_SIZE(mpll_osc_sel_clks));
57 clk[IMX21_CLK_IPG] = imx_clk_divider("ipg", "hclk", CCM_CSCR, 9, 1);
58 clk[IMX21_CLK_HCLK] = imx_clk_divider("hclk", "fclk", CCM_CSCR, 10, 4);
59 clk[IMX21_CLK_MPLL_SEL] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, ARRAY_SIZE(mpll_sel_clks));
60 clk[IMX21_CLK_SPLL_SEL] = imx_clk_mux("spll_sel", CCM_CSCR, 17, 1, spll_sel_clks, ARRAY_SIZE(spll_sel_clks));
61 clk[IMX21_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", CCM_CSCR, 19, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
62 clk[IMX21_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", CCM_CSCR, 20, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
63 clk[IMX21_CLK_USB_DIV] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 26, 3);
64 clk[IMX21_CLK_FCLK] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 29, 3);
65
66 clk[IMX21_CLK_MPLL] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0);
67
68 clk[IMX21_CLK_SPLL] = imx_clk_pllv1("spll", "spll_sel", CCM_SPCTL0);
69
70 clk[IMX21_CLK_NFC_DIV] = imx_clk_divider("nfc_div", "fclk", CCM_PCDR0, 12, 4);
71 clk[IMX21_CLK_SSI1_DIV] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6);
72 clk[IMX21_CLK_SSI2_DIV] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6);
73
74 clk[IMX21_CLK_PER1] = imx_clk_divider("per1", "mpll_gate", CCM_PCDR1, 0, 6);
75 clk[IMX21_CLK_PER2] = imx_clk_divider("per2", "mpll_gate", CCM_PCDR1, 8, 6);
76 clk[IMX21_CLK_PER3] = imx_clk_divider("per3", "mpll_gate", CCM_PCDR1, 16, 6);
77 clk[IMX21_CLK_PER4] = imx_clk_divider("per4", "mpll_gate", CCM_PCDR1, 24, 6);
78
79 clk[IMX21_CLK_UART1_IPG_GATE] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR0, 0);
80 clk[IMX21_CLK_UART2_IPG_GATE] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR0, 1);
81 clk[IMX21_CLK_UART3_IPG_GATE] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR0, 2);
82 clk[IMX21_CLK_UART4_IPG_GATE] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR0, 3);
83 clk[IMX21_CLK_CSPI1_IPG_GATE] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 4);
84 clk[IMX21_CLK_CSPI2_IPG_GATE] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 5);
85 clk[IMX21_CLK_SSI1_GATE] = imx_clk_gate("ssi1_gate", "ipg", CCM_PCCR0, 6);
86 clk[IMX21_CLK_SSI2_GATE] = imx_clk_gate("ssi2_gate", "ipg", CCM_PCCR0, 7);
87 clk[IMX21_CLK_SDHC1_IPG_GATE] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 9);
88 clk[IMX21_CLK_SDHC2_IPG_GATE] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 10);
89 clk[IMX21_CLK_GPIO_GATE] = imx_clk_gate("gpio_gate", "ipg", CCM_PCCR0, 11);
90 clk[IMX21_CLK_I2C_GATE] = imx_clk_gate("i2c_gate", "ipg", CCM_PCCR0, 12);
91 clk[IMX21_CLK_DMA_GATE] = imx_clk_gate("dma_gate", "ipg", CCM_PCCR0, 13);
92 clk[IMX21_CLK_USB_GATE] = imx_clk_gate("usb_gate", "usb_div", CCM_PCCR0, 14);
93 clk[IMX21_CLK_EMMA_GATE] = imx_clk_gate("emma_gate", "ipg", CCM_PCCR0, 15);
94 clk[IMX21_CLK_SSI2_BAUD_GATE] = imx_clk_gate("ssi2_baud_gate", "ipg", CCM_PCCR0, 16);
95 clk[IMX21_CLK_SSI1_BAUD_GATE] = imx_clk_gate("ssi1_baud_gate", "ipg", CCM_PCCR0, 17);
96 clk[IMX21_CLK_LCDC_IPG_GATE] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 18);
97 clk[IMX21_CLK_NFC_GATE] = imx_clk_gate("nfc_gate", "nfc_div", CCM_PCCR0, 19);
98 clk[IMX21_CLK_SLCDC_HCLK_GATE] = imx_clk_gate("slcdc_hclk_gate", "hclk", CCM_PCCR0, 21);
99 clk[IMX21_CLK_PER4_GATE] = imx_clk_gate("per4_gate", "per4", CCM_PCCR0, 22);
100 clk[IMX21_CLK_BMI_GATE] = imx_clk_gate("bmi_gate", "hclk", CCM_PCCR0, 23);
101 clk[IMX21_CLK_USB_HCLK_GATE] = imx_clk_gate("usb_hclk_gate", "hclk", CCM_PCCR0, 24);
102 clk[IMX21_CLK_SLCDC_GATE] = imx_clk_gate("slcdc_gate", "hclk", CCM_PCCR0, 25);
103 clk[IMX21_CLK_LCDC_HCLK_GATE] = imx_clk_gate("lcdc_hclk_gate", "hclk", CCM_PCCR0, 26);
104 clk[IMX21_CLK_EMMA_HCLK_GATE] = imx_clk_gate("emma_hclk_gate", "hclk", CCM_PCCR0, 27);
105 clk[IMX21_CLK_BROM_GATE] = imx_clk_gate("brom_gate", "hclk", CCM_PCCR0, 28);
106 clk[IMX21_CLK_DMA_HCLK_GATE] = imx_clk_gate("dma_hclk_gate", "hclk", CCM_PCCR0, 30);
107 clk[IMX21_CLK_CSI_HCLK_GATE] = imx_clk_gate("csi_hclk_gate", "hclk", CCM_PCCR0, 31);
108
109 clk[IMX21_CLK_CSPI3_IPG_GATE] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR1, 23);
110 clk[IMX21_CLK_WDOG_GATE] = imx_clk_gate("wdog_gate", "ipg", CCM_PCCR1, 24);
111 clk[IMX21_CLK_GPT1_IPG_GATE] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR1, 25);
112 clk[IMX21_CLK_GPT2_IPG_GATE] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR1, 26);
113 clk[IMX21_CLK_GPT3_IPG_GATE] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR1, 27);
114 clk[IMX21_CLK_PWM_IPG_GATE] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR1, 28);
115 clk[IMX21_CLK_RTC_GATE] = imx_clk_gate("rtc_gate", "ipg", CCM_PCCR1, 29);
116 clk[IMX21_CLK_KPP_GATE] = imx_clk_gate("kpp_gate", "ipg", CCM_PCCR1, 30);
117 clk[IMX21_CLK_OWIRE_GATE] = imx_clk_gate("owire_gate", "ipg", CCM_PCCR1, 31);
118
119 imx_check_clocks(clk, ARRAY_SIZE(clk));
120}
66 121
67/*
68 * must be called very early to get information about the
69 * available clock rate when the timer framework starts
70 */
71int __init mx21_clocks_init(unsigned long lref, unsigned long href) 122int __init mx21_clocks_init(unsigned long lref, unsigned long href)
72{ 123{
73 int i; 124 ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
74 125
75 clk[ckil] = imx_clk_fixed("ckil", lref); 126 _mx21_clocks_init(lref, href);
76 clk[ckih] = imx_clk_fixed("ckih", href); 127
77 clk[fpm] = imx_clk_fixed_factor("fpm", "ckil", 512, 1); 128 clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.0");
78 clk[mpll_sel] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, 129 clk_register_clkdev(clk[IMX21_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
79 ARRAY_SIZE(mpll_sel_clks)); 130 clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.1");
80 clk[spll_sel] = imx_clk_mux("spll_sel", CCM_CSCR, 17, 1, spll_sel_clks, 131 clk_register_clkdev(clk[IMX21_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
81 ARRAY_SIZE(spll_sel_clks)); 132 clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.2");
82 clk[mpll] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0); 133 clk_register_clkdev(clk[IMX21_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
83 clk[spll] = imx_clk_pllv1("spll", "spll_sel", CCM_SPCTL0); 134 clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.3");
84 clk[fclk] = imx_clk_divider("fclk", "mpll", CCM_CSCR, 29, 3); 135 clk_register_clkdev(clk[IMX21_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
85 clk[hclk] = imx_clk_divider("hclk", "fclk", CCM_CSCR, 10, 4); 136 clk_register_clkdev(clk[IMX21_CLK_GPT1_IPG_GATE], "ipg", "imx-gpt.0");
86 clk[ipg] = imx_clk_divider("ipg", "hclk", CCM_CSCR, 9, 1); 137 clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx-gpt.0");
87 clk[per1] = imx_clk_divider("per1", "mpll", CCM_PCDR1, 0, 6); 138 clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.0");
88 clk[per2] = imx_clk_divider("per2", "mpll", CCM_PCDR1, 8, 6); 139 clk_register_clkdev(clk[IMX21_CLK_CSPI1_IPG_GATE], "ipg", "imx21-cspi.0");
89 clk[per3] = imx_clk_divider("per3", "mpll", CCM_PCDR1, 16, 6); 140 clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.1");
90 clk[per4] = imx_clk_divider("per4", "mpll", CCM_PCDR1, 24, 6); 141 clk_register_clkdev(clk[IMX21_CLK_CSPI2_IPG_GATE], "ipg", "imx21-cspi.1");
91 clk[uart1_ipg_gate] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR0, 0); 142 clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.2");
92 clk[uart2_ipg_gate] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR0, 1); 143 clk_register_clkdev(clk[IMX21_CLK_CSPI3_IPG_GATE], "ipg", "imx21-cspi.2");
93 clk[uart3_ipg_gate] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR0, 2); 144 clk_register_clkdev(clk[IMX21_CLK_PER3], "per", "imx21-fb.0");
94 clk[uart4_ipg_gate] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR0, 3); 145 clk_register_clkdev(clk[IMX21_CLK_LCDC_IPG_GATE], "ipg", "imx21-fb.0");
95 clk[gpt1_ipg_gate] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR1, 25); 146 clk_register_clkdev(clk[IMX21_CLK_LCDC_HCLK_GATE], "ahb", "imx21-fb.0");
96 clk[gpt2_ipg_gate] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR1, 26); 147 clk_register_clkdev(clk[IMX21_CLK_USB_GATE], "per", "imx21-hcd.0");
97 clk[gpt3_ipg_gate] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR1, 27); 148 clk_register_clkdev(clk[IMX21_CLK_USB_HCLK_GATE], "ahb", "imx21-hcd.0");
98 clk[pwm_ipg_gate] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR1, 28); 149 clk_register_clkdev(clk[IMX21_CLK_NFC_GATE], NULL, "imx21-nand.0");
99 clk[sdhc1_ipg_gate] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 9); 150 clk_register_clkdev(clk[IMX21_CLK_DMA_HCLK_GATE], "ahb", "imx21-dma");
100 clk[sdhc2_ipg_gate] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 10); 151 clk_register_clkdev(clk[IMX21_CLK_DMA_GATE], "ipg", "imx21-dma");
101 clk[lcdc_ipg_gate] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 18); 152 clk_register_clkdev(clk[IMX21_CLK_WDOG_GATE], NULL, "imx2-wdt.0");
102 clk[lcdc_hclk_gate] = imx_clk_gate("lcdc_hclk_gate", "hclk", CCM_PCCR0, 26); 153 clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0");
103 clk[cspi3_ipg_gate] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR1, 23); 154 clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0");
104 clk[cspi2_ipg_gate] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 5);
105 clk[cspi1_ipg_gate] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 4);
106 clk[per4_gate] = imx_clk_gate("per4_gate", "per4", CCM_PCCR0, 22);
107 clk[csi_hclk_gate] = imx_clk_gate("csi_hclk_gate", "hclk", CCM_PCCR0, 31);
108 clk[usb_div] = imx_clk_divider("usb_div", "spll", CCM_CSCR, 26, 3);
109 clk[usb_gate] = imx_clk_gate("usb_gate", "usb_div", CCM_PCCR0, 14);
110 clk[usb_hclk_gate] = imx_clk_gate("usb_hclk_gate", "hclk", CCM_PCCR0, 24);
111 clk[ssi1_gate] = imx_clk_gate("ssi1_gate", "ipg", CCM_PCCR0, 6);
112 clk[ssi2_gate] = imx_clk_gate("ssi2_gate", "ipg", CCM_PCCR0, 7);
113 clk[nfc_div] = imx_clk_divider("nfc_div", "ipg", CCM_PCDR0, 12, 4);
114 clk[nfc_gate] = imx_clk_gate("nfc_gate", "nfc_div", CCM_PCCR0, 19);
115 clk[dma_gate] = imx_clk_gate("dma_gate", "ipg", CCM_PCCR0, 13);
116 clk[dma_hclk_gate] = imx_clk_gate("dma_hclk_gate", "hclk", CCM_PCCR0, 30);
117 clk[brom_gate] = imx_clk_gate("brom_gate", "hclk", CCM_PCCR0, 28);
118 clk[emma_gate] = imx_clk_gate("emma_gate", "ipg", CCM_PCCR0, 15);
119 clk[emma_hclk_gate] = imx_clk_gate("emma_hclk_gate", "hclk", CCM_PCCR0, 27);
120 clk[slcdc_gate] = imx_clk_gate("slcdc_gate", "ipg", CCM_PCCR0, 25);
121 clk[slcdc_hclk_gate] = imx_clk_gate("slcdc_hclk_gate", "hclk", CCM_PCCR0, 21);
122 clk[wdog_gate] = imx_clk_gate("wdog_gate", "ipg", CCM_PCCR1, 24);
123 clk[gpio_gate] = imx_clk_gate("gpio_gate", "ipg", CCM_PCCR0, 11);
124 clk[i2c_gate] = imx_clk_gate("i2c_gate", "ipg", CCM_PCCR0, 12);
125 clk[kpp_gate] = imx_clk_gate("kpp_gate", "ipg", CCM_PCCR1, 30);
126 clk[owire_gate] = imx_clk_gate("owire_gate", "ipg", CCM_PCCR1, 31);
127 clk[rtc_gate] = imx_clk_gate("rtc_gate", "ipg", CCM_PCCR1, 29);
128
129 for (i = 0; i < ARRAY_SIZE(clk); i++)
130 if (IS_ERR(clk[i]))
131 pr_err("i.MX21 clk %d: register failed with %ld\n",
132 i, PTR_ERR(clk[i]));
133
134 clk_register_clkdev(clk[per1], "per1", NULL);
135 clk_register_clkdev(clk[per2], "per2", NULL);
136 clk_register_clkdev(clk[per3], "per3", NULL);
137 clk_register_clkdev(clk[per4], "per4", NULL);
138 clk_register_clkdev(clk[per1], "per", "imx21-uart.0");
139 clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0");
140 clk_register_clkdev(clk[per1], "per", "imx21-uart.1");
141 clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1");
142 clk_register_clkdev(clk[per1], "per", "imx21-uart.2");
143 clk_register_clkdev(clk[uart3_ipg_gate], "ipg", "imx21-uart.2");
144 clk_register_clkdev(clk[per1], "per", "imx21-uart.3");
145 clk_register_clkdev(clk[uart4_ipg_gate], "ipg", "imx21-uart.3");
146 clk_register_clkdev(clk[gpt1_ipg_gate], "ipg", "imx-gpt.0");
147 clk_register_clkdev(clk[per1], "per", "imx-gpt.0");
148 clk_register_clkdev(clk[gpt2_ipg_gate], "ipg", "imx-gpt.1");
149 clk_register_clkdev(clk[per1], "per", "imx-gpt.1");
150 clk_register_clkdev(clk[gpt3_ipg_gate], "ipg", "imx-gpt.2");
151 clk_register_clkdev(clk[per1], "per", "imx-gpt.2");
152 clk_register_clkdev(clk[per2], "per", "imx21-cspi.0");
153 clk_register_clkdev(clk[cspi1_ipg_gate], "ipg", "imx21-cspi.0");
154 clk_register_clkdev(clk[per2], "per", "imx21-cspi.1");
155 clk_register_clkdev(clk[cspi2_ipg_gate], "ipg", "imx21-cspi.1");
156 clk_register_clkdev(clk[per2], "per", "imx21-cspi.2");
157 clk_register_clkdev(clk[cspi3_ipg_gate], "ipg", "imx21-cspi.2");
158 clk_register_clkdev(clk[per3], "per", "imx21-fb.0");
159 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
160 clk_register_clkdev(clk[lcdc_hclk_gate], "ahb", "imx21-fb.0");
161 clk_register_clkdev(clk[usb_gate], "per", "imx21-hcd.0");
162 clk_register_clkdev(clk[usb_hclk_gate], "ahb", "imx21-hcd.0");
163 clk_register_clkdev(clk[nfc_gate], NULL, "imx21-nand.0");
164 clk_register_clkdev(clk[dma_hclk_gate], "ahb", "imx21-dma");
165 clk_register_clkdev(clk[dma_gate], "ipg", "imx21-dma");
166 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
167 clk_register_clkdev(clk[i2c_gate], NULL, "imx21-i2c.0");
168 clk_register_clkdev(clk[kpp_gate], NULL, "mxc-keypad");
169 clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
170 clk_register_clkdev(clk[brom_gate], "brom", NULL);
171 clk_register_clkdev(clk[emma_gate], "emma", NULL);
172 clk_register_clkdev(clk[slcdc_gate], "slcdc", NULL);
173 clk_register_clkdev(clk[gpio_gate], "gpio", NULL);
174 clk_register_clkdev(clk[rtc_gate], "rtc", NULL);
175 clk_register_clkdev(clk[csi_hclk_gate], "csi", NULL);
176 clk_register_clkdev(clk[ssi1_gate], "ssi1", NULL);
177 clk_register_clkdev(clk[ssi2_gate], "ssi2", NULL);
178 clk_register_clkdev(clk[sdhc1_ipg_gate], "sdhc1", NULL);
179 clk_register_clkdev(clk[sdhc2_ipg_gate], "sdhc2", NULL);
180 155
181 mxc_timer_init(MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), MX21_INT_GPT1); 156 mxc_timer_init(MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), MX21_INT_GPT1);
182 157
183 return 0; 158 return 0;
184} 159}
160
161static void __init mx21_clocks_init_dt(struct device_node *np)
162{
163 ccm = of_iomap(np, 0);
164
165 _mx21_clocks_init(32768, 26000000);
166
167 clk_data.clks = clk;
168 clk_data.clk_num = ARRAY_SIZE(clk);
169 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
170}
171CLK_OF_DECLARE(imx27_ccm, "fsl,imx21-ccm", mx21_clocks_init_dt);
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index ae578c096ad8..59c0c8558c6b 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -32,8 +32,6 @@
32#include "hardware.h" 32#include "hardware.h"
33#include "mx25.h" 33#include "mx25.h"
34 34
35#define CRM_BASE MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
36
37#define CCM_MPCTL 0x00 35#define CCM_MPCTL 0x00
38#define CCM_UPCTL 0x04 36#define CCM_UPCTL 0x04
39#define CCM_CCTL 0x08 37#define CCM_CCTL 0x08
@@ -56,7 +54,7 @@
56#define CCM_LTR3 0x4c 54#define CCM_LTR3 0x4c
57#define CCM_MCR 0x64 55#define CCM_MCR 0x64
58 56
59#define ccm(x) (CRM_BASE + (x)) 57#define ccm(x) (ccm_base + (x))
60 58
61static struct clk_onecell_data clk_data; 59static struct clk_onecell_data clk_data;
62 60
@@ -91,9 +89,10 @@ enum mx25_clks {
91 89
92static struct clk *clk[clk_max]; 90static struct clk *clk[clk_max];
93 91
94static int __init __mx25_clocks_init(unsigned long osc_rate) 92static int __init __mx25_clocks_init(unsigned long osc_rate,
93 void __iomem *ccm_base)
95{ 94{
96 int i; 95 BUG_ON(!ccm_base);
97 96
98 clk[dummy] = imx_clk_fixed("dummy", 0); 97 clk[dummy] = imx_clk_fixed("dummy", 0);
99 clk[osc] = imx_clk_fixed("osc", osc_rate); 98 clk[osc] = imx_clk_fixed("osc", osc_rate);
@@ -224,19 +223,13 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
224 /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */ 223 /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */
225 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19); 224 clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19);
226 225
227 for (i = 0; i < ARRAY_SIZE(clk); i++) 226 imx_check_clocks(clk, ARRAY_SIZE(clk));
228 if (IS_ERR(clk[i]))
229 pr_err("i.MX25 clk %d: register failed with %ld\n",
230 i, PTR_ERR(clk[i]));
231 227
232 clk_prepare_enable(clk[emi_ahb]); 228 clk_prepare_enable(clk[emi_ahb]);
233 229
234 /* Clock source for gpt must be derived from AHB */ 230 /* Clock source for gpt must be derived from AHB */
235 clk_set_parent(clk[per5_sel], clk[ahb]); 231 clk_set_parent(clk[per5_sel], clk[ahb]);
236 232
237 clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
238 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
239
240 /* 233 /*
241 * Let's initially set up CLKO parent as ipg, since this configuration 234 * Let's initially set up CLKO parent as ipg, since this configuration
242 * is used on some imx25 board designs to clock the audio codec. 235 * is used on some imx25 board designs to clock the audio codec.
@@ -248,8 +241,14 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
248 241
249int __init mx25_clocks_init(void) 242int __init mx25_clocks_init(void)
250{ 243{
251 __mx25_clocks_init(24000000); 244 void __iomem *ccm;
252 245
246 ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K);
247
248 __mx25_clocks_init(24000000, ccm);
249
250 clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0");
251 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
253 /* i.mx25 has the i.mx21 type uart */ 252 /* i.mx25 has the i.mx21 type uart */
254 clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0"); 253 clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0");
255 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0"); 254 clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0");
@@ -314,29 +313,27 @@ int __init mx25_clocks_init(void)
314 return 0; 313 return 0;
315} 314}
316 315
317int __init mx25_clocks_init_dt(void) 316static void __init mx25_clocks_init_dt(struct device_node *np)
318{ 317{
319 struct device_node *np; 318 struct device_node *refnp;
320 unsigned long osc_rate = 24000000; 319 unsigned long osc_rate = 24000000;
320 void __iomem *ccm;
321 321
322 /* retrieve the freqency of fixed clocks from device tree */ 322 /* retrieve the freqency of fixed clocks from device tree */
323 for_each_compatible_node(np, NULL, "fixed-clock") { 323 for_each_compatible_node(refnp, NULL, "fixed-clock") {
324 u32 rate; 324 u32 rate;
325 if (of_property_read_u32(np, "clock-frequency", &rate)) 325 if (of_property_read_u32(refnp, "clock-frequency", &rate))
326 continue; 326 continue;
327 327
328 if (of_device_is_compatible(np, "fsl,imx-osc")) 328 if (of_device_is_compatible(refnp, "fsl,imx-osc"))
329 osc_rate = rate; 329 osc_rate = rate;
330 } 330 }
331 331
332 np = of_find_compatible_node(NULL, NULL, "fsl,imx25-ccm"); 332 ccm = of_iomap(np, 0);
333 __mx25_clocks_init(osc_rate, ccm);
334
333 clk_data.clks = clk; 335 clk_data.clks = clk;
334 clk_data.clk_num = ARRAY_SIZE(clk); 336 clk_data.clk_num = ARRAY_SIZE(clk);
335 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 337 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
336
337 __mx25_clocks_init(osc_rate);
338
339 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt"));
340
341 return 0;
342} 338}
339CLK_OF_DECLARE(imx25_ccm, "fsl,imx25-ccm", mx25_clocks_init_dt);
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 317a662626d6..ab6349ec23b9 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -1,61 +1,36 @@
1#include <linux/clk.h> 1#include <linux/clk.h>
2#include <linux/io.h> 2#include <linux/clk-provider.h>
3#include <linux/module.h>
4#include <linux/clkdev.h> 3#include <linux/clkdev.h>
5#include <linux/err.h> 4#include <linux/err.h>
6#include <linux/clk-provider.h>
7#include <linux/of.h> 5#include <linux/of.h>
6#include <linux/of_address.h>
7#include <dt-bindings/clock/imx27-clock.h>
8 8
9#include "clk.h" 9#include "clk.h"
10#include "common.h" 10#include "common.h"
11#include "hardware.h" 11#include "hardware.h"
12 12
13#define IO_ADDR_CCM(off) (MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR + (off))) 13static void __iomem *ccm __initdata;
14 14
15/* Register offsets */ 15/* Register offsets */
16#define CCM_CSCR IO_ADDR_CCM(0x0) 16#define CCM_CSCR (ccm + 0x00)
17#define CCM_MPCTL0 IO_ADDR_CCM(0x4) 17#define CCM_MPCTL0 (ccm + 0x04)
18#define CCM_MPCTL1 IO_ADDR_CCM(0x8) 18#define CCM_MPCTL1 (ccm + 0x08)
19#define CCM_SPCTL0 IO_ADDR_CCM(0xc) 19#define CCM_SPCTL0 (ccm + 0x0c)
20#define CCM_SPCTL1 IO_ADDR_CCM(0x10) 20#define CCM_SPCTL1 (ccm + 0x10)
21#define CCM_OSC26MCTL IO_ADDR_CCM(0x14) 21#define CCM_PCDR0 (ccm + 0x18)
22#define CCM_PCDR0 IO_ADDR_CCM(0x18) 22#define CCM_PCDR1 (ccm + 0x1c)
23#define CCM_PCDR1 IO_ADDR_CCM(0x1c) 23#define CCM_PCCR0 (ccm + 0x20)
24#define CCM_PCCR0 IO_ADDR_CCM(0x20) 24#define CCM_PCCR1 (ccm + 0x24)
25#define CCM_PCCR1 IO_ADDR_CCM(0x24) 25#define CCM_CCSR (ccm + 0x28)
26#define CCM_CCSR IO_ADDR_CCM(0x28)
27#define CCM_PMCTL IO_ADDR_CCM(0x2c)
28#define CCM_PMCOUNT IO_ADDR_CCM(0x30)
29#define CCM_WKGDCTL IO_ADDR_CCM(0x34)
30
31#define CCM_CSCR_UPDATE_DIS (1 << 31)
32#define CCM_CSCR_SSI2 (1 << 23)
33#define CCM_CSCR_SSI1 (1 << 22)
34#define CCM_CSCR_VPU (1 << 21)
35#define CCM_CSCR_MSHC (1 << 20)
36#define CCM_CSCR_SPLLRES (1 << 19)
37#define CCM_CSCR_MPLLRES (1 << 18)
38#define CCM_CSCR_SP (1 << 17)
39#define CCM_CSCR_MCU (1 << 16)
40#define CCM_CSCR_OSC26MDIV (1 << 4)
41#define CCM_CSCR_OSC26M (1 << 3)
42#define CCM_CSCR_FPM (1 << 2)
43#define CCM_CSCR_SPEN (1 << 1)
44#define CCM_CSCR_MPEN (1 << 0)
45
46/* i.MX27 TO 2+ */
47#define CCM_CSCR_ARM_SRC (1 << 15)
48
49#define CCM_SPCTL1_LF (1 << 15)
50#define CCM_SPCTL1_BRMO (1 << 6)
51 26
52static const char *vpu_sel_clks[] = { "spll", "mpll_main2", }; 27static const char *vpu_sel_clks[] = { "spll", "mpll_main2", };
53static const char *cpu_sel_clks[] = { "mpll_main2", "mpll", }; 28static const char *cpu_sel_clks[] = { "mpll_main2", "mpll", };
54static const char *mpll_sel_clks[] = { "fpm", "mpll_osc_sel", }; 29static const char *mpll_sel_clks[] = { "fpm", "mpll_osc_sel", };
55static const char *mpll_osc_sel_clks[] = { "ckih", "ckih_div1p5", }; 30static const char *mpll_osc_sel_clks[] = { "ckih_gate", "ckih_div1p5", };
56static const char *clko_sel_clks[] = { 31static const char *clko_sel_clks[] = {
57 "ckil", "fpm", "ckih", "ckih", 32 "ckil", "fpm", "ckih_gate", "ckih_gate",
58 "ckih", "mpll", "spll", "cpu_div", 33 "ckih_gate", "mpll", "spll", "cpu_div",
59 "ahb", "ipg", "per1_div", "per2_div", 34 "ahb", "ipg", "per1_div", "per2_div",
60 "per3_div", "per4_div", "ssi1_div", "ssi2_div", 35 "per3_div", "per4_div", "ssi1_div", "ssi2_div",
61 "nfc_div", "mshc_div", "vpu_div", "60m", 36 "nfc_div", "mshc_div", "vpu_div", "60m",
@@ -64,239 +39,220 @@ static const char *clko_sel_clks[] = {
64 39
65static const char *ssi_sel_clks[] = { "spll_gate", "mpll", }; 40static const char *ssi_sel_clks[] = { "spll_gate", "mpll", };
66 41
67enum mx27_clks { 42static struct clk *clk[IMX27_CLK_MAX];
68 dummy, ckih, ckil, mpll, spll, mpll_main2, ahb, ipg, nfc_div, per1_div,
69 per2_div, per3_div, per4_div, vpu_sel, vpu_div, usb_div, cpu_sel,
70 clko_sel, cpu_div, clko_div, ssi1_sel, ssi2_sel, ssi1_div, ssi2_div,
71 clko_en, ssi2_ipg_gate, ssi1_ipg_gate, slcdc_ipg_gate, sdhc3_ipg_gate,
72 sdhc2_ipg_gate, sdhc1_ipg_gate, scc_ipg_gate, sahara_ipg_gate,
73 rtc_ipg_gate, pwm_ipg_gate, owire_ipg_gate, lcdc_ipg_gate,
74 kpp_ipg_gate, iim_ipg_gate, i2c2_ipg_gate, i2c1_ipg_gate,
75 gpt6_ipg_gate, gpt5_ipg_gate, gpt4_ipg_gate, gpt3_ipg_gate,
76 gpt2_ipg_gate, gpt1_ipg_gate, gpio_ipg_gate, fec_ipg_gate,
77 emma_ipg_gate, dma_ipg_gate, cspi3_ipg_gate, cspi2_ipg_gate,
78 cspi1_ipg_gate, nfc_baud_gate, ssi2_baud_gate, ssi1_baud_gate,
79 vpu_baud_gate, per4_gate, per3_gate, per2_gate, per1_gate,
80 usb_ahb_gate, slcdc_ahb_gate, sahara_ahb_gate, lcdc_ahb_gate,
81 vpu_ahb_gate, fec_ahb_gate, emma_ahb_gate, emi_ahb_gate, dma_ahb_gate,
82 csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate,
83 uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate,
84 uart2_ipg_gate, uart1_ipg_gate, ckih_div1p5, fpm, mpll_osc_sel,
85 mpll_sel, spll_gate, mshc_div, rtic_ipg_gate, mshc_ipg_gate,
86 rtic_ahb_gate, mshc_baud_gate, clk_max
87};
88
89static struct clk *clk[clk_max];
90static struct clk_onecell_data clk_data; 43static struct clk_onecell_data clk_data;
91 44
92int __init mx27_clocks_init(unsigned long fref) 45static void __init _mx27_clocks_init(unsigned long fref)
93{ 46{
94 int i; 47 BUG_ON(!ccm);
95 struct device_node *np;
96
97 clk[dummy] = imx_clk_fixed("dummy", 0);
98 clk[ckih] = imx_clk_fixed("ckih", fref);
99 clk[ckil] = imx_clk_fixed("ckil", 32768);
100 clk[fpm] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
101 clk[ckih_div1p5] = imx_clk_fixed_factor("ckih_div1p5", "ckih", 2, 3);
102 48
103 clk[mpll_osc_sel] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1, 49 clk[IMX27_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
104 mpll_osc_sel_clks, 50 clk[IMX27_CLK_CKIH] = imx_clk_fixed("ckih", fref);
105 ARRAY_SIZE(mpll_osc_sel_clks)); 51 clk[IMX27_CLK_CKIL] = imx_clk_fixed("ckil", 32768);
106 clk[mpll_sel] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, 52 clk[IMX27_CLK_FPM] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
107 ARRAY_SIZE(mpll_sel_clks)); 53 clk[IMX27_CLK_CKIH_DIV1P5] = imx_clk_fixed_factor("ckih_div1p5", "ckih_gate", 2, 3);
108 clk[mpll] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0); 54 clk[IMX27_CLK_CKIH_GATE] = imx_clk_gate_dis("ckih_gate", "ckih", CCM_CSCR, 3);
109 clk[spll] = imx_clk_pllv1("spll", "ckih", CCM_SPCTL0); 55 clk[IMX27_CLK_MPLL_OSC_SEL] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1, mpll_osc_sel_clks, ARRAY_SIZE(mpll_osc_sel_clks));
110 clk[spll_gate] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1); 56 clk[IMX27_CLK_MPLL_SEL] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, ARRAY_SIZE(mpll_sel_clks));
111 clk[mpll_main2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3); 57 clk[IMX27_CLK_MPLL] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0);
58 clk[IMX27_CLK_SPLL] = imx_clk_pllv1("spll", "ckih_gate", CCM_SPCTL0);
59 clk[IMX27_CLK_SPLL_GATE] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
60 clk[IMX27_CLK_MPLL_MAIN2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3);
112 61
113 if (mx27_revision() >= IMX_CHIP_REVISION_2_0) { 62 if (mx27_revision() >= IMX_CHIP_REVISION_2_0) {
114 clk[ahb] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 8, 2); 63 clk[IMX27_CLK_AHB] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 8, 2);
115 clk[ipg] = imx_clk_fixed_factor("ipg", "ahb", 1, 2); 64 clk[IMX27_CLK_IPG] = imx_clk_fixed_factor("ipg", "ahb", 1, 2);
116 } else { 65 } else {
117 clk[ahb] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 9, 4); 66 clk[IMX27_CLK_AHB] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 9, 4);
118 clk[ipg] = imx_clk_divider("ipg", "ahb", CCM_CSCR, 8, 1); 67 clk[IMX27_CLK_IPG] = imx_clk_divider("ipg", "ahb", CCM_CSCR, 8, 1);
119 } 68 }
120 69
121 clk[mshc_div] = imx_clk_divider("mshc_div", "ahb", CCM_PCDR0, 0, 6); 70 clk[IMX27_CLK_MSHC_DIV] = imx_clk_divider("mshc_div", "ahb", CCM_PCDR0, 0, 6);
122 clk[nfc_div] = imx_clk_divider("nfc_div", "ahb", CCM_PCDR0, 6, 4); 71 clk[IMX27_CLK_NFC_DIV] = imx_clk_divider("nfc_div", "ahb", CCM_PCDR0, 6, 4);
123 clk[per1_div] = imx_clk_divider("per1_div", "mpll_main2", CCM_PCDR1, 0, 6); 72 clk[IMX27_CLK_PER1_DIV] = imx_clk_divider("per1_div", "mpll_main2", CCM_PCDR1, 0, 6);
124 clk[per2_div] = imx_clk_divider("per2_div", "mpll_main2", CCM_PCDR1, 8, 6); 73 clk[IMX27_CLK_PER2_DIV] = imx_clk_divider("per2_div", "mpll_main2", CCM_PCDR1, 8, 6);
125 clk[per3_div] = imx_clk_divider("per3_div", "mpll_main2", CCM_PCDR1, 16, 6); 74 clk[IMX27_CLK_PER3_DIV] = imx_clk_divider("per3_div", "mpll_main2", CCM_PCDR1, 16, 6);
126 clk[per4_div] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6); 75 clk[IMX27_CLK_PER4_DIV] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6);
127 clk[vpu_sel] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks)); 76 clk[IMX27_CLK_VPU_SEL] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks));
128 clk[vpu_div] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 6); 77 clk[IMX27_CLK_VPU_DIV] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 6);
129 clk[usb_div] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 28, 3); 78 clk[IMX27_CLK_USB_DIV] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 28, 3);
130 clk[cpu_sel] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks)); 79 clk[IMX27_CLK_CPU_SEL] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks));
131 clk[clko_sel] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks)); 80 clk[IMX27_CLK_CLKO_SEL] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks));
81
132 if (mx27_revision() >= IMX_CHIP_REVISION_2_0) 82 if (mx27_revision() >= IMX_CHIP_REVISION_2_0)
133 clk[cpu_div] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 12, 2); 83 clk[IMX27_CLK_CPU_DIV] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 12, 2);
134 else 84 else
135 clk[cpu_div] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 13, 3); 85 clk[IMX27_CLK_CPU_DIV] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 13, 3);
136 clk[clko_div] = imx_clk_divider("clko_div", "clko_sel", CCM_PCDR0, 22, 3);
137 clk[ssi1_sel] = imx_clk_mux("ssi1_sel", CCM_CSCR, 22, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
138 clk[ssi2_sel] = imx_clk_mux("ssi2_sel", CCM_CSCR, 23, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
139 clk[ssi1_div] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6);
140 clk[ssi2_div] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6);
141 clk[clko_en] = imx_clk_gate("clko_en", "clko_div", CCM_PCCR0, 0);
142 clk[ssi2_ipg_gate] = imx_clk_gate("ssi2_ipg_gate", "ipg", CCM_PCCR0, 0);
143 clk[ssi1_ipg_gate] = imx_clk_gate("ssi1_ipg_gate", "ipg", CCM_PCCR0, 1);
144 clk[slcdc_ipg_gate] = imx_clk_gate("slcdc_ipg_gate", "ipg", CCM_PCCR0, 2);
145 clk[sdhc3_ipg_gate] = imx_clk_gate("sdhc3_ipg_gate", "ipg", CCM_PCCR0, 3);
146 clk[sdhc2_ipg_gate] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 4);
147 clk[sdhc1_ipg_gate] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 5);
148 clk[scc_ipg_gate] = imx_clk_gate("scc_ipg_gate", "ipg", CCM_PCCR0, 6);
149 clk[sahara_ipg_gate] = imx_clk_gate("sahara_ipg_gate", "ipg", CCM_PCCR0, 7);
150 clk[rtic_ipg_gate] = imx_clk_gate("rtic_ipg_gate", "ipg", CCM_PCCR0, 8);
151 clk[rtc_ipg_gate] = imx_clk_gate("rtc_ipg_gate", "ipg", CCM_PCCR0, 9);
152 clk[pwm_ipg_gate] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR0, 11);
153 clk[owire_ipg_gate] = imx_clk_gate("owire_ipg_gate", "ipg", CCM_PCCR0, 12);
154 clk[mshc_ipg_gate] = imx_clk_gate("mshc_ipg_gate", "ipg", CCM_PCCR0, 13);
155 clk[lcdc_ipg_gate] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 14);
156 clk[kpp_ipg_gate] = imx_clk_gate("kpp_ipg_gate", "ipg", CCM_PCCR0, 15);
157 clk[iim_ipg_gate] = imx_clk_gate("iim_ipg_gate", "ipg", CCM_PCCR0, 16);
158 clk[i2c2_ipg_gate] = imx_clk_gate("i2c2_ipg_gate", "ipg", CCM_PCCR0, 17);
159 clk[i2c1_ipg_gate] = imx_clk_gate("i2c1_ipg_gate", "ipg", CCM_PCCR0, 18);
160 clk[gpt6_ipg_gate] = imx_clk_gate("gpt6_ipg_gate", "ipg", CCM_PCCR0, 19);
161 clk[gpt5_ipg_gate] = imx_clk_gate("gpt5_ipg_gate", "ipg", CCM_PCCR0, 20);
162 clk[gpt4_ipg_gate] = imx_clk_gate("gpt4_ipg_gate", "ipg", CCM_PCCR0, 21);
163 clk[gpt3_ipg_gate] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR0, 22);
164 clk[gpt2_ipg_gate] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR0, 23);
165 clk[gpt1_ipg_gate] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR0, 24);
166 clk[gpio_ipg_gate] = imx_clk_gate("gpio_ipg_gate", "ipg", CCM_PCCR0, 25);
167 clk[fec_ipg_gate] = imx_clk_gate("fec_ipg_gate", "ipg", CCM_PCCR0, 26);
168 clk[emma_ipg_gate] = imx_clk_gate("emma_ipg_gate", "ipg", CCM_PCCR0, 27);
169 clk[dma_ipg_gate] = imx_clk_gate("dma_ipg_gate", "ipg", CCM_PCCR0, 28);
170 clk[cspi3_ipg_gate] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR0, 29);
171 clk[cspi2_ipg_gate] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 30);
172 clk[cspi1_ipg_gate] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 31);
173 clk[mshc_baud_gate] = imx_clk_gate("mshc_baud_gate", "mshc_div", CCM_PCCR1, 2);
174 clk[nfc_baud_gate] = imx_clk_gate("nfc_baud_gate", "nfc_div", CCM_PCCR1, 3);
175 clk[ssi2_baud_gate] = imx_clk_gate("ssi2_baud_gate", "ssi2_div", CCM_PCCR1, 4);
176 clk[ssi1_baud_gate] = imx_clk_gate("ssi1_baud_gate", "ssi1_div", CCM_PCCR1, 5);
177 clk[vpu_baud_gate] = imx_clk_gate("vpu_baud_gate", "vpu_div", CCM_PCCR1, 6);
178 clk[per4_gate] = imx_clk_gate("per4_gate", "per4_div", CCM_PCCR1, 7);
179 clk[per3_gate] = imx_clk_gate("per3_gate", "per3_div", CCM_PCCR1, 8);
180 clk[per2_gate] = imx_clk_gate("per2_gate", "per2_div", CCM_PCCR1, 9);
181 clk[per1_gate] = imx_clk_gate("per1_gate", "per1_div", CCM_PCCR1, 10);
182 clk[usb_ahb_gate] = imx_clk_gate("usb_ahb_gate", "ahb", CCM_PCCR1, 11);
183 clk[slcdc_ahb_gate] = imx_clk_gate("slcdc_ahb_gate", "ahb", CCM_PCCR1, 12);
184 clk[sahara_ahb_gate] = imx_clk_gate("sahara_ahb_gate", "ahb", CCM_PCCR1, 13);
185 clk[rtic_ahb_gate] = imx_clk_gate("rtic_ahb_gate", "ahb", CCM_PCCR1, 14);
186 clk[lcdc_ahb_gate] = imx_clk_gate("lcdc_ahb_gate", "ahb", CCM_PCCR1, 15);
187 clk[vpu_ahb_gate] = imx_clk_gate("vpu_ahb_gate", "ahb", CCM_PCCR1, 16);
188 clk[fec_ahb_gate] = imx_clk_gate("fec_ahb_gate", "ahb", CCM_PCCR1, 17);
189 clk[emma_ahb_gate] = imx_clk_gate("emma_ahb_gate", "ahb", CCM_PCCR1, 18);
190 clk[emi_ahb_gate] = imx_clk_gate("emi_ahb_gate", "ahb", CCM_PCCR1, 19);
191 clk[dma_ahb_gate] = imx_clk_gate("dma_ahb_gate", "ahb", CCM_PCCR1, 20);
192 clk[csi_ahb_gate] = imx_clk_gate("csi_ahb_gate", "ahb", CCM_PCCR1, 21);
193 clk[brom_ahb_gate] = imx_clk_gate("brom_ahb_gate", "ahb", CCM_PCCR1, 22);
194 clk[ata_ahb_gate] = imx_clk_gate("ata_ahb_gate", "ahb", CCM_PCCR1, 23);
195 clk[wdog_ipg_gate] = imx_clk_gate("wdog_ipg_gate", "ipg", CCM_PCCR1, 24);
196 clk[usb_ipg_gate] = imx_clk_gate("usb_ipg_gate", "ipg", CCM_PCCR1, 25);
197 clk[uart6_ipg_gate] = imx_clk_gate("uart6_ipg_gate", "ipg", CCM_PCCR1, 26);
198 clk[uart5_ipg_gate] = imx_clk_gate("uart5_ipg_gate", "ipg", CCM_PCCR1, 27);
199 clk[uart4_ipg_gate] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR1, 28);
200 clk[uart3_ipg_gate] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR1, 29);
201 clk[uart2_ipg_gate] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30);
202 clk[uart1_ipg_gate] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31);
203 86
204 for (i = 0; i < ARRAY_SIZE(clk); i++) 87 clk[IMX27_CLK_CLKO_DIV] = imx_clk_divider("clko_div", "clko_sel", CCM_PCDR0, 22, 3);
205 if (IS_ERR(clk[i])) 88 clk[IMX27_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", CCM_CSCR, 22, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
206 pr_err("i.MX27 clk %d: register failed with %ld\n", 89 clk[IMX27_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", CCM_CSCR, 23, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
207 i, PTR_ERR(clk[i])); 90 clk[IMX27_CLK_SSI1_DIV] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6);
91 clk[IMX27_CLK_SSI2_DIV] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6);
92 clk[IMX27_CLK_CLKO_EN] = imx_clk_gate("clko_en", "clko_div", CCM_PCCR0, 0);
93 clk[IMX27_CLK_SSI2_IPG_GATE] = imx_clk_gate("ssi2_ipg_gate", "ipg", CCM_PCCR0, 0);
94 clk[IMX27_CLK_SSI1_IPG_GATE] = imx_clk_gate("ssi1_ipg_gate", "ipg", CCM_PCCR0, 1);
95 clk[IMX27_CLK_SLCDC_IPG_GATE] = imx_clk_gate("slcdc_ipg_gate", "ipg", CCM_PCCR0, 2);
96 clk[IMX27_CLK_SDHC3_IPG_GATE] = imx_clk_gate("sdhc3_ipg_gate", "ipg", CCM_PCCR0, 3);
97 clk[IMX27_CLK_SDHC2_IPG_GATE] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 4);
98 clk[IMX27_CLK_SDHC1_IPG_GATE] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 5);
99 clk[IMX27_CLK_SCC_IPG_GATE] = imx_clk_gate("scc_ipg_gate", "ipg", CCM_PCCR0, 6);
100 clk[IMX27_CLK_SAHARA_IPG_GATE] = imx_clk_gate("sahara_ipg_gate", "ipg", CCM_PCCR0, 7);
101 clk[IMX27_CLK_RTIC_IPG_GATE] = imx_clk_gate("rtic_ipg_gate", "ipg", CCM_PCCR0, 8);
102 clk[IMX27_CLK_RTC_IPG_GATE] = imx_clk_gate("rtc_ipg_gate", "ipg", CCM_PCCR0, 9);
103 clk[IMX27_CLK_PWM_IPG_GATE] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR0, 11);
104 clk[IMX27_CLK_OWIRE_IPG_GATE] = imx_clk_gate("owire_ipg_gate", "ipg", CCM_PCCR0, 12);
105 clk[IMX27_CLK_MSHC_IPG_GATE] = imx_clk_gate("mshc_ipg_gate", "ipg", CCM_PCCR0, 13);
106 clk[IMX27_CLK_LCDC_IPG_GATE] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 14);
107 clk[IMX27_CLK_KPP_IPG_GATE] = imx_clk_gate("kpp_ipg_gate", "ipg", CCM_PCCR0, 15);
108 clk[IMX27_CLK_IIM_IPG_GATE] = imx_clk_gate("iim_ipg_gate", "ipg", CCM_PCCR0, 16);
109 clk[IMX27_CLK_I2C2_IPG_GATE] = imx_clk_gate("i2c2_ipg_gate", "ipg", CCM_PCCR0, 17);
110 clk[IMX27_CLK_I2C1_IPG_GATE] = imx_clk_gate("i2c1_ipg_gate", "ipg", CCM_PCCR0, 18);
111 clk[IMX27_CLK_GPT6_IPG_GATE] = imx_clk_gate("gpt6_ipg_gate", "ipg", CCM_PCCR0, 19);
112 clk[IMX27_CLK_GPT5_IPG_GATE] = imx_clk_gate("gpt5_ipg_gate", "ipg", CCM_PCCR0, 20);
113 clk[IMX27_CLK_GPT4_IPG_GATE] = imx_clk_gate("gpt4_ipg_gate", "ipg", CCM_PCCR0, 21);
114 clk[IMX27_CLK_GPT3_IPG_GATE] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR0, 22);
115 clk[IMX27_CLK_GPT2_IPG_GATE] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR0, 23);
116 clk[IMX27_CLK_GPT1_IPG_GATE] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR0, 24);
117 clk[IMX27_CLK_GPIO_IPG_GATE] = imx_clk_gate("gpio_ipg_gate", "ipg", CCM_PCCR0, 25);
118 clk[IMX27_CLK_FEC_IPG_GATE] = imx_clk_gate("fec_ipg_gate", "ipg", CCM_PCCR0, 26);
119 clk[IMX27_CLK_EMMA_IPG_GATE] = imx_clk_gate("emma_ipg_gate", "ipg", CCM_PCCR0, 27);
120 clk[IMX27_CLK_DMA_IPG_GATE] = imx_clk_gate("dma_ipg_gate", "ipg", CCM_PCCR0, 28);
121 clk[IMX27_CLK_CSPI3_IPG_GATE] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR0, 29);
122 clk[IMX27_CLK_CSPI2_IPG_GATE] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 30);
123 clk[IMX27_CLK_CSPI1_IPG_GATE] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 31);
124 clk[IMX27_CLK_MSHC_BAUD_GATE] = imx_clk_gate("mshc_baud_gate", "mshc_div", CCM_PCCR1, 2);
125 clk[IMX27_CLK_NFC_BAUD_GATE] = imx_clk_gate("nfc_baud_gate", "nfc_div", CCM_PCCR1, 3);
126 clk[IMX27_CLK_SSI2_BAUD_GATE] = imx_clk_gate("ssi2_baud_gate", "ssi2_div", CCM_PCCR1, 4);
127 clk[IMX27_CLK_SSI1_BAUD_GATE] = imx_clk_gate("ssi1_baud_gate", "ssi1_div", CCM_PCCR1, 5);
128 clk[IMX27_CLK_VPU_BAUD_GATE] = imx_clk_gate("vpu_baud_gate", "vpu_div", CCM_PCCR1, 6);
129 clk[IMX27_CLK_PER4_GATE] = imx_clk_gate("per4_gate", "per4_div", CCM_PCCR1, 7);
130 clk[IMX27_CLK_PER3_GATE] = imx_clk_gate("per3_gate", "per3_div", CCM_PCCR1, 8);
131 clk[IMX27_CLK_PER2_GATE] = imx_clk_gate("per2_gate", "per2_div", CCM_PCCR1, 9);
132 clk[IMX27_CLK_PER1_GATE] = imx_clk_gate("per1_gate", "per1_div", CCM_PCCR1, 10);
133 clk[IMX27_CLK_USB_AHB_GATE] = imx_clk_gate("usb_ahb_gate", "ahb", CCM_PCCR1, 11);
134 clk[IMX27_CLK_SLCDC_AHB_GATE] = imx_clk_gate("slcdc_ahb_gate", "ahb", CCM_PCCR1, 12);
135 clk[IMX27_CLK_SAHARA_AHB_GATE] = imx_clk_gate("sahara_ahb_gate", "ahb", CCM_PCCR1, 13);
136 clk[IMX27_CLK_RTIC_AHB_GATE] = imx_clk_gate("rtic_ahb_gate", "ahb", CCM_PCCR1, 14);
137 clk[IMX27_CLK_LCDC_AHB_GATE] = imx_clk_gate("lcdc_ahb_gate", "ahb", CCM_PCCR1, 15);
138 clk[IMX27_CLK_VPU_AHB_GATE] = imx_clk_gate("vpu_ahb_gate", "ahb", CCM_PCCR1, 16);
139 clk[IMX27_CLK_FEC_AHB_GATE] = imx_clk_gate("fec_ahb_gate", "ahb", CCM_PCCR1, 17);
140 clk[IMX27_CLK_EMMA_AHB_GATE] = imx_clk_gate("emma_ahb_gate", "ahb", CCM_PCCR1, 18);
141 clk[IMX27_CLK_EMI_AHB_GATE] = imx_clk_gate("emi_ahb_gate", "ahb", CCM_PCCR1, 19);
142 clk[IMX27_CLK_DMA_AHB_GATE] = imx_clk_gate("dma_ahb_gate", "ahb", CCM_PCCR1, 20);
143 clk[IMX27_CLK_CSI_AHB_GATE] = imx_clk_gate("csi_ahb_gate", "ahb", CCM_PCCR1, 21);
144 clk[IMX27_CLK_BROM_AHB_GATE] = imx_clk_gate("brom_ahb_gate", "ahb", CCM_PCCR1, 22);
145 clk[IMX27_CLK_ATA_AHB_GATE] = imx_clk_gate("ata_ahb_gate", "ahb", CCM_PCCR1, 23);
146 clk[IMX27_CLK_WDOG_IPG_GATE] = imx_clk_gate("wdog_ipg_gate", "ipg", CCM_PCCR1, 24);
147 clk[IMX27_CLK_USB_IPG_GATE] = imx_clk_gate("usb_ipg_gate", "ipg", CCM_PCCR1, 25);
148 clk[IMX27_CLK_UART6_IPG_GATE] = imx_clk_gate("uart6_ipg_gate", "ipg", CCM_PCCR1, 26);
149 clk[IMX27_CLK_UART5_IPG_GATE] = imx_clk_gate("uart5_ipg_gate", "ipg", CCM_PCCR1, 27);
150 clk[IMX27_CLK_UART4_IPG_GATE] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR1, 28);
151 clk[IMX27_CLK_UART3_IPG_GATE] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR1, 29);
152 clk[IMX27_CLK_UART2_IPG_GATE] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30);
153 clk[IMX27_CLK_UART1_IPG_GATE] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31);
208 154
209 np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); 155 imx_check_clocks(clk, ARRAY_SIZE(clk));
210 if (np) {
211 clk_data.clks = clk;
212 clk_data.clk_num = ARRAY_SIZE(clk);
213 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
214 }
215 156
216 clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); 157 clk_register_clkdev(clk[IMX27_CLK_CPU_DIV], NULL, "cpu0");
217 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0");
218 clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1");
219 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.1");
220 clk_register_clkdev(clk[uart3_ipg_gate], "ipg", "imx21-uart.2");
221 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.2");
222 clk_register_clkdev(clk[uart4_ipg_gate], "ipg", "imx21-uart.3");
223 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.3");
224 clk_register_clkdev(clk[uart5_ipg_gate], "ipg", "imx21-uart.4");
225 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.4");
226 clk_register_clkdev(clk[uart6_ipg_gate], "ipg", "imx21-uart.5");
227 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.5");
228 clk_register_clkdev(clk[gpt1_ipg_gate], "ipg", "imx-gpt.0");
229 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.0");
230 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
231 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
232 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
233 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.1");
234 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.2");
235 clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.2");
236 clk_register_clkdev(clk[per2_gate], "per", "imx27-cspi.0");
237 clk_register_clkdev(clk[cspi1_ipg_gate], "ipg", "imx27-cspi.0");
238 clk_register_clkdev(clk[per2_gate], "per", "imx27-cspi.1");
239 clk_register_clkdev(clk[cspi2_ipg_gate], "ipg", "imx27-cspi.1");
240 clk_register_clkdev(clk[per2_gate], "per", "imx27-cspi.2");
241 clk_register_clkdev(clk[cspi3_ipg_gate], "ipg", "imx27-cspi.2");
242 clk_register_clkdev(clk[per3_gate], "per", "imx21-fb.0");
243 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx21-fb.0");
244 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0");
245 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
246 clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0");
247 clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
248 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "imx-udc-mx27");
249 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "imx-udc-mx27");
250 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
251 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.0");
252 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.0");
253 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.1");
254 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.1");
255 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.1");
256 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
257 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.2");
258 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.2");
259 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
260 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
261 clk_register_clkdev(clk[nfc_baud_gate], NULL, "imx27-nand.0");
262 clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0");
263 clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0");
264 clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx27-dma");
265 clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx27-dma");
266 clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0");
267 clk_register_clkdev(clk[fec_ahb_gate], "ahb", "imx27-fec.0");
268 clk_register_clkdev(clk[wdog_ipg_gate], NULL, "imx2-wdt.0");
269 clk_register_clkdev(clk[i2c1_ipg_gate], NULL, "imx21-i2c.0");
270 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx21-i2c.1");
271 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0");
272 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad");
273 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "imx27-camera.0");
274 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "imx27-camera.0");
275 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
276 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
277 clk_register_clkdev(clk[cpu_div], NULL, "cpu0");
278 158
279 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1); 159 clk_prepare_enable(clk[IMX27_CLK_EMI_AHB_GATE]);
280
281 clk_prepare_enable(clk[emi_ahb_gate]);
282 160
283 imx_print_silicon_rev("i.MX27", mx27_revision()); 161 imx_print_silicon_rev("i.MX27", mx27_revision());
162}
163
164int __init mx27_clocks_init(unsigned long fref)
165{
166 ccm = ioremap(MX27_CCM_BASE_ADDR, SZ_4K);
167
168 _mx27_clocks_init(fref);
169
170 clk_register_clkdev(clk[IMX27_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
171 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.0");
172 clk_register_clkdev(clk[IMX27_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
173 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.1");
174 clk_register_clkdev(clk[IMX27_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
175 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.2");
176 clk_register_clkdev(clk[IMX27_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
177 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.3");
178 clk_register_clkdev(clk[IMX27_CLK_UART5_IPG_GATE], "ipg", "imx21-uart.4");
179 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.4");
180 clk_register_clkdev(clk[IMX27_CLK_UART6_IPG_GATE], "ipg", "imx21-uart.5");
181 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx21-uart.5");
182 clk_register_clkdev(clk[IMX27_CLK_GPT1_IPG_GATE], "ipg", "imx-gpt.0");
183 clk_register_clkdev(clk[IMX27_CLK_PER1_GATE], "per", "imx-gpt.0");
184 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.0");
185 clk_register_clkdev(clk[IMX27_CLK_SDHC1_IPG_GATE], "ipg", "imx21-mmc.0");
186 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.1");
187 clk_register_clkdev(clk[IMX27_CLK_SDHC2_IPG_GATE], "ipg", "imx21-mmc.1");
188 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx21-mmc.2");
189 clk_register_clkdev(clk[IMX27_CLK_SDHC2_IPG_GATE], "ipg", "imx21-mmc.2");
190 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.0");
191 clk_register_clkdev(clk[IMX27_CLK_CSPI1_IPG_GATE], "ipg", "imx27-cspi.0");
192 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.1");
193 clk_register_clkdev(clk[IMX27_CLK_CSPI2_IPG_GATE], "ipg", "imx27-cspi.1");
194 clk_register_clkdev(clk[IMX27_CLK_PER2_GATE], "per", "imx27-cspi.2");
195 clk_register_clkdev(clk[IMX27_CLK_CSPI3_IPG_GATE], "ipg", "imx27-cspi.2");
196 clk_register_clkdev(clk[IMX27_CLK_PER3_GATE], "per", "imx21-fb.0");
197 clk_register_clkdev(clk[IMX27_CLK_LCDC_IPG_GATE], "ipg", "imx21-fb.0");
198 clk_register_clkdev(clk[IMX27_CLK_LCDC_AHB_GATE], "ahb", "imx21-fb.0");
199 clk_register_clkdev(clk[IMX27_CLK_CSI_AHB_GATE], "ahb", "imx27-camera.0");
200 clk_register_clkdev(clk[IMX27_CLK_PER4_GATE], "per", "imx27-camera.0");
201 clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "imx-udc-mx27");
202 clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "imx-udc-mx27");
203 clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "imx-udc-mx27");
204 clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.0");
205 clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.0");
206 clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.0");
207 clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.1");
208 clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.1");
209 clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.1");
210 clk_register_clkdev(clk[IMX27_CLK_USB_DIV], "per", "mxc-ehci.2");
211 clk_register_clkdev(clk[IMX27_CLK_USB_IPG_GATE], "ipg", "mxc-ehci.2");
212 clk_register_clkdev(clk[IMX27_CLK_USB_AHB_GATE], "ahb", "mxc-ehci.2");
213 clk_register_clkdev(clk[IMX27_CLK_SSI1_IPG_GATE], NULL, "imx-ssi.0");
214 clk_register_clkdev(clk[IMX27_CLK_SSI2_IPG_GATE], NULL, "imx-ssi.1");
215 clk_register_clkdev(clk[IMX27_CLK_NFC_BAUD_GATE], NULL, "imx27-nand.0");
216 clk_register_clkdev(clk[IMX27_CLK_VPU_BAUD_GATE], "per", "coda-imx27.0");
217 clk_register_clkdev(clk[IMX27_CLK_VPU_AHB_GATE], "ahb", "coda-imx27.0");
218 clk_register_clkdev(clk[IMX27_CLK_DMA_AHB_GATE], "ahb", "imx27-dma");
219 clk_register_clkdev(clk[IMX27_CLK_DMA_IPG_GATE], "ipg", "imx27-dma");
220 clk_register_clkdev(clk[IMX27_CLK_FEC_IPG_GATE], "ipg", "imx27-fec.0");
221 clk_register_clkdev(clk[IMX27_CLK_FEC_AHB_GATE], "ahb", "imx27-fec.0");
222 clk_register_clkdev(clk[IMX27_CLK_WDOG_IPG_GATE], NULL, "imx2-wdt.0");
223 clk_register_clkdev(clk[IMX27_CLK_I2C1_IPG_GATE], NULL, "imx21-i2c.0");
224 clk_register_clkdev(clk[IMX27_CLK_I2C2_IPG_GATE], NULL, "imx21-i2c.1");
225 clk_register_clkdev(clk[IMX27_CLK_OWIRE_IPG_GATE], NULL, "mxc_w1.0");
226 clk_register_clkdev(clk[IMX27_CLK_KPP_IPG_GATE], NULL, "imx-keypad");
227 clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "emma-ahb", "imx27-camera.0");
228 clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "emma-ipg", "imx27-camera.0");
229 clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "ahb", "m2m-emmaprp.0");
230 clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "ipg", "m2m-emmaprp.0");
231
232 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
284 233
285 return 0; 234 return 0;
286} 235}
287 236
288int __init mx27_clocks_init_dt(void) 237static void __init mx27_clocks_init_dt(struct device_node *np)
289{ 238{
290 struct device_node *np; 239 struct device_node *refnp;
291 u32 fref = 26000000; /* default */ 240 u32 fref = 26000000; /* default */
292 241
293 for_each_compatible_node(np, NULL, "fixed-clock") { 242 for_each_compatible_node(refnp, NULL, "fixed-clock") {
294 if (!of_device_is_compatible(np, "fsl,imx-osc26m")) 243 if (!of_device_is_compatible(refnp, "fsl,imx-osc26m"))
295 continue; 244 continue;
296 245
297 if (!of_property_read_u32(np, "clock-frequency", &fref)) 246 if (!of_property_read_u32(refnp, "clock-frequency", &fref))
298 break; 247 break;
299 } 248 }
300 249
301 return mx27_clocks_init(fref); 250 ccm = of_iomap(np, 0);
251
252 _mx27_clocks_init(fref);
253
254 clk_data.clks = clk;
255 clk_data.clk_num = ARRAY_SIZE(clk);
256 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
302} 257}
258CLK_OF_DECLARE(imx27_ccm, "fsl,imx27-ccm", mx27_clocks_init_dt);
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 4a9de0835eb1..286ef422cebc 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -51,7 +51,6 @@ static struct clk_onecell_data clk_data;
51int __init mx31_clocks_init(unsigned long fref) 51int __init mx31_clocks_init(unsigned long fref)
52{ 52{
53 void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR); 53 void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
54 int i;
55 struct device_node *np; 54 struct device_node *np;
56 55
57 clk[dummy] = imx_clk_fixed("dummy", 0); 56 clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -114,10 +113,7 @@ int __init mx31_clocks_init(unsigned long fref)
114 clk[rtic_gate] = imx_clk_gate2("rtic_gate", "ahb", base + MXC_CCM_CGR2, 10); 113 clk[rtic_gate] = imx_clk_gate2("rtic_gate", "ahb", base + MXC_CCM_CGR2, 10);
115 clk[firi_gate] = imx_clk_gate2("firi_gate", "upll", base+MXC_CCM_CGR2, 12); 114 clk[firi_gate] = imx_clk_gate2("firi_gate", "upll", base+MXC_CCM_CGR2, 12);
116 115
117 for (i = 0; i < ARRAY_SIZE(clk); i++) 116 imx_check_clocks(clk, ARRAY_SIZE(clk));
118 if (IS_ERR(clk[i]))
119 pr_err("imx31 clk %d: register failed with %ld\n",
120 i, PTR_ERR(clk[i]));
121 117
122 np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm"); 118 np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm");
123 119
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 71c86a2f856d..a0d2b57fd376 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -75,7 +75,6 @@ int __init mx35_clocks_init(void)
75 u32 pdr0, consumer_sel, hsp_sel; 75 u32 pdr0, consumer_sel, hsp_sel;
76 struct arm_ahb_div *aad; 76 struct arm_ahb_div *aad;
77 unsigned char *hsp_div; 77 unsigned char *hsp_div;
78 u32 i;
79 78
80 pdr0 = __raw_readl(base + MXC_CCM_PDR0); 79 pdr0 = __raw_readl(base + MXC_CCM_PDR0);
81 consumer_sel = (pdr0 >> 16) & 0xf; 80 consumer_sel = (pdr0 >> 16) & 0xf;
@@ -200,10 +199,7 @@ int __init mx35_clocks_init(void)
200 clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", base + MX35_CCM_CGR3, 2); 199 clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", base + MX35_CCM_CGR3, 2);
201 clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "ahb", base + MX35_CCM_CGR3, 4); 200 clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "ahb", base + MX35_CCM_CGR3, 4);
202 201
203 for (i = 0; i < ARRAY_SIZE(clk); i++) 202 imx_check_clocks(clk, ARRAY_SIZE(clk));
204 if (IS_ERR(clk[i]))
205 pr_err("i.MX35 clk %d: register failed with %ld\n",
206 i, PTR_ERR(clk[i]));
207 203
208 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx"); 204 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx");
209 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0"); 205 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0");
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 21d2b111c83d..72d65214223e 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -18,11 +18,54 @@
18#include <linux/of_irq.h> 18#include <linux/of_irq.h>
19#include <dt-bindings/clock/imx5-clock.h> 19#include <dt-bindings/clock/imx5-clock.h>
20 20
21#include "crm-regs-imx5.h"
22#include "clk.h" 21#include "clk.h"
23#include "common.h" 22#include "common.h"
24#include "hardware.h" 23#include "hardware.h"
25 24
25#define MX51_DPLL1_BASE 0x83f80000
26#define MX51_DPLL2_BASE 0x83f84000
27#define MX51_DPLL3_BASE 0x83f88000
28
29#define MX53_DPLL1_BASE 0x63f80000
30#define MX53_DPLL2_BASE 0x63f84000
31#define MX53_DPLL3_BASE 0x63f88000
32#define MX53_DPLL4_BASE 0x63f8c000
33
34#define MXC_CCM_CCR (ccm_base + 0x00)
35#define MXC_CCM_CCDR (ccm_base + 0x04)
36#define MXC_CCM_CSR (ccm_base + 0x08)
37#define MXC_CCM_CCSR (ccm_base + 0x0c)
38#define MXC_CCM_CACRR (ccm_base + 0x10)
39#define MXC_CCM_CBCDR (ccm_base + 0x14)
40#define MXC_CCM_CBCMR (ccm_base + 0x18)
41#define MXC_CCM_CSCMR1 (ccm_base + 0x1c)
42#define MXC_CCM_CSCMR2 (ccm_base + 0x20)
43#define MXC_CCM_CSCDR1 (ccm_base + 0x24)
44#define MXC_CCM_CS1CDR (ccm_base + 0x28)
45#define MXC_CCM_CS2CDR (ccm_base + 0x2c)
46#define MXC_CCM_CDCDR (ccm_base + 0x30)
47#define MXC_CCM_CHSCDR (ccm_base + 0x34)
48#define MXC_CCM_CSCDR2 (ccm_base + 0x38)
49#define MXC_CCM_CSCDR3 (ccm_base + 0x3c)
50#define MXC_CCM_CSCDR4 (ccm_base + 0x40)
51#define MXC_CCM_CWDR (ccm_base + 0x44)
52#define MXC_CCM_CDHIPR (ccm_base + 0x48)
53#define MXC_CCM_CDCR (ccm_base + 0x4c)
54#define MXC_CCM_CTOR (ccm_base + 0x50)
55#define MXC_CCM_CLPCR (ccm_base + 0x54)
56#define MXC_CCM_CISR (ccm_base + 0x58)
57#define MXC_CCM_CIMR (ccm_base + 0x5c)
58#define MXC_CCM_CCOSR (ccm_base + 0x60)
59#define MXC_CCM_CGPR (ccm_base + 0x64)
60#define MXC_CCM_CCGR0 (ccm_base + 0x68)
61#define MXC_CCM_CCGR1 (ccm_base + 0x6c)
62#define MXC_CCM_CCGR2 (ccm_base + 0x70)
63#define MXC_CCM_CCGR3 (ccm_base + 0x74)
64#define MXC_CCM_CCGR4 (ccm_base + 0x78)
65#define MXC_CCM_CCGR5 (ccm_base + 0x7c)
66#define MXC_CCM_CCGR6 (ccm_base + 0x80)
67#define MXC_CCM_CCGR7 (ccm_base + 0x84)
68
26/* Low-power Audio Playback Mode clock */ 69/* Low-power Audio Playback Mode clock */
27static const char *lp_apm_sel[] = { "osc", }; 70static const char *lp_apm_sel[] = { "osc", };
28 71
@@ -86,17 +129,15 @@ static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", };
86static struct clk *clk[IMX5_CLK_END]; 129static struct clk *clk[IMX5_CLK_END];
87static struct clk_onecell_data clk_data; 130static struct clk_onecell_data clk_data;
88 131
89static void __init mx5_clocks_common_init(unsigned long rate_ckil, 132static void __init mx5_clocks_common_init(void __iomem *ccm_base)
90 unsigned long rate_osc, unsigned long rate_ckih1,
91 unsigned long rate_ckih2)
92{ 133{
93 int i; 134 imx5_pm_set_ccm_base(ccm_base);
94 135
95 clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 136 clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
96 clk[IMX5_CLK_CKIL] = imx_obtain_fixed_clock("ckil", rate_ckil); 137 clk[IMX5_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
97 clk[IMX5_CLK_OSC] = imx_obtain_fixed_clock("osc", rate_osc); 138 clk[IMX5_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
98 clk[IMX5_CLK_CKIH1] = imx_obtain_fixed_clock("ckih1", rate_ckih1); 139 clk[IMX5_CLK_CKIH1] = imx_obtain_fixed_clock("ckih1", 0);
99 clk[IMX5_CLK_CKIH2] = imx_obtain_fixed_clock("ckih2", rate_ckih2); 140 clk[IMX5_CLK_CKIH2] = imx_obtain_fixed_clock("ckih2", 0);
100 141
101 clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2, 142 clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
102 periph_apm_sel, ARRAY_SIZE(periph_apm_sel)); 143 periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
@@ -244,58 +285,8 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
244 clk[IMX5_CLK_SAHARA_IPG_GATE] = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14); 285 clk[IMX5_CLK_SAHARA_IPG_GATE] = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14);
245 clk[IMX5_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1); 286 clk[IMX5_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1);
246 287
247 for (i = 0; i < ARRAY_SIZE(clk); i++)
248 if (IS_ERR(clk[i]))
249 pr_err("i.MX5 clk %d: register failed with %ld\n",
250 i, PTR_ERR(clk[i]));
251
252 clk_register_clkdev(clk[IMX5_CLK_GPT_HF_GATE], "per", "imx-gpt.0");
253 clk_register_clkdev(clk[IMX5_CLK_GPT_IPG_GATE], "ipg", "imx-gpt.0");
254 clk_register_clkdev(clk[IMX5_CLK_UART1_PER_GATE], "per", "imx21-uart.0");
255 clk_register_clkdev(clk[IMX5_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
256 clk_register_clkdev(clk[IMX5_CLK_UART2_PER_GATE], "per", "imx21-uart.1");
257 clk_register_clkdev(clk[IMX5_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
258 clk_register_clkdev(clk[IMX5_CLK_UART3_PER_GATE], "per", "imx21-uart.2");
259 clk_register_clkdev(clk[IMX5_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
260 clk_register_clkdev(clk[IMX5_CLK_UART4_PER_GATE], "per", "imx21-uart.3");
261 clk_register_clkdev(clk[IMX5_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
262 clk_register_clkdev(clk[IMX5_CLK_UART5_PER_GATE], "per", "imx21-uart.4");
263 clk_register_clkdev(clk[IMX5_CLK_UART5_IPG_GATE], "ipg", "imx21-uart.4");
264 clk_register_clkdev(clk[IMX5_CLK_ECSPI1_PER_GATE], "per", "imx51-ecspi.0");
265 clk_register_clkdev(clk[IMX5_CLK_ECSPI1_IPG_GATE], "ipg", "imx51-ecspi.0");
266 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_PER_GATE], "per", "imx51-ecspi.1");
267 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_IPG_GATE], "ipg", "imx51-ecspi.1");
268 clk_register_clkdev(clk[IMX5_CLK_CSPI_IPG_GATE], NULL, "imx35-cspi.2");
269 clk_register_clkdev(clk[IMX5_CLK_I2C1_GATE], NULL, "imx21-i2c.0");
270 clk_register_clkdev(clk[IMX5_CLK_I2C2_GATE], NULL, "imx21-i2c.1");
271 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.0");
272 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.0");
273 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.0");
274 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.1");
275 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.1");
276 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.1");
277 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.2");
278 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.2");
279 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.2");
280 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "imx-udc-mx51");
281 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "imx-udc-mx51");
282 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "imx-udc-mx51");
283 clk_register_clkdev(clk[IMX5_CLK_NFC_GATE], NULL, "imx51-nand");
284 clk_register_clkdev(clk[IMX5_CLK_SSI1_IPG_GATE], NULL, "imx-ssi.0");
285 clk_register_clkdev(clk[IMX5_CLK_SSI2_IPG_GATE], NULL, "imx-ssi.1");
286 clk_register_clkdev(clk[IMX5_CLK_SSI3_IPG_GATE], NULL, "imx-ssi.2");
287 clk_register_clkdev(clk[IMX5_CLK_SDMA_GATE], NULL, "imx35-sdma");
288 clk_register_clkdev(clk[IMX5_CLK_CPU_PODF], NULL, "cpu0"); 288 clk_register_clkdev(clk[IMX5_CLK_CPU_PODF], NULL, "cpu0");
289 clk_register_clkdev(clk[IMX5_CLK_IIM_GATE], "iim", NULL);
290 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.0");
291 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.1");
292 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx-keypad");
293 clk_register_clkdev(clk[IMX5_CLK_IPU_DI1_GATE], "di1", "imx-tve.0");
294 clk_register_clkdev(clk[IMX5_CLK_GPC_DVFS], "gpc_dvfs", NULL); 289 clk_register_clkdev(clk[IMX5_CLK_GPC_DVFS], "gpc_dvfs", NULL);
295 clk_register_clkdev(clk[IMX5_CLK_EPIT1_IPG_GATE], "ipg", "imx-epit.0");
296 clk_register_clkdev(clk[IMX5_CLK_EPIT1_HF_GATE], "per", "imx-epit.0");
297 clk_register_clkdev(clk[IMX5_CLK_EPIT2_IPG_GATE], "ipg", "imx-epit.1");
298 clk_register_clkdev(clk[IMX5_CLK_EPIT2_HF_GATE], "per", "imx-epit.1");
299 290
300 /* Set SDHC parents to be PLL2 */ 291 /* Set SDHC parents to be PLL2 */
301 clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]); 292 clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
@@ -322,12 +313,26 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
322 313
323static void __init mx50_clocks_init(struct device_node *np) 314static void __init mx50_clocks_init(struct device_node *np)
324{ 315{
316 void __iomem *ccm_base;
317 void __iomem *pll_base;
325 unsigned long r; 318 unsigned long r;
326 int i;
327 319
328 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 320 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K);
329 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 321 WARN_ON(!pll_base);
330 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE); 322 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", pll_base);
323
324 pll_base = ioremap(MX53_DPLL2_BASE, SZ_16K);
325 WARN_ON(!pll_base);
326 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", pll_base);
327
328 pll_base = ioremap(MX53_DPLL3_BASE, SZ_16K);
329 WARN_ON(!pll_base);
330 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", pll_base);
331
332 ccm_base = of_iomap(np, 0);
333 WARN_ON(!ccm_base);
334
335 mx5_clocks_common_init(ccm_base);
331 336
332 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1, 337 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
333 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 338 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
@@ -349,17 +354,12 @@ static void __init mx50_clocks_init(struct device_node *np)
349 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); 354 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
350 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); 355 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
351 356
352 for (i = 0; i < ARRAY_SIZE(clk); i++) 357 imx_check_clocks(clk, ARRAY_SIZE(clk));
353 if (IS_ERR(clk[i]))
354 pr_err("i.MX50 clk %d: register failed with %ld\n",
355 i, PTR_ERR(clk[i]));
356 358
357 clk_data.clks = clk; 359 clk_data.clks = clk;
358 clk_data.clk_num = ARRAY_SIZE(clk); 360 clk_data.clk_num = ARRAY_SIZE(clk);
359 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 361 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
360 362
361 mx5_clocks_common_init(0, 0, 0, 0);
362
363 /* set SDHC root clock to 200MHZ*/ 363 /* set SDHC root clock to 200MHZ*/
364 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000); 364 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
365 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000); 365 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
@@ -370,21 +370,32 @@ static void __init mx50_clocks_init(struct device_node *np)
370 370
371 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000); 371 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
372 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r); 372 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
373
374 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx50-gpt"));
375} 373}
376CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init); 374CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init);
377 375
378int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, 376static void __init mx51_clocks_init(struct device_node *np)
379 unsigned long rate_ckih1, unsigned long rate_ckih2)
380{ 377{
381 int i; 378 void __iomem *ccm_base;
379 void __iomem *pll_base;
382 u32 val; 380 u32 val;
383 struct device_node *np;
384 381
385 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE); 382 pll_base = ioremap(MX51_DPLL1_BASE, SZ_16K);
386 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE); 383 WARN_ON(!pll_base);
387 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX51_DPLL3_BASE); 384 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", pll_base);
385
386 pll_base = ioremap(MX51_DPLL2_BASE, SZ_16K);
387 WARN_ON(!pll_base);
388 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", pll_base);
389
390 pll_base = ioremap(MX51_DPLL3_BASE, SZ_16K);
391 WARN_ON(!pll_base);
392 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", pll_base);
393
394 ccm_base = of_iomap(np, 0);
395 WARN_ON(!ccm_base);
396
397 mx5_clocks_common_init(ccm_base);
398
388 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1, 399 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
389 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 400 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
390 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3, 401 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
@@ -417,35 +428,12 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
417 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel)); 428 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
418 clk[IMX5_CLK_SPDIF1_GATE] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28); 429 clk[IMX5_CLK_SPDIF1_GATE] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
419 430
420 for (i = 0; i < ARRAY_SIZE(clk); i++) 431 imx_check_clocks(clk, ARRAY_SIZE(clk));
421 if (IS_ERR(clk[i]))
422 pr_err("i.MX51 clk %d: register failed with %ld\n",
423 i, PTR_ERR(clk[i]));
424 432
425 np = of_find_compatible_node(NULL, NULL, "fsl,imx51-ccm");
426 clk_data.clks = clk; 433 clk_data.clks = clk;
427 clk_data.clk_num = ARRAY_SIZE(clk); 434 clk_data.clk_num = ARRAY_SIZE(clk);
428 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 435 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
429 436
430 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
431
432 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2");
433 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL);
434 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0");
435 clk_register_clkdev(clk[IMX5_CLK_USB_PHY_GATE], "phy", "mxc-ehci.0");
436 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx51.0");
437 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.0");
438 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx51.0");
439 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx51.1");
440 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.1");
441 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx51.1");
442 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx51.2");
443 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.2");
444 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx51.2");
445 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx51.3");
446 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.3");
447 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx51.3");
448
449 /* set the usboh3 parent to pll2_sw */ 437 /* set the usboh3 parent to pll2_sw */
450 clk_set_parent(clk[IMX5_CLK_USBOH3_SEL], clk[IMX5_CLK_PLL2_SW]); 438 clk_set_parent(clk[IMX5_CLK_USBOH3_SEL], clk[IMX5_CLK_PLL2_SW]);
451 439
@@ -453,9 +441,6 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
453 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 166250000); 441 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 166250000);
454 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 166250000); 442 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 166250000);
455 443
456 /* System timer */
457 mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT);
458
459 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]); 444 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
460 imx_print_silicon_rev("i.MX51", mx51_revision()); 445 imx_print_silicon_rev("i.MX51", mx51_revision());
461 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]); 446 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
@@ -474,25 +459,35 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
474 val = readl(MXC_CCM_CLPCR); 459 val = readl(MXC_CCM_CLPCR);
475 val |= 1 << 23; 460 val |= 1 << 23;
476 writel(val, MXC_CCM_CLPCR); 461 writel(val, MXC_CCM_CLPCR);
477
478 return 0;
479}
480
481static void __init mx51_clocks_init_dt(struct device_node *np)
482{
483 mx51_clocks_init(0, 0, 0, 0);
484} 462}
485CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt); 463CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init);
486 464
487static void __init mx53_clocks_init(struct device_node *np) 465static void __init mx53_clocks_init(struct device_node *np)
488{ 466{
489 int i; 467 void __iomem *ccm_base;
468 void __iomem *pll_base;
490 unsigned long r; 469 unsigned long r;
491 470
492 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 471 pll_base = ioremap(MX53_DPLL1_BASE, SZ_16K);
493 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 472 WARN_ON(!pll_base);
494 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE); 473 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", pll_base);
495 clk[IMX5_CLK_PLL4_SW] = imx_clk_pllv2("pll4_sw", "osc", MX53_DPLL4_BASE); 474
475 pll_base = ioremap(MX53_DPLL2_BASE, SZ_16K);
476 WARN_ON(!pll_base);
477 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", pll_base);
478
479 pll_base = ioremap(MX53_DPLL3_BASE, SZ_16K);
480 WARN_ON(!pll_base);
481 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", pll_base);
482
483 pll_base = ioremap(MX53_DPLL4_BASE, SZ_16K);
484 WARN_ON(!pll_base);
485 clk[IMX5_CLK_PLL4_SW] = imx_clk_pllv2("pll4_sw", "osc", pll_base);
486
487 ccm_base = of_iomap(np, 0);
488 WARN_ON(!ccm_base);
489
490 mx5_clocks_common_init(ccm_base);
496 491
497 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1, 492 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
498 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 493 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
@@ -543,33 +538,12 @@ static void __init mx53_clocks_init(struct device_node *np)
543 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, 538 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
544 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel)); 539 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
545 540
546 for (i = 0; i < ARRAY_SIZE(clk); i++) 541 imx_check_clocks(clk, ARRAY_SIZE(clk));
547 if (IS_ERR(clk[i]))
548 pr_err("i.MX53 clk %d: register failed with %ld\n",
549 i, PTR_ERR(clk[i]));
550 542
551 clk_data.clks = clk; 543 clk_data.clks = clk;
552 clk_data.clk_num = ARRAY_SIZE(clk); 544 clk_data.clk_num = ARRAY_SIZE(clk);
553 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 545 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
554 546
555 mx5_clocks_common_init(0, 0, 0, 0);
556
557 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2");
558 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0");
559 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0");
560 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx53.0");
561 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.0");
562 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx53.0");
563 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx53.1");
564 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.1");
565 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx53.1");
566 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx53.2");
567 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.2");
568 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx53.2");
569 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx53.3");
570 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.3");
571 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx53.3");
572
573 /* set SDHC root clock to 200MHZ*/ 547 /* set SDHC root clock to 200MHZ*/
574 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000); 548 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
575 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000); 549 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
@@ -583,7 +557,5 @@ static void __init mx53_clocks_init(struct device_node *np)
583 557
584 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000); 558 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
585 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r); 559 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
586
587 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt"));
588} 560}
589CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init); 561CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 8556c787e59c..6cceb7765c14 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -19,6 +19,7 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_address.h> 20#include <linux/of_address.h>
21#include <linux/of_irq.h> 21#include <linux/of_irq.h>
22#include <dt-bindings/clock/imx6qdl-clock.h>
22 23
23#include "clk.h" 24#include "clk.h"
24#include "common.h" 25#include "common.h"
@@ -73,48 +74,13 @@ static const char *lvds_sels[] = {
73 "pcie_ref_125m", "sata_ref_100m", 74 "pcie_ref_125m", "sata_ref_100m",
74}; 75};
75 76
76enum mx6q_clks { 77static struct clk *clk[IMX6QDL_CLK_END];
77 dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m,
78 pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m,
79 pll2_198m, pll3_120m, pll3_80m, pll3_60m, twd, step, pll1_sw,
80 periph_pre, periph2_pre, periph_clk2_sel, periph2_clk2_sel, axi_sel,
81 esai_sel, asrc_sel, spdif_sel, gpu2d_axi, gpu3d_axi, gpu2d_core_sel,
82 gpu3d_core_sel, gpu3d_shader_sel, ipu1_sel, ipu2_sel, ldb_di0_sel,
83 ldb_di1_sel, ipu1_di0_pre_sel, ipu1_di1_pre_sel, ipu2_di0_pre_sel,
84 ipu2_di1_pre_sel, ipu1_di0_sel, ipu1_di1_sel, ipu2_di0_sel,
85 ipu2_di1_sel, hsi_tx_sel, pcie_axi_sel, ssi1_sel, ssi2_sel, ssi3_sel,
86 usdhc1_sel, usdhc2_sel, usdhc3_sel, usdhc4_sel, enfc_sel, emi_sel,
87 emi_slow_sel, vdo_axi_sel, vpu_axi_sel, cko1_sel, periph, periph2,
88 periph_clk2, periph2_clk2, ipg, ipg_per, esai_pred, esai_podf,
89 asrc_pred, asrc_podf, spdif_pred, spdif_podf, can_root, ecspi_root,
90 gpu2d_core_podf, gpu3d_core_podf, gpu3d_shader, ipu1_podf, ipu2_podf,
91 ldb_di0_podf, ldb_di1_podf, ipu1_di0_pre, ipu1_di1_pre, ipu2_di0_pre,
92 ipu2_di1_pre, hsi_tx_podf, ssi1_pred, ssi1_podf, ssi2_pred, ssi2_podf,
93 ssi3_pred, ssi3_podf, uart_serial_podf, usdhc1_podf, usdhc2_podf,
94 usdhc3_podf, usdhc4_podf, enfc_pred, enfc_podf, emi_podf,
95 emi_slow_podf, vpu_axi_podf, cko1_podf, axi, mmdc_ch0_axi_podf,
96 mmdc_ch1_axi_podf, arm, ahb, apbh_dma, asrc, can1_ipg, can1_serial,
97 can2_ipg, can2_serial, ecspi1, ecspi2, ecspi3, ecspi4, ecspi5, enet,
98 esai, gpt_ipg, gpt_ipg_per, gpu2d_core, gpu3d_core, hdmi_iahb,
99 hdmi_isfr, i2c1, i2c2, i2c3, iim, enfc, ipu1, ipu1_di0, ipu1_di1, ipu2,
100 ipu2_di0, ldb_di0, ldb_di1, ipu2_di1, hsi_tx, mlb, mmdc_ch0_axi,
101 mmdc_ch1_axi, ocram, openvg_axi, pcie_axi, pwm1, pwm2, pwm3, pwm4, per1_bch,
102 gpmi_bch_apb, gpmi_bch, gpmi_io, gpmi_apb, sata, sdma, spba, ssi1,
103 ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3,
104 usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg,
105 pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg,
106 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5,
107 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
108 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow,
109 spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div,
110 lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, esai_ahb, clk_max
111};
112
113static struct clk *clk[clk_max];
114static struct clk_onecell_data clk_data; 78static struct clk_onecell_data clk_data;
115 79
116static enum mx6q_clks const clks_init_on[] __initconst = { 80static unsigned int const clks_init_on[] __initconst = {
117 mmdc_ch0_axi, rom, arm, 81 IMX6QDL_CLK_MMDC_CH0_AXI,
82 IMX6QDL_CLK_ROM,
83 IMX6QDL_CLK_ARM,
118}; 84};
119 85
120static struct clk_div_table clk_enet_ref_table[] = { 86static struct clk_div_table clk_enet_ref_table[] = {
@@ -149,10 +115,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
149 int i; 115 int i;
150 int ret; 116 int ret;
151 117
152 clk[dummy] = imx_clk_fixed("dummy", 0); 118 clk[IMX6QDL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
153 clk[ckil] = imx_obtain_fixed_clock("ckil", 0); 119 clk[IMX6QDL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
154 clk[ckih] = imx_obtain_fixed_clock("ckih1", 0); 120 clk[IMX6QDL_CLK_CKIH] = imx_obtain_fixed_clock("ckih1", 0);
155 clk[osc] = imx_obtain_fixed_clock("osc", 0); 121 clk[IMX6QDL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
156 122
157 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); 123 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
158 base = of_iomap(np, 0); 124 base = of_iomap(np, 0);
@@ -166,14 +132,14 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
166 video_div_table[2].div = 1; 132 video_div_table[2].div = 1;
167 }; 133 };
168 134
169 /* type name parent_name base div_mask */ 135 /* type name parent_name base div_mask */
170 clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); 136 clk[IMX6QDL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
171 clk[pll2_bus] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); 137 clk[IMX6QDL_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1);
172 clk[pll3_usb_otg] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3); 138 clk[IMX6QDL_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3);
173 clk[pll4_audio] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f); 139 clk[IMX6QDL_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f);
174 clk[pll5_video] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f); 140 clk[IMX6QDL_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f);
175 clk[pll6_enet] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3); 141 clk[IMX6QDL_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3);
176 clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3); 142 clk[IMX6QDL_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3);
177 143
178 /* 144 /*
179 * Bit 20 is the reserved and read-only bit, we do this only for: 145 * Bit 20 is the reserved and read-only bit, we do this only for:
@@ -181,28 +147,28 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
181 * - Keep refcount when do usbphy clk_enable/disable, in that case, 147 * - Keep refcount when do usbphy clk_enable/disable, in that case,
182 * the clk framework may need to enable/disable usbphy's parent 148 * the clk framework may need to enable/disable usbphy's parent
183 */ 149 */
184 clk[usbphy1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 150 clk[IMX6QDL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20);
185 clk[usbphy2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 151 clk[IMX6QDL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20);
186 152
187 /* 153 /*
188 * usbphy*_gate needs to be on after system boots up, and software 154 * usbphy*_gate needs to be on after system boots up, and software
189 * never needs to control it anymore. 155 * never needs to control it anymore.
190 */ 156 */
191 clk[usbphy1_gate] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6); 157 clk[IMX6QDL_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6);
192 clk[usbphy2_gate] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6); 158 clk[IMX6QDL_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6);
193 159
194 clk[sata_ref] = imx_clk_fixed_factor("sata_ref", "pll6_enet", 1, 5); 160 clk[IMX6QDL_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "pll6_enet", 1, 5);
195 clk[pcie_ref] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 4); 161 clk[IMX6QDL_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 4);
196 162
197 clk[sata_ref_100m] = imx_clk_gate("sata_ref_100m", "sata_ref", base + 0xe0, 20); 163 clk[IMX6QDL_CLK_SATA_REF_100M] = imx_clk_gate("sata_ref_100m", "sata_ref", base + 0xe0, 20);
198 clk[pcie_ref_125m] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 164 clk[IMX6QDL_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19);
199 165
200 clk[enet_ref] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 166 clk[IMX6QDL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0,
201 base + 0xe0, 0, 2, 0, clk_enet_ref_table, 167 base + 0xe0, 0, 2, 0, clk_enet_ref_table,
202 &imx_ccm_lock); 168 &imx_ccm_lock);
203 169
204 clk[lvds1_sel] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 170 clk[IMX6QDL_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
205 clk[lvds2_sel] = imx_clk_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 171 clk[IMX6QDL_CLK_LVDS2_SEL] = imx_clk_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels));
206 172
207 /* 173 /*
208 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be 174 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be
@@ -210,29 +176,29 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
210 * the "output_enable" bit as a gate, even though it's really just 176 * the "output_enable" bit as a gate, even though it's really just
211 * enabling clock output. 177 * enabling clock output.
212 */ 178 */
213 clk[lvds1_gate] = imx_clk_gate("lvds1_gate", "lvds1_sel", base + 0x160, 10); 179 clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate("lvds1_gate", "lvds1_sel", base + 0x160, 10);
214 clk[lvds2_gate] = imx_clk_gate("lvds2_gate", "lvds2_sel", base + 0x160, 11); 180 clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate("lvds2_gate", "lvds2_sel", base + 0x160, 11);
215 181
216 /* name parent_name reg idx */ 182 /* name parent_name reg idx */
217 clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 183 clk[IMX6QDL_CLK_PLL2_PFD0_352M] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0);
218 clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 184 clk[IMX6QDL_CLK_PLL2_PFD1_594M] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1);
219 clk[pll2_pfd2_396m] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 185 clk[IMX6QDL_CLK_PLL2_PFD2_396M] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2);
220 clk[pll3_pfd0_720m] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 186 clk[IMX6QDL_CLK_PLL3_PFD0_720M] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0);
221 clk[pll3_pfd1_540m] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 187 clk[IMX6QDL_CLK_PLL3_PFD1_540M] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1);
222 clk[pll3_pfd2_508m] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 188 clk[IMX6QDL_CLK_PLL3_PFD2_508M] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2);
223 clk[pll3_pfd3_454m] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 189 clk[IMX6QDL_CLK_PLL3_PFD3_454M] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3);
224 190
225 /* name parent_name mult div */ 191 /* name parent_name mult div */
226 clk[pll2_198m] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 192 clk[IMX6QDL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2);
227 clk[pll3_120m] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 193 clk[IMX6QDL_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4);
228 clk[pll3_80m] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 194 clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6);
229 clk[pll3_60m] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 195 clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8);
230 clk[twd] = imx_clk_fixed_factor("twd", "arm", 1, 2); 196 clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2);
231 197
232 clk[pll4_post_div] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 198 clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock);
233 clk[pll4_audio_div] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 199 clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock);
234 clk[pll5_post_div] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 200 clk[IMX6QDL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock);
235 clk[pll5_video_div] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 201 clk[IMX6QDL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock);
236 202
237 np = ccm_node; 203 np = ccm_node;
238 base = of_iomap(np, 0); 204 base = of_iomap(np, 0);
@@ -240,262 +206,254 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
240 206
241 imx6q_pm_set_ccm_base(base); 207 imx6q_pm_set_ccm_base(base);
242 208
243 /* name reg shift width parent_names num_parents */ 209 /* name reg shift width parent_names num_parents */
244 clk[step] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 210 clk[IMX6QDL_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels));
245 clk[pll1_sw] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 211 clk[IMX6QDL_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels));
246 clk[periph_pre] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 212 clk[IMX6QDL_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels));
247 clk[periph2_pre] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 213 clk[IMX6QDL_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels));
248 clk[periph_clk2_sel] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 214 clk[IMX6QDL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels));
249 clk[periph2_clk2_sel] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 215 clk[IMX6QDL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels));
250 clk[axi_sel] = imx_clk_mux("axi_sel", base + 0x14, 6, 2, axi_sels, ARRAY_SIZE(axi_sels)); 216 clk[IMX6QDL_CLK_AXI_SEL] = imx_clk_mux("axi_sel", base + 0x14, 6, 2, axi_sels, ARRAY_SIZE(axi_sels));
251 clk[esai_sel] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 217 clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels));
252 clk[asrc_sel] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 218 clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels));
253 clk[spdif_sel] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 219 clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels));
254 clk[gpu2d_axi] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 220 clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels));
255 clk[gpu3d_axi] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 221 clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels));
256 clk[gpu2d_core_sel] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 222 clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels));
257 clk[gpu3d_core_sel] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); 223 clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels));
258 clk[gpu3d_shader_sel] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 224 clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels));
259 clk[ipu1_sel] = imx_clk_mux("ipu1_sel", base + 0x3c, 9, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 225 clk[IMX6QDL_CLK_IPU1_SEL] = imx_clk_mux("ipu1_sel", base + 0x3c, 9, 2, ipu_sels, ARRAY_SIZE(ipu_sels));
260 clk[ipu2_sel] = imx_clk_mux("ipu2_sel", base + 0x3c, 14, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 226 clk[IMX6QDL_CLK_IPU2_SEL] = imx_clk_mux("ipu2_sel", base + 0x3c, 14, 2, ipu_sels, ARRAY_SIZE(ipu_sels));
261 clk[ldb_di0_sel] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 227 clk[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT);
262 clk[ldb_di1_sel] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 228 clk[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT);
263 clk[ipu1_di0_pre_sel] = imx_clk_mux_flags("ipu1_di0_pre_sel", base + 0x34, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 229 clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL] = imx_clk_mux_flags("ipu1_di0_pre_sel", base + 0x34, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
264 clk[ipu1_di1_pre_sel] = imx_clk_mux_flags("ipu1_di1_pre_sel", base + 0x34, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 230 clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL] = imx_clk_mux_flags("ipu1_di1_pre_sel", base + 0x34, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
265 clk[ipu2_di0_pre_sel] = imx_clk_mux_flags("ipu2_di0_pre_sel", base + 0x38, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 231 clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL] = imx_clk_mux_flags("ipu2_di0_pre_sel", base + 0x38, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
266 clk[ipu2_di1_pre_sel] = imx_clk_mux_flags("ipu2_di1_pre_sel", base + 0x38, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 232 clk[IMX6QDL_CLK_IPU2_DI1_PRE_SEL] = imx_clk_mux_flags("ipu2_di1_pre_sel", base + 0x38, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
267 clk[ipu1_di0_sel] = imx_clk_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels, ARRAY_SIZE(ipu1_di0_sels), CLK_SET_RATE_PARENT); 233 clk[IMX6QDL_CLK_IPU1_DI0_SEL] = imx_clk_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels, ARRAY_SIZE(ipu1_di0_sels), CLK_SET_RATE_PARENT);
268 clk[ipu1_di1_sel] = imx_clk_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels, ARRAY_SIZE(ipu1_di1_sels), CLK_SET_RATE_PARENT); 234 clk[IMX6QDL_CLK_IPU1_DI1_SEL] = imx_clk_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels, ARRAY_SIZE(ipu1_di1_sels), CLK_SET_RATE_PARENT);
269 clk[ipu2_di0_sel] = imx_clk_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels, ARRAY_SIZE(ipu2_di0_sels), CLK_SET_RATE_PARENT); 235 clk[IMX6QDL_CLK_IPU2_DI0_SEL] = imx_clk_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels, ARRAY_SIZE(ipu2_di0_sels), CLK_SET_RATE_PARENT);
270 clk[ipu2_di1_sel] = imx_clk_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels, ARRAY_SIZE(ipu2_di1_sels), CLK_SET_RATE_PARENT); 236 clk[IMX6QDL_CLK_IPU2_DI1_SEL] = imx_clk_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels, ARRAY_SIZE(ipu2_di1_sels), CLK_SET_RATE_PARENT);
271 clk[hsi_tx_sel] = imx_clk_mux("hsi_tx_sel", base + 0x30, 28, 1, hsi_tx_sels, ARRAY_SIZE(hsi_tx_sels)); 237 clk[IMX6QDL_CLK_HSI_TX_SEL] = imx_clk_mux("hsi_tx_sel", base + 0x30, 28, 1, hsi_tx_sels, ARRAY_SIZE(hsi_tx_sels));
272 clk[pcie_axi_sel] = imx_clk_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels)); 238 clk[IMX6QDL_CLK_PCIE_AXI_SEL] = imx_clk_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels));
273 clk[ssi1_sel] = imx_clk_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 239 clk[IMX6QDL_CLK_SSI1_SEL] = imx_clk_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup);
274 clk[ssi2_sel] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 240 clk[IMX6QDL_CLK_SSI2_SEL] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup);
275 clk[ssi3_sel] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 241 clk[IMX6QDL_CLK_SSI3_SEL] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup);
276 clk[usdhc1_sel] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 242 clk[IMX6QDL_CLK_USDHC1_SEL] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
277 clk[usdhc2_sel] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 243 clk[IMX6QDL_CLK_USDHC2_SEL] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
278 clk[usdhc3_sel] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 244 clk[IMX6QDL_CLK_USDHC3_SEL] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
279 clk[usdhc4_sel] = imx_clk_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 245 clk[IMX6QDL_CLK_USDHC4_SEL] = imx_clk_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup);
280 clk[enfc_sel] = imx_clk_mux("enfc_sel", base + 0x2c, 16, 2, enfc_sels, ARRAY_SIZE(enfc_sels)); 246 clk[IMX6QDL_CLK_ENFC_SEL] = imx_clk_mux("enfc_sel", base + 0x2c, 16, 2, enfc_sels, ARRAY_SIZE(enfc_sels));
281 clk[emi_sel] = imx_clk_fixup_mux("emi_sel", base + 0x1c, 27, 2, emi_sels, ARRAY_SIZE(emi_sels), imx_cscmr1_fixup); 247 clk[IMX6QDL_CLK_EMI_SEL] = imx_clk_fixup_mux("emi_sel", base + 0x1c, 27, 2, emi_sels, ARRAY_SIZE(emi_sels), imx_cscmr1_fixup);
282 clk[emi_slow_sel] = imx_clk_fixup_mux("emi_slow_sel", base + 0x1c, 29, 2, emi_slow_sels, ARRAY_SIZE(emi_slow_sels), imx_cscmr1_fixup); 248 clk[IMX6QDL_CLK_EMI_SLOW_SEL] = imx_clk_fixup_mux("emi_slow_sel", base + 0x1c, 29, 2, emi_slow_sels, ARRAY_SIZE(emi_slow_sels), imx_cscmr1_fixup);
283 clk[vdo_axi_sel] = imx_clk_mux("vdo_axi_sel", base + 0x18, 11, 1, vdo_axi_sels, ARRAY_SIZE(vdo_axi_sels)); 249 clk[IMX6QDL_CLK_VDO_AXI_SEL] = imx_clk_mux("vdo_axi_sel", base + 0x18, 11, 1, vdo_axi_sels, ARRAY_SIZE(vdo_axi_sels));
284 clk[vpu_axi_sel] = imx_clk_mux("vpu_axi_sel", base + 0x18, 14, 2, vpu_axi_sels, ARRAY_SIZE(vpu_axi_sels)); 250 clk[IMX6QDL_CLK_VPU_AXI_SEL] = imx_clk_mux("vpu_axi_sel", base + 0x18, 14, 2, vpu_axi_sels, ARRAY_SIZE(vpu_axi_sels));
285 clk[cko1_sel] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 251 clk[IMX6QDL_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels));
286 clk[cko2_sel] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 252 clk[IMX6QDL_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels));
287 clk[cko] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 253 clk[IMX6QDL_CLK_CKO] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels));
288 254
289 /* name reg shift width busy: reg, shift parent_names num_parents */ 255 /* name reg shift width busy: reg, shift parent_names num_parents */
290 clk[periph] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 256 clk[IMX6QDL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels));
291 clk[periph2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 257 clk[IMX6QDL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels));
292 258
293 /* name parent_name reg shift width */ 259 /* name parent_name reg shift width */
294 clk[periph_clk2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 260 clk[IMX6QDL_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3);
295 clk[periph2_clk2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 261 clk[IMX6QDL_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3);
296 clk[ipg] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 262 clk[IMX6QDL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2);
297 clk[ipg_per] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup); 263 clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup);
298 clk[esai_pred] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 264 clk[IMX6QDL_CLK_ESAI_PRED] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3);
299 clk[esai_podf] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 265 clk[IMX6QDL_CLK_ESAI_PODF] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3);
300 clk[asrc_pred] = imx_clk_divider("asrc_pred", "asrc_sel", base + 0x30, 12, 3); 266 clk[IMX6QDL_CLK_ASRC_PRED] = imx_clk_divider("asrc_pred", "asrc_sel", base + 0x30, 12, 3);
301 clk[asrc_podf] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3); 267 clk[IMX6QDL_CLK_ASRC_PODF] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3);
302 clk[spdif_pred] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 268 clk[IMX6QDL_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3);
303 clk[spdif_podf] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 269 clk[IMX6QDL_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3);
304 clk[can_root] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6); 270 clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6);
305 clk[ecspi_root] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); 271 clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);
306 clk[gpu2d_core_podf] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3); 272 clk[IMX6QDL_CLK_GPU2D_CORE_PODF] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3);
307 clk[gpu3d_core_podf] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3); 273 clk[IMX6QDL_CLK_GPU3D_CORE_PODF] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3);
308 clk[gpu3d_shader] = imx_clk_divider("gpu3d_shader", "gpu3d_shader_sel", base + 0x18, 29, 3); 274 clk[IMX6QDL_CLK_GPU3D_SHADER] = imx_clk_divider("gpu3d_shader", "gpu3d_shader_sel", base + 0x18, 29, 3);
309 clk[ipu1_podf] = imx_clk_divider("ipu1_podf", "ipu1_sel", base + 0x3c, 11, 3); 275 clk[IMX6QDL_CLK_IPU1_PODF] = imx_clk_divider("ipu1_podf", "ipu1_sel", base + 0x3c, 11, 3);
310 clk[ipu2_podf] = imx_clk_divider("ipu2_podf", "ipu2_sel", base + 0x3c, 16, 3); 276 clk[IMX6QDL_CLK_IPU2_PODF] = imx_clk_divider("ipu2_podf", "ipu2_sel", base + 0x3c, 16, 3);
311 clk[ldb_di0_div_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 277 clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
312 clk[ldb_di0_podf] = imx_clk_divider_flags("ldb_di0_podf", "ldb_di0_div_3_5", base + 0x20, 10, 1, 0); 278 clk[IMX6QDL_CLK_LDB_DI0_PODF] = imx_clk_divider_flags("ldb_di0_podf", "ldb_di0_div_3_5", base + 0x20, 10, 1, 0);
313 clk[ldb_di1_div_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 279 clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
314 clk[ldb_di1_podf] = imx_clk_divider_flags("ldb_di1_podf", "ldb_di1_div_3_5", base + 0x20, 11, 1, 0); 280 clk[IMX6QDL_CLK_LDB_DI1_PODF] = imx_clk_divider_flags("ldb_di1_podf", "ldb_di1_div_3_5", base + 0x20, 11, 1, 0);
315 clk[ipu1_di0_pre] = imx_clk_divider("ipu1_di0_pre", "ipu1_di0_pre_sel", base + 0x34, 3, 3); 281 clk[IMX6QDL_CLK_IPU1_DI0_PRE] = imx_clk_divider("ipu1_di0_pre", "ipu1_di0_pre_sel", base + 0x34, 3, 3);
316 clk[ipu1_di1_pre] = imx_clk_divider("ipu1_di1_pre", "ipu1_di1_pre_sel", base + 0x34, 12, 3); 282 clk[IMX6QDL_CLK_IPU1_DI1_PRE] = imx_clk_divider("ipu1_di1_pre", "ipu1_di1_pre_sel", base + 0x34, 12, 3);
317 clk[ipu2_di0_pre] = imx_clk_divider("ipu2_di0_pre", "ipu2_di0_pre_sel", base + 0x38, 3, 3); 283 clk[IMX6QDL_CLK_IPU2_DI0_PRE] = imx_clk_divider("ipu2_di0_pre", "ipu2_di0_pre_sel", base + 0x38, 3, 3);
318 clk[ipu2_di1_pre] = imx_clk_divider("ipu2_di1_pre", "ipu2_di1_pre_sel", base + 0x38, 12, 3); 284 clk[IMX6QDL_CLK_IPU2_DI1_PRE] = imx_clk_divider("ipu2_di1_pre", "ipu2_di1_pre_sel", base + 0x38, 12, 3);
319 clk[hsi_tx_podf] = imx_clk_divider("hsi_tx_podf", "hsi_tx_sel", base + 0x30, 29, 3); 285 clk[IMX6QDL_CLK_HSI_TX_PODF] = imx_clk_divider("hsi_tx_podf", "hsi_tx_sel", base + 0x30, 29, 3);
320 clk[ssi1_pred] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 286 clk[IMX6QDL_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3);
321 clk[ssi1_podf] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 287 clk[IMX6QDL_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6);
322 clk[ssi2_pred] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 288 clk[IMX6QDL_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3);
323 clk[ssi2_podf] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 289 clk[IMX6QDL_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6);
324 clk[ssi3_pred] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 290 clk[IMX6QDL_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3);
325 clk[ssi3_podf] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 291 clk[IMX6QDL_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6);
326 clk[uart_serial_podf] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6); 292 clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6);
327 clk[usdhc1_podf] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 293 clk[IMX6QDL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3);
328 clk[usdhc2_podf] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 294 clk[IMX6QDL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3);
329 clk[usdhc3_podf] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 295 clk[IMX6QDL_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3);
330 clk[usdhc4_podf] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 296 clk[IMX6QDL_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3);
331 clk[enfc_pred] = imx_clk_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3); 297 clk[IMX6QDL_CLK_ENFC_PRED] = imx_clk_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3);
332 clk[enfc_podf] = imx_clk_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6); 298 clk[IMX6QDL_CLK_ENFC_PODF] = imx_clk_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6);
333 clk[emi_podf] = imx_clk_fixup_divider("emi_podf", "emi_sel", base + 0x1c, 20, 3, imx_cscmr1_fixup); 299 clk[IMX6QDL_CLK_EMI_PODF] = imx_clk_fixup_divider("emi_podf", "emi_sel", base + 0x1c, 20, 3, imx_cscmr1_fixup);
334 clk[emi_slow_podf] = imx_clk_fixup_divider("emi_slow_podf", "emi_slow_sel", base + 0x1c, 23, 3, imx_cscmr1_fixup); 300 clk[IMX6QDL_CLK_EMI_SLOW_PODF] = imx_clk_fixup_divider("emi_slow_podf", "emi_slow_sel", base + 0x1c, 23, 3, imx_cscmr1_fixup);
335 clk[vpu_axi_podf] = imx_clk_divider("vpu_axi_podf", "vpu_axi_sel", base + 0x24, 25, 3); 301 clk[IMX6QDL_CLK_VPU_AXI_PODF] = imx_clk_divider("vpu_axi_podf", "vpu_axi_sel", base + 0x24, 25, 3);
336 clk[cko1_podf] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 302 clk[IMX6QDL_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3);
337 clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 303 clk[IMX6QDL_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3);
338 304
339 /* name parent_name reg shift width busy: reg, shift */ 305 /* name parent_name reg shift width busy: reg, shift */
340 clk[axi] = imx_clk_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 306 clk[IMX6QDL_CLK_AXI] = imx_clk_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0);
341 clk[mmdc_ch0_axi_podf] = imx_clk_busy_divider("mmdc_ch0_axi_podf", "periph", base + 0x14, 19, 3, base + 0x48, 4); 307 clk[IMX6QDL_CLK_MMDC_CH0_AXI_PODF] = imx_clk_busy_divider("mmdc_ch0_axi_podf", "periph", base + 0x14, 19, 3, base + 0x48, 4);
342 clk[mmdc_ch1_axi_podf] = imx_clk_busy_divider("mmdc_ch1_axi_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 308 clk[IMX6QDL_CLK_MMDC_CH1_AXI_PODF] = imx_clk_busy_divider("mmdc_ch1_axi_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2);
343 clk[arm] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 309 clk[IMX6QDL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16);
344 clk[ahb] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 310 clk[IMX6QDL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1);
345 311
346 /* name parent_name reg shift */ 312 /* name parent_name reg shift */
347 clk[apbh_dma] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 313 clk[IMX6QDL_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4);
348 clk[asrc] = imx_clk_gate2("asrc", "asrc_podf", base + 0x68, 6); 314 clk[IMX6QDL_CLK_ASRC] = imx_clk_gate2("asrc", "asrc_podf", base + 0x68, 6);
349 clk[can1_ipg] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14); 315 clk[IMX6QDL_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14);
350 clk[can1_serial] = imx_clk_gate2("can1_serial", "can_root", base + 0x68, 16); 316 clk[IMX6QDL_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_root", base + 0x68, 16);
351 clk[can2_ipg] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18); 317 clk[IMX6QDL_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18);
352 clk[can2_serial] = imx_clk_gate2("can2_serial", "can_root", base + 0x68, 20); 318 clk[IMX6QDL_CLK_CAN2_SERIAL] = imx_clk_gate2("can2_serial", "can_root", base + 0x68, 20);
353 clk[ecspi1] = imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0); 319 clk[IMX6QDL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0);
354 clk[ecspi2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 320 clk[IMX6QDL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2);
355 clk[ecspi3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 321 clk[IMX6QDL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4);
356 clk[ecspi4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 322 clk[IMX6QDL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6);
357 if (cpu_is_imx6dl()) 323 if (cpu_is_imx6dl())
358 /* ecspi5 is replaced with i2c4 on imx6dl & imx6s */ 324 clk[IMX6DL_CLK_I2C4] = imx_clk_gate2("i2c4", "ipg_per", base + 0x6c, 8);
359 clk[ecspi5] = imx_clk_gate2("i2c4", "ipg_per", base + 0x6c, 8);
360 else 325 else
361 clk[ecspi5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8); 326 clk[IMX6Q_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8);
362 clk[enet] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); 327 clk[IMX6QDL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10);
363 clk[esai] = imx_clk_gate2_shared("esai", "esai_podf", base + 0x6c, 16, &share_count_esai); 328 clk[IMX6QDL_CLK_ESAI] = imx_clk_gate2_shared("esai", "esai_podf", base + 0x6c, 16, &share_count_esai);
364 clk[esai_ahb] = imx_clk_gate2_shared("esai_ahb", "ahb", base + 0x6c, 16, &share_count_esai); 329 clk[IMX6QDL_CLK_ESAI_AHB] = imx_clk_gate2_shared("esai_ahb", "ahb", base + 0x6c, 16, &share_count_esai);
365 clk[gpt_ipg] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 330 clk[IMX6QDL_CLK_GPT_IPG] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20);
366 clk[gpt_ipg_per] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 331 clk[IMX6QDL_CLK_GPT_IPG_PER] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22);
367 if (cpu_is_imx6dl()) 332 if (cpu_is_imx6dl())
368 /* 333 /*
369 * The multiplexer and divider of imx6q clock gpu3d_shader get 334 * The multiplexer and divider of imx6q clock gpu3d_shader get
370 * redefined/reused as gpu2d_core_sel and gpu2d_core_podf on imx6dl. 335 * redefined/reused as gpu2d_core_sel and gpu2d_core_podf on imx6dl.
371 */ 336 */
372 clk[gpu2d_core] = imx_clk_gate2("gpu2d_core", "gpu3d_shader", base + 0x6c, 24); 337 clk[IMX6QDL_CLK_GPU2D_CORE] = imx_clk_gate2("gpu2d_core", "gpu3d_shader", base + 0x6c, 24);
373 else 338 else
374 clk[gpu2d_core] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24); 339 clk[IMX6QDL_CLK_GPU2D_CORE] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24);
375 clk[gpu3d_core] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26); 340 clk[IMX6QDL_CLK_GPU3D_CORE] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26);
376 clk[hdmi_iahb] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0); 341 clk[IMX6QDL_CLK_HDMI_IAHB] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0);
377 clk[hdmi_isfr] = imx_clk_gate2("hdmi_isfr", "pll3_pfd1_540m", base + 0x70, 4); 342 clk[IMX6QDL_CLK_HDMI_ISFR] = imx_clk_gate2("hdmi_isfr", "pll3_pfd1_540m", base + 0x70, 4);
378 clk[i2c1] = imx_clk_gate2("i2c1", "ipg_per", base + 0x70, 6); 343 clk[IMX6QDL_CLK_I2C1] = imx_clk_gate2("i2c1", "ipg_per", base + 0x70, 6);
379 clk[i2c2] = imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8); 344 clk[IMX6QDL_CLK_I2C2] = imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8);
380 clk[i2c3] = imx_clk_gate2("i2c3", "ipg_per", base + 0x70, 10); 345 clk[IMX6QDL_CLK_I2C3] = imx_clk_gate2("i2c3", "ipg_per", base + 0x70, 10);
381 clk[iim] = imx_clk_gate2("iim", "ipg", base + 0x70, 12); 346 clk[IMX6QDL_CLK_IIM] = imx_clk_gate2("iim", "ipg", base + 0x70, 12);
382 clk[enfc] = imx_clk_gate2("enfc", "enfc_podf", base + 0x70, 14); 347 clk[IMX6QDL_CLK_ENFC] = imx_clk_gate2("enfc", "enfc_podf", base + 0x70, 14);
383 clk[vdoa] = imx_clk_gate2("vdoa", "vdo_axi", base + 0x70, 26); 348 clk[IMX6QDL_CLK_VDOA] = imx_clk_gate2("vdoa", "vdo_axi", base + 0x70, 26);
384 clk[ipu1] = imx_clk_gate2("ipu1", "ipu1_podf", base + 0x74, 0); 349 clk[IMX6QDL_CLK_IPU1] = imx_clk_gate2("ipu1", "ipu1_podf", base + 0x74, 0);
385 clk[ipu1_di0] = imx_clk_gate2("ipu1_di0", "ipu1_di0_sel", base + 0x74, 2); 350 clk[IMX6QDL_CLK_IPU1_DI0] = imx_clk_gate2("ipu1_di0", "ipu1_di0_sel", base + 0x74, 2);
386 clk[ipu1_di1] = imx_clk_gate2("ipu1_di1", "ipu1_di1_sel", base + 0x74, 4); 351 clk[IMX6QDL_CLK_IPU1_DI1] = imx_clk_gate2("ipu1_di1", "ipu1_di1_sel", base + 0x74, 4);
387 clk[ipu2] = imx_clk_gate2("ipu2", "ipu2_podf", base + 0x74, 6); 352 clk[IMX6QDL_CLK_IPU2] = imx_clk_gate2("ipu2", "ipu2_podf", base + 0x74, 6);
388 clk[ipu2_di0] = imx_clk_gate2("ipu2_di0", "ipu2_di0_sel", base + 0x74, 8); 353 clk[IMX6QDL_CLK_IPU2_DI0] = imx_clk_gate2("ipu2_di0", "ipu2_di0_sel", base + 0x74, 8);
389 clk[ldb_di0] = imx_clk_gate2("ldb_di0", "ldb_di0_podf", base + 0x74, 12); 354 clk[IMX6QDL_CLK_LDB_DI0] = imx_clk_gate2("ldb_di0", "ldb_di0_podf", base + 0x74, 12);
390 clk[ldb_di1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14); 355 clk[IMX6QDL_CLK_LDB_DI1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14);
391 clk[ipu2_di1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10); 356 clk[IMX6QDL_CLK_IPU2_DI1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10);
392 clk[hsi_tx] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16); 357 clk[IMX6QDL_CLK_HSI_TX] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16);
393 if (cpu_is_imx6dl()) 358 if (cpu_is_imx6dl())
394 /* 359 /*
395 * The multiplexer and divider of the imx6q clock gpu2d get 360 * The multiplexer and divider of the imx6q clock gpu2d get
396 * redefined/reused as mlb_sys_sel and mlb_sys_clk_podf on imx6dl. 361 * redefined/reused as mlb_sys_sel and mlb_sys_clk_podf on imx6dl.
397 */ 362 */
398 clk[mlb] = imx_clk_gate2("mlb", "gpu2d_core_podf", base + 0x74, 18); 363 clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb", "gpu2d_core_podf", base + 0x74, 18);
399 else 364 else
400 clk[mlb] = imx_clk_gate2("mlb", "axi", base + 0x74, 18); 365 clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb", "axi", base + 0x74, 18);
401 clk[mmdc_ch0_axi] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20); 366 clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20);
402 clk[mmdc_ch1_axi] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22); 367 clk[IMX6QDL_CLK_MMDC_CH1_AXI] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22);
403 clk[ocram] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28); 368 clk[IMX6QDL_CLK_OCRAM] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28);
404 clk[openvg_axi] = imx_clk_gate2("openvg_axi", "axi", base + 0x74, 30); 369 clk[IMX6QDL_CLK_OPENVG_AXI] = imx_clk_gate2("openvg_axi", "axi", base + 0x74, 30);
405 clk[pcie_axi] = imx_clk_gate2("pcie_axi", "pcie_axi_sel", base + 0x78, 0); 370 clk[IMX6QDL_CLK_PCIE_AXI] = imx_clk_gate2("pcie_axi", "pcie_axi_sel", base + 0x78, 0);
406 clk[per1_bch] = imx_clk_gate2("per1_bch", "usdhc3", base + 0x78, 12); 371 clk[IMX6QDL_CLK_PER1_BCH] = imx_clk_gate2("per1_bch", "usdhc3", base + 0x78, 12);
407 clk[pwm1] = imx_clk_gate2("pwm1", "ipg_per", base + 0x78, 16); 372 clk[IMX6QDL_CLK_PWM1] = imx_clk_gate2("pwm1", "ipg_per", base + 0x78, 16);
408 clk[pwm2] = imx_clk_gate2("pwm2", "ipg_per", base + 0x78, 18); 373 clk[IMX6QDL_CLK_PWM2] = imx_clk_gate2("pwm2", "ipg_per", base + 0x78, 18);
409 clk[pwm3] = imx_clk_gate2("pwm3", "ipg_per", base + 0x78, 20); 374 clk[IMX6QDL_CLK_PWM3] = imx_clk_gate2("pwm3", "ipg_per", base + 0x78, 20);
410 clk[pwm4] = imx_clk_gate2("pwm4", "ipg_per", base + 0x78, 22); 375 clk[IMX6QDL_CLK_PWM4] = imx_clk_gate2("pwm4", "ipg_per", base + 0x78, 22);
411 clk[gpmi_bch_apb] = imx_clk_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24); 376 clk[IMX6QDL_CLK_GPMI_BCH_APB] = imx_clk_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24);
412 clk[gpmi_bch] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 377 clk[IMX6QDL_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26);
413 clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); 378 clk[IMX6QDL_CLK_GPMI_IO] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28);
414 clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 379 clk[IMX6QDL_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30);
415 clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); 380 clk[IMX6QDL_CLK_ROM] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0);
416 clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); 381 clk[IMX6QDL_CLK_SATA] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4);
417 clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 382 clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6);
418 clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 383 clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
419 clk[spdif] = imx_clk_gate2("spdif", "spdif_podf", base + 0x7c, 14); 384 clk[IMX6QDL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif_podf", base + 0x7c, 14);
420 clk[ssi1_ipg] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); 385 clk[IMX6QDL_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18);
421 clk[ssi2_ipg] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20); 386 clk[IMX6QDL_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20);
422 clk[ssi3_ipg] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22); 387 clk[IMX6QDL_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22);
423 clk[uart_ipg] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24); 388 clk[IMX6QDL_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24);
424 clk[uart_serial] = imx_clk_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26); 389 clk[IMX6QDL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26);
425 clk[usboh3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 390 clk[IMX6QDL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0);
426 clk[usdhc1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 391 clk[IMX6QDL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2);
427 clk[usdhc2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 392 clk[IMX6QDL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4);
428 clk[usdhc3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 393 clk[IMX6QDL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
429 clk[usdhc4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 394 clk[IMX6QDL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
430 clk[eim_slow] = imx_clk_gate2("eim_slow", "emi_slow_podf", base + 0x80, 10); 395 clk[IMX6QDL_CLK_EIM_SLOW] = imx_clk_gate2("eim_slow", "emi_slow_podf", base + 0x80, 10);
431 clk[vdo_axi] = imx_clk_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12); 396 clk[IMX6QDL_CLK_VDO_AXI] = imx_clk_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12);
432 clk[vpu_axi] = imx_clk_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14); 397 clk[IMX6QDL_CLK_VPU_AXI] = imx_clk_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14);
433 clk[cko1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 398 clk[IMX6QDL_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7);
434 clk[cko2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 399 clk[IMX6QDL_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24);
435 400
436 for (i = 0; i < ARRAY_SIZE(clk); i++) 401 imx_check_clocks(clk, ARRAY_SIZE(clk));
437 if (IS_ERR(clk[i]))
438 pr_err("i.MX6q clk %d: register failed with %ld\n",
439 i, PTR_ERR(clk[i]));
440 402
441 clk_data.clks = clk; 403 clk_data.clks = clk;
442 clk_data.clk_num = ARRAY_SIZE(clk); 404 clk_data.clk_num = ARRAY_SIZE(clk);
443 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 405 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
444 406
445 clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0"); 407 clk_register_clkdev(clk[IMX6QDL_CLK_ENET_REF], "enet_ref", NULL);
446 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
447 clk_register_clkdev(clk[enet_ref], "enet_ref", NULL);
448 408
449 if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) || 409 if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) ||
450 cpu_is_imx6dl()) { 410 cpu_is_imx6dl()) {
451 clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]); 411 clk_set_parent(clk[IMX6QDL_CLK_LDB_DI0_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
452 clk_set_parent(clk[ldb_di1_sel], clk[pll5_video_div]); 412 clk_set_parent(clk[IMX6QDL_CLK_LDB_DI1_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
453 } 413 }
454 414
455 clk_set_parent(clk[ipu1_di0_pre_sel], clk[pll5_video_div]); 415 clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
456 clk_set_parent(clk[ipu1_di1_pre_sel], clk[pll5_video_div]); 416 clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
457 clk_set_parent(clk[ipu2_di0_pre_sel], clk[pll5_video_div]); 417 clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
458 clk_set_parent(clk[ipu2_di1_pre_sel], clk[pll5_video_div]); 418 clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);
459 clk_set_parent(clk[ipu1_di0_sel], clk[ipu1_di0_pre]); 419 clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_SEL], clk[IMX6QDL_CLK_IPU1_DI0_PRE]);
460 clk_set_parent(clk[ipu1_di1_sel], clk[ipu1_di1_pre]); 420 clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_SEL], clk[IMX6QDL_CLK_IPU1_DI1_PRE]);
461 clk_set_parent(clk[ipu2_di0_sel], clk[ipu2_di0_pre]); 421 clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_SEL], clk[IMX6QDL_CLK_IPU2_DI0_PRE]);
462 clk_set_parent(clk[ipu2_di1_sel], clk[ipu2_di1_pre]); 422 clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_SEL], clk[IMX6QDL_CLK_IPU2_DI1_PRE]);
463 423
464 /* 424 /*
465 * The gpmi needs 100MHz frequency in the EDO/Sync mode, 425 * The gpmi needs 100MHz frequency in the EDO/Sync mode,
466 * We can not get the 100MHz from the pll2_pfd0_352m. 426 * We can not get the 100MHz from the pll2_pfd0_352m.
467 * So choose pll2_pfd2_396m as enfc_sel's parent. 427 * So choose pll2_pfd2_396m as enfc_sel's parent.
468 */ 428 */
469 clk_set_parent(clk[enfc_sel], clk[pll2_pfd2_396m]); 429 clk_set_parent(clk[IMX6QDL_CLK_ENFC_SEL], clk[IMX6QDL_CLK_PLL2_PFD2_396M]);
470 430
471 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 431 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
472 clk_prepare_enable(clk[clks_init_on[i]]); 432 clk_prepare_enable(clk[clks_init_on[i]]);
473 433
474 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 434 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
475 clk_prepare_enable(clk[usbphy1_gate]); 435 clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]);
476 clk_prepare_enable(clk[usbphy2_gate]); 436 clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]);
477 } 437 }
478 438
479 /* 439 /*
480 * Let's initially set up CLKO with OSC24M, since this configuration 440 * Let's initially set up CLKO with OSC24M, since this configuration
481 * is widely used by imx6q board designs to clock audio codec. 441 * is widely used by imx6q board designs to clock audio codec.
482 */ 442 */
483 ret = clk_set_parent(clk[cko2_sel], clk[osc]); 443 ret = clk_set_parent(clk[IMX6QDL_CLK_CKO2_SEL], clk[IMX6QDL_CLK_OSC]);
484 if (!ret) 444 if (!ret)
485 ret = clk_set_parent(clk[cko], clk[cko2]); 445 ret = clk_set_parent(clk[IMX6QDL_CLK_CKO], clk[IMX6QDL_CLK_CKO2]);
486 if (ret) 446 if (ret)
487 pr_warn("failed to set up CLKO: %d\n", ret); 447 pr_warn("failed to set up CLKO: %d\n", ret);
488 448
489 /* Audio-related clocks configuration */ 449 /* Audio-related clocks configuration */
490 clk_set_parent(clk[spdif_sel], clk[pll3_pfd3_454m]); 450 clk_set_parent(clk[IMX6QDL_CLK_SPDIF_SEL], clk[IMX6QDL_CLK_PLL3_PFD3_454M]);
491 451
492 /* All existing boards with PCIe use LVDS1 */ 452 /* All existing boards with PCIe use LVDS1 */
493 if (IS_ENABLED(CONFIG_PCI_IMX6)) 453 if (IS_ENABLED(CONFIG_PCI_IMX6))
494 clk_set_parent(clk[lvds1_sel], clk[sata_ref_100m]); 454 clk_set_parent(clk[IMX6QDL_CLK_LVDS1_SEL], clk[IMX6QDL_CLK_SATA_REF_100M]);
495 455
496 /* Set initial power mode */ 456 /* Set initial power mode */
497 imx6q_set_lpm(WAIT_CLOCKED); 457 imx6q_set_lpm(WAIT_CLOCKED);
498
499 mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"));
500} 458}
501CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init); 459CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 5408ca70c8d6..fef46faf692f 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -348,18 +348,12 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
348 clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 348 clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
349 clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 349 clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
350 350
351 for (i = 0; i < ARRAY_SIZE(clks); i++) 351 imx_check_clocks(clks, ARRAY_SIZE(clks));
352 if (IS_ERR(clks[i]))
353 pr_err("i.MX6SL clk %d: register failed with %ld\n",
354 i, PTR_ERR(clks[i]));
355 352
356 clk_data.clks = clks; 353 clk_data.clks = clks;
357 clk_data.clk_num = ARRAY_SIZE(clks); 354 clk_data.clk_num = ARRAY_SIZE(clks);
358 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 355 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
359 356
360 clk_register_clkdev(clks[IMX6SL_CLK_GPT], "ipg", "imx-gpt.0");
361 clk_register_clkdev(clks[IMX6SL_CLK_GPT_SERIAL], "per", "imx-gpt.0");
362
363 /* Ensure the AHB clk is at 132MHz. */ 357 /* Ensure the AHB clk is at 132MHz. */
364 ret = clk_set_rate(clks[IMX6SL_CLK_AHB], 132000000); 358 ret = clk_set_rate(clks[IMX6SL_CLK_AHB], 132000000);
365 if (ret) 359 if (ret)
@@ -383,8 +377,5 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
383 377
384 /* Set initial power mode */ 378 /* Set initial power mode */
385 imx6q_set_lpm(WAIT_CLOCKED); 379 imx6q_set_lpm(WAIT_CLOCKED);
386
387 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt");
388 mxc_timer_init_dt(np);
389} 380}
390CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init); 381CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
index 72f8902235d1..ecde72bdfe88 100644
--- a/arch/arm/mach-imx/clk-imx6sx.c
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -124,6 +124,9 @@ static struct clk_div_table video_div_table[] = {
124static u32 share_count_asrc; 124static u32 share_count_asrc;
125static u32 share_count_audio; 125static u32 share_count_audio;
126static u32 share_count_esai; 126static u32 share_count_esai;
127static u32 share_count_ssi1;
128static u32 share_count_ssi2;
129static u32 share_count_ssi3;
127 130
128static void __init imx6sx_clocks_init(struct device_node *ccm_node) 131static void __init imx6sx_clocks_init(struct device_node *ccm_node)
129{ 132{
@@ -409,12 +412,12 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
409 clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 412 clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
410 clks[IMX6SX_CLK_AUDIO] = imx_clk_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio); 413 clks[IMX6SX_CLK_AUDIO] = imx_clk_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio);
411 clks[IMX6SX_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 414 clks[IMX6SX_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio);
412 clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); 415 clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1);
413 clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20); 416 clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2);
414 clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22); 417 clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3);
415 clks[IMX6SX_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18); 418 clks[IMX6SX_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1);
416 clks[IMX6SX_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20); 419 clks[IMX6SX_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2);
417 clks[IMX6SX_CLK_SSI3] = imx_clk_gate2("ssi3", "ssi3_podf", base + 0x7c, 22); 420 clks[IMX6SX_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3);
418 clks[IMX6SX_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24); 421 clks[IMX6SX_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24);
419 clks[IMX6SX_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_podf", base + 0x7c, 26); 422 clks[IMX6SX_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_podf", base + 0x7c, 26);
420 clks[IMX6SX_CLK_SAI1_IPG] = imx_clk_gate2("sai1_ipg", "ipg", base + 0x7c, 28); 423 clks[IMX6SX_CLK_SAI1_IPG] = imx_clk_gate2("sai1_ipg", "ipg", base + 0x7c, 28);
@@ -443,17 +446,12 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
443 /* mask handshake of mmdc */ 446 /* mask handshake of mmdc */
444 writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); 447 writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR);
445 448
446 for (i = 0; i < ARRAY_SIZE(clks); i++) 449 imx_check_clocks(clks, ARRAY_SIZE(clks));
447 if (IS_ERR(clks[i]))
448 pr_err("i.MX6sx clk %d: register failed with %ld\n", i, PTR_ERR(clks[i]));
449 450
450 clk_data.clks = clks; 451 clk_data.clks = clks;
451 clk_data.clk_num = ARRAY_SIZE(clks); 452 clk_data.clk_num = ARRAY_SIZE(clks);
452 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 453 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
453 454
454 clk_register_clkdev(clks[IMX6SX_CLK_GPT_BUS], "ipg", "imx-gpt.0");
455 clk_register_clkdev(clks[IMX6SX_CLK_GPT_SERIAL], "per", "imx-gpt.0");
456
457 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 455 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
458 clk_prepare_enable(clks[clks_init_on[i]]); 456 clk_prepare_enable(clks[clks_init_on[i]]);
459 457
@@ -517,8 +515,5 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
517 515
518 /* Set initial power mode */ 516 /* Set initial power mode */
519 imx6q_set_lpm(WAIT_CLOCKED); 517 imx6q_set_lpm(WAIT_CLOCKED);
520
521 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-gpt");
522 mxc_timer_init_dt(np);
523} 518}
524CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init); 519CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index 22dc3ee21fd4..f60d6d569ce3 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -295,14 +295,18 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
295 295
296 clk[VF610_CLK_ASRC] = imx_clk_gate2("asrc", "ipg_bus", CCM_CCGR4, CCM_CCGRx_CGn(1)); 296 clk[VF610_CLK_ASRC] = imx_clk_gate2("asrc", "ipg_bus", CCM_CCGR4, CCM_CCGRx_CGn(1));
297 297
298 clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(0)); 298 clk[VF610_CLK_FLEXCAN0_EN] = imx_clk_gate("flexcan0_en", "ipg_bus", CCM_CSCDR2, 11);
299 clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(4)); 299 clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "flexcan0_en", CCM_CCGR0, CCM_CCGRx_CGn(0));
300 clk[VF610_CLK_FLEXCAN1_EN] = imx_clk_gate("flexcan1_en", "ipg_bus", CCM_CSCDR2, 12);
301 clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "flexcan1_en", CCM_CCGR9, CCM_CCGRx_CGn(4));
300 302
301 clk[VF610_CLK_DMAMUX0] = imx_clk_gate2("dmamux0", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(4)); 303 clk[VF610_CLK_DMAMUX0] = imx_clk_gate2("dmamux0", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(4));
302 clk[VF610_CLK_DMAMUX1] = imx_clk_gate2("dmamux1", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(5)); 304 clk[VF610_CLK_DMAMUX1] = imx_clk_gate2("dmamux1", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(5));
303 clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1)); 305 clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1));
304 clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2)); 306 clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2));
305 307
308 imx_check_clocks(clk, ARRAY_SIZE(clk));
309
306 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]); 310 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
307 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2); 311 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2);
308 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2); 312 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2);
diff --git a/arch/arm/mach-imx/clk.c b/arch/arm/mach-imx/clk.c
index edc35df7bed4..df12b5307175 100644
--- a/arch/arm/mach-imx/clk.c
+++ b/arch/arm/mach-imx/clk.c
@@ -7,6 +7,16 @@
7 7
8DEFINE_SPINLOCK(imx_ccm_lock); 8DEFINE_SPINLOCK(imx_ccm_lock);
9 9
10void __init imx_check_clocks(struct clk *clks[], unsigned int count)
11{
12 unsigned i;
13
14 for (i = 0; i < count; i++)
15 if (IS_ERR(clks[i]))
16 pr_err("i.MX clk %u: register failed with %ld\n",
17 i, PTR_ERR(clks[i]));
18}
19
10static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name) 20static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
11{ 21{
12 struct of_phandle_args phandle; 22 struct of_phandle_args phandle;
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index e29f6ebe9f39..d5ba76fee115 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -6,6 +6,8 @@
6 6
7extern spinlock_t imx_ccm_lock; 7extern spinlock_t imx_ccm_lock;
8 8
9void imx_check_clocks(struct clk *clks[], unsigned int count);
10
9extern void imx_cscmr1_fixup(u32 *val); 11extern void imx_cscmr1_fixup(u32 *val);
10 12
11struct clk *imx_clk_pllv1(const char *name, const char *parent, 13struct clk *imx_clk_pllv1(const char *name, const char *parent,
@@ -95,6 +97,13 @@ static inline struct clk *imx_clk_gate(const char *name, const char *parent,
95 shift, 0, &imx_ccm_lock); 97 shift, 0, &imx_ccm_lock);
96} 98}
97 99
100static inline struct clk *imx_clk_gate_dis(const char *name, const char *parent,
101 void __iomem *reg, u8 shift)
102{
103 return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
104 shift, CLK_GATE_SET_TO_DISABLE, &imx_ccm_lock);
105}
106
98static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg, 107static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
99 u8 shift, u8 width, const char **parents, int num_parents) 108 u8 shift, u8 width, const char **parents, int num_parents)
100{ 109{
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 9ab785ce13e8..22ba8973bcb9 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -19,6 +19,7 @@ struct pt_regs;
19struct clk; 19struct clk;
20struct device_node; 20struct device_node;
21enum mxc_cpu_pwr_mode; 21enum mxc_cpu_pwr_mode;
22struct of_device_id;
22 23
23void mx1_map_io(void); 24void mx1_map_io(void);
24void mx21_map_io(void); 25void mx21_map_io(void);
@@ -26,48 +27,34 @@ void mx25_map_io(void);
26void mx27_map_io(void); 27void mx27_map_io(void);
27void mx31_map_io(void); 28void mx31_map_io(void);
28void mx35_map_io(void); 29void mx35_map_io(void);
29void mx51_map_io(void);
30void mx53_map_io(void);
31void imx1_init_early(void); 30void imx1_init_early(void);
32void imx21_init_early(void); 31void imx21_init_early(void);
33void imx25_init_early(void); 32void imx25_init_early(void);
34void imx27_init_early(void); 33void imx27_init_early(void);
35void imx31_init_early(void); 34void imx31_init_early(void);
36void imx35_init_early(void); 35void imx35_init_early(void);
37void imx51_init_early(void);
38void imx53_init_early(void);
39void mxc_init_irq(void __iomem *); 36void mxc_init_irq(void __iomem *);
40void tzic_init_irq(void __iomem *); 37void tzic_init_irq(void);
41void mx1_init_irq(void); 38void mx1_init_irq(void);
42void mx21_init_irq(void); 39void mx21_init_irq(void);
43void mx25_init_irq(void); 40void mx25_init_irq(void);
44void mx27_init_irq(void); 41void mx27_init_irq(void);
45void mx31_init_irq(void); 42void mx31_init_irq(void);
46void mx35_init_irq(void); 43void mx35_init_irq(void);
47void mx51_init_irq(void);
48void mx53_init_irq(void);
49void imx1_soc_init(void); 44void imx1_soc_init(void);
50void imx21_soc_init(void); 45void imx21_soc_init(void);
51void imx25_soc_init(void); 46void imx25_soc_init(void);
52void imx27_soc_init(void); 47void imx27_soc_init(void);
53void imx31_soc_init(void); 48void imx31_soc_init(void);
54void imx35_soc_init(void); 49void imx35_soc_init(void);
55void imx51_soc_init(void);
56void imx51_init_late(void);
57void imx53_init_late(void);
58void epit_timer_init(void __iomem *base, int irq); 50void epit_timer_init(void __iomem *base, int irq);
59void mxc_timer_init(void __iomem *, int); 51void mxc_timer_init(void __iomem *, int);
60void mxc_timer_init_dt(struct device_node *);
61int mx1_clocks_init(unsigned long fref); 52int mx1_clocks_init(unsigned long fref);
62int mx21_clocks_init(unsigned long lref, unsigned long fref); 53int mx21_clocks_init(unsigned long lref, unsigned long fref);
63int mx25_clocks_init(void); 54int mx25_clocks_init(void);
64int mx27_clocks_init(unsigned long fref); 55int mx27_clocks_init(unsigned long fref);
65int mx31_clocks_init(unsigned long fref); 56int mx31_clocks_init(unsigned long fref);
66int mx35_clocks_init(void); 57int mx35_clocks_init(void);
67int mx51_clocks_init(unsigned long ckil, unsigned long osc,
68 unsigned long ckih1, unsigned long ckih2);
69int mx25_clocks_init_dt(void);
70int mx27_clocks_init_dt(void);
71int mx31_clocks_init_dt(void); 58int mx31_clocks_init_dt(void);
72struct platform_device *mxc_register_gpio(char *name, int id, 59struct platform_device *mxc_register_gpio(char *name, int id,
73 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); 60 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
@@ -75,8 +62,10 @@ void mxc_set_cpu_type(unsigned int type);
75void mxc_restart(enum reboot_mode, const char *); 62void mxc_restart(enum reboot_mode, const char *);
76void mxc_arch_reset_init(void __iomem *); 63void mxc_arch_reset_init(void __iomem *);
77void mxc_arch_reset_init_dt(void); 64void mxc_arch_reset_init_dt(void);
65int mx51_revision(void);
78int mx53_revision(void); 66int mx53_revision(void);
79void imx_set_aips(void __iomem *); 67void imx_set_aips(void __iomem *);
68void imx_aips_allow_unprivileged_access(const char *compat);
80int mxc_device_init(void); 69int mxc_device_init(void);
81void imx_set_soc_revision(unsigned int rev); 70void imx_set_soc_revision(unsigned int rev);
82unsigned int imx_get_soc_revision(void); 71unsigned int imx_get_soc_revision(void);
@@ -117,7 +106,7 @@ static inline void imx_scu_standby_enable(void) {}
117#endif 106#endif
118void imx_src_init(void); 107void imx_src_init(void);
119void imx_gpc_init(void); 108void imx_gpc_init(void);
120void imx_gpc_pre_suspend(void); 109void imx_gpc_pre_suspend(bool arm_power_off);
121void imx_gpc_post_resume(void); 110void imx_gpc_post_resume(void);
122void imx_gpc_mask_all(void); 111void imx_gpc_mask_all(void);
123void imx_gpc_restore_all(void); 112void imx_gpc_restore_all(void);
@@ -127,7 +116,7 @@ void imx_anatop_init(void);
127void imx_anatop_pre_suspend(void); 116void imx_anatop_pre_suspend(void);
128void imx_anatop_post_resume(void); 117void imx_anatop_post_resume(void);
129int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); 118int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
130void imx6q_set_int_mem_clk_lpm(void); 119void imx6q_set_int_mem_clk_lpm(bool enable);
131void imx6sl_set_wait_clk(bool enter); 120void imx6sl_set_wait_clk(bool enter);
132 121
133void imx_cpu_die(unsigned int cpu); 122void imx_cpu_die(unsigned int cpu);
@@ -144,12 +133,17 @@ static inline void imx6_suspend(void __iomem *ocram_vbase) {}
144void imx6q_pm_init(void); 133void imx6q_pm_init(void);
145void imx6dl_pm_init(void); 134void imx6dl_pm_init(void);
146void imx6sl_pm_init(void); 135void imx6sl_pm_init(void);
136void imx6sx_pm_init(void);
147void imx6q_pm_set_ccm_base(void __iomem *base); 137void imx6q_pm_set_ccm_base(void __iomem *base);
148 138
149#ifdef CONFIG_PM 139#ifdef CONFIG_PM
150void imx5_pm_init(void); 140void imx51_pm_init(void);
141void imx53_pm_init(void);
142void imx5_pm_set_ccm_base(void __iomem *base);
151#else 143#else
152static inline void imx5_pm_init(void) {} 144static inline void imx51_pm_init(void) {}
145static inline void imx53_pm_init(void) {}
146static inline void imx5_pm_set_ccm_base(void __iomem *base) {}
153#endif 147#endif
154 148
155#ifdef CONFIG_NEON 149#ifdef CONFIG_NEON
diff --git a/arch/arm/mach-imx/cpu-imx5.c b/arch/arm/mach-imx/cpu-imx5.c
index c1c99a72c6a1..3403bac94a31 100644
--- a/arch/arm/mach-imx/cpu-imx5.c
+++ b/arch/arm/mach-imx/cpu-imx5.c
@@ -16,6 +16,8 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
19 21
20#include "hardware.h" 22#include "hardware.h"
21#include "common.h" 23#include "common.h"
@@ -24,10 +26,26 @@ static int mx5_cpu_rev = -1;
24 26
25#define IIM_SREV 0x24 27#define IIM_SREV 0x24
26 28
29static u32 imx5_read_srev_reg(const char *compat)
30{
31 void __iomem *iim_base;
32 struct device_node *np;
33 u32 srev;
34
35 np = of_find_compatible_node(NULL, NULL, compat);
36 iim_base = of_iomap(np, 0);
37 WARN_ON(!iim_base);
38
39 srev = readl(iim_base + IIM_SREV) & 0xff;
40
41 iounmap(iim_base);
42
43 return srev;
44}
45
27static int get_mx51_srev(void) 46static int get_mx51_srev(void)
28{ 47{
29 void __iomem *iim_base = MX51_IO_ADDRESS(MX51_IIM_BASE_ADDR); 48 u32 rev = imx5_read_srev_reg("fsl,imx51-iim");
30 u32 rev = readl(iim_base + IIM_SREV) & 0xff;
31 49
32 switch (rev) { 50 switch (rev) {
33 case 0x0: 51 case 0x0:
@@ -77,8 +95,7 @@ int __init mx51_neon_fixup(void)
77 95
78static int get_mx53_srev(void) 96static int get_mx53_srev(void)
79{ 97{
80 void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR); 98 u32 rev = imx5_read_srev_reg("fsl,imx53-iim");
81 u32 rev = readl(iim_base + IIM_SREV) & 0xff;
82 99
83 switch (rev) { 100 switch (rev) {
84 case 0x0: 101 case 0x0:
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index bbe8ff1f0412..df42c14ff749 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -2,6 +2,7 @@
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/io.h> 3#include <linux/io.h>
4#include <linux/of.h> 4#include <linux/of.h>
5#include <linux/of_address.h>
5#include <linux/slab.h> 6#include <linux/slab.h>
6#include <linux/sys_soc.h> 7#include <linux/sys_soc.h>
7 8
@@ -60,6 +61,18 @@ void __init imx_set_aips(void __iomem *base)
60 __raw_writel(reg, base + 0x50); 61 __raw_writel(reg, base + 0x50);
61} 62}
62 63
64void __init imx_aips_allow_unprivileged_access(
65 const char *compat)
66{
67 void __iomem *aips_base_addr;
68 struct device_node *np;
69
70 for_each_compatible_node(np, NULL, compat) {
71 aips_base_addr = of_iomap(np, 0);
72 imx_set_aips(aips_base_addr);
73 }
74}
75
63struct device * __init imx_soc_device_init(void) 76struct device * __init imx_soc_device_init(void)
64{ 77{
65 struct soc_device_attribute *soc_dev_attr; 78 struct soc_device_attribute *soc_dev_attr;
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index 6bcae0479049..10844d3bb926 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -13,6 +13,7 @@
13 13
14#include "common.h" 14#include "common.h"
15#include "cpuidle.h" 15#include "cpuidle.h"
16#include "hardware.h"
16 17
17static atomic_t master = ATOMIC_INIT(0); 18static atomic_t master = ATOMIC_INIT(0);
18static DEFINE_SPINLOCK(master_lock); 19static DEFINE_SPINLOCK(master_lock);
@@ -66,10 +67,11 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
66int __init imx6q_cpuidle_init(void) 67int __init imx6q_cpuidle_init(void)
67{ 68{
68 /* Need to enable SCU standby for entering WAIT modes */ 69 /* Need to enable SCU standby for entering WAIT modes */
69 imx_scu_standby_enable(); 70 if (!cpu_is_imx6sx())
71 imx_scu_standby_enable();
70 72
71 /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */ 73 /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */
72 imx6q_set_int_mem_clk_lpm(); 74 imx6q_set_int_mem_clk_lpm(true);
73 75
74 return cpuidle_register(&imx6q_cpuidle_driver, NULL); 76 return cpuidle_register(&imx6q_cpuidle_driver, NULL);
75} 77}
diff --git a/arch/arm/mach-imx/crm-regs-imx5.h b/arch/arm/mach-imx/crm-regs-imx5.h
deleted file mode 100644
index 5e3f1f0f4cab..000000000000
--- a/arch/arm/mach-imx/crm-regs-imx5.h
+++ /dev/null
@@ -1,600 +0,0 @@
1/*
2 * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11#ifndef __ARCH_ARM_MACH_MX51_CRM_REGS_H__
12#define __ARCH_ARM_MACH_MX51_CRM_REGS_H__
13
14#define MX51_CCM_BASE MX51_IO_ADDRESS(MX51_CCM_BASE_ADDR)
15#define MX51_DPLL1_BASE MX51_IO_ADDRESS(MX51_PLL1_BASE_ADDR)
16#define MX51_DPLL2_BASE MX51_IO_ADDRESS(MX51_PLL2_BASE_ADDR)
17#define MX51_DPLL3_BASE MX51_IO_ADDRESS(MX51_PLL3_BASE_ADDR)
18#define MX51_CORTEXA8_BASE MX51_IO_ADDRESS(MX51_ARM_BASE_ADDR)
19#define MX51_GPC_BASE MX51_IO_ADDRESS(MX51_GPC_BASE_ADDR)
20
21/*MX53*/
22#define MX53_CCM_BASE MX53_IO_ADDRESS(MX53_CCM_BASE_ADDR)
23#define MX53_DPLL1_BASE MX53_IO_ADDRESS(MX53_PLL1_BASE_ADDR)
24#define MX53_DPLL2_BASE MX53_IO_ADDRESS(MX53_PLL2_BASE_ADDR)
25#define MX53_DPLL3_BASE MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR)
26#define MX53_DPLL4_BASE MX53_IO_ADDRESS(MX53_PLL4_BASE_ADDR)
27
28/* PLL Register Offsets */
29#define MXC_PLL_DP_CTL 0x00
30#define MXC_PLL_DP_CONFIG 0x04
31#define MXC_PLL_DP_OP 0x08
32#define MXC_PLL_DP_MFD 0x0C
33#define MXC_PLL_DP_MFN 0x10
34#define MXC_PLL_DP_MFNMINUS 0x14
35#define MXC_PLL_DP_MFNPLUS 0x18
36#define MXC_PLL_DP_HFS_OP 0x1C
37#define MXC_PLL_DP_HFS_MFD 0x20
38#define MXC_PLL_DP_HFS_MFN 0x24
39#define MXC_PLL_DP_MFN_TOGC 0x28
40#define MXC_PLL_DP_DESTAT 0x2c
41
42/* PLL Register Bit definitions */
43#define MXC_PLL_DP_CTL_MUL_CTRL 0x2000
44#define MXC_PLL_DP_CTL_DPDCK0_2_EN 0x1000
45#define MXC_PLL_DP_CTL_DPDCK0_2_OFFSET 12
46#define MXC_PLL_DP_CTL_ADE 0x800
47#define MXC_PLL_DP_CTL_REF_CLK_DIV 0x400
48#define MXC_PLL_DP_CTL_REF_CLK_SEL_MASK (3 << 8)
49#define MXC_PLL_DP_CTL_REF_CLK_SEL_OFFSET 8
50#define MXC_PLL_DP_CTL_HFSM 0x80
51#define MXC_PLL_DP_CTL_PRE 0x40
52#define MXC_PLL_DP_CTL_UPEN 0x20
53#define MXC_PLL_DP_CTL_RST 0x10
54#define MXC_PLL_DP_CTL_RCP 0x8
55#define MXC_PLL_DP_CTL_PLM 0x4
56#define MXC_PLL_DP_CTL_BRM0 0x2
57#define MXC_PLL_DP_CTL_LRF 0x1
58
59#define MXC_PLL_DP_CONFIG_BIST 0x8
60#define MXC_PLL_DP_CONFIG_SJC_CE 0x4
61#define MXC_PLL_DP_CONFIG_AREN 0x2
62#define MXC_PLL_DP_CONFIG_LDREQ 0x1
63
64#define MXC_PLL_DP_OP_MFI_OFFSET 4
65#define MXC_PLL_DP_OP_MFI_MASK (0xF << 4)
66#define MXC_PLL_DP_OP_PDF_OFFSET 0
67#define MXC_PLL_DP_OP_PDF_MASK 0xF
68
69#define MXC_PLL_DP_MFD_OFFSET 0
70#define MXC_PLL_DP_MFD_MASK 0x07FFFFFF
71
72#define MXC_PLL_DP_MFN_OFFSET 0x0
73#define MXC_PLL_DP_MFN_MASK 0x07FFFFFF
74
75#define MXC_PLL_DP_MFN_TOGC_TOG_DIS (1 << 17)
76#define MXC_PLL_DP_MFN_TOGC_TOG_EN (1 << 16)
77#define MXC_PLL_DP_MFN_TOGC_CNT_OFFSET 0x0
78#define MXC_PLL_DP_MFN_TOGC_CNT_MASK 0xFFFF
79
80#define MXC_PLL_DP_DESTAT_TOG_SEL (1 << 31)
81#define MXC_PLL_DP_DESTAT_MFN 0x07FFFFFF
82
83/* Register addresses of CCM*/
84#define MXC_CCM_CCR (MX51_CCM_BASE + 0x00)
85#define MXC_CCM_CCDR (MX51_CCM_BASE + 0x04)
86#define MXC_CCM_CSR (MX51_CCM_BASE + 0x08)
87#define MXC_CCM_CCSR (MX51_CCM_BASE + 0x0C)
88#define MXC_CCM_CACRR (MX51_CCM_BASE + 0x10)
89#define MXC_CCM_CBCDR (MX51_CCM_BASE + 0x14)
90#define MXC_CCM_CBCMR (MX51_CCM_BASE + 0x18)
91#define MXC_CCM_CSCMR1 (MX51_CCM_BASE + 0x1C)
92#define MXC_CCM_CSCMR2 (MX51_CCM_BASE + 0x20)
93#define MXC_CCM_CSCDR1 (MX51_CCM_BASE + 0x24)
94#define MXC_CCM_CS1CDR (MX51_CCM_BASE + 0x28)
95#define MXC_CCM_CS2CDR (MX51_CCM_BASE + 0x2C)
96#define MXC_CCM_CDCDR (MX51_CCM_BASE + 0x30)
97#define MXC_CCM_CHSCDR (MX51_CCM_BASE + 0x34)
98#define MXC_CCM_CSCDR2 (MX51_CCM_BASE + 0x38)
99#define MXC_CCM_CSCDR3 (MX51_CCM_BASE + 0x3C)
100#define MXC_CCM_CSCDR4 (MX51_CCM_BASE + 0x40)
101#define MXC_CCM_CWDR (MX51_CCM_BASE + 0x44)
102#define MXC_CCM_CDHIPR (MX51_CCM_BASE + 0x48)
103#define MXC_CCM_CDCR (MX51_CCM_BASE + 0x4C)
104#define MXC_CCM_CTOR (MX51_CCM_BASE + 0x50)
105#define MXC_CCM_CLPCR (MX51_CCM_BASE + 0x54)
106#define MXC_CCM_CISR (MX51_CCM_BASE + 0x58)
107#define MXC_CCM_CIMR (MX51_CCM_BASE + 0x5C)
108#define MXC_CCM_CCOSR (MX51_CCM_BASE + 0x60)
109#define MXC_CCM_CGPR (MX51_CCM_BASE + 0x64)
110#define MXC_CCM_CCGR0 (MX51_CCM_BASE + 0x68)
111#define MXC_CCM_CCGR1 (MX51_CCM_BASE + 0x6C)
112#define MXC_CCM_CCGR2 (MX51_CCM_BASE + 0x70)
113#define MXC_CCM_CCGR3 (MX51_CCM_BASE + 0x74)
114#define MXC_CCM_CCGR4 (MX51_CCM_BASE + 0x78)
115#define MXC_CCM_CCGR5 (MX51_CCM_BASE + 0x7C)
116#define MXC_CCM_CCGR6 (MX51_CCM_BASE + 0x80)
117#define MXC_CCM_CCGR7 (MX51_CCM_BASE + 0x84)
118
119#define MXC_CCM_CMEOR (MX51_CCM_BASE + 0x84)
120
121/* Define the bits in register CCR */
122#define MXC_CCM_CCR_COSC_EN (1 << 12)
123#define MXC_CCM_CCR_FPM_MULT_MASK (1 << 11)
124#define MXC_CCM_CCR_CAMP2_EN (1 << 10)
125#define MXC_CCM_CCR_CAMP1_EN (1 << 9)
126#define MXC_CCM_CCR_FPM_EN (1 << 8)
127#define MXC_CCM_CCR_OSCNT_OFFSET (0)
128#define MXC_CCM_CCR_OSCNT_MASK (0xFF)
129
130/* Define the bits in register CCDR */
131#define MXC_CCM_CCDR_HSC_HS_MASK (0x1 << 18)
132#define MXC_CCM_CCDR_IPU_HS_MASK (0x1 << 17)
133#define MXC_CCM_CCDR_EMI_HS_MASK (0x1 << 16)
134
135/* Define the bits in register CSR */
136#define MXC_CCM_CSR_COSR_READY (1 << 5)
137#define MXC_CCM_CSR_LVS_VALUE (1 << 4)
138#define MXC_CCM_CSR_CAMP2_READY (1 << 3)
139#define MXC_CCM_CSR_CAMP1_READY (1 << 2)
140#define MXC_CCM_CSR_FPM_READY (1 << 1)
141#define MXC_CCM_CSR_REF_EN_B (1 << 0)
142
143/* Define the bits in register CCSR */
144#define MXC_CCM_CCSR_LP_APM_SEL (0x1 << 9)
145#define MXC_CCM_CCSR_STEP_SEL_OFFSET (7)
146#define MXC_CCM_CCSR_STEP_SEL_MASK (0x3 << 7)
147#define MXC_CCM_CCSR_STEP_SEL_LP_APM 0
148#define MXC_CCM_CCSR_STEP_SEL_PLL1_BYPASS 1 /* Only when JTAG connected? */
149#define MXC_CCM_CCSR_STEP_SEL_PLL2_DIVIDED 2
150#define MXC_CCM_CCSR_STEP_SEL_PLL3_DIVIDED 3
151#define MXC_CCM_CCSR_PLL2_PODF_OFFSET (5)
152#define MXC_CCM_CCSR_PLL2_PODF_MASK (0x3 << 5)
153#define MXC_CCM_CCSR_PLL3_PODF_OFFSET (3)
154#define MXC_CCM_CCSR_PLL3_PODF_MASK (0x3 << 3)
155#define MXC_CCM_CCSR_PLL1_SW_CLK_SEL (1 << 2) /* 0: pll1_main_clk,
156 1: step_clk */
157#define MXC_CCM_CCSR_PLL2_SW_CLK_SEL (1 << 1)
158#define MXC_CCM_CCSR_PLL3_SW_CLK_SEL (1 << 0)
159
160/* Define the bits in register CACRR */
161#define MXC_CCM_CACRR_ARM_PODF_OFFSET (0)
162#define MXC_CCM_CACRR_ARM_PODF_MASK (0x7)
163
164/* Define the bits in register CBCDR */
165#define MXC_CCM_CBCDR_EMI_CLK_SEL (0x1 << 26)
166#define MXC_CCM_CBCDR_PERIPH_CLK_SEL (0x1 << 25)
167#define MXC_CCM_CBCDR_DDR_HF_SEL_OFFSET (30)
168#define MXC_CCM_CBCDR_DDR_HF_SEL (0x1 << 30)
169#define MXC_CCM_CBCDR_DDR_PODF_OFFSET (27)
170#define MXC_CCM_CBCDR_DDR_PODF_MASK (0x7 << 27)
171#define MXC_CCM_CBCDR_EMI_PODF_OFFSET (22)
172#define MXC_CCM_CBCDR_EMI_PODF_MASK (0x7 << 22)
173#define MXC_CCM_CBCDR_AXI_B_PODF_OFFSET (19)
174#define MXC_CCM_CBCDR_AXI_B_PODF_MASK (0x7 << 19)
175#define MXC_CCM_CBCDR_AXI_A_PODF_OFFSET (16)
176#define MXC_CCM_CBCDR_AXI_A_PODF_MASK (0x7 << 16)
177#define MXC_CCM_CBCDR_NFC_PODF_OFFSET (13)
178#define MXC_CCM_CBCDR_NFC_PODF_MASK (0x7 << 13)
179#define MXC_CCM_CBCDR_AHB_PODF_OFFSET (10)
180#define MXC_CCM_CBCDR_AHB_PODF_MASK (0x7 << 10)
181#define MXC_CCM_CBCDR_IPG_PODF_OFFSET (8)
182#define MXC_CCM_CBCDR_IPG_PODF_MASK (0x3 << 8)
183#define MXC_CCM_CBCDR_PERCLK_PRED1_OFFSET (6)
184#define MXC_CCM_CBCDR_PERCLK_PRED1_MASK (0x3 << 6)
185#define MXC_CCM_CBCDR_PERCLK_PRED2_OFFSET (3)
186#define MXC_CCM_CBCDR_PERCLK_PRED2_MASK (0x7 << 3)
187#define MXC_CCM_CBCDR_PERCLK_PODF_OFFSET (0)
188#define MXC_CCM_CBCDR_PERCLK_PODF_MASK (0x7)
189
190/* Define the bits in register CBCMR */
191#define MXC_CCM_CBCMR_VPU_AXI_CLK_SEL_OFFSET (14)
192#define MXC_CCM_CBCMR_VPU_AXI_CLK_SEL_MASK (0x3 << 14)
193#define MXC_CCM_CBCMR_PERIPH_CLK_SEL_OFFSET (12)
194#define MXC_CCM_CBCMR_PERIPH_CLK_SEL_MASK (0x3 << 12)
195#define MXC_CCM_CBCMR_DDR_CLK_SEL_OFFSET (10)
196#define MXC_CCM_CBCMR_DDR_CLK_SEL_MASK (0x3 << 10)
197#define MXC_CCM_CBCMR_ARM_AXI_CLK_SEL_OFFSET (8)
198#define MXC_CCM_CBCMR_ARM_AXI_CLK_SEL_MASK (0x3 << 8)
199#define MXC_CCM_CBCMR_IPU_HSP_CLK_SEL_OFFSET (6)
200#define MXC_CCM_CBCMR_IPU_HSP_CLK_SEL_MASK (0x3 << 6)
201#define MXC_CCM_CBCMR_GPU_CLK_SEL_OFFSET (4)
202#define MXC_CCM_CBCMR_GPU_CLK_SEL_MASK (0x3 << 4)
203#define MXC_CCM_CBCMR_GPU2D_CLK_SEL_OFFSET (14)
204#define MXC_CCM_CBCMR_GPU2D_CLK_SEL_MASK (0x3 << 14)
205#define MXC_CCM_CBCMR_PERCLK_LP_APM_CLK_SEL (0x1 << 1)
206#define MXC_CCM_CBCMR_PERCLK_IPG_CLK_SEL (0x1 << 0)
207
208/* Define the bits in register CSCMR1 */
209#define MXC_CCM_CSCMR1_SSI_EXT2_CLK_SEL_OFFSET (30)
210#define MXC_CCM_CSCMR1_SSI_EXT2_CLK_SEL_MASK (0x3 << 30)
211#define MXC_CCM_CSCMR1_SSI_EXT1_CLK_SEL_OFFSET (28)
212#define MXC_CCM_CSCMR1_SSI_EXT1_CLK_SEL_MASK (0x3 << 28)
213#define MXC_CCM_CSCMR1_USB_PHY_CLK_SEL_OFFSET (26)
214#define MXC_CCM_CSCMR1_USB_PHY_CLK_SEL (0x1 << 26)
215#define MXC_CCM_CSCMR1_UART_CLK_SEL_OFFSET (24)
216#define MXC_CCM_CSCMR1_UART_CLK_SEL_MASK (0x3 << 24)
217#define MXC_CCM_CSCMR1_USBOH3_CLK_SEL_OFFSET (22)
218#define MXC_CCM_CSCMR1_USBOH3_CLK_SEL_MASK (0x3 << 22)
219#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_OFFSET (20)
220#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_MASK (0x3 << 20)
221#define MXC_CCM_CSCMR1_ESDHC3_CLK_SEL (0x1 << 19)
222#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_MX53_CLK_SEL (0x1 << 19)
223#define MXC_CCM_CSCMR1_ESDHC4_CLK_SEL (0x1 << 18)
224#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_OFFSET (16)
225#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_MASK (0x3 << 16)
226#define MXC_CCM_CSCMR1_ESDHC3_MX53_CLK_SEL_OFFSET (16)
227#define MXC_CCM_CSCMR1_ESDHC3_MX53_CLK_SEL_MASK (0x3 << 16)
228#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_OFFSET (14)
229#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_MASK (0x3 << 14)
230#define MXC_CCM_CSCMR1_SSI2_CLK_SEL_OFFSET (12)
231#define MXC_CCM_CSCMR1_SSI2_CLK_SEL_MASK (0x3 << 12)
232#define MXC_CCM_CSCMR1_SSI3_CLK_SEL (0x1 << 11)
233#define MXC_CCM_CSCMR1_VPU_RCLK_SEL (0x1 << 10)
234#define MXC_CCM_CSCMR1_SSI_APM_CLK_SEL_OFFSET (8)
235#define MXC_CCM_CSCMR1_SSI_APM_CLK_SEL_MASK (0x3 << 8)
236#define MXC_CCM_CSCMR1_TVE_CLK_SEL (0x1 << 7)
237#define MXC_CCM_CSCMR1_TVE_EXT_CLK_SEL (0x1 << 6)
238#define MXC_CCM_CSCMR1_CSPI_CLK_SEL_OFFSET (4)
239#define MXC_CCM_CSCMR1_CSPI_CLK_SEL_MASK (0x3 << 4)
240#define MXC_CCM_CSCMR1_SPDIF_CLK_SEL_OFFSET (2)
241#define MXC_CCM_CSCMR1_SPDIF_CLK_SEL_MASK (0x3 << 2)
242#define MXC_CCM_CSCMR1_SSI_EXT2_COM_CLK_SEL (0x1 << 1)
243#define MXC_CCM_CSCMR1_SSI_EXT1_COM_CLK_SEL (0x1)
244
245/* Define the bits in register CSCMR2 */
246#define MXC_CCM_CSCMR2_DI_CLK_SEL_OFFSET(n) (26+n*3)
247#define MXC_CCM_CSCMR2_DI_CLK_SEL_MASK(n) (0x7 << (26+n*3))
248#define MXC_CCM_CSCMR2_CSI_MCLK2_CLK_SEL_OFFSET (24)
249#define MXC_CCM_CSCMR2_CSI_MCLK2_CLK_SEL_MASK (0x3 << 24)
250#define MXC_CCM_CSCMR2_CSI_MCLK1_CLK_SEL_OFFSET (22)
251#define MXC_CCM_CSCMR2_CSI_MCLK1_CLK_SEL_MASK (0x3 << 22)
252#define MXC_CCM_CSCMR2_ESC_CLK_SEL_OFFSET (20)
253#define MXC_CCM_CSCMR2_ESC_CLK_SEL_MASK (0x3 << 20)
254#define MXC_CCM_CSCMR2_HSC2_CLK_SEL_OFFSET (18)
255#define MXC_CCM_CSCMR2_HSC2_CLK_SEL_MASK (0x3 << 18)
256#define MXC_CCM_CSCMR2_HSC1_CLK_SEL_OFFSET (16)
257#define MXC_CCM_CSCMR2_HSC1_CLK_SEL_MASK (0x3 << 16)
258#define MXC_CCM_CSCMR2_HSI2C_CLK_SEL_OFFSET (14)
259#define MXC_CCM_CSCMR2_HSI2C_CLK_SEL_MASK (0x3 << 14)
260#define MXC_CCM_CSCMR2_FIRI_CLK_SEL_OFFSET (12)
261#define MXC_CCM_CSCMR2_FIRI_CLK_SEL_MASK (0x3 << 12)
262#define MXC_CCM_CSCMR2_SIM_CLK_SEL_OFFSET (10)
263#define MXC_CCM_CSCMR2_SIM_CLK_SEL_MASK (0x3 << 10)
264#define MXC_CCM_CSCMR2_SLIMBUS_COM (0x1 << 9)
265#define MXC_CCM_CSCMR2_SLIMBUS_CLK_SEL_OFFSET (6)
266#define MXC_CCM_CSCMR2_SLIMBUS_CLK_SEL_MASK (0x7 << 6)
267#define MXC_CCM_CSCMR2_SPDIF1_COM (1 << 5)
268#define MXC_CCM_CSCMR2_SPDIF0_COM (1 << 4)
269#define MXC_CCM_CSCMR2_SPDIF1_CLK_SEL_OFFSET (2)
270#define MXC_CCM_CSCMR2_SPDIF1_CLK_SEL_MASK (0x3 << 2)
271#define MXC_CCM_CSCMR2_SPDIF0_CLK_SEL_OFFSET (0)
272#define MXC_CCM_CSCMR2_SPDIF0_CLK_SEL_MASK (0x3)
273
274/* Define the bits in register CSCDR1 */
275#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PRED_OFFSET (22)
276#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PRED_MASK (0x7 << 22)
277#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_OFFSET (19)
278#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_MASK (0x7 << 19)
279#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PRED_OFFSET (22)
280#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PRED_MASK (0x7 << 22)
281#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PODF_OFFSET (19)
282#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PODF_MASK (0x7 << 19)
283#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_OFFSET (16)
284#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_MASK (0x7 << 16)
285#define MXC_CCM_CSCDR1_PGC_CLK_PODF_OFFSET (14)
286#define MXC_CCM_CSCDR1_PGC_CLK_PODF_MASK (0x3 << 14)
287#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PODF_OFFSET (11)
288#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PODF_MASK (0x7 << 11)
289#define MXC_CCM_CSCDR1_USBOH3_CLK_PRED_OFFSET (8)
290#define MXC_CCM_CSCDR1_USBOH3_CLK_PRED_MASK (0x7 << 8)
291#define MXC_CCM_CSCDR1_USBOH3_CLK_PODF_OFFSET (6)
292#define MXC_CCM_CSCDR1_USBOH3_CLK_PODF_MASK (0x3 << 6)
293#define MXC_CCM_CSCDR1_UART_CLK_PRED_OFFSET (3)
294#define MXC_CCM_CSCDR1_UART_CLK_PRED_MASK (0x7 << 3)
295#define MXC_CCM_CSCDR1_UART_CLK_PODF_OFFSET (0)
296#define MXC_CCM_CSCDR1_UART_CLK_PODF_MASK (0x7)
297
298/* Define the bits in register CS1CDR and CS2CDR */
299#define MXC_CCM_CS1CDR_SSI_EXT1_CLK_PRED_OFFSET (22)
300#define MXC_CCM_CS1CDR_SSI_EXT1_CLK_PRED_MASK (0x7 << 22)
301#define MXC_CCM_CS1CDR_SSI_EXT1_CLK_PODF_OFFSET (16)
302#define MXC_CCM_CS1CDR_SSI_EXT1_CLK_PODF_MASK (0x3F << 16)
303#define MXC_CCM_CS1CDR_SSI1_CLK_PRED_OFFSET (6)
304#define MXC_CCM_CS1CDR_SSI1_CLK_PRED_MASK (0x7 << 6)
305#define MXC_CCM_CS1CDR_SSI1_CLK_PODF_OFFSET (0)
306#define MXC_CCM_CS1CDR_SSI1_CLK_PODF_MASK (0x3F)
307
308#define MXC_CCM_CS2CDR_SSI_EXT2_CLK_PRED_OFFSET (22)
309#define MXC_CCM_CS2CDR_SSI_EXT2_CLK_PRED_MASK (0x7 << 22)
310#define MXC_CCM_CS2CDR_SSI_EXT2_CLK_PODF_OFFSET (16)
311#define MXC_CCM_CS2CDR_SSI_EXT2_CLK_PODF_MASK (0x3F << 16)
312#define MXC_CCM_CS2CDR_SSI2_CLK_PRED_OFFSET (6)
313#define MXC_CCM_CS2CDR_SSI2_CLK_PRED_MASK (0x7 << 6)
314#define MXC_CCM_CS2CDR_SSI2_CLK_PODF_OFFSET (0)
315#define MXC_CCM_CS2CDR_SSI2_CLK_PODF_MASK (0x3F)
316
317/* Define the bits in register CDCDR */
318#define MXC_CCM_CDCDR_TVE_CLK_PRED_OFFSET (28)
319#define MXC_CCM_CDCDR_TVE_CLK_PRED_MASK (0x7 << 28)
320#define MXC_CCM_CDCDR_SPDIF0_CLK_PRED_OFFSET (25)
321#define MXC_CCM_CDCDR_SPDIF0_CLK_PRED_MASK (0x7 << 25)
322#define MXC_CCM_CDCDR_SPDIF0_CLK_PODF_OFFSET (19)
323#define MXC_CCM_CDCDR_SPDIF0_CLK_PODF_MASK (0x3F << 19)
324#define MXC_CCM_CDCDR_SPDIF1_CLK_PRED_OFFSET (16)
325#define MXC_CCM_CDCDR_SPDIF1_CLK_PRED_MASK (0x7 << 16)
326#define MXC_CCM_CDCDR_SPDIF1_CLK_PODF_OFFSET (9)
327#define MXC_CCM_CDCDR_SPDIF1_CLK_PODF_MASK (0x3F << 9)
328#define MXC_CCM_CDCDR_DI_CLK_PRED_OFFSET (6)
329#define MXC_CCM_CDCDR_DI_CLK_PRED_MASK (0x7 << 6)
330#define MXC_CCM_CDCDR_USB_PHY_PRED_OFFSET (3)
331#define MXC_CCM_CDCDR_USB_PHY_PRED_MASK (0x7 << 3)
332#define MXC_CCM_CDCDR_USB_PHY_PODF_OFFSET (0)
333#define MXC_CCM_CDCDR_USB_PHY_PODF_MASK (0x7)
334
335/* Define the bits in register CHSCCDR */
336#define MXC_CCM_CHSCCDR_ESC_CLK_PRED_OFFSET (12)
337#define MXC_CCM_CHSCCDR_ESC_CLK_PRED_MASK (0x7 << 12)
338#define MXC_CCM_CHSCCDR_ESC_CLK_PODF_OFFSET (6)
339#define MXC_CCM_CHSCCDR_ESC_CLK_PODF_MASK (0x3F << 6)
340#define MXC_CCM_CHSCCDR_HSC2_CLK_PODF_OFFSET (3)
341#define MXC_CCM_CHSCCDR_HSC2_CLK_PODF_MASK (0x7 << 3)
342#define MXC_CCM_CHSCCDR_HSC1_CLK_PODF_OFFSET (0)
343#define MXC_CCM_CHSCCDR_HSC1_CLK_PODF_MASK (0x7)
344
345/* Define the bits in register CSCDR2 */
346#define MXC_CCM_CSCDR2_CSPI_CLK_PRED_OFFSET (25)
347#define MXC_CCM_CSCDR2_CSPI_CLK_PRED_MASK (0x7 << 25)
348#define MXC_CCM_CSCDR2_CSPI_CLK_PODF_OFFSET (19)
349#define MXC_CCM_CSCDR2_CSPI_CLK_PODF_MASK (0x3F << 19)
350#define MXC_CCM_CSCDR2_SIM_CLK_PRED_OFFSET (16)
351#define MXC_CCM_CSCDR2_SIM_CLK_PRED_MASK (0x7 << 16)
352#define MXC_CCM_CSCDR2_SIM_CLK_PODF_OFFSET (9)
353#define MXC_CCM_CSCDR2_SIM_CLK_PODF_MASK (0x3F << 9)
354#define MXC_CCM_CSCDR2_SLIMBUS_CLK_PRED_OFFSET (6)
355#define MXC_CCM_CSCDR2_SLIMBUS_PRED_MASK (0x7 << 6)
356#define MXC_CCM_CSCDR2_SLIMBUS_PODF_OFFSET (0)
357#define MXC_CCM_CSCDR2_SLIMBUS_PODF_MASK (0x3F)
358
359/* Define the bits in register CSCDR3 */
360#define MXC_CCM_CSCDR3_HSI2C_CLK_PRED_OFFSET (16)
361#define MXC_CCM_CSCDR3_HSI2C_CLK_PRED_MASK (0x7 << 16)
362#define MXC_CCM_CSCDR3_HSI2C_CLK_PODF_OFFSET (9)
363#define MXC_CCM_CSCDR3_HSI2C_CLK_PODF_MASK (0x3F << 9)
364#define MXC_CCM_CSCDR3_FIRI_CLK_PRED_OFFSET (6)
365#define MXC_CCM_CSCDR3_FIRI_CLK_PRED_MASK (0x7 << 6)
366#define MXC_CCM_CSCDR3_FIRI_CLK_PODF_OFFSET (0)
367#define MXC_CCM_CSCDR3_FIRI_CLK_PODF_MASK (0x3F)
368
369/* Define the bits in register CSCDR4 */
370#define MXC_CCM_CSCDR4_CSI_MCLK2_CLK_PRED_OFFSET (16)
371#define MXC_CCM_CSCDR4_CSI_MCLK2_CLK_PRED_MASK (0x7 << 16)
372#define MXC_CCM_CSCDR4_CSI_MCLK2_CLK_PODF_OFFSET (9)
373#define MXC_CCM_CSCDR4_CSI_MCLK2_CLK_PODF_MASK (0x3F << 9)
374#define MXC_CCM_CSCDR4_CSI_MCLK1_CLK_PRED_OFFSET (6)
375#define MXC_CCM_CSCDR4_CSI_MCLK1_CLK_PRED_MASK (0x7 << 6)
376#define MXC_CCM_CSCDR4_CSI_MCLK1_CLK_PODF_OFFSET (0)
377#define MXC_CCM_CSCDR4_CSI_MCLK1_CLK_PODF_MASK (0x3F)
378
379/* Define the bits in register CDHIPR */
380#define MXC_CCM_CDHIPR_ARM_PODF_BUSY (1 << 16)
381#define MXC_CCM_CDHIPR_DDR_HF_CLK_SEL_BUSY (1 << 8)
382#define MXC_CCM_CDHIPR_DDR_PODF_BUSY (1 << 7)
383#define MXC_CCM_CDHIPR_EMI_CLK_SEL_BUSY (1 << 6)
384#define MXC_CCM_CDHIPR_PERIPH_CLK_SEL_BUSY (1 << 5)
385#define MXC_CCM_CDHIPR_NFC_IPG_INT_MEM_PODF_BUSY (1 << 4)
386#define MXC_CCM_CDHIPR_AHB_PODF_BUSY (1 << 3)
387#define MXC_CCM_CDHIPR_EMI_PODF_BUSY (1 << 2)
388#define MXC_CCM_CDHIPR_AXI_B_PODF_BUSY (1 << 1)
389#define MXC_CCM_CDHIPR_AXI_A_PODF_BUSY (1 << 0)
390
391/* Define the bits in register CDCR */
392#define MXC_CCM_CDCR_ARM_FREQ_SHIFT_DIVIDER (0x1 << 2)
393#define MXC_CCM_CDCR_PERIPH_CLK_DVFS_PODF_OFFSET (0)
394#define MXC_CCM_CDCR_PERIPH_CLK_DVFS_PODF_MASK (0x3)
395
396/* Define the bits in register CLPCR */
397#define MXC_CCM_CLPCR_BYPASS_HSC_LPM_HS (0x1 << 23)
398#define MXC_CCM_CLPCR_BYPASS_SCC_LPM_HS (0x1 << 22)
399#define MX51_CCM_CLPCR_BYPASS_MAX_LPM_HS (0x1 << 21)
400#define MX53_CCM_CLPCR_BYPASS_MAX_LPM_HS (0x1 << 25)
401#define MXC_CCM_CLPCR_BYPASS_SDMA_LPM_HS (0x1 << 20)
402#define MXC_CCM_CLPCR_BYPASS_EMI_LPM_HS (0x1 << 19)
403#define MXC_CCM_CLPCR_BYPASS_IPU_LPM_HS (0x1 << 18)
404#define MXC_CCM_CLPCR_BYPASS_RTIC_LPM_HS (0x1 << 17)
405#define MXC_CCM_CLPCR_BYPASS_RNGC_LPM_HS (0x1 << 16)
406#define MXC_CCM_CLPCR_COSC_PWRDOWN (0x1 << 11)
407#define MXC_CCM_CLPCR_STBY_COUNT_OFFSET (9)
408#define MXC_CCM_CLPCR_STBY_COUNT_MASK (0x3 << 9)
409#define MXC_CCM_CLPCR_VSTBY (0x1 << 8)
410#define MXC_CCM_CLPCR_DIS_REF_OSC (0x1 << 7)
411#define MXC_CCM_CLPCR_SBYOS (0x1 << 6)
412#define MXC_CCM_CLPCR_ARM_CLK_DIS_ON_LPM (0x1 << 5)
413#define MXC_CCM_CLPCR_LPSR_CLK_SEL_OFFSET (3)
414#define MXC_CCM_CLPCR_LPSR_CLK_SEL_MASK (0x3 << 3)
415#define MXC_CCM_CLPCR_LPM_OFFSET (0)
416#define MXC_CCM_CLPCR_LPM_MASK (0x3)
417
418/* Define the bits in register CISR */
419#define MXC_CCM_CISR_ARM_PODF_LOADED (0x1 << 25)
420#define MXC_CCM_CISR_NFC_IPG_INT_MEM_PODF_LOADED (0x1 << 21)
421#define MXC_CCM_CISR_AHB_PODF_LOADED (0x1 << 20)
422#define MXC_CCM_CISR_EMI_PODF_LOADED (0x1 << 19)
423#define MXC_CCM_CISR_AXI_B_PODF_LOADED (0x1 << 18)
424#define MXC_CCM_CISR_AXI_A_PODF_LOADED (0x1 << 17)
425#define MXC_CCM_CISR_DIVIDER_LOADED (0x1 << 16)
426#define MXC_CCM_CISR_COSC_READY (0x1 << 6)
427#define MXC_CCM_CISR_CKIH2_READY (0x1 << 5)
428#define MXC_CCM_CISR_CKIH_READY (0x1 << 4)
429#define MXC_CCM_CISR_FPM_READY (0x1 << 3)
430#define MXC_CCM_CISR_LRF_PLL3 (0x1 << 2)
431#define MXC_CCM_CISR_LRF_PLL2 (0x1 << 1)
432#define MXC_CCM_CISR_LRF_PLL1 (0x1)
433
434/* Define the bits in register CIMR */
435#define MXC_CCM_CIMR_MASK_ARM_PODF_LOADED (0x1 << 25)
436#define MXC_CCM_CIMR_MASK_NFC_IPG_INT_MEM_PODF_LOADED (0x1 << 21)
437#define MXC_CCM_CIMR_MASK_EMI_PODF_LOADED (0x1 << 20)
438#define MXC_CCM_CIMR_MASK_AXI_C_PODF_LOADED (0x1 << 19)
439#define MXC_CCM_CIMR_MASK_AXI_B_PODF_LOADED (0x1 << 18)
440#define MXC_CCM_CIMR_MASK_AXI_A_PODF_LOADED (0x1 << 17)
441#define MXC_CCM_CIMR_MASK_DIVIDER_LOADED (0x1 << 16)
442#define MXC_CCM_CIMR_MASK_COSC_READY (0x1 << 5)
443#define MXC_CCM_CIMR_MASK_CKIH_READY (0x1 << 4)
444#define MXC_CCM_CIMR_MASK_FPM_READY (0x1 << 3)
445#define MXC_CCM_CIMR_MASK_LRF_PLL3 (0x1 << 2)
446#define MXC_CCM_CIMR_MASK_LRF_PLL2 (0x1 << 1)
447#define MXC_CCM_CIMR_MASK_LRF_PLL1 (0x1)
448
449/* Define the bits in register CCOSR */
450#define MXC_CCM_CCOSR_CKO2_EN_OFFSET (0x1 << 24)
451#define MXC_CCM_CCOSR_CKO2_DIV_OFFSET (21)
452#define MXC_CCM_CCOSR_CKO2_DIV_MASK (0x7 << 21)
453#define MXC_CCM_CCOSR_CKO2_SEL_OFFSET (16)
454#define MXC_CCM_CCOSR_CKO2_SEL_MASK (0x1F << 16)
455#define MXC_CCM_CCOSR_CKOL_EN (0x1 << 7)
456#define MXC_CCM_CCOSR_CKOL_DIV_OFFSET (4)
457#define MXC_CCM_CCOSR_CKOL_DIV_MASK (0x7 << 4)
458#define MXC_CCM_CCOSR_CKOL_SEL_OFFSET (0)
459#define MXC_CCM_CCOSR_CKOL_SEL_MASK (0xF)
460
461/* Define the bits in registers CGPR */
462#define MXC_CCM_CGPR_EFUSE_PROG_SUPPLY_GATE (0x1 << 4)
463#define MXC_CCM_CGPR_FPM_SEL (0x1 << 3)
464#define MXC_CCM_CGPR_VL_L2BIST_CLKDIV_OFFSET (0)
465#define MXC_CCM_CGPR_VL_L2BIST_CLKDIV_MASK (0x7)
466
467/* Define the bits in registers CCGRx */
468#define MXC_CCM_CCGRx_CG_MASK 0x3
469#define MXC_CCM_CCGRx_MOD_OFF 0x0
470#define MXC_CCM_CCGRx_MOD_ON 0x3
471#define MXC_CCM_CCGRx_MOD_IDLE 0x1
472
473#define MXC_CCM_CCGRx_CG15_MASK (0x3 << 30)
474#define MXC_CCM_CCGRx_CG14_MASK (0x3 << 28)
475#define MXC_CCM_CCGRx_CG13_MASK (0x3 << 26)
476#define MXC_CCM_CCGRx_CG12_MASK (0x3 << 24)
477#define MXC_CCM_CCGRx_CG11_MASK (0x3 << 22)
478#define MXC_CCM_CCGRx_CG10_MASK (0x3 << 20)
479#define MXC_CCM_CCGRx_CG9_MASK (0x3 << 18)
480#define MXC_CCM_CCGRx_CG8_MASK (0x3 << 16)
481#define MXC_CCM_CCGRx_CG5_MASK (0x3 << 10)
482#define MXC_CCM_CCGRx_CG4_MASK (0x3 << 8)
483#define MXC_CCM_CCGRx_CG3_MASK (0x3 << 6)
484#define MXC_CCM_CCGRx_CG2_MASK (0x3 << 4)
485#define MXC_CCM_CCGRx_CG1_MASK (0x3 << 2)
486#define MXC_CCM_CCGRx_CG0_MASK (0x3 << 0)
487
488#define MXC_CCM_CCGRx_CG15_OFFSET 30
489#define MXC_CCM_CCGRx_CG14_OFFSET 28
490#define MXC_CCM_CCGRx_CG13_OFFSET 26
491#define MXC_CCM_CCGRx_CG12_OFFSET 24
492#define MXC_CCM_CCGRx_CG11_OFFSET 22
493#define MXC_CCM_CCGRx_CG10_OFFSET 20
494#define MXC_CCM_CCGRx_CG9_OFFSET 18
495#define MXC_CCM_CCGRx_CG8_OFFSET 16
496#define MXC_CCM_CCGRx_CG7_OFFSET 14
497#define MXC_CCM_CCGRx_CG6_OFFSET 12
498#define MXC_CCM_CCGRx_CG5_OFFSET 10
499#define MXC_CCM_CCGRx_CG4_OFFSET 8
500#define MXC_CCM_CCGRx_CG3_OFFSET 6
501#define MXC_CCM_CCGRx_CG2_OFFSET 4
502#define MXC_CCM_CCGRx_CG1_OFFSET 2
503#define MXC_CCM_CCGRx_CG0_OFFSET 0
504
505#define MXC_DPTC_LP_BASE (MX51_GPC_BASE + 0x80)
506#define MXC_DPTC_GP_BASE (MX51_GPC_BASE + 0x100)
507#define MXC_DVFS_CORE_BASE (MX51_GPC_BASE + 0x180)
508#define MXC_DPTC_PER_BASE (MX51_GPC_BASE + 0x1C0)
509#define MXC_PGC_IPU_BASE (MX51_GPC_BASE + 0x220)
510#define MXC_PGC_VPU_BASE (MX51_GPC_BASE + 0x240)
511#define MXC_PGC_GPU_BASE (MX51_GPC_BASE + 0x260)
512#define MXC_SRPG_NEON_BASE (MX51_GPC_BASE + 0x280)
513#define MXC_SRPG_ARM_BASE (MX51_GPC_BASE + 0x2A0)
514#define MXC_SRPG_EMPGC0_BASE (MX51_GPC_BASE + 0x2C0)
515#define MXC_SRPG_EMPGC1_BASE (MX51_GPC_BASE + 0x2D0)
516#define MXC_SRPG_MEGAMIX_BASE (MX51_GPC_BASE + 0x2E0)
517#define MXC_SRPG_EMI_BASE (MX51_GPC_BASE + 0x300)
518
519/* CORTEXA8 platform */
520#define MXC_CORTEXA8_PLAT_PVID (MX51_CORTEXA8_BASE + 0x0)
521#define MXC_CORTEXA8_PLAT_GPC (MX51_CORTEXA8_BASE + 0x4)
522#define MXC_CORTEXA8_PLAT_PIC (MX51_CORTEXA8_BASE + 0x8)
523#define MXC_CORTEXA8_PLAT_LPC (MX51_CORTEXA8_BASE + 0xC)
524#define MXC_CORTEXA8_PLAT_NEON_LPC (MX51_CORTEXA8_BASE + 0x10)
525#define MXC_CORTEXA8_PLAT_ICGC (MX51_CORTEXA8_BASE + 0x14)
526#define MXC_CORTEXA8_PLAT_AMC (MX51_CORTEXA8_BASE + 0x18)
527#define MXC_CORTEXA8_PLAT_NMC (MX51_CORTEXA8_BASE + 0x20)
528#define MXC_CORTEXA8_PLAT_NMS (MX51_CORTEXA8_BASE + 0x24)
529
530/* DVFS CORE */
531#define MXC_DVFSTHRS (MXC_DVFS_CORE_BASE + 0x00)
532#define MXC_DVFSCOUN (MXC_DVFS_CORE_BASE + 0x04)
533#define MXC_DVFSSIG1 (MXC_DVFS_CORE_BASE + 0x08)
534#define MXC_DVFSSIG0 (MXC_DVFS_CORE_BASE + 0x0C)
535#define MXC_DVFSGPC0 (MXC_DVFS_CORE_BASE + 0x10)
536#define MXC_DVFSGPC1 (MXC_DVFS_CORE_BASE + 0x14)
537#define MXC_DVFSGPBT (MXC_DVFS_CORE_BASE + 0x18)
538#define MXC_DVFSEMAC (MXC_DVFS_CORE_BASE + 0x1C)
539#define MXC_DVFSCNTR (MXC_DVFS_CORE_BASE + 0x20)
540#define MXC_DVFSLTR0_0 (MXC_DVFS_CORE_BASE + 0x24)
541#define MXC_DVFSLTR0_1 (MXC_DVFS_CORE_BASE + 0x28)
542#define MXC_DVFSLTR1_0 (MXC_DVFS_CORE_BASE + 0x2C)
543#define MXC_DVFSLTR1_1 (MXC_DVFS_CORE_BASE + 0x30)
544#define MXC_DVFSPT0 (MXC_DVFS_CORE_BASE + 0x34)
545#define MXC_DVFSPT1 (MXC_DVFS_CORE_BASE + 0x38)
546#define MXC_DVFSPT2 (MXC_DVFS_CORE_BASE + 0x3C)
547#define MXC_DVFSPT3 (MXC_DVFS_CORE_BASE + 0x40)
548
549/* GPC */
550#define MXC_GPC_CNTR (MX51_GPC_BASE + 0x0)
551#define MXC_GPC_PGR (MX51_GPC_BASE + 0x4)
552#define MXC_GPC_VCR (MX51_GPC_BASE + 0x8)
553#define MXC_GPC_ALL_PU (MX51_GPC_BASE + 0xC)
554#define MXC_GPC_NEON (MX51_GPC_BASE + 0x10)
555#define MXC_GPC_PGR_ARMPG_OFFSET 8
556#define MXC_GPC_PGR_ARMPG_MASK (3 << 8)
557
558/* PGC */
559#define MXC_PGC_IPU_PGCR (MXC_PGC_IPU_BASE + 0x0)
560#define MXC_PGC_IPU_PGSR (MXC_PGC_IPU_BASE + 0xC)
561#define MXC_PGC_VPU_PGCR (MXC_PGC_VPU_BASE + 0x0)
562#define MXC_PGC_VPU_PGSR (MXC_PGC_VPU_BASE + 0xC)
563#define MXC_PGC_GPU_PGCR (MXC_PGC_GPU_BASE + 0x0)
564#define MXC_PGC_GPU_PGSR (MXC_PGC_GPU_BASE + 0xC)
565
566#define MXC_PGCR_PCR 1
567#define MXC_SRPGCR_PCR 1
568#define MXC_EMPGCR_PCR 1
569#define MXC_PGSR_PSR 1
570
571
572#define MXC_CORTEXA8_PLAT_LPC_DSM (1 << 0)
573#define MXC_CORTEXA8_PLAT_LPC_DBG_DSM (1 << 1)
574
575/* SRPG */
576#define MXC_SRPG_NEON_SRPGCR (MXC_SRPG_NEON_BASE + 0x0)
577#define MXC_SRPG_NEON_PUPSCR (MXC_SRPG_NEON_BASE + 0x4)
578#define MXC_SRPG_NEON_PDNSCR (MXC_SRPG_NEON_BASE + 0x8)
579
580#define MXC_SRPG_ARM_SRPGCR (MXC_SRPG_ARM_BASE + 0x0)
581#define MXC_SRPG_ARM_PUPSCR (MXC_SRPG_ARM_BASE + 0x4)
582#define MXC_SRPG_ARM_PDNSCR (MXC_SRPG_ARM_BASE + 0x8)
583
584#define MXC_SRPG_EMPGC0_SRPGCR (MXC_SRPG_EMPGC0_BASE + 0x0)
585#define MXC_SRPG_EMPGC0_PUPSCR (MXC_SRPG_EMPGC0_BASE + 0x4)
586#define MXC_SRPG_EMPGC0_PDNSCR (MXC_SRPG_EMPGC0_BASE + 0x8)
587
588#define MXC_SRPG_EMPGC1_SRPGCR (MXC_SRPG_EMPGC1_BASE + 0x0)
589#define MXC_SRPG_EMPGC1_PUPSCR (MXC_SRPG_EMPGC1_BASE + 0x4)
590#define MXC_SRPG_EMPGC1_PDNSCR (MXC_SRPG_EMPGC1_BASE + 0x8)
591
592#define MXC_SRPG_MEGAMIX_SRPGCR (MXC_SRPG_MEGAMIX_BASE + 0x0)
593#define MXC_SRPG_MEGAMIX_PUPSCR (MXC_SRPG_MEGAMIX_BASE + 0x4)
594#define MXC_SRPG_MEGAMIX_PDNSCR (MXC_SRPG_MEGAMIX_BASE + 0x8)
595
596#define MXC_SRPGC_EMI_SRPGCR (MXC_SRPGC_EMI_BASE + 0x0)
597#define MXC_SRPGC_EMI_PUPSCR (MXC_SRPGC_EMI_BASE + 0x4)
598#define MXC_SRPGC_EMI_PDNSCR (MXC_SRPGC_EMI_BASE + 0x8)
599
600#endif /* __ARCH_ARM_MACH_MX51_CRM_REGS_H__ */
diff --git a/arch/arm/mach-imx/devices-imx51.h b/arch/arm/mach-imx/devices-imx51.h
deleted file mode 100644
index 26389f35a2b2..000000000000
--- a/arch/arm/mach-imx/devices-imx51.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include "devices/devices-common.h"
10
11extern const struct imx_fec_data imx51_fec_data;
12#define imx51_add_fec(pdata) \
13 imx_add_fec(&imx51_fec_data, pdata)
14
15extern const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data;
16#define imx51_add_fsl_usb2_udc(pdata) \
17 imx_add_fsl_usb2_udc(&imx51_fsl_usb2_udc_data, pdata)
18
19extern const struct imx_imx_i2c_data imx51_imx_i2c_data[];
20#define imx51_add_imx_i2c(id, pdata) \
21 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
22#define imx51_add_hsi2c(pdata) \
23 imx51_add_imx_i2c(2, pdata)
24
25extern const struct imx_imx_ssi_data imx51_imx_ssi_data[];
26#define imx51_add_imx_ssi(id, pdata) \
27 imx_add_imx_ssi(&imx51_imx_ssi_data[id], pdata)
28
29extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[];
30#define imx51_add_imx_uart(id, pdata) \
31 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
32
33extern const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data;
34#define imx51_add_mxc_ehci_otg(pdata) \
35 imx_add_mxc_ehci(&imx51_mxc_ehci_otg_data, pdata)
36extern const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[];
37#define imx51_add_mxc_ehci_hs(id, pdata) \
38 imx_add_mxc_ehci(&imx51_mxc_ehci_hs_data[id - 1], pdata)
39
40extern const struct imx_mxc_nand_data imx51_mxc_nand_data;
41#define imx51_add_mxc_nand(pdata) \
42 imx_add_mxc_nand(&imx51_mxc_nand_data, pdata)
43
44extern const struct imx_sdhci_esdhc_imx_data imx51_sdhci_esdhc_imx_data[];
45#define imx51_add_sdhci_esdhc_imx(id, pdata) \
46 imx_add_sdhci_esdhc_imx(&imx51_sdhci_esdhc_imx_data[id], pdata)
47
48extern const struct imx_spi_imx_data imx51_cspi_data;
49#define imx51_add_cspi(pdata) \
50 imx_add_spi_imx(&imx51_cspi_data, pdata)
51
52extern const struct imx_spi_imx_data imx51_ecspi_data[];
53#define imx51_add_ecspi(id, pdata) \
54 imx_add_spi_imx(&imx51_ecspi_data[id], pdata)
55
56extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[];
57#define imx51_add_imx2_wdt(id) \
58 imx_add_imx2_wdt(&imx51_imx2_wdt_data[id])
59
60extern const struct imx_imx_keypad_data imx51_imx_keypad_data;
61#define imx51_add_imx_keypad(pdata) \
62 imx_add_imx_keypad(&imx51_imx_keypad_data, pdata)
63
64extern const struct imx_pata_imx_data imx51_pata_imx_data;
65#define imx51_add_pata_imx() \
66 imx_add_pata_imx(&imx51_pata_imx_data)
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 2d260a5a307c..1d2cc1805f3e 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -1,6 +1,6 @@
1config IMX_HAVE_PLATFORM_FEC 1config IMX_HAVE_PLATFORM_FEC
2 bool 2 bool
3 default y if ARCH_MX25 || SOC_IMX27 || SOC_IMX35 || SOC_IMX51 || SOC_IMX53 3 default y if SOC_IMX25 || SOC_IMX27 || SOC_IMX35
4 4
5config IMX_HAVE_PLATFORM_FLEXCAN 5config IMX_HAVE_PLATFORM_FLEXCAN
6 bool 6 bool
@@ -10,7 +10,6 @@ config IMX_HAVE_PLATFORM_FSL_USB2_UDC
10 10
11config IMX_HAVE_PLATFORM_GPIO_KEYS 11config IMX_HAVE_PLATFORM_GPIO_KEYS
12 bool 12 bool
13 default y if SOC_IMX51
14 13
15config IMX_HAVE_PLATFORM_IMX21_HCD 14config IMX_HAVE_PLATFORM_IMX21_HCD
16 bool 15 bool
@@ -43,15 +42,9 @@ config IMX_HAVE_PLATFORM_IMX_SSI
43config IMX_HAVE_PLATFORM_IMX_UART 42config IMX_HAVE_PLATFORM_IMX_UART
44 bool 43 bool
45 44
46config IMX_HAVE_PLATFORM_IMX_UDC
47 bool
48
49config IMX_HAVE_PLATFORM_IPU_CORE 45config IMX_HAVE_PLATFORM_IPU_CORE
50 bool 46 bool
51 47
52config IMX_HAVE_PLATFORM_MX1_CAMERA
53 bool
54
55config IMX_HAVE_PLATFORM_MX2_CAMERA 48config IMX_HAVE_PLATFORM_MX2_CAMERA
56 bool 49 bool
57 50
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
index 1cbc14cd80d1..8fdb12b4ca7e 100644
--- a/arch/arm/mach-imx/devices/Makefile
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -16,9 +16,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
16obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o 16obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
17obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o 17obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
18obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 18obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
19obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
20obj-$(CONFIG_IMX_HAVE_PLATFORM_IPU_CORE) += platform-ipu-core.o 19obj-$(CONFIG_IMX_HAVE_PLATFORM_IPU_CORE) += platform-ipu-core.o
21obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
22obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o 20obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
23obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o 21obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
24obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o 22obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 61352a80bb59..67f7fb13050d 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -176,22 +176,6 @@ struct platform_device *__init imx_add_imx_uart_1irq(
176 const struct imx_imx_uart_1irq_data *data, 176 const struct imx_imx_uart_1irq_data *data,
177 const struct imxuart_platform_data *pdata); 177 const struct imxuart_platform_data *pdata);
178 178
179#include <linux/platform_data/usb-imx_udc.h>
180struct imx_imx_udc_data {
181 resource_size_t iobase;
182 resource_size_t iosize;
183 resource_size_t irq0;
184 resource_size_t irq1;
185 resource_size_t irq2;
186 resource_size_t irq3;
187 resource_size_t irq4;
188 resource_size_t irq5;
189 resource_size_t irq6;
190};
191struct platform_device *__init imx_add_imx_udc(
192 const struct imx_imx_udc_data *data,
193 const struct imxusb_platform_data *pdata);
194
195#include <linux/platform_data/video-mx3fb.h> 179#include <linux/platform_data/video-mx3fb.h>
196#include <linux/platform_data/camera-mx3.h> 180#include <linux/platform_data/camera-mx3.h>
197struct imx_ipu_core_data { 181struct imx_ipu_core_data {
@@ -208,16 +192,6 @@ struct platform_device *__init imx_add_mx3_sdc_fb(
208 const struct imx_ipu_core_data *data, 192 const struct imx_ipu_core_data *data,
209 struct mx3fb_platform_data *pdata); 193 struct mx3fb_platform_data *pdata);
210 194
211#include <linux/platform_data/camera-mx1.h>
212struct imx_mx1_camera_data {
213 resource_size_t iobase;
214 resource_size_t iosize;
215 resource_size_t irq;
216};
217struct platform_device *__init imx_add_mx1_camera(
218 const struct imx_mx1_camera_data *data,
219 const struct mx1_camera_pdata *pdata);
220
221#include <linux/platform_data/camera-mx2.h> 195#include <linux/platform_data/camera-mx2.h>
222struct imx_mx2_camera_data { 196struct imx_mx2_camera_data {
223 const char *devid; 197 const char *devid;
diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
index 1b4366a0e7c0..8eab5440da28 100644
--- a/arch/arm/mach-imx/devices/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -24,12 +24,10 @@
24 24
25struct device mxc_aips_bus = { 25struct device mxc_aips_bus = {
26 .init_name = "mxc_aips", 26 .init_name = "mxc_aips",
27 .parent = &platform_bus,
28}; 27};
29 28
30struct device mxc_ahb_bus = { 29struct device mxc_ahb_bus = {
31 .init_name = "mxc_ahb", 30 .init_name = "mxc_ahb",
32 .parent = &platform_bus,
33}; 31};
34 32
35int __init mxc_device_init(void) 33int __init mxc_device_init(void)
diff --git a/arch/arm/mach-imx/devices/platform-fec.c b/arch/arm/mach-imx/devices/platform-fec.c
index 63eba08f87b1..d86f9250b4ee 100644
--- a/arch/arm/mach-imx/devices/platform-fec.c
+++ b/arch/arm/mach-imx/devices/platform-fec.c
@@ -35,18 +35,6 @@ const struct imx_fec_data imx35_fec_data __initconst =
35 imx_fec_data_entry_single(MX35, "imx27-fec"); 35 imx_fec_data_entry_single(MX35, "imx27-fec");
36#endif 36#endif
37 37
38#ifdef CONFIG_SOC_IMX51
39/* i.mx51 has the i.mx27 type fec */
40const struct imx_fec_data imx51_fec_data __initconst =
41 imx_fec_data_entry_single(MX51, "imx27-fec");
42#endif
43
44#ifdef CONFIG_SOC_IMX53
45/* i.mx53 has the i.mx25 type fec */
46const struct imx_fec_data imx53_fec_data __initconst =
47 imx_fec_data_entry_single(MX53, "imx25-fec");
48#endif
49
50struct platform_device *__init imx_add_fec( 38struct platform_device *__init imx_add_fec(
51 const struct imx_fec_data *data, 39 const struct imx_fec_data *data,
52 const struct fec_platform_data *pdata) 40 const struct fec_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
index 3c06bd96e9cc..23b0061347cb 100644
--- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
+++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
@@ -38,11 +38,6 @@ const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
38 imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27"); 38 imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
39#endif /* ifdef CONFIG_SOC_IMX35 */ 39#endif /* ifdef CONFIG_SOC_IMX35 */
40 40
41#ifdef CONFIG_SOC_IMX51
42const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst =
43 imx_fsl_usb2_udc_data_entry_single(MX51, "imx-udc-mx51");
44#endif
45
46struct platform_device *__init imx_add_fsl_usb2_udc( 41struct platform_device *__init imx_add_fsl_usb2_udc(
47 const struct imx_fsl_usb2_udc_data *data, 42 const struct imx_fsl_usb2_udc_data *data,
48 const struct fsl_usb2_platform_data *pdata) 43 const struct fsl_usb2_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-imx-i2c.c b/arch/arm/mach-imx/devices/platform-imx-i2c.c
index 57d342e85c2f..644ac2689882 100644
--- a/arch/arm/mach-imx/devices/platform-imx-i2c.c
+++ b/arch/arm/mach-imx/devices/platform-imx-i2c.c
@@ -70,32 +70,6 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
70}; 70};
71#endif /* ifdef CONFIG_SOC_IMX35 */ 71#endif /* ifdef CONFIG_SOC_IMX35 */
72 72
73#ifdef CONFIG_SOC_IMX51
74const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
75#define imx51_imx_i2c_data_entry(_id, _hwid) \
76 imx_imx_i2c_data_entry(MX51, "imx21-i2c", _id, _hwid, SZ_4K)
77 imx51_imx_i2c_data_entry(0, 1),
78 imx51_imx_i2c_data_entry(1, 2),
79 {
80 .devid = "imx21-i2c",
81 .id = 2,
82 .iobase = MX51_HSI2C_DMA_BASE_ADDR,
83 .iosize = SZ_16K,
84 .irq = MX51_INT_HS_I2C,
85 },
86};
87#endif /* ifdef CONFIG_SOC_IMX51 */
88
89#ifdef CONFIG_SOC_IMX53
90const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
91#define imx53_imx_i2c_data_entry(_id, _hwid) \
92 imx_imx_i2c_data_entry(MX53, "imx21-i2c", _id, _hwid, SZ_4K)
93 imx53_imx_i2c_data_entry(0, 1),
94 imx53_imx_i2c_data_entry(1, 2),
95 imx53_imx_i2c_data_entry(2, 3),
96};
97#endif /* ifdef CONFIG_SOC_IMX53 */
98
99struct platform_device *__init imx_add_imx_i2c( 73struct platform_device *__init imx_add_imx_i2c(
100 const struct imx_imx_i2c_data *data, 74 const struct imx_imx_i2c_data *data,
101 const struct imxi2c_platform_data *pdata) 75 const struct imxi2c_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-imx-keypad.c b/arch/arm/mach-imx/devices/platform-imx-keypad.c
index 8f22a4c98a4c..f42200b7aca9 100644
--- a/arch/arm/mach-imx/devices/platform-imx-keypad.c
+++ b/arch/arm/mach-imx/devices/platform-imx-keypad.c
@@ -41,16 +41,6 @@ const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
41 imx_imx_keypad_data_entry_single(MX35, SZ_16); 41 imx_imx_keypad_data_entry_single(MX35, SZ_16);
42#endif /* ifdef CONFIG_SOC_IMX35 */ 42#endif /* ifdef CONFIG_SOC_IMX35 */
43 43
44#ifdef CONFIG_SOC_IMX51
45const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
46 imx_imx_keypad_data_entry_single(MX51, SZ_16);
47#endif /* ifdef CONFIG_SOC_IMX51 */
48
49#ifdef CONFIG_SOC_IMX53
50const struct imx_imx_keypad_data imx53_imx_keypad_data __initconst =
51 imx_imx_keypad_data_entry_single(MX53, SZ_16);
52#endif /* ifdef CONFIG_SOC_IMX53 */
53
54struct platform_device *__init imx_add_imx_keypad( 44struct platform_device *__init imx_add_imx_keypad(
55 const struct imx_imx_keypad_data *data, 45 const struct imx_imx_keypad_data *data,
56 const struct matrix_keymap_data *pdata) 46 const struct matrix_keymap_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-imx-ssi.c b/arch/arm/mach-imx/devices/platform-imx-ssi.c
index bfcb8f3dfa8d..1c7c721ebff1 100644
--- a/arch/arm/mach-imx/devices/platform-imx-ssi.c
+++ b/arch/arm/mach-imx/devices/platform-imx-ssi.c
@@ -66,26 +66,6 @@ const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
66}; 66};
67#endif /* ifdef CONFIG_SOC_IMX35 */ 67#endif /* ifdef CONFIG_SOC_IMX35 */
68 68
69#ifdef CONFIG_SOC_IMX51
70const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst = {
71#define imx51_imx_ssi_data_entry(_id, _hwid) \
72 imx_imx_ssi_data_entry(MX51, _id, _hwid, SZ_16K)
73 imx51_imx_ssi_data_entry(0, 1),
74 imx51_imx_ssi_data_entry(1, 2),
75 imx51_imx_ssi_data_entry(2, 3),
76};
77#endif /* ifdef CONFIG_SOC_IMX51 */
78
79#ifdef CONFIG_SOC_IMX53
80const struct imx_imx_ssi_data imx53_imx_ssi_data[] __initconst = {
81#define imx53_imx_ssi_data_entry(_id, _hwid) \
82 imx_imx_ssi_data_entry(MX53, _id, _hwid, SZ_16K)
83 imx53_imx_ssi_data_entry(0, 1),
84 imx53_imx_ssi_data_entry(1, 2),
85 imx53_imx_ssi_data_entry(2, 3),
86};
87#endif /* ifdef CONFIG_SOC_IMX53 */
88
89struct platform_device *__init imx_add_imx_ssi( 69struct platform_device *__init imx_add_imx_ssi(
90 const struct imx_imx_ssi_data *data, 70 const struct imx_imx_ssi_data *data,
91 const struct imx_ssi_platform_data *pdata) 71 const struct imx_ssi_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-imx-uart.c b/arch/arm/mach-imx/devices/platform-imx-uart.c
index faac4aa6ca6d..8c01836bc1d4 100644
--- a/arch/arm/mach-imx/devices/platform-imx-uart.c
+++ b/arch/arm/mach-imx/devices/platform-imx-uart.c
@@ -94,28 +94,6 @@ const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
94}; 94};
95#endif /* ifdef CONFIG_SOC_IMX35 */ 95#endif /* ifdef CONFIG_SOC_IMX35 */
96 96
97#ifdef CONFIG_SOC_IMX51
98const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
99#define imx51_imx_uart_data_entry(_id, _hwid) \
100 imx_imx_uart_1irq_data_entry(MX51, _id, _hwid, SZ_4K)
101 imx51_imx_uart_data_entry(0, 1),
102 imx51_imx_uart_data_entry(1, 2),
103 imx51_imx_uart_data_entry(2, 3),
104};
105#endif /* ifdef CONFIG_SOC_IMX51 */
106
107#ifdef CONFIG_SOC_IMX53
108const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst = {
109#define imx53_imx_uart_data_entry(_id, _hwid) \
110 imx_imx_uart_1irq_data_entry(MX53, _id, _hwid, SZ_4K)
111 imx53_imx_uart_data_entry(0, 1),
112 imx53_imx_uart_data_entry(1, 2),
113 imx53_imx_uart_data_entry(2, 3),
114 imx53_imx_uart_data_entry(3, 4),
115 imx53_imx_uart_data_entry(4, 5),
116};
117#endif /* ifdef CONFIG_SOC_IMX53 */
118
119struct platform_device *__init imx_add_imx_uart_3irq( 97struct platform_device *__init imx_add_imx_uart_3irq(
120 const struct imx_imx_uart_3irq_data *data, 98 const struct imx_imx_uart_3irq_data *data,
121 const struct imxuart_platform_data *pdata) 99 const struct imxuart_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-imx2-wdt.c b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
index ec75d6413686..54f63bc25ca4 100644
--- a/arch/arm/mach-imx/devices/platform-imx2-wdt.c
+++ b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
@@ -45,24 +45,6 @@ const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
45 imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K); 45 imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
46#endif /* ifdef CONFIG_SOC_IMX35 */ 46#endif /* ifdef CONFIG_SOC_IMX35 */
47 47
48#ifdef CONFIG_SOC_IMX51
49const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst = {
50#define imx51_imx2_wdt_data_entry(_id, _hwid) \
51 imx_imx2_wdt_data_entry(MX51, _id, _hwid, SZ_16K)
52 imx51_imx2_wdt_data_entry(0, 1),
53 imx51_imx2_wdt_data_entry(1, 2),
54};
55#endif /* ifdef CONFIG_SOC_IMX51 */
56
57#ifdef CONFIG_SOC_IMX53
58const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst = {
59#define imx53_imx2_wdt_data_entry(_id, _hwid) \
60 imx_imx2_wdt_data_entry(MX53, _id, _hwid, SZ_16K)
61 imx53_imx2_wdt_data_entry(0, 1),
62 imx53_imx2_wdt_data_entry(1, 2),
63};
64#endif /* ifdef CONFIG_SOC_IMX53 */
65
66struct platform_device *__init imx_add_imx2_wdt( 48struct platform_device *__init imx_add_imx2_wdt(
67 const struct imx_imx2_wdt_data *data) 49 const struct imx_imx2_wdt_data *data)
68{ 50{
diff --git a/arch/arm/mach-imx/devices/platform-imx_udc.c b/arch/arm/mach-imx/devices/platform-imx_udc.c
deleted file mode 100644
index 5ced7e4e2c71..000000000000
--- a/arch/arm/mach-imx/devices/platform-imx_udc.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include "../hardware.h"
10#include "devices-common.h"
11
12#define imx_imx_udc_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _USBD_BASE_ADDR, \
15 .iosize = _size, \
16 .irq0 = soc ## _INT_USBD0, \
17 .irq1 = soc ## _INT_USBD1, \
18 .irq2 = soc ## _INT_USBD2, \
19 .irq3 = soc ## _INT_USBD3, \
20 .irq4 = soc ## _INT_USBD4, \
21 .irq5 = soc ## _INT_USBD5, \
22 .irq6 = soc ## _INT_USBD6, \
23 }
24
25#define imx_imx_udc_data_entry(soc, _size) \
26 [_id] = imx_imx_udc_data_entry_single(soc, _size)
27
28#ifdef CONFIG_SOC_IMX1
29const struct imx_imx_udc_data imx1_imx_udc_data __initconst =
30 imx_imx_udc_data_entry_single(MX1, SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX1 */
32
33struct platform_device *__init imx_add_imx_udc(
34 const struct imx_imx_udc_data *data,
35 const struct imxusb_platform_data *pdata)
36{
37 struct resource res[] = {
38 {
39 .start = data->iobase,
40 .end = data->iobase + data->iosize - 1,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq0,
44 .end = data->irq0,
45 .flags = IORESOURCE_IRQ,
46 }, {
47 .start = data->irq1,
48 .end = data->irq1,
49 .flags = IORESOURCE_IRQ,
50 }, {
51 .start = data->irq2,
52 .end = data->irq2,
53 .flags = IORESOURCE_IRQ,
54 }, {
55 .start = data->irq3,
56 .end = data->irq3,
57 .flags = IORESOURCE_IRQ,
58 }, {
59 .start = data->irq4,
60 .end = data->irq4,
61 .flags = IORESOURCE_IRQ,
62 }, {
63 .start = data->irq5,
64 .end = data->irq5,
65 .flags = IORESOURCE_IRQ,
66 }, {
67 .start = data->irq6,
68 .end = data->irq6,
69 .flags = IORESOURCE_IRQ,
70 },
71 };
72
73 return imx_add_platform_device("imx_udc", 0,
74 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
75}
diff --git a/arch/arm/mach-imx/devices/platform-mx1-camera.c b/arch/arm/mach-imx/devices/platform-mx1-camera.c
deleted file mode 100644
index 2c6788131080..000000000000
--- a/arch/arm/mach-imx/devices/platform-mx1-camera.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include "../hardware.h"
10#include "devices-common.h"
11
12#define imx_mx1_camera_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _CSI ## _BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_CSI, \
17 }
18
19#ifdef CONFIG_SOC_IMX1
20const struct imx_mx1_camera_data imx1_mx1_camera_data __initconst =
21 imx_mx1_camera_data_entry_single(MX1, 10);
22#endif /* ifdef CONFIG_SOC_IMX1 */
23
24struct platform_device *__init imx_add_mx1_camera(
25 const struct imx_mx1_camera_data *data,
26 const struct mx1_camera_pdata *pdata)
27{
28 struct resource res[] = {
29 {
30 .start = data->iobase,
31 .end = data->iobase + data->iosize - 1,
32 .flags = IORESOURCE_MEM,
33 }, {
34 .start = data->irq,
35 .end = data->irq,
36 .flags = IORESOURCE_IRQ,
37 },
38 };
39 return imx_add_platform_device_dmamask("mx1-camera", 0,
40 res, ARRAY_SIZE(res),
41 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
42}
diff --git a/arch/arm/mach-imx/devices/platform-mxc-ehci.c b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
index 5d4bbbfde641..296353662ff0 100644
--- a/arch/arm/mach-imx/devices/platform-mxc-ehci.c
+++ b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
@@ -50,15 +50,6 @@ const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
50 imx_mxc_ehci_data_entry_single(MX35, 1, HS); 50 imx_mxc_ehci_data_entry_single(MX35, 1, HS);
51#endif /* ifdef CONFIG_SOC_IMX35 */ 51#endif /* ifdef CONFIG_SOC_IMX35 */
52 52
53#ifdef CONFIG_SOC_IMX51
54const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst =
55 imx_mxc_ehci_data_entry_single(MX51, 0, OTG);
56const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[] __initconst = {
57 imx_mxc_ehci_data_entry_single(MX51, 1, HS1),
58 imx_mxc_ehci_data_entry_single(MX51, 2, HS2),
59};
60#endif /* ifdef CONFIG_SOC_IMX51 */
61
62struct platform_device *__init imx_add_mxc_ehci( 53struct platform_device *__init imx_add_mxc_ehci(
63 const struct imx_mxc_ehci_data *data, 54 const struct imx_mxc_ehci_data *data,
64 const struct mxc_usbh_platform_data *pdata) 55 const struct mxc_usbh_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-mxc_nand.c b/arch/arm/mach-imx/devices/platform-mxc_nand.c
index 7af1c53e42b5..fa618a34f462 100644
--- a/arch/arm/mach-imx/devices/platform-mxc_nand.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_nand.c
@@ -54,11 +54,6 @@ const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
54 imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K); 54 imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
55#endif 55#endif
56 56
57#ifdef CONFIG_SOC_IMX51
58const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
59 imx_mxc_nandv3_data_entry_single(MX51, "imx51-nand", SZ_16K);
60#endif
61
62struct platform_device *__init imx_add_mxc_nand( 57struct platform_device *__init imx_add_mxc_nand(
63 const struct imx_mxc_nand_data *data, 58 const struct imx_mxc_nand_data *data,
64 const struct mxc_nand_platform_data *pdata) 59 const struct mxc_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/devices/platform-mxc_rnga.c b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
index c58404badb59..851fbc8af7a9 100644
--- a/arch/arm/mach-imx/devices/platform-mxc_rnga.c
+++ b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
@@ -48,9 +48,6 @@ static int __init imxXX_add_mxc_rnga(void)
48#endif /* if defined(CONFIG_SOC_IMX31) */ 48#endif /* if defined(CONFIG_SOC_IMX31) */
49 ret = ERR_PTR(-ENODEV); 49 ret = ERR_PTR(-ENODEV);
50 50
51 if (IS_ERR(ret)) 51 return PTR_ERR_OR_ZERO(ret);
52 return PTR_ERR(ret);
53
54 return 0;
55} 52}
56arch_initcall(imxXX_add_mxc_rnga); 53arch_initcall(imxXX_add_mxc_rnga);
diff --git a/arch/arm/mach-imx/devices/platform-pata_imx.c b/arch/arm/mach-imx/devices/platform-pata_imx.c
index e4ec11c8ce55..1c7f895a69d2 100644
--- a/arch/arm/mach-imx/devices/platform-pata_imx.c
+++ b/arch/arm/mach-imx/devices/platform-pata_imx.c
@@ -28,16 +28,6 @@ const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
28 imx_pata_imx_data_entry_single(MX35, SZ_16K); 28 imx_pata_imx_data_entry_single(MX35, SZ_16K);
29#endif /* ifdef CONFIG_SOC_IMX35 */ 29#endif /* ifdef CONFIG_SOC_IMX35 */
30 30
31#ifdef CONFIG_SOC_IMX51
32const struct imx_pata_imx_data imx51_pata_imx_data __initconst =
33 imx_pata_imx_data_entry_single(MX51, SZ_16K);
34#endif /* ifdef CONFIG_SOC_IMX51 */
35
36#ifdef CONFIG_SOC_IMX53
37const struct imx_pata_imx_data imx53_pata_imx_data __initconst =
38 imx_pata_imx_data_entry_single(MX53, SZ_16K);
39#endif /* ifdef CONFIG_SOC_IMX53 */
40
41struct platform_device *__init imx_add_pata_imx( 31struct platform_device *__init imx_add_pata_imx(
42 const struct imx_pata_imx_data *data) 32 const struct imx_pata_imx_data *data)
43{ 33{
diff --git a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
index e66a4e316311..fb8d4a2ad48c 100644
--- a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
+++ b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
@@ -43,30 +43,6 @@ imx35_sdhci_esdhc_imx_data[] __initconst = {
43}; 43};
44#endif /* ifdef CONFIG_SOC_IMX35 */ 44#endif /* ifdef CONFIG_SOC_IMX35 */
45 45
46#ifdef CONFIG_SOC_IMX51
47const struct imx_sdhci_esdhc_imx_data
48imx51_sdhci_esdhc_imx_data[] __initconst = {
49#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \
50 imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid)
51 imx51_sdhci_esdhc_imx_data_entry(0, 1),
52 imx51_sdhci_esdhc_imx_data_entry(1, 2),
53 imx51_sdhci_esdhc_imx_data_entry(2, 3),
54 imx51_sdhci_esdhc_imx_data_entry(3, 4),
55};
56#endif /* ifdef CONFIG_SOC_IMX51 */
57
58#ifdef CONFIG_SOC_IMX53
59const struct imx_sdhci_esdhc_imx_data
60imx53_sdhci_esdhc_imx_data[] __initconst = {
61#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \
62 imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid)
63 imx53_sdhci_esdhc_imx_data_entry(0, 1),
64 imx53_sdhci_esdhc_imx_data_entry(1, 2),
65 imx53_sdhci_esdhc_imx_data_entry(2, 3),
66 imx53_sdhci_esdhc_imx_data_entry(3, 4),
67};
68#endif /* ifdef CONFIG_SOC_IMX53 */
69
70static const struct esdhc_platform_data default_esdhc_pdata __initconst = { 46static const struct esdhc_platform_data default_esdhc_pdata __initconst = {
71 .wp_type = ESDHC_WP_NONE, 47 .wp_type = ESDHC_WP_NONE,
72 .cd_type = ESDHC_CD_NONE, 48 .cd_type = ESDHC_CD_NONE,
diff --git a/arch/arm/mach-imx/devices/platform-spi_imx.c b/arch/arm/mach-imx/devices/platform-spi_imx.c
index 8880bcb11e05..aca825d74c48 100644
--- a/arch/arm/mach-imx/devices/platform-spi_imx.c
+++ b/arch/arm/mach-imx/devices/platform-spi_imx.c
@@ -79,33 +79,6 @@ const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
79}; 79};
80#endif /* ifdef CONFIG_SOC_IMX35 */ 80#endif /* ifdef CONFIG_SOC_IMX35 */
81 81
82#ifdef CONFIG_SOC_IMX51
83/* i.mx51 has the i.mx35 type cspi */
84const struct imx_spi_imx_data imx51_cspi_data __initconst =
85 imx_spi_imx_data_entry_single(MX51, CSPI, "imx35-cspi", 2, , SZ_4K);
86
87const struct imx_spi_imx_data imx51_ecspi_data[] __initconst = {
88#define imx51_ecspi_data_entry(_id, _hwid) \
89 imx_spi_imx_data_entry(MX51, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
90 imx51_ecspi_data_entry(0, 1),
91 imx51_ecspi_data_entry(1, 2),
92};
93#endif /* ifdef CONFIG_SOC_IMX51 */
94
95#ifdef CONFIG_SOC_IMX53
96/* i.mx53 has the i.mx35 type cspi */
97const struct imx_spi_imx_data imx53_cspi_data __initconst =
98 imx_spi_imx_data_entry_single(MX53, CSPI, "imx35-cspi", 2, , SZ_4K);
99
100/* i.mx53 has the i.mx51 type ecspi */
101const struct imx_spi_imx_data imx53_ecspi_data[] __initconst = {
102#define imx53_ecspi_data_entry(_id, _hwid) \
103 imx_spi_imx_data_entry(MX53, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
104 imx53_ecspi_data_entry(0, 1),
105 imx53_ecspi_data_entry(1, 2),
106};
107#endif /* ifdef CONFIG_SOC_IMX53 */
108
109struct platform_device *__init imx_add_spi_imx( 82struct platform_device *__init imx_add_spi_imx(
110 const struct imx_spi_imx_data *data, 83 const struct imx_spi_imx_data *data,
111 const struct spi_imx_master *pdata) 84 const struct spi_imx_master *pdata)
diff --git a/arch/arm/mach-imx/ehci-imx25.c b/arch/arm/mach-imx/ehci-imx25.c
index 134c190e3003..42a5a3d14c5f 100644
--- a/arch/arm/mach-imx/ehci-imx25.c
+++ b/arch/arm/mach-imx/ehci-imx25.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
19 19
20#include "ehci.h"
20#include "hardware.h" 21#include "hardware.h"
21 22
22#define USBCTRL_OTGBASE_OFFSET 0x600 23#define USBCTRL_OTGBASE_OFFSET 0x600
diff --git a/arch/arm/mach-imx/ehci-imx27.c b/arch/arm/mach-imx/ehci-imx27.c
index 448d9115539d..c56974346c16 100644
--- a/arch/arm/mach-imx/ehci-imx27.c
+++ b/arch/arm/mach-imx/ehci-imx27.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
19 19
20#include "ehci.h"
20#include "hardware.h" 21#include "hardware.h"
21 22
22#define USBCTRL_OTGBASE_OFFSET 0x600 23#define USBCTRL_OTGBASE_OFFSET 0x600
diff --git a/arch/arm/mach-imx/ehci-imx31.c b/arch/arm/mach-imx/ehci-imx31.c
index 05de4e1e39d7..bede21d9b981 100644
--- a/arch/arm/mach-imx/ehci-imx31.c
+++ b/arch/arm/mach-imx/ehci-imx31.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
19 19
20#include "ehci.h"
20#include "hardware.h" 21#include "hardware.h"
21 22
22#define USBCTRL_OTGBASE_OFFSET 0x600 23#define USBCTRL_OTGBASE_OFFSET 0x600
diff --git a/arch/arm/mach-imx/ehci-imx35.c b/arch/arm/mach-imx/ehci-imx35.c
index 554e7cccff53..f424a543755c 100644
--- a/arch/arm/mach-imx/ehci-imx35.c
+++ b/arch/arm/mach-imx/ehci-imx35.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/usb-ehci-mxc.h> 18#include <linux/platform_data/usb-ehci-mxc.h>
19 19
20#include "ehci.h"
20#include "hardware.h" 21#include "hardware.h"
21 22
22#define USBCTRL_OTGBASE_OFFSET 0x600 23#define USBCTRL_OTGBASE_OFFSET 0x600
diff --git a/arch/arm/mach-imx/ehci-imx5.c b/arch/arm/mach-imx/ehci-imx5.c
deleted file mode 100644
index e49710b10c68..000000000000
--- a/arch/arm/mach-imx/ehci-imx5.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
3 * Copyright (C) 2010 Freescale Semiconductor, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#include <linux/platform_device.h>
17#include <linux/io.h>
18#include <linux/platform_data/usb-ehci-mxc.h>
19
20#include "hardware.h"
21
22#define MXC_OTG_OFFSET 0
23#define MXC_H1_OFFSET 0x200
24#define MXC_H2_OFFSET 0x400
25
26/* USB_CTRL */
27#define MXC_OTG_UCTRL_OWIE_BIT (1 << 27) /* OTG wakeup intr enable */
28#define MXC_OTG_UCTRL_OPM_BIT (1 << 24) /* OTG power mask */
29#define MXC_H1_UCTRL_H1UIE_BIT (1 << 12) /* Host1 ULPI interrupt enable */
30#define MXC_H1_UCTRL_H1WIE_BIT (1 << 11) /* HOST1 wakeup intr enable */
31#define MXC_H1_UCTRL_H1PM_BIT (1 << 8) /* HOST1 power mask */
32
33/* USB_PHY_CTRL_FUNC */
34#define MXC_OTG_PHYCTRL_OC_POL_BIT (1 << 9) /* OTG Polarity of Overcurrent */
35#define MXC_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) /* OTG Disable Overcurrent Event */
36#define MXC_H1_OC_POL_BIT (1 << 6) /* UH1 Polarity of Overcurrent */
37#define MXC_H1_OC_DIS_BIT (1 << 5) /* UH1 Disable Overcurrent Event */
38#define MXC_OTG_PHYCTRL_PWR_POL_BIT (1 << 3) /* OTG Power Pin Polarity */
39
40/* USBH2CTRL */
41#define MXC_H2_UCTRL_H2UIE_BIT (1 << 8)
42#define MXC_H2_UCTRL_H2WIE_BIT (1 << 7)
43#define MXC_H2_UCTRL_H2PM_BIT (1 << 4)
44
45#define MXC_USBCMD_OFFSET 0x140
46
47/* USBCMD */
48#define MXC_UCMD_ITC_NO_THRESHOLD_MASK (~(0xff << 16)) /* Interrupt Threshold Control */
49
50int mx51_initialize_usb_hw(int port, unsigned int flags)
51{
52 unsigned int v;
53 void __iomem *usb_base;
54 void __iomem *usbotg_base;
55 void __iomem *usbother_base;
56 int ret = 0;
57
58 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
59 if (!usb_base) {
60 printk(KERN_ERR "%s(): ioremap failed\n", __func__);
61 return -ENOMEM;
62 }
63
64 switch (port) {
65 case 0: /* OTG port */
66 usbotg_base = usb_base + MXC_OTG_OFFSET;
67 break;
68 case 1: /* Host 1 port */
69 usbotg_base = usb_base + MXC_H1_OFFSET;
70 break;
71 case 2: /* Host 2 port */
72 usbotg_base = usb_base + MXC_H2_OFFSET;
73 break;
74 default:
75 printk(KERN_ERR"%s no such port %d\n", __func__, port);
76 ret = -ENOENT;
77 goto error;
78 }
79 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
80
81 switch (port) {
82 case 0: /*OTG port */
83 if (flags & MXC_EHCI_INTERNAL_PHY) {
84 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
85
86 if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
87 v |= MXC_OTG_PHYCTRL_OC_POL_BIT;
88 else
89 v &= ~MXC_OTG_PHYCTRL_OC_POL_BIT;
90 if (flags & MXC_EHCI_POWER_PINS_ENABLED) {
91 /* OC/USBPWR is used */
92 v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT;
93 } else {
94 /* OC/USBPWR is not used */
95 v |= MXC_OTG_PHYCTRL_OC_DIS_BIT;
96 }
97 if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
98 v |= MXC_OTG_PHYCTRL_PWR_POL_BIT;
99 else
100 v &= ~MXC_OTG_PHYCTRL_PWR_POL_BIT;
101 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
102
103 v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
104 if (flags & MXC_EHCI_WAKEUP_ENABLED)
105 v |= MXC_OTG_UCTRL_OWIE_BIT;/* OTG wakeup enable */
106 else
107 v &= ~MXC_OTG_UCTRL_OWIE_BIT;/* OTG wakeup disable */
108 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
109 v &= ~MXC_OTG_UCTRL_OPM_BIT;
110 else
111 v |= MXC_OTG_UCTRL_OPM_BIT;
112 __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
113 }
114 break;
115 case 1: /* Host 1 */
116 /*Host ULPI */
117 v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
118 if (flags & MXC_EHCI_WAKEUP_ENABLED) {
119 /* HOST1 wakeup/ULPI intr enable */
120 v |= (MXC_H1_UCTRL_H1WIE_BIT | MXC_H1_UCTRL_H1UIE_BIT);
121 } else {
122 /* HOST1 wakeup/ULPI intr disable */
123 v &= ~(MXC_H1_UCTRL_H1WIE_BIT | MXC_H1_UCTRL_H1UIE_BIT);
124 }
125
126 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
127 v &= ~MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask unused*/
128 else
129 v |= MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask used*/
130 __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
131
132 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
133 if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
134 v |= MXC_H1_OC_POL_BIT;
135 else
136 v &= ~MXC_H1_OC_POL_BIT;
137 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
138 v &= ~MXC_H1_OC_DIS_BIT; /* OC is used */
139 else
140 v |= MXC_H1_OC_DIS_BIT; /* OC is not used */
141 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
142
143 v = __raw_readl(usbotg_base + MXC_USBCMD_OFFSET);
144 if (flags & MXC_EHCI_ITC_NO_THRESHOLD)
145 /* Interrupt Threshold Control:Immediate (no threshold) */
146 v &= MXC_UCMD_ITC_NO_THRESHOLD_MASK;
147 __raw_writel(v, usbotg_base + MXC_USBCMD_OFFSET);
148 break;
149 case 2: /* Host 2 ULPI */
150 v = __raw_readl(usbother_base + MXC_USBH2CTRL_OFFSET);
151 if (flags & MXC_EHCI_WAKEUP_ENABLED) {
152 /* HOST1 wakeup/ULPI intr enable */
153 v |= (MXC_H2_UCTRL_H2WIE_BIT | MXC_H2_UCTRL_H2UIE_BIT);
154 } else {
155 /* HOST1 wakeup/ULPI intr disable */
156 v &= ~(MXC_H2_UCTRL_H2WIE_BIT | MXC_H2_UCTRL_H2UIE_BIT);
157 }
158
159 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
160 v &= ~MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask unused*/
161 else
162 v |= MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask used*/
163 __raw_writel(v, usbother_base + MXC_USBH2CTRL_OFFSET);
164 break;
165 }
166
167error:
168 iounmap(usb_base);
169 return ret;
170}
171
diff --git a/arch/arm/mach-imx/ehci.h b/arch/arm/mach-imx/ehci.h
new file mode 100644
index 000000000000..0e060023db8b
--- /dev/null
+++ b/arch/arm/mach-imx/ehci.h
@@ -0,0 +1,43 @@
1#ifndef __MACH_IMX_EHCI_H
2#define __MACH_IMX_EHCI_H
3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38int mx25_initialize_usb_hw(int port, unsigned int flags);
39int mx31_initialize_usb_hw(int port, unsigned int flags);
40int mx35_initialize_usb_hw(int port, unsigned int flags);
41int mx27_initialize_usb_hw(int port, unsigned int flags);
42
43#endif /* __MACH_IMX_EHCI_H */
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 586e0171a652..82ea74e68482 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -27,13 +27,14 @@ static void __iomem *gpc_base;
27static u32 gpc_wake_irqs[IMR_NUM]; 27static u32 gpc_wake_irqs[IMR_NUM];
28static u32 gpc_saved_imrs[IMR_NUM]; 28static u32 gpc_saved_imrs[IMR_NUM];
29 29
30void imx_gpc_pre_suspend(void) 30void imx_gpc_pre_suspend(bool arm_power_off)
31{ 31{
32 void __iomem *reg_imr1 = gpc_base + GPC_IMR1; 32 void __iomem *reg_imr1 = gpc_base + GPC_IMR1;
33 int i; 33 int i;
34 34
35 /* Tell GPC to power off ARM core when suspend */ 35 /* Tell GPC to power off ARM core when suspend */
36 writel_relaxed(0x1, gpc_base + GPC_PGC_CPU_PDN); 36 if (arm_power_off)
37 writel_relaxed(0x1, gpc_base + GPC_PGC_CPU_PDN);
37 38
38 for (i = 0; i < IMR_NUM; i++) { 39 for (i = 0; i < IMR_NUM; i++) {
39 gpc_saved_imrs[i] = readl_relaxed(reg_imr1 + i * 4); 40 gpc_saved_imrs[i] = readl_relaxed(reg_imr1 + i * 4);
diff --git a/arch/arm/mach-imx/hardware.h b/arch/arm/mach-imx/hardware.h
index abf43bb47eca..66b2b564c463 100644
--- a/arch/arm/mach-imx/hardware.h
+++ b/arch/arm/mach-imx/hardware.h
@@ -105,8 +105,6 @@
105 105
106#include "mxc.h" 106#include "mxc.h"
107 107
108#include "mx51.h"
109#include "mx53.h"
110#include "mx3x.h" 108#include "mx3x.h"
111#include "mx31.h" 109#include "mx31.h"
112#include "mx35.h" 110#include "mx35.h"
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 42a65e067443..cf8032bae277 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -29,16 +29,10 @@ static const char * const imx25_dt_board_compat[] __initconst = {
29 NULL 29 NULL
30}; 30};
31 31
32static void __init imx25_timer_init(void)
33{
34 mx25_clocks_init_dt();
35}
36
37DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") 32DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
38 .map_io = mx25_map_io, 33 .map_io = mx25_map_io,
39 .init_early = imx25_init_early, 34 .init_early = imx25_init_early,
40 .init_irq = mx25_init_irq, 35 .init_irq = mx25_init_irq,
41 .init_time = imx25_timer_init,
42 .init_machine = imx25_dt_init, 36 .init_machine = imx25_dt_init,
43 .dt_compat = imx25_dt_board_compat, 37 .dt_compat = imx25_dt_board_compat,
44 .restart = mxc_restart, 38 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 17bd4058133d..080e66c6a1d0 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -34,16 +34,10 @@ static const char * const imx27_dt_board_compat[] __initconst = {
34 NULL 34 NULL
35}; 35};
36 36
37static void __init imx27_timer_init(void)
38{
39 mx27_clocks_init_dt();
40}
41
42DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)") 37DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
43 .map_io = mx27_map_io, 38 .map_io = mx27_map_io,
44 .init_early = imx27_init_early, 39 .init_early = imx27_init_early,
45 .init_irq = mx27_init_irq, 40 .init_irq = mx27_init_irq,
46 .init_time = imx27_timer_init,
47 .init_machine = imx27_dt_init, 41 .init_machine = imx27_dt_init,
48 .dt_compat = imx27_dt_board_compat, 42 .dt_compat = imx27_dt_board_compat,
49 .restart = mxc_restart, 43 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 581f4d6c9b8a..418dbc82adc4 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -25,7 +25,7 @@ static void __init imx31_dt_init(void)
25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
26} 26}
27 27
28static const char *imx31_dt_board_compat[] __initconst = { 28static const char * const imx31_dt_board_compat[] __initconst = {
29 "fsl,imx31", 29 "fsl,imx31",
30 NULL 30 NULL
31}; 31};
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
index a62854c59240..584fbe105579 100644
--- a/arch/arm/mach-imx/imx35-dt.c
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -34,7 +34,7 @@ static void __init imx35_irq_init(void)
34 mx35_init_irq(); 34 mx35_init_irq();
35} 35}
36 36
37static const char *imx35_dt_board_compat[] __initconst = { 37static const char * const imx35_dt_board_compat[] __initconst = {
38 "fsl,imx35", 38 "fsl,imx35",
39 NULL 39 NULL
40}; 40};
diff --git a/arch/arm/mach-imx/iomux-mx51.h b/arch/arm/mach-imx/iomux-mx51.h
deleted file mode 100644
index 75bbcc4aa2d2..000000000000
--- a/arch/arm/mach-imx/iomux-mx51.h
+++ /dev/null
@@ -1,827 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
3 * Copyright (C) 2010 Freescale Semiconductor, Inc.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#ifndef __MACH_IOMUX_MX51_H__
14#define __MACH_IOMUX_MX51_H__
15
16#include "iomux-v3.h"
17#define __NA_ 0x000
18
19
20/* Pad control groupings */
21#define MX51_UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_DSE_HIGH | \
22 PAD_CTL_HYS | PAD_CTL_SRE_FAST)
23#define MX51_I2C_PAD_CTRL (PAD_CTL_SRE_FAST | PAD_CTL_ODE | \
24 PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
25 PAD_CTL_HYS)
26#define MX51_ESDHC_PAD_CTRL (PAD_CTL_SRE_FAST | PAD_CTL_ODE | \
27 PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
28 PAD_CTL_HYS)
29#define MX51_USBH1_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_SRE_FAST | \
30 PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \
31 PAD_CTL_HYS | PAD_CTL_PUE)
32#define MX51_ECSPI_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_HYS | \
33 PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST)
34#define MX51_SDHCI_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \
35 PAD_CTL_PUS_47K_UP | PAD_CTL_PUE | \
36 PAD_CTL_SRE_FAST | PAD_CTL_DVS)
37#define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | PAD_CTL_SRE_FAST)
38
39#define MX51_PAD_CTRL_2 (PAD_CTL_PKE | PAD_CTL_HYS)
40#define MX51_PAD_CTRL_3 (PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
41#define MX51_PAD_CTRL_4 (PAD_CTL_PKE | PAD_CTL_DVS | PAD_CTL_HYS)
42#define MX51_PAD_CTRL_5 (PAD_CTL_DVS | PAD_CTL_DSE_HIGH)
43
44/*
45 * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode>
46 * If <padname> or <padmode> refers to a GPIO, it is named GPIO<unit>_<num>
47 * See also iomux-v3.h
48 */
49
50/* Raw pin modes without pad control */
51/* PAD MUX ALT INPSE PATH PADCTRL */
52
53/* The same pins as above but with the default pad control values applied */
54#define MX51_PAD_EIM_D16__AUD4_RXFS IOMUX_PAD(0x3f0, 0x05c, 5, __NA_, 0, NO_PAD_CTRL)
55#define MX51_PAD_EIM_D16__AUD5_TXD IOMUX_PAD(0x3f0, 0x05c, 7, 0x8d8, 0, NO_PAD_CTRL)
56#define MX51_PAD_EIM_D16__EIM_D16 IOMUX_PAD(0x3f0, 0x05c, 0, __NA_, 0, NO_PAD_CTRL)
57#define MX51_PAD_EIM_D16__GPIO2_0 IOMUX_PAD(0x3f0, 0x05c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
58#define MX51_PAD_EIM_D16__I2C1_SDA IOMUX_PAD(0x3f0, 0x05c, 0x14, 0x9b4, 0, MX51_I2C_PAD_CTRL)
59#define MX51_PAD_EIM_D16__UART2_CTS IOMUX_PAD(0x3f0, 0x05c, 3, __NA_, 0, MX51_UART_PAD_CTRL)
60#define MX51_PAD_EIM_D16__USBH2_DATA0 IOMUX_PAD(0x3f0, 0x05c, 2, __NA_, 0, NO_PAD_CTRL)
61#define MX51_PAD_EIM_D17__AUD5_RXD IOMUX_PAD(0x3f4, 0x060, 7, 0x8d4, 0, NO_PAD_CTRL)
62#define MX51_PAD_EIM_D17__EIM_D17 IOMUX_PAD(0x3f4, 0x060, 0, __NA_, 0, NO_PAD_CTRL)
63#define MX51_PAD_EIM_D17__GPIO2_1 IOMUX_PAD(0x3f4, 0x060, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
64#define MX51_PAD_EIM_D17__UART2_RXD IOMUX_PAD(0x3f4, 0x060, 3, 0x9ec, 0, MX51_UART_PAD_CTRL)
65#define MX51_PAD_EIM_D17__UART3_CTS IOMUX_PAD(0x3f4, 0x060, 4, __NA_, 0, MX51_UART_PAD_CTRL)
66#define MX51_PAD_EIM_D17__USBH2_DATA1 IOMUX_PAD(0x3f4, 0x060, 2, __NA_, 0, NO_PAD_CTRL)
67#define MX51_PAD_EIM_D18__AUD5_TXC IOMUX_PAD(0x3f8, 0x064, 7, 0x8e4, 0, NO_PAD_CTRL)
68#define MX51_PAD_EIM_D18__EIM_D18 IOMUX_PAD(0x3f8, 0x064, 0, __NA_, 0, NO_PAD_CTRL)
69#define MX51_PAD_EIM_D18__GPIO2_2 IOMUX_PAD(0x3f8, 0x064, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
70#define MX51_PAD_EIM_D18__UART2_TXD IOMUX_PAD(0x3f8, 0x064, 3, __NA_, 0, MX51_UART_PAD_CTRL)
71#define MX51_PAD_EIM_D18__UART3_RTS IOMUX_PAD(0x3f8, 0x064, 4, 0x9f0, 1, MX51_UART_PAD_CTRL)
72#define MX51_PAD_EIM_D18__USBH2_DATA2 IOMUX_PAD(0x3f8, 0x064, 2, __NA_, 0, NO_PAD_CTRL)
73#define MX51_PAD_EIM_D19__AUD4_RXC IOMUX_PAD(0x3fc, 0x068, 5, __NA_, 0, NO_PAD_CTRL)
74#define MX51_PAD_EIM_D19__AUD5_TXFS IOMUX_PAD(0x3fc, 0x068, 7, 0x8e8, 0, NO_PAD_CTRL)
75#define MX51_PAD_EIM_D19__EIM_D19 IOMUX_PAD(0x3fc, 0x068, 0, __NA_, 0, NO_PAD_CTRL)
76#define MX51_PAD_EIM_D19__GPIO2_3 IOMUX_PAD(0x3fc, 0x068, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
77#define MX51_PAD_EIM_D19__I2C1_SCL IOMUX_PAD(0x3fc, 0x068, 0x14, 0x9b0, 0, MX51_I2C_PAD_CTRL)
78#define MX51_PAD_EIM_D19__UART2_RTS IOMUX_PAD(0x3fc, 0x068, 3, 0x9e8, 1, MX51_UART_PAD_CTRL)
79#define MX51_PAD_EIM_D19__USBH2_DATA3 IOMUX_PAD(0x3fc, 0x068, 2, __NA_, 0, NO_PAD_CTRL)
80#define MX51_PAD_EIM_D20__AUD4_TXD IOMUX_PAD(0x400, 0x06c, 5, 0x8c8, 0, NO_PAD_CTRL)
81#define MX51_PAD_EIM_D20__EIM_D20 IOMUX_PAD(0x400, 0x06c, 0, __NA_, 0, NO_PAD_CTRL)
82#define MX51_PAD_EIM_D20__GPIO2_4 IOMUX_PAD(0x400, 0x06c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
83#define MX51_PAD_EIM_D20__SRTC_ALARM_DEB IOMUX_PAD(0x400, 0x06c, 4, __NA_, 0, NO_PAD_CTRL)
84#define MX51_PAD_EIM_D20__USBH2_DATA4 IOMUX_PAD(0x400, 0x06c, 2, __NA_, 0, NO_PAD_CTRL)
85#define MX51_PAD_EIM_D21__AUD4_RXD IOMUX_PAD(0x404, 0x070, 5, 0x8c4, 0, NO_PAD_CTRL)
86#define MX51_PAD_EIM_D21__EIM_D21 IOMUX_PAD(0x404, 0x070, 0, __NA_, 0, NO_PAD_CTRL)
87#define MX51_PAD_EIM_D21__GPIO2_5 IOMUX_PAD(0x404, 0x070, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
88#define MX51_PAD_EIM_D21__SRTC_ALARM_DEB IOMUX_PAD(0x404, 0x070, 3, __NA_, 0, NO_PAD_CTRL)
89#define MX51_PAD_EIM_D21__USBH2_DATA5 IOMUX_PAD(0x404, 0x070, 2, __NA_, 0, NO_PAD_CTRL)
90#define MX51_PAD_EIM_D22__AUD4_TXC IOMUX_PAD(0x408, 0x074, 5, 0x8cc, 0, NO_PAD_CTRL)
91#define MX51_PAD_EIM_D22__EIM_D22 IOMUX_PAD(0x408, 0x074, 0, __NA_, 0, NO_PAD_CTRL)
92#define MX51_PAD_EIM_D22__GPIO2_6 IOMUX_PAD(0x408, 0x074, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
93#define MX51_PAD_EIM_D22__USBH2_DATA6 IOMUX_PAD(0x408, 0x074, 2, __NA_, 0, NO_PAD_CTRL)
94#define MX51_PAD_EIM_D23__AUD4_TXFS IOMUX_PAD(0x40c, 0x078, 5, 0x8d0, 0, NO_PAD_CTRL)
95#define MX51_PAD_EIM_D23__EIM_D23 IOMUX_PAD(0x40c, 0x078, 0, __NA_, 0, NO_PAD_CTRL)
96#define MX51_PAD_EIM_D23__GPIO2_7 IOMUX_PAD(0x40c, 0x078, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
97#define MX51_PAD_EIM_D23__SPDIF_OUT1 IOMUX_PAD(0x40c, 0x078, 4, __NA_, 0, NO_PAD_CTRL)
98#define MX51_PAD_EIM_D23__USBH2_DATA7 IOMUX_PAD(0x40c, 0x078, 2, __NA_, 0, NO_PAD_CTRL)
99#define MX51_PAD_EIM_D24__AUD6_RXFS IOMUX_PAD(0x410, 0x07c, 5, 0x8f8, 0, NO_PAD_CTRL)
100#define MX51_PAD_EIM_D24__EIM_D24 IOMUX_PAD(0x410, 0x07c, 0, __NA_, 0, NO_PAD_CTRL)
101#define MX51_PAD_EIM_D24__GPIO2_8 IOMUX_PAD(0x410, 0x07c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
102#define MX51_PAD_EIM_D24__I2C2_SDA IOMUX_PAD(0x410, 0x07c, 0x14, 0x9bc, 0, MX51_I2C_PAD_CTRL)
103#define MX51_PAD_EIM_D24__UART3_CTS IOMUX_PAD(0x410, 0x07c, 3, __NA_, 0, MX51_UART_PAD_CTRL)
104#define MX51_PAD_EIM_D24__USBOTG_DATA0 IOMUX_PAD(0x410, 0x07c, 2, __NA_, 0, NO_PAD_CTRL)
105#define MX51_PAD_EIM_D25__EIM_D25 IOMUX_PAD(0x414, 0x080, 0, __NA_, 0, NO_PAD_CTRL)
106#define MX51_PAD_EIM_D25__KEY_COL6 IOMUX_PAD(0x414, 0x080, 1, 0x9c8, 0, NO_PAD_CTRL)
107#define MX51_PAD_EIM_D25__UART2_CTS IOMUX_PAD(0x414, 0x080, 4, __NA_, 0, MX51_UART_PAD_CTRL)
108#define MX51_PAD_EIM_D25__UART3_RXD IOMUX_PAD(0x414, 0x080, 3, 0x9f4, 0, MX51_UART_PAD_CTRL)
109#define MX51_PAD_EIM_D25__USBOTG_DATA1 IOMUX_PAD(0x414, 0x080, 2, __NA_, 0, NO_PAD_CTRL)
110#define MX51_PAD_EIM_D25__GPT_CMPOUT1 IOMUX_PAD(0x414, 0x080, 5, __NA_, 0, NO_PAD_CTRL)
111#define MX51_PAD_EIM_D26__EIM_D26 IOMUX_PAD(0x418, 0x084, 0, __NA_, 0, NO_PAD_CTRL)
112#define MX51_PAD_EIM_D26__KEY_COL7 IOMUX_PAD(0x418, 0x084, 1, 0x9cc, 0, NO_PAD_CTRL)
113#define MX51_PAD_EIM_D26__UART2_RTS IOMUX_PAD(0x418, 0x084, 4, 0x9e8, 3, MX51_UART_PAD_CTRL)
114#define MX51_PAD_EIM_D26__UART3_TXD IOMUX_PAD(0x418, 0x084, 3, __NA_, 0, MX51_UART_PAD_CTRL)
115#define MX51_PAD_EIM_D26__USBOTG_DATA2 IOMUX_PAD(0x418, 0x084, 2, __NA_, 0, NO_PAD_CTRL)
116#define MX51_PAD_EIM_D26__GPT_CMPOUT2 IOMUX_PAD(0x418, 0x084, 5, __NA_, 0, NO_PAD_CTRL)
117#define MX51_PAD_EIM_D27__AUD6_RXC IOMUX_PAD(0x41c, 0x088, 5, 0x8f4, 0, NO_PAD_CTRL)
118#define MX51_PAD_EIM_D27__EIM_D27 IOMUX_PAD(0x41c, 0x088, 0, __NA_, 0, NO_PAD_CTRL)
119#define MX51_PAD_EIM_D27__GPIO2_9 IOMUX_PAD(0x41c, 0x088, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
120#define MX51_PAD_EIM_D27__I2C2_SCL IOMUX_PAD(0x41c, 0x088, 0x14, 0x9b8, 0, MX51_I2C_PAD_CTRL)
121#define MX51_PAD_EIM_D27__UART3_RTS IOMUX_PAD(0x41c, 0x088, 3, 0x9f0, 3, MX51_UART_PAD_CTRL)
122#define MX51_PAD_EIM_D27__USBOTG_DATA3 IOMUX_PAD(0x41c, 0x088, 2, __NA_, 0, NO_PAD_CTRL)
123#define MX51_PAD_EIM_D28__AUD6_TXD IOMUX_PAD(0x420, 0x08c, 5, 0x8f0, 0, NO_PAD_CTRL)
124#define MX51_PAD_EIM_D28__EIM_D28 IOMUX_PAD(0x420, 0x08c, 0, __NA_, 0, NO_PAD_CTRL)
125#define MX51_PAD_EIM_D28__KEY_ROW4 IOMUX_PAD(0x420, 0x08c, 1, 0x9d0, 0, NO_PAD_CTRL)
126#define MX51_PAD_EIM_D28__USBOTG_DATA4 IOMUX_PAD(0x420, 0x08c, 2, __NA_, 0, NO_PAD_CTRL)
127#define MX51_PAD_EIM_D29__AUD6_RXD IOMUX_PAD(0x424, 0x090, 5, 0x8ec, 0, NO_PAD_CTRL)
128#define MX51_PAD_EIM_D29__EIM_D29 IOMUX_PAD(0x424, 0x090, 0, __NA_, 0, NO_PAD_CTRL)
129#define MX51_PAD_EIM_D29__KEY_ROW5 IOMUX_PAD(0x424, 0x090, 1, 0x9d4, 0, NO_PAD_CTRL)
130#define MX51_PAD_EIM_D29__USBOTG_DATA5 IOMUX_PAD(0x424, 0x090, 2, __NA_, 0, NO_PAD_CTRL)
131#define MX51_PAD_EIM_D30__AUD6_TXC IOMUX_PAD(0x428, 0x094, 5, 0x8fc, 0, NO_PAD_CTRL)
132#define MX51_PAD_EIM_D30__EIM_D30 IOMUX_PAD(0x428, 0x094, 0, __NA_, 0, NO_PAD_CTRL)
133#define MX51_PAD_EIM_D30__KEY_ROW6 IOMUX_PAD(0x428, 0x094, 1, 0x9d8, 0, NO_PAD_CTRL)
134#define MX51_PAD_EIM_D30__USBOTG_DATA6 IOMUX_PAD(0x428, 0x094, 2, __NA_, 0, NO_PAD_CTRL)
135#define MX51_PAD_EIM_D31__AUD6_TXFS IOMUX_PAD(0x42c, 0x098, 5, 0x900, 0, NO_PAD_CTRL)
136#define MX51_PAD_EIM_D31__EIM_D31 IOMUX_PAD(0x42c, 0x098, 0, __NA_, 0, NO_PAD_CTRL)
137#define MX51_PAD_EIM_D31__KEY_ROW7 IOMUX_PAD(0x42c, 0x098, 1, 0x9dc, 0, NO_PAD_CTRL)
138#define MX51_PAD_EIM_D31__USBOTG_DATA7 IOMUX_PAD(0x42c, 0x098, 2, __NA_, 0, NO_PAD_CTRL)
139#define MX51_PAD_EIM_A16__EIM_A16 IOMUX_PAD(0x430, 0x09c, 0, __NA_, 0, NO_PAD_CTRL)
140#define MX51_PAD_EIM_A16__GPIO2_10 IOMUX_PAD(0x430, 0x09c, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
141#define MX51_PAD_EIM_A16__OSC_FREQ_SEL0 IOMUX_PAD(0x430, 0x09c, 7, __NA_, 0, NO_PAD_CTRL)
142#define MX51_PAD_EIM_A17__EIM_A17 IOMUX_PAD(0x434, 0x0a0, 0, __NA_, 0, NO_PAD_CTRL)
143#define MX51_PAD_EIM_A17__GPIO2_11 IOMUX_PAD(0x434, 0x0a0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
144#define MX51_PAD_EIM_A17__OSC_FREQ_SEL1 IOMUX_PAD(0x434, 0x0a0, 7, __NA_, 0, NO_PAD_CTRL)
145#define MX51_PAD_EIM_A18__BOOT_LPB0 IOMUX_PAD(0x438, 0x0a4, 7, __NA_, 0, NO_PAD_CTRL)
146#define MX51_PAD_EIM_A18__EIM_A18 IOMUX_PAD(0x438, 0x0a4, 0, __NA_, 0, NO_PAD_CTRL)
147#define MX51_PAD_EIM_A18__GPIO2_12 IOMUX_PAD(0x438, 0x0a4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
148#define MX51_PAD_EIM_A19__BOOT_LPB1 IOMUX_PAD(0x43c, 0x0a8, 7, __NA_, 0, NO_PAD_CTRL)
149#define MX51_PAD_EIM_A19__EIM_A19 IOMUX_PAD(0x43c, 0x0a8, 0, __NA_, 0, NO_PAD_CTRL)
150#define MX51_PAD_EIM_A19__GPIO2_13 IOMUX_PAD(0x43c, 0x0a8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
151#define MX51_PAD_EIM_A20__BOOT_UART_SRC0 IOMUX_PAD(0x440, 0x0ac, 7, __NA_, 0, NO_PAD_CTRL)
152#define MX51_PAD_EIM_A20__EIM_A20 IOMUX_PAD(0x440, 0x0ac, 0, __NA_, 0, NO_PAD_CTRL)
153#define MX51_PAD_EIM_A20__GPIO2_14 IOMUX_PAD(0x440, 0x0ac, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
154#define MX51_PAD_EIM_A21__BOOT_UART_SRC1 IOMUX_PAD(0x444, 0x0b0, 7, __NA_, 0, NO_PAD_CTRL)
155#define MX51_PAD_EIM_A21__EIM_A21 IOMUX_PAD(0x444, 0x0b0, 0, __NA_, 0, NO_PAD_CTRL)
156#define MX51_PAD_EIM_A21__GPIO2_15 IOMUX_PAD(0x444, 0x0b0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
157#define MX51_PAD_EIM_A22__EIM_A22 IOMUX_PAD(0x448, 0x0b4, 0, __NA_, 0, NO_PAD_CTRL)
158#define MX51_PAD_EIM_A22__GPIO2_16 IOMUX_PAD(0x448, 0x0b4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
159#define MX51_PAD_EIM_A23__BOOT_HPN_EN IOMUX_PAD(0x44c, 0x0b8, 7, __NA_, 0, NO_PAD_CTRL)
160#define MX51_PAD_EIM_A23__EIM_A23 IOMUX_PAD(0x44c, 0x0b8, 0, __NA_, 0, NO_PAD_CTRL)
161#define MX51_PAD_EIM_A23__GPIO2_17 IOMUX_PAD(0x44c, 0x0b8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
162#define MX51_PAD_EIM_A24__EIM_A24 IOMUX_PAD(0x450, 0x0bc, 0, __NA_, 0, NO_PAD_CTRL)
163#define MX51_PAD_EIM_A24__GPIO2_18 IOMUX_PAD(0x450, 0x0bc, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
164#define MX51_PAD_EIM_A24__USBH2_CLK IOMUX_PAD(0x450, 0x0bc, 2, __NA_, 0, NO_PAD_CTRL)
165#define MX51_PAD_EIM_A25__DISP1_PIN4 IOMUX_PAD(0x454, 0x0c0, 6, __NA_, 0, NO_PAD_CTRL)
166#define MX51_PAD_EIM_A25__EIM_A25 IOMUX_PAD(0x454, 0x0c0, 0, __NA_, 0, NO_PAD_CTRL)
167#define MX51_PAD_EIM_A25__GPIO2_19 IOMUX_PAD(0x454, 0x0c0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
168#define MX51_PAD_EIM_A25__USBH2_DIR IOMUX_PAD(0x454, 0x0c0, 2, __NA_, 0, NO_PAD_CTRL)
169#define MX51_PAD_EIM_A26__CSI1_DATA_EN IOMUX_PAD(0x458, 0x0c4, 5, 0x9a0, 0, NO_PAD_CTRL)
170#define MX51_PAD_EIM_A26__DISP2_EXT_CLK IOMUX_PAD(0x458, 0x0c4, 6, 0x908, 0, NO_PAD_CTRL)
171#define MX51_PAD_EIM_A26__EIM_A26 IOMUX_PAD(0x458, 0x0c4, 0, __NA_, 0, NO_PAD_CTRL)
172#define MX51_PAD_EIM_A26__GPIO2_20 IOMUX_PAD(0x458, 0x0c4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
173#define MX51_PAD_EIM_A26__USBH2_STP IOMUX_PAD(0x458, 0x0c4, 2, __NA_, 0, NO_PAD_CTRL)
174#define MX51_PAD_EIM_A27__CSI2_DATA_EN IOMUX_PAD(0x45c, 0x0c8, 5, 0x99c, 0, NO_PAD_CTRL)
175#define MX51_PAD_EIM_A27__DISP1_PIN1 IOMUX_PAD(0x45c, 0x0c8, 6, 0x9a4, 0, NO_PAD_CTRL)
176#define MX51_PAD_EIM_A27__EIM_A27 IOMUX_PAD(0x45c, 0x0c8, 0, __NA_, 0, NO_PAD_CTRL)
177#define MX51_PAD_EIM_A27__GPIO2_21 IOMUX_PAD(0x45c, 0x0c8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
178#define MX51_PAD_EIM_A27__USBH2_NXT IOMUX_PAD(0x45c, 0x0c8, 2, __NA_, 0, NO_PAD_CTRL)
179#define MX51_PAD_EIM_EB0__EIM_EB0 IOMUX_PAD(0x460, 0x0cc, 0, __NA_, 0, NO_PAD_CTRL)
180#define MX51_PAD_EIM_EB1__EIM_EB1 IOMUX_PAD(0x464, 0x0d0, 0, __NA_, 0, NO_PAD_CTRL)
181#define MX51_PAD_EIM_EB2__AUD5_RXFS IOMUX_PAD(0x468, 0x0d4, 6, 0x8e0, 0, NO_PAD_CTRL)
182#define MX51_PAD_EIM_EB2__CSI1_D2 IOMUX_PAD(0x468, 0x0d4, 5, __NA_, 0, NO_PAD_CTRL)
183#define MX51_PAD_EIM_EB2__EIM_EB2 IOMUX_PAD(0x468, 0x0d4, 0, __NA_, 0, NO_PAD_CTRL)
184#define MX51_PAD_EIM_EB2__FEC_MDIO (IOMUX_PAD(0x468, 0x0d4, 3, 0x954, 0, 0) | \
185 MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP | PAD_CTL_PKE | PAD_CTL_SRE_FAST | \
186 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS))
187#define MX51_PAD_EIM_EB2__GPIO2_22 IOMUX_PAD(0x468, 0x0d4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
188#define MX51_PAD_EIM_EB2__GPT_CMPOUT1 IOMUX_PAD(0x468, 0x0d4, 7, __NA_, 0, NO_PAD_CTRL)
189#define MX51_PAD_EIM_EB3__AUD5_RXC IOMUX_PAD(0x46c, 0x0d8, 6, 0x8dc, 0, NO_PAD_CTRL)
190#define MX51_PAD_EIM_EB3__CSI1_D3 IOMUX_PAD(0x46c, 0x0d8, 5, __NA_, 0, NO_PAD_CTRL)
191#define MX51_PAD_EIM_EB3__EIM_EB3 IOMUX_PAD(0x46c, 0x0d8, 0, __NA_, 0, NO_PAD_CTRL)
192#define MX51_PAD_EIM_EB3__FEC_RDATA1 IOMUX_PAD(0x46c, 0x0d8, 3, 0x95c, 0, NO_PAD_CTRL)
193#define MX51_PAD_EIM_EB3__GPIO2_23 IOMUX_PAD(0x46c, 0x0d8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
194#define MX51_PAD_EIM_EB3__GPT_CMPOUT2 IOMUX_PAD(0x46c, 0x0d8, 7, __NA_, 0, NO_PAD_CTRL)
195#define MX51_PAD_EIM_OE__EIM_OE IOMUX_PAD(0x470, 0x0dc, 0, __NA_, 0, NO_PAD_CTRL)
196#define MX51_PAD_EIM_OE__GPIO2_24 IOMUX_PAD(0x470, 0x0dc, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
197#define MX51_PAD_EIM_CS0__EIM_CS0 IOMUX_PAD(0x474, 0x0e0, 0, __NA_, 0, NO_PAD_CTRL)
198#define MX51_PAD_EIM_CS0__GPIO2_25 IOMUX_PAD(0x474, 0x0e0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
199#define MX51_PAD_EIM_CS1__EIM_CS1 IOMUX_PAD(0x478, 0x0e4, 0, __NA_, 0, NO_PAD_CTRL)
200#define MX51_PAD_EIM_CS1__GPIO2_26 IOMUX_PAD(0x478, 0x0e4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
201#define MX51_PAD_EIM_CS2__AUD5_TXD IOMUX_PAD(0x47c, 0x0e8, 6, 0x8d8, 1, NO_PAD_CTRL)
202#define MX51_PAD_EIM_CS2__CSI1_D4 IOMUX_PAD(0x47c, 0x0e8, 5, __NA_, 0, NO_PAD_CTRL)
203#define MX51_PAD_EIM_CS2__EIM_CS2 IOMUX_PAD(0x47c, 0x0e8, 0, __NA_, 0, NO_PAD_CTRL)
204#define MX51_PAD_EIM_CS2__FEC_RDATA2 IOMUX_PAD(0x47c, 0x0e8, 3, 0x960, 0, NO_PAD_CTRL)
205#define MX51_PAD_EIM_CS2__GPIO2_27 IOMUX_PAD(0x47c, 0x0e8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
206#define MX51_PAD_EIM_CS2__USBOTG_STP IOMUX_PAD(0x47c, 0x0e8, 2, __NA_, 0, NO_PAD_CTRL)
207#define MX51_PAD_EIM_CS3__AUD5_RXD IOMUX_PAD(0x480, 0x0ec, 6, 0x8d4, 1, NO_PAD_CTRL)
208#define MX51_PAD_EIM_CS3__CSI1_D5 IOMUX_PAD(0x480, 0x0ec, 5, __NA_, 0, NO_PAD_CTRL)
209#define MX51_PAD_EIM_CS3__EIM_CS3 IOMUX_PAD(0x480, 0x0ec, 0, __NA_, 0, NO_PAD_CTRL)
210#define MX51_PAD_EIM_CS3__FEC_RDATA3 IOMUX_PAD(0x480, 0x0ec, 3, 0x964, 0, NO_PAD_CTRL)
211#define MX51_PAD_EIM_CS3__GPIO2_28 IOMUX_PAD(0x480, 0x0ec, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
212#define MX51_PAD_EIM_CS3__USBOTG_NXT IOMUX_PAD(0x480, 0x0ec, 2, __NA_, 0, NO_PAD_CTRL)
213#define MX51_PAD_EIM_CS4__AUD5_TXC IOMUX_PAD(0x484, 0x0f0, 6, 0x8e4, 1, NO_PAD_CTRL)
214#define MX51_PAD_EIM_CS4__CSI1_D6 IOMUX_PAD(0x484, 0x0f0, 5, __NA_, 0, NO_PAD_CTRL)
215#define MX51_PAD_EIM_CS4__EIM_CS4 IOMUX_PAD(0x484, 0x0f0, 0, __NA_, 0, NO_PAD_CTRL)
216#define MX51_PAD_EIM_CS4__FEC_RX_ER IOMUX_PAD(0x484, 0x0f0, 3, 0x970, 0, MX51_PAD_CTRL_2)
217#define MX51_PAD_EIM_CS4__GPIO2_29 IOMUX_PAD(0x484, 0x0f0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
218#define MX51_PAD_EIM_CS4__USBOTG_CLK IOMUX_PAD(0x484, 0x0f0, 2, __NA_, 0, NO_PAD_CTRL)
219#define MX51_PAD_EIM_CS5__AUD5_TXFS IOMUX_PAD(0x488, 0x0f4, 6, 0x8e8, 1, NO_PAD_CTRL)
220#define MX51_PAD_EIM_CS5__CSI1_D7 IOMUX_PAD(0x488, 0x0f4, 5, __NA_, 0, NO_PAD_CTRL)
221#define MX51_PAD_EIM_CS5__DISP1_EXT_CLK IOMUX_PAD(0x488, 0x0f4, 4, 0x904, 0, NO_PAD_CTRL)
222#define MX51_PAD_EIM_CS5__EIM_CS5 IOMUX_PAD(0x488, 0x0f4, 0, __NA_, 0, NO_PAD_CTRL)
223#define MX51_PAD_EIM_CS5__FEC_CRS IOMUX_PAD(0x488, 0x0f4, 3, 0x950, 0, MX51_PAD_CTRL_2)
224#define MX51_PAD_EIM_CS5__GPIO2_30 IOMUX_PAD(0x488, 0x0f4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
225#define MX51_PAD_EIM_CS5__USBOTG_DIR IOMUX_PAD(0x488, 0x0f4, 2, __NA_, 0, NO_PAD_CTRL)
226#define MX51_PAD_EIM_DTACK__EIM_DTACK IOMUX_PAD(0x48c, 0x0f8, 0, __NA_, 0, NO_PAD_CTRL)
227#define MX51_PAD_EIM_DTACK__GPIO2_31 IOMUX_PAD(0x48c, 0x0f8, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
228#define MX51_PAD_EIM_LBA__EIM_LBA IOMUX_PAD(0x494, 0x0fc, 0, __NA_, 0, NO_PAD_CTRL)
229#define MX51_PAD_EIM_LBA__GPIO3_1 IOMUX_PAD(0x494, 0x0fc, 1, 0x978, 0, MX51_GPIO_PAD_CTRL)
230#define MX51_PAD_EIM_CRE__EIM_CRE IOMUX_PAD(0x4a0, 0x100, 0, __NA_, 0, NO_PAD_CTRL)
231#define MX51_PAD_EIM_CRE__GPIO3_2 IOMUX_PAD(0x4a0, 0x100, 1, 0x97c, 0, MX51_GPIO_PAD_CTRL)
232#define MX51_PAD_DRAM_CS1__DRAM_CS1 IOMUX_PAD(0x4d0, 0x104, 0, __NA_, 0, NO_PAD_CTRL)
233#define MX51_PAD_DRAM_CS1__CCM_CLKO IOMUX_PAD(0x4d0, 0x104, 1, __NA_, 0, NO_PAD_CTRL)
234#define MX51_PAD_NANDF_WE_B__GPIO3_3 IOMUX_PAD(0x4e4, 0x108, 3, 0x980, 0, MX51_GPIO_PAD_CTRL)
235#define MX51_PAD_NANDF_WE_B__NANDF_WE_B IOMUX_PAD(0x4e4, 0x108, 0, __NA_, 0, NO_PAD_CTRL)
236#define MX51_PAD_NANDF_WE_B__PATA_DIOW IOMUX_PAD(0x4e4, 0x108, 1, __NA_, 0, NO_PAD_CTRL)
237#define MX51_PAD_NANDF_WE_B__SD3_DATA0 IOMUX_PAD(0x4e4, 0x108, 2, 0x93c, 0, MX51_SDHCI_PAD_CTRL)
238#define MX51_PAD_NANDF_RE_B__GPIO3_4 IOMUX_PAD(0x4e8, 0x10c, 3, 0x984, 0, MX51_GPIO_PAD_CTRL)
239#define MX51_PAD_NANDF_RE_B__NANDF_RE_B IOMUX_PAD(0x4e8, 0x10c, 0, __NA_, 0, NO_PAD_CTRL)
240#define MX51_PAD_NANDF_RE_B__PATA_DIOR IOMUX_PAD(0x4e8, 0x10c, 1, __NA_, 0, NO_PAD_CTRL)
241#define MX51_PAD_NANDF_RE_B__SD3_DATA1 IOMUX_PAD(0x4e8, 0x10c, 2, 0x940, 0, MX51_SDHCI_PAD_CTRL)
242#define MX51_PAD_NANDF_ALE__GPIO3_5 IOMUX_PAD(0x4ec, 0x110, 3, 0x988, 0, MX51_GPIO_PAD_CTRL)
243#define MX51_PAD_NANDF_ALE__NANDF_ALE IOMUX_PAD(0x4ec, 0x110, 0, __NA_, 0, NO_PAD_CTRL)
244#define MX51_PAD_NANDF_ALE__PATA_BUFFER_EN IOMUX_PAD(0x4ec, 0x110, 1, __NA_, 0, NO_PAD_CTRL)
245#define MX51_PAD_NANDF_CLE__GPIO3_6 IOMUX_PAD(0x4f0, 0x114, 3, 0x98c, 0, MX51_GPIO_PAD_CTRL)
246#define MX51_PAD_NANDF_CLE__NANDF_CLE IOMUX_PAD(0x4f0, 0x114, 0, __NA_, 0, NO_PAD_CTRL)
247#define MX51_PAD_NANDF_CLE__PATA_RESET_B IOMUX_PAD(0x4f0, 0x114, 1, __NA_, 0, NO_PAD_CTRL)
248#define MX51_PAD_NANDF_WP_B__GPIO3_7 IOMUX_PAD(0x4f4, 0x118, 3, 0x990, 0, MX51_GPIO_PAD_CTRL)
249#define MX51_PAD_NANDF_WP_B__NANDF_WP_B IOMUX_PAD(0x4f4, 0x118, 0, __NA_, 0, NO_PAD_CTRL)
250#define MX51_PAD_NANDF_WP_B__PATA_DMACK IOMUX_PAD(0x4f4, 0x118, 1, __NA_, 0, NO_PAD_CTRL)
251#define MX51_PAD_NANDF_WP_B__SD3_DATA2 IOMUX_PAD(0x4f4, 0x118, 2, 0x944, 0, MX51_SDHCI_PAD_CTRL)
252#define MX51_PAD_NANDF_RB0__ECSPI2_SS1 IOMUX_PAD(0x4f8, 0x11c, 5, 0x930, 0, MX51_ECSPI_PAD_CTRL)
253#define MX51_PAD_NANDF_RB0__GPIO3_8 IOMUX_PAD(0x4f8, 0x11c, 3, 0x994, 0, MX51_GPIO_PAD_CTRL)
254#define MX51_PAD_NANDF_RB0__NANDF_RB0 IOMUX_PAD(0x4f8, 0x11c, 0, __NA_, 0, NO_PAD_CTRL)
255#define MX51_PAD_NANDF_RB0__PATA_DMARQ IOMUX_PAD(0x4f8, 0x11c, 1, __NA_, 0, NO_PAD_CTRL)
256#define MX51_PAD_NANDF_RB0__SD3_DATA3 IOMUX_PAD(0x4f8, 0x11c, 2, 0x948, 0, MX51_SDHCI_PAD_CTRL)
257#define MX51_PAD_NANDF_RB1__CSPI_MOSI IOMUX_PAD(0x4fc, 0x120, 6, 0x91c, 0, MX51_ECSPI_PAD_CTRL)
258#define MX51_PAD_NANDF_RB1__ECSPI2_RDY IOMUX_PAD(0x4fc, 0x120, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
259#define MX51_PAD_NANDF_RB1__GPIO3_9 IOMUX_PAD(0x4fc, 0x120, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
260#define MX51_PAD_NANDF_RB1__NANDF_RB1 IOMUX_PAD(0x4fc, 0x120, 0, __NA_, 0, NO_PAD_CTRL)
261#define MX51_PAD_NANDF_RB1__PATA_IORDY IOMUX_PAD(0x4fc, 0x120, 1, __NA_, 0, NO_PAD_CTRL)
262#define MX51_PAD_NANDF_RB1__GPT_CMPOUT2 IOMUX_PAD(0x4fc, 0x120, 4, __NA_, 0, NO_PAD_CTRL)
263#define MX51_PAD_NANDF_RB1__SD4_CMD IOMUX_PAD(0x4fc, 0x120, 0x15, __NA_, 0, MX51_SDHCI_PAD_CTRL)
264#define MX51_PAD_NANDF_RB2__DISP2_WAIT IOMUX_PAD(0x500, 0x124, 5, 0x9a8, 0, NO_PAD_CTRL)
265#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK IOMUX_PAD(0x500, 0x124, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
266#define MX51_PAD_NANDF_RB2__FEC_COL IOMUX_PAD(0x500, 0x124, 1, 0x94c, 0, MX51_PAD_CTRL_2)
267#define MX51_PAD_NANDF_RB2__GPIO3_10 IOMUX_PAD(0x500, 0x124, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
268#define MX51_PAD_NANDF_RB2__NANDF_RB2 IOMUX_PAD(0x500, 0x124, 0, __NA_, 0, NO_PAD_CTRL)
269#define MX51_PAD_NANDF_RB2__GPT_CMPOUT3 IOMUX_PAD(0x500, 0x124, 4, __NA_, 0, NO_PAD_CTRL)
270#define MX51_PAD_NANDF_RB2__USBH3_H3_DP IOMUX_PAD(0x500, 0x124, 0x17, __NA_, 0, NO_PAD_CTRL)
271#define MX51_PAD_NANDF_RB2__USBH3_NXT IOMUX_PAD(0x500, 0x124, 6, 0xa20, 0, NO_PAD_CTRL)
272#define MX51_PAD_NANDF_RB3__DISP1_WAIT IOMUX_PAD(0x504, 0x128, 5, __NA_, 0, NO_PAD_CTRL)
273#define MX51_PAD_NANDF_RB3__ECSPI2_MISO IOMUX_PAD(0x504, 0x128, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
274#define MX51_PAD_NANDF_RB3__FEC_RX_CLK IOMUX_PAD(0x504, 0x128, 1, 0x968, 0, MX51_PAD_CTRL_2)
275#define MX51_PAD_NANDF_RB3__GPIO3_11 IOMUX_PAD(0x504, 0x128, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
276#define MX51_PAD_NANDF_RB3__NANDF_RB3 IOMUX_PAD(0x504, 0x128, 0, __NA_, 0, NO_PAD_CTRL)
277#define MX51_PAD_NANDF_RB3__USBH3_CLK IOMUX_PAD(0x504, 0x128, 6, 0x9f8, 0, NO_PAD_CTRL)
278#define MX51_PAD_NANDF_RB3__USBH3_H3_DM IOMUX_PAD(0x504, 0x128, 0x17, __NA_, 0, NO_PAD_CTRL)
279#define MX51_PAD_GPIO_NAND__GPIO_NAND IOMUX_PAD(0x514, 0x12c, 0, 0x998, 0, MX51_GPIO_PAD_CTRL)
280#define MX51_PAD_GPIO_NAND__PATA_INTRQ IOMUX_PAD(0x514, 0x12c, 1, __NA_, 0, NO_PAD_CTRL)
281#define MX51_PAD_NANDF_CS0__GPIO3_16 IOMUX_PAD(0x518, 0x130, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
282#define MX51_PAD_NANDF_CS0__NANDF_CS0 IOMUX_PAD(0x518, 0x130, 0, __NA_, 0, NO_PAD_CTRL)
283#define MX51_PAD_NANDF_CS1__GPIO3_17 IOMUX_PAD(0x51c, 0x134, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
284#define MX51_PAD_NANDF_CS1__NANDF_CS1 IOMUX_PAD(0x51c, 0x134, 0, __NA_, 0, NO_PAD_CTRL)
285#define MX51_PAD_NANDF_CS2__CSPI_SCLK IOMUX_PAD(0x520, 0x138, 6, 0x914, 0, MX51_ECSPI_PAD_CTRL)
286#define MX51_PAD_NANDF_CS2__FEC_TX_ER IOMUX_PAD(0x520, 0x138, 2, __NA_, 0, MX51_PAD_CTRL_5)
287#define MX51_PAD_NANDF_CS2__GPIO3_18 IOMUX_PAD(0x520, 0x138, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
288#define MX51_PAD_NANDF_CS2__NANDF_CS2 IOMUX_PAD(0x520, 0x138, 0, __NA_, 0, NO_PAD_CTRL)
289#define MX51_PAD_NANDF_CS2__PATA_CS_0 IOMUX_PAD(0x520, 0x138, 1, __NA_, 0, NO_PAD_CTRL)
290#define MX51_PAD_NANDF_CS2__SD4_CLK IOMUX_PAD(0x520, 0x138, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
291#define MX51_PAD_NANDF_CS2__USBH3_H1_DP IOMUX_PAD(0x520, 0x138, 0x17, __NA_, 0, NO_PAD_CTRL)
292#define MX51_PAD_NANDF_CS3__FEC_MDC IOMUX_PAD(0x524, 0x13c, 2, __NA_, 0, MX51_PAD_CTRL_5)
293#define MX51_PAD_NANDF_CS3__GPIO3_19 IOMUX_PAD(0x524, 0x13c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
294#define MX51_PAD_NANDF_CS3__NANDF_CS3 IOMUX_PAD(0x524, 0x13c, 0, __NA_, 0, NO_PAD_CTRL)
295#define MX51_PAD_NANDF_CS3__PATA_CS_1 IOMUX_PAD(0x524, 0x13c, 1, __NA_, 0, NO_PAD_CTRL)
296#define MX51_PAD_NANDF_CS3__SD4_DAT0 IOMUX_PAD(0x524, 0x13c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
297#define MX51_PAD_NANDF_CS3__USBH3_H1_DM IOMUX_PAD(0x524, 0x13c, 0x17, __NA_, 0, NO_PAD_CTRL)
298#define MX51_PAD_NANDF_CS4__FEC_TDATA1 IOMUX_PAD(0x528, 0x140, 2, __NA_, 0, MX51_PAD_CTRL_5)
299#define MX51_PAD_NANDF_CS4__GPIO3_20 IOMUX_PAD(0x528, 0x140, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
300#define MX51_PAD_NANDF_CS4__NANDF_CS4 IOMUX_PAD(0x528, 0x140, 0, __NA_, 0, NO_PAD_CTRL)
301#define MX51_PAD_NANDF_CS4__PATA_DA_0 IOMUX_PAD(0x528, 0x140, 1, __NA_, 0, NO_PAD_CTRL)
302#define MX51_PAD_NANDF_CS4__SD4_DAT1 IOMUX_PAD(0x528, 0x140, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
303#define MX51_PAD_NANDF_CS4__USBH3_STP IOMUX_PAD(0x528, 0x140, 7, 0xa24, 0, NO_PAD_CTRL)
304#define MX51_PAD_NANDF_CS5__FEC_TDATA2 IOMUX_PAD(0x52c, 0x144, 2, __NA_, 0, MX51_PAD_CTRL_5)
305#define MX51_PAD_NANDF_CS5__GPIO3_21 IOMUX_PAD(0x52c, 0x144, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
306#define MX51_PAD_NANDF_CS5__NANDF_CS5 IOMUX_PAD(0x52c, 0x144, 0, __NA_, 0, NO_PAD_CTRL)
307#define MX51_PAD_NANDF_CS5__PATA_DA_1 IOMUX_PAD(0x52c, 0x144, 1, __NA_, 0, NO_PAD_CTRL)
308#define MX51_PAD_NANDF_CS5__SD4_DAT2 IOMUX_PAD(0x52c, 0x144, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
309#define MX51_PAD_NANDF_CS5__USBH3_DIR IOMUX_PAD(0x52c, 0x144, 7, 0xa1c, 0, NO_PAD_CTRL)
310#define MX51_PAD_NANDF_CS6__CSPI_SS3 IOMUX_PAD(0x530, 0x148, 7, 0x928, 0, MX51_ECSPI_PAD_CTRL)
311#define MX51_PAD_NANDF_CS6__FEC_TDATA3 IOMUX_PAD(0x530, 0x148, 2, __NA_, 0, MX51_PAD_CTRL_5)
312#define MX51_PAD_NANDF_CS6__GPIO3_22 IOMUX_PAD(0x530, 0x148, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
313#define MX51_PAD_NANDF_CS6__NANDF_CS6 IOMUX_PAD(0x530, 0x148, 0, __NA_, 0, NO_PAD_CTRL)
314#define MX51_PAD_NANDF_CS6__PATA_DA_2 IOMUX_PAD(0x530, 0x148, 1, __NA_, 0, NO_PAD_CTRL)
315#define MX51_PAD_NANDF_CS6__SD4_DAT3 IOMUX_PAD(0x530, 0x148, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
316#define MX51_PAD_NANDF_CS7__FEC_TX_EN IOMUX_PAD(0x534, 0x14c, 1, __NA_, 0, MX51_PAD_CTRL_5)
317#define MX51_PAD_NANDF_CS7__GPIO3_23 IOMUX_PAD(0x534, 0x14c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
318#define MX51_PAD_NANDF_CS7__NANDF_CS7 IOMUX_PAD(0x534, 0x14c, 0, __NA_, 0, NO_PAD_CTRL)
319#define MX51_PAD_NANDF_CS7__SD3_CLK IOMUX_PAD(0x534, 0x14c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
320#define MX51_PAD_NANDF_RDY_INT__ECSPI2_SS0 IOMUX_PAD(0x538, 0x150, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
321#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK IOMUX_PAD(0x538, 0x150, 1, 0x974, 0, MX51_PAD_CTRL_4)
322#define MX51_PAD_NANDF_RDY_INT__GPIO3_24 IOMUX_PAD(0x538, 0x150, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
323#define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT IOMUX_PAD(0x538, 0x150, 0, 0x938, 0, NO_PAD_CTRL)
324#define MX51_PAD_NANDF_RDY_INT__SD3_CMD IOMUX_PAD(0x538, 0x150, 0x15, __NA_, 0, MX51_SDHCI_PAD_CTRL)
325#define MX51_PAD_NANDF_D15__ECSPI2_MOSI IOMUX_PAD(0x53c, 0x154, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
326#define MX51_PAD_NANDF_D15__GPIO3_25 IOMUX_PAD(0x53c, 0x154, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
327#define MX51_PAD_NANDF_D15__NANDF_D15 IOMUX_PAD(0x53c, 0x154, 0, __NA_, 0, NO_PAD_CTRL)
328#define MX51_PAD_NANDF_D15__PATA_DATA15 IOMUX_PAD(0x53c, 0x154, 1, __NA_, 0, NO_PAD_CTRL)
329#define MX51_PAD_NANDF_D15__SD3_DAT7 IOMUX_PAD(0x53c, 0x154, 5, __NA_, 0, NO_PAD_CTRL)
330#define MX51_PAD_NANDF_D14__ECSPI2_SS3 IOMUX_PAD(0x540, 0x158, 2, 0x934, 0, MX51_ECSPI_PAD_CTRL)
331#define MX51_PAD_NANDF_D14__GPIO3_26 IOMUX_PAD(0x540, 0x158, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
332#define MX51_PAD_NANDF_D14__NANDF_D14 IOMUX_PAD(0x540, 0x158, 0, __NA_, 0, NO_PAD_CTRL)
333#define MX51_PAD_NANDF_D14__PATA_DATA14 IOMUX_PAD(0x540, 0x158, 1, __NA_, 0, NO_PAD_CTRL)
334#define MX51_PAD_NANDF_D14__SD3_DAT6 IOMUX_PAD(0x540, 0x158, 5, __NA_, 0, NO_PAD_CTRL)
335#define MX51_PAD_NANDF_D13__ECSPI2_SS2 IOMUX_PAD(0x544, 0x15c, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
336#define MX51_PAD_NANDF_D13__GPIO3_27 IOMUX_PAD(0x544, 0x15c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
337#define MX51_PAD_NANDF_D13__NANDF_D13 IOMUX_PAD(0x544, 0x15c, 0, __NA_, 0, NO_PAD_CTRL)
338#define MX51_PAD_NANDF_D13__PATA_DATA13 IOMUX_PAD(0x544, 0x15c, 1, __NA_, 0, NO_PAD_CTRL)
339#define MX51_PAD_NANDF_D13__SD3_DAT5 IOMUX_PAD(0x544, 0x15c, 5, __NA_, 0, NO_PAD_CTRL)
340#define MX51_PAD_NANDF_D12__ECSPI2_SS1 IOMUX_PAD(0x548, 0x160, 2, 0x930, 1, MX51_ECSPI_PAD_CTRL)
341#define MX51_PAD_NANDF_D12__GPIO3_28 IOMUX_PAD(0x548, 0x160, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
342#define MX51_PAD_NANDF_D12__NANDF_D12 IOMUX_PAD(0x548, 0x160, 0, __NA_, 0, NO_PAD_CTRL)
343#define MX51_PAD_NANDF_D12__PATA_DATA12 IOMUX_PAD(0x548, 0x160, 1, __NA_, 0, NO_PAD_CTRL)
344#define MX51_PAD_NANDF_D12__SD3_DAT4 IOMUX_PAD(0x548, 0x160, 5, __NA_, 0, NO_PAD_CTRL)
345#define MX51_PAD_NANDF_D11__FEC_RX_DV IOMUX_PAD(0x54c, 0x164, 2, 0x96c, 0, NO_PAD_CTRL)
346#define MX51_PAD_NANDF_D11__GPIO3_29 IOMUX_PAD(0x54c, 0x164, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
347#define MX51_PAD_NANDF_D11__NANDF_D11 IOMUX_PAD(0x54c, 0x164, 0, __NA_, 0, NO_PAD_CTRL)
348#define MX51_PAD_NANDF_D11__PATA_DATA11 IOMUX_PAD(0x54c, 0x164, 1, __NA_, 0, NO_PAD_CTRL)
349#define MX51_PAD_NANDF_D11__SD3_DATA3 IOMUX_PAD(0x54c, 0x164, 5, 0x948, 1, NO_PAD_CTRL)
350#define MX51_PAD_NANDF_D10__GPIO3_30 IOMUX_PAD(0x550, 0x168, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
351#define MX51_PAD_NANDF_D10__NANDF_D10 IOMUX_PAD(0x550, 0x168, 0, __NA_, 0, NO_PAD_CTRL)
352#define MX51_PAD_NANDF_D10__PATA_DATA10 IOMUX_PAD(0x550, 0x168, 1, __NA_, 0, NO_PAD_CTRL)
353#define MX51_PAD_NANDF_D10__SD3_DATA2 IOMUX_PAD(0x550, 0x168, 5, 0x944, 1, NO_PAD_CTRL)
354#define MX51_PAD_NANDF_D9__FEC_RDATA0 IOMUX_PAD(0x554, 0x16c, 0x12, 0x958, 0, MX51_PAD_CTRL_4)
355#define MX51_PAD_NANDF_D9__GPIO3_31 IOMUX_PAD(0x554, 0x16c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
356#define MX51_PAD_NANDF_D9__NANDF_D9 IOMUX_PAD(0x554, 0x16c, 0, __NA_, 0, NO_PAD_CTRL)
357#define MX51_PAD_NANDF_D9__PATA_DATA9 IOMUX_PAD(0x554, 0x16c, 1, __NA_, 0, NO_PAD_CTRL)
358#define MX51_PAD_NANDF_D9__SD3_DATA1 IOMUX_PAD(0x554, 0x16c, 5, 0x940, 1, NO_PAD_CTRL)
359#define MX51_PAD_NANDF_D8__FEC_TDATA0 IOMUX_PAD(0x558, 0x170, 2, __NA_, 0, MX51_PAD_CTRL_5)
360#define MX51_PAD_NANDF_D8__GPIO4_0 IOMUX_PAD(0x558, 0x170, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
361#define MX51_PAD_NANDF_D8__NANDF_D8 IOMUX_PAD(0x558, 0x170, 0, __NA_, 0, NO_PAD_CTRL)
362#define MX51_PAD_NANDF_D8__PATA_DATA8 IOMUX_PAD(0x558, 0x170, 1, __NA_, 0, NO_PAD_CTRL)
363#define MX51_PAD_NANDF_D8__SD3_DATA0 IOMUX_PAD(0x558, 0x170, 5, 0x93c, 1, NO_PAD_CTRL)
364#define MX51_PAD_NANDF_D7__GPIO4_1 IOMUX_PAD(0x55c, 0x174, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
365#define MX51_PAD_NANDF_D7__NANDF_D7 IOMUX_PAD(0x55c, 0x174, 0, __NA_, 0, NO_PAD_CTRL)
366#define MX51_PAD_NANDF_D7__PATA_DATA7 IOMUX_PAD(0x55c, 0x174, 1, __NA_, 0, NO_PAD_CTRL)
367#define MX51_PAD_NANDF_D7__USBH3_DATA0 IOMUX_PAD(0x55c, 0x174, 5, 0x9fc, 0, NO_PAD_CTRL)
368#define MX51_PAD_NANDF_D6__GPIO4_2 IOMUX_PAD(0x560, 0x178, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
369#define MX51_PAD_NANDF_D6__NANDF_D6 IOMUX_PAD(0x560, 0x178, 0, __NA_, 0, NO_PAD_CTRL)
370#define MX51_PAD_NANDF_D6__PATA_DATA6 IOMUX_PAD(0x560, 0x178, 1, __NA_, 0, NO_PAD_CTRL)
371#define MX51_PAD_NANDF_D6__SD4_LCTL IOMUX_PAD(0x560, 0x178, 2, __NA_, 0, NO_PAD_CTRL)
372#define MX51_PAD_NANDF_D6__USBH3_DATA1 IOMUX_PAD(0x560, 0x178, 5, 0xa00, 0, NO_PAD_CTRL)
373#define MX51_PAD_NANDF_D5__GPIO4_3 IOMUX_PAD(0x564, 0x17c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
374#define MX51_PAD_NANDF_D5__NANDF_D5 IOMUX_PAD(0x564, 0x17c, 0, __NA_, 0, NO_PAD_CTRL)
375#define MX51_PAD_NANDF_D5__PATA_DATA5 IOMUX_PAD(0x564, 0x17c, 1, __NA_, 0, NO_PAD_CTRL)
376#define MX51_PAD_NANDF_D5__SD4_WP IOMUX_PAD(0x564, 0x17c, 2, __NA_, 0, NO_PAD_CTRL)
377#define MX51_PAD_NANDF_D5__USBH3_DATA2 IOMUX_PAD(0x564, 0x17c, 5, 0xa04, 0, NO_PAD_CTRL)
378#define MX51_PAD_NANDF_D4__GPIO4_4 IOMUX_PAD(0x568, 0x180, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
379#define MX51_PAD_NANDF_D4__NANDF_D4 IOMUX_PAD(0x568, 0x180, 0, __NA_, 0, NO_PAD_CTRL)
380#define MX51_PAD_NANDF_D4__PATA_DATA4 IOMUX_PAD(0x568, 0x180, 1, __NA_, 0, NO_PAD_CTRL)
381#define MX51_PAD_NANDF_D4__SD4_CD IOMUX_PAD(0x568, 0x180, 2, __NA_, 0, NO_PAD_CTRL)
382#define MX51_PAD_NANDF_D4__USBH3_DATA3 IOMUX_PAD(0x568, 0x180, 5, 0xa08, 0, NO_PAD_CTRL)
383#define MX51_PAD_NANDF_D3__GPIO4_5 IOMUX_PAD(0x56c, 0x184, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
384#define MX51_PAD_NANDF_D3__NANDF_D3 IOMUX_PAD(0x56c, 0x184, 0, __NA_, 0, NO_PAD_CTRL)
385#define MX51_PAD_NANDF_D3__PATA_DATA3 IOMUX_PAD(0x56c, 0x184, 1, __NA_, 0, NO_PAD_CTRL)
386#define MX51_PAD_NANDF_D3__SD4_DAT4 IOMUX_PAD(0x56c, 0x184, 2, __NA_, 0, NO_PAD_CTRL)
387#define MX51_PAD_NANDF_D3__USBH3_DATA4 IOMUX_PAD(0x56c, 0x184, 5, 0xa0c, 0, NO_PAD_CTRL)
388#define MX51_PAD_NANDF_D2__GPIO4_6 IOMUX_PAD(0x570, 0x188, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
389#define MX51_PAD_NANDF_D2__NANDF_D2 IOMUX_PAD(0x570, 0x188, 0, __NA_, 0, NO_PAD_CTRL)
390#define MX51_PAD_NANDF_D2__PATA_DATA2 IOMUX_PAD(0x570, 0x188, 1, __NA_, 0, NO_PAD_CTRL)
391#define MX51_PAD_NANDF_D2__SD4_DAT5 IOMUX_PAD(0x570, 0x188, 2, __NA_, 0, NO_PAD_CTRL)
392#define MX51_PAD_NANDF_D2__USBH3_DATA5 IOMUX_PAD(0x570, 0x188, 5, 0xa10, 0, NO_PAD_CTRL)
393#define MX51_PAD_NANDF_D1__GPIO4_7 IOMUX_PAD(0x574, 0x18c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
394#define MX51_PAD_NANDF_D1__NANDF_D1 IOMUX_PAD(0x574, 0x18c, 0, __NA_, 0, NO_PAD_CTRL)
395#define MX51_PAD_NANDF_D1__PATA_DATA1 IOMUX_PAD(0x574, 0x18c, 1, __NA_, 0, NO_PAD_CTRL)
396#define MX51_PAD_NANDF_D1__SD4_DAT6 IOMUX_PAD(0x574, 0x18c, 2, __NA_, 0, NO_PAD_CTRL)
397#define MX51_PAD_NANDF_D1__USBH3_DATA6 IOMUX_PAD(0x574, 0x18c, 5, 0xa14, 0, NO_PAD_CTRL)
398#define MX51_PAD_NANDF_D0__GPIO4_8 IOMUX_PAD(0x578, 0x190, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
399#define MX51_PAD_NANDF_D0__NANDF_D0 IOMUX_PAD(0x578, 0x190, 0, __NA_, 0, NO_PAD_CTRL)
400#define MX51_PAD_NANDF_D0__PATA_DATA0 IOMUX_PAD(0x578, 0x190, 1, __NA_, 0, NO_PAD_CTRL)
401#define MX51_PAD_NANDF_D0__SD4_DAT7 IOMUX_PAD(0x578, 0x190, 2, __NA_, 0, NO_PAD_CTRL)
402#define MX51_PAD_NANDF_D0__USBH3_DATA7 IOMUX_PAD(0x578, 0x190, 5, 0xa18, 0, NO_PAD_CTRL)
403#define MX51_PAD_CSI1_D8__CSI1_D8 IOMUX_PAD(0x57c, 0x194, 0, __NA_, 0, NO_PAD_CTRL)
404#define MX51_PAD_CSI1_D8__GPIO3_12 IOMUX_PAD(0x57c, 0x194, 3, 0x998, 1, MX51_GPIO_PAD_CTRL)
405#define MX51_PAD_CSI1_D9__CSI1_D9 IOMUX_PAD(0x580, 0x198, 0, __NA_, 0, NO_PAD_CTRL)
406#define MX51_PAD_CSI1_D9__GPIO3_13 IOMUX_PAD(0x580, 0x198, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
407#define MX51_PAD_CSI1_D10__CSI1_D10 IOMUX_PAD(0x584, 0x19c, 0, __NA_, 0, NO_PAD_CTRL)
408#define MX51_PAD_CSI1_D11__CSI1_D11 IOMUX_PAD(0x588, 0x1a0, 0, __NA_, 0, NO_PAD_CTRL)
409#define MX51_PAD_CSI1_D12__CSI1_D12 IOMUX_PAD(0x58c, 0x1a4, 0, __NA_, 0, NO_PAD_CTRL)
410#define MX51_PAD_CSI1_D13__CSI1_D13 IOMUX_PAD(0x590, 0x1a8, 0, __NA_, 0, NO_PAD_CTRL)
411#define MX51_PAD_CSI1_D14__CSI1_D14 IOMUX_PAD(0x594, 0x1ac, 0, __NA_, 0, NO_PAD_CTRL)
412#define MX51_PAD_CSI1_D15__CSI1_D15 IOMUX_PAD(0x598, 0x1b0, 0, __NA_, 0, NO_PAD_CTRL)
413#define MX51_PAD_CSI1_D16__CSI1_D16 IOMUX_PAD(0x59c, 0x1b4, 0, __NA_, 0, NO_PAD_CTRL)
414#define MX51_PAD_CSI1_D17__CSI1_D17 IOMUX_PAD(0x5a0, 0x1b8, 0, __NA_, 0, NO_PAD_CTRL)
415#define MX51_PAD_CSI1_D18__CSI1_D18 IOMUX_PAD(0x5a4, 0x1bc, 0, __NA_, 0, NO_PAD_CTRL)
416#define MX51_PAD_CSI1_D19__CSI1_D19 IOMUX_PAD(0x5a8, 0x1c0, 0, __NA_, 0, NO_PAD_CTRL)
417#define MX51_PAD_CSI1_VSYNC__CSI1_VSYNC IOMUX_PAD(0x5ac, 0x1c4, 0, __NA_, 0, NO_PAD_CTRL)
418#define MX51_PAD_CSI1_VSYNC__GPIO3_14 IOMUX_PAD(0x5ac, 0x1c4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
419#define MX51_PAD_CSI1_HSYNC__CSI1_HSYNC IOMUX_PAD(0x5b0, 0x1c8, 0, __NA_, 0, NO_PAD_CTRL)
420#define MX51_PAD_CSI1_HSYNC__GPIO3_15 IOMUX_PAD(0x5b0, 0x1c8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
421#define MX51_PAD_CSI1_PIXCLK__CSI1_PIXCLK IOMUX_PAD(0x5b4, __NA_, 0, 0x000, 0, NO_PAD_CTRL)
422#define MX51_PAD_CSI1_MCLK__CSI1_MCLK IOMUX_PAD(0x5b8, __NA_, 0, 0x000, 0, NO_PAD_CTRL)
423#define MX51_PAD_CSI2_D12__CSI2_D12 IOMUX_PAD(0x5bc, 0x1cc, 0, __NA_, 0, NO_PAD_CTRL)
424#define MX51_PAD_CSI2_D12__GPIO4_9 IOMUX_PAD(0x5bc, 0x1cc, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
425#define MX51_PAD_CSI2_D13__CSI2_D13 IOMUX_PAD(0x5c0, 0x1d0, 0, __NA_, 0, NO_PAD_CTRL)
426#define MX51_PAD_CSI2_D13__GPIO4_10 IOMUX_PAD(0x5c0, 0x1d0, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
427#define MX51_PAD_CSI2_D14__CSI2_D14 IOMUX_PAD(0x5c4, 0x1d4, 0, __NA_, 0, NO_PAD_CTRL)
428#define MX51_PAD_CSI2_D15__CSI2_D15 IOMUX_PAD(0x5c8, 0x1d8, 0, __NA_, 0, NO_PAD_CTRL)
429#define MX51_PAD_CSI2_D16__CSI2_D16 IOMUX_PAD(0x5cc, 0x1dc, 0, __NA_, 0, NO_PAD_CTRL)
430#define MX51_PAD_CSI2_D17__CSI2_D17 IOMUX_PAD(0x5d0, 0x1e0, 0, __NA_, 0, NO_PAD_CTRL)
431#define MX51_PAD_CSI2_D18__CSI2_D18 IOMUX_PAD(0x5d4, 0x1e4, 0, __NA_, 0, NO_PAD_CTRL)
432#define MX51_PAD_CSI2_D18__GPIO4_11 IOMUX_PAD(0x5d4, 0x1e4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
433#define MX51_PAD_CSI2_D19__CSI2_D19 IOMUX_PAD(0x5d8, 0x1e8, 0, __NA_, 0, NO_PAD_CTRL)
434#define MX51_PAD_CSI2_D19__GPIO4_12 IOMUX_PAD(0x5d8, 0x1e8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
435#define MX51_PAD_CSI2_VSYNC__CSI2_VSYNC IOMUX_PAD(0x5dc, 0x1ec, 0, __NA_, 0, NO_PAD_CTRL)
436#define MX51_PAD_CSI2_VSYNC__GPIO4_13 IOMUX_PAD(0x5dc, 0x1ec, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
437#define MX51_PAD_CSI2_HSYNC__CSI2_HSYNC IOMUX_PAD(0x5e0, 0x1f0, 0, __NA_, 0, NO_PAD_CTRL)
438#define MX51_PAD_CSI2_HSYNC__GPIO4_14 IOMUX_PAD(0x5e0, 0x1f0, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
439#define MX51_PAD_CSI2_PIXCLK__CSI2_PIXCLK IOMUX_PAD(0x5e4, 0x1f4, 0, __NA_, 0, NO_PAD_CTRL)
440#define MX51_PAD_CSI2_PIXCLK__GPIO4_15 IOMUX_PAD(0x5e4, 0x1f4, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
441#define MX51_PAD_I2C1_CLK__GPIO4_16 IOMUX_PAD(0x5e8, 0x1f8, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
442#define MX51_PAD_I2C1_CLK__I2C1_CLK IOMUX_PAD(0x5e8, 0x1f8, 0x10, __NA_, 0, MX51_I2C_PAD_CTRL)
443#define MX51_PAD_I2C1_DAT__GPIO4_17 IOMUX_PAD(0x5ec, 0x1fc, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
444#define MX51_PAD_I2C1_DAT__I2C1_DAT IOMUX_PAD(0x5ec, 0x1fc, 0x10, __NA_, 0, MX51_I2C_PAD_CTRL)
445#define MX51_PAD_AUD3_BB_TXD__AUD3_TXD IOMUX_PAD(0x5f0, 0x200, 0, __NA_, 0, NO_PAD_CTRL)
446#define MX51_PAD_AUD3_BB_TXD__GPIO4_18 IOMUX_PAD(0x5f0, 0x200, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
447#define MX51_PAD_AUD3_BB_RXD__AUD3_RXD IOMUX_PAD(0x5f4, 0x204, 0, __NA_, 0, NO_PAD_CTRL)
448#define MX51_PAD_AUD3_BB_RXD__GPIO4_19 IOMUX_PAD(0x5f4, 0x204, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
449#define MX51_PAD_AUD3_BB_RXD__UART3_RXD IOMUX_PAD(0x5f4, 0x204, 1, 0x9f4, 2, MX51_UART_PAD_CTRL)
450#define MX51_PAD_AUD3_BB_CK__AUD3_TXC IOMUX_PAD(0x5f8, 0x208, 0, __NA_, 0, NO_PAD_CTRL)
451#define MX51_PAD_AUD3_BB_CK__GPIO4_20 IOMUX_PAD(0x5f8, 0x208, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
452#define MX51_PAD_AUD3_BB_FS__AUD3_TXFS IOMUX_PAD(0x5fc, 0x20c, 0, __NA_, 0, NO_PAD_CTRL)
453#define MX51_PAD_AUD3_BB_FS__GPIO4_21 IOMUX_PAD(0x5fc, 0x20c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
454#define MX51_PAD_AUD3_BB_FS__UART3_TXD IOMUX_PAD(0x5fc, 0x20c, 1, __NA_, 0, MX51_UART_PAD_CTRL)
455#define MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI IOMUX_PAD(0x600, 0x210, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
456#define MX51_PAD_CSPI1_MOSI__GPIO4_22 IOMUX_PAD(0x600, 0x210, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
457#define MX51_PAD_CSPI1_MOSI__I2C1_SDA IOMUX_PAD(0x600, 0x210, 0x11, 0x9b4, 1, MX51_I2C_PAD_CTRL)
458#define MX51_PAD_CSPI1_MISO__AUD4_RXD IOMUX_PAD(0x604, 0x214, 1, 0x8c4, 1, NO_PAD_CTRL)
459#define MX51_PAD_CSPI1_MISO__ECSPI1_MISO IOMUX_PAD(0x604, 0x214, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
460#define MX51_PAD_CSPI1_MISO__GPIO4_23 IOMUX_PAD(0x604, 0x214, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
461#define MX51_PAD_CSPI1_SS0__AUD4_TXC IOMUX_PAD(0x608, 0x218, 1, 0x8cc, 1, NO_PAD_CTRL)
462#define MX51_PAD_CSPI1_SS0__ECSPI1_SS0 IOMUX_PAD(0x608, 0x218, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
463#define MX51_PAD_CSPI1_SS0__GPIO4_24 IOMUX_PAD(0x608, 0x218, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
464#define MX51_PAD_CSPI1_SS1__AUD4_TXD IOMUX_PAD(0x60c, 0x21c, 1, 0x8c8, 1, NO_PAD_CTRL)
465#define MX51_PAD_CSPI1_SS1__ECSPI1_SS1 IOMUX_PAD(0x60c, 0x21c, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
466#define MX51_PAD_CSPI1_SS1__GPIO4_25 IOMUX_PAD(0x60c, 0x21c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
467#define MX51_PAD_CSPI1_RDY__AUD4_TXFS IOMUX_PAD(0x610, 0x220, 1, 0x8d0, 1, NO_PAD_CTRL)
468#define MX51_PAD_CSPI1_RDY__ECSPI1_RDY IOMUX_PAD(0x610, 0x220, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
469#define MX51_PAD_CSPI1_RDY__GPIO4_26 IOMUX_PAD(0x610, 0x220, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
470#define MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK IOMUX_PAD(0x614, 0x224, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL)
471#define MX51_PAD_CSPI1_SCLK__GPIO4_27 IOMUX_PAD(0x614, 0x224, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
472#define MX51_PAD_CSPI1_SCLK__I2C1_SCL IOMUX_PAD(0x614, 0x224, 0x11, 0x9b0, 1, MX51_I2C_PAD_CTRL)
473#define MX51_PAD_UART1_RXD__GPIO4_28 IOMUX_PAD(0x618, 0x228, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
474#define MX51_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART_PAD_CTRL)
475#define MX51_PAD_UART1_TXD__GPIO4_29 IOMUX_PAD(0x61c, 0x22c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
476#define MX51_PAD_UART1_TXD__PWM2_PWMO IOMUX_PAD(0x61c, 0x22c, 1, __NA_, 0, NO_PAD_CTRL)
477#define MX51_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x61c, 0x22c, 0, __NA_, 0, MX51_UART_PAD_CTRL)
478#define MX51_PAD_UART1_RTS__GPIO4_30 IOMUX_PAD(0x620, 0x230, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
479#define MX51_PAD_UART1_RTS__UART1_RTS IOMUX_PAD(0x620, 0x230, 0, 0x9e0, 0, MX51_UART_PAD_CTRL)
480#define MX51_PAD_UART1_CTS__GPIO4_31 IOMUX_PAD(0x624, 0x234, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
481#define MX51_PAD_UART1_CTS__UART1_CTS IOMUX_PAD(0x624, 0x234, 0, __NA_, 0, MX51_UART_PAD_CTRL)
482#define MX51_PAD_UART2_RXD__FIRI_TXD IOMUX_PAD(0x628, 0x238, 1, __NA_, 0, NO_PAD_CTRL)
483#define MX51_PAD_UART2_RXD__GPIO1_20 IOMUX_PAD(0x628, 0x238, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
484#define MX51_PAD_UART2_RXD__UART2_RXD IOMUX_PAD(0x628, 0x238, 0, 0x9ec, 2, MX51_UART_PAD_CTRL)
485#define MX51_PAD_UART2_TXD__FIRI_RXD IOMUX_PAD(0x62c, 0x23c, 1, __NA_, 0, NO_PAD_CTRL)
486#define MX51_PAD_UART2_TXD__GPIO1_21 IOMUX_PAD(0x62c, 0x23c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
487#define MX51_PAD_UART2_TXD__UART2_TXD IOMUX_PAD(0x62c, 0x23c, 0, __NA_, 0, MX51_UART_PAD_CTRL)
488#define MX51_PAD_UART3_RXD__CSI1_D0 IOMUX_PAD(0x630, 0x240, 2, __NA_, 0, NO_PAD_CTRL)
489#define MX51_PAD_UART3_RXD__GPIO1_22 IOMUX_PAD(0x630, 0x240, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
490#define MX51_PAD_UART3_RXD__UART1_DTR IOMUX_PAD(0x630, 0x240, 0, __NA_, 0, NO_PAD_CTRL)
491#define MX51_PAD_UART3_RXD__UART3_RXD IOMUX_PAD(0x630, 0x240, 1, 0x9f4, 4, MX51_UART_PAD_CTRL)
492#define MX51_PAD_UART3_TXD__CSI1_D1 IOMUX_PAD(0x634, 0x244, 2, __NA_, 0, NO_PAD_CTRL)
493#define MX51_PAD_UART3_TXD__GPIO1_23 IOMUX_PAD(0x634, 0x244, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
494#define MX51_PAD_UART3_TXD__UART1_DSR IOMUX_PAD(0x634, 0x244, 0, __NA_, 0, MX51_UART_PAD_CTRL)
495#define MX51_PAD_UART3_TXD__UART3_TXD IOMUX_PAD(0x634, 0x244, 1, __NA_, 0, MX51_UART_PAD_CTRL)
496#define MX51_PAD_OWIRE_LINE__GPIO1_24 IOMUX_PAD(0x638, 0x248, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
497#define MX51_PAD_OWIRE_LINE__OWIRE_LINE IOMUX_PAD(0x638, 0x248, 0, __NA_, 0, NO_PAD_CTRL)
498#define MX51_PAD_OWIRE_LINE__SPDIF_OUT IOMUX_PAD(0x638, 0x248, 6, __NA_, 0, NO_PAD_CTRL)
499#define MX51_PAD_KEY_ROW0__KEY_ROW0 IOMUX_PAD(0x63c, 0x24c, 0, __NA_, 0, NO_PAD_CTRL)
500#define MX51_PAD_KEY_ROW1__KEY_ROW1 IOMUX_PAD(0x640, 0x250, 0, __NA_, 0, NO_PAD_CTRL)
501#define MX51_PAD_KEY_ROW2__KEY_ROW2 IOMUX_PAD(0x644, 0x254, 0, __NA_, 0, NO_PAD_CTRL)
502#define MX51_PAD_KEY_ROW3__KEY_ROW3 IOMUX_PAD(0x648, 0x258, 0, __NA_, 0, NO_PAD_CTRL)
503#define MX51_PAD_KEY_COL0__KEY_COL0 IOMUX_PAD(0x64c, 0x25c, 0, __NA_, 0, NO_PAD_CTRL)
504#define MX51_PAD_KEY_COL0__PLL1_BYP IOMUX_PAD(0x64c, 0x25c, 7, 0x90c, 0, NO_PAD_CTRL)
505#define MX51_PAD_KEY_COL1__KEY_COL1 IOMUX_PAD(0x650, 0x260, 0, __NA_, 0, NO_PAD_CTRL)
506#define MX51_PAD_KEY_COL1__PLL2_BYP IOMUX_PAD(0x650, 0x260, 7, 0x910, 0, NO_PAD_CTRL)
507#define MX51_PAD_KEY_COL2__KEY_COL2 IOMUX_PAD(0x654, 0x264, 0, __NA_, 0, NO_PAD_CTRL)
508#define MX51_PAD_KEY_COL2__PLL3_BYP IOMUX_PAD(0x654, 0x264, 7, __NA_, 0, NO_PAD_CTRL)
509#define MX51_PAD_KEY_COL3__KEY_COL3 IOMUX_PAD(0x658, 0x268, 0, __NA_, 0, NO_PAD_CTRL)
510#define MX51_PAD_KEY_COL4__I2C2_SCL IOMUX_PAD(0x65c, 0x26c, 0x13, 0x9b8, 1, MX51_I2C_PAD_CTRL)
511#define MX51_PAD_KEY_COL4__KEY_COL4 IOMUX_PAD(0x65c, 0x26c, 0, __NA_, 0, NO_PAD_CTRL)
512#define MX51_PAD_KEY_COL4__SPDIF_OUT1 IOMUX_PAD(0x65c, 0x26c, 6, __NA_, 0, NO_PAD_CTRL)
513#define MX51_PAD_KEY_COL4__UART1_RI IOMUX_PAD(0x65c, 0x26c, 1, __NA_, 0, MX51_UART_PAD_CTRL)
514#define MX51_PAD_KEY_COL4__UART3_RTS IOMUX_PAD(0x65c, 0x26c, 2, 0x9f0, 4, MX51_UART_PAD_CTRL)
515#define MX51_PAD_KEY_COL5__I2C2_SDA IOMUX_PAD(0x660, 0x270, 0x13, 0x9bc, 1, MX51_I2C_PAD_CTRL)
516#define MX51_PAD_KEY_COL5__KEY_COL5 IOMUX_PAD(0x660, 0x270, 0, __NA_, 0, NO_PAD_CTRL)
517#define MX51_PAD_KEY_COL5__UART1_DCD IOMUX_PAD(0x660, 0x270, 1, __NA_, 0, MX51_UART_PAD_CTRL)
518#define MX51_PAD_KEY_COL5__UART3_CTS IOMUX_PAD(0x660, 0x270, 2, __NA_, 0, MX51_UART_PAD_CTRL)
519#define MX51_PAD_USBH1_CLK__CSPI_SCLK IOMUX_PAD(0x678, 0x278, 1, 0x914, 1, MX51_ECSPI_PAD_CTRL)
520#define MX51_PAD_USBH1_CLK__GPIO1_25 IOMUX_PAD(0x678, 0x278, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
521#define MX51_PAD_USBH1_CLK__I2C2_SCL IOMUX_PAD(0x678, 0x278, 0x15, 0x9b8, 2, MX51_I2C_PAD_CTRL)
522#define MX51_PAD_USBH1_CLK__USBH1_CLK IOMUX_PAD(0x678, 0x278, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
523#define MX51_PAD_USBH1_DIR__CSPI_MOSI IOMUX_PAD(0x67c, 0x27c, 1, 0x91c, 1, MX51_ECSPI_PAD_CTRL)
524#define MX51_PAD_USBH1_DIR__GPIO1_26 IOMUX_PAD(0x67c, 0x27c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
525#define MX51_PAD_USBH1_DIR__I2C2_SDA IOMUX_PAD(0x67c, 0x27c, 0x15, 0x9bc, 2, MX51_I2C_PAD_CTRL)
526#define MX51_PAD_USBH1_DIR__USBH1_DIR IOMUX_PAD(0x67c, 0x27c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
527#define MX51_PAD_USBH1_STP__CSPI_RDY IOMUX_PAD(0x680, 0x280, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
528#define MX51_PAD_USBH1_STP__GPIO1_27 IOMUX_PAD(0x680, 0x280, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
529#define MX51_PAD_USBH1_STP__UART3_RXD IOMUX_PAD(0x680, 0x280, 5, 0x9f4, 6, MX51_UART_PAD_CTRL)
530#define MX51_PAD_USBH1_STP__USBH1_STP IOMUX_PAD(0x680, 0x280, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
531#define MX51_PAD_USBH1_NXT__CSPI_MISO IOMUX_PAD(0x684, 0x284, 1, 0x918, 0, MX51_ECSPI_PAD_CTRL)
532#define MX51_PAD_USBH1_NXT__GPIO1_28 IOMUX_PAD(0x684, 0x284, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
533#define MX51_PAD_USBH1_NXT__UART3_TXD IOMUX_PAD(0x684, 0x284, 5, __NA_, 0, MX51_UART_PAD_CTRL)
534#define MX51_PAD_USBH1_NXT__USBH1_NXT IOMUX_PAD(0x684, 0x284, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
535#define MX51_PAD_USBH1_DATA0__GPIO1_11 IOMUX_PAD(0x688, 0x288, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
536#define MX51_PAD_USBH1_DATA0__UART2_CTS IOMUX_PAD(0x688, 0x288, 1, __NA_, 0, MX51_UART_PAD_CTRL)
537#define MX51_PAD_USBH1_DATA0__USBH1_DATA0 IOMUX_PAD(0x688, 0x288, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
538#define MX51_PAD_USBH1_DATA1__GPIO1_12 IOMUX_PAD(0x68c, 0x28c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
539#define MX51_PAD_USBH1_DATA1__UART2_RXD IOMUX_PAD(0x68c, 0x28c, 1, 0x9ec, 4, MX51_UART_PAD_CTRL)
540#define MX51_PAD_USBH1_DATA1__USBH1_DATA1 IOMUX_PAD(0x68c, 0x28c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
541#define MX51_PAD_USBH1_DATA2__GPIO1_13 IOMUX_PAD(0x690, 0x290, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
542#define MX51_PAD_USBH1_DATA2__UART2_TXD IOMUX_PAD(0x690, 0x290, 1, __NA_, 0, MX51_UART_PAD_CTRL)
543#define MX51_PAD_USBH1_DATA2__USBH1_DATA2 IOMUX_PAD(0x690, 0x290, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
544#define MX51_PAD_USBH1_DATA3__GPIO1_14 IOMUX_PAD(0x694, 0x294, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
545#define MX51_PAD_USBH1_DATA3__UART2_RTS IOMUX_PAD(0x694, 0x294, 1, 0x9e8, 5, MX51_UART_PAD_CTRL)
546#define MX51_PAD_USBH1_DATA3__USBH1_DATA3 IOMUX_PAD(0x694, 0x294, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
547#define MX51_PAD_USBH1_DATA4__CSPI_SS0 IOMUX_PAD(0x698, 0x298, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
548#define MX51_PAD_USBH1_DATA4__GPIO1_15 IOMUX_PAD(0x698, 0x298, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
549#define MX51_PAD_USBH1_DATA4__USBH1_DATA4 IOMUX_PAD(0x698, 0x298, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
550#define MX51_PAD_USBH1_DATA5__CSPI_SS1 IOMUX_PAD(0x69c, 0x29c, 1, 0x920, 0, MX51_ECSPI_PAD_CTRL)
551#define MX51_PAD_USBH1_DATA5__GPIO1_16 IOMUX_PAD(0x69c, 0x29c, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
552#define MX51_PAD_USBH1_DATA5__USBH1_DATA5 IOMUX_PAD(0x69c, 0x29c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
553#define MX51_PAD_USBH1_DATA6__CSPI_SS3 IOMUX_PAD(0x6a0, 0x2a0, 1, 0x928, 1, MX51_ECSPI_PAD_CTRL)
554#define MX51_PAD_USBH1_DATA6__GPIO1_17 IOMUX_PAD(0x6a0, 0x2a0, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
555#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 IOMUX_PAD(0x6a0, 0x2a0, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
556#define MX51_PAD_USBH1_DATA7__ECSPI1_SS3 IOMUX_PAD(0x6a4, 0x2a4, 1, __NA_, 0, MX51_ECSPI_PAD_CTRL)
557#define MX51_PAD_USBH1_DATA7__ECSPI2_SS3 IOMUX_PAD(0x6a4, 0x2a4, 5, 0x934, 1, MX51_ECSPI_PAD_CTRL)
558#define MX51_PAD_USBH1_DATA7__GPIO1_18 IOMUX_PAD(0x6a4, 0x2a4, 2, __NA_, 0, MX51_GPIO_PAD_CTRL)
559#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 IOMUX_PAD(0x6a4, 0x2a4, 0, __NA_, 0, MX51_USBH1_PAD_CTRL)
560#define MX51_PAD_DI1_PIN11__DI1_PIN11 IOMUX_PAD(0x6a8, 0x2a8, 0, __NA_, 0, NO_PAD_CTRL)
561#define MX51_PAD_DI1_PIN11__ECSPI1_SS2 IOMUX_PAD(0x6a8, 0x2a8, 7, __NA_, 0, MX51_ECSPI_PAD_CTRL)
562#define MX51_PAD_DI1_PIN11__GPIO3_0 IOMUX_PAD(0x6a8, 0x2a8, 4, __NA_, 0, MX51_GPIO_PAD_CTRL)
563#define MX51_PAD_DI1_PIN12__DI1_PIN12 IOMUX_PAD(0x6ac, 0x2ac, 0, __NA_, 0, NO_PAD_CTRL)
564#define MX51_PAD_DI1_PIN12__GPIO3_1 IOMUX_PAD(0x6ac, 0x2ac, 4, 0x978, 1, MX51_GPIO_PAD_CTRL)
565#define MX51_PAD_DI1_PIN13__DI1_PIN13 IOMUX_PAD(0x6b0, 0x2b0, 0, __NA_, 0, NO_PAD_CTRL)
566#define MX51_PAD_DI1_PIN13__GPIO3_2 IOMUX_PAD(0x6b0, 0x2b0, 4, 0x97c, 1, MX51_GPIO_PAD_CTRL)
567#define MX51_PAD_DI1_D0_CS__DI1_D0_CS IOMUX_PAD(0x6b4, 0x2b4, 0, __NA_, 0, NO_PAD_CTRL)
568#define MX51_PAD_DI1_D0_CS__GPIO3_3 IOMUX_PAD(0x6b4, 0x2b4, 4, 0x980, 1, MX51_GPIO_PAD_CTRL)
569#define MX51_PAD_DI1_D1_CS__DI1_D1_CS IOMUX_PAD(0x6b8, 0x2b8, 0, __NA_, 0, NO_PAD_CTRL)
570#define MX51_PAD_DI1_D1_CS__DISP1_PIN14 IOMUX_PAD(0x6b8, 0x2b8, 2, __NA_, 0, NO_PAD_CTRL)
571#define MX51_PAD_DI1_D1_CS__DISP1_PIN5 IOMUX_PAD(0x6b8, 0x2b8, 3, __NA_, 0, NO_PAD_CTRL)
572#define MX51_PAD_DI1_D1_CS__GPIO3_4 IOMUX_PAD(0x6b8, 0x2b8, 4, 0x984, 1, MX51_GPIO_PAD_CTRL)
573#define MX51_PAD_DISPB2_SER_DIN__DISP1_PIN1 IOMUX_PAD(0x6bc, 0x2bc, 2, 0x9a4, 1, NO_PAD_CTRL)
574#define MX51_PAD_DISPB2_SER_DIN__DISPB2_SER_DIN IOMUX_PAD(0x6bc, 0x2bc, 0, 0x9c4, 0, NO_PAD_CTRL)
575#define MX51_PAD_DISPB2_SER_DIN__GPIO3_5 IOMUX_PAD(0x6bc, 0x2bc, 4, 0x988, 1, MX51_GPIO_PAD_CTRL)
576#define MX51_PAD_DISPB2_SER_DIO__DISP1_PIN6 IOMUX_PAD(0x6c0, 0x2c0, 3, __NA_, 0, NO_PAD_CTRL)
577#define MX51_PAD_DISPB2_SER_DIO__DISPB2_SER_DIO IOMUX_PAD(0x6c0, 0x2c0, 0, 0x9c4, 1, NO_PAD_CTRL)
578#define MX51_PAD_DISPB2_SER_DIO__GPIO3_6 IOMUX_PAD(0x6c0, 0x2c0, 4, 0x98c, 1, MX51_GPIO_PAD_CTRL)
579#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN17 IOMUX_PAD(0x6c4, 0x2c4, 2, __NA_, 0, NO_PAD_CTRL)
580#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN7 IOMUX_PAD(0x6c4, 0x2c4, 3, __NA_, 0, NO_PAD_CTRL)
581#define MX51_PAD_DISPB2_SER_CLK__DISPB2_SER_CLK IOMUX_PAD(0x6c4, 0x2c4, 0, __NA_, 0, NO_PAD_CTRL)
582#define MX51_PAD_DISPB2_SER_CLK__GPIO3_7 IOMUX_PAD(0x6c4, 0x2c4, 4, 0x990, 1, MX51_GPIO_PAD_CTRL)
583#define MX51_PAD_DISPB2_SER_RS__DISP1_EXT_CLK IOMUX_PAD(0x6c8, 0x2c8, 2, __NA_, 0, NO_PAD_CTRL)
584#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN16 IOMUX_PAD(0x6c8, 0x2c8, 2, __NA_, 0, NO_PAD_CTRL)
585#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN8 IOMUX_PAD(0x6c8, 0x2c8, 3, __NA_, 0, NO_PAD_CTRL)
586#define MX51_PAD_DISPB2_SER_RS__DISPB2_SER_RS IOMUX_PAD(0x6c8, 0x2c8, 0, __NA_, 0, NO_PAD_CTRL)
587#define MX51_PAD_DISPB2_SER_RS__DISPB2_SER_RS IOMUX_PAD(0x6c8, 0x2c8, 0, __NA_, 0, NO_PAD_CTRL)
588#define MX51_PAD_DISPB2_SER_RS__GPIO3_8 IOMUX_PAD(0x6c8, 0x2c8, 4, 0x994, 1, MX51_GPIO_PAD_CTRL)
589#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 IOMUX_PAD(0x6cc, 0x2cc, 0, __NA_, 0, NO_PAD_CTRL)
590#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 IOMUX_PAD(0x6d0, 0x2d0, 0, __NA_, 0, NO_PAD_CTRL)
591#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 IOMUX_PAD(0x6d4, 0x2d4, 0, __NA_, 0, NO_PAD_CTRL)
592#define MX51_PAD_DISP1_DAT3__DISP1_DAT3 IOMUX_PAD(0x6d8, 0x2d8, 0, __NA_, 0, NO_PAD_CTRL)
593#define MX51_PAD_DISP1_DAT4__DISP1_DAT4 IOMUX_PAD(0x6dc, 0x2dc, 0, __NA_, 0, NO_PAD_CTRL)
594#define MX51_PAD_DISP1_DAT5__DISP1_DAT5 IOMUX_PAD(0x6e0, 0x2e0, 0, __NA_, 0, NO_PAD_CTRL)
595#define MX51_PAD_DISP1_DAT6__BOOT_USB_SRC IOMUX_PAD(0x6e4, 0x2e4, 7, __NA_, 0, NO_PAD_CTRL)
596#define MX51_PAD_DISP1_DAT6__DISP1_DAT6 IOMUX_PAD(0x6e4, 0x2e4, 0, __NA_, 0, NO_PAD_CTRL)
597#define MX51_PAD_DISP1_DAT7__BOOT_EEPROM_CFG IOMUX_PAD(0x6e8, 0x2e8, 7, __NA_, 0, NO_PAD_CTRL)
598#define MX51_PAD_DISP1_DAT7__DISP1_DAT7 IOMUX_PAD(0x6e8, 0x2e8, 0, __NA_, 0, NO_PAD_CTRL)
599#define MX51_PAD_DISP1_DAT8__BOOT_SRC0 IOMUX_PAD(0x6ec, 0x2ec, 7, __NA_, 0, NO_PAD_CTRL)
600#define MX51_PAD_DISP1_DAT8__DISP1_DAT8 IOMUX_PAD(0x6ec, 0x2ec, 0, __NA_, 0, NO_PAD_CTRL)
601#define MX51_PAD_DISP1_DAT9__BOOT_SRC1 IOMUX_PAD(0x6f0, 0x2f0, 7, __NA_, 0, NO_PAD_CTRL)
602#define MX51_PAD_DISP1_DAT9__DISP1_DAT9 IOMUX_PAD(0x6f0, 0x2f0, 0, __NA_, 0, NO_PAD_CTRL)
603#define MX51_PAD_DISP1_DAT10__BOOT_SPARE_SIZE IOMUX_PAD(0x6f4, 0x2f4, 7, __NA_, 0, NO_PAD_CTRL)
604#define MX51_PAD_DISP1_DAT10__DISP1_DAT10 IOMUX_PAD(0x6f4, 0x2f4, 0, __NA_, 0, NO_PAD_CTRL)
605#define MX51_PAD_DISP1_DAT11__BOOT_LPB_FREQ2 IOMUX_PAD(0x6f8, 0x2f8, 7, __NA_, 0, NO_PAD_CTRL)
606#define MX51_PAD_DISP1_DAT11__DISP1_DAT11 IOMUX_PAD(0x6f8, 0x2f8, 0, __NA_, 0, NO_PAD_CTRL)
607#define MX51_PAD_DISP1_DAT12__BOOT_MLC_SEL IOMUX_PAD(0x6fc, 0x2fc, 7, __NA_, 0, NO_PAD_CTRL)
608#define MX51_PAD_DISP1_DAT12__DISP1_DAT12 IOMUX_PAD(0x6fc, 0x2fc, 0, __NA_, 0, NO_PAD_CTRL)
609#define MX51_PAD_DISP1_DAT13__BOOT_MEM_CTL0 IOMUX_PAD(0x700, 0x300, 7, __NA_, 0, NO_PAD_CTRL)
610#define MX51_PAD_DISP1_DAT13__DISP1_DAT13 IOMUX_PAD(0x700, 0x300, 0, __NA_, 0, NO_PAD_CTRL)
611#define MX51_PAD_DISP1_DAT14__BOOT_MEM_CTL1 IOMUX_PAD(0x704, 0x304, 7, __NA_, 0, NO_PAD_CTRL)
612#define MX51_PAD_DISP1_DAT14__DISP1_DAT14 IOMUX_PAD(0x704, 0x304, 0, __NA_, 0, NO_PAD_CTRL)
613#define MX51_PAD_DISP1_DAT15__BOOT_BUS_WIDTH IOMUX_PAD(0x708, 0x308, 7, __NA_, 0, NO_PAD_CTRL)
614#define MX51_PAD_DISP1_DAT15__DISP1_DAT15 IOMUX_PAD(0x708, 0x308, 0, __NA_, 0, NO_PAD_CTRL)
615#define MX51_PAD_DISP1_DAT16__BOOT_PAGE_SIZE0 IOMUX_PAD(0x70c, 0x30c, 7, __NA_, 0, NO_PAD_CTRL)
616#define MX51_PAD_DISP1_DAT16__DISP1_DAT16 IOMUX_PAD(0x70c, 0x30c, 0, __NA_, 0, NO_PAD_CTRL)
617#define MX51_PAD_DISP1_DAT17__BOOT_PAGE_SIZE1 IOMUX_PAD(0x710, 0x310, 7, __NA_, 0, NO_PAD_CTRL)
618#define MX51_PAD_DISP1_DAT17__DISP1_DAT17 IOMUX_PAD(0x710, 0x310, 0, __NA_, 0, NO_PAD_CTRL)
619#define MX51_PAD_DISP1_DAT18__BOOT_WEIM_MUXED0 IOMUX_PAD(0x714, 0x314, 7, __NA_, 0, NO_PAD_CTRL)
620#define MX51_PAD_DISP1_DAT18__DISP1_DAT18 IOMUX_PAD(0x714, 0x314, 0, __NA_, 0, NO_PAD_CTRL)
621#define MX51_PAD_DISP1_DAT18__DISP2_PIN11 IOMUX_PAD(0x714, 0x314, 5, __NA_, 0, NO_PAD_CTRL)
622#define MX51_PAD_DISP1_DAT18__DISP2_PIN5 IOMUX_PAD(0x714, 0x314, 4, __NA_, 0, NO_PAD_CTRL)
623#define MX51_PAD_DISP1_DAT19__BOOT_WEIM_MUXED1 IOMUX_PAD(0x718, 0x318, 7, __NA_, 0, NO_PAD_CTRL)
624#define MX51_PAD_DISP1_DAT19__DISP1_DAT19 IOMUX_PAD(0x718, 0x318, 0, __NA_, 0, NO_PAD_CTRL)
625#define MX51_PAD_DISP1_DAT19__DISP2_PIN12 IOMUX_PAD(0x718, 0x318, 5, __NA_, 0, NO_PAD_CTRL)
626#define MX51_PAD_DISP1_DAT19__DISP2_PIN6 IOMUX_PAD(0x718, 0x318, 4, __NA_, 0, NO_PAD_CTRL)
627#define MX51_PAD_DISP1_DAT20__BOOT_MEM_TYPE0 IOMUX_PAD(0x71c, 0x31c, 7, __NA_, 0, NO_PAD_CTRL)
628#define MX51_PAD_DISP1_DAT20__DISP1_DAT20 IOMUX_PAD(0x71c, 0x31c, 0, __NA_, 0, NO_PAD_CTRL)
629#define MX51_PAD_DISP1_DAT20__DISP2_PIN13 IOMUX_PAD(0x71c, 0x31c, 5, __NA_, 0, NO_PAD_CTRL)
630#define MX51_PAD_DISP1_DAT20__DISP2_PIN7 IOMUX_PAD(0x71c, 0x31c, 4, __NA_, 0, NO_PAD_CTRL)
631#define MX51_PAD_DISP1_DAT21__BOOT_MEM_TYPE1 IOMUX_PAD(0x720, 0x320, 7, __NA_, 0, NO_PAD_CTRL)
632#define MX51_PAD_DISP1_DAT21__DISP1_DAT21 IOMUX_PAD(0x720, 0x320, 0, __NA_, 0, NO_PAD_CTRL)
633#define MX51_PAD_DISP1_DAT21__DISP2_PIN14 IOMUX_PAD(0x720, 0x320, 5, __NA_, 0, NO_PAD_CTRL)
634#define MX51_PAD_DISP1_DAT21__DISP2_PIN8 IOMUX_PAD(0x720, 0x320, 4, __NA_, 0, NO_PAD_CTRL)
635#define MX51_PAD_DISP1_DAT22__BOOT_LPB_FREQ0 IOMUX_PAD(0x724, 0x324, 7, __NA_, 0, NO_PAD_CTRL)
636#define MX51_PAD_DISP1_DAT22__DISP1_DAT22 IOMUX_PAD(0x724, 0x324, 0, __NA_, 0, NO_PAD_CTRL)
637#define MX51_PAD_DISP1_DAT22__DISP2_D0_CS IOMUX_PAD(0x724, 0x324, 6, __NA_, 0, NO_PAD_CTRL)
638#define MX51_PAD_DISP1_DAT22__DISP2_DAT16 IOMUX_PAD(0x724, 0x324, 5, __NA_, 0, NO_PAD_CTRL)
639#define MX51_PAD_DISP1_DAT23__BOOT_LPB_FREQ1 IOMUX_PAD(0x728, 0x328, 7, __NA_, 0, NO_PAD_CTRL)
640#define MX51_PAD_DISP1_DAT23__DISP1_DAT23 IOMUX_PAD(0x728, 0x328, 0, __NA_, 0, NO_PAD_CTRL)
641#define MX51_PAD_DISP1_DAT23__DISP2_D1_CS IOMUX_PAD(0x728, 0x328, 6, __NA_, 0, NO_PAD_CTRL)
642#define MX51_PAD_DISP1_DAT23__DISP2_DAT17 IOMUX_PAD(0x728, 0x328, 5, __NA_, 0, NO_PAD_CTRL)
643#define MX51_PAD_DISP1_DAT23__DISP2_SER_CS IOMUX_PAD(0x728, 0x328, 4, __NA_, 0, NO_PAD_CTRL)
644#define MX51_PAD_DI1_PIN3__DI1_PIN3 IOMUX_PAD(0x72c, 0x32c, 0, __NA_, 0, NO_PAD_CTRL)
645#define MX51_PAD_DI1_DISP_CLK__DI1_DISP_CLK IOMUX_PAD(0x730, __NA_, 0, __NA_, 0, NO_PAD_CTRL)
646#define MX51_PAD_DI1_PIN2__DI1_PIN2 IOMUX_PAD(0x734, 0x330, 0, __NA_, 0, NO_PAD_CTRL)
647#define MX51_PAD_DI1_PIN15__DI1_PIN15 IOMUX_PAD(0x738, __NA_, 0, __NA_, 0, NO_PAD_CTRL)
648#define MX51_PAD_DI_GP2__DISP1_SER_CLK IOMUX_PAD(0x740, 0x338, 0, __NA_, 0, NO_PAD_CTRL)
649#define MX51_PAD_DI_GP2__DISP2_WAIT IOMUX_PAD(0x740, 0x338, 2, 0x9a8, 1, NO_PAD_CTRL)
650#define MX51_PAD_DI_GP3__CSI1_DATA_EN IOMUX_PAD(0x744, 0x33c, 3, 0x9a0, 1, NO_PAD_CTRL)
651#define MX51_PAD_DI_GP3__DISP1_SER_DIO IOMUX_PAD(0x744, 0x33c, 0, 0x9c0, 0, NO_PAD_CTRL)
652#define MX51_PAD_DI_GP3__FEC_TX_ER IOMUX_PAD(0x744, 0x33c, 2, __NA_, 0, MX51_PAD_CTRL_5)
653#define MX51_PAD_DI2_PIN4__CSI2_DATA_EN IOMUX_PAD(0x748, 0x340, 3, 0x99c, 1, NO_PAD_CTRL)
654#define MX51_PAD_DI2_PIN4__DI2_PIN4 IOMUX_PAD(0x748, 0x340, 0, __NA_, 0, NO_PAD_CTRL)
655#define MX51_PAD_DI2_PIN4__FEC_CRS IOMUX_PAD(0x748, 0x340, 2, 0x950, 1, NO_PAD_CTRL)
656#define MX51_PAD_DI2_PIN2__DI2_PIN2 IOMUX_PAD(0x74c, 0x344, 0, __NA_, 0, NO_PAD_CTRL)
657#define MX51_PAD_DI2_PIN2__FEC_MDC IOMUX_PAD(0x74c, 0x344, 2, __NA_, 0, MX51_PAD_CTRL_5)
658#define MX51_PAD_DI2_PIN3__DI2_PIN3 IOMUX_PAD(0x750, 0x348, 0, __NA_, 0, NO_PAD_CTRL)
659#define MX51_PAD_DI2_PIN3__FEC_MDIO IOMUX_PAD(0x750, 0x348, 2, 0x954, 1, NO_PAD_CTRL)
660#define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK IOMUX_PAD(0x754, 0x34c, 0, __NA_, 0, NO_PAD_CTRL)
661#define MX51_PAD_DI2_DISP_CLK__FEC_RDATA1 IOMUX_PAD(0x754, 0x34c, 2, 0x95c, 1, NO_PAD_CTRL)
662#define MX51_PAD_DI_GP4__DI2_PIN15 IOMUX_PAD(0x758, 0x350, 4, __NA_, 0, NO_PAD_CTRL)
663#define MX51_PAD_DI_GP4__DISP1_SER_DIN IOMUX_PAD(0x758, 0x350, 0, 0x9c0, 1, NO_PAD_CTRL)
664#define MX51_PAD_DI_GP4__DISP2_PIN1 IOMUX_PAD(0x758, 0x350, 3, __NA_, 0, NO_PAD_CTRL)
665#define MX51_PAD_DI_GP4__FEC_RDATA2 IOMUX_PAD(0x758, 0x350, 2, 0x960, 1, NO_PAD_CTRL)
666#define MX51_PAD_DISP2_DAT0__DISP2_DAT0 IOMUX_PAD(0x75c, 0x354, 0, __NA_, 0, NO_PAD_CTRL)
667#define MX51_PAD_DISP2_DAT0__FEC_RDATA3 IOMUX_PAD(0x75c, 0x354, 2, 0x964, 1, NO_PAD_CTRL)
668#define MX51_PAD_DISP2_DAT0__KEY_COL6 IOMUX_PAD(0x75c, 0x354, 4, 0x9c8, 1, NO_PAD_CTRL)
669#define MX51_PAD_DISP2_DAT0__UART3_RXD IOMUX_PAD(0x75c, 0x354, 5, 0x9f4, 8, MX51_UART_PAD_CTRL)
670#define MX51_PAD_DISP2_DAT0__USBH3_CLK IOMUX_PAD(0x75c, 0x354, 3, 0x9f8, 1, MX51_UART_PAD_CTRL)
671#define MX51_PAD_DISP2_DAT1__DISP2_DAT1 IOMUX_PAD(0x760, 0x358, 0, __NA_, 0, NO_PAD_CTRL)
672#define MX51_PAD_DISP2_DAT1__FEC_RX_ER IOMUX_PAD(0x760, 0x358, 2, 0x970, 1, NO_PAD_CTRL)
673#define MX51_PAD_DISP2_DAT1__KEY_COL7 IOMUX_PAD(0x760, 0x358, 4, 0x9cc, 1, NO_PAD_CTRL)
674#define MX51_PAD_DISP2_DAT1__UART3_TXD IOMUX_PAD(0x760, 0x358, 5, __NA_, 0, MX51_UART_PAD_CTRL)
675#define MX51_PAD_DISP2_DAT1__USBH3_DIR IOMUX_PAD(0x760, 0x358, 3, 0xa1c, 1, NO_PAD_CTRL)
676#define MX51_PAD_DISP2_DAT2__DISP2_DAT2 IOMUX_PAD(0x764, 0x35c, 0, __NA_, 0, NO_PAD_CTRL)
677#define MX51_PAD_DISP2_DAT3__DISP2_DAT3 IOMUX_PAD(0x768, 0x360, 0, __NA_, 0, NO_PAD_CTRL)
678#define MX51_PAD_DISP2_DAT4__DISP2_DAT4 IOMUX_PAD(0x76c, 0x364, 0, __NA_, 0, NO_PAD_CTRL)
679#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 IOMUX_PAD(0x770, 0x368, 0, __NA_, 0, NO_PAD_CTRL)
680#define MX51_PAD_DISP2_DAT6__DISP2_DAT6 IOMUX_PAD(0x774, 0x36c, 0, __NA_, 0, NO_PAD_CTRL)
681#define MX51_PAD_DISP2_DAT6__FEC_TDATA1 IOMUX_PAD(0x774, 0x36c, 2, __NA_, 0, MX51_PAD_CTRL_5)
682#define MX51_PAD_DISP2_DAT6__GPIO1_19 IOMUX_PAD(0x774, 0x36c, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
683#define MX51_PAD_DISP2_DAT6__KEY_ROW4 IOMUX_PAD(0x774, 0x36c, 4, 0x9d0, 1, NO_PAD_CTRL)
684#define MX51_PAD_DISP2_DAT6__USBH3_STP IOMUX_PAD(0x774, 0x36c, 3, 0xa24, 1, NO_PAD_CTRL)
685#define MX51_PAD_DISP2_DAT7__DISP2_DAT7 IOMUX_PAD(0x778, 0x370, 0, __NA_, 0, NO_PAD_CTRL)
686#define MX51_PAD_DISP2_DAT7__FEC_TDATA2 IOMUX_PAD(0x778, 0x370, 2, __NA_, 0, MX51_PAD_CTRL_5)
687#define MX51_PAD_DISP2_DAT7__GPIO1_29 IOMUX_PAD(0x778, 0x370, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
688#define MX51_PAD_DISP2_DAT7__KEY_ROW5 IOMUX_PAD(0x778, 0x370, 4, 0x9d4, 1, NO_PAD_CTRL)
689#define MX51_PAD_DISP2_DAT7__USBH3_NXT IOMUX_PAD(0x778, 0x370, 3, 0xa20, 1, NO_PAD_CTRL)
690#define MX51_PAD_DISP2_DAT8__DISP2_DAT8 IOMUX_PAD(0x77c, 0x374, 0, __NA_, 0, NO_PAD_CTRL)
691#define MX51_PAD_DISP2_DAT8__FEC_TDATA3 IOMUX_PAD(0x77c, 0x374, 2, __NA_, 0, MX51_PAD_CTRL_5)
692#define MX51_PAD_DISP2_DAT8__GPIO1_30 IOMUX_PAD(0x77c, 0x374, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
693#define MX51_PAD_DISP2_DAT8__KEY_ROW6 IOMUX_PAD(0x77c, 0x374, 4, 0x9d8, 1, NO_PAD_CTRL)
694#define MX51_PAD_DISP2_DAT8__USBH3_DATA0 IOMUX_PAD(0x77c, 0x374, 3, 0x9fc, 1, NO_PAD_CTRL)
695#define MX51_PAD_DISP2_DAT9__AUD6_RXC IOMUX_PAD(0x780, 0x378, 4, 0x8f4, 1, NO_PAD_CTRL)
696#define MX51_PAD_DISP2_DAT9__DISP2_DAT9 IOMUX_PAD(0x780, 0x378, 0, __NA_, 0, NO_PAD_CTRL)
697#define MX51_PAD_DISP2_DAT9__FEC_TX_EN IOMUX_PAD(0x780, 0x378, 2, __NA_, 0, MX51_PAD_CTRL_5)
698#define MX51_PAD_DISP2_DAT9__GPIO1_31 IOMUX_PAD(0x780, 0x378, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
699#define MX51_PAD_DISP2_DAT9__USBH3_DATA1 IOMUX_PAD(0x780, 0x378, 3, 0xa00, 1, NO_PAD_CTRL)
700#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 IOMUX_PAD(0x784, 0x37c, 0, __NA_, 0, NO_PAD_CTRL)
701#define MX51_PAD_DISP2_DAT10__DISP2_SER_CS IOMUX_PAD(0x784, 0x37c, 5, __NA_, 0, NO_PAD_CTRL)
702#define MX51_PAD_DISP2_DAT10__FEC_COL IOMUX_PAD(0x784, 0x37c, 2, 0x94c, 1, NO_PAD_CTRL)
703#define MX51_PAD_DISP2_DAT10__KEY_ROW7 IOMUX_PAD(0x784, 0x37c, 4, 0x9dc, 1, NO_PAD_CTRL)
704#define MX51_PAD_DISP2_DAT10__USBH3_DATA2 IOMUX_PAD(0x784, 0x37c, 3, 0xa04, 1, NO_PAD_CTRL)
705#define MX51_PAD_DISP2_DAT11__AUD6_TXD IOMUX_PAD(0x788, 0x380, 4, 0x8f0, 1, NO_PAD_CTRL)
706#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 IOMUX_PAD(0x788, 0x380, 0, __NA_, 0, NO_PAD_CTRL)
707#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK IOMUX_PAD(0x788, 0x380, 2, 0x968, 1, NO_PAD_CTRL)
708#define MX51_PAD_DISP2_DAT11__GPIO1_10 IOMUX_PAD(0x788, 0x380, 7, __NA_, 0, MX51_GPIO_PAD_CTRL)
709#define MX51_PAD_DISP2_DAT11__USBH3_DATA3 IOMUX_PAD(0x788, 0x380, 3, 0xa08, 1, NO_PAD_CTRL)
710#define MX51_PAD_DISP2_DAT12__AUD6_RXD IOMUX_PAD(0x78c, 0x384, 4, 0x8ec, 1, NO_PAD_CTRL)
711#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 IOMUX_PAD(0x78c, 0x384, 0, __NA_, 0, NO_PAD_CTRL)
712#define MX51_PAD_DISP2_DAT12__FEC_RX_DV IOMUX_PAD(0x78c, 0x384, 2, 0x96c, 1, NO_PAD_CTRL)
713#define MX51_PAD_DISP2_DAT12__USBH3_DATA4 IOMUX_PAD(0x78c, 0x384, 3, 0xa0c, 1, NO_PAD_CTRL)
714#define MX51_PAD_DISP2_DAT13__AUD6_TXC IOMUX_PAD(0x790, 0x388, 4, 0x8fc, 1, NO_PAD_CTRL)
715#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, __NA_, 0, NO_PAD_CTRL)
716#define MX51_PAD_DISP2_DAT13__FEC_TX_CLK IOMUX_PAD(0x790, 0x388, 2, 0x974, 1, MX51_PAD_CTRL_4)
717#define MX51_PAD_DISP2_DAT13__USBH3_DATA5 IOMUX_PAD(0x790, 0x388, 3, 0xa10, 1, NO_PAD_CTRL)
718#define MX51_PAD_DISP2_DAT14__AUD6_TXFS IOMUX_PAD(0x794, 0x38c, 4, 0x900, 1, NO_PAD_CTRL)
719#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38c, 0, __NA_, 0, NO_PAD_CTRL)
720#define MX51_PAD_DISP2_DAT14__FEC_RDATA0 IOMUX_PAD(0x794, 0x38c, 2, 0x958, 1, MX51_PAD_CTRL_4)
721#define MX51_PAD_DISP2_DAT14__USBH3_DATA6 IOMUX_PAD(0x794, 0x38c, 3, 0xa14, 1, NO_PAD_CTRL)
722#define MX51_PAD_DISP2_DAT15__AUD6_RXFS IOMUX_PAD(0x798, 0x390, 4, 0x8f8, 1, NO_PAD_CTRL)
723#define MX51_PAD_DISP2_DAT15__DISP1_SER_CS IOMUX_PAD(0x798, 0x390, 5, __NA_, 0, NO_PAD_CTRL)
724#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, __NA_, 0, NO_PAD_CTRL)
725#define MX51_PAD_DISP2_DAT15__FEC_TDATA0 IOMUX_PAD(0x798, 0x390, 2, __NA_, 0, MX51_PAD_CTRL_5)
726#define MX51_PAD_DISP2_DAT15__USBH3_DATA7 IOMUX_PAD(0x798, 0x390, 3, 0xa18, 1, NO_PAD_CTRL)
727#define MX51_PAD_SD1_CMD__AUD5_RXFS IOMUX_PAD(0x79c, 0x394, 1, 0x8e0, 1, NO_PAD_CTRL)
728#define MX51_PAD_SD1_CMD__CSPI_MOSI IOMUX_PAD(0x79c, 0x394, 2, 0x91c, 2, NO_PAD_CTRL)
729#define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79c, 0x394, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
730#define MX51_PAD_SD1_CLK__AUD5_RXC IOMUX_PAD(0x7a0, 0x398, 1, 0x8dc, 1, NO_PAD_CTRL)
731#define MX51_PAD_SD1_CLK__CSPI_SCLK IOMUX_PAD(0x7a0, 0x398, 2, 0x914, 2, NO_PAD_CTRL)
732#define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7a0, 0x398, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
733#define MX51_PAD_SD1_DATA0__AUD5_TXD IOMUX_PAD(0x7a4, 0x39c, 1, 0x8d8, 2, NO_PAD_CTRL)
734#define MX51_PAD_SD1_DATA0__CSPI_MISO IOMUX_PAD(0x7a4, 0x39c, 2, 0x918, 1, MX51_ECSPI_PAD_CTRL)
735#define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7a4, 0x39c, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
736#define MX51_PAD_EIM_DA0__EIM_DA0 IOMUX_PAD(__NA_, 0x01c, 0, 0x000, 0, NO_PAD_CTRL)
737#define MX51_PAD_EIM_DA1__EIM_DA1 IOMUX_PAD(__NA_, 0x020, 0, 0x000, 0, NO_PAD_CTRL)
738#define MX51_PAD_EIM_DA2__EIM_DA2 IOMUX_PAD(__NA_, 0x024, 0, 0x000, 0, NO_PAD_CTRL)
739#define MX51_PAD_EIM_DA3__EIM_DA3 IOMUX_PAD(__NA_, 0x028, 0, 0x000, 0, NO_PAD_CTRL)
740#define MX51_PAD_SD1_DATA1__AUD5_RXD IOMUX_PAD(0x7a8, 0x3a0, 1, 0x8d4, 2, NO_PAD_CTRL)
741#define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7a8, 0x3a0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
742#define MX51_PAD_EIM_DA4__EIM_DA4 IOMUX_PAD(__NA_, 0x02c, 0, 0x000, 0, NO_PAD_CTRL)
743#define MX51_PAD_EIM_DA5__EIM_DA5 IOMUX_PAD(__NA_, 0x030, 0, 0x000, 0, NO_PAD_CTRL)
744#define MX51_PAD_EIM_DA6__EIM_DA6 IOMUX_PAD(__NA_, 0x034, 0, 0x000, 0, NO_PAD_CTRL)
745#define MX51_PAD_EIM_DA7__EIM_DA7 IOMUX_PAD(__NA_, 0x038, 0, 0x000, 0, NO_PAD_CTRL)
746#define MX51_PAD_SD1_DATA2__AUD5_TXC IOMUX_PAD(0x7ac, 0x3a4, 1, 0x8e4, 2, NO_PAD_CTRL)
747#define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7ac, 0x3a4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
748#define MX51_PAD_EIM_DA10__EIM_DA10 IOMUX_PAD(__NA_, 0x044, 0, 0x000, 0, NO_PAD_CTRL)
749#define MX51_PAD_EIM_DA11__EIM_DA11 IOMUX_PAD(__NA_, 0x048, 0, 0x000, 0, NO_PAD_CTRL)
750#define MX51_PAD_EIM_DA8__EIM_DA8 IOMUX_PAD(__NA_, 0x03c, 0, 0x000, 0, NO_PAD_CTRL)
751#define MX51_PAD_EIM_DA9__EIM_DA9 IOMUX_PAD(__NA_, 0x040, 0, 0x000, 0, NO_PAD_CTRL)
752#define MX51_PAD_SD1_DATA3__AUD5_TXFS IOMUX_PAD(0x7b0, 0x3a8, 1, 0x8e8, 2, NO_PAD_CTRL)
753#define MX51_PAD_SD1_DATA3__CSPI_SS1 IOMUX_PAD(0x7b0, 0x3a8, 2, 0x920, 1, MX51_ECSPI_PAD_CTRL)
754#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7b0, 0x3a8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
755#define MX51_PAD_GPIO1_0__CSPI_SS2 IOMUX_PAD(0x7b4, 0x3ac, 2, 0x924, 0, MX51_ECSPI_PAD_CTRL)
756#define MX51_PAD_GPIO1_0__GPIO1_0 IOMUX_PAD(0x7b4, 0x3ac, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
757#define MX51_PAD_GPIO1_0__SD1_CD IOMUX_PAD(0x7b4, 0x3ac, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
758#define MX51_PAD_GPIO1_1__CSPI_MISO IOMUX_PAD(0x7b8, 0x3b0, 2, 0x918, 2, MX51_ECSPI_PAD_CTRL)
759#define MX51_PAD_GPIO1_1__GPIO1_1 IOMUX_PAD(0x7b8, 0x3b0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
760#define MX51_PAD_GPIO1_1__SD1_WP IOMUX_PAD(0x7b8, 0x3b0, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
761#define MX51_PAD_EIM_DA12__EIM_DA12 IOMUX_PAD(__NA_, 0x04c, 0, 0x000, 0, NO_PAD_CTRL)
762#define MX51_PAD_EIM_DA13__EIM_DA13 IOMUX_PAD(__NA_, 0x050, 0, 0x000, 0, NO_PAD_CTRL)
763#define MX51_PAD_EIM_DA14__EIM_DA14 IOMUX_PAD(__NA_, 0x054, 0, 0x000, 0, NO_PAD_CTRL)
764#define MX51_PAD_EIM_DA15__EIM_DA15 IOMUX_PAD(__NA_, 0x058, 0, 0x000, 0, NO_PAD_CTRL)
765#define MX51_PAD_SD2_CMD__CSPI_MOSI IOMUX_PAD(0x7bc, 0x3b4, 2, 0x91c, 3, MX51_ECSPI_PAD_CTRL)
766#define MX51_PAD_SD2_CMD__I2C1_SCL IOMUX_PAD(0x7bc, 0x3b4, 0x11, 0x9b0, 2, MX51_I2C_PAD_CTRL)
767#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7bc, 0x3b4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
768#define MX51_PAD_SD2_CLK__CSPI_SCLK IOMUX_PAD(0x7c0, 0x3b8, 2, 0x914, 3, MX51_ECSPI_PAD_CTRL)
769#define MX51_PAD_SD2_CLK__I2C1_SDA IOMUX_PAD(0x7c0, 0x3b8, 0x11, 0x9b4, 2, MX51_I2C_PAD_CTRL)
770#define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7c0, 0x3b8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
771#define MX51_PAD_SD2_DATA0__CSPI_MISO IOMUX_PAD(0x7c4, 0x3bc, 2, 0x918, 3, MX51_ECSPI_PAD_CTRL)
772#define MX51_PAD_SD2_DATA0__SD1_DAT4 IOMUX_PAD(0x7c4, 0x3bc, 1, __NA_, 0, NO_PAD_CTRL)
773#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7c4, 0x3bc, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
774#define MX51_PAD_SD2_DATA1__SD1_DAT5 IOMUX_PAD(0x7c8, 0x3c0, 1, __NA_, 0, NO_PAD_CTRL)
775#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7c8, 0x3c0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
776#define MX51_PAD_SD2_DATA1__USBH3_H2_DP IOMUX_PAD(0x7c8, 0x3c0, 0x12, __NA_, 0, NO_PAD_CTRL)
777#define MX51_PAD_SD2_DATA2__SD1_DAT6 IOMUX_PAD(0x7cc, 0x3c4, 1, __NA_, 0, NO_PAD_CTRL)
778#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7cc, 0x3c4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
779#define MX51_PAD_SD2_DATA2__USBH3_H2_DM IOMUX_PAD(0x7cc, 0x3c4, 0x12, __NA_, 0, NO_PAD_CTRL)
780#define MX51_PAD_SD2_DATA3__CSPI_SS2 IOMUX_PAD(0x7d0, 0x3c8, 2, 0x924, 1, MX51_ECSPI_PAD_CTRL)
781#define MX51_PAD_SD2_DATA3__SD1_DAT7 IOMUX_PAD(0x7d0, 0x3c8, 1, __NA_, 0, NO_PAD_CTRL)
782#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7d0, 0x3c8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
783#define MX51_PAD_GPIO1_2__CCM_OUT_2 IOMUX_PAD(0x7d4, 0x3cc, 5, __NA_, 0, NO_PAD_CTRL)
784#define MX51_PAD_GPIO1_2__GPIO1_2 IOMUX_PAD(0x7d4, 0x3cc, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
785#define MX51_PAD_GPIO1_2__I2C2_SCL IOMUX_PAD(0x7d4, 0x3cc, 0x12, 0x9b8, 3, MX51_I2C_PAD_CTRL)
786#define MX51_PAD_GPIO1_2__PLL1_BYP IOMUX_PAD(0x7d4, 0x3cc, 7, 0x90c, 1, NO_PAD_CTRL)
787#define MX51_PAD_GPIO1_2__PWM1_PWMO IOMUX_PAD(0x7d4, 0x3cc, 1, __NA_, 0, NO_PAD_CTRL)
788#define MX51_PAD_GPIO1_3__GPIO1_3 IOMUX_PAD(0x7d8, 0x3d0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
789#define MX51_PAD_GPIO1_3__I2C2_SDA IOMUX_PAD(0x7d8, 0x3d0, 0x12, 0x9bc, 3, MX51_I2C_PAD_CTRL)
790#define MX51_PAD_GPIO1_3__CCM_CLKO2 IOMUX_PAD(0x7d8, 0x3d0, 5, __NA_, 0, NO_PAD_CTRL)
791#define MX51_PAD_GPIO1_3__GPT_CLKIN IOMUX_PAD(0x7d8, 0x3d0, 6, __NA_, 0, NO_PAD_CTRL)
792#define MX51_PAD_GPIO1_3__PLL2_BYP IOMUX_PAD(0x7d8, 0x3d0, 7, 0x910, 1, NO_PAD_CTRL)
793#define MX51_PAD_GPIO1_3__PWM2_PWMO IOMUX_PAD(0x7d8, 0x3d0, 1, __NA_, 0, NO_PAD_CTRL)
794#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7fc, 0x3d4, 0, __NA_, 0, NO_PAD_CTRL)
795#define MX51_PAD_PMIC_INT_REQ__PMIC_PMU_IRQ_B IOMUX_PAD(0x7fc, 0x3d4, 1, __NA_, 0, NO_PAD_CTRL)
796#define MX51_PAD_GPIO1_4__DISP2_EXT_CLK IOMUX_PAD(0x804, 0x3d8, 4, 0x908, 1, NO_PAD_CTRL)
797#define MX51_PAD_GPIO1_4__EIM_RDY IOMUX_PAD(0x804, 0x3d8, 3, 0x938, 1, NO_PAD_CTRL)
798#define MX51_PAD_GPIO1_4__GPIO1_4 IOMUX_PAD(0x804, 0x3d8, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
799#define MX51_PAD_GPIO1_4__WDOG1_WDOG_B IOMUX_PAD(0x804, 0x3d8, 2, __NA_, 0, NO_PAD_CTRL)
800#define MX51_PAD_GPIO1_4__GPT_CAPIN1 IOMUX_PAD(0x804, 0x3d8, 6, __NA_, 0, NO_PAD_CTRL)
801#define MX51_PAD_GPIO1_5__CSI2_MCLK IOMUX_PAD(0x808, 0x3dc, 6, __NA_, 0, NO_PAD_CTRL)
802#define MX51_PAD_GPIO1_5__DISP2_PIN16 IOMUX_PAD(0x808, 0x3dc, 3, __NA_, 0, NO_PAD_CTRL)
803#define MX51_PAD_GPIO1_5__GPIO1_5 IOMUX_PAD(0x808, 0x3dc, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
804#define MX51_PAD_GPIO1_5__WDOG2_WDOG_B IOMUX_PAD(0x808, 0x3dc, 2, __NA_, 0, NO_PAD_CTRL)
805#define MX51_PAD_GPIO1_5__CCM_CLKO IOMUX_PAD(0x808, 0x3dc, 5, __NA_, 0, NO_PAD_CTRL)
806#define MX51_PAD_GPIO1_6__DISP2_PIN17 IOMUX_PAD(0x80c, 0x3e0, 4, __NA_, 0, NO_PAD_CTRL)
807#define MX51_PAD_GPIO1_6__GPIO1_6 IOMUX_PAD(0x80c, 0x3e0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
808#define MX51_PAD_GPIO1_6__REF_EN_B IOMUX_PAD(0x80c, 0x3e0, 3, __NA_, 0, NO_PAD_CTRL)
809#define MX51_PAD_GPIO1_6__GPT_CAPIN2 IOMUX_PAD(0x80c, 0x3e0, 6, __NA_, 0, NO_PAD_CTRL)
810#define MX51_PAD_GPIO1_7__CCM_OUT_0 IOMUX_PAD(0x810, 0x3e4, 3, __NA_, 0, NO_PAD_CTRL)
811#define MX51_PAD_GPIO1_7__GPIO1_7 IOMUX_PAD(0x810, 0x3e4, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
812#define MX51_PAD_GPIO1_7__SD2_WP IOMUX_PAD(0x810, 0x3e4, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
813#define MX51_PAD_GPIO1_7__SPDIF_OUT1 IOMUX_PAD(0x810, 0x3e4, 2, __NA_, 0, NO_PAD_CTRL)
814#define MX51_PAD_GPIO1_8__CSI2_DATA_EN IOMUX_PAD(0x814, 0x3e8, 2, 0x99c, 2, NO_PAD_CTRL)
815#define MX51_PAD_GPIO1_8__GPIO1_8 IOMUX_PAD(0x814, 0x3e8, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
816#define MX51_PAD_GPIO1_8__SD2_CD IOMUX_PAD(0x814, 0x3e8, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
817#define MX51_PAD_GPIO1_8__USBH3_PWR IOMUX_PAD(0x814, 0x3e8, 1, __NA_, 0, NO_PAD_CTRL)
818#define MX51_PAD_GPIO1_8__CCM_CLKO2 IOMUX_PAD(0x814, 0x3e8, 4, __NA_, 0, NO_PAD_CTRL)
819#define MX51_PAD_GPIO1_9__CCM_OUT_1 IOMUX_PAD(0x818, 0x3ec, 3, __NA_, 0, NO_PAD_CTRL)
820#define MX51_PAD_GPIO1_9__DISP2_D1_CS IOMUX_PAD(0x818, 0x3ec, 2, __NA_, 0, NO_PAD_CTRL)
821#define MX51_PAD_GPIO1_9__DISP2_SER_CS IOMUX_PAD(0x818, 0x3ec, 7, __NA_, 0, NO_PAD_CTRL)
822#define MX51_PAD_GPIO1_9__GPIO1_9 IOMUX_PAD(0x818, 0x3ec, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
823#define MX51_PAD_GPIO1_9__SD2_LCTL IOMUX_PAD(0x818, 0x3ec, 6, __NA_, 0, NO_PAD_CTRL)
824#define MX51_PAD_GPIO1_9__USBH3_OC IOMUX_PAD(0x818, 0x3ec, 1, __NA_, 0, NO_PAD_CTRL)
825#define MX51_PAD_GPIO1_9__CCM_CLKO IOMUX_PAD(0x818, 0x3ec, 4, __NA_, 0, NO_PAD_CTRL)
826
827#endif /* __MACH_IOMUX_MX51_H__ */
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index 39406b7e3228..a7e9bd26a552 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -50,6 +50,7 @@
50#include "common.h" 50#include "common.h"
51#include "devices-imx31.h" 51#include "devices-imx31.h"
52#include "crmregs-imx3.h" 52#include "crmregs-imx3.h"
53#include "ehci.h"
53#include "hardware.h" 54#include "hardware.h"
54#include "iomux-mx3.h" 55#include "iomux-mx3.h"
55#include "ulpi.h" 56#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 75b7b6aa2720..e6d4b9929571 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -36,6 +36,7 @@
36 36
37#include "common.h" 37#include "common.h"
38#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "ehci.h"
39#include "eukrea-baseboards.h" 40#include "eukrea-baseboards.h"
40#include "hardware.h" 41#include "hardware.h"
41#include "iomux-mx27.h" 42#include "iomux-mx27.h"
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index 1ffa27169045..62a6e02f4763 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -39,6 +39,7 @@
39 39
40#include "common.h" 40#include "common.h"
41#include "devices-imx35.h" 41#include "devices-imx35.h"
42#include "ehci.h"
42#include "eukrea-baseboards.h" 43#include "eukrea-baseboards.h"
43#include "hardware.h" 44#include "hardware.h"
44#include "iomux-mx35.h" 45#include "iomux-mx35.h"
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index e978dda1434c..b2ee6e009fe4 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -35,6 +35,7 @@
35 35
36#include "common.h" 36#include "common.h"
37#include "devices-imx25.h" 37#include "devices-imx25.h"
38#include "ehci.h"
38#include "eukrea-baseboards.h" 39#include "eukrea-baseboards.h"
39#include "hardware.h" 40#include "hardware.h"
40#include "iomux-mx25.h" 41#include "iomux-mx25.h"
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index b61bd8ed5568..ede2bdbb5dd5 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -43,6 +43,7 @@
43 43
44#include "common.h" 44#include "common.h"
45#include "devices-imx27.h" 45#include "devices-imx27.h"
46#include "ehci.h"
46#include "hardware.h" 47#include "hardware.h"
47#include "iomux-mx27.h" 48#include "iomux-mx27.h"
48 49
diff --git a/arch/arm/mach-imx/mach-imx27ipcam.c b/arch/arm/mach-imx/mach-imx27ipcam.c
deleted file mode 100644
index bb3ca0429680..000000000000
--- a/arch/arm/mach-imx/mach-imx27ipcam.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/time.h>
20
21#include "hardware.h"
22#include "common.h"
23#include "devices-imx27.h"
24#include "iomux-mx27.h"
25
26static const int mx27ipcam_pins[] __initconst = {
27 /* UART1 */
28 PE12_PF_UART1_TXD,
29 PE13_PF_UART1_RXD,
30 /* FEC */
31 PD0_AIN_FEC_TXD0,
32 PD1_AIN_FEC_TXD1,
33 PD2_AIN_FEC_TXD2,
34 PD3_AIN_FEC_TXD3,
35 PD4_AOUT_FEC_RX_ER,
36 PD5_AOUT_FEC_RXD1,
37 PD6_AOUT_FEC_RXD2,
38 PD7_AOUT_FEC_RXD3,
39 PD8_AF_FEC_MDIO,
40 PD9_AIN_FEC_MDC,
41 PD10_AOUT_FEC_CRS,
42 PD11_AOUT_FEC_TX_CLK,
43 PD12_AOUT_FEC_RXD0,
44 PD13_AOUT_FEC_RX_DV,
45 PD14_AOUT_FEC_RX_CLK,
46 PD15_AOUT_FEC_COL,
47 PD16_AIN_FEC_TX_ER,
48 PF23_AIN_FEC_TX_EN,
49};
50
51static void __init mx27ipcam_init(void)
52{
53 imx27_soc_init();
54
55 mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins),
56 "mx27ipcam");
57
58 imx27_add_imx_uart0(NULL);
59 imx27_add_fec(NULL);
60 imx27_add_imx2_wdt();
61}
62
63static void __init mx27ipcam_timer_init(void)
64{
65 mx27_clocks_init(25000000);
66}
67
68MACHINE_START(IMX27IPCAM, "Freescale IMX27IPCAM")
69 /* maintainer: Freescale Semiconductor, Inc. */
70 .atag_offset = 0x100,
71 .map_io = mx27_map_io,
72 .init_early = imx27_init_early,
73 .init_irq = mx27_init_irq,
74 .init_time = mx27ipcam_timer_init,
75 .init_machine = mx27ipcam_init,
76 .restart = mxc_restart,
77MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
deleted file mode 100644
index 9992089d3ad1..000000000000
--- a/arch/arm/mach-imx/mach-imx27lite.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
4 * Copyright 2009 Daniel Schaeffer (daniel.schaeffer@timesys.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
17#include <linux/platform_device.h>
18#include <linux/gpio.h>
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/time.h>
22#include <asm/mach/map.h>
23
24#include "common.h"
25#include "devices-imx27.h"
26#include "hardware.h"
27#include "iomux-mx27.h"
28
29static const int mx27lite_pins[] __initconst = {
30 /* UART1 */
31 PE12_PF_UART1_TXD,
32 PE13_PF_UART1_RXD,
33 PE14_PF_UART1_CTS,
34 PE15_PF_UART1_RTS,
35 /* FEC */
36 PD0_AIN_FEC_TXD0,
37 PD1_AIN_FEC_TXD1,
38 PD2_AIN_FEC_TXD2,
39 PD3_AIN_FEC_TXD3,
40 PD4_AOUT_FEC_RX_ER,
41 PD5_AOUT_FEC_RXD1,
42 PD6_AOUT_FEC_RXD2,
43 PD7_AOUT_FEC_RXD3,
44 PD8_AF_FEC_MDIO,
45 PD9_AIN_FEC_MDC,
46 PD10_AOUT_FEC_CRS,
47 PD11_AOUT_FEC_TX_CLK,
48 PD12_AOUT_FEC_RXD0,
49 PD13_AOUT_FEC_RX_DV,
50 PD14_AOUT_FEC_RX_CLK,
51 PD15_AOUT_FEC_COL,
52 PD16_AIN_FEC_TX_ER,
53 PF23_AIN_FEC_TX_EN,
54};
55
56static const struct imxuart_platform_data uart_pdata __initconst = {
57 .flags = IMXUART_HAVE_RTSCTS,
58};
59
60static void __init mx27lite_init(void)
61{
62 imx27_soc_init();
63
64 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
65 "imx27lite");
66 imx27_add_imx_uart0(&uart_pdata);
67 imx27_add_fec(NULL);
68}
69
70static void __init mx27lite_timer_init(void)
71{
72 mx27_clocks_init(26000000);
73}
74
75MACHINE_START(IMX27LITE, "LogicPD i.MX27LITE")
76 .atag_offset = 0x100,
77 .map_io = mx27_map_io,
78 .init_early = imx27_init_early,
79 .init_irq = mx27_init_irq,
80 .init_time = mx27lite_timer_init,
81 .init_machine = mx27lite_init,
82 .restart = mxc_restart,
83MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx50.c b/arch/arm/mach-imx/mach-imx50.c
index b899c0b59afd..b1e56a94a382 100644
--- a/arch/arm/mach-imx/mach-imx50.c
+++ b/arch/arm/mach-imx/mach-imx50.c
@@ -23,14 +23,13 @@ static void __init imx50_dt_init(void)
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
24} 24}
25 25
26static const char *imx50_dt_board_compat[] __initconst = { 26static const char * const imx50_dt_board_compat[] __initconst = {
27 "fsl,imx50", 27 "fsl,imx50",
28 NULL 28 NULL
29}; 29};
30 30
31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)") 31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
32 .map_io = mx53_map_io, 32 .init_irq = tzic_init_irq,
33 .init_irq = mx53_init_irq,
34 .init_machine = imx50_dt_init, 33 .init_machine = imx50_dt_init,
35 .dt_compat = imx50_dt_board_compat, 34 .dt_compat = imx50_dt_board_compat,
36 .restart = mxc_restart, 35 .restart = mxc_restart,
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/mach-imx51.c
index b8cd968faa52..c77deb3f0893 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/mach-imx51.c
@@ -10,6 +10,7 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13#include <linux/io.h>
13#include <linux/irq.h> 14#include <linux/irq.h>
14#include <linux/of_irq.h> 15#include <linux/of_irq.h>
15#include <linux/of_platform.h> 16#include <linux/of_platform.h>
@@ -17,27 +18,63 @@
17#include <asm/mach/time.h> 18#include <asm/mach/time.h>
18 19
19#include "common.h" 20#include "common.h"
20#include "mx51.h" 21#include "hardware.h"
22
23static void __init imx51_init_early(void)
24{
25 mxc_set_cpu_type(MXC_CPU_MX51);
26}
27
28/*
29 * The MIPI HSC unit has been removed from the i.MX51 Reference Manual by
30 * the Freescale marketing division. However this did not remove the
31 * hardware from the chip which still needs to be configured for proper
32 * IPU support.
33 */
34#define MX51_MIPI_HSC_BASE 0x83fdc000
35static void __init imx51_ipu_mipi_setup(void)
36{
37 void __iomem *hsc_addr;
38
39 hsc_addr = ioremap(MX51_MIPI_HSC_BASE, SZ_16K);
40 WARN_ON(!hsc_addr);
41
42 /* setup MIPI module to legacy mode */
43 __raw_writel(0xf00, hsc_addr);
44
45 /* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */
46 __raw_writel(__raw_readl(hsc_addr + 0x800) | 0x30ff,
47 hsc_addr + 0x800);
48
49 iounmap(hsc_addr);
50}
21 51
22static void __init imx51_dt_init(void) 52static void __init imx51_dt_init(void)
23{ 53{
24 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 54 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
25 55
26 mxc_arch_reset_init_dt(); 56 mxc_arch_reset_init_dt();
57 imx51_ipu_mipi_setup();
58 imx_src_init();
27 59
28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 60 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
29 platform_device_register_full(&devinfo); 61 platform_device_register_full(&devinfo);
30} 62}
31 63
32static const char *imx51_dt_board_compat[] __initconst = { 64static void __init imx51_init_late(void)
65{
66 mx51_neon_fixup();
67 imx51_pm_init();
68}
69
70static const char * const imx51_dt_board_compat[] __initconst = {
33 "fsl,imx51", 71 "fsl,imx51",
34 NULL 72 NULL
35}; 73};
36 74
37DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") 75DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
38 .map_io = mx51_map_io,
39 .init_early = imx51_init_early, 76 .init_early = imx51_init_early,
40 .init_irq = mx51_init_irq, 77 .init_irq = tzic_init_irq,
41 .init_machine = imx51_dt_init, 78 .init_machine = imx51_dt_init,
42 .init_late = imx51_init_late, 79 .init_late = imx51_init_late,
43 .dt_compat = imx51_dt_board_compat, 80 .dt_compat = imx51_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index 2bad387956c0..03dd6ea13acc 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -22,24 +22,35 @@
22 22
23#include "common.h" 23#include "common.h"
24#include "hardware.h" 24#include "hardware.h"
25#include "mx53.h" 25
26static void __init imx53_init_early(void)
27{
28 mxc_set_cpu_type(MXC_CPU_MX53);
29}
26 30
27static void __init imx53_dt_init(void) 31static void __init imx53_dt_init(void)
28{ 32{
29 mxc_arch_reset_init_dt(); 33 mxc_arch_reset_init_dt();
34 imx_src_init();
30 35
31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 36 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
37
38 imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
39}
40
41static void __init imx53_init_late(void)
42{
43 imx53_pm_init();
32} 44}
33 45
34static const char *imx53_dt_board_compat[] __initconst = { 46static const char * const imx53_dt_board_compat[] __initconst = {
35 "fsl,imx53", 47 "fsl,imx53",
36 NULL 48 NULL
37}; 49};
38 50
39DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)") 51DT_MACHINE_START(IMX53_DT, "Freescale i.MX53 (Device Tree Support)")
40 .map_io = mx53_map_io,
41 .init_early = imx53_init_early, 52 .init_early = imx53_init_early,
42 .init_irq = mx53_init_irq, 53 .init_irq = tzic_init_irq,
43 .init_machine = imx53_dt_init, 54 .init_machine = imx53_dt_init,
44 .init_late = imx53_init_late, 55 .init_late = imx53_init_late,
45 .dt_compat = imx53_dt_board_compat, 56 .dt_compat = imx53_dt_board_compat,
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index e60456d85c9d..d51c6e99a2e9 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -320,7 +320,7 @@ static void __init imx6q_opp_check_speed_grading(struct device *cpu_dev)
320 val >>= OCOTP_CFG3_SPEED_SHIFT; 320 val >>= OCOTP_CFG3_SPEED_SHIFT;
321 val &= 0x3; 321 val &= 0x3;
322 322
323 if (val != OCOTP_CFG3_SPEED_1P2GHZ) 323 if ((val != OCOTP_CFG3_SPEED_1P2GHZ) && cpu_is_imx6q())
324 if (dev_pm_opp_disable(cpu_dev, 1200000000)) 324 if (dev_pm_opp_disable(cpu_dev, 1200000000))
325 pr_warn("failed to disable 1.2 GHz OPP\n"); 325 pr_warn("failed to disable 1.2 GHz OPP\n");
326 if (val < OCOTP_CFG3_SPEED_996MHZ) 326 if (val < OCOTP_CFG3_SPEED_996MHZ)
@@ -396,7 +396,7 @@ static void __init imx6q_init_irq(void)
396 irqchip_init(); 396 irqchip_init();
397} 397}
398 398
399static const char *imx6q_dt_compat[] __initconst = { 399static const char * const imx6q_dt_compat[] __initconst = {
400 "fsl,imx6dl", 400 "fsl,imx6dl",
401 "fsl,imx6q", 401 "fsl,imx6q",
402 NULL, 402 NULL,
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index ad323385115c..ed263a21d928 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -70,7 +70,7 @@ static void __init imx6sl_init_irq(void)
70 irqchip_init(); 70 irqchip_init();
71} 71}
72 72
73static const char *imx6sl_dt_compat[] __initconst = { 73static const char * const imx6sl_dt_compat[] __initconst = {
74 "fsl,imx6sl", 74 "fsl,imx6sl",
75 NULL, 75 NULL,
76}; 76};
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 02fccf6033ac..673a734165ba 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -12,6 +12,7 @@
12#include <asm/mach/map.h> 12#include <asm/mach/map.h>
13 13
14#include "common.h" 14#include "common.h"
15#include "cpuidle.h"
15 16
16static void __init imx6sx_init_machine(void) 17static void __init imx6sx_init_machine(void)
17{ 18{
@@ -26,6 +27,7 @@ static void __init imx6sx_init_machine(void)
26 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
27 28
28 imx_anatop_init(); 29 imx_anatop_init();
30 imx6sx_pm_init();
29} 31}
30 32
31static void __init imx6sx_init_irq(void) 33static void __init imx6sx_init_irq(void)
@@ -37,7 +39,12 @@ static void __init imx6sx_init_irq(void)
37 irqchip_init(); 39 irqchip_init();
38} 40}
39 41
40static const char *imx6sx_dt_compat[] __initconst = { 42static void __init imx6sx_init_late(void)
43{
44 imx6q_cpuidle_init();
45}
46
47static const char * const imx6sx_dt_compat[] __initconst = {
41 "fsl,imx6sx", 48 "fsl,imx6sx",
42 NULL, 49 NULL,
43}; 50};
@@ -47,5 +54,6 @@ DT_MACHINE_START(IMX6SX, "Freescale i.MX6 SoloX (Device Tree)")
47 .init_irq = imx6sx_init_irq, 54 .init_irq = imx6sx_init_irq,
48 .init_machine = imx6sx_init_machine, 55 .init_machine = imx6sx_init_machine,
49 .dt_compat = imx6sx_dt_compat, 56 .dt_compat = imx6sx_dt_compat,
57 .init_late = imx6sx_init_late,
50 .restart = mxc_restart, 58 .restart = mxc_restart,
51MACHINE_END 59MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index ea1fa199c148..0d01e367b062 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -39,6 +39,7 @@
39 39
40#include "common.h" 40#include "common.h"
41#include "devices-imx25.h" 41#include "devices-imx25.h"
42#include "ehci.h"
42#include "hardware.h" 43#include "hardware.h"
43#include "iomux-mx25.h" 44#include "iomux-mx25.h"
44#include "mx25.h" 45#include "mx25.h"
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 435a5428a678..9ef4640f3660 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -40,6 +40,7 @@
40#include "3ds_debugboard.h" 40#include "3ds_debugboard.h"
41#include "common.h" 41#include "common.h"
42#include "devices-imx27.h" 42#include "devices-imx27.h"
43#include "ehci.h"
43#include "hardware.h" 44#include "hardware.h"
44#include "iomux-mx27.h" 45#include "iomux-mx27.h"
45#include "ulpi.h" 46#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 2f834ce8f39c..eb1c3477c48a 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -245,7 +245,7 @@ static void __init mx27ads_regulator_init(void)
245 vchip->set = vgpio_set; 245 vchip->set = vgpio_set;
246 gpiochip_add(vchip); 246 gpiochip_add(vchip);
247 247
248 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 248 platform_device_register_data(NULL, "reg-fixed-voltage",
249 PLATFORM_DEVID_AUTO, 249 PLATFORM_DEVID_AUTO,
250 &mx27ads_lcd_regulator_pdata, 250 &mx27ads_lcd_regulator_pdata,
251 sizeof(mx27ads_lcd_regulator_pdata)); 251 sizeof(mx27ads_lcd_regulator_pdata));
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 4217871a9653..453f41a2c5a9 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -40,6 +40,7 @@
40#include "3ds_debugboard.h" 40#include "3ds_debugboard.h"
41#include "common.h" 41#include "common.h"
42#include "devices-imx31.h" 42#include "devices-imx31.h"
43#include "ehci.h"
43#include "hardware.h" 44#include "hardware.h"
44#include "iomux-mx3.h" 45#include "iomux-mx3.h"
45#include "ulpi.h" 46#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index eee042fa2768..e9549a3c0223 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -45,6 +45,7 @@
45#include "board-mx31lilly.h" 45#include "board-mx31lilly.h"
46#include "common.h" 46#include "common.h"
47#include "devices-imx31.h" 47#include "devices-imx31.h"
48#include "ehci.h"
48#include "hardware.h" 49#include "hardware.h"
49#include "iomux-mx3.h" 50#include "iomux-mx3.h"
50#include "ulpi.h" 51#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index fa15d0b6118d..57eac6f45fab 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -42,6 +42,7 @@
42#include "board-mx31lite.h" 42#include "board-mx31lite.h"
43#include "common.h" 43#include "common.h"
44#include "devices-imx31.h" 44#include "devices-imx31.h"
45#include "ehci.h"
45#include "hardware.h" 46#include "hardware.h"
46#include "iomux-mx3.h" 47#include "iomux-mx3.h"
47#include "ulpi.h" 48#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 08730f238449..bb6f8a52a6b8 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -47,6 +47,7 @@
47#include "board-mx31moboard.h" 47#include "board-mx31moboard.h"
48#include "common.h" 48#include "common.h"
49#include "devices-imx31.h" 49#include "devices-imx31.h"
50#include "ehci.h"
50#include "hardware.h" 51#include "hardware.h"
51#include "iomux-mx3.h" 52#include "iomux-mx3.h"
52#include "ulpi.h" 53#include "ulpi.h"
@@ -434,10 +435,8 @@ static int __init moboard_usbh2_init(void)
434 return -ENODEV; 435 return -ENODEV;
435 436
436 pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 437 pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
437 if (IS_ERR(pdev))
438 return PTR_ERR(pdev);
439 438
440 return 0; 439 return PTR_ERR_OR_ZERO(pdev);
441} 440}
442 441
443static const struct gpio_led mx31moboard_leds[] __initconst = { 442static const struct gpio_led mx31moboard_leds[] __initconst = {
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 4e8b184d773b..72cd77d21f63 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -50,6 +50,7 @@
50#include "3ds_debugboard.h" 50#include "3ds_debugboard.h"
51#include "common.h" 51#include "common.h"
52#include "devices-imx35.h" 52#include "devices-imx35.h"
53#include "ehci.h"
53#include "hardware.h" 54#include "hardware.h"
54#include "iomux-mx35.h" 55#include "iomux-mx35.h"
55 56
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 12212378c672..2d1c50bd8bdf 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -36,6 +36,7 @@
36 36
37#include "common.h" 37#include "common.h"
38#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "ehci.h"
39#include "hardware.h" 40#include "hardware.h"
40#include "iomux-mx27.h" 41#include "iomux-mx27.h"
41#include "ulpi.h" 42#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index 81b8affb9448..8eb1570f7851 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -45,6 +45,7 @@
45 45
46#include "common.h" 46#include "common.h"
47#include "devices-imx31.h" 47#include "devices-imx31.h"
48#include "ehci.h"
48#include "hardware.h" 49#include "hardware.h"
49#include "iomux-mx3.h" 50#include "iomux-mx3.h"
50#include "pcm037.h" 51#include "pcm037.h"
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 6c56fb5553c7..ee862ad6b6fc 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -36,6 +36,7 @@
36#include "board-pcm038.h" 36#include "board-pcm038.h"
37#include "common.h" 37#include "common.h"
38#include "devices-imx27.h" 38#include "devices-imx27.h"
39#include "ehci.h"
39#include "hardware.h" 40#include "hardware.h"
40#include "iomux-mx27.h" 41#include "iomux-mx27.h"
41#include "ulpi.h" 42#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index c62b5d261345..b623bcaca76c 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -35,6 +35,7 @@
35 35
36#include "common.h" 36#include "common.h"
37#include "devices-imx35.h" 37#include "devices-imx35.h"
38#include "ehci.h"
38#include "hardware.h" 39#include "hardware.h"
39#include "iomux-mx35.h" 40#include "iomux-mx35.h"
40#include "ulpi.h" 41#include "ulpi.h"
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index c44602758120..ee7e57b752a7 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -20,7 +20,7 @@ static void __init vf610_init_machine(void)
20 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 20 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
21} 21}
22 22
23static const char *vf610_dt_compat[] __initconst = { 23static const char * const vf610_dt_compat[] __initconst = {
24 "fsl,vf610", 24 "fsl,vf610",
25 NULL, 25 NULL,
26}; 26};
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 872b3c6ba408..97836e94451c 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -34,6 +34,7 @@
34 34
35#include "common.h" 35#include "common.h"
36#include "devices-imx35.h" 36#include "devices-imx35.h"
37#include "ehci.h"
37#include "hardware.h" 38#include "hardware.h"
38#include "iomux-mx35.h" 39#include "iomux-mx35.h"
39 40
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
deleted file mode 100644
index 4c112021aa4e..000000000000
--- a/arch/arm/mach-imx/mm-imx5.c
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 *
11 * Create static mapping between physical to virtual memory.
12 */
13
14#include <linux/mm.h>
15#include <linux/init.h>
16#include <linux/clk.h>
17#include <linux/pinctrl/machine.h>
18#include <linux/of_address.h>
19
20#include <asm/mach/map.h>
21
22#include "common.h"
23#include "devices/devices-common.h"
24#include "hardware.h"
25#include "iomux-v3.h"
26
27/*
28 * Define the MX51 memory map.
29 */
30static struct map_desc mx51_io_desc[] __initdata = {
31 imx_map_entry(MX51, TZIC, MT_DEVICE),
32 imx_map_entry(MX51, IRAM, MT_DEVICE),
33 imx_map_entry(MX51, AIPS1, MT_DEVICE),
34 imx_map_entry(MX51, SPBA0, MT_DEVICE),
35 imx_map_entry(MX51, AIPS2, MT_DEVICE),
36};
37
38/*
39 * Define the MX53 memory map.
40 */
41static struct map_desc mx53_io_desc[] __initdata = {
42 imx_map_entry(MX53, TZIC, MT_DEVICE),
43 imx_map_entry(MX53, AIPS1, MT_DEVICE),
44 imx_map_entry(MX53, SPBA0, MT_DEVICE),
45 imx_map_entry(MX53, AIPS2, MT_DEVICE),
46};
47
48/*
49 * This function initializes the memory map. It is called during the
50 * system startup to create static physical to virtual memory mappings
51 * for the IO modules.
52 */
53void __init mx51_map_io(void)
54{
55 iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
56}
57
58void __init mx53_map_io(void)
59{
60 iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
61}
62
63/*
64 * The MIPI HSC unit has been removed from the i.MX51 Reference Manual by
65 * the Freescale marketing division. However this did not remove the
66 * hardware from the chip which still needs to be configured for proper
67 * IPU support.
68 */
69static void __init imx51_ipu_mipi_setup(void)
70{
71 void __iomem *hsc_addr;
72 hsc_addr = MX51_IO_ADDRESS(MX51_MIPI_HSC_BASE_ADDR);
73
74 /* setup MIPI module to legacy mode */
75 __raw_writel(0xf00, hsc_addr);
76
77 /* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */
78 __raw_writel(__raw_readl(hsc_addr + 0x800) | 0x30ff,
79 hsc_addr + 0x800);
80}
81
82void __init imx51_init_early(void)
83{
84 imx51_ipu_mipi_setup();
85 mxc_set_cpu_type(MXC_CPU_MX51);
86 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
87 imx_src_init();
88}
89
90void __init imx53_init_early(void)
91{
92 mxc_set_cpu_type(MXC_CPU_MX53);
93 imx_src_init();
94}
95
96void __init mx51_init_irq(void)
97{
98 tzic_init_irq(MX51_IO_ADDRESS(MX51_TZIC_BASE_ADDR));
99}
100
101void __init mx53_init_irq(void)
102{
103 struct device_node *np;
104 void __iomem *base;
105
106 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-tzic");
107 base = of_iomap(np, 0);
108 WARN_ON(!base);
109
110 tzic_init_irq(base);
111}
112
113static struct sdma_platform_data imx51_sdma_pdata __initdata = {
114 .fw_name = "sdma-imx51.bin",
115};
116
117static const struct resource imx51_audmux_res[] __initconst = {
118 DEFINE_RES_MEM(MX51_AUDMUX_BASE_ADDR, SZ_16K),
119};
120
121void __init imx51_soc_init(void)
122{
123 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
124 mxc_device_init();
125
126 /* i.mx51 has the i.mx35 type gpio */
127 mxc_register_gpio("imx35-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH);
128 mxc_register_gpio("imx35-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH);
129 mxc_register_gpio("imx35-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_INT_GPIO3_LOW, MX51_INT_GPIO3_HIGH);
130 mxc_register_gpio("imx35-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_INT_GPIO4_LOW, MX51_INT_GPIO4_HIGH);
131
132 pinctrl_provide_dummies();
133
134 /* i.mx51 has the i.mx35 type sdma */
135 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
136
137 /* Setup AIPS registers */
138 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR));
139 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR));
140
141 /* i.mx51 has the i.mx31 type audmux */
142 platform_device_register_simple("imx31-audmux", 0, imx51_audmux_res,
143 ARRAY_SIZE(imx51_audmux_res));
144}
145
146void __init imx51_init_late(void)
147{
148 mx51_neon_fixup();
149 imx5_pm_init();
150}
151
152void __init imx53_init_late(void)
153{
154 imx5_pm_init();
155}
diff --git a/arch/arm/mach-imx/mx1-camera-fiq-ksym.c b/arch/arm/mach-imx/mx1-camera-fiq-ksym.c
deleted file mode 100644
index fb38436ca67f..000000000000
--- a/arch/arm/mach-imx/mx1-camera-fiq-ksym.c
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Exported ksyms of ARCH_MX1
3 *
4 * Copyright (C) 2008, Darius Augulis <augulis.darius@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/module.h>
13
14#include <linux/platform_data/camera-mx1.h>
15
16/* IMX camera FIQ handler */
17EXPORT_SYMBOL(mx1_camera_sof_fiq_start);
18EXPORT_SYMBOL(mx1_camera_sof_fiq_end);
diff --git a/arch/arm/mach-imx/mx1-camera-fiq.S b/arch/arm/mach-imx/mx1-camera-fiq.S
deleted file mode 100644
index 9c69aa65bf17..000000000000
--- a/arch/arm/mach-imx/mx1-camera-fiq.S
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
3 *
4 * Based on linux/arch/arm/lib/floppydma.S
5 * Copyright (C) 1995, 1996 Russell King
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#include <linux/linkage.h>
12#include <asm/assembler.h>
13
14 .text
15 .global mx1_camera_sof_fiq_end
16 .global mx1_camera_sof_fiq_start
17mx1_camera_sof_fiq_start:
18 @ enable dma
19 ldr r12, [r9]
20 orr r12, r12, #0x00000001
21 str r12, [r9]
22 @ unmask DMA interrupt
23 ldr r12, [r8]
24 bic r12, r12, r13
25 str r12, [r8]
26 @ disable SOF interrupt
27 ldr r12, [r10]
28 bic r12, r12, #0x00010000
29 str r12, [r10]
30 @ clear SOF flag
31 mov r12, #0x00010000
32 str r12, [r11]
33 @ return from FIQ
34 subs pc, lr, #4
35mx1_camera_sof_fiq_end:
diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c
index 52d5b1574721..1e91a0918e83 100644
--- a/arch/arm/mach-imx/mx31moboard-devboard.c
+++ b/arch/arm/mach-imx/mx31moboard-devboard.c
@@ -24,6 +24,7 @@
24 24
25#include "common.h" 25#include "common.h"
26#include "devices-imx31.h" 26#include "devices-imx31.h"
27#include "ehci.h"
27#include "hardware.h" 28#include "hardware.h"
28#include "iomux-mx3.h" 29#include "iomux-mx3.h"
29#include "ulpi.h" 30#include "ulpi.h"
@@ -213,10 +214,8 @@ static int __init devboard_usbh1_init(void)
213 usbh1_pdata.otg = phy; 214 usbh1_pdata.otg = phy;
214 215
215 pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); 216 pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
216 if (IS_ERR(pdev))
217 return PTR_ERR(pdev);
218 217
219 return 0; 218 return PTR_ERR_OR_ZERO(pdev);
220} 219}
221 220
222 221
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c
index a4f43e90f3c1..2e895a82a6eb 100644
--- a/arch/arm/mach-imx/mx31moboard-marxbot.c
+++ b/arch/arm/mach-imx/mx31moboard-marxbot.c
@@ -28,6 +28,7 @@
28 28
29#include "common.h" 29#include "common.h"
30#include "devices-imx31.h" 30#include "devices-imx31.h"
31#include "ehci.h"
31#include "hardware.h" 32#include "hardware.h"
32#include "iomux-mx3.h" 33#include "iomux-mx3.h"
33#include "ulpi.h" 34#include "ulpi.h"
@@ -327,10 +328,8 @@ static int __init marxbot_usbh1_init(void)
327 usbh1_pdata.otg = phy; 328 usbh1_pdata.otg = phy;
328 329
329 pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); 330 pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
330 if (IS_ERR(pdev))
331 return PTR_ERR(pdev);
332 331
333 return 0; 332 return PTR_ERR_OR_ZERO(pdev);
334} 333}
335 334
336static const struct fsl_usb2_platform_data usb_pdata __initconst = { 335static const struct fsl_usb2_platform_data usb_pdata __initconst = {
diff --git a/arch/arm/mach-imx/mx31moboard-smartbot.c b/arch/arm/mach-imx/mx31moboard-smartbot.c
index 04ae45dbfaa7..89fc35a64448 100644
--- a/arch/arm/mach-imx/mx31moboard-smartbot.c
+++ b/arch/arm/mach-imx/mx31moboard-smartbot.c
@@ -28,6 +28,7 @@
28#include "board-mx31moboard.h" 28#include "board-mx31moboard.h"
29#include "common.h" 29#include "common.h"
30#include "devices-imx31.h" 30#include "devices-imx31.h"
31#include "ehci.h"
31#include "hardware.h" 32#include "hardware.h"
32#include "iomux-mx3.h" 33#include "iomux-mx3.h"
33#include "ulpi.h" 34#include "ulpi.h"
@@ -141,10 +142,8 @@ static int __init smartbot_otg_host_init(void)
141 return -ENODEV; 142 return -ENODEV;
142 143
143 pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata); 144 pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
144 if (IS_ERR(pdev))
145 return PTR_ERR(pdev);
146 145
147 return 0; 146 return PTR_ERR_OR_ZERO(pdev);
148} 147}
149#else 148#else
150static inline int smartbot_otg_host_init(void) { return 0; } 149static inline int smartbot_otg_host_init(void) { return 0; }
diff --git a/arch/arm/mach-imx/mx51.h b/arch/arm/mach-imx/mx51.h
deleted file mode 100644
index af844f76261a..000000000000
--- a/arch/arm/mach-imx/mx51.h
+++ /dev/null
@@ -1,346 +0,0 @@
1#ifndef __MACH_MX51_H__
2#define __MACH_MX51_H__
3
4/*
5 * IROM
6 */
7#define MX51_IROM_BASE_ADDR 0x0
8#define MX51_IROM_SIZE SZ_64K
9
10/*
11 * IRAM
12 */
13#define MX51_IRAM_BASE_ADDR 0x1ffe0000 /* internal ram */
14#define MX51_IRAM_PARTITIONS 16
15#define MX51_IRAM_SIZE (MX51_IRAM_PARTITIONS * SZ_8K) /* 128KB */
16
17#define MX51_GPU_BASE_ADDR 0x20000000
18#define MX51_GPU_CTRL_BASE_ADDR 0x30000000
19#define MX51_IPU_CTRL_BASE_ADDR 0x40000000
20
21/*
22 * SPBA global module enabled #0
23 */
24#define MX51_SPBA0_BASE_ADDR 0x70000000
25#define MX51_SPBA0_SIZE SZ_1M
26
27#define MX51_ESDHC1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x04000)
28#define MX51_ESDHC2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x08000)
29#define MX51_UART3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x0c000)
30#define MX51_ECSPI1_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x10000)
31#define MX51_SSI2_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x14000)
32#define MX51_ESDHC3_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x20000)
33#define MX51_ESDHC4_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x24000)
34#define MX51_SPDIF_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x28000)
35#define MX51_ATA_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x30000)
36#define MX51_SLIM_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x34000)
37#define MX51_HSI2C_DMA_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x38000)
38#define MX51_SPBA_CTRL_BASE_ADDR (MX51_SPBA0_BASE_ADDR + 0x3c000)
39
40/*
41 * AIPS 1
42 */
43#define MX51_AIPS1_BASE_ADDR 0x73f00000
44#define MX51_AIPS1_SIZE SZ_1M
45
46#define MX51_USB_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x80000)
47#define MX51_USB_OTG_BASE_ADDR (MX51_USB_BASE_ADDR + 0x0000)
48#define MX51_USB_HS1_BASE_ADDR (MX51_USB_BASE_ADDR + 0x0200)
49#define MX51_USB_HS2_BASE_ADDR (MX51_USB_BASE_ADDR + 0x0400)
50#define MX51_GPIO1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x84000)
51#define MX51_GPIO2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x88000)
52#define MX51_GPIO3_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x8c000)
53#define MX51_GPIO4_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x90000)
54#define MX51_KPP_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x94000)
55#define MX51_WDOG1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x98000)
56#define MX51_WDOG2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0x9c000)
57#define MX51_GPT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa0000)
58#define MX51_SRTC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa4000)
59#define MX51_IOMUXC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xa8000)
60#define MX51_EPIT1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xac000)
61#define MX51_EPIT2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb0000)
62#define MX51_PWM1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb4000)
63#define MX51_PWM2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xb8000)
64#define MX51_UART1_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xbc000)
65#define MX51_UART2_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xc0000)
66#define MX51_SRC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd0000)
67#define MX51_CCM_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd4000)
68#define MX51_GPC_BASE_ADDR (MX51_AIPS1_BASE_ADDR + 0xd8000)
69
70/*
71 * AIPS 2
72 */
73#define MX51_AIPS2_BASE_ADDR 0x83f00000
74#define MX51_AIPS2_SIZE SZ_1M
75
76#define MX51_PLL1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x80000)
77#define MX51_PLL2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x84000)
78#define MX51_PLL3_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x88000)
79#define MX51_AHBMAX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x94000)
80#define MX51_IIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x98000)
81#define MX51_CSU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0x9c000)
82#define MX51_ARM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa0000)
83#define MX51_OWIRE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa4000)
84#define MX51_FIRI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xa8000)
85#define MX51_ECSPI2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xac000)
86#define MX51_SDMA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb0000)
87#define MX51_SCC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb4000)
88#define MX51_ROMCP_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xb8000)
89#define MX51_RTIC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xbc000)
90#define MX51_CSPI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc0000)
91#define MX51_I2C2_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc4000)
92#define MX51_I2C1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xc8000)
93#define MX51_SSI1_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xcc000)
94#define MX51_AUDMUX_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd0000)
95#define MX51_M4IF_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd8000)
96#define MX51_ESDCTL_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xd9000)
97#define MX51_WEIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xda000)
98#define MX51_NFC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdb000)
99#define MX51_EMI_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdbf00)
100#define MX51_MIPI_HSC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xdc000)
101#define MX51_ATA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe0000)
102#define MX51_SIM_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe4000)
103#define MX51_SSI3_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xe8000)
104#define MX51_FEC_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xec000)
105#define MX51_TVE_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf0000)
106#define MX51_VPU_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf4000)
107#define MX51_SAHARA_BASE_ADDR (MX51_AIPS2_BASE_ADDR + 0xf8000)
108
109#define MX51_CSD0_BASE_ADDR 0x90000000
110#define MX51_CSD1_BASE_ADDR 0xa0000000
111#define MX51_CS0_BASE_ADDR 0xb0000000
112#define MX51_CS1_BASE_ADDR 0xb8000000
113#define MX51_CS2_BASE_ADDR 0xc0000000
114#define MX51_CS3_BASE_ADDR 0xc8000000
115#define MX51_CS4_BASE_ADDR 0xcc000000
116#define MX51_CS5_BASE_ADDR 0xce000000
117
118/*
119 * NFC
120 */
121#define MX51_NFC_AXI_BASE_ADDR 0xcfff0000 /* NAND flash AXI */
122#define MX51_NFC_AXI_SIZE SZ_64K
123
124#define MX51_GPU2D_BASE_ADDR 0xd0000000
125#define MX51_TZIC_BASE_ADDR 0xe0000000
126#define MX51_TZIC_SIZE SZ_16K
127
128#define MX51_IO_P2V(x) IMX_IO_P2V(x)
129#define MX51_IO_ADDRESS(x) IOMEM(MX51_IO_P2V(x))
130
131/*
132 * defines for SPBA modules
133 */
134#define MX51_SPBA_SDHC1 0x04
135#define MX51_SPBA_SDHC2 0x08
136#define MX51_SPBA_UART3 0x0c
137#define MX51_SPBA_CSPI1 0x10
138#define MX51_SPBA_SSI2 0x14
139#define MX51_SPBA_SDHC3 0x20
140#define MX51_SPBA_SDHC4 0x24
141#define MX51_SPBA_SPDIF 0x28
142#define MX51_SPBA_ATA 0x30
143#define MX51_SPBA_SLIM 0x34
144#define MX51_SPBA_HSI2C 0x38
145#define MX51_SPBA_CTRL 0x3c
146
147/*
148 * Defines for modules using static and dynamic DMA channels
149 */
150#define MX51_MXC_DMA_CHANNEL_IRAM 30
151#define MX51_MXC_DMA_CHANNEL_SPDIF_TX MXC_DMA_DYNAMIC_CHANNEL
152#define MX51_MXC_DMA_CHANNEL_UART1_RX MXC_DMA_DYNAMIC_CHANNEL
153#define MX51_MXC_DMA_CHANNEL_UART1_TX MXC_DMA_DYNAMIC_CHANNEL
154#define MX51_MXC_DMA_CHANNEL_UART2_RX MXC_DMA_DYNAMIC_CHANNEL
155#define MX51_MXC_DMA_CHANNEL_UART2_TX MXC_DMA_DYNAMIC_CHANNEL
156#define MX51_MXC_DMA_CHANNEL_UART3_RX MXC_DMA_DYNAMIC_CHANNEL
157#define MX51_MXC_DMA_CHANNEL_UART3_TX MXC_DMA_DYNAMIC_CHANNEL
158#define MX51_MXC_DMA_CHANNEL_MMC1 MXC_DMA_DYNAMIC_CHANNEL
159#define MX51_MXC_DMA_CHANNEL_MMC2 MXC_DMA_DYNAMIC_CHANNEL
160#define MX51_MXC_DMA_CHANNEL_SSI1_RX MXC_DMA_DYNAMIC_CHANNEL
161#define MX51_MXC_DMA_CHANNEL_SSI1_TX MXC_DMA_DYNAMIC_CHANNEL
162#define MX51_MXC_DMA_CHANNEL_SSI2_RX MXC_DMA_DYNAMIC_CHANNEL
163#ifdef CONFIG_SDMA_IRAM
164#define MX51_MXC_DMA_CHANNEL_SSI2_TX (MX51_MXC_DMA_CHANNEL_IRAM + 1)
165#else /*CONFIG_SDMA_IRAM */
166#define MX51_MXC_DMA_CHANNEL_SSI2_TX MXC_DMA_DYNAMIC_CHANNEL
167#endif /*CONFIG_SDMA_IRAM */
168#define MX51_MXC_DMA_CHANNEL_CSPI1_RX MXC_DMA_DYNAMIC_CHANNEL
169#define MX51_MXC_DMA_CHANNEL_CSPI1_TX MXC_DMA_DYNAMIC_CHANNEL
170#define MX51_MXC_DMA_CHANNEL_CSPI2_RX MXC_DMA_DYNAMIC_CHANNEL
171#define MX51_MXC_DMA_CHANNEL_CSPI2_TX MXC_DMA_DYNAMIC_CHANNEL
172#define MX51_MXC_DMA_CHANNEL_CSPI3_RX MXC_DMA_DYNAMIC_CHANNEL
173#define MX51_MXC_DMA_CHANNEL_CSPI3_TX MXC_DMA_DYNAMIC_CHANNEL
174#define MX51_MXC_DMA_CHANNEL_ATA_RX MXC_DMA_DYNAMIC_CHANNEL
175#define MX51_MXC_DMA_CHANNEL_ATA_TX MXC_DMA_DYNAMIC_CHANNEL
176#define MX51_MXC_DMA_CHANNEL_MEMORY MXC_DMA_DYNAMIC_CHANNEL
177
178#define MX51_IS_MEM_DEVICE_NONSHARED(x) 0
179
180/*
181 * DMA request assignments
182 */
183#define MX51_DMA_REQ_VPU 0
184#define MX51_DMA_REQ_GPC 1
185#define MX51_DMA_REQ_ATA_RX 2
186#define MX51_DMA_REQ_ATA_TX 3
187#define MX51_DMA_REQ_ATA_TX_END 4
188#define MX51_DMA_REQ_SLIM_B 5
189#define MX51_DMA_REQ_CSPI1_RX 6
190#define MX51_DMA_REQ_CSPI1_TX 7
191#define MX51_DMA_REQ_CSPI2_RX 8
192#define MX51_DMA_REQ_CSPI2_TX 9
193#define MX51_DMA_REQ_HS_I2C_TX 10
194#define MX51_DMA_REQ_HS_I2C_RX 11
195#define MX51_DMA_REQ_FIRI_RX 12
196#define MX51_DMA_REQ_FIRI_TX 13
197#define MX51_DMA_REQ_EXTREQ1 14
198#define MX51_DMA_REQ_GPU 15
199#define MX51_DMA_REQ_UART2_RX 16
200#define MX51_DMA_REQ_UART2_TX 17
201#define MX51_DMA_REQ_UART1_RX 18
202#define MX51_DMA_REQ_UART1_TX 19
203#define MX51_DMA_REQ_SDHC1 20
204#define MX51_DMA_REQ_SDHC2 21
205#define MX51_DMA_REQ_SSI2_RX1 22
206#define MX51_DMA_REQ_SSI2_TX1 23
207#define MX51_DMA_REQ_SSI2_RX0 24
208#define MX51_DMA_REQ_SSI2_TX0 25
209#define MX51_DMA_REQ_SSI1_RX1 26
210#define MX51_DMA_REQ_SSI1_TX1 27
211#define MX51_DMA_REQ_SSI1_RX0 28
212#define MX51_DMA_REQ_SSI1_TX0 29
213#define MX51_DMA_REQ_EMI_RD 30
214#define MX51_DMA_REQ_CTI2_0 31
215#define MX51_DMA_REQ_EMI_WR 32
216#define MX51_DMA_REQ_CTI2_1 33
217#define MX51_DMA_REQ_EPIT2 34
218#define MX51_DMA_REQ_SSI3_RX1 35
219#define MX51_DMA_REQ_IPU 36
220#define MX51_DMA_REQ_SSI3_TX1 37
221#define MX51_DMA_REQ_CSPI_RX 38
222#define MX51_DMA_REQ_CSPI_TX 39
223#define MX51_DMA_REQ_SDHC3 40
224#define MX51_DMA_REQ_SDHC4 41
225#define MX51_DMA_REQ_SLIM_B_TX 42
226#define MX51_DMA_REQ_UART3_RX 43
227#define MX51_DMA_REQ_UART3_TX 44
228#define MX51_DMA_REQ_SPDIF 45
229#define MX51_DMA_REQ_SSI3_RX0 46
230#define MX51_DMA_REQ_SSI3_TX0 47
231
232/*
233 * Interrupt numbers
234 */
235#include <asm/irq.h>
236#define MX51_INT_BASE (NR_IRQS_LEGACY + 0)
237#define MX51_INT_RESV0 (NR_IRQS_LEGACY + 0)
238#define MX51_INT_ESDHC1 (NR_IRQS_LEGACY + 1)
239#define MX51_INT_ESDHC2 (NR_IRQS_LEGACY + 2)
240#define MX51_INT_ESDHC3 (NR_IRQS_LEGACY + 3)
241#define MX51_INT_ESDHC4 (NR_IRQS_LEGACY + 4)
242#define MX51_INT_RESV5 (NR_IRQS_LEGACY + 5)
243#define MX51_INT_SDMA (NR_IRQS_LEGACY + 6)
244#define MX51_INT_IOMUX (NR_IRQS_LEGACY + 7)
245#define MX51_INT_NFC (NR_IRQS_LEGACY + 8)
246#define MX51_INT_VPU (NR_IRQS_LEGACY + 9)
247#define MX51_INT_IPU_ERR (NR_IRQS_LEGACY + 10)
248#define MX51_INT_IPU_SYN (NR_IRQS_LEGACY + 11)
249#define MX51_INT_GPU (NR_IRQS_LEGACY + 12)
250#define MX51_INT_RESV13 (NR_IRQS_LEGACY + 13)
251#define MX51_INT_USB_HS1 (NR_IRQS_LEGACY + 14)
252#define MX51_INT_EMI (NR_IRQS_LEGACY + 15)
253#define MX51_INT_USB_HS2 (NR_IRQS_LEGACY + 16)
254#define MX51_INT_USB_HS3 (NR_IRQS_LEGACY + 17)
255#define MX51_INT_USB_OTG (NR_IRQS_LEGACY + 18)
256#define MX51_INT_SAHARA_H0 (NR_IRQS_LEGACY + 19)
257#define MX51_INT_SAHARA_H1 (NR_IRQS_LEGACY + 20)
258#define MX51_INT_SCC_SMN (NR_IRQS_LEGACY + 21)
259#define MX51_INT_SCC_STZ (NR_IRQS_LEGACY + 22)
260#define MX51_INT_SCC_SCM (NR_IRQS_LEGACY + 23)
261#define MX51_INT_SRTC_NTZ (NR_IRQS_LEGACY + 24)
262#define MX51_INT_SRTC_TZ (NR_IRQS_LEGACY + 25)
263#define MX51_INT_RTIC (NR_IRQS_LEGACY + 26)
264#define MX51_INT_CSU (NR_IRQS_LEGACY + 27)
265#define MX51_INT_SLIM_B (NR_IRQS_LEGACY + 28)
266#define MX51_INT_SSI1 (NR_IRQS_LEGACY + 29)
267#define MX51_INT_SSI2 (NR_IRQS_LEGACY + 30)
268#define MX51_INT_UART1 (NR_IRQS_LEGACY + 31)
269#define MX51_INT_UART2 (NR_IRQS_LEGACY + 32)
270#define MX51_INT_UART3 (NR_IRQS_LEGACY + 33)
271#define MX51_INT_RESV34 (NR_IRQS_LEGACY + 34)
272#define MX51_INT_RESV35 (NR_IRQS_LEGACY + 35)
273#define MX51_INT_ECSPI1 (NR_IRQS_LEGACY + 36)
274#define MX51_INT_ECSPI2 (NR_IRQS_LEGACY + 37)
275#define MX51_INT_CSPI (NR_IRQS_LEGACY + 38)
276#define MX51_INT_GPT (NR_IRQS_LEGACY + 39)
277#define MX51_INT_EPIT1 (NR_IRQS_LEGACY + 40)
278#define MX51_INT_EPIT2 (NR_IRQS_LEGACY + 41)
279#define MX51_INT_GPIO1_INT7 (NR_IRQS_LEGACY + 42)
280#define MX51_INT_GPIO1_INT6 (NR_IRQS_LEGACY + 43)
281#define MX51_INT_GPIO1_INT5 (NR_IRQS_LEGACY + 44)
282#define MX51_INT_GPIO1_INT4 (NR_IRQS_LEGACY + 45)
283#define MX51_INT_GPIO1_INT3 (NR_IRQS_LEGACY + 46)
284#define MX51_INT_GPIO1_INT2 (NR_IRQS_LEGACY + 47)
285#define MX51_INT_GPIO1_INT1 (NR_IRQS_LEGACY + 48)
286#define MX51_INT_GPIO1_INT0 (NR_IRQS_LEGACY + 49)
287#define MX51_INT_GPIO1_LOW (NR_IRQS_LEGACY + 50)
288#define MX51_INT_GPIO1_HIGH (NR_IRQS_LEGACY + 51)
289#define MX51_INT_GPIO2_LOW (NR_IRQS_LEGACY + 52)
290#define MX51_INT_GPIO2_HIGH (NR_IRQS_LEGACY + 53)
291#define MX51_INT_GPIO3_LOW (NR_IRQS_LEGACY + 54)
292#define MX51_INT_GPIO3_HIGH (NR_IRQS_LEGACY + 55)
293#define MX51_INT_GPIO4_LOW (NR_IRQS_LEGACY + 56)
294#define MX51_INT_GPIO4_HIGH (NR_IRQS_LEGACY + 57)
295#define MX51_INT_WDOG1 (NR_IRQS_LEGACY + 58)
296#define MX51_INT_WDOG2 (NR_IRQS_LEGACY + 59)
297#define MX51_INT_KPP (NR_IRQS_LEGACY + 60)
298#define MX51_INT_PWM1 (NR_IRQS_LEGACY + 61)
299#define MX51_INT_I2C1 (NR_IRQS_LEGACY + 62)
300#define MX51_INT_I2C2 (NR_IRQS_LEGACY + 63)
301#define MX51_INT_HS_I2C (NR_IRQS_LEGACY + 64)
302#define MX51_INT_RESV65 (NR_IRQS_LEGACY + 65)
303#define MX51_INT_RESV66 (NR_IRQS_LEGACY + 66)
304#define MX51_INT_SIM_IPB (NR_IRQS_LEGACY + 67)
305#define MX51_INT_SIM_DAT (NR_IRQS_LEGACY + 68)
306#define MX51_INT_IIM (NR_IRQS_LEGACY + 69)
307#define MX51_INT_ATA (NR_IRQS_LEGACY + 70)
308#define MX51_INT_CCM1 (NR_IRQS_LEGACY + 71)
309#define MX51_INT_CCM2 (NR_IRQS_LEGACY + 72)
310#define MX51_INT_GPC1 (NR_IRQS_LEGACY + 73)
311#define MX51_INT_GPC2 (NR_IRQS_LEGACY + 74)
312#define MX51_INT_SRC (NR_IRQS_LEGACY + 75)
313#define MX51_INT_NM (NR_IRQS_LEGACY + 76)
314#define MX51_INT_PMU (NR_IRQS_LEGACY + 77)
315#define MX51_INT_CTI_IRQ (NR_IRQS_LEGACY + 78)
316#define MX51_INT_CTI1_TG0 (NR_IRQS_LEGACY + 79)
317#define MX51_INT_CTI1_TG1 (NR_IRQS_LEGACY + 80)
318#define MX51_INT_MCG_ERR (NR_IRQS_LEGACY + 81)
319#define MX51_INT_MCG_TMR (NR_IRQS_LEGACY + 82)
320#define MX51_INT_MCG_FUNC (NR_IRQS_LEGACY + 83)
321#define MX51_INT_GPU2_IRQ (NR_IRQS_LEGACY + 84)
322#define MX51_INT_GPU2_BUSY (NR_IRQS_LEGACY + 85)
323#define MX51_INT_RESV86 (NR_IRQS_LEGACY + 86)
324#define MX51_INT_FEC (NR_IRQS_LEGACY + 87)
325#define MX51_INT_OWIRE (NR_IRQS_LEGACY + 88)
326#define MX51_INT_CTI1_TG2 (NR_IRQS_LEGACY + 89)
327#define MX51_INT_SJC (NR_IRQS_LEGACY + 90)
328#define MX51_INT_SPDIF (NR_IRQS_LEGACY + 91)
329#define MX51_INT_TVE (NR_IRQS_LEGACY + 92)
330#define MX51_INT_FIRI (NR_IRQS_LEGACY + 93)
331#define MX51_INT_PWM2 (NR_IRQS_LEGACY + 94)
332#define MX51_INT_SLIM_EXP (NR_IRQS_LEGACY + 95)
333#define MX51_INT_SSI3 (NR_IRQS_LEGACY + 96)
334#define MX51_INT_EMI_BOOT (NR_IRQS_LEGACY + 97)
335#define MX51_INT_CTI1_TG3 (NR_IRQS_LEGACY + 98)
336#define MX51_INT_SMC_RX (NR_IRQS_LEGACY + 99)
337#define MX51_INT_VPU_IDLE (NR_IRQS_LEGACY + 100)
338#define MX51_INT_EMI_NFC (NR_IRQS_LEGACY + 101)
339#define MX51_INT_GPU_IDLE (NR_IRQS_LEGACY + 102)
340
341#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
342extern int mx51_revision(void);
343extern void mx51_display_revision(void);
344#endif
345
346#endif /* ifndef __MACH_MX51_H__ */
diff --git a/arch/arm/mach-imx/mx53.h b/arch/arm/mach-imx/mx53.h
deleted file mode 100644
index f829d1c22501..000000000000
--- a/arch/arm/mach-imx/mx53.h
+++ /dev/null
@@ -1,342 +0,0 @@
1#ifndef __MACH_MX53_H__
2#define __MACH_MX53_H__
3
4/*
5 * IROM
6 */
7#define MX53_IROM_BASE_ADDR 0x0
8#define MX53_IROM_SIZE SZ_64K
9
10/* TZIC */
11#define MX53_TZIC_BASE_ADDR 0x0FFFC000
12#define MX53_TZIC_SIZE SZ_16K
13
14/*
15 * AHCI SATA
16 */
17#define MX53_SATA_BASE_ADDR 0x10000000
18
19/*
20 * NFC
21 */
22#define MX53_NFC_AXI_BASE_ADDR 0xF7FF0000 /* NAND flash AXI */
23#define MX53_NFC_AXI_SIZE SZ_64K
24
25/*
26 * IRAM
27 */
28#define MX53_IRAM_BASE_ADDR 0xF8000000 /* internal ram */
29#define MX53_IRAM_PARTITIONS 16
30#define MX53_IRAM_SIZE (MX53_IRAM_PARTITIONS * SZ_8K) /* 128KB */
31
32/*
33 * Graphics Memory of GPU
34 */
35#define MX53_IPU_CTRL_BASE_ADDR 0x18000000
36#define MX53_GPU2D_BASE_ADDR 0x20000000
37#define MX53_GPU_BASE_ADDR 0x30000000
38#define MX53_GPU_GMEM_BASE_ADDR 0xF8020000
39
40#define MX53_DEBUG_BASE_ADDR 0x40000000
41#define MX53_DEBUG_SIZE SZ_1M
42#define MX53_ETB_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00001000)
43#define MX53_ETM_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00002000)
44#define MX53_TPIU_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00003000)
45#define MX53_CTI0_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00004000)
46#define MX53_CTI1_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00005000)
47#define MX53_CTI2_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00006000)
48#define MX53_CTI3_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00007000)
49#define MX53_CORTEX_DBG_BASE_ADDR (MX53_DEBUG_BASE_ADDR + 0x00008000)
50
51/*
52 * SPBA global module enabled #0
53 */
54#define MX53_SPBA0_BASE_ADDR 0x50000000
55#define MX53_SPBA0_SIZE SZ_1M
56
57#define MX53_ESDHC1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00004000)
58#define MX53_ESDHC2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00008000)
59#define MX53_UART3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0000C000)
60#define MX53_ECSPI1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00010000)
61#define MX53_SSI2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00014000)
62#define MX53_ESDHC3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00020000)
63#define MX53_ESDHC4_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00024000)
64#define MX53_SPDIF_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00028000)
65#define MX53_ASRC_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0002C000)
66#define MX53_ATA_DMA_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00030000)
67#define MX53_SLIM_DMA_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00034000)
68#define MX53_HSI2C_DMA_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00038000)
69#define MX53_SPBA_CTRL_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0003C000)
70
71/*
72 * AIPS 1
73 */
74#define MX53_AIPS1_BASE_ADDR 0x53F00000
75#define MX53_AIPS1_SIZE SZ_1M
76
77#define MX53_OTG_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00080000)
78#define MX53_GPIO1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00084000)
79#define MX53_GPIO2_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00088000)
80#define MX53_GPIO3_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x0008C000)
81#define MX53_GPIO4_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00090000)
82#define MX53_KPP_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00094000)
83#define MX53_WDOG1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x00098000)
84#define MX53_WDOG2_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x0009C000)
85#define MX53_GPT1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000A0000)
86#define MX53_SRTC_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000A4000)
87#define MX53_IOMUXC_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000A8000)
88#define MX53_EPIT1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000AC000)
89#define MX53_EPIT2_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000B0000)
90#define MX53_PWM1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000B4000)
91#define MX53_PWM2_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000B8000)
92#define MX53_UART1_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000BC000)
93#define MX53_UART2_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000C0000)
94#define MX53_SRC_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000D0000)
95#define MX53_CCM_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000D4000)
96#define MX53_GPC_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000D8000)
97#define MX53_GPIO5_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000DC000)
98#define MX53_GPIO6_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000E0000)
99#define MX53_GPIO7_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000E4000)
100#define MX53_ATA_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000E8000)
101#define MX53_I2C3_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000EC000)
102#define MX53_UART4_BASE_ADDR (MX53_AIPS1_BASE_ADDR + 0x000F0000)
103
104/*
105 * AIPS 2
106 */
107#define MX53_AIPS2_BASE_ADDR 0x63F00000
108#define MX53_AIPS2_SIZE SZ_1M
109
110#define MX53_PLL1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00080000)
111#define MX53_PLL2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00084000)
112#define MX53_PLL3_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00088000)
113#define MX53_PLL4_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x0008C000)
114#define MX53_UART5_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00090000)
115#define MX53_AHBMAX_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00094000)
116#define MX53_IIM_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x00098000)
117#define MX53_CSU_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x0009C000)
118#define MX53_ARM_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A0000)
119#define MX53_OWIRE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A4000)
120#define MX53_FIRI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A8000)
121#define MX53_ECSPI2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000AC000)
122#define MX53_SDMA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B0000)
123#define MX53_SCC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B4000)
124#define MX53_ROMCP_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B8000)
125#define MX53_RTIC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000BC000)
126#define MX53_CSPI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C0000)
127#define MX53_I2C2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C4000)
128#define MX53_I2C1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C8000)
129#define MX53_SSI1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000CC000)
130#define MX53_AUDMUX_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000D0000)
131#define MX53_RTC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000D4000)
132#define MX53_M4IF_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000D8000)
133#define MX53_ESDCTL_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000D9000)
134#define MX53_WEIM_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DA000)
135#define MX53_NFC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DB000)
136#define MX53_EMI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DBF00)
137#define MX53_MIPI_HSC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DC000)
138#define MX53_MLB_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E4000)
139#define MX53_SSI3_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E8000)
140#define MX53_FEC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000EC000)
141#define MX53_TVE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F0000)
142#define MX53_VPU_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F4000)
143#define MX53_SAHARA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F8000)
144#define MX53_PTP_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000FC000)
145
146/*
147 * Memory regions and CS
148 */
149#define MX53_CSD0_BASE_ADDR 0x70000000
150#define MX53_CSD1_BASE_ADDR 0xB0000000
151#define MX53_CS0_BASE_ADDR 0xF0000000
152#define MX53_CS1_32MB_BASE_ADDR 0xF2000000
153#define MX53_CS1_64MB_BASE_ADDR 0xF4000000
154#define MX53_CS2_64MB_BASE_ADDR 0xF4000000
155#define MX53_CS2_96MB_BASE_ADDR 0xF6000000
156#define MX53_CS3_BASE_ADDR 0xF6000000
157
158#define MX53_IO_P2V(x) IMX_IO_P2V(x)
159#define MX53_IO_ADDRESS(x) IOMEM(MX53_IO_P2V(x))
160
161/*
162 * defines for SPBA modules
163 */
164#define MX53_SPBA_SDHC1 0x04
165#define MX53_SPBA_SDHC2 0x08
166#define MX53_SPBA_UART3 0x0C
167#define MX53_SPBA_CSPI1 0x10
168#define MX53_SPBA_SSI2 0x14
169#define MX53_SPBA_SDHC3 0x20
170#define MX53_SPBA_SDHC4 0x24
171#define MX53_SPBA_SPDIF 0x28
172#define MX53_SPBA_ATA 0x30
173#define MX53_SPBA_SLIM 0x34
174#define MX53_SPBA_HSI2C 0x38
175#define MX53_SPBA_CTRL 0x3C
176
177/*
178 * DMA request assignments
179 */
180#define MX53_DMA_REQ_SSI3_TX0 47
181#define MX53_DMA_REQ_SSI3_RX0 46
182#define MX53_DMA_REQ_SSI3_TX1 45
183#define MX53_DMA_REQ_SSI3_RX1 44
184#define MX53_DMA_REQ_UART3_TX 43
185#define MX53_DMA_REQ_UART3_RX 42
186#define MX53_DMA_REQ_ESAI_TX 41
187#define MX53_DMA_REQ_ESAI_RX 40
188#define MX53_DMA_REQ_CSPI_TX 39
189#define MX53_DMA_REQ_CSPI_RX 38
190#define MX53_DMA_REQ_ASRC_DMA6 37
191#define MX53_DMA_REQ_ASRC_DMA5 36
192#define MX53_DMA_REQ_ASRC_DMA4 35
193#define MX53_DMA_REQ_ASRC_DMA3 34
194#define MX53_DMA_REQ_ASRC_DMA2 33
195#define MX53_DMA_REQ_ASRC_DMA1 32
196#define MX53_DMA_REQ_EMI_WR 31
197#define MX53_DMA_REQ_EMI_RD 30
198#define MX53_DMA_REQ_SSI1_TX0 29
199#define MX53_DMA_REQ_SSI1_RX0 28
200#define MX53_DMA_REQ_SSI1_TX1 27
201#define MX53_DMA_REQ_SSI1_RX1 26
202#define MX53_DMA_REQ_SSI2_TX0 25
203#define MX53_DMA_REQ_SSI2_RX0 24
204#define MX53_DMA_REQ_SSI2_TX1 23
205#define MX53_DMA_REQ_SSI2_RX1 22
206#define MX53_DMA_REQ_I2C2_SDHC2 21
207#define MX53_DMA_REQ_I2C1_SDHC1 20
208#define MX53_DMA_REQ_UART1_TX 19
209#define MX53_DMA_REQ_UART1_RX 18
210#define MX53_DMA_REQ_UART5_TX 17
211#define MX53_DMA_REQ_UART5_RX 16
212#define MX53_DMA_REQ_SPDIF_TX 15
213#define MX53_DMA_REQ_SPDIF_RX 14
214#define MX53_DMA_REQ_UART2_FIRI_TX 13
215#define MX53_DMA_REQ_UART2_FIRI_RX 12
216#define MX53_DMA_REQ_SDHC4 11
217#define MX53_DMA_REQ_I2C3_SDHC3 10
218#define MX53_DMA_REQ_CSPI2_TX 9
219#define MX53_DMA_REQ_CSPI2_RX 8
220#define MX53_DMA_REQ_CSPI1_TX 7
221#define MX53_DMA_REQ_CSPI1_RX 6
222#define MX53_DMA_REQ_IPU 5
223#define MX53_DMA_REQ_ATA_TX_END 4
224#define MX53_DMA_REQ_ATA_UART4_TX 3
225#define MX53_DMA_REQ_ATA_UART4_RX 2
226#define MX53_DMA_REQ_GPC 1
227#define MX53_DMA_REQ_VPU 0
228
229/*
230 * Interrupt numbers
231 */
232#include <asm/irq.h>
233#define MX53_INT_RESV0 (NR_IRQS_LEGACY + 0)
234#define MX53_INT_ESDHC1 (NR_IRQS_LEGACY + 1)
235#define MX53_INT_ESDHC2 (NR_IRQS_LEGACY + 2)
236#define MX53_INT_ESDHC3 (NR_IRQS_LEGACY + 3)
237#define MX53_INT_ESDHC4 (NR_IRQS_LEGACY + 4)
238#define MX53_INT_DAP (NR_IRQS_LEGACY + 5)
239#define MX53_INT_SDMA (NR_IRQS_LEGACY + 6)
240#define MX53_INT_IOMUX (NR_IRQS_LEGACY + 7)
241#define MX53_INT_NFC (NR_IRQS_LEGACY + 8)
242#define MX53_INT_VPU (NR_IRQS_LEGACY + 9)
243#define MX53_INT_IPU_ERR (NR_IRQS_LEGACY + 10)
244#define MX53_INT_IPU_SYN (NR_IRQS_LEGACY + 11)
245#define MX53_INT_GPU (NR_IRQS_LEGACY + 12)
246#define MX53_INT_UART4 (NR_IRQS_LEGACY + 13)
247#define MX53_INT_USB_H1 (NR_IRQS_LEGACY + 14)
248#define MX53_INT_EMI (NR_IRQS_LEGACY + 15)
249#define MX53_INT_USB_H2 (NR_IRQS_LEGACY + 16)
250#define MX53_INT_USB_H3 (NR_IRQS_LEGACY + 17)
251#define MX53_INT_USB_OTG (NR_IRQS_LEGACY + 18)
252#define MX53_INT_SAHARA_H0 (NR_IRQS_LEGACY + 19)
253#define MX53_INT_SAHARA_H1 (NR_IRQS_LEGACY + 20)
254#define MX53_INT_SCC_SMN (NR_IRQS_LEGACY + 21)
255#define MX53_INT_SCC_STZ (NR_IRQS_LEGACY + 22)
256#define MX53_INT_SCC_SCM (NR_IRQS_LEGACY + 23)
257#define MX53_INT_SRTC_NTZ (NR_IRQS_LEGACY + 24)
258#define MX53_INT_SRTC_TZ (NR_IRQS_LEGACY + 25)
259#define MX53_INT_RTIC (NR_IRQS_LEGACY + 26)
260#define MX53_INT_CSU (NR_IRQS_LEGACY + 27)
261#define MX53_INT_SATA (NR_IRQS_LEGACY + 28)
262#define MX53_INT_SSI1 (NR_IRQS_LEGACY + 29)
263#define MX53_INT_SSI2 (NR_IRQS_LEGACY + 30)
264#define MX53_INT_UART1 (NR_IRQS_LEGACY + 31)
265#define MX53_INT_UART2 (NR_IRQS_LEGACY + 32)
266#define MX53_INT_UART3 (NR_IRQS_LEGACY + 33)
267#define MX53_INT_RTC (NR_IRQS_LEGACY + 34)
268#define MX53_INT_PTP (NR_IRQS_LEGACY + 35)
269#define MX53_INT_ECSPI1 (NR_IRQS_LEGACY + 36)
270#define MX53_INT_ECSPI2 (NR_IRQS_LEGACY + 37)
271#define MX53_INT_CSPI (NR_IRQS_LEGACY + 38)
272#define MX53_INT_GPT (NR_IRQS_LEGACY + 39)
273#define MX53_INT_EPIT1 (NR_IRQS_LEGACY + 40)
274#define MX53_INT_EPIT2 (NR_IRQS_LEGACY + 41)
275#define MX53_INT_GPIO1_INT7 (NR_IRQS_LEGACY + 42)
276#define MX53_INT_GPIO1_INT6 (NR_IRQS_LEGACY + 43)
277#define MX53_INT_GPIO1_INT5 (NR_IRQS_LEGACY + 44)
278#define MX53_INT_GPIO1_INT4 (NR_IRQS_LEGACY + 45)
279#define MX53_INT_GPIO1_INT3 (NR_IRQS_LEGACY + 46)
280#define MX53_INT_GPIO1_INT2 (NR_IRQS_LEGACY + 47)
281#define MX53_INT_GPIO1_INT1 (NR_IRQS_LEGACY + 48)
282#define MX53_INT_GPIO1_INT0 (NR_IRQS_LEGACY + 49)
283#define MX53_INT_GPIO1_LOW (NR_IRQS_LEGACY + 50)
284#define MX53_INT_GPIO1_HIGH (NR_IRQS_LEGACY + 51)
285#define MX53_INT_GPIO2_LOW (NR_IRQS_LEGACY + 52)
286#define MX53_INT_GPIO2_HIGH (NR_IRQS_LEGACY + 53)
287#define MX53_INT_GPIO3_LOW (NR_IRQS_LEGACY + 54)
288#define MX53_INT_GPIO3_HIGH (NR_IRQS_LEGACY + 55)
289#define MX53_INT_GPIO4_LOW (NR_IRQS_LEGACY + 56)
290#define MX53_INT_GPIO4_HIGH (NR_IRQS_LEGACY + 57)
291#define MX53_INT_WDOG1 (NR_IRQS_LEGACY + 58)
292#define MX53_INT_WDOG2 (NR_IRQS_LEGACY + 59)
293#define MX53_INT_KPP (NR_IRQS_LEGACY + 60)
294#define MX53_INT_PWM1 (NR_IRQS_LEGACY + 61)
295#define MX53_INT_I2C1 (NR_IRQS_LEGACY + 62)
296#define MX53_INT_I2C2 (NR_IRQS_LEGACY + 63)
297#define MX53_INT_I2C3 (NR_IRQS_LEGACY + 64)
298#define MX53_INT_MLB (NR_IRQS_LEGACY + 65)
299#define MX53_INT_ASRC (NR_IRQS_LEGACY + 66)
300#define MX53_INT_SPDIF (NR_IRQS_LEGACY + 67)
301#define MX53_INT_SIM_DAT (NR_IRQS_LEGACY + 68)
302#define MX53_INT_IIM (NR_IRQS_LEGACY + 69)
303#define MX53_INT_ATA (NR_IRQS_LEGACY + 70)
304#define MX53_INT_CCM1 (NR_IRQS_LEGACY + 71)
305#define MX53_INT_CCM2 (NR_IRQS_LEGACY + 72)
306#define MX53_INT_GPC1 (NR_IRQS_LEGACY + 73)
307#define MX53_INT_GPC2 (NR_IRQS_LEGACY + 74)
308#define MX53_INT_SRC (NR_IRQS_LEGACY + 75)
309#define MX53_INT_NM (NR_IRQS_LEGACY + 76)
310#define MX53_INT_PMU (NR_IRQS_LEGACY + 77)
311#define MX53_INT_CTI_IRQ (NR_IRQS_LEGACY + 78)
312#define MX53_INT_CTI1_TG0 (NR_IRQS_LEGACY + 79)
313#define MX53_INT_CTI1_TG1 (NR_IRQS_LEGACY + 80)
314#define MX53_INT_ESAI (NR_IRQS_LEGACY + 81)
315#define MX53_INT_CAN1 (NR_IRQS_LEGACY + 82)
316#define MX53_INT_CAN2 (NR_IRQS_LEGACY + 83)
317#define MX53_INT_GPU2_IRQ (NR_IRQS_LEGACY + 84)
318#define MX53_INT_GPU2_BUSY (NR_IRQS_LEGACY + 85)
319#define MX53_INT_UART5 (NR_IRQS_LEGACY + 86)
320#define MX53_INT_FEC (NR_IRQS_LEGACY + 87)
321#define MX53_INT_OWIRE (NR_IRQS_LEGACY + 88)
322#define MX53_INT_CTI1_TG2 (NR_IRQS_LEGACY + 89)
323#define MX53_INT_SJC (NR_IRQS_LEGACY + 90)
324#define MX53_INT_TVE (NR_IRQS_LEGACY + 92)
325#define MX53_INT_FIRI (NR_IRQS_LEGACY + 93)
326#define MX53_INT_PWM2 (NR_IRQS_LEGACY + 94)
327#define MX53_INT_SLIM_EXP (NR_IRQS_LEGACY + 95)
328#define MX53_INT_SSI3 (NR_IRQS_LEGACY + 96)
329#define MX53_INT_EMI_BOOT (NR_IRQS_LEGACY + 97)
330#define MX53_INT_CTI1_TG3 (NR_IRQS_LEGACY + 98)
331#define MX53_INT_SMC_RX (NR_IRQS_LEGACY + 99)
332#define MX53_INT_VPU_IDLE (NR_IRQS_LEGACY + 100)
333#define MX53_INT_EMI_NFC (NR_IRQS_LEGACY + 101)
334#define MX53_INT_GPU_IDLE (NR_IRQS_LEGACY + 102)
335#define MX53_INT_GPIO5_LOW (NR_IRQS_LEGACY + 103)
336#define MX53_INT_GPIO5_HIGH (NR_IRQS_LEGACY + 104)
337#define MX53_INT_GPIO6_LOW (NR_IRQS_LEGACY + 105)
338#define MX53_INT_GPIO6_HIGH (NR_IRQS_LEGACY + 106)
339#define MX53_INT_GPIO7_LOW (NR_IRQS_LEGACY + 107)
340#define MX53_INT_GPIO7_HIGH (NR_IRQS_LEGACY + 108)
341
342#endif /* ifndef __MACH_MX53_H__ */
diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h
index 75d6a37e1ae4..a39b69ef4301 100644
--- a/arch/arm/mach-imx/mxc.h
+++ b/arch/arm/mach-imx/mxc.h
@@ -154,10 +154,17 @@ extern unsigned int __mxc_cpu_type;
154#endif 154#endif
155 155
156#ifndef __ASSEMBLY__ 156#ifndef __ASSEMBLY__
157#ifdef CONFIG_SOC_IMX6SL
157static inline bool cpu_is_imx6sl(void) 158static inline bool cpu_is_imx6sl(void)
158{ 159{
159 return __mxc_cpu_type == MXC_CPU_IMX6SL; 160 return __mxc_cpu_type == MXC_CPU_IMX6SL;
160} 161}
162#else
163static inline bool cpu_is_imx6sl(void)
164{
165 return false;
166}
167#endif
161 168
162static inline bool cpu_is_imx6dl(void) 169static inline bool cpu_is_imx6dl(void)
163{ 170{
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 58aeaf5baaf6..f1f80ab73e69 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -19,9 +19,26 @@
19 19
20#include "common.h" 20#include "common.h"
21#include "cpuidle.h" 21#include "cpuidle.h"
22#include "crm-regs-imx5.h"
23#include "hardware.h" 22#include "hardware.h"
24 23
24#define MXC_CCM_CLPCR 0x54
25#define MXC_CCM_CLPCR_LPM_OFFSET 0
26#define MXC_CCM_CLPCR_LPM_MASK 0x3
27#define MXC_CCM_CLPCR_STBY_COUNT_OFFSET 9
28#define MXC_CCM_CLPCR_VSTBY (0x1 << 8)
29#define MXC_CCM_CLPCR_SBYOS (0x1 << 6)
30
31#define MXC_CORTEXA8_PLAT_LPC 0xc
32#define MXC_CORTEXA8_PLAT_LPC_DSM (1 << 0)
33#define MXC_CORTEXA8_PLAT_LPC_DBG_DSM (1 << 1)
34
35#define MXC_SRPG_NEON_SRPGCR 0x280
36#define MXC_SRPG_ARM_SRPGCR 0x2a0
37#define MXC_SRPG_EMPGC0_SRPGCR 0x2c0
38#define MXC_SRPG_EMPGC1_SRPGCR 0x2d0
39
40#define MXC_SRPGCR_PCR 1
41
25/* 42/*
26 * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit. 43 * The WAIT_UNCLOCKED_POWER_OFF state only requires <= 500ns to exit.
27 * This is also the lowest power state possible without affecting 44 * This is also the lowest power state possible without affecting
@@ -32,6 +49,30 @@
32 */ 49 */
33#define IMX5_DEFAULT_CPU_IDLE_STATE WAIT_UNCLOCKED_POWER_OFF 50#define IMX5_DEFAULT_CPU_IDLE_STATE WAIT_UNCLOCKED_POWER_OFF
34 51
52struct imx5_pm_data {
53 phys_addr_t cortex_addr;
54 phys_addr_t gpc_addr;
55};
56
57static const struct imx5_pm_data imx51_pm_data __initconst = {
58 .cortex_addr = 0x83fa0000,
59 .gpc_addr = 0x73fd8000,
60};
61
62static const struct imx5_pm_data imx53_pm_data __initconst = {
63 .cortex_addr = 0x63fa0000,
64 .gpc_addr = 0x53fd8000,
65};
66
67static void __iomem *ccm_base;
68static void __iomem *cortex_base;
69static void __iomem *gpc_base;
70
71void __init imx5_pm_set_ccm_base(void __iomem *base)
72{
73 ccm_base = base;
74}
75
35/* 76/*
36 * set cpu low power mode before WFI instruction. This function is called 77 * set cpu low power mode before WFI instruction. This function is called
37 * mx5 because it can be used for mx51, and mx53. 78 * mx5 because it can be used for mx51, and mx53.
@@ -43,12 +84,16 @@ static void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)
43 int stop_mode = 0; 84 int stop_mode = 0;
44 85
45 /* always allow platform to issue a deep sleep mode request */ 86 /* always allow platform to issue a deep sleep mode request */
46 plat_lpc = __raw_readl(MXC_CORTEXA8_PLAT_LPC) & 87 plat_lpc = __raw_readl(cortex_base + MXC_CORTEXA8_PLAT_LPC) &
47 ~(MXC_CORTEXA8_PLAT_LPC_DSM); 88 ~(MXC_CORTEXA8_PLAT_LPC_DSM);
48 ccm_clpcr = __raw_readl(MXC_CCM_CLPCR) & ~(MXC_CCM_CLPCR_LPM_MASK); 89 ccm_clpcr = __raw_readl(ccm_base + MXC_CCM_CLPCR) &
49 arm_srpgcr = __raw_readl(MXC_SRPG_ARM_SRPGCR) & ~(MXC_SRPGCR_PCR); 90 ~(MXC_CCM_CLPCR_LPM_MASK);
50 empgc0 = __raw_readl(MXC_SRPG_EMPGC0_SRPGCR) & ~(MXC_SRPGCR_PCR); 91 arm_srpgcr = __raw_readl(gpc_base + MXC_SRPG_ARM_SRPGCR) &
51 empgc1 = __raw_readl(MXC_SRPG_EMPGC1_SRPGCR) & ~(MXC_SRPGCR_PCR); 92 ~(MXC_SRPGCR_PCR);
93 empgc0 = __raw_readl(gpc_base + MXC_SRPG_EMPGC0_SRPGCR) &
94 ~(MXC_SRPGCR_PCR);
95 empgc1 = __raw_readl(gpc_base + MXC_SRPG_EMPGC1_SRPGCR) &
96 ~(MXC_SRPGCR_PCR);
52 97
53 switch (mode) { 98 switch (mode) {
54 case WAIT_CLOCKED: 99 case WAIT_CLOCKED:
@@ -82,17 +127,17 @@ static void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)
82 return; 127 return;
83 } 128 }
84 129
85 __raw_writel(plat_lpc, MXC_CORTEXA8_PLAT_LPC); 130 __raw_writel(plat_lpc, cortex_base + MXC_CORTEXA8_PLAT_LPC);
86 __raw_writel(ccm_clpcr, MXC_CCM_CLPCR); 131 __raw_writel(ccm_clpcr, ccm_base + MXC_CCM_CLPCR);
87 __raw_writel(arm_srpgcr, MXC_SRPG_ARM_SRPGCR); 132 __raw_writel(arm_srpgcr, gpc_base + MXC_SRPG_ARM_SRPGCR);
88 __raw_writel(arm_srpgcr, MXC_SRPG_NEON_SRPGCR); 133 __raw_writel(arm_srpgcr, gpc_base + MXC_SRPG_NEON_SRPGCR);
89 134
90 if (stop_mode) { 135 if (stop_mode) {
91 empgc0 |= MXC_SRPGCR_PCR; 136 empgc0 |= MXC_SRPGCR_PCR;
92 empgc1 |= MXC_SRPGCR_PCR; 137 empgc1 |= MXC_SRPGCR_PCR;
93 138
94 __raw_writel(empgc0, MXC_SRPG_EMPGC0_SRPGCR); 139 __raw_writel(empgc0, gpc_base + MXC_SRPG_EMPGC0_SRPGCR);
95 __raw_writel(empgc1, MXC_SRPG_EMPGC1_SRPGCR); 140 __raw_writel(empgc1, gpc_base + MXC_SRPG_EMPGC1_SRPGCR);
96 } 141 }
97} 142}
98 143
@@ -114,8 +159,8 @@ static int mx5_suspend_enter(suspend_state_t state)
114 flush_cache_all(); 159 flush_cache_all();
115 160
116 /*clear the EMPGC0/1 bits */ 161 /*clear the EMPGC0/1 bits */
117 __raw_writel(0, MXC_SRPG_EMPGC0_SRPGCR); 162 __raw_writel(0, gpc_base + MXC_SRPG_EMPGC0_SRPGCR);
118 __raw_writel(0, MXC_SRPG_EMPGC1_SRPGCR); 163 __raw_writel(0, gpc_base + MXC_SRPG_EMPGC1_SRPGCR);
119 } 164 }
120 cpu_do_idle(); 165 cpu_do_idle();
121 166
@@ -149,7 +194,7 @@ static void imx5_pm_idle(void)
149 imx5_cpu_do_idle(); 194 imx5_cpu_do_idle();
150} 195}
151 196
152static int __init imx5_pm_common_init(void) 197static int __init imx5_pm_common_init(const struct imx5_pm_data *data)
153{ 198{
154 int ret; 199 int ret;
155 struct clk *gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs"); 200 struct clk *gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs");
@@ -163,15 +208,28 @@ static int __init imx5_pm_common_init(void)
163 208
164 arm_pm_idle = imx5_pm_idle; 209 arm_pm_idle = imx5_pm_idle;
165 210
211 cortex_base = ioremap(data->cortex_addr, SZ_16K);
212 gpc_base = ioremap(data->gpc_addr, SZ_16K);
213 WARN_ON(!ccm_base || !cortex_base || !gpc_base);
214
166 /* Set the registers to the default cpu idle state. */ 215 /* Set the registers to the default cpu idle state. */
167 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); 216 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
168 217
169 return imx5_cpuidle_init(); 218 ret = imx5_cpuidle_init();
219 if (ret)
220 pr_warn("%s: cpuidle init failed %d\n", __func__, ret);
221
222 suspend_set_ops(&mx5_suspend_ops);
223
224 return 0;
225}
226
227void __init imx51_pm_init(void)
228{
229 imx5_pm_common_init(&imx51_pm_data);
170} 230}
171 231
172void __init imx5_pm_init(void) 232void __init imx53_pm_init(void)
173{ 233{
174 int ret = imx5_pm_common_init(); 234 imx5_pm_common_init(&imx53_pm_data);
175 if (!ret)
176 suspend_set_ops(&mx5_suspend_ops);
177} 235}
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index 9392a8f4ef24..5c3af8f993d0 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -129,6 +129,14 @@ static const u32 imx6sl_mmdc_io_offset[] __initconst = {
129 0x330, 0x334, 0x320, /* SDCKE0, SDCKE1, RESET */ 129 0x330, 0x334, 0x320, /* SDCKE0, SDCKE1, RESET */
130}; 130};
131 131
132static const u32 imx6sx_mmdc_io_offset[] __initconst = {
133 0x2ec, 0x2f0, 0x2f4, 0x2f8, /* DQM0 ~ DQM3 */
134 0x60c, 0x610, 0x61c, 0x620, /* GPR_B0DS ~ GPR_B3DS */
135 0x300, 0x2fc, 0x32c, 0x5f4, /* CAS, RAS, SDCLK_0, GPR_ADDS */
136 0x310, 0x314, 0x5f8, 0x608, /* SODT0, SODT1, MODE_CTL, MODE */
137 0x330, 0x334, 0x338, 0x33c, /* SDQS0 ~ SDQS3 */
138};
139
132static const struct imx6_pm_socdata imx6q_pm_data __initconst = { 140static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
133 .cpu_type = MXC_CPU_IMX6Q, 141 .cpu_type = MXC_CPU_IMX6Q,
134 .mmdc_compat = "fsl,imx6q-mmdc", 142 .mmdc_compat = "fsl,imx6q-mmdc",
@@ -159,6 +167,16 @@ static const struct imx6_pm_socdata imx6sl_pm_data __initconst = {
159 .mmdc_io_offset = imx6sl_mmdc_io_offset, 167 .mmdc_io_offset = imx6sl_mmdc_io_offset,
160}; 168};
161 169
170static const struct imx6_pm_socdata imx6sx_pm_data __initconst = {
171 .cpu_type = MXC_CPU_IMX6SX,
172 .mmdc_compat = "fsl,imx6sx-mmdc",
173 .src_compat = "fsl,imx6sx-src",
174 .iomuxc_compat = "fsl,imx6sx-iomuxc",
175 .gpc_compat = "fsl,imx6sx-gpc",
176 .mmdc_io_num = ARRAY_SIZE(imx6sx_mmdc_io_offset),
177 .mmdc_io_offset = imx6sx_mmdc_io_offset,
178};
179
162/* 180/*
163 * This structure is for passing necessary data for low level ocram 181 * This structure is for passing necessary data for low level ocram
164 * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct 182 * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
@@ -181,11 +199,13 @@ struct imx6_cpu_pm_info {
181 u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][2]; /* To save offset and value */ 199 u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][2]; /* To save offset and value */
182} __aligned(8); 200} __aligned(8);
183 201
184void imx6q_set_int_mem_clk_lpm(void) 202void imx6q_set_int_mem_clk_lpm(bool enable)
185{ 203{
186 u32 val = readl_relaxed(ccm_base + CGPR); 204 u32 val = readl_relaxed(ccm_base + CGPR);
187 205
188 val |= BM_CGPR_INT_MEM_CLK_LPM; 206 val &= ~BM_CGPR_INT_MEM_CLK_LPM;
207 if (enable)
208 val |= BM_CGPR_INT_MEM_CLK_LPM;
189 writel_relaxed(val, ccm_base + CGPR); 209 writel_relaxed(val, ccm_base + CGPR);
190} 210}
191 211
@@ -254,6 +274,14 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
254 break; 274 break;
255 case STOP_POWER_ON: 275 case STOP_POWER_ON:
256 val |= 0x2 << BP_CLPCR_LPM; 276 val |= 0x2 << BP_CLPCR_LPM;
277 val &= ~BM_CLPCR_VSTBY;
278 val &= ~BM_CLPCR_SBYOS;
279 if (cpu_is_imx6sl())
280 val |= BM_CLPCR_BYPASS_PMIC_READY;
281 if (cpu_is_imx6sl() || cpu_is_imx6sx())
282 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
283 else
284 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
257 break; 285 break;
258 case WAIT_UNCLOCKED_POWER_OFF: 286 case WAIT_UNCLOCKED_POWER_OFF:
259 val |= 0x1 << BP_CLPCR_LPM; 287 val |= 0x1 << BP_CLPCR_LPM;
@@ -265,12 +293,12 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
265 val |= 0x3 << BP_CLPCR_STBY_COUNT; 293 val |= 0x3 << BP_CLPCR_STBY_COUNT;
266 val |= BM_CLPCR_VSTBY; 294 val |= BM_CLPCR_VSTBY;
267 val |= BM_CLPCR_SBYOS; 295 val |= BM_CLPCR_SBYOS;
268 if (cpu_is_imx6sl()) { 296 if (cpu_is_imx6sl())
269 val |= BM_CLPCR_BYPASS_PMIC_READY; 297 val |= BM_CLPCR_BYPASS_PMIC_READY;
298 if (cpu_is_imx6sl() || cpu_is_imx6sx())
270 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; 299 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
271 } else { 300 else
272 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; 301 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
273 }
274 break; 302 break;
275 default: 303 default:
276 return -EINVAL; 304 return -EINVAL;
@@ -314,8 +342,22 @@ static int imx6q_suspend_finish(unsigned long val)
314static int imx6q_pm_enter(suspend_state_t state) 342static int imx6q_pm_enter(suspend_state_t state)
315{ 343{
316 switch (state) { 344 switch (state) {
345 case PM_SUSPEND_STANDBY:
346 imx6q_set_lpm(STOP_POWER_ON);
347 imx6q_set_int_mem_clk_lpm(true);
348 imx_gpc_pre_suspend(false);
349 if (cpu_is_imx6sl())
350 imx6sl_set_wait_clk(true);
351 /* Zzz ... */
352 cpu_do_idle();
353 if (cpu_is_imx6sl())
354 imx6sl_set_wait_clk(false);
355 imx_gpc_post_resume();
356 imx6q_set_lpm(WAIT_CLOCKED);
357 break;
317 case PM_SUSPEND_MEM: 358 case PM_SUSPEND_MEM:
318 imx6q_set_lpm(STOP_POWER_OFF); 359 imx6q_set_lpm(STOP_POWER_OFF);
360 imx6q_set_int_mem_clk_lpm(false);
319 imx6q_enable_wb(true); 361 imx6q_enable_wb(true);
320 /* 362 /*
321 * For suspend into ocram, asm code already take care of 363 * For suspend into ocram, asm code already take care of
@@ -323,7 +365,7 @@ static int imx6q_pm_enter(suspend_state_t state)
323 */ 365 */
324 if (!imx6_suspend_in_ocram_fn) 366 if (!imx6_suspend_in_ocram_fn)
325 imx6q_enable_rbc(true); 367 imx6q_enable_rbc(true);
326 imx_gpc_pre_suspend(); 368 imx_gpc_pre_suspend(true);
327 imx_anatop_pre_suspend(); 369 imx_anatop_pre_suspend();
328 imx_set_cpu_jump(0, v7_cpu_resume); 370 imx_set_cpu_jump(0, v7_cpu_resume);
329 /* Zzz ... */ 371 /* Zzz ... */
@@ -334,6 +376,7 @@ static int imx6q_pm_enter(suspend_state_t state)
334 imx_gpc_post_resume(); 376 imx_gpc_post_resume();
335 imx6q_enable_rbc(false); 377 imx6q_enable_rbc(false);
336 imx6q_enable_wb(false); 378 imx6q_enable_wb(false);
379 imx6q_set_int_mem_clk_lpm(true);
337 imx6q_set_lpm(WAIT_CLOCKED); 380 imx6q_set_lpm(WAIT_CLOCKED);
338 break; 381 break;
339 default: 382 default:
@@ -343,9 +386,14 @@ static int imx6q_pm_enter(suspend_state_t state)
343 return 0; 386 return 0;
344} 387}
345 388
389static int imx6q_pm_valid(suspend_state_t state)
390{
391 return (state == PM_SUSPEND_STANDBY || state == PM_SUSPEND_MEM);
392}
393
346static const struct platform_suspend_ops imx6q_pm_ops = { 394static const struct platform_suspend_ops imx6q_pm_ops = {
347 .enter = imx6q_pm_enter, 395 .enter = imx6q_pm_enter,
348 .valid = suspend_valid_only_mem, 396 .valid = imx6q_pm_valid,
349}; 397};
350 398
351void __init imx6q_pm_set_ccm_base(void __iomem *base) 399void __init imx6q_pm_set_ccm_base(void __iomem *base)
@@ -549,3 +597,8 @@ void __init imx6sl_pm_init(void)
549{ 597{
550 imx6_pm_common_init(&imx6sl_pm_data); 598 imx6_pm_common_init(&imx6sl_pm_data);
551} 599}
600
601void __init imx6sx_pm_init(void)
602{
603 imx6_pm_common_init(&imx6sx_pm_data);
604}
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
index fe123b079c05..74b50f1982db 100644
--- a/arch/arm/mach-imx/suspend-imx6.S
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h>
13#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
14#include <asm/hardware/cache-l2x0.h> 15#include <asm/hardware/cache-l2x0.h>
15#include "hardware.h" 16#include "hardware.h"
@@ -301,7 +302,7 @@ rbc_loop:
301 resume_mmdc 302 resume_mmdc
302 303
303 /* return to suspend finish */ 304 /* return to suspend finish */
304 mov pc, lr 305 ret lr
305 306
306resume: 307resume:
307 /* invalidate L1 I-cache first */ 308 /* invalidate L1 I-cache first */
@@ -325,7 +326,7 @@ resume:
325 mov r5, #0x1 326 mov r5, #0x1
326 resume_mmdc 327 resume_mmdc
327 328
328 mov pc, lr 329 ret lr
329ENDPROC(imx6_suspend) 330ENDPROC(imx6_suspend)
330 331
331/* 332/*
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 3b0733edb68c..d14c33fd6b03 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -42,7 +42,10 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
42{ 42{
43 unsigned int wcr_enable; 43 unsigned int wcr_enable;
44 44
45 if (wdog_clk) 45 if (!wdog_base)
46 goto reset_fallback;
47
48 if (!IS_ERR(wdog_clk))
46 clk_enable(wdog_clk); 49 clk_enable(wdog_clk);
47 50
48 if (cpu_is_mx1()) 51 if (cpu_is_mx1())
@@ -70,6 +73,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
70 /* delay to allow the serial port to show the message */ 73 /* delay to allow the serial port to show the message */
71 mdelay(50); 74 mdelay(50);
72 75
76reset_fallback:
73 /* we'll take a jump through zero as a poor second */ 77 /* we'll take a jump through zero as a poor second */
74 soft_restart(0); 78 soft_restart(0);
75} 79}
@@ -79,13 +83,10 @@ void __init mxc_arch_reset_init(void __iomem *base)
79 wdog_base = base; 83 wdog_base = base;
80 84
81 wdog_clk = clk_get_sys("imx2-wdt.0", NULL); 85 wdog_clk = clk_get_sys("imx2-wdt.0", NULL);
82 if (IS_ERR(wdog_clk)) { 86 if (IS_ERR(wdog_clk))
83 pr_warn("%s: failed to get wdog clock\n", __func__); 87 pr_warn("%s: failed to get wdog clock\n", __func__);
84 wdog_clk = NULL; 88 else
85 return; 89 clk_prepare(wdog_clk);
86 }
87
88 clk_prepare(wdog_clk);
89} 90}
90 91
91void __init mxc_arch_reset_init_dt(void) 92void __init mxc_arch_reset_init_dt(void)
@@ -97,13 +98,10 @@ void __init mxc_arch_reset_init_dt(void)
97 WARN_ON(!wdog_base); 98 WARN_ON(!wdog_base);
98 99
99 wdog_clk = of_clk_get(np, 0); 100 wdog_clk = of_clk_get(np, 0);
100 if (IS_ERR(wdog_clk)) { 101 if (IS_ERR(wdog_clk))
101 pr_warn("%s: failed to get wdog clock\n", __func__); 102 pr_warn("%s: failed to get wdog clock\n", __func__);
102 wdog_clk = NULL; 103 else
103 return; 104 clk_prepare(wdog_clk);
104 }
105
106 clk_prepare(wdog_clk);
107} 105}
108 106
109#ifdef CONFIG_CACHE_L2X0 107#ifdef CONFIG_CACHE_L2X0
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index bed081e58262..bf92e5a351c0 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -290,25 +290,20 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
290 return 0; 290 return 0;
291} 291}
292 292
293void __init mxc_timer_init(void __iomem *base, int irq) 293static void __init _mxc_timer_init(int irq,
294 struct clk *clk_per, struct clk *clk_ipg)
294{ 295{
295 uint32_t tctl_val; 296 uint32_t tctl_val;
296 struct clk *timer_clk;
297 struct clk *timer_ipg_clk;
298 297
299 timer_clk = clk_get_sys("imx-gpt.0", "per"); 298 if (IS_ERR(clk_per)) {
300 if (IS_ERR(timer_clk)) {
301 pr_err("i.MX timer: unable to get clk\n"); 299 pr_err("i.MX timer: unable to get clk\n");
302 return; 300 return;
303 } 301 }
304 302
305 timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg"); 303 if (!IS_ERR(clk_ipg))
306 if (!IS_ERR(timer_ipg_clk)) 304 clk_prepare_enable(clk_ipg);
307 clk_prepare_enable(timer_ipg_clk);
308
309 clk_prepare_enable(timer_clk);
310 305
311 timer_base = base; 306 clk_prepare_enable(clk_per);
312 307
313 /* 308 /*
314 * Initialise to a known state (all timers off, and timing reset) 309 * Initialise to a known state (all timers off, and timing reset)
@@ -325,21 +320,45 @@ void __init mxc_timer_init(void __iomem *base, int irq)
325 __raw_writel(tctl_val, timer_base + MXC_TCTL); 320 __raw_writel(tctl_val, timer_base + MXC_TCTL);
326 321
327 /* init and register the timer to the framework */ 322 /* init and register the timer to the framework */
328 mxc_clocksource_init(timer_clk); 323 mxc_clocksource_init(clk_per);
329 mxc_clockevent_init(timer_clk); 324 mxc_clockevent_init(clk_per);
330 325
331 /* Make irqs happen */ 326 /* Make irqs happen */
332 setup_irq(irq, &mxc_timer_irq); 327 setup_irq(irq, &mxc_timer_irq);
333} 328}
334 329
335void __init mxc_timer_init_dt(struct device_node *np) 330void __init mxc_timer_init(void __iomem *base, int irq)
336{ 331{
337 void __iomem *base; 332 struct clk *clk_per = clk_get_sys("imx-gpt.0", "per");
333 struct clk *clk_ipg = clk_get_sys("imx-gpt.0", "ipg");
334
335 timer_base = base;
336
337 _mxc_timer_init(irq, clk_per, clk_ipg);
338}
339
340static void __init mxc_timer_init_dt(struct device_node *np)
341{
342 struct clk *clk_per, *clk_ipg;
338 int irq; 343 int irq;
339 344
340 base = of_iomap(np, 0); 345 if (timer_base)
341 WARN_ON(!base); 346 return;
347
348 timer_base = of_iomap(np, 0);
349 WARN_ON(!timer_base);
342 irq = irq_of_parse_and_map(np, 0); 350 irq = irq_of_parse_and_map(np, 0);
343 351
344 mxc_timer_init(base, irq); 352 clk_per = of_clk_get_by_name(np, "per");
353 clk_ipg = of_clk_get_by_name(np, "ipg");
354
355 _mxc_timer_init(irq, clk_per, clk_ipg);
345} 356}
357CLOCKSOURCE_OF_DECLARE(mx1_timer, "fsl,imx1-gpt", mxc_timer_init_dt);
358CLOCKSOURCE_OF_DECLARE(mx25_timer, "fsl,imx25-gpt", mxc_timer_init_dt);
359CLOCKSOURCE_OF_DECLARE(mx50_timer, "fsl,imx50-gpt", mxc_timer_init_dt);
360CLOCKSOURCE_OF_DECLARE(mx51_timer, "fsl,imx51-gpt", mxc_timer_init_dt);
361CLOCKSOURCE_OF_DECLARE(mx53_timer, "fsl,imx53-gpt", mxc_timer_init_dt);
362CLOCKSOURCE_OF_DECLARE(mx6q_timer, "fsl,imx6q-gpt", mxc_timer_init_dt);
363CLOCKSOURCE_OF_DECLARE(mx6sl_timer, "fsl,imx6sl-gpt", mxc_timer_init_dt);
364CLOCKSOURCE_OF_DECLARE(mx6sx_timer, "fsl,imx6sx-gpt", mxc_timer_init_dt);
diff --git a/arch/arm/mach-imx/tzic.c b/arch/arm/mach-imx/tzic.c
index 7828af4b2022..1d4f384ca773 100644
--- a/arch/arm/mach-imx/tzic.c
+++ b/arch/arm/mach-imx/tzic.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irqdomain.h> 18#include <linux/irqdomain.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_address.h>
20 21
21#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
22#include <asm/exception.h> 23#include <asm/exception.h>
@@ -153,13 +154,16 @@ static void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs)
153 * interrupts. It registers the interrupt enable and disable functions 154 * interrupts. It registers the interrupt enable and disable functions
154 * to the kernel for each interrupt source. 155 * to the kernel for each interrupt source.
155 */ 156 */
156void __init tzic_init_irq(void __iomem *irqbase) 157void __init tzic_init_irq(void)
157{ 158{
158 struct device_node *np; 159 struct device_node *np;
159 int irq_base; 160 int irq_base;
160 int i; 161 int i;
161 162
162 tzic_base = irqbase; 163 np = of_find_compatible_node(NULL, NULL, "fsl,tzic");
164 tzic_base = of_iomap(np, 0);
165 WARN_ON(!tzic_base);
166
163 /* put the TZIC into the reset value with 167 /* put the TZIC into the reset value with
164 * all interrupts disabled 168 * all interrupts disabled
165 */ 169 */
@@ -181,7 +185,6 @@ void __init tzic_init_irq(void __iomem *irqbase)
181 irq_base = irq_alloc_descs(-1, 0, TZIC_NUM_IRQS, numa_node_id()); 185 irq_base = irq_alloc_descs(-1, 0, TZIC_NUM_IRQS, numa_node_id());
182 WARN_ON(irq_base < 0); 186 WARN_ON(irq_base < 0);
183 187
184 np = of_find_compatible_node(NULL, NULL, "fsl,tzic");
185 domain = irq_domain_add_legacy(np, TZIC_NUM_IRQS, irq_base, 0, 188 domain = irq_domain_add_legacy(np, TZIC_NUM_IRQS, irq_base, 0,
186 &irq_domain_simple_ops, NULL); 189 &irq_domain_simple_ops, NULL);
187 WARN_ON(!domain); 190 WARN_ON(!domain);
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index 64f8e2564a37..c455e974bbfe 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -17,7 +17,6 @@ config ARCH_INTEGRATOR_CP
17 bool "Support Integrator/CP platform" 17 bool "Support Integrator/CP platform"
18 select ARCH_CINTEGRATOR 18 select ARCH_CINTEGRATOR
19 select ARM_TIMER_SP804 19 select ARM_TIMER_SP804
20 select PLAT_VERSATILE_CLCD
21 select SERIAL_AMBA_PL011 if TTY 20 select SERIAL_AMBA_PL011 if TTY
22 select SERIAL_AMBA_PL011_CONSOLE if TTY 21 select SERIAL_AMBA_PL011_CONSOLE if TTY
23 select SOC_BUS 22 select SOC_BUS
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
deleted file mode 100644
index 334d5e271889..000000000000
--- a/arch/arm/mach-integrator/include/mach/memory.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/memory.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PLAT_PHYS_OFFSET UL(0x00000000)
27
28#define BUS_OFFSET UL(0x80000000)
29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET)
30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET)
31#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - PHYS_OFFSET))
32#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - PHYS_OFFSET))
33
34#endif
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 660ca6feff40..8ca290b479b1 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -31,7 +31,7 @@
31#include <linux/clockchips.h> 31#include <linux/clockchips.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/irqchip/versatile-fpga.h> 34#include <linux/irqchip.h>
35#include <linux/mtd/physmap.h> 35#include <linux/mtd/physmap.h>
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/platform_data/clk-integrator.h> 37#include <linux/platform_data/clk-integrator.h>
@@ -439,15 +439,10 @@ static void __init ap_of_timer_init(void)
439 integrator_clockevent_init(rate, base, irq); 439 integrator_clockevent_init(rate, base, irq);
440} 440}
441 441
442static const struct of_device_id fpga_irq_of_match[] __initconst = {
443 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
444 { /* Sentinel */ }
445};
446
447static void __init ap_init_irq_of(void) 442static void __init ap_init_irq_of(void)
448{ 443{
449 cm_init(); 444 cm_init();
450 of_irq_init(fpga_irq_of_match); 445 irqchip_init();
451} 446}
452 447
453/* For the Device Tree, add in the UART callbacks as AUXDATA */ 448/* For the Device Tree, add in the UART callbacks as AUXDATA */
@@ -558,7 +553,6 @@ DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
558 .map_io = ap_map_io, 553 .map_io = ap_map_io,
559 .init_early = ap_init_early, 554 .init_early = ap_init_early,
560 .init_irq = ap_init_irq_of, 555 .init_irq = ap_init_irq_of,
561 .handle_irq = fpga_handle_irq,
562 .init_time = ap_of_timer_init, 556 .init_time = ap_of_timer_init,
563 .init_machine = ap_init_of, 557 .init_machine = ap_init_of,
564 .restart = integrator_restart, 558 .restart = integrator_restart,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 0e57f8f820a5..cca02eb75eb5 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -18,9 +18,10 @@
18#include <linux/amba/bus.h> 18#include <linux/amba/bus.h>
19#include <linux/amba/kmi.h> 19#include <linux/amba/kmi.h>
20#include <linux/amba/clcd.h> 20#include <linux/amba/clcd.h>
21#include <linux/platform_data/video-clcd-versatile.h>
21#include <linux/amba/mmci.h> 22#include <linux/amba/mmci.h>
22#include <linux/io.h> 23#include <linux/io.h>
23#include <linux/irqchip/versatile-fpga.h> 24#include <linux/irqchip.h>
24#include <linux/gfp.h> 25#include <linux/gfp.h>
25#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
26#include <linux/of_irq.h> 27#include <linux/of_irq.h>
@@ -36,8 +37,6 @@
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
38 39
39#include <plat/clcd.h>
40
41#include "hardware.h" 40#include "hardware.h"
42#include "cm.h" 41#include "cm.h"
43#include "common.h" 42#include "common.h"
@@ -235,15 +234,10 @@ static void __init intcp_init_early(void)
235 sched_clock_register(intcp_read_sched_clock, 32, 24000000); 234 sched_clock_register(intcp_read_sched_clock, 32, 24000000);
236} 235}
237 236
238static const struct of_device_id fpga_irq_of_match[] __initconst = {
239 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
240 { /* Sentinel */ }
241};
242
243static void __init intcp_init_irq_of(void) 237static void __init intcp_init_irq_of(void)
244{ 238{
245 cm_init(); 239 cm_init();
246 of_irq_init(fpga_irq_of_match); 240 irqchip_init();
247} 241}
248 242
249/* 243/*
@@ -329,7 +323,6 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
329 .map_io = intcp_map_io, 323 .map_io = intcp_map_io,
330 .init_early = intcp_init_early, 324 .init_early = intcp_init_early,
331 .init_irq = intcp_init_irq_of, 325 .init_irq = intcp_init_irq_of,
332 .handle_irq = fpga_handle_irq,
333 .init_machine = intcp_init_of, 326 .init_machine = intcp_init_of,
334 .restart = integrator_restart, 327 .restart = integrator_restart,
335 .dt_compat = intcp_dt_board_compat, 328 .dt_compat = intcp_dt_board_compat,
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index 17b40279e0a4..9311ee2126d6 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -3,7 +3,7 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#include <linux/reboot.h> 6enum reboot_mode;
7 7
8/* The ATU offsets can change based on the strapping */ 8/* The ATU offsets can change based on the strapping */
9extern u32 iop13xx_atux_pmmr_offset; 9extern u32 iop13xx_atux_pmmr_offset;
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index 7c032d0ab24a..59307e787588 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -3,11 +3,6 @@
3 3
4#include <mach/hardware.h> 4#include <mach/hardware.h>
5 5
6/*
7 * Physical DRAM offset.
8 */
9#define PLAT_PHYS_OFFSET UL(0x00000000)
10
11#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
12 7
13#if defined(CONFIG_ARCH_IOP13XX) 8#if defined(CONFIG_ARCH_IOP13XX)
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index bca96f433495..53c316f7301e 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -20,6 +20,7 @@
20#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
21#include <linux/serial_8250.h> 21#include <linux/serial_8250.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/reboot.h>
23#ifdef CONFIG_MTD_PHYSMAP 24#ifdef CONFIG_MTD_PHYSMAP
24#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
25#endif 26#endif
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
deleted file mode 100644
index df4b26340ae4..000000000000
--- a/arch/arm/mach-kirkwood/Kconfig
+++ /dev/null
@@ -1,111 +0,0 @@
1if ARCH_KIRKWOOD
2
3menu "Marvell Kirkwood Implementations"
4
5config KIRKWOOD_LEGACY
6 bool
7
8config MACH_D2NET_V2
9 bool "LaCie d2 Network v2 NAS Board"
10 select KIRKWOOD_LEGACY
11 help
12 Say 'Y' here if you want your kernel to support the
13 LaCie d2 Network v2 NAS.
14
15config MACH_NET2BIG_V2
16 bool "LaCie 2Big Network v2 NAS Board"
17 select KIRKWOOD_LEGACY
18 help
19 Say 'Y' here if you want your kernel to support the
20 LaCie 2Big Network v2 NAS.
21
22config MACH_NET5BIG_V2
23 bool "LaCie 5Big Network v2 NAS Board"
24 select KIRKWOOD_LEGACY
25 help
26 Say 'Y' here if you want your kernel to support the
27 LaCie 5Big Network v2 NAS.
28
29config MACH_OPENRD
30 select KIRKWOOD_LEGACY
31 bool
32
33config MACH_OPENRD_BASE
34 bool "Marvell OpenRD Base Board"
35 select MACH_OPENRD
36 help
37 Say 'Y' here if you want your kernel to support the
38 Marvell OpenRD Base Board.
39
40config MACH_OPENRD_CLIENT
41 bool "Marvell OpenRD Client Board"
42 select MACH_OPENRD
43 help
44 Say 'Y' here if you want your kernel to support the
45 Marvell OpenRD Client Board.
46
47config MACH_OPENRD_ULTIMATE
48 bool "Marvell OpenRD Ultimate Board"
49 select MACH_OPENRD
50 help
51 Say 'Y' here if you want your kernel to support the
52 Marvell OpenRD Ultimate Board.
53
54config MACH_RD88F6192_NAS
55 bool "Marvell RD-88F6192-NAS Reference Board"
56 select KIRKWOOD_LEGACY
57 help
58 Say 'Y' here if you want your kernel to support the
59 Marvell RD-88F6192-NAS Reference Board.
60
61config MACH_RD88F6281
62 bool "Marvell RD-88F6281 Reference Board"
63 select KIRKWOOD_LEGACY
64 help
65 Say 'Y' here if you want your kernel to support the
66 Marvell RD-88F6281 Reference Board.
67
68config MACH_T5325
69 bool "HP t5325 Thin Client"
70 select KIRKWOOD_LEGACY
71 help
72 Say 'Y' here if you want your kernel to support the
73 HP t5325 Thin Client.
74
75config MACH_TS219
76 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
77 select KIRKWOOD_LEGACY
78 help
79 Say 'Y' here if you want your kernel to support the
80 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
81 TS-219P+ Turbo NAS devices.
82
83config MACH_TS41X
84 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
85 select KIRKWOOD_LEGACY
86 help
87 Say 'Y' here if you want your kernel to support the
88 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
89 NAS devices.
90
91comment "Device tree entries"
92
93config ARCH_KIRKWOOD_DT
94 bool "Marvell Kirkwood Flattened Device Tree"
95 select KIRKWOOD_CLK
96 select OF_IRQ
97 select ORION_IRQCHIP
98 select ORION_TIMER
99 select POWER_SUPPLY
100 select POWER_RESET
101 select POWER_RESET_GPIO
102 select REGULATOR
103 select REGULATOR_FIXED_VOLTAGE
104 select USE_OF
105 help
106 Say 'Y' here if you want your kernel to support the
107 Marvell Kirkwood using flattened device tree.
108
109endmenu
110
111endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
deleted file mode 100644
index 3a72c5c6e747..000000000000
--- a/arch/arm/mach-kirkwood/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
1obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o common.o pcie.o
2obj-$(CONFIG_PM) += pm.o
3
4obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
5obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
6obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
7obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
8obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o
9obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
10obj-$(CONFIG_MACH_T5325) += t5325-setup.o
11obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
13
14obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
deleted file mode 100644
index 760a0efe7580..000000000000
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
deleted file mode 100644
index ff18ff20f71f..000000000000
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dt.c
5 *
6 * Flattened Device Tree board initialization
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/clk.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/of.h>
17#include <linux/of_address.h>
18#include <linux/of_net.h>
19#include <linux/of_platform.h>
20#include <linux/dma-mapping.h>
21#include <linux/irqchip.h>
22#include <asm/hardware/cache-feroceon-l2.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <mach/bridge-regs.h>
26#include <plat/common.h>
27#include <plat/pcie.h>
28#include "pm.h"
29
30static struct map_desc kirkwood_io_desc[] __initdata = {
31 {
32 .virtual = (unsigned long) KIRKWOOD_REGS_VIRT_BASE,
33 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
34 .length = KIRKWOOD_REGS_SIZE,
35 .type = MT_DEVICE,
36 },
37};
38
39static void __init kirkwood_map_io(void)
40{
41 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
42}
43
44static struct resource kirkwood_cpufreq_resources[] = {
45 [0] = {
46 .start = CPU_CONTROL_PHYS,
47 .end = CPU_CONTROL_PHYS + 3,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
52static struct platform_device kirkwood_cpufreq_device = {
53 .name = "kirkwood-cpufreq",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
56 .resource = kirkwood_cpufreq_resources,
57};
58
59static void __init kirkwood_cpufreq_init(void)
60{
61 platform_device_register(&kirkwood_cpufreq_device);
62}
63
64static struct resource kirkwood_cpuidle_resource[] = {
65 {
66 .flags = IORESOURCE_MEM,
67 .start = DDR_OPERATION_BASE,
68 .end = DDR_OPERATION_BASE + 3,
69 },
70};
71
72static struct platform_device kirkwood_cpuidle = {
73 .name = "kirkwood_cpuidle",
74 .id = -1,
75 .resource = kirkwood_cpuidle_resource,
76 .num_resources = 1,
77};
78
79static void __init kirkwood_cpuidle_init(void)
80{
81 platform_device_register(&kirkwood_cpuidle);
82}
83
84/* Temporary here since mach-mvebu has a function we can use */
85static void kirkwood_restart(enum reboot_mode mode, const char *cmd)
86{
87 /*
88 * Enable soft reset to assert RSTOUTn.
89 */
90 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
91
92 /*
93 * Assert soft reset.
94 */
95 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
96
97 while (1)
98 ;
99}
100
101#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
102#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
103
104static void __init kirkwood_dt_eth_fixup(void)
105{
106 struct device_node *np;
107
108 /*
109 * The ethernet interfaces forget the MAC address assigned by u-boot
110 * if the clocks are turned off. Usually, u-boot on kirkwood boards
111 * has no DT support to properly set local-mac-address property.
112 * As a workaround, we get the MAC address from mv643xx_eth registers
113 * and update the port device node if no valid MAC address is set.
114 */
115 for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
116 struct device_node *pnp = of_get_parent(np);
117 struct clk *clk;
118 struct property *pmac;
119 void __iomem *io;
120 u8 *macaddr;
121 u32 reg;
122
123 if (!pnp)
124 continue;
125
126 /* skip disabled nodes or nodes with valid MAC address*/
127 if (!of_device_is_available(pnp) || of_get_mac_address(np))
128 goto eth_fixup_skip;
129
130 clk = of_clk_get(pnp, 0);
131 if (IS_ERR(clk))
132 goto eth_fixup_skip;
133
134 io = of_iomap(pnp, 0);
135 if (!io)
136 goto eth_fixup_no_map;
137
138 /* ensure port clock is not gated to not hang CPU */
139 clk_prepare_enable(clk);
140
141 /* store MAC address register contents in local-mac-address */
142 pr_err(FW_INFO "%s: local-mac-address is not set\n",
143 np->full_name);
144
145 pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
146 if (!pmac)
147 goto eth_fixup_no_mem;
148
149 pmac->value = pmac + 1;
150 pmac->length = 6;
151 pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
152 if (!pmac->name) {
153 kfree(pmac);
154 goto eth_fixup_no_mem;
155 }
156
157 macaddr = pmac->value;
158 reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
159 macaddr[0] = (reg >> 24) & 0xff;
160 macaddr[1] = (reg >> 16) & 0xff;
161 macaddr[2] = (reg >> 8) & 0xff;
162 macaddr[3] = reg & 0xff;
163
164 reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
165 macaddr[4] = (reg >> 8) & 0xff;
166 macaddr[5] = reg & 0xff;
167
168 of_update_property(np, pmac);
169
170eth_fixup_no_mem:
171 iounmap(io);
172 clk_disable_unprepare(clk);
173eth_fixup_no_map:
174 clk_put(clk);
175eth_fixup_skip:
176 of_node_put(pnp);
177 }
178}
179
180/*
181 * Disable propagation of mbus errors to the CPU local bus, as this
182 * causes mbus errors (which can occur for example for PCI aborts) to
183 * throw CPU aborts, which we're not set up to deal with.
184 */
185static void __init kirkwood_disable_mbus_error_propagation(void)
186{
187 void __iomem *cpu_config;
188
189 cpu_config = ioremap(CPU_CONFIG_PHYS, 4);
190 writel(readl(cpu_config) & ~CPU_CONFIG_ERROR_PROP, cpu_config);
191 iounmap(cpu_config);
192}
193
194static void __init kirkwood_dt_init(void)
195{
196 kirkwood_disable_mbus_error_propagation();
197
198 BUG_ON(mvebu_mbus_dt_init(false));
199
200#ifdef CONFIG_CACHE_FEROCEON_L2
201 feroceon_of_init();
202#endif
203 kirkwood_cpufreq_init();
204 kirkwood_cpuidle_init();
205
206 kirkwood_pm_init();
207 kirkwood_dt_eth_fixup();
208
209 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
210}
211
212static const char * const kirkwood_dt_board_compat[] = {
213 "marvell,kirkwood",
214 NULL
215};
216
217DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
218 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
219 .map_io = kirkwood_map_io,
220 .init_machine = kirkwood_dt_init,
221 .restart = kirkwood_restart,
222 .dt_compat = kirkwood_dt_board_compat,
223MACHINE_END
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
deleted file mode 100644
index 255f33a3903c..000000000000
--- a/arch/arm/mach-kirkwood/common.c
+++ /dev/null
@@ -1,746 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/common.c
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/ata_platform.h>
16#include <linux/mtd/nand.h>
17#include <linux/dma-mapping.h>
18#include <linux/clk-provider.h>
19#include <linux/spinlock.h>
20#include <linux/mv643xx_i2c.h>
21#include <linux/timex.h>
22#include <linux/kexec.h>
23#include <linux/reboot.h>
24#include <net/dsa.h>
25#include <asm/page.h>
26#include <asm/mach/map.h>
27#include <asm/mach/time.h>
28#include <asm/hardware/cache-feroceon-l2.h>
29#include <mach/kirkwood.h>
30#include <mach/bridge-regs.h>
31#include <linux/platform_data/asoc-kirkwood.h>
32#include <linux/platform_data/mmc-mvsdio.h>
33#include <linux/platform_data/mtd-orion_nand.h>
34#include <linux/platform_data/usb-ehci-orion.h>
35#include <plat/common.h>
36#include <plat/time.h>
37#include <linux/platform_data/dma-mv_xor.h>
38#include "common.h"
39#include "pm.h"
40
41/* These can go away once Kirkwood uses the mvebu-mbus DT binding */
42#define KIRKWOOD_MBUS_NAND_TARGET 0x01
43#define KIRKWOOD_MBUS_NAND_ATTR 0x2f
44#define KIRKWOOD_MBUS_SRAM_TARGET 0x03
45#define KIRKWOOD_MBUS_SRAM_ATTR 0x01
46
47/*****************************************************************************
48 * I/O Address Mapping
49 ****************************************************************************/
50static struct map_desc kirkwood_io_desc[] __initdata = {
51 {
52 .virtual = (unsigned long) KIRKWOOD_REGS_VIRT_BASE,
53 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
54 .length = KIRKWOOD_REGS_SIZE,
55 .type = MT_DEVICE,
56 },
57};
58
59void __init kirkwood_map_io(void)
60{
61 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
62}
63
64/*****************************************************************************
65 * CLK tree
66 ****************************************************************************/
67
68static void enable_sata0(void)
69{
70 /* Enable PLL and IVREF */
71 writel(readl(SATA0_PHY_MODE_2) | 0xf, SATA0_PHY_MODE_2);
72 /* Enable PHY */
73 writel(readl(SATA0_IF_CTRL) & ~0x200, SATA0_IF_CTRL);
74}
75
76static void disable_sata0(void)
77{
78 /* Disable PLL and IVREF */
79 writel(readl(SATA0_PHY_MODE_2) & ~0xf, SATA0_PHY_MODE_2);
80 /* Disable PHY */
81 writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL);
82}
83
84static void enable_sata1(void)
85{
86 /* Enable PLL and IVREF */
87 writel(readl(SATA1_PHY_MODE_2) | 0xf, SATA1_PHY_MODE_2);
88 /* Enable PHY */
89 writel(readl(SATA1_IF_CTRL) & ~0x200, SATA1_IF_CTRL);
90}
91
92static void disable_sata1(void)
93{
94 /* Disable PLL and IVREF */
95 writel(readl(SATA1_PHY_MODE_2) & ~0xf, SATA1_PHY_MODE_2);
96 /* Disable PHY */
97 writel(readl(SATA1_IF_CTRL) | 0x200, SATA1_IF_CTRL);
98}
99
100static void disable_pcie0(void)
101{
102 writel(readl(PCIE_LINK_CTRL) | 0x10, PCIE_LINK_CTRL);
103 while (1)
104 if (readl(PCIE_STATUS) & 0x1)
105 break;
106 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL);
107}
108
109static void disable_pcie1(void)
110{
111 u32 dev, rev;
112
113 kirkwood_pcie_id(&dev, &rev);
114
115 if (dev == MV88F6282_DEV_ID) {
116 writel(readl(PCIE1_LINK_CTRL) | 0x10, PCIE1_LINK_CTRL);
117 while (1)
118 if (readl(PCIE1_STATUS) & 0x1)
119 break;
120 writel(readl(PCIE1_LINK_CTRL) & ~0x10, PCIE1_LINK_CTRL);
121 }
122}
123
124/* An extended version of the gated clk. This calls fn_en()/fn_dis
125 * before enabling/disabling the clock. We use this to turn on/off
126 * PHYs etc. */
127struct clk_gate_fn {
128 struct clk_gate gate;
129 void (*fn_en)(void);
130 void (*fn_dis)(void);
131};
132
133#define to_clk_gate_fn(_gate) container_of(_gate, struct clk_gate_fn, gate)
134#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
135
136static int clk_gate_fn_enable(struct clk_hw *hw)
137{
138 struct clk_gate *gate = to_clk_gate(hw);
139 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
140 int ret;
141
142 ret = clk_gate_ops.enable(hw);
143 if (!ret && gate_fn->fn_en)
144 gate_fn->fn_en();
145
146 return ret;
147}
148
149static void clk_gate_fn_disable(struct clk_hw *hw)
150{
151 struct clk_gate *gate = to_clk_gate(hw);
152 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
153
154 if (gate_fn->fn_dis)
155 gate_fn->fn_dis();
156
157 clk_gate_ops.disable(hw);
158}
159
160static struct clk_ops clk_gate_fn_ops;
161
162static struct clk __init *clk_register_gate_fn(struct device *dev,
163 const char *name,
164 const char *parent_name, unsigned long flags,
165 void __iomem *reg, u8 bit_idx,
166 u8 clk_gate_flags, spinlock_t *lock,
167 void (*fn_en)(void), void (*fn_dis)(void))
168{
169 struct clk_gate_fn *gate_fn;
170 struct clk *clk;
171 struct clk_init_data init;
172
173 gate_fn = kzalloc(sizeof(struct clk_gate_fn), GFP_KERNEL);
174 if (!gate_fn) {
175 pr_err("%s: could not allocate gated clk\n", __func__);
176 return ERR_PTR(-ENOMEM);
177 }
178
179 init.name = name;
180 init.ops = &clk_gate_fn_ops;
181 init.flags = flags;
182 init.parent_names = (parent_name ? &parent_name : NULL);
183 init.num_parents = (parent_name ? 1 : 0);
184
185 /* struct clk_gate assignments */
186 gate_fn->gate.reg = reg;
187 gate_fn->gate.bit_idx = bit_idx;
188 gate_fn->gate.flags = clk_gate_flags;
189 gate_fn->gate.lock = lock;
190 gate_fn->gate.hw.init = &init;
191 gate_fn->fn_en = fn_en;
192 gate_fn->fn_dis = fn_dis;
193
194 /* ops is the gate ops, but with our enable/disable functions */
195 if (clk_gate_fn_ops.enable != clk_gate_fn_enable ||
196 clk_gate_fn_ops.disable != clk_gate_fn_disable) {
197 clk_gate_fn_ops = clk_gate_ops;
198 clk_gate_fn_ops.enable = clk_gate_fn_enable;
199 clk_gate_fn_ops.disable = clk_gate_fn_disable;
200 }
201
202 clk = clk_register(dev, &gate_fn->gate.hw);
203
204 if (IS_ERR(clk))
205 kfree(gate_fn);
206
207 return clk;
208}
209
210static DEFINE_SPINLOCK(gating_lock);
211static struct clk *tclk;
212
213static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
214{
215 return clk_register_gate(NULL, name, "tclk", 0, CLOCK_GATING_CTRL,
216 bit_idx, 0, &gating_lock);
217}
218
219static struct clk __init *kirkwood_register_gate_fn(const char *name,
220 u8 bit_idx,
221 void (*fn_en)(void),
222 void (*fn_dis)(void))
223{
224 return clk_register_gate_fn(NULL, name, "tclk", 0, CLOCK_GATING_CTRL,
225 bit_idx, 0, &gating_lock, fn_en, fn_dis);
226}
227
228static struct clk *ge0, *ge1;
229
230void __init kirkwood_clk_init(void)
231{
232 struct clk *runit, *sata0, *sata1, *usb0, *sdio;
233 struct clk *crypto, *xor0, *xor1, *pex0, *pex1, *audio;
234
235 tclk = clk_register_fixed_rate(NULL, "tclk", NULL,
236 CLK_IS_ROOT, kirkwood_tclk);
237
238 runit = kirkwood_register_gate("runit", CGC_BIT_RUNIT);
239 ge0 = kirkwood_register_gate("ge0", CGC_BIT_GE0);
240 ge1 = kirkwood_register_gate("ge1", CGC_BIT_GE1);
241 sata0 = kirkwood_register_gate_fn("sata0", CGC_BIT_SATA0,
242 enable_sata0, disable_sata0);
243 sata1 = kirkwood_register_gate_fn("sata1", CGC_BIT_SATA1,
244 enable_sata1, disable_sata1);
245 usb0 = kirkwood_register_gate("usb0", CGC_BIT_USB0);
246 sdio = kirkwood_register_gate("sdio", CGC_BIT_SDIO);
247 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO);
248 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0);
249 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1);
250 pex0 = kirkwood_register_gate_fn("pex0", CGC_BIT_PEX0,
251 NULL, disable_pcie0);
252 pex1 = kirkwood_register_gate_fn("pex1", CGC_BIT_PEX1,
253 NULL, disable_pcie1);
254 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO);
255 kirkwood_register_gate("tdm", CGC_BIT_TDM);
256 kirkwood_register_gate("tsu", CGC_BIT_TSU);
257
258 /* clkdev entries, mapping clks to devices */
259 orion_clkdev_add(NULL, "orion_spi.0", runit);
260 orion_clkdev_add(NULL, "orion_spi.1", runit);
261 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0);
262 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1);
263 orion_clkdev_add(NULL, "orion_wdt", tclk);
264 orion_clkdev_add("0", "sata_mv.0", sata0);
265 orion_clkdev_add("1", "sata_mv.0", sata1);
266 orion_clkdev_add(NULL, "orion-ehci.0", usb0);
267 orion_clkdev_add(NULL, "orion_nand", runit);
268 orion_clkdev_add(NULL, "mvsdio", sdio);
269 orion_clkdev_add(NULL, "mv_crypto", crypto);
270 orion_clkdev_add(NULL, MV_XOR_NAME ".0", xor0);
271 orion_clkdev_add(NULL, MV_XOR_NAME ".1", xor1);
272 orion_clkdev_add("0", "pcie", pex0);
273 orion_clkdev_add("1", "pcie", pex1);
274 orion_clkdev_add(NULL, "mvebu-audio", audio);
275 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit);
276 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".1", runit);
277
278 /* Marvell says runit is used by SPI, UART, NAND, TWSI, ...,
279 * so should never be gated.
280 */
281 clk_prepare_enable(runit);
282}
283
284/*****************************************************************************
285 * EHCI0
286 ****************************************************************************/
287void __init kirkwood_ehci_init(void)
288{
289 orion_ehci_init(USB_PHYS_BASE, IRQ_KIRKWOOD_USB, EHCI_PHY_NA);
290}
291
292
293/*****************************************************************************
294 * GE00
295 ****************************************************************************/
296void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
297{
298 orion_ge00_init(eth_data,
299 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
300 IRQ_KIRKWOOD_GE00_ERR, 1600);
301 /* The interface forgets the MAC address assigned by u-boot if
302 the clock is turned off, so claim the clk now. */
303 clk_prepare_enable(ge0);
304}
305
306
307/*****************************************************************************
308 * GE01
309 ****************************************************************************/
310void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
311{
312 orion_ge01_init(eth_data,
313 GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
314 IRQ_KIRKWOOD_GE01_ERR, 1600);
315 clk_prepare_enable(ge1);
316}
317
318
319/*****************************************************************************
320 * Ethernet switch
321 ****************************************************************************/
322void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
323{
324 orion_ge00_switch_init(d, irq);
325}
326
327
328/*****************************************************************************
329 * NAND flash
330 ****************************************************************************/
331static struct resource kirkwood_nand_resource = {
332 .flags = IORESOURCE_MEM,
333 .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
334 .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
335 KIRKWOOD_NAND_MEM_SIZE - 1,
336};
337
338static struct orion_nand_data kirkwood_nand_data = {
339 .cle = 0,
340 .ale = 1,
341 .width = 8,
342};
343
344static struct platform_device kirkwood_nand_flash = {
345 .name = "orion_nand",
346 .id = -1,
347 .dev = {
348 .platform_data = &kirkwood_nand_data,
349 },
350 .resource = &kirkwood_nand_resource,
351 .num_resources = 1,
352};
353
354void __init kirkwood_nand_init(struct mtd_partition *parts, int nr_parts,
355 int chip_delay)
356{
357 kirkwood_nand_data.parts = parts;
358 kirkwood_nand_data.nr_parts = nr_parts;
359 kirkwood_nand_data.chip_delay = chip_delay;
360 platform_device_register(&kirkwood_nand_flash);
361}
362
363void __init kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
364 int (*dev_ready)(struct mtd_info *))
365{
366 kirkwood_nand_data.parts = parts;
367 kirkwood_nand_data.nr_parts = nr_parts;
368 kirkwood_nand_data.dev_ready = dev_ready;
369 platform_device_register(&kirkwood_nand_flash);
370}
371
372/*****************************************************************************
373 * SoC RTC
374 ****************************************************************************/
375static void __init kirkwood_rtc_init(void)
376{
377 orion_rtc_init(RTC_PHYS_BASE, IRQ_KIRKWOOD_RTC);
378}
379
380
381/*****************************************************************************
382 * SATA
383 ****************************************************************************/
384void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
385{
386 orion_sata_init(sata_data, SATA_PHYS_BASE, IRQ_KIRKWOOD_SATA);
387}
388
389
390/*****************************************************************************
391 * SD/SDIO/MMC
392 ****************************************************************************/
393static struct resource mvsdio_resources[] = {
394 [0] = {
395 .start = SDIO_PHYS_BASE,
396 .end = SDIO_PHYS_BASE + SZ_1K - 1,
397 .flags = IORESOURCE_MEM,
398 },
399 [1] = {
400 .start = IRQ_KIRKWOOD_SDIO,
401 .end = IRQ_KIRKWOOD_SDIO,
402 .flags = IORESOURCE_IRQ,
403 },
404};
405
406static u64 mvsdio_dmamask = DMA_BIT_MASK(32);
407
408static struct platform_device kirkwood_sdio = {
409 .name = "mvsdio",
410 .id = -1,
411 .dev = {
412 .dma_mask = &mvsdio_dmamask,
413 .coherent_dma_mask = DMA_BIT_MASK(32),
414 },
415 .num_resources = ARRAY_SIZE(mvsdio_resources),
416 .resource = mvsdio_resources,
417};
418
419void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
420{
421 u32 dev, rev;
422
423 kirkwood_pcie_id(&dev, &rev);
424 if (rev == 0 && dev != MV88F6282_DEV_ID) /* catch all Kirkwood Z0's */
425 mvsdio_data->clock = 100000000;
426 else
427 mvsdio_data->clock = 200000000;
428 kirkwood_sdio.dev.platform_data = mvsdio_data;
429 platform_device_register(&kirkwood_sdio);
430}
431
432
433/*****************************************************************************
434 * SPI
435 ****************************************************************************/
436void __init kirkwood_spi_init(void)
437{
438 orion_spi_init(SPI_PHYS_BASE);
439}
440
441
442/*****************************************************************************
443 * I2C
444 ****************************************************************************/
445void __init kirkwood_i2c_init(void)
446{
447 orion_i2c_init(I2C_PHYS_BASE, IRQ_KIRKWOOD_TWSI, 8);
448}
449
450
451/*****************************************************************************
452 * UART0
453 ****************************************************************************/
454
455void __init kirkwood_uart0_init(void)
456{
457 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
458 IRQ_KIRKWOOD_UART_0, tclk);
459}
460
461
462/*****************************************************************************
463 * UART1
464 ****************************************************************************/
465void __init kirkwood_uart1_init(void)
466{
467 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
468 IRQ_KIRKWOOD_UART_1, tclk);
469}
470
471/*****************************************************************************
472 * Cryptographic Engines and Security Accelerator (CESA)
473 ****************************************************************************/
474void __init kirkwood_crypto_init(void)
475{
476 orion_crypto_init(CRYPTO_PHYS_BASE, KIRKWOOD_SRAM_PHYS_BASE,
477 KIRKWOOD_SRAM_SIZE, IRQ_KIRKWOOD_CRYPTO);
478}
479
480
481/*****************************************************************************
482 * XOR0
483 ****************************************************************************/
484void __init kirkwood_xor0_init(void)
485{
486 orion_xor0_init(XOR0_PHYS_BASE, XOR0_HIGH_PHYS_BASE,
487 IRQ_KIRKWOOD_XOR_00, IRQ_KIRKWOOD_XOR_01);
488}
489
490
491/*****************************************************************************
492 * XOR1
493 ****************************************************************************/
494void __init kirkwood_xor1_init(void)
495{
496 orion_xor1_init(XOR1_PHYS_BASE, XOR1_HIGH_PHYS_BASE,
497 IRQ_KIRKWOOD_XOR_10, IRQ_KIRKWOOD_XOR_11);
498}
499
500
501/*****************************************************************************
502 * Watchdog
503 ****************************************************************************/
504void __init kirkwood_wdt_init(void)
505{
506 orion_wdt_init();
507}
508
509/*****************************************************************************
510 * CPU idle
511 ****************************************************************************/
512static struct resource kirkwood_cpuidle_resource[] = {
513 {
514 .flags = IORESOURCE_MEM,
515 .start = DDR_OPERATION_BASE,
516 .end = DDR_OPERATION_BASE + 3,
517 },
518};
519
520static struct platform_device kirkwood_cpuidle = {
521 .name = "kirkwood_cpuidle",
522 .id = -1,
523 .resource = kirkwood_cpuidle_resource,
524 .num_resources = 1,
525};
526
527void __init kirkwood_cpuidle_init(void)
528{
529 platform_device_register(&kirkwood_cpuidle);
530}
531
532/*****************************************************************************
533 * Time handling
534 ****************************************************************************/
535void __init kirkwood_init_early(void)
536{
537 orion_time_set_base(TIMER_VIRT_BASE);
538}
539
540int kirkwood_tclk;
541
542static int __init kirkwood_find_tclk(void)
543{
544 u32 dev, rev;
545
546 kirkwood_pcie_id(&dev, &rev);
547
548 if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID)
549 if (((readl(SAMPLE_AT_RESET) >> 21) & 1) == 0)
550 return 200000000;
551
552 return 166666667;
553}
554
555void __init kirkwood_timer_init(void)
556{
557 kirkwood_tclk = kirkwood_find_tclk();
558
559 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
560 IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
561}
562
563/*****************************************************************************
564 * Audio
565 ****************************************************************************/
566static struct resource kirkwood_audio_resources[] = {
567 [0] = {
568 .start = AUDIO_PHYS_BASE,
569 .end = AUDIO_PHYS_BASE + SZ_16K - 1,
570 .flags = IORESOURCE_MEM,
571 },
572 [1] = {
573 .start = IRQ_KIRKWOOD_I2S,
574 .end = IRQ_KIRKWOOD_I2S,
575 .flags = IORESOURCE_IRQ,
576 },
577};
578
579static struct kirkwood_asoc_platform_data kirkwood_audio_data = {
580 .burst = 128,
581};
582
583static struct platform_device kirkwood_audio_device = {
584 .name = "mvebu-audio",
585 .id = -1,
586 .num_resources = ARRAY_SIZE(kirkwood_audio_resources),
587 .resource = kirkwood_audio_resources,
588 .dev = {
589 .platform_data = &kirkwood_audio_data,
590 },
591};
592
593void __init kirkwood_audio_init(void)
594{
595 platform_device_register(&kirkwood_audio_device);
596}
597
598/*****************************************************************************
599 * CPU Frequency
600 ****************************************************************************/
601static struct resource kirkwood_cpufreq_resources[] = {
602 [0] = {
603 .start = CPU_CONTROL_PHYS,
604 .end = CPU_CONTROL_PHYS + 3,
605 .flags = IORESOURCE_MEM,
606 },
607};
608
609static struct platform_device kirkwood_cpufreq_device = {
610 .name = "kirkwood-cpufreq",
611 .id = -1,
612 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
613 .resource = kirkwood_cpufreq_resources,
614};
615
616void __init kirkwood_cpufreq_init(void)
617{
618 platform_device_register(&kirkwood_cpufreq_device);
619}
620
621/*****************************************************************************
622 * General
623 ****************************************************************************/
624/*
625 * Identify device ID and revision.
626 */
627char * __init kirkwood_id(void)
628{
629 u32 dev, rev;
630
631 kirkwood_pcie_id(&dev, &rev);
632
633 if (dev == MV88F6281_DEV_ID) {
634 if (rev == MV88F6281_REV_Z0)
635 return "MV88F6281-Z0";
636 else if (rev == MV88F6281_REV_A0)
637 return "MV88F6281-A0";
638 else if (rev == MV88F6281_REV_A1)
639 return "MV88F6281-A1";
640 else
641 return "MV88F6281-Rev-Unsupported";
642 } else if (dev == MV88F6192_DEV_ID) {
643 if (rev == MV88F6192_REV_Z0)
644 return "MV88F6192-Z0";
645 else if (rev == MV88F6192_REV_A0)
646 return "MV88F6192-A0";
647 else if (rev == MV88F6192_REV_A1)
648 return "MV88F6192-A1";
649 else
650 return "MV88F6192-Rev-Unsupported";
651 } else if (dev == MV88F6180_DEV_ID) {
652 if (rev == MV88F6180_REV_A0)
653 return "MV88F6180-Rev-A0";
654 else if (rev == MV88F6180_REV_A1)
655 return "MV88F6180-Rev-A1";
656 else
657 return "MV88F6180-Rev-Unsupported";
658 } else if (dev == MV88F6282_DEV_ID) {
659 if (rev == MV88F6282_REV_A0)
660 return "MV88F6282-Rev-A0";
661 else if (rev == MV88F6282_REV_A1)
662 return "MV88F6282-Rev-A1";
663 else
664 return "MV88F6282-Rev-Unsupported";
665 } else {
666 return "Device-Unknown";
667 }
668}
669
670void __init kirkwood_setup_wins(void)
671{
672 mvebu_mbus_add_window_by_id(KIRKWOOD_MBUS_NAND_TARGET,
673 KIRKWOOD_MBUS_NAND_ATTR,
674 KIRKWOOD_NAND_MEM_PHYS_BASE,
675 KIRKWOOD_NAND_MEM_SIZE);
676 mvebu_mbus_add_window_by_id(KIRKWOOD_MBUS_SRAM_TARGET,
677 KIRKWOOD_MBUS_SRAM_ATTR,
678 KIRKWOOD_SRAM_PHYS_BASE,
679 KIRKWOOD_SRAM_SIZE);
680}
681
682void __init kirkwood_l2_init(void)
683{
684#ifdef CONFIG_CACHE_FEROCEON_L2
685#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
686 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
687 feroceon_l2_init(1);
688#else
689 writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
690 feroceon_l2_init(0);
691#endif
692#endif
693}
694
695void __init kirkwood_init(void)
696{
697 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
698
699 /*
700 * Disable propagation of mbus errors to the CPU local bus,
701 * as this causes mbus errors (which can occur for example
702 * for PCI aborts) to throw CPU aborts, which we're not set
703 * up to deal with.
704 */
705 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
706
707 BUG_ON(mvebu_mbus_init("marvell,kirkwood-mbus",
708 BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
709 DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ));
710
711 kirkwood_setup_wins();
712
713 kirkwood_l2_init();
714
715 /* Setup root of clk tree */
716 kirkwood_clk_init();
717
718 /* internal devices that every board has */
719 kirkwood_rtc_init();
720 kirkwood_wdt_init();
721 kirkwood_xor0_init();
722 kirkwood_xor1_init();
723 kirkwood_crypto_init();
724
725 kirkwood_pm_init();
726 kirkwood_cpuidle_init();
727#ifdef CONFIG_KEXEC
728 kexec_reinit = kirkwood_enable_pcie;
729#endif
730}
731
732void kirkwood_restart(enum reboot_mode mode, const char *cmd)
733{
734 /*
735 * Enable soft reset to assert RSTOUTn.
736 */
737 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
738
739 /*
740 * Assert soft reset.
741 */
742 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
743
744 while (1)
745 ;
746}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
deleted file mode 100644
index 832a4e2ab8d7..000000000000
--- a/arch/arm/mach-kirkwood/common.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/common.h
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_KIRKWOOD_COMMON_H
12#define __ARCH_KIRKWOOD_COMMON_H
13
14#include <linux/reboot.h>
15
16struct dsa_platform_data;
17struct mv643xx_eth_platform_data;
18struct mv_sata_platform_data;
19struct mvsdio_platform_data;
20struct mtd_partition;
21struct mtd_info;
22struct kirkwood_asoc_platform_data;
23
24#define KW_PCIE0 (1 << 0)
25#define KW_PCIE1 (1 << 1)
26
27/*
28 * Basic Kirkwood init functions used early by machine-setup.
29 */
30void kirkwood_map_io(void);
31void kirkwood_init(void);
32void kirkwood_init_early(void);
33void kirkwood_init_irq(void);
34
35void kirkwood_setup_wins(void);
36
37void kirkwood_enable_pcie(void);
38void kirkwood_pcie_id(u32 *dev, u32 *rev);
39
40void kirkwood_ehci_init(void);
41void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
42void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data);
43void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq);
44void kirkwood_pcie_init(unsigned int portmask);
45void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
46void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data);
47void kirkwood_spi_init(void);
48void kirkwood_i2c_init(void);
49void kirkwood_uart0_init(void);
50void kirkwood_uart1_init(void);
51void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay);
52void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
53 int (*dev_ready)(struct mtd_info *));
54void kirkwood_audio_init(void);
55void kirkwood_cpuidle_init(void);
56void kirkwood_cpufreq_init(void);
57
58void kirkwood_restart(enum reboot_mode, const char *);
59void kirkwood_clk_init(void);
60
61/* early init functions not converted to fdt yet */
62char *kirkwood_id(void);
63void kirkwood_l2_init(void);
64void kirkwood_wdt_init(void);
65void kirkwood_xor0_init(void);
66void kirkwood_xor1_init(void);
67void kirkwood_crypto_init(void);
68
69extern int kirkwood_tclk;
70extern void kirkwood_timer_init(void);
71
72#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
73
74#endif
diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c
deleted file mode 100644
index 453418063c1e..000000000000
--- a/arch/arm/mach-kirkwood/d2net_v2-setup.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/d2net_v2-setup.c
3 *
4 * LaCie d2 Network Space v2 Board Setup
5 *
6 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.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/kernel.h>
24#include <linux/init.h>
25#include <linux/platform_device.h>
26#include <linux/ata_platform.h>
27#include <linux/mv643xx_eth.h>
28#include <linux/input.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/leds.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/kirkwood.h>
35#include <linux/platform_data/leds-kirkwood-ns2.h>
36#include "common.h"
37#include "mpp.h"
38#include "lacie_v2-common.h"
39
40/*****************************************************************************
41 * Ethernet
42 ****************************************************************************/
43
44static struct mv643xx_eth_platform_data d2net_v2_ge00_data = {
45 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
46};
47
48/*****************************************************************************
49 * SATA
50 ****************************************************************************/
51
52static struct mv_sata_platform_data d2net_v2_sata_data = {
53 .n_ports = 2,
54};
55
56/*****************************************************************************
57 * GPIO keys
58 ****************************************************************************/
59
60#define D2NET_V2_GPIO_PUSH_BUTTON 34
61#define D2NET_V2_GPIO_POWER_SWITCH_ON 13
62#define D2NET_V2_GPIO_POWER_SWITCH_OFF 15
63
64#define D2NET_V2_SWITCH_POWER_ON 0x1
65#define D2NET_V2_SWITCH_POWER_OFF 0x2
66
67static struct gpio_keys_button d2net_v2_buttons[] = {
68 [0] = {
69 .type = EV_SW,
70 .code = D2NET_V2_SWITCH_POWER_ON,
71 .gpio = D2NET_V2_GPIO_POWER_SWITCH_ON,
72 .desc = "Back power switch (on|auto)",
73 .active_low = 0,
74 },
75 [1] = {
76 .type = EV_SW,
77 .code = D2NET_V2_SWITCH_POWER_OFF,
78 .gpio = D2NET_V2_GPIO_POWER_SWITCH_OFF,
79 .desc = "Back power switch (auto|off)",
80 .active_low = 0,
81 },
82 [2] = {
83 .code = KEY_POWER,
84 .gpio = D2NET_V2_GPIO_PUSH_BUTTON,
85 .desc = "Front Push Button",
86 .active_low = 1,
87 },
88};
89
90static struct gpio_keys_platform_data d2net_v2_button_data = {
91 .buttons = d2net_v2_buttons,
92 .nbuttons = ARRAY_SIZE(d2net_v2_buttons),
93};
94
95static struct platform_device d2net_v2_gpio_buttons = {
96 .name = "gpio-keys",
97 .id = -1,
98 .dev = {
99 .platform_data = &d2net_v2_button_data,
100 },
101};
102
103/*****************************************************************************
104 * GPIO LEDs
105 ****************************************************************************/
106
107#define D2NET_V2_GPIO_RED_LED 12
108
109static struct gpio_led d2net_v2_gpio_led_pins[] = {
110 {
111 .name = "d2net_v2:red:fail",
112 .gpio = D2NET_V2_GPIO_RED_LED,
113 },
114};
115
116static struct gpio_led_platform_data d2net_v2_gpio_leds_data = {
117 .num_leds = ARRAY_SIZE(d2net_v2_gpio_led_pins),
118 .leds = d2net_v2_gpio_led_pins,
119};
120
121static struct platform_device d2net_v2_gpio_leds = {
122 .name = "leds-gpio",
123 .id = -1,
124 .dev = {
125 .platform_data = &d2net_v2_gpio_leds_data,
126 },
127};
128
129/*****************************************************************************
130 * Dual-GPIO CPLD LEDs
131 ****************************************************************************/
132
133#define D2NET_V2_GPIO_BLUE_LED_SLOW 29
134#define D2NET_V2_GPIO_BLUE_LED_CMD 30
135
136static struct ns2_led d2net_v2_led_pins[] = {
137 {
138 .name = "d2net_v2:blue:sata",
139 .cmd = D2NET_V2_GPIO_BLUE_LED_CMD,
140 .slow = D2NET_V2_GPIO_BLUE_LED_SLOW,
141 },
142};
143
144static struct ns2_led_platform_data d2net_v2_leds_data = {
145 .num_leds = ARRAY_SIZE(d2net_v2_led_pins),
146 .leds = d2net_v2_led_pins,
147};
148
149static struct platform_device d2net_v2_leds = {
150 .name = "leds-ns2",
151 .id = -1,
152 .dev = {
153 .platform_data = &d2net_v2_leds_data,
154 },
155};
156
157/*****************************************************************************
158 * General Setup
159 ****************************************************************************/
160
161static unsigned int d2net_v2_mpp_config[] __initdata = {
162 MPP0_SPI_SCn,
163 MPP1_SPI_MOSI,
164 MPP2_SPI_SCK,
165 MPP3_SPI_MISO,
166 MPP6_SYSRST_OUTn,
167 MPP7_GPO, /* Request power-off */
168 MPP8_TW0_SDA,
169 MPP9_TW0_SCK,
170 MPP10_UART0_TXD,
171 MPP11_UART0_RXD,
172 MPP12_GPO, /* Red led */
173 MPP13_GPIO, /* Rear power switch (on|auto) */
174 MPP14_GPIO, /* USB fuse */
175 MPP15_GPIO, /* Rear power switch (auto|off) */
176 MPP16_GPIO, /* SATA 0 power */
177 MPP21_SATA0_ACTn,
178 MPP24_GPIO, /* USB mode select */
179 MPP26_GPIO, /* USB device vbus */
180 MPP28_GPIO, /* USB enable host vbus */
181 MPP29_GPIO, /* Blue led (slow register) */
182 MPP30_GPIO, /* Blue led (command register) */
183 MPP34_GPIO, /* Power button (1 = Released, 0 = Pushed) */
184 MPP35_GPIO, /* Inhibit power-off */
185 0
186};
187
188#define D2NET_V2_GPIO_POWER_OFF 7
189
190static void d2net_v2_power_off(void)
191{
192 gpio_set_value(D2NET_V2_GPIO_POWER_OFF, 1);
193}
194
195static void __init d2net_v2_init(void)
196{
197 /*
198 * Basic setup. Needs to be called early.
199 */
200 kirkwood_init();
201 kirkwood_mpp_conf(d2net_v2_mpp_config);
202
203 lacie_v2_hdd_power_init(1);
204
205 kirkwood_ehci_init();
206 kirkwood_ge00_init(&d2net_v2_ge00_data);
207 kirkwood_sata_init(&d2net_v2_sata_data);
208 kirkwood_uart0_init();
209 lacie_v2_register_flash();
210 lacie_v2_register_i2c_devices();
211
212 platform_device_register(&d2net_v2_leds);
213 platform_device_register(&d2net_v2_gpio_leds);
214 platform_device_register(&d2net_v2_gpio_buttons);
215
216 if (gpio_request(D2NET_V2_GPIO_POWER_OFF, "power-off") == 0 &&
217 gpio_direction_output(D2NET_V2_GPIO_POWER_OFF, 0) == 0)
218 pm_power_off = d2net_v2_power_off;
219 else
220 pr_err("d2net_v2: failed to configure power-off GPIO\n");
221}
222
223MACHINE_START(D2NET_V2, "LaCie d2 Network v2")
224 .atag_offset = 0x100,
225 .init_machine = d2net_v2_init,
226 .map_io = kirkwood_map_io,
227 .init_early = kirkwood_init_early,
228 .init_irq = kirkwood_init_irq,
229 .init_time = kirkwood_timer_init,
230 .restart = kirkwood_restart,
231MACHINE_END
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
deleted file mode 100644
index 1c37082c8b39..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/bridge-regs.h
3 *
4 * Mbus-L to Mbus Bridge Registers
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_BRIDGE_REGS_H
12#define __ASM_ARCH_BRIDGE_REGS_H
13
14#include <mach/kirkwood.h>
15
16#define CPU_CONFIG (BRIDGE_VIRT_BASE + 0x0100)
17#define CPU_CONFIG_PHYS (BRIDGE_PHYS_BASE + 0x0100)
18#define CPU_CONFIG_ERROR_PROP 0x00000004
19
20#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
21#define CPU_CONTROL_PHYS (BRIDGE_PHYS_BASE + 0x0104)
22#define CPU_RESET 0x00000002
23
24#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
25#define RSTOUTn_MASK_PHYS (BRIDGE_PHYS_BASE + 0x0108)
26#define SOFT_RESET_OUT_EN 0x00000004
27
28#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
29#define SOFT_RESET 0x00000001
30
31#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
32
33#define BRIDGE_INT_TIMER1_CLR (~0x0004)
34
35#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
36#define IRQ_CAUSE_LOW_OFF 0x0000
37#define IRQ_MASK_LOW_OFF 0x0004
38#define IRQ_CAUSE_HIGH_OFF 0x0010
39#define IRQ_MASK_HIGH_OFF 0x0014
40
41#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0300)
42#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE + 0x0300)
43
44#define L2_CONFIG_REG (BRIDGE_VIRT_BASE + 0x0128)
45#define L2_WRITETHROUGH 0x00000010
46
47#define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE + 0x11c)
48#define CGC_BIT_GE0 (0)
49#define CGC_BIT_PEX0 (2)
50#define CGC_BIT_USB0 (3)
51#define CGC_BIT_SDIO (4)
52#define CGC_BIT_TSU (5)
53#define CGC_BIT_DUNIT (6)
54#define CGC_BIT_RUNIT (7)
55#define CGC_BIT_XOR0 (8)
56#define CGC_BIT_AUDIO (9)
57#define CGC_BIT_SATA0 (14)
58#define CGC_BIT_SATA1 (15)
59#define CGC_BIT_XOR1 (16)
60#define CGC_BIT_CRYPTO (17)
61#define CGC_BIT_PEX1 (18)
62#define CGC_BIT_GE1 (19)
63#define CGC_BIT_TDM (20)
64#define CGC_GE0 (1 << 0)
65#define CGC_PEX0 (1 << 2)
66#define CGC_USB0 (1 << 3)
67#define CGC_SDIO (1 << 4)
68#define CGC_TSU (1 << 5)
69#define CGC_DUNIT (1 << 6)
70#define CGC_RUNIT (1 << 7)
71#define CGC_XOR0 (1 << 8)
72#define CGC_AUDIO (1 << 9)
73#define CGC_POWERSAVE (1 << 11)
74#define CGC_SATA0 (1 << 14)
75#define CGC_SATA1 (1 << 15)
76#define CGC_XOR1 (1 << 16)
77#define CGC_CRYPTO (1 << 17)
78#define CGC_PEX1 (1 << 18)
79#define CGC_GE1 (1 << 19)
80#define CGC_TDM (1 << 20)
81#define CGC_RESERVED (0x6 << 21)
82
83#define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118)
84#define MEMORY_PM_CTRL_PHYS (BRIDGE_PHYS_BASE + 0x118)
85
86#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/entry-macro.S b/arch/arm/mach-kirkwood/include/mach/entry-macro.S
deleted file mode 100644
index 82db29f7af8f..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/entry-macro.S
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Marvell Kirkwood platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <mach/bridge-regs.h>
12
13 .macro get_irqnr_preamble, base, tmp
14 ldr \base, =IRQ_VIRT_BASE
15 .endm
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18 @ check low interrupts
19 ldr \irqstat, [\base, #IRQ_CAUSE_LOW_OFF]
20 ldr \tmp, [\base, #IRQ_MASK_LOW_OFF]
21 mov \irqnr, #31
22 ands \irqstat, \irqstat, \tmp
23 bne 1001f
24
25 @ if no low interrupts set, check high interrupts
26 ldr \irqstat, [\base, #IRQ_CAUSE_HIGH_OFF]
27 ldr \tmp, [\base, #IRQ_MASK_HIGH_OFF]
28 mov \irqnr, #63
29 ands \irqstat, \irqstat, \tmp
30
31 @ find first active interrupt source
321001: clzne \irqstat, \irqstat
33 subne \irqnr, \irqnr, \irqstat
34 .endm
diff --git a/arch/arm/mach-kirkwood/include/mach/hardware.h b/arch/arm/mach-kirkwood/include/mach/hardware.h
deleted file mode 100644
index 742b74f43e41..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/hardware.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/hardware.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#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H
11
12#include "kirkwood.h"
13
14#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
deleted file mode 100644
index 2bf8161e3b51..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/irqs.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/irqs.h
3 *
4 * IRQ definitions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14/*
15 * Low Interrupt Controller
16 */
17#define IRQ_KIRKWOOD_HIGH_SUM 0
18#define IRQ_KIRKWOOD_BRIDGE 1
19#define IRQ_KIRKWOOD_HOST2CPU 2
20#define IRQ_KIRKWOOD_CPU2HOST 3
21#define IRQ_KIRKWOOD_XOR_00 5
22#define IRQ_KIRKWOOD_XOR_01 6
23#define IRQ_KIRKWOOD_XOR_10 7
24#define IRQ_KIRKWOOD_XOR_11 8
25#define IRQ_KIRKWOOD_PCIE 9
26#define IRQ_KIRKWOOD_PCIE1 10
27#define IRQ_KIRKWOOD_GE00_SUM 11
28#define IRQ_KIRKWOOD_GE01_SUM 15
29#define IRQ_KIRKWOOD_USB 19
30#define IRQ_KIRKWOOD_SATA 21
31#define IRQ_KIRKWOOD_CRYPTO 22
32#define IRQ_KIRKWOOD_SPI 23
33#define IRQ_KIRKWOOD_I2S 24
34#define IRQ_KIRKWOOD_TS_0 26
35#define IRQ_KIRKWOOD_SDIO 28
36#define IRQ_KIRKWOOD_TWSI 29
37#define IRQ_KIRKWOOD_AVB 30
38#define IRQ_KIRKWOOD_TDMI 31
39
40/*
41 * High Interrupt Controller
42 */
43#define IRQ_KIRKWOOD_UART_0 33
44#define IRQ_KIRKWOOD_UART_1 34
45#define IRQ_KIRKWOOD_GPIO_LOW_0_7 35
46#define IRQ_KIRKWOOD_GPIO_LOW_8_15 36
47#define IRQ_KIRKWOOD_GPIO_LOW_16_23 37
48#define IRQ_KIRKWOOD_GPIO_LOW_24_31 38
49#define IRQ_KIRKWOOD_GPIO_HIGH_0_7 39
50#define IRQ_KIRKWOOD_GPIO_HIGH_8_15 40
51#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
52#define IRQ_KIRKWOOD_GE00_ERR 46
53#define IRQ_KIRKWOOD_GE01_ERR 47
54#define IRQ_KIRKWOOD_RTC 53
55
56/*
57 * KIRKWOOD General Purpose Pins
58 */
59#define IRQ_KIRKWOOD_GPIO_START 64
60#define NR_GPIO_IRQS 50
61
62#define NR_IRQS (IRQ_KIRKWOOD_GPIO_START + NR_GPIO_IRQS)
63
64
65#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
deleted file mode 100644
index 92976cef3910..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/kirkwood.h
3 *
4 * Generic definitions for Marvell Kirkwood SoC flavors:
5 * 88F6180, 88F6192 and 88F6281.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __ASM_ARCH_KIRKWOOD_H
13#define __ASM_ARCH_KIRKWOOD_H
14
15/*
16 * Marvell Kirkwood address maps.
17 *
18 * phys
19 * e0000000 PCIe #0 Memory space
20 * e8000000 PCIe #1 Memory space
21 * f1000000 on-chip peripheral registers
22 * f2000000 PCIe #0 I/O space
23 * f3000000 PCIe #1 I/O space
24 * f4000000 NAND controller address window
25 * f5000000 Security Accelerator SRAM
26 *
27 * virt phys size
28 * fed00000 f1000000 1M on-chip peripheral registers
29 * fee00000 f2000000 1M PCIe #0 I/O space
30 * fef00000 f3000000 1M PCIe #1 I/O space
31 */
32
33#define KIRKWOOD_SRAM_PHYS_BASE 0xf5000000
34#define KIRKWOOD_SRAM_SIZE SZ_2K
35
36#define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf4000000
37#define KIRKWOOD_NAND_MEM_SIZE SZ_1K
38
39#define KIRKWOOD_PCIE1_IO_PHYS_BASE 0xf3000000
40#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00010000
41#define KIRKWOOD_PCIE1_IO_SIZE SZ_64K
42
43#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000
44#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000
45#define KIRKWOOD_PCIE_IO_SIZE SZ_64K
46
47#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
48#define KIRKWOOD_REGS_VIRT_BASE IOMEM(0xfed00000)
49#define KIRKWOOD_REGS_SIZE SZ_1M
50
51#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000
52#define KIRKWOOD_PCIE_MEM_BUS_BASE 0xe0000000
53#define KIRKWOOD_PCIE_MEM_SIZE SZ_128M
54
55#define KIRKWOOD_PCIE1_MEM_PHYS_BASE 0xe8000000
56#define KIRKWOOD_PCIE1_MEM_BUS_BASE 0xe8000000
57#define KIRKWOOD_PCIE1_MEM_SIZE SZ_128M
58
59/*
60 * Register Map
61 */
62#define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000)
63#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
64#define DDR_WINDOW_CPU_BASE (DDR_PHYS_BASE + 0x1500)
65#define DDR_WINDOW_CPU_SZ (0x20)
66#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
67
68#define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000)
69#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x10000)
70#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE + 0x0030)
71#define DEVICE_ID (DEV_BUS_VIRT_BASE + 0x0034)
72#define GPIO_LOW_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x0100)
73#define GPIO_HIGH_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x0140)
74#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x0300)
75#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x0600)
76#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x1000)
77#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2000)
78#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2000)
79#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE + 0x2100)
80#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE + 0x2100)
81
82#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x20000)
83#define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x20000)
84#define BRIDGE_WINS_BASE (BRIDGE_PHYS_BASE)
85#define BRIDGE_WINS_SZ (0x80)
86
87#define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x30000)
88
89#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x40000)
90#define PCIE_LINK_CTRL (PCIE_VIRT_BASE + 0x70)
91#define PCIE_STATUS (PCIE_VIRT_BASE + 0x1a04)
92#define PCIE1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x44000)
93#define PCIE1_LINK_CTRL (PCIE1_VIRT_BASE + 0x70)
94#define PCIE1_STATUS (PCIE1_VIRT_BASE + 0x1a04)
95
96#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x50000)
97
98#define XOR0_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60800)
99#define XOR0_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60800)
100#define XOR1_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60900)
101#define XOR1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60900)
102#define XOR0_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60A00)
103#define XOR0_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60A00)
104#define XOR1_HIGH_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x60B00)
105#define XOR1_HIGH_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x60B00)
106
107#define GE00_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x70000)
108#define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x74000)
109
110#define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x80000)
111#define SATA_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x80000)
112#define SATA0_IF_CTRL (SATA_VIRT_BASE + 0x2050)
113#define SATA0_PHY_MODE_2 (SATA_VIRT_BASE + 0x2330)
114#define SATA1_IF_CTRL (SATA_VIRT_BASE + 0x4050)
115#define SATA1_PHY_MODE_2 (SATA_VIRT_BASE + 0x4330)
116
117#define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x90000)
118
119#define AUDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0xA0000)
120#define AUDIO_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0xA0000)
121
122/*
123 * Supported devices and revisions.
124 */
125#define MV88F6281_DEV_ID 0x6281
126#define MV88F6281_REV_Z0 0
127#define MV88F6281_REV_A0 2
128#define MV88F6281_REV_A1 3
129
130#define MV88F6192_DEV_ID 0x6192
131#define MV88F6192_REV_Z0 0
132#define MV88F6192_REV_A0 2
133#define MV88F6192_REV_A1 3
134
135#define MV88F6180_DEV_ID 0x6180
136#define MV88F6180_REV_A0 2
137#define MV88F6180_REV_A1 3
138
139#define MV88F6282_DEV_ID 0x6282
140#define MV88F6282_REV_A0 0
141#define MV88F6282_REV_A1 1
142#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/uncompress.h b/arch/arm/mach-kirkwood/include/mach/uncompress.h
deleted file mode 100644
index 5bca5534021f..000000000000
--- a/arch/arm/mach-kirkwood/include/mach/uncompress.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/uncompress.h
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#include <linux/serial_reg.h>
10#include <mach/kirkwood.h>
11
12#define SERIAL_BASE ((unsigned char *)UART0_PHYS_BASE)
13
14static void putc(const char c)
15{
16 unsigned char *base = SERIAL_BASE;
17 int i;
18
19 for (i = 0; i < 0x1000; i++) {
20 if (base[UART_LSR << 2] & UART_LSR_THRE)
21 break;
22 barrier();
23 }
24
25 base[UART_TX << 2] = c;
26}
27
28static void flush(void)
29{
30 unsigned char *base = SERIAL_BASE;
31 unsigned char mask;
32 int i;
33
34 mask = UART_LSR_TEMT | UART_LSR_THRE;
35
36 for (i = 0; i < 0x1000; i++) {
37 if ((base[UART_LSR << 2] & mask) == mask)
38 break;
39 barrier();
40 }
41}
42
43/*
44 * nothing to do
45 */
46#define arch_decomp_setup()
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
deleted file mode 100644
index 2c47a8ad0e27..000000000000
--- a/arch/arm/mach-kirkwood/irq.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/irq.c
3 *
4 * Kirkwood IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <asm/exception.h>
11#include <linux/gpio.h>
12#include <linux/kernel.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <mach/bridge-regs.h>
16#include <plat/orion-gpio.h>
17#include <plat/irq.h>
18#include "common.h"
19
20static int __initdata gpio0_irqs[4] = {
21 IRQ_KIRKWOOD_GPIO_LOW_0_7,
22 IRQ_KIRKWOOD_GPIO_LOW_8_15,
23 IRQ_KIRKWOOD_GPIO_LOW_16_23,
24 IRQ_KIRKWOOD_GPIO_LOW_24_31,
25};
26
27static int __initdata gpio1_irqs[4] = {
28 IRQ_KIRKWOOD_GPIO_HIGH_0_7,
29 IRQ_KIRKWOOD_GPIO_HIGH_8_15,
30 IRQ_KIRKWOOD_GPIO_HIGH_16_23,
31 0,
32};
33
34#ifdef CONFIG_MULTI_IRQ_HANDLER
35/*
36 * Compiling with both non-DT and DT support enabled, will
37 * break asm irq handler used by non-DT boards. Therefore,
38 * we provide a C-style irq handler even for non-DT boards,
39 * if MULTI_IRQ_HANDLER is set.
40 */
41
42static void __iomem *kirkwood_irq_base = IRQ_VIRT_BASE;
43
44asmlinkage void
45__exception_irq_entry kirkwood_legacy_handle_irq(struct pt_regs *regs)
46{
47 u32 stat;
48
49 stat = readl_relaxed(kirkwood_irq_base + IRQ_CAUSE_LOW_OFF);
50 stat &= readl_relaxed(kirkwood_irq_base + IRQ_MASK_LOW_OFF);
51 if (stat) {
52 unsigned int hwirq = __fls(stat);
53 handle_IRQ(hwirq, regs);
54 return;
55 }
56 stat = readl_relaxed(kirkwood_irq_base + IRQ_CAUSE_HIGH_OFF);
57 stat &= readl_relaxed(kirkwood_irq_base + IRQ_MASK_HIGH_OFF);
58 if (stat) {
59 unsigned int hwirq = 32 + __fls(stat);
60 handle_IRQ(hwirq, regs);
61 return;
62 }
63}
64#endif
65
66void __init kirkwood_init_irq(void)
67{
68 orion_irq_init(0, IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF);
69 orion_irq_init(32, IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF);
70
71#ifdef CONFIG_MULTI_IRQ_HANDLER
72 set_handle_irq(kirkwood_legacy_handle_irq);
73#endif
74
75 /*
76 * Initialize gpiolib for GPIOs 0-49.
77 */
78 orion_gpio_init(NULL, 0, 32, GPIO_LOW_VIRT_BASE, 0,
79 IRQ_KIRKWOOD_GPIO_START, gpio0_irqs);
80 orion_gpio_init(NULL, 32, 18, GPIO_HIGH_VIRT_BASE, 0,
81 IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs);
82}
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c
deleted file mode 100644
index 8e3e4331c380..000000000000
--- a/arch/arm/mach-kirkwood/lacie_v2-common.c
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.c
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#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/mtd/physmap.h>
12#include <linux/spi/flash.h>
13#include <linux/spi/spi.h>
14#include <linux/i2c.h>
15#include <linux/platform_data/at24.h>
16#include <linux/gpio.h>
17#include <asm/mach/time.h>
18#include <mach/kirkwood.h>
19#include <mach/irqs.h>
20#include <plat/time.h>
21#include "common.h"
22#include "lacie_v2-common.h"
23
24/*****************************************************************************
25 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
26 ****************************************************************************/
27
28static struct mtd_partition lacie_v2_flash_parts[] = {
29 {
30 .name = "u-boot",
31 .size = MTDPART_SIZ_FULL,
32 .offset = 0,
33 .mask_flags = MTD_WRITEABLE, /* force read-only */
34 },
35};
36
37static const struct flash_platform_data lacie_v2_flash = {
38 .type = "mx25l4005a",
39 .name = "spi_flash",
40 .parts = lacie_v2_flash_parts,
41 .nr_parts = ARRAY_SIZE(lacie_v2_flash_parts),
42};
43
44static struct spi_board_info __initdata lacie_v2_spi_slave_info[] = {
45 {
46 .modalias = "m25p80",
47 .platform_data = &lacie_v2_flash,
48 .irq = -1,
49 .max_speed_hz = 20000000,
50 .bus_num = 0,
51 .chip_select = 0,
52 },
53};
54
55void __init lacie_v2_register_flash(void)
56{
57 spi_register_board_info(lacie_v2_spi_slave_info,
58 ARRAY_SIZE(lacie_v2_spi_slave_info));
59 kirkwood_spi_init();
60}
61
62/*****************************************************************************
63 * I2C devices
64 ****************************************************************************/
65
66static struct at24_platform_data at24c04 = {
67 .byte_len = SZ_4K / 8,
68 .page_size = 16,
69};
70
71/*
72 * i2c addr | chip | description
73 * 0x50 | HT24LC04 | eeprom (512B)
74 */
75
76static struct i2c_board_info __initdata lacie_v2_i2c_info[] = {
77 {
78 I2C_BOARD_INFO("24c04", 0x50),
79 .platform_data = &at24c04,
80 }
81};
82
83void __init lacie_v2_register_i2c_devices(void)
84{
85 kirkwood_i2c_init();
86 i2c_register_board_info(0, lacie_v2_i2c_info,
87 ARRAY_SIZE(lacie_v2_i2c_info));
88}
89
90/*****************************************************************************
91 * Hard Disk power
92 ****************************************************************************/
93
94static int __initdata lacie_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 };
95
96void __init lacie_v2_hdd_power_init(int hdd_num)
97{
98 int i;
99 int err;
100
101 /* Power up all hard disks. */
102 for (i = 0; i < hdd_num; i++) {
103 err = gpio_request(lacie_v2_gpio_hdd_power[i], NULL);
104 if (err == 0) {
105 err = gpio_direction_output(
106 lacie_v2_gpio_hdd_power[i], 1);
107 /* Free the HDD power GPIOs. This allow user-space to
108 * configure them via the gpiolib sysfs interface. */
109 gpio_free(lacie_v2_gpio_hdd_power[i]);
110 }
111 if (err)
112 pr_err("Failed to power up HDD%d\n", i + 1);
113 }
114}
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h
deleted file mode 100644
index fc64f578536e..000000000000
--- a/arch/arm/mach-kirkwood/lacie_v2-common.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.h
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#ifndef __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
10#define __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
11
12void lacie_v2_register_flash(void);
13void lacie_v2_register_i2c_devices(void);
14void lacie_v2_hdd_power_init(int hdd_num);
15
16#endif
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
deleted file mode 100644
index e96fd71abd76..000000000000
--- a/arch/arm/mach-kirkwood/mpp.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/mpp.c
3 *
4 * MPP functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <linux/gpio.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/io.h>
14#include <mach/hardware.h>
15#include <plat/mpp.h>
16#include "common.h"
17#include "mpp.h"
18
19static unsigned int __init kirkwood_variant(void)
20{
21 u32 dev, rev;
22
23 kirkwood_pcie_id(&dev, &rev);
24
25 if (dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0)
26 return MPP_F6281_MASK;
27 if (dev == MV88F6282_DEV_ID)
28 return MPP_F6282_MASK;
29 if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0)
30 return MPP_F6192_MASK;
31 if (dev == MV88F6180_DEV_ID)
32 return MPP_F6180_MASK;
33
34 pr_err("MPP setup: unknown kirkwood variant (dev %#x rev %#x)\n",
35 dev, rev);
36 return 0;
37}
38
39void __init kirkwood_mpp_conf(unsigned int *mpp_list)
40{
41 orion_mpp_conf(mpp_list, kirkwood_variant(),
42 MPP_MAX, DEV_BUS_VIRT_BASE);
43}
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h
deleted file mode 100644
index d5a0d1da2e0e..000000000000
--- a/arch/arm/mach-kirkwood/mpp.h
+++ /dev/null
@@ -1,348 +0,0 @@
1/*
2 * linux/arch/arm/mach-kirkwood/mpp.h -- Multi Purpose Pins
3 *
4 * Copyright 2009: Marvell Technology Group Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __KIRKWOOD_MPP_H
12#define __KIRKWOOD_MPP_H
13
14#define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281, _F6282) ( \
15 /* MPP number */ ((_num) & 0xff) | \
16 /* MPP select value */ (((_sel) & 0xf) << 8) | \
17 /* may be input signal */ ((!!(_in)) << 12) | \
18 /* may be output signal */ ((!!(_out)) << 13) | \
19 /* available on F6180 */ ((!!(_F6180)) << 14) | \
20 /* available on F6190 */ ((!!(_F6190)) << 15) | \
21 /* available on F6192 */ ((!!(_F6192)) << 16) | \
22 /* available on F6281 */ ((!!(_F6281)) << 17) | \
23 /* available on F6282 */ ((!!(_F6282)) << 18))
24
25 /* num sel i o 6180 6190 6192 6281 6282 */
26
27#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 )
28#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 )
29#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 )
30#define MPP_F6281_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 1, 0 )
31#define MPP_F6282_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 0, 1 )
32
33#define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1, 1 )
34#define MPP0_NF_IO2 MPP( 0, 0x1, 0, 0, 1, 1, 1, 1, 1 )
35#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 0, 1, 1, 1, 1, 1 )
36
37#define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1, 1 )
38#define MPP1_NF_IO3 MPP( 1, 0x1, 0, 0, 1, 1, 1, 1, 1 )
39#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 0, 1, 1, 1, 1, 1 )
40
41#define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1, 1 )
42#define MPP2_NF_IO4 MPP( 2, 0x1, 0, 0, 1, 1, 1, 1, 1 )
43#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 0, 1, 1, 1, 1, 1 )
44
45#define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1, 1 )
46#define MPP3_NF_IO5 MPP( 3, 0x1, 0, 0, 1, 1, 1, 1, 1 )
47#define MPP3_SPI_MISO MPP( 3, 0x2, 0, 0, 1, 1, 1, 1, 1 )
48
49#define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1, 1 )
50#define MPP4_NF_IO6 MPP( 4, 0x1, 0, 0, 1, 1, 1, 1, 1 )
51#define MPP4_UART0_RXD MPP( 4, 0x2, 0, 0, 1, 1, 1, 1, 1 )
52#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 0, 0, 0, 1, 1, 1 )
53#define MPP4_LCD_VGA_HSYNC MPP( 4, 0xb, 0, 0, 0, 0, 0, 0, 1 )
54#define MPP4_PTP_CLK MPP( 4, 0xd, 0, 0, 1, 1, 1, 1, 0 )
55
56#define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1, 1 )
57#define MPP5_NF_IO7 MPP( 5, 0x1, 0, 0, 1, 1, 1, 1, 1 )
58#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 0, 1, 1, 1, 1, 1 )
59#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 0, 1, 1, 1, 1, 0 )
60#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 0, 0, 1, 1, 1, 1 )
61#define MPP5_LCD_VGA_VSYNC MPP( 5, 0xb, 0, 0, 0, 0, 0, 0, 1 )
62
63#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 0, 1, 1, 1, 1, 1 )
64#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 0, 1, 1, 1, 1, 1 )
65#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 0, 1, 1, 1, 1, 0 )
66
67#define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1, 1 )
68#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 0, 1, 1, 1, 1, 0 )
69#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 0, 1, 1, 1, 1, 1 )
70#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 0, 1, 1, 1, 1, 0 )
71#define MPP7_LCD_PWM MPP( 7, 0xb, 0, 0, 0, 0, 0, 0, 1 )
72
73#define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1, 1 )
74#define MPP8_TW0_SDA MPP( 8, 0x1, 0, 0, 1, 1, 1, 1, 1 )
75#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 0, 1, 1, 1, 1, 1 )
76#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 0, 1, 1, 1, 1, 1 )
77#define MPP8_MII0_RXERR MPP( 8, 0x4, 0, 0, 0, 1, 1, 1, 1 )
78#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 0, 0, 0, 1, 1, 1 )
79#define MPP8_PTP_CLK MPP( 8, 0xc, 0, 0, 1, 1, 1, 1, 0 )
80#define MPP8_MII0_COL MPP( 8, 0xd, 0, 0, 1, 1, 1, 1, 1 )
81
82#define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1, 1 )
83#define MPP9_TW0_SCK MPP( 9, 0x1, 0, 0, 1, 1, 1, 1, 1 )
84#define MPP9_UART0_CTS MPP( 9, 0x2, 0, 0, 1, 1, 1, 1, 1 )
85#define MPP9_UART1_CTS MPP( 9, 0x3, 0, 0, 1, 1, 1, 1, 1 )
86#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 0, 0, 1, 1, 1, 1 )
87#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 0, 0, 1, 1, 1, 1, 0 )
88#define MPP9_MII0_CRS MPP( 9, 0xd, 0, 0, 1, 1, 1, 1, 1 )
89
90#define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1, 1 )
91#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 0, 1, 1, 1, 1, 1 )
92#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 0, 1, 1, 1, 1, 1 )
93#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 0, 0, 0, 1, 1, 1 )
94#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 0, 1, 1, 1, 1, 0 )
95
96#define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1, 1 )
97#define MPP11_SPI_MISO MPP( 11, 0x2, 0, 0, 1, 1, 1, 1, 1 )
98#define MPP11_UART0_RXD MPP( 11, 0x3, 0, 0, 1, 1, 1, 1, 1 )
99#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 0, 0, 1, 1, 1, 1, 0 )
100#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 0, 1, 1, 1, 1, 0 )
101#define MPP11_PTP_CLK MPP( 11, 0xd, 0, 0, 1, 1, 1, 1, 0 )
102#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 0, 0, 1, 1, 1, 1 )
103
104#define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1, 1 )
105#define MPP12_GPIO MPP( 12, 0x0, 1, 1, 0, 0, 0, 1, 0 )
106#define MPP12_SD_CLK MPP( 12, 0x1, 0, 0, 1, 1, 1, 1, 1 )
107#define MPP12_AU_SPDIF0 MPP( 12, 0xa, 0, 0, 0, 0, 0, 0, 1 )
108#define MPP12_SPI_MOSI MPP( 12, 0xb, 0, 0, 0, 0, 0, 0, 1 )
109#define MPP12_TW1_SDA MPP( 12, 0xd, 0, 0, 0, 0, 0, 0, 1 )
110
111#define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1, 1 )
112#define MPP13_SD_CMD MPP( 13, 0x1, 0, 0, 1, 1, 1, 1, 1 )
113#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 0, 1, 1, 1, 1, 1 )
114#define MPP13_AU_SPDIFRMCLK MPP( 13, 0xa, 0, 0, 0, 0, 0, 0, 1 )
115#define MPP13_LCDPWM MPP( 13, 0xb, 0, 0, 0, 0, 0, 0, 1 )
116
117#define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1, 1 )
118#define MPP14_SD_D0 MPP( 14, 0x1, 0, 0, 1, 1, 1, 1, 1 )
119#define MPP14_UART1_RXD MPP( 14, 0x3, 0, 0, 1, 1, 1, 1, 1 )
120#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 0, 0, 0, 1, 1, 1 )
121#define MPP14_AU_SPDIFI MPP( 14, 0xa, 0, 0, 0, 0, 0, 0, 1 )
122#define MPP14_AU_I2SDI MPP( 14, 0xb, 0, 0, 0, 0, 0, 0, 1 )
123#define MPP14_MII0_COL MPP( 14, 0xd, 0, 0, 1, 1, 1, 1, 1 )
124
125#define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1, 1 )
126#define MPP15_SD_D1 MPP( 15, 0x1, 0, 0, 1, 1, 1, 1, 1 )
127#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 0, 1, 1, 1, 1, 1 )
128#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 0, 1, 1, 1, 1, 1 )
129#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 0, 0, 1, 1, 1, 1 )
130#define MPP15_SPI_CSn MPP( 15, 0xb, 0, 0, 0, 0, 0, 0, 1 )
131
132#define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1, 1 )
133#define MPP16_SD_D2 MPP( 16, 0x1, 0, 0, 1, 1, 1, 1, 1 )
134#define MPP16_UART0_CTS MPP( 16, 0x2, 0, 0, 1, 1, 1, 1, 1 )
135#define MPP16_UART1_RXD MPP( 16, 0x3, 0, 0, 1, 1, 1, 1, 1 )
136#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 0, 0, 0, 1, 1, 1 )
137#define MPP16_LCD_EXT_REF_CLK MPP( 16, 0xb, 0, 0, 0, 0, 0, 0, 1 )
138#define MPP16_MII0_CRS MPP( 16, 0xd, 0, 0, 1, 1, 1, 1, 1 )
139
140#define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1, 1 )
141#define MPP17_SD_D3 MPP( 17, 0x1, 0, 0, 1, 1, 1, 1, 1 )
142#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 0, 0, 1, 1, 1, 1 )
143#define MPP17_SATA1_ACTn MPP( 17, 0xa, 0, 0, 0, 0, 0, 0, 1 )
144#define MPP17_TW1_SCK MPP( 17, 0xd, 0, 0, 0, 0, 0, 0, 1 )
145
146#define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1, 1 )
147#define MPP18_NF_IO0 MPP( 18, 0x1, 0, 0, 1, 1, 1, 1, 1 )
148#define MPP18_PEX0_CLKREQ MPP( 18, 0x2, 0, 0, 0, 0, 0, 0, 1 )
149
150#define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1, 1 )
151#define MPP19_NF_IO1 MPP( 19, 0x1, 0, 0, 1, 1, 1, 1, 1 )
152
153#define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1, 1 )
154#define MPP20_TSMP0 MPP( 20, 0x1, 0, 0, 0, 0, 1, 1, 1 )
155#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 0, 0, 0, 1, 1, 1 )
156#define MPP20_GE1_TXD0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1, 1 )
157#define MPP20_AU_SPDIFI MPP( 20, 0x4, 0, 0, 0, 0, 1, 1, 1 )
158#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 0, 0, 0, 1, 1, 1 )
159#define MPP20_LCD_D0 MPP( 20, 0xb, 0, 0, 0, 0, 0, 0, 1 )
160
161#define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1, 1 )
162#define MPP21_TSMP1 MPP( 21, 0x1, 0, 0, 0, 0, 1, 1, 1 )
163#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 0, 0, 0, 1, 1, 1 )
164#define MPP21_GE1_TXD1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1, 1 )
165#define MPP21_AU_SPDIFO MPP( 21, 0x4, 0, 0, 0, 0, 1, 1, 1 )
166#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 0, 0, 1, 1, 1, 1 )
167#define MPP21_LCD_D1 MPP( 21, 0xb, 0, 0, 0, 0, 0, 0, 1 )
168
169#define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1, 1 )
170#define MPP22_TSMP2 MPP( 22, 0x1, 0, 0, 0, 0, 1, 1, 1 )
171#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 0, 0, 0, 1, 1, 1 )
172#define MPP22_GE1_TXD2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1, 1 )
173#define MPP22_AU_SPDIFRMKCLK MPP( 22, 0x4, 0, 0, 0, 0, 1, 1, 1 )
174#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 0, 0, 0, 1, 1, 1 )
175#define MPP22_LCD_D2 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
176
177#define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1, 1 )
178#define MPP23_TSMP3 MPP( 23, 0x1, 0, 0, 0, 0, 1, 1, 1 )
179#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 0, 0, 0, 0, 1, 1, 1 )
180#define MPP23_GE1_TXD3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1, 1 )
181#define MPP23_AU_I2SBCLK MPP( 23, 0x4, 0, 0, 0, 0, 1, 1, 1 )
182#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 0, 0, 1, 1, 1, 1 )
183#define MPP23_LCD_D3 MPP( 23, 0xb, 0, 0, 0, 0, 0, 0, 1 )
184
185#define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1, 1 )
186#define MPP24_TSMP4 MPP( 24, 0x1, 0, 0, 0, 0, 1, 1, 1 )
187#define MPP24_TDM_SPI_CS0 MPP( 24, 0x2, 0, 0, 0, 0, 1, 1, 1 )
188#define MPP24_GE1_RXD0 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1, 1 )
189#define MPP24_AU_I2SDO MPP( 24, 0x4, 0, 0, 0, 0, 1, 1, 1 )
190#define MPP24_LCD_D4 MPP( 24, 0xb, 0, 0, 0, 0, 0, 0, 1 )
191
192#define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1, 1 )
193#define MPP25_TSMP5 MPP( 25, 0x1, 0, 0, 0, 0, 1, 1, 1 )
194#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 0, 0, 0, 1, 1, 1 )
195#define MPP25_GE1_RXD1 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1, 1 )
196#define MPP25_AU_I2SLRCLK MPP( 25, 0x4, 0, 0, 0, 0, 1, 1, 1 )
197#define MPP25_LCD_D5 MPP( 25, 0xb, 0, 0, 0, 0, 0, 0, 1 )
198
199#define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1, 1 )
200#define MPP26_TSMP6 MPP( 26, 0x1, 0, 0, 0, 0, 1, 1, 1 )
201#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 0, 0, 0, 0, 1, 1, 1 )
202#define MPP26_GE1_RXD2 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1, 1 )
203#define MPP26_AU_I2SMCLK MPP( 26, 0x4, 0, 0, 0, 0, 1, 1, 1 )
204#define MPP26_LCD_D6 MPP( 26, 0xb, 0, 0, 0, 0, 0, 0, 1 )
205
206#define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1, 1 )
207#define MPP27_TSMP7 MPP( 27, 0x1, 0, 0, 0, 0, 1, 1, 1 )
208#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 0, 0, 0, 1, 1, 1 )
209#define MPP27_GE1_RXD3 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1, 1 )
210#define MPP27_AU_I2SDI MPP( 27, 0x4, 0, 0, 0, 0, 1, 1, 1 )
211#define MPP27_LCD_D7 MPP( 27, 0xb, 0, 0, 0, 0, 0, 0, 1 )
212
213#define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1, 1 )
214#define MPP28_TSMP8 MPP( 28, 0x1, 0, 0, 0, 0, 1, 1, 1 )
215#define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1, 1 )
216#define MPP28_GE1_COL MPP( 28, 0x3, 0, 0, 0, 1, 1, 1, 1 )
217#define MPP28_AU_EXTCLK MPP( 28, 0x4, 0, 0, 0, 0, 1, 1, 1 )
218#define MPP28_LCD_D8 MPP( 28, 0xb, 0, 0, 0, 0, 0, 0, 1 )
219
220#define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1, 1 )
221#define MPP29_TSMP9 MPP( 29, 0x1, 0, 0, 0, 0, 1, 1, 1 )
222#define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1, 1 )
223#define MPP29_GE1_TCLK MPP( 29, 0x3, 0, 0, 0, 1, 1, 1, 1 )
224#define MPP29_LCD_D9 MPP( 29, 0xb, 0, 0, 0, 0, 0, 0, 1 )
225
226#define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1, 1 )
227#define MPP30_TSMP10 MPP( 30, 0x1, 0, 0, 0, 0, 1, 1, 1 )
228#define MPP30_TDM_PCLK MPP( 30, 0x2, 0, 0, 0, 0, 1, 1, 1 )
229#define MPP30_GE1_RXCTL MPP( 30, 0x3, 0, 0, 0, 1, 1, 1, 1 )
230#define MPP30_LCD_D10 MPP( 30, 0xb, 0, 0, 0, 0, 0, 0, 1 )
231
232#define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1, 1 )
233#define MPP31_TSMP11 MPP( 31, 0x1, 0, 0, 0, 0, 1, 1, 1 )
234#define MPP31_TDM_FS MPP( 31, 0x2, 0, 0, 0, 0, 1, 1, 1 )
235#define MPP31_GE1_RXCLK MPP( 31, 0x3, 0, 0, 0, 1, 1, 1, 1 )
236#define MPP31_LCD_D11 MPP( 31, 0xb, 0, 0, 0, 0, 0, 0, 1 )
237
238#define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1, 1 )
239#define MPP32_TSMP12 MPP( 32, 0x1, 0, 0, 0, 0, 1, 1, 1 )
240#define MPP32_TDM_DRX MPP( 32, 0x2, 0, 0, 0, 0, 1, 1, 1 )
241#define MPP32_GE1_TCLKOUT MPP( 32, 0x3, 0, 0, 0, 1, 1, 1, 1 )
242#define MPP32_LCD_D12 MPP( 32, 0xb, 0, 0, 0, 0, 0, 0, 1 )
243
244#define MPP33_GPO MPP( 33, 0x0, 0, 1, 0, 1, 1, 1, 1 )
245#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 0, 0, 0, 1, 1, 1 )
246#define MPP33_GE1_TXCTL MPP( 33, 0x3, 0, 0, 0, 1, 1, 1, 1 )
247#define MPP33_LCD_D13 MPP( 33, 0xb, 0, 0, 0, 0, 0, 0, 1 )
248
249#define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1, 1 )
250#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 0, 0, 0, 1, 1, 1 )
251#define MPP34_GE1_TXEN MPP( 34, 0x3, 0, 0, 0, 1, 1, 1, 1 )
252#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 0, 0, 0, 0, 1, 1 )
253#define MPP34_LCD_D14 MPP( 34, 0xb, 0, 0, 0, 0, 0, 0, 1 )
254
255#define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1, 1 )
256#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 0, 0, 0, 1, 1, 1 )
257#define MPP35_GE1_RXERR MPP( 35, 0x3, 0, 0, 0, 1, 1, 1, 1 )
258#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 0, 0, 1, 1, 1, 1 )
259#define MPP35_LCD_D15 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
260#define MPP35_MII0_RXERR MPP( 35, 0xc, 0, 0, 1, 1, 1, 1, 1 )
261
262#define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1, 1 )
263#define MPP36_TSMP0 MPP( 36, 0x1, 0, 0, 0, 0, 0, 1, 1 )
264#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 0, 0, 0, 0, 1, 1 )
265#define MPP36_AU_SPDIFI MPP( 36, 0x4, 0, 0, 1, 0, 0, 1, 1 )
266#define MPP36_TW1_SDA MPP( 36, 0xb, 0, 0, 0, 0, 0, 0, 1 )
267
268#define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1, 1 )
269#define MPP37_TSMP1 MPP( 37, 0x1, 0, 0, 0, 0, 0, 1, 1 )
270#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 0, 0, 0, 0, 1, 1 )
271#define MPP37_AU_SPDIFO MPP( 37, 0x4, 0, 0, 1, 0, 0, 1, 1 )
272#define MPP37_TW1_SCK MPP( 37, 0xb, 0, 0, 0, 0, 0, 0, 1 )
273
274#define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1, 1 )
275#define MPP38_TSMP2 MPP( 38, 0x1, 0, 0, 0, 0, 0, 1, 1 )
276#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 0, 0, 0, 0, 1, 1 )
277#define MPP38_AU_SPDIFRMLCLK MPP( 38, 0x4, 0, 0, 1, 0, 0, 1, 1 )
278#define MPP38_LCD_D18 MPP( 38, 0xb, 0, 0, 0, 0, 0, 0, 1 )
279
280#define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1, 1 )
281#define MPP39_TSMP3 MPP( 39, 0x1, 0, 0, 0, 0, 0, 1, 1 )
282#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 0, 0, 0, 0, 1, 1 )
283#define MPP39_AU_I2SBCLK MPP( 39, 0x4, 0, 0, 1, 0, 0, 1, 1 )
284#define MPP39_LCD_D19 MPP( 39, 0xb, 0, 0, 0, 0, 0, 0, 1 )
285
286#define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1, 1 )
287#define MPP40_TSMP4 MPP( 40, 0x1, 0, 0, 0, 0, 0, 1, 1 )
288#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 0, 0, 0, 0, 1, 1 )
289#define MPP40_AU_I2SDO MPP( 40, 0x4, 0, 0, 1, 0, 0, 1, 1 )
290#define MPP40_LCD_D20 MPP( 40, 0xb, 0, 0, 0, 0, 0, 0, 1 )
291
292#define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1, 1 )
293#define MPP41_TSMP5 MPP( 41, 0x1, 0, 0, 0, 0, 0, 1, 1 )
294#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 0, 0, 0, 0, 0, 1, 1 )
295#define MPP41_AU_I2SLRCLK MPP( 41, 0x4, 0, 0, 1, 0, 0, 1, 1 )
296#define MPP41_LCD_D21 MPP( 41, 0xb, 0, 0, 0, 0, 0, 0, 1 )
297
298#define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1, 1 )
299#define MPP42_TSMP6 MPP( 42, 0x1, 0, 0, 0, 0, 0, 1, 1 )
300#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 0, 0, 0, 0, 1, 1 )
301#define MPP42_AU_I2SMCLK MPP( 42, 0x4, 0, 0, 1, 0, 0, 1, 1 )
302#define MPP42_LCD_D22 MPP( 42, 0xb, 0, 0, 0, 0, 0, 0, 1 )
303
304#define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1, 1 )
305#define MPP43_TSMP7 MPP( 43, 0x1, 0, 0, 0, 0, 0, 1, 1 )
306#define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1, 1 )
307#define MPP43_AU_I2SDI MPP( 43, 0x4, 0, 0, 1, 0, 0, 1, 1 )
308#define MPP43_LCD_D23 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
309
310#define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1, 1 )
311#define MPP44_TSMP8 MPP( 44, 0x1, 0, 0, 0, 0, 0, 1, 1 )
312#define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1, 1 )
313#define MPP44_AU_EXTCLK MPP( 44, 0x4, 0, 0, 1, 0, 0, 1, 1 )
314#define MPP44_LCD_CLK MPP( 44, 0xb, 0, 0, 0, 0, 0, 0, 1 )
315
316#define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1, 1 )
317#define MPP45_TSMP9 MPP( 45, 0x1, 0, 0, 0, 0, 0, 1, 1 )
318#define MPP45_TDM_PCLK MPP( 45, 0x2, 0, 0, 0, 0, 0, 1, 1 )
319#define MPP245_LCD_E MPP( 45, 0xb, 0, 0, 0, 0, 0, 0, 1 )
320
321#define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1, 1 )
322#define MPP46_TSMP10 MPP( 46, 0x1, 0, 0, 0, 0, 0, 1, 1 )
323#define MPP46_TDM_FS MPP( 46, 0x2, 0, 0, 0, 0, 0, 1, 1 )
324#define MPP46_LCD_HSYNC MPP( 46, 0xb, 0, 0, 0, 0, 0, 0, 1 )
325
326#define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1, 1 )
327#define MPP47_TSMP11 MPP( 47, 0x1, 0, 0, 0, 0, 0, 1, 1 )
328#define MPP47_TDM_DRX MPP( 47, 0x2, 0, 0, 0, 0, 0, 1, 1 )
329#define MPP47_LCD_VSYNC MPP( 47, 0xb, 0, 0, 0, 0, 0, 0, 1 )
330
331#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1, 1 )
332#define MPP48_TSMP12 MPP( 48, 0x1, 0, 0, 0, 0, 0, 1, 1 )
333#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 0, 0, 0, 0, 1, 1 )
334#define MPP48_LCD_D16 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
335
336#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1, 0 )
337#define MPP49_GPO MPP( 49, 0x0, 0, 1, 0, 0, 0, 0, 1 )
338#define MPP49_TSMP9 MPP( 49, 0x1, 0, 0, 0, 0, 0, 1, 0 )
339#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 0, 0, 0, 0, 1, 1 )
340#define MPP49_PTP_CLK MPP( 49, 0x5, 0, 0, 0, 0, 0, 1, 0 )
341#define MPP49_PEX0_CLKREQ MPP( 49, 0xa, 0, 0, 0, 0, 0, 0, 1 )
342#define MPP49_LCD_D17 MPP( 49, 0xb, 0, 0, 0, 0, 0, 0, 1 )
343
344#define MPP_MAX 49
345
346void kirkwood_mpp_conf(unsigned int *mpp_list);
347
348#endif
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
deleted file mode 100644
index 913d032cdb19..000000000000
--- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c
+++ /dev/null
@@ -1,422 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/netxbig_v2-setup.c
3 *
4 * LaCie 2Big and 5Big Network v2 board setup
5 *
6 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.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/kernel.h>
24#include <linux/init.h>
25#include <linux/platform_device.h>
26#include <linux/ata_platform.h>
27#include <linux/mv643xx_eth.h>
28#include <linux/input.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/leds.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/kirkwood.h>
35#include <linux/platform_data/leds-kirkwood-netxbig.h>
36#include "common.h"
37#include "mpp.h"
38#include "lacie_v2-common.h"
39
40/*****************************************************************************
41 * Ethernet
42 ****************************************************************************/
43
44static struct mv643xx_eth_platform_data netxbig_v2_ge00_data = {
45 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
46};
47
48static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = {
49 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
50};
51
52/*****************************************************************************
53 * SATA
54 ****************************************************************************/
55
56static struct mv_sata_platform_data netxbig_v2_sata_data = {
57 .n_ports = 2,
58};
59
60/*****************************************************************************
61 * GPIO keys
62 ****************************************************************************/
63
64#define NETXBIG_V2_GPIO_SWITCH_POWER_ON 13
65#define NETXBIG_V2_GPIO_SWITCH_POWER_OFF 15
66#define NETXBIG_V2_GPIO_FUNC_BUTTON 34
67
68#define NETXBIG_V2_SWITCH_POWER_ON 0x1
69#define NETXBIG_V2_SWITCH_POWER_OFF 0x2
70
71static struct gpio_keys_button netxbig_v2_buttons[] = {
72 [0] = {
73 .type = EV_SW,
74 .code = NETXBIG_V2_SWITCH_POWER_ON,
75 .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_ON,
76 .desc = "Back power switch (on|auto)",
77 .active_low = 1,
78 },
79 [1] = {
80 .type = EV_SW,
81 .code = NETXBIG_V2_SWITCH_POWER_OFF,
82 .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_OFF,
83 .desc = "Back power switch (auto|off)",
84 .active_low = 1,
85 },
86 [2] = {
87 .code = KEY_OPTION,
88 .gpio = NETXBIG_V2_GPIO_FUNC_BUTTON,
89 .desc = "Function button",
90 .active_low = 1,
91 },
92};
93
94static struct gpio_keys_platform_data netxbig_v2_button_data = {
95 .buttons = netxbig_v2_buttons,
96 .nbuttons = ARRAY_SIZE(netxbig_v2_buttons),
97};
98
99static struct platform_device netxbig_v2_gpio_buttons = {
100 .name = "gpio-keys",
101 .id = -1,
102 .dev = {
103 .platform_data = &netxbig_v2_button_data,
104 },
105};
106
107/*****************************************************************************
108 * GPIO extension LEDs
109 ****************************************************************************/
110
111/*
112 * The LEDs are controlled by a CPLD and can be configured through a GPIO
113 * extension bus:
114 *
115 * - address register : bit [0-2] -> GPIO [47-49]
116 * - data register : bit [0-2] -> GPIO [44-46]
117 * - enable register : GPIO 29
118 */
119
120static int netxbig_v2_gpio_ext_addr[] = { 47, 48, 49 };
121static int netxbig_v2_gpio_ext_data[] = { 44, 45, 46 };
122
123static struct netxbig_gpio_ext netxbig_v2_gpio_ext = {
124 .addr = netxbig_v2_gpio_ext_addr,
125 .num_addr = ARRAY_SIZE(netxbig_v2_gpio_ext_addr),
126 .data = netxbig_v2_gpio_ext_data,
127 .num_data = ARRAY_SIZE(netxbig_v2_gpio_ext_data),
128 .enable = 29,
129};
130
131/*
132 * Address register selection:
133 *
134 * addr | register
135 * ----------------------------
136 * 0 | front LED
137 * 1 | front LED brightness
138 * 2 | SATA LED brightness
139 * 3 | SATA0 LED
140 * 4 | SATA1 LED
141 * 5 | SATA2 LED
142 * 6 | SATA3 LED
143 * 7 | SATA4 LED
144 *
145 * Data register configuration:
146 *
147 * data | LED brightness
148 * -------------------------------------------------
149 * 0 | min (off)
150 * - | -
151 * 7 | max
152 *
153 * data | front LED mode
154 * -------------------------------------------------
155 * 0 | fix off
156 * 1 | fix blue on
157 * 2 | fix red on
158 * 3 | blink blue on=1 sec and blue off=1 sec
159 * 4 | blink red on=1 sec and red off=1 sec
160 * 5 | blink blue on=2.5 sec and red on=0.5 sec
161 * 6 | blink blue on=1 sec and red on=1 sec
162 * 7 | blink blue on=0.5 sec and blue off=2.5 sec
163 *
164 * data | SATA LED mode
165 * -------------------------------------------------
166 * 0 | fix off
167 * 1 | SATA activity blink
168 * 2 | fix red on
169 * 3 | blink blue on=1 sec and blue off=1 sec
170 * 4 | blink red on=1 sec and red off=1 sec
171 * 5 | blink blue on=2.5 sec and red on=0.5 sec
172 * 6 | blink blue on=1 sec and red on=1 sec
173 * 7 | fix blue on
174 */
175
176static int netxbig_v2_red_mled[NETXBIG_LED_MODE_NUM] = {
177 [NETXBIG_LED_OFF] = 0,
178 [NETXBIG_LED_ON] = 2,
179 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
180 [NETXBIG_LED_TIMER1] = 4,
181 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
182};
183
184static int netxbig_v2_blue_pwr_mled[NETXBIG_LED_MODE_NUM] = {
185 [NETXBIG_LED_OFF] = 0,
186 [NETXBIG_LED_ON] = 1,
187 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
188 [NETXBIG_LED_TIMER1] = 3,
189 [NETXBIG_LED_TIMER2] = 7,
190};
191
192static int netxbig_v2_blue_sata_mled[NETXBIG_LED_MODE_NUM] = {
193 [NETXBIG_LED_OFF] = 0,
194 [NETXBIG_LED_ON] = 7,
195 [NETXBIG_LED_SATA] = 1,
196 [NETXBIG_LED_TIMER1] = 3,
197 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
198};
199
200static struct netxbig_led_timer netxbig_v2_led_timer[] = {
201 [0] = {
202 .delay_on = 500,
203 .delay_off = 500,
204 .mode = NETXBIG_LED_TIMER1,
205 },
206 [1] = {
207 .delay_on = 500,
208 .delay_off = 1000,
209 .mode = NETXBIG_LED_TIMER2,
210 },
211};
212
213#define NETXBIG_LED(_name, maddr, mval, baddr) \
214 { .name = _name, \
215 .mode_addr = maddr, \
216 .mode_val = mval, \
217 .bright_addr = baddr }
218
219static struct netxbig_led net2big_v2_leds_ctrl[] = {
220 NETXBIG_LED("net2big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
221 NETXBIG_LED("net2big-v2:red:power", 0, netxbig_v2_red_mled, 1),
222 NETXBIG_LED("net2big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
223 NETXBIG_LED("net2big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
224 NETXBIG_LED("net2big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
225 NETXBIG_LED("net2big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
226};
227
228static struct netxbig_led_platform_data net2big_v2_leds_data = {
229 .gpio_ext = &netxbig_v2_gpio_ext,
230 .timer = netxbig_v2_led_timer,
231 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
232 .leds = net2big_v2_leds_ctrl,
233 .num_leds = ARRAY_SIZE(net2big_v2_leds_ctrl),
234};
235
236static struct netxbig_led net5big_v2_leds_ctrl[] = {
237 NETXBIG_LED("net5big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
238 NETXBIG_LED("net5big-v2:red:power", 0, netxbig_v2_red_mled, 1),
239 NETXBIG_LED("net5big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
240 NETXBIG_LED("net5big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
241 NETXBIG_LED("net5big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
242 NETXBIG_LED("net5big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
243 NETXBIG_LED("net5big-v2:blue:sata2", 5, netxbig_v2_blue_sata_mled, 2),
244 NETXBIG_LED("net5big-v2:red:sata2", 5, netxbig_v2_red_mled, 2),
245 NETXBIG_LED("net5big-v2:blue:sata3", 6, netxbig_v2_blue_sata_mled, 2),
246 NETXBIG_LED("net5big-v2:red:sata3", 6, netxbig_v2_red_mled, 2),
247 NETXBIG_LED("net5big-v2:blue:sata4", 7, netxbig_v2_blue_sata_mled, 2),
248 NETXBIG_LED("net5big-v2:red:sata5", 7, netxbig_v2_red_mled, 2),
249};
250
251static struct netxbig_led_platform_data net5big_v2_leds_data = {
252 .gpio_ext = &netxbig_v2_gpio_ext,
253 .timer = netxbig_v2_led_timer,
254 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
255 .leds = net5big_v2_leds_ctrl,
256 .num_leds = ARRAY_SIZE(net5big_v2_leds_ctrl),
257};
258
259static struct platform_device netxbig_v2_leds = {
260 .name = "leds-netxbig",
261 .id = -1,
262 .dev = {
263 .platform_data = &net2big_v2_leds_data,
264 },
265};
266
267/*****************************************************************************
268 * General Setup
269 ****************************************************************************/
270
271static unsigned int net2big_v2_mpp_config[] __initdata = {
272 MPP0_SPI_SCn,
273 MPP1_SPI_MOSI,
274 MPP2_SPI_SCK,
275 MPP3_SPI_MISO,
276 MPP6_SYSRST_OUTn,
277 MPP7_GPO, /* Request power-off */
278 MPP8_TW0_SDA,
279 MPP9_TW0_SCK,
280 MPP10_UART0_TXD,
281 MPP11_UART0_RXD,
282 MPP13_GPIO, /* Rear power switch (on|auto) */
283 MPP14_GPIO, /* USB fuse alarm */
284 MPP15_GPIO, /* Rear power switch (auto|off) */
285 MPP16_GPIO, /* SATA HDD1 power */
286 MPP17_GPIO, /* SATA HDD2 power */
287 MPP20_SATA1_ACTn,
288 MPP21_SATA0_ACTn,
289 MPP24_GPIO, /* USB mode select */
290 MPP26_GPIO, /* USB device vbus */
291 MPP28_GPIO, /* USB enable host vbus */
292 MPP29_GPIO, /* GPIO extension ALE */
293 MPP34_GPIO, /* Rear Push button */
294 MPP35_GPIO, /* Inhibit switch power-off */
295 MPP36_GPIO, /* SATA HDD1 presence */
296 MPP37_GPIO, /* SATA HDD2 presence */
297 MPP40_GPIO, /* eSATA presence */
298 MPP44_GPIO, /* GPIO extension (data 0) */
299 MPP45_GPIO, /* GPIO extension (data 1) */
300 MPP46_GPIO, /* GPIO extension (data 2) */
301 MPP47_GPIO, /* GPIO extension (addr 0) */
302 MPP48_GPIO, /* GPIO extension (addr 1) */
303 MPP49_GPIO, /* GPIO extension (addr 2) */
304 0
305};
306
307static unsigned int net5big_v2_mpp_config[] __initdata = {
308 MPP0_SPI_SCn,
309 MPP1_SPI_MOSI,
310 MPP2_SPI_SCK,
311 MPP3_SPI_MISO,
312 MPP6_SYSRST_OUTn,
313 MPP7_GPO, /* Request power-off */
314 MPP8_TW0_SDA,
315 MPP9_TW0_SCK,
316 MPP10_UART0_TXD,
317 MPP11_UART0_RXD,
318 MPP13_GPIO, /* Rear power switch (on|auto) */
319 MPP14_GPIO, /* USB fuse alarm */
320 MPP15_GPIO, /* Rear power switch (auto|off) */
321 MPP16_GPIO, /* SATA HDD1 power */
322 MPP17_GPIO, /* SATA HDD2 power */
323 MPP20_GE1_TXD0,
324 MPP21_GE1_TXD1,
325 MPP22_GE1_TXD2,
326 MPP23_GE1_TXD3,
327 MPP24_GE1_RXD0,
328 MPP25_GE1_RXD1,
329 MPP26_GE1_RXD2,
330 MPP27_GE1_RXD3,
331 MPP28_GPIO, /* USB enable host vbus */
332 MPP29_GPIO, /* GPIO extension ALE */
333 MPP30_GE1_RXCTL,
334 MPP31_GE1_RXCLK,
335 MPP32_GE1_TCLKOUT,
336 MPP33_GE1_TXCTL,
337 MPP34_GPIO, /* Rear Push button */
338 MPP35_GPIO, /* Inhibit switch power-off */
339 MPP36_GPIO, /* SATA HDD1 presence */
340 MPP37_GPIO, /* SATA HDD2 presence */
341 MPP38_GPIO, /* SATA HDD3 presence */
342 MPP39_GPIO, /* SATA HDD4 presence */
343 MPP40_GPIO, /* SATA HDD5 presence */
344 MPP41_GPIO, /* SATA HDD3 power */
345 MPP42_GPIO, /* SATA HDD4 power */
346 MPP43_GPIO, /* SATA HDD5 power */
347 MPP44_GPIO, /* GPIO extension (data 0) */
348 MPP45_GPIO, /* GPIO extension (data 1) */
349 MPP46_GPIO, /* GPIO extension (data 2) */
350 MPP47_GPIO, /* GPIO extension (addr 0) */
351 MPP48_GPIO, /* GPIO extension (addr 1) */
352 MPP49_GPIO, /* GPIO extension (addr 2) */
353 0
354};
355
356#define NETXBIG_V2_GPIO_POWER_OFF 7
357
358static void netxbig_v2_power_off(void)
359{
360 gpio_set_value(NETXBIG_V2_GPIO_POWER_OFF, 1);
361}
362
363static void __init netxbig_v2_init(void)
364{
365 /*
366 * Basic setup. Needs to be called early.
367 */
368 kirkwood_init();
369 if (machine_is_net2big_v2())
370 kirkwood_mpp_conf(net2big_v2_mpp_config);
371 else
372 kirkwood_mpp_conf(net5big_v2_mpp_config);
373
374 if (machine_is_net2big_v2())
375 lacie_v2_hdd_power_init(2);
376 else
377 lacie_v2_hdd_power_init(5);
378
379 kirkwood_ehci_init();
380 kirkwood_ge00_init(&netxbig_v2_ge00_data);
381 if (machine_is_net5big_v2())
382 kirkwood_ge01_init(&netxbig_v2_ge01_data);
383 kirkwood_sata_init(&netxbig_v2_sata_data);
384 kirkwood_uart0_init();
385 lacie_v2_register_flash();
386 lacie_v2_register_i2c_devices();
387
388 if (machine_is_net5big_v2())
389 netxbig_v2_leds.dev.platform_data = &net5big_v2_leds_data;
390 platform_device_register(&netxbig_v2_leds);
391 platform_device_register(&netxbig_v2_gpio_buttons);
392
393 if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 &&
394 gpio_direction_output(NETXBIG_V2_GPIO_POWER_OFF, 0) == 0)
395 pm_power_off = netxbig_v2_power_off;
396 else
397 pr_err("netxbig_v2: failed to configure power-off GPIO\n");
398}
399
400#ifdef CONFIG_MACH_NET2BIG_V2
401MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2")
402 .atag_offset = 0x100,
403 .init_machine = netxbig_v2_init,
404 .map_io = kirkwood_map_io,
405 .init_early = kirkwood_init_early,
406 .init_irq = kirkwood_init_irq,
407 .init_time = kirkwood_timer_init,
408 .restart = kirkwood_restart,
409MACHINE_END
410#endif
411
412#ifdef CONFIG_MACH_NET5BIG_V2
413MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2")
414 .atag_offset = 0x100,
415 .init_machine = netxbig_v2_init,
416 .map_io = kirkwood_map_io,
417 .init_early = kirkwood_init_early,
418 .init_irq = kirkwood_init_irq,
419 .init_time = kirkwood_timer_init,
420 .restart = kirkwood_restart,
421MACHINE_END
422#endif
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
deleted file mode 100644
index e5cf84103583..000000000000
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/openrd-setup.c
3 *
4 * Marvell OpenRD (Base|Client|Ultimate) Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/nand.h>
15#include <linux/mtd/partitions.h>
16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/i2c.h>
19#include <linux/gpio.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <mach/kirkwood.h>
23#include <linux/platform_data/mmc-mvsdio.h>
24#include "common.h"
25#include "mpp.h"
26
27static struct mtd_partition openrd_nand_parts[] = {
28 {
29 .name = "u-boot",
30 .offset = 0,
31 .size = SZ_1M,
32 .mask_flags = MTD_WRITEABLE
33 }, {
34 .name = "uImage",
35 .offset = MTDPART_OFS_NXTBLK,
36 .size = SZ_4M
37 }, {
38 .name = "root",
39 .offset = MTDPART_OFS_NXTBLK,
40 .size = MTDPART_SIZ_FULL
41 },
42};
43
44static struct mv643xx_eth_platform_data openrd_ge00_data = {
45 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
46};
47
48static struct mv643xx_eth_platform_data openrd_ge01_data = {
49 .phy_addr = MV643XX_ETH_PHY_ADDR(24),
50};
51
52static struct mv_sata_platform_data openrd_sata_data = {
53 .n_ports = 2,
54};
55
56static struct mvsdio_platform_data openrd_mvsdio_data = {
57 .gpio_card_detect = 29, /* MPP29 used as SD card detect */
58 .gpio_write_protect = -1,
59};
60
61static unsigned int openrd_mpp_config[] __initdata = {
62 MPP12_SD_CLK,
63 MPP13_SD_CMD,
64 MPP14_SD_D0,
65 MPP15_SD_D1,
66 MPP16_SD_D2,
67 MPP17_SD_D3,
68 MPP28_GPIO,
69 MPP29_GPIO,
70 MPP34_GPIO,
71 0
72};
73
74/* Configure MPP for UART1 */
75static unsigned int openrd_uart1_mpp_config[] __initdata = {
76 MPP13_UART1_TXD,
77 MPP14_UART1_RXD,
78 0
79};
80
81static struct i2c_board_info i2c_board_info[] __initdata = {
82 {
83 I2C_BOARD_INFO("cs42l51", 0x4a),
84 },
85};
86
87static struct platform_device openrd_client_audio_device = {
88 .name = "openrd-client-audio",
89 .id = -1,
90};
91
92static int __initdata uart1;
93
94static int __init sd_uart_selection(char *str)
95{
96 uart1 = -EINVAL;
97
98 /* Default is SD. Change if required, for UART */
99 if (!str)
100 return 0;
101
102 if (!strncmp(str, "232", 3)) {
103 uart1 = 232;
104 } else if (!strncmp(str, "485", 3)) {
105 /* OpenRD-Base doesn't have RS485. Treat is as an
106 * unknown argument & just have default setting -
107 * which is SD */
108 if (machine_is_openrd_base()) {
109 uart1 = -ENODEV;
110 return 1;
111 }
112
113 uart1 = 485;
114 }
115 return 1;
116}
117/* Parse boot_command_line string kw_openrd_init_uart1=232/485 */
118__setup("kw_openrd_init_uart1=", sd_uart_selection);
119
120static int __init uart1_mpp_config(void)
121{
122 kirkwood_mpp_conf(openrd_uart1_mpp_config);
123
124 if (gpio_request(34, "SD_UART1_SEL")) {
125 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
126 return -EIO;
127 }
128
129 if (gpio_request(28, "RS232_RS485_SEL")) {
130 pr_err("GPIO request 28 failed for RS232/RS485 selection\n");
131 gpio_free(34);
132 return -EIO;
133 }
134
135 /* Select UART1
136 * Pin # 34: 0 => UART1, 1 => SD */
137 gpio_direction_output(34, 0);
138
139 /* Select RS232 OR RS485
140 * Pin # 28: 0 => RS232, 1 => RS485 */
141 if (uart1 == 232)
142 gpio_direction_output(28, 0);
143 else
144 gpio_direction_output(28, 1);
145
146 gpio_free(34);
147 gpio_free(28);
148
149 return 0;
150}
151
152static void __init openrd_init(void)
153{
154 /*
155 * Basic setup. Needs to be called early.
156 */
157 kirkwood_init();
158 kirkwood_mpp_conf(openrd_mpp_config);
159
160 kirkwood_uart0_init();
161 kirkwood_nand_init(openrd_nand_parts, ARRAY_SIZE(openrd_nand_parts),
162 25);
163
164 kirkwood_ehci_init();
165
166 if (machine_is_openrd_ultimate()) {
167 openrd_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
168 openrd_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
169 }
170
171 kirkwood_ge00_init(&openrd_ge00_data);
172 if (!machine_is_openrd_base())
173 kirkwood_ge01_init(&openrd_ge01_data);
174
175 kirkwood_sata_init(&openrd_sata_data);
176
177 kirkwood_i2c_init();
178
179 if (machine_is_openrd_client() || machine_is_openrd_ultimate()) {
180 platform_device_register(&openrd_client_audio_device);
181 i2c_register_board_info(0, i2c_board_info,
182 ARRAY_SIZE(i2c_board_info));
183 kirkwood_audio_init();
184 }
185
186 if (uart1 <= 0) {
187 if (uart1 < 0)
188 pr_err("Invalid kernel parameter to select UART1. Defaulting to SD. ERROR CODE: %d\n",
189 uart1);
190
191 /* Select SD
192 * Pin # 34: 0 => UART1, 1 => SD */
193 if (gpio_request(34, "SD_UART1_SEL")) {
194 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
195 } else {
196
197 gpio_direction_output(34, 1);
198 gpio_free(34);
199 kirkwood_sdio_init(&openrd_mvsdio_data);
200 }
201 } else {
202 if (!uart1_mpp_config())
203 kirkwood_uart1_init();
204 }
205}
206
207static int __init openrd_pci_init(void)
208{
209 if (machine_is_openrd_base() ||
210 machine_is_openrd_client() ||
211 machine_is_openrd_ultimate())
212 kirkwood_pcie_init(KW_PCIE0);
213
214 return 0;
215}
216subsys_initcall(openrd_pci_init);
217
218#ifdef CONFIG_MACH_OPENRD_BASE
219MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
220 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
221 .atag_offset = 0x100,
222 .init_machine = openrd_init,
223 .map_io = kirkwood_map_io,
224 .init_early = kirkwood_init_early,
225 .init_irq = kirkwood_init_irq,
226 .init_time = kirkwood_timer_init,
227 .restart = kirkwood_restart,
228MACHINE_END
229#endif
230
231#ifdef CONFIG_MACH_OPENRD_CLIENT
232MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
233 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
234 .atag_offset = 0x100,
235 .init_machine = openrd_init,
236 .map_io = kirkwood_map_io,
237 .init_early = kirkwood_init_early,
238 .init_irq = kirkwood_init_irq,
239 .init_time = kirkwood_timer_init,
240 .restart = kirkwood_restart,
241MACHINE_END
242#endif
243
244#ifdef CONFIG_MACH_OPENRD_ULTIMATE
245MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
246 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
247 .atag_offset = 0x100,
248 .init_machine = openrd_init,
249 .map_io = kirkwood_map_io,
250 .init_early = kirkwood_init_early,
251 .init_irq = kirkwood_init_irq,
252 .init_time = kirkwood_timer_init,
253 .restart = kirkwood_restart,
254MACHINE_END
255#endif
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
deleted file mode 100644
index 12d86f39f380..000000000000
--- a/arch/arm/mach-kirkwood/pcie.c
+++ /dev/null
@@ -1,296 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/pcie.c
3 *
4 * PCIe functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <linux/slab.h>
14#include <linux/clk.h>
15#include <linux/mbus.h>
16#include <video/vga.h>
17#include <asm/irq.h>
18#include <asm/mach/pci.h>
19#include <plat/pcie.h>
20#include <mach/bridge-regs.h>
21#include "common.h"
22
23/* These can go away once Kirkwood uses the mvebu-mbus DT binding */
24#define KIRKWOOD_MBUS_PCIE0_MEM_TARGET 0x4
25#define KIRKWOOD_MBUS_PCIE0_MEM_ATTR 0xe8
26#define KIRKWOOD_MBUS_PCIE0_IO_TARGET 0x4
27#define KIRKWOOD_MBUS_PCIE0_IO_ATTR 0xe0
28#define KIRKWOOD_MBUS_PCIE1_MEM_TARGET 0x4
29#define KIRKWOOD_MBUS_PCIE1_MEM_ATTR 0xd8
30#define KIRKWOOD_MBUS_PCIE1_IO_TARGET 0x4
31#define KIRKWOOD_MBUS_PCIE1_IO_ATTR 0xd0
32
33static void kirkwood_enable_pcie_clk(const char *port)
34{
35 struct clk *clk;
36
37 clk = clk_get_sys("pcie", port);
38 if (IS_ERR(clk)) {
39 pr_err("PCIE clock %s missing\n", port);
40 return;
41 }
42 clk_prepare_enable(clk);
43 clk_put(clk);
44}
45
46/* This function is called very early in the boot when probing the
47 hardware to determine what we actually are, and what rate tclk is
48 ticking at. Hence calling kirkwood_enable_pcie_clk() is not
49 possible since the clk tree has not been created yet. */
50void kirkwood_enable_pcie(void)
51{
52 u32 curr = readl(CLOCK_GATING_CTRL);
53 if (!(curr & CGC_PEX0))
54 writel(curr | CGC_PEX0, CLOCK_GATING_CTRL);
55}
56
57void kirkwood_pcie_id(u32 *dev, u32 *rev)
58{
59 kirkwood_enable_pcie();
60 *dev = orion_pcie_dev_id(PCIE_VIRT_BASE);
61 *rev = orion_pcie_rev(PCIE_VIRT_BASE);
62}
63
64struct pcie_port {
65 u8 root_bus_nr;
66 void __iomem *base;
67 spinlock_t conf_lock;
68 int irq;
69 struct resource res;
70};
71
72static int pcie_port_map[2];
73static int num_pcie_ports;
74
75static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
76{
77 /*
78 * Don't go out when trying to access --
79 * 1. nonexisting device on local bus
80 * 2. where there's no device connected (no link)
81 */
82 if (bus == pp->root_bus_nr && dev == 0)
83 return 1;
84
85 if (!orion_pcie_link_up(pp->base))
86 return 0;
87
88 if (bus == pp->root_bus_nr && dev != 1)
89 return 0;
90
91 return 1;
92}
93
94
95/*
96 * PCIe config cycles are done by programming the PCIE_CONF_ADDR register
97 * and then reading the PCIE_CONF_DATA register. Need to make sure these
98 * transactions are atomic.
99 */
100
101static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
102 int size, u32 *val)
103{
104 struct pci_sys_data *sys = bus->sysdata;
105 struct pcie_port *pp = sys->private_data;
106 unsigned long flags;
107 int ret;
108
109 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) {
110 *val = 0xffffffff;
111 return PCIBIOS_DEVICE_NOT_FOUND;
112 }
113
114 spin_lock_irqsave(&pp->conf_lock, flags);
115 ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val);
116 spin_unlock_irqrestore(&pp->conf_lock, flags);
117
118 return ret;
119}
120
121static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
122 int where, int size, u32 val)
123{
124 struct pci_sys_data *sys = bus->sysdata;
125 struct pcie_port *pp = sys->private_data;
126 unsigned long flags;
127 int ret;
128
129 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0)
130 return PCIBIOS_DEVICE_NOT_FOUND;
131
132 spin_lock_irqsave(&pp->conf_lock, flags);
133 ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val);
134 spin_unlock_irqrestore(&pp->conf_lock, flags);
135
136 return ret;
137}
138
139static struct pci_ops pcie_ops = {
140 .read = pcie_rd_conf,
141 .write = pcie_wr_conf,
142};
143
144static void __init pcie0_ioresources_init(struct pcie_port *pp)
145{
146 pp->base = PCIE_VIRT_BASE;
147 pp->irq = IRQ_KIRKWOOD_PCIE;
148
149 /*
150 * IORESOURCE_MEM
151 */
152 pp->res.name = "PCIe 0 MEM";
153 pp->res.start = KIRKWOOD_PCIE_MEM_PHYS_BASE;
154 pp->res.end = pp->res.start + KIRKWOOD_PCIE_MEM_SIZE - 1;
155 pp->res.flags = IORESOURCE_MEM;
156}
157
158static void __init pcie1_ioresources_init(struct pcie_port *pp)
159{
160 pp->base = PCIE1_VIRT_BASE;
161 pp->irq = IRQ_KIRKWOOD_PCIE1;
162
163 /*
164 * IORESOURCE_MEM
165 */
166 pp->res.name = "PCIe 1 MEM";
167 pp->res.start = KIRKWOOD_PCIE1_MEM_PHYS_BASE;
168 pp->res.end = pp->res.start + KIRKWOOD_PCIE1_MEM_SIZE - 1;
169 pp->res.flags = IORESOURCE_MEM;
170}
171
172static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
173{
174 struct pcie_port *pp;
175 int index;
176
177 if (nr >= num_pcie_ports)
178 return 0;
179
180 index = pcie_port_map[nr];
181 pr_info("PCI: bus%d uses PCIe port %d\n", sys->busnr, index);
182
183 pp = kzalloc(sizeof(*pp), GFP_KERNEL);
184 if (!pp)
185 panic("PCIe: failed to allocate pcie_port data");
186 sys->private_data = pp;
187 pp->root_bus_nr = sys->busnr;
188 spin_lock_init(&pp->conf_lock);
189
190 switch (index) {
191 case 0:
192 kirkwood_enable_pcie_clk("0");
193 pcie0_ioresources_init(pp);
194 pci_ioremap_io(SZ_64K * sys->busnr, KIRKWOOD_PCIE_IO_PHYS_BASE);
195 break;
196 case 1:
197 kirkwood_enable_pcie_clk("1");
198 pcie1_ioresources_init(pp);
199 pci_ioremap_io(SZ_64K * sys->busnr,
200 KIRKWOOD_PCIE1_IO_PHYS_BASE);
201 break;
202 default:
203 panic("PCIe setup: invalid controller %d", index);
204 }
205
206 if (request_resource(&iomem_resource, &pp->res))
207 panic("Request PCIe%d Memory resource failed\n", index);
208
209 pci_add_resource_offset(&sys->resources, &pp->res, sys->mem_offset);
210
211 /*
212 * Generic PCIe unit setup.
213 */
214 orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
215
216 orion_pcie_setup(pp->base);
217
218 return 1;
219}
220
221/*
222 * The root complex has a hardwired class of PCI_CLASS_MEMORY_OTHER, when it
223 * is operating as a root complex this needs to be switched to
224 * PCI_CLASS_BRIDGE_HOST or Linux will errantly try to process the BAR's on
225 * the device. Decoding setup is handled by the orion code.
226 */
227static void rc_pci_fixup(struct pci_dev *dev)
228{
229 if (dev->bus->parent == NULL && dev->devfn == 0) {
230 int i;
231
232 dev->class &= 0xff;
233 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
234 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
235 dev->resource[i].start = 0;
236 dev->resource[i].end = 0;
237 dev->resource[i].flags = 0;
238 }
239 }
240}
241DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
242
243static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot,
244 u8 pin)
245{
246 struct pci_sys_data *sys = dev->sysdata;
247 struct pcie_port *pp = sys->private_data;
248
249 return pp->irq;
250}
251
252static struct hw_pci kirkwood_pci __initdata = {
253 .setup = kirkwood_pcie_setup,
254 .map_irq = kirkwood_pcie_map_irq,
255 .ops = &pcie_ops,
256};
257
258static void __init add_pcie_port(int index, void __iomem *base)
259{
260 pcie_port_map[num_pcie_ports++] = index;
261 pr_info("Kirkwood PCIe port %d: link %s\n", index,
262 orion_pcie_link_up(base) ? "up" : "down");
263}
264
265void __init kirkwood_pcie_init(unsigned int portmask)
266{
267 mvebu_mbus_add_window_remap_by_id(KIRKWOOD_MBUS_PCIE0_IO_TARGET,
268 KIRKWOOD_MBUS_PCIE0_IO_ATTR,
269 KIRKWOOD_PCIE_IO_PHYS_BASE,
270 KIRKWOOD_PCIE_IO_SIZE,
271 KIRKWOOD_PCIE_IO_BUS_BASE);
272 mvebu_mbus_add_window_by_id(KIRKWOOD_MBUS_PCIE0_MEM_TARGET,
273 KIRKWOOD_MBUS_PCIE0_MEM_ATTR,
274 KIRKWOOD_PCIE_MEM_PHYS_BASE,
275 KIRKWOOD_PCIE_MEM_SIZE);
276 mvebu_mbus_add_window_remap_by_id(KIRKWOOD_MBUS_PCIE1_IO_TARGET,
277 KIRKWOOD_MBUS_PCIE1_IO_ATTR,
278 KIRKWOOD_PCIE1_IO_PHYS_BASE,
279 KIRKWOOD_PCIE1_IO_SIZE,
280 KIRKWOOD_PCIE1_IO_BUS_BASE);
281 mvebu_mbus_add_window_by_id(KIRKWOOD_MBUS_PCIE1_MEM_TARGET,
282 KIRKWOOD_MBUS_PCIE1_MEM_ATTR,
283 KIRKWOOD_PCIE1_MEM_PHYS_BASE,
284 KIRKWOOD_PCIE1_MEM_SIZE);
285
286 vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
287
288 if (portmask & KW_PCIE0)
289 add_pcie_port(0, PCIE_VIRT_BASE);
290
291 if (portmask & KW_PCIE1)
292 add_pcie_port(1, PCIE1_VIRT_BASE);
293
294 kirkwood_pci.nr_controllers = num_pcie_ports;
295 pci_common_init(&kirkwood_pci);
296}
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c
deleted file mode 100644
index 8e5e0329d04c..000000000000
--- a/arch/arm/mach-kirkwood/pm.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.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,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/suspend.h>
19#include <linux/io.h>
20#include <mach/bridge-regs.h>
21#include "common.h"
22
23static void __iomem *ddr_operation_base;
24static void __iomem *memory_pm_ctrl;
25
26static void kirkwood_low_power(void)
27{
28 u32 mem_pm_ctrl;
29
30 mem_pm_ctrl = readl(memory_pm_ctrl);
31
32 /* Set peripherals to low-power mode */
33 writel_relaxed(~0, memory_pm_ctrl);
34
35 /* Set DDR in self-refresh */
36 writel_relaxed(0x7, ddr_operation_base);
37
38 /*
39 * Set CPU in wait-for-interrupt state.
40 * This disables the CPU core clocks,
41 * the array clocks, and also the L2 controller.
42 */
43 cpu_do_idle();
44
45 writel_relaxed(mem_pm_ctrl, memory_pm_ctrl);
46}
47
48static int kirkwood_suspend_enter(suspend_state_t state)
49{
50 switch (state) {
51 case PM_SUSPEND_STANDBY:
52 kirkwood_low_power();
53 break;
54 default:
55 return -EINVAL;
56 }
57 return 0;
58}
59
60static int kirkwood_pm_valid_standby(suspend_state_t state)
61{
62 return state == PM_SUSPEND_STANDBY;
63}
64
65static const struct platform_suspend_ops kirkwood_suspend_ops = {
66 .enter = kirkwood_suspend_enter,
67 .valid = kirkwood_pm_valid_standby,
68};
69
70void __init kirkwood_pm_init(void)
71{
72 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
73 memory_pm_ctrl = ioremap(MEMORY_PM_CTRL_PHYS, 4);
74
75 suspend_set_ops(&kirkwood_suspend_ops);
76}
diff --git a/arch/arm/mach-kirkwood/pm.h b/arch/arm/mach-kirkwood/pm.h
deleted file mode 100644
index 21e7530f368b..000000000000
--- a/arch/arm/mach-kirkwood/pm.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.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,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __ARCH_KIRKWOOD_PM_H
18#define __ARCH_KIRKWOOD_PM_H
19
20#ifdef CONFIG_PM
21void kirkwood_pm_init(void);
22#else
23static inline void kirkwood_pm_init(void) {};
24#endif
25
26#endif
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
deleted file mode 100644
index e4fd3129d36f..000000000000
--- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
3 *
4 * Marvell RD-88F6192-NAS Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/gpio.h>
17#include <linux/spi/flash.h>
18#include <linux/spi/spi.h>
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <mach/kirkwood.h>
22#include <plat/orion-gpio.h>
23#include "common.h"
24
25#define RD88F6192_GPIO_USB_VBUS 10
26
27static struct mv643xx_eth_platform_data rd88f6192_ge00_data = {
28 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
29};
30
31static struct mv_sata_platform_data rd88f6192_sata_data = {
32 .n_ports = 2,
33};
34
35static const struct flash_platform_data rd88F6192_spi_slave_data = {
36 .type = "m25p128",
37};
38
39static struct spi_board_info __initdata rd88F6192_spi_slave_info[] = {
40 {
41 .modalias = "m25p80",
42 .platform_data = &rd88F6192_spi_slave_data,
43 .irq = -1,
44 .max_speed_hz = 20000000,
45 .bus_num = 0,
46 .chip_select = 0,
47 },
48};
49
50static void __init rd88f6192_init(void)
51{
52 /*
53 * Basic setup. Needs to be called early.
54 */
55 kirkwood_init();
56
57 orion_gpio_set_valid(RD88F6192_GPIO_USB_VBUS, 1);
58 if (gpio_request(RD88F6192_GPIO_USB_VBUS, "USB VBUS") != 0 ||
59 gpio_direction_output(RD88F6192_GPIO_USB_VBUS, 1) != 0)
60 pr_err("RD-88F6192-NAS: failed to setup USB VBUS GPIO\n");
61
62 kirkwood_ehci_init();
63 kirkwood_ge00_init(&rd88f6192_ge00_data);
64 kirkwood_sata_init(&rd88f6192_sata_data);
65 spi_register_board_info(rd88F6192_spi_slave_info,
66 ARRAY_SIZE(rd88F6192_spi_slave_info));
67 kirkwood_spi_init();
68 kirkwood_uart0_init();
69}
70
71static int __init rd88f6192_pci_init(void)
72{
73 if (machine_is_rd88f6192_nas())
74 kirkwood_pcie_init(KW_PCIE0);
75
76 return 0;
77}
78subsys_initcall(rd88f6192_pci_init);
79
80MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board")
81 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
82 .atag_offset = 0x100,
83 .init_machine = rd88f6192_init,
84 .map_io = kirkwood_map_io,
85 .init_early = kirkwood_init_early,
86 .init_irq = kirkwood_init_irq,
87 .init_time = kirkwood_timer_init,
88 .restart = kirkwood_restart,
89MACHINE_END
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
deleted file mode 100644
index 5154bd2a3ad3..000000000000
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6281-setup.c
3 *
4 * Marvell RD-88F6281 Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/mtd/partitions.h>
16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/ethtool.h>
19#include <net/dsa.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <mach/kirkwood.h>
23#include <linux/platform_data/mmc-mvsdio.h>
24#include "common.h"
25#include "mpp.h"
26
27static struct mtd_partition rd88f6281_nand_parts[] = {
28 {
29 .name = "u-boot",
30 .offset = 0,
31 .size = SZ_1M
32 }, {
33 .name = "uImage",
34 .offset = MTDPART_OFS_NXTBLK,
35 .size = SZ_2M
36 }, {
37 .name = "root",
38 .offset = MTDPART_OFS_NXTBLK,
39 .size = MTDPART_SIZ_FULL
40 },
41};
42
43static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
44 .phy_addr = MV643XX_ETH_PHY_NONE,
45 .speed = SPEED_1000,
46 .duplex = DUPLEX_FULL,
47};
48
49static struct dsa_chip_data rd88f6281_switch_chip_data = {
50 .port_names[0] = "lan1",
51 .port_names[1] = "lan2",
52 .port_names[2] = "lan3",
53 .port_names[3] = "lan4",
54 .port_names[5] = "cpu",
55};
56
57static struct dsa_platform_data rd88f6281_switch_plat_data = {
58 .nr_chips = 1,
59 .chip = &rd88f6281_switch_chip_data,
60};
61
62static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
63 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
64};
65
66static struct mv_sata_platform_data rd88f6281_sata_data = {
67 .n_ports = 2,
68};
69
70static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
71 .gpio_card_detect = 28,
72 .gpio_write_protect = -1,
73};
74
75static unsigned int rd88f6281_mpp_config[] __initdata = {
76 MPP28_GPIO,
77 0
78};
79
80static void __init rd88f6281_init(void)
81{
82 u32 dev, rev;
83
84 /*
85 * Basic setup. Needs to be called early.
86 */
87 kirkwood_init();
88 kirkwood_mpp_conf(rd88f6281_mpp_config);
89
90 kirkwood_nand_init(rd88f6281_nand_parts,
91 ARRAY_SIZE(rd88f6281_nand_parts),
92 25);
93 kirkwood_ehci_init();
94
95 kirkwood_ge00_init(&rd88f6281_ge00_data);
96 kirkwood_pcie_id(&dev, &rev);
97 if (rev == MV88F6281_REV_A0) {
98 rd88f6281_switch_chip_data.sw_addr = 10;
99 kirkwood_ge01_init(&rd88f6281_ge01_data);
100 } else {
101 rd88f6281_switch_chip_data.port_names[4] = "wan";
102 }
103 kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);
104
105 kirkwood_sata_init(&rd88f6281_sata_data);
106 kirkwood_sdio_init(&rd88f6281_mvsdio_data);
107 kirkwood_uart0_init();
108}
109
110static int __init rd88f6281_pci_init(void)
111{
112 if (machine_is_rd88f6281())
113 kirkwood_pcie_init(KW_PCIE0);
114
115 return 0;
116}
117subsys_initcall(rd88f6281_pci_init);
118
119MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
120 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
121 .atag_offset = 0x100,
122 .init_machine = rd88f6281_init,
123 .map_io = kirkwood_map_io,
124 .init_early = kirkwood_init_early,
125 .init_irq = kirkwood_init_irq,
126 .init_time = kirkwood_timer_init,
127 .restart = kirkwood_restart,
128MACHINE_END
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c
deleted file mode 100644
index 8736f8c97518..000000000000
--- a/arch/arm/mach-kirkwood/t5325-setup.c
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2 *
3 * HP t5325 Thin Client setup
4 *
5 * Copyright (C) 2010 Martin Michlmayr <tbm@cyrius.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17#include <linux/spi/flash.h>
18#include <linux/spi/spi.h>
19#include <linux/i2c.h>
20#include <linux/mv643xx_eth.h>
21#include <linux/ata_platform.h>
22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <sound/alc5623.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <mach/kirkwood.h>
29#include "common.h"
30#include "mpp.h"
31
32static struct mtd_partition hp_t5325_partitions[] = {
33 {
34 .name = "u-boot env",
35 .size = SZ_64K,
36 .offset = SZ_512K + SZ_256K,
37 },
38 {
39 .name = "permanent u-boot env",
40 .size = SZ_64K,
41 .offset = MTDPART_OFS_APPEND,
42 .mask_flags = MTD_WRITEABLE,
43 },
44 {
45 .name = "HP env",
46 .size = SZ_64K,
47 .offset = MTDPART_OFS_APPEND,
48 },
49 {
50 .name = "u-boot",
51 .size = SZ_512K,
52 .offset = 0,
53 .mask_flags = MTD_WRITEABLE,
54 },
55 {
56 .name = "SSD firmware",
57 .size = SZ_256K,
58 .offset = SZ_512K,
59 },
60};
61
62static const struct flash_platform_data hp_t5325_flash = {
63 .type = "mx25l8005",
64 .name = "spi_flash",
65 .parts = hp_t5325_partitions,
66 .nr_parts = ARRAY_SIZE(hp_t5325_partitions),
67};
68
69static struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
70 {
71 .modalias = "m25p80",
72 .platform_data = &hp_t5325_flash,
73 .irq = -1,
74 },
75};
76
77static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {
78 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
79};
80
81static struct mv_sata_platform_data hp_t5325_sata_data = {
82 .n_ports = 2,
83};
84
85static struct gpio_keys_button hp_t5325_buttons[] = {
86 {
87 .code = KEY_POWER,
88 .gpio = 45,
89 .desc = "Power",
90 .active_low = 1,
91 },
92};
93
94static struct gpio_keys_platform_data hp_t5325_button_data = {
95 .buttons = hp_t5325_buttons,
96 .nbuttons = ARRAY_SIZE(hp_t5325_buttons),
97};
98
99static struct platform_device hp_t5325_button_device = {
100 .name = "gpio-keys",
101 .id = -1,
102 .num_resources = 0,
103 .dev = {
104 .platform_data = &hp_t5325_button_data,
105 }
106};
107
108static struct platform_device hp_t5325_audio_device = {
109 .name = "t5325-audio",
110 .id = -1,
111};
112
113static unsigned int hp_t5325_mpp_config[] __initdata = {
114 MPP0_NF_IO2,
115 MPP1_SPI_MOSI,
116 MPP2_SPI_SCK,
117 MPP3_SPI_MISO,
118 MPP4_NF_IO6,
119 MPP5_NF_IO7,
120 MPP6_SYSRST_OUTn,
121 MPP7_SPI_SCn,
122 MPP8_TW0_SDA,
123 MPP9_TW0_SCK,
124 MPP10_UART0_TXD,
125 MPP11_UART0_RXD,
126 MPP12_SD_CLK,
127 MPP13_GPIO,
128 MPP14_GPIO,
129 MPP15_GPIO,
130 MPP16_GPIO,
131 MPP17_GPIO,
132 MPP18_NF_IO0,
133 MPP19_NF_IO1,
134 MPP20_GPIO,
135 MPP21_GPIO,
136 MPP22_GPIO,
137 MPP23_GPIO,
138 MPP32_GPIO,
139 MPP33_GE1_TXCTL,
140 MPP39_AU_I2SBCLK,
141 MPP40_AU_I2SDO,
142 MPP43_AU_I2SDI,
143 MPP41_AU_I2SLRCLK,
144 MPP42_AU_I2SMCLK,
145 MPP45_GPIO, /* Power button */
146 MPP48_GPIO, /* Board power off */
147 0
148};
149
150static struct alc5623_platform_data alc5621_data = {
151 .add_ctrl = 0x3700,
152 .jack_det_ctrl = 0x4810,
153};
154
155static struct i2c_board_info i2c_board_info[] __initdata = {
156 {
157 I2C_BOARD_INFO("alc5621", 0x1a),
158 .platform_data = &alc5621_data,
159 },
160};
161
162#define HP_T5325_GPIO_POWER_OFF 48
163
164static void hp_t5325_power_off(void)
165{
166 gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);
167}
168
169static void __init hp_t5325_init(void)
170{
171 /*
172 * Basic setup. Needs to be called early.
173 */
174 kirkwood_init();
175 kirkwood_mpp_conf(hp_t5325_mpp_config);
176
177 kirkwood_uart0_init();
178 spi_register_board_info(hp_t5325_spi_slave_info,
179 ARRAY_SIZE(hp_t5325_spi_slave_info));
180 kirkwood_spi_init();
181 kirkwood_i2c_init();
182 kirkwood_ge00_init(&hp_t5325_ge00_data);
183 kirkwood_sata_init(&hp_t5325_sata_data);
184 kirkwood_ehci_init();
185 platform_device_register(&hp_t5325_button_device);
186 platform_device_register(&hp_t5325_audio_device);
187
188 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
189 kirkwood_audio_init();
190
191 if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
192 gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
193 pm_power_off = hp_t5325_power_off;
194 else
195 pr_err("t5325: failed to configure power-off GPIO\n");
196}
197
198static int __init hp_t5325_pci_init(void)
199{
200 if (machine_is_t5325())
201 kirkwood_pcie_init(KW_PCIE0);
202
203 return 0;
204}
205subsys_initcall(hp_t5325_pci_init);
206
207MACHINE_START(T5325, "HP t5325 Thin Client")
208 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
209 .atag_offset = 0x100,
210 .init_machine = hp_t5325_init,
211 .map_io = kirkwood_map_io,
212 .init_early = kirkwood_init_early,
213 .init_irq = kirkwood_init_irq,
214 .init_time = kirkwood_timer_init,
215 .restart = kirkwood_restart,
216MACHINE_END
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c
deleted file mode 100644
index e1267d6b468f..000000000000
--- a/arch/arm/mach-kirkwood/ts219-setup.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 *
3 * QNAP TS-11x/TS-21x Turbo NAS Board Setup
4 *
5 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/ata_platform.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <mach/kirkwood.h>
25#include "common.h"
26#include "mpp.h"
27#include "tsx1x-common.h"
28
29static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = {
30 I2C_BOARD_INFO("s35390a", 0x30),
31};
32
33static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
34 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
35};
36
37static struct mv_sata_platform_data qnap_ts219_sata_data = {
38 .n_ports = 2,
39};
40
41static struct gpio_keys_button qnap_ts219_buttons[] = {
42 {
43 .code = KEY_COPY,
44 .gpio = 15,
45 .desc = "USB Copy",
46 .active_low = 1,
47 },
48 {
49 .code = KEY_RESTART,
50 .gpio = 16,
51 .desc = "Reset",
52 .active_low = 1,
53 },
54};
55
56static struct gpio_keys_platform_data qnap_ts219_button_data = {
57 .buttons = qnap_ts219_buttons,
58 .nbuttons = ARRAY_SIZE(qnap_ts219_buttons),
59};
60
61static struct platform_device qnap_ts219_button_device = {
62 .name = "gpio-keys",
63 .id = -1,
64 .num_resources = 0,
65 .dev = {
66 .platform_data = &qnap_ts219_button_data,
67 }
68};
69
70static unsigned int qnap_ts219_mpp_config[] __initdata = {
71 MPP0_SPI_SCn,
72 MPP1_SPI_MOSI,
73 MPP2_SPI_SCK,
74 MPP3_SPI_MISO,
75 MPP4_SATA1_ACTn,
76 MPP5_SATA0_ACTn,
77 MPP8_TW0_SDA,
78 MPP9_TW0_SCK,
79 MPP10_UART0_TXD,
80 MPP11_UART0_RXD,
81 MPP13_UART1_TXD, /* PIC controller */
82 MPP14_UART1_RXD, /* PIC controller */
83 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
84 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
85 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
86 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
87 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
88 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
89 0
90};
91
92static void __init qnap_ts219_init(void)
93{
94 u32 dev, rev;
95
96 /*
97 * Basic setup. Needs to be called early.
98 */
99 kirkwood_init();
100 kirkwood_mpp_conf(qnap_ts219_mpp_config);
101
102 kirkwood_uart0_init();
103 kirkwood_uart1_init(); /* A PIC controller is connected here. */
104 qnap_tsx1x_register_flash();
105 kirkwood_i2c_init();
106 i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1);
107
108 kirkwood_pcie_id(&dev, &rev);
109 if (dev == MV88F6282_DEV_ID) {
110 qnap_ts219_buttons[0].gpio = 43; /* USB Copy button */
111 qnap_ts219_buttons[1].gpio = 37; /* Reset button */
112 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
113 }
114
115 kirkwood_ge00_init(&qnap_ts219_ge00_data);
116 kirkwood_sata_init(&qnap_ts219_sata_data);
117 kirkwood_ehci_init();
118 platform_device_register(&qnap_ts219_button_device);
119
120 pm_power_off = qnap_tsx1x_power_off;
121
122}
123
124static int __init ts219_pci_init(void)
125{
126 if (machine_is_ts219())
127 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
128
129 return 0;
130}
131subsys_initcall(ts219_pci_init);
132
133MACHINE_START(TS219, "QNAP TS-119/TS-219")
134 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
135 .atag_offset = 0x100,
136 .init_machine = qnap_ts219_init,
137 .map_io = kirkwood_map_io,
138 .init_early = kirkwood_init_early,
139 .init_irq = kirkwood_init_irq,
140 .init_time = kirkwood_timer_init,
141 .restart = kirkwood_restart,
142MACHINE_END
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
deleted file mode 100644
index 81d585806b2f..000000000000
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 *
3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
4 *
5 * Copyright (C) 2009-2010 Martin Michlmayr <tbm@cyrius.com>
6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/ata_platform.h>
20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/io.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <mach/kirkwood.h>
27#include "common.h"
28#include "mpp.h"
29#include "tsx1x-common.h"
30
31/* for the PCIe reset workaround */
32#include <plat/pcie.h>
33
34
35#define QNAP_TS41X_JUMPER_JP1 45
36
37static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
38 I2C_BOARD_INFO("s35390a", 0x30),
39};
40
41static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data = {
42 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
43};
44
45static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data = {
46 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
47};
48
49static struct mv_sata_platform_data qnap_ts41x_sata_data = {
50 .n_ports = 2,
51};
52
53static struct gpio_keys_button qnap_ts41x_buttons[] = {
54 {
55 .code = KEY_COPY,
56 .gpio = 43,
57 .desc = "USB Copy",
58 .active_low = 1,
59 },
60 {
61 .code = KEY_RESTART,
62 .gpio = 37,
63 .desc = "Reset",
64 .active_low = 1,
65 },
66};
67
68static struct gpio_keys_platform_data qnap_ts41x_button_data = {
69 .buttons = qnap_ts41x_buttons,
70 .nbuttons = ARRAY_SIZE(qnap_ts41x_buttons),
71};
72
73static struct platform_device qnap_ts41x_button_device = {
74 .name = "gpio-keys",
75 .id = -1,
76 .num_resources = 0,
77 .dev = {
78 .platform_data = &qnap_ts41x_button_data,
79 }
80};
81
82static unsigned int qnap_ts41x_mpp_config[] __initdata = {
83 MPP0_SPI_SCn,
84 MPP1_SPI_MOSI,
85 MPP2_SPI_SCK,
86 MPP3_SPI_MISO,
87 MPP6_SYSRST_OUTn,
88 MPP7_PEX_RST_OUTn,
89 MPP8_TW0_SDA,
90 MPP9_TW0_SCK,
91 MPP10_UART0_TXD,
92 MPP11_UART0_RXD,
93 MPP13_UART1_TXD, /* PIC controller */
94 MPP14_UART1_RXD, /* PIC controller */
95 MPP15_SATA0_ACTn,
96 MPP16_SATA1_ACTn,
97 MPP20_GE1_TXD0,
98 MPP21_GE1_TXD1,
99 MPP22_GE1_TXD2,
100 MPP23_GE1_TXD3,
101 MPP24_GE1_RXD0,
102 MPP25_GE1_RXD1,
103 MPP26_GE1_RXD2,
104 MPP27_GE1_RXD3,
105 MPP30_GE1_RXCTL,
106 MPP31_GE1_RXCLK,
107 MPP32_GE1_TCLKOUT,
108 MPP33_GE1_TXCTL,
109 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
110 MPP37_GPIO, /* Reset button */
111 MPP43_GPIO, /* USB Copy button */
112 MPP44_GPIO, /* Board ID: 0: TS-419U, 1: TS-419 */
113 MPP45_GPIO, /* JP1: 0: LCD, 1: serial console */
114 MPP46_GPIO, /* External SATA HDD1 error indicator */
115 MPP47_GPIO, /* External SATA HDD2 error indicator */
116 MPP48_GPIO, /* External SATA HDD3 error indicator */
117 MPP49_GPIO, /* External SATA HDD4 error indicator */
118 0
119};
120
121static void __init qnap_ts41x_init(void)
122{
123 u32 dev, rev;
124
125 /*
126 * Basic setup. Needs to be called early.
127 */
128 kirkwood_init();
129 kirkwood_mpp_conf(qnap_ts41x_mpp_config);
130
131 kirkwood_uart0_init();
132 kirkwood_uart1_init(); /* A PIC controller is connected here. */
133 qnap_tsx1x_register_flash();
134 kirkwood_i2c_init();
135 i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1);
136
137 kirkwood_pcie_id(&dev, &rev);
138 if (dev == MV88F6282_DEV_ID) {
139 qnap_ts41x_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
140 qnap_ts41x_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
141 }
142 kirkwood_ge00_init(&qnap_ts41x_ge00_data);
143 kirkwood_ge01_init(&qnap_ts41x_ge01_data);
144
145 kirkwood_sata_init(&qnap_ts41x_sata_data);
146 kirkwood_ehci_init();
147 platform_device_register(&qnap_ts41x_button_device);
148
149 pm_power_off = qnap_tsx1x_power_off;
150
151 if (gpio_request(QNAP_TS41X_JUMPER_JP1, "JP1") == 0)
152 gpio_export(QNAP_TS41X_JUMPER_JP1, 0);
153}
154
155static int __init ts41x_pci_init(void)
156{
157 if (machine_is_ts41x()) {
158 u32 dev, rev;
159
160 /*
161 * Without this explicit reset, the PCIe SATA controller
162 * (Marvell 88sx7042/sata_mv) is known to stop working
163 * after a few minutes.
164 */
165 orion_pcie_reset(PCIE_VIRT_BASE);
166
167 kirkwood_pcie_id(&dev, &rev);
168 if (dev == MV88F6282_DEV_ID)
169 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
170 else
171 kirkwood_pcie_init(KW_PCIE0);
172 }
173 return 0;
174}
175subsys_initcall(ts41x_pci_init);
176
177MACHINE_START(TS41X, "QNAP TS-41x")
178 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
179 .atag_offset = 0x100,
180 .init_machine = qnap_ts41x_init,
181 .map_io = kirkwood_map_io,
182 .init_early = kirkwood_init_early,
183 .init_irq = kirkwood_init_irq,
184 .init_time = kirkwood_timer_init,
185 .restart = kirkwood_restart,
186MACHINE_END
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c
deleted file mode 100644
index cec87cef76ca..000000000000
--- a/arch/arm/mach-kirkwood/tsx1x-common.c
+++ /dev/null
@@ -1,113 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/pci.h>
3#include <linux/platform_device.h>
4#include <linux/mtd/physmap.h>
5#include <linux/spi/flash.h>
6#include <linux/spi/spi.h>
7#include <linux/serial_reg.h>
8#include <mach/kirkwood.h>
9#include "common.h"
10#include "tsx1x-common.h"
11
12/*
13 * QNAP TS-x1x Boards flash
14 */
15
16/****************************************************************************
17 * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the
18 * partitions on the device because we want to keep compatibility with
19 * the QNAP firmware.
20 * Layout as used by QNAP:
21 * 0x00000000-0x00080000 : "U-Boot"
22 * 0x00200000-0x00400000 : "Kernel"
23 * 0x00400000-0x00d00000 : "RootFS"
24 * 0x00d00000-0x01000000 : "RootFS2"
25 * 0x00080000-0x000c0000 : "U-Boot Config"
26 * 0x000c0000-0x00200000 : "NAS Config"
27 *
28 * We'll use "RootFS1" instead of "RootFS" to stay compatible with the layout
29 * used by the QNAP TS-109/TS-209.
30 *
31 ***************************************************************************/
32
33static struct mtd_partition qnap_tsx1x_partitions[] = {
34 {
35 .name = "U-Boot",
36 .size = 0x00080000,
37 .offset = 0,
38 .mask_flags = MTD_WRITEABLE,
39 }, {
40 .name = "Kernel",
41 .size = 0x00200000,
42 .offset = 0x00200000,
43 }, {
44 .name = "RootFS1",
45 .size = 0x00900000,
46 .offset = 0x00400000,
47 }, {
48 .name = "RootFS2",
49 .size = 0x00300000,
50 .offset = 0x00d00000,
51 }, {
52 .name = "U-Boot Config",
53 .size = 0x00040000,
54 .offset = 0x00080000,
55 }, {
56 .name = "NAS Config",
57 .size = 0x00140000,
58 .offset = 0x000c0000,
59 },
60};
61
62static const struct flash_platform_data qnap_tsx1x_flash = {
63 .type = "m25p128",
64 .name = "spi_flash",
65 .parts = qnap_tsx1x_partitions,
66 .nr_parts = ARRAY_SIZE(qnap_tsx1x_partitions),
67};
68
69static struct spi_board_info __initdata qnap_tsx1x_spi_slave_info[] = {
70 {
71 .modalias = "m25p80",
72 .platform_data = &qnap_tsx1x_flash,
73 .irq = -1,
74 .max_speed_hz = 20000000,
75 .bus_num = 0,
76 .chip_select = 0,
77 },
78};
79
80void __init qnap_tsx1x_register_flash(void)
81{
82 spi_register_board_info(qnap_tsx1x_spi_slave_info,
83 ARRAY_SIZE(qnap_tsx1x_spi_slave_info));
84 kirkwood_spi_init();
85}
86
87
88/*****************************************************************************
89 * QNAP TS-x1x specific power off method via UART1-attached PIC
90 ****************************************************************************/
91
92#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
93
94void qnap_tsx1x_power_off(void)
95{
96 /* 19200 baud divisor */
97 const unsigned divisor = ((kirkwood_tclk + (8 * 19200)) / (16 * 19200));
98
99 pr_info("%s: triggering power-off...\n", __func__);
100
101 /* hijack UART1 and reset into sane state (19200,8n1) */
102 writel(0x83, UART1_REG(LCR));
103 writel(divisor & 0xff, UART1_REG(DLL));
104 writel((divisor >> 8) & 0xff, UART1_REG(DLM));
105 writel(0x03, UART1_REG(LCR));
106 writel(0x00, UART1_REG(IER));
107 writel(0x00, UART1_REG(FCR));
108 writel(0x00, UART1_REG(MCR));
109
110 /* send the power-off command 'A' to PIC */
111 writel('A', UART1_REG(TX));
112}
113
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.h b/arch/arm/mach-kirkwood/tsx1x-common.h
deleted file mode 100644
index 7fa037361b55..000000000000
--- a/arch/arm/mach-kirkwood/tsx1x-common.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ARCH_KIRKWOOD_TSX1X_COMMON_H
2#define __ARCH_KIRKWOOD_TSX1X_COMMON_H
3
4extern void __init qnap_tsx1x_register_flash(void);
5extern void qnap_tsx1x_power_off(void);
6
7#endif
diff --git a/arch/arm/mach-ks8695/include/mach/memory.h b/arch/arm/mach-ks8695/include/mach/memory.h
index 95e731a7ed6a..ab0d27fa8969 100644
--- a/arch/arm/mach-ks8695/include/mach/memory.h
+++ b/arch/arm/mach-ks8695/include/mach/memory.h
@@ -15,11 +15,6 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18/*
19 * Physical SRAM offset.
20 */
21#define PLAT_PHYS_OFFSET KS8695_SDRAM_PA
22
23#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
24 19
25#ifdef CONFIG_PCI 20#ifdef CONFIG_PCI
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
new file mode 100644
index 000000000000..2c043a210db0
--- /dev/null
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -0,0 +1,6 @@
1config ARCH_MEDIATEK
2 bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7
3 select ARM_GIC
4 select MTK_TIMER
5 help
6 Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.
diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
new file mode 100644
index 000000000000..43e619f56172
--- /dev/null
+++ b/arch/arm/mach-mediatek/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-s5pc100/include/mach/dma.h b/arch/arm/mach-mediatek/mediatek.c
index 201842a3769e..f2acf075350d 100644
--- a/arch/arm/mach-s5pc100/include/mach/dma.h
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * Copyright (C) 2010 Samsung Electronics Co. Ltd. 2 * Device Tree support for Mediatek SoCs
3 * Jaswinder Singh <jassi.brar@samsung.com> 3 *
4 * Copyright (c) 2014 MundoReader S.L.
5 * Author: Matthias Brugger <matthias.bgg@gmail.com>
4 * 6 *
5 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -11,16 +13,15 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 15 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 16 */
17#include <linux/init.h>
18#include <asm/mach/arch.h>
19 19
20#ifndef __MACH_DMA_H 20static const char * const mediatek_board_dt_compat[] = {
21#define __MACH_DMA_H 21 "mediatek,mt6589",
22 22 NULL,
23/* This platform uses the common DMA API driver for PL330 */ 23};
24#include <plat/dma-pl330.h>
25 24
26#endif /* __MACH_DMA_H */ 25DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
26 .dt_compat = mediatek_board_dt_compat,
27MACHINE_END
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
index fbd7ee8e4897..8c78f2b16452 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
@@ -23,7 +23,6 @@
23#define SM_nCS0_nCS0 MFP_CFG(SM_nCS0, AF0) 23#define SM_nCS0_nCS0 MFP_CFG(SM_nCS0, AF0)
24#define SM_ADV_SM_ADV MFP_CFG(SM_ADV, AF0) 24#define SM_ADV_SM_ADV MFP_CFG(SM_ADV, AF0)
25#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0) 25#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0)
26#define SM_SCLK_SM_SCLK MFP_CFG(SM_SCLK, AF0)
27#define SM_BE0_SM_BE0 MFP_CFG(SM_BE0, AF1) 26#define SM_BE0_SM_BE0 MFP_CFG(SM_BE0, AF1)
28#define SM_BE1_SM_BE1 MFP_CFG(SM_BE1, AF1) 27#define SM_BE1_SM_BE1 MFP_CFG(SM_BE1, AF1)
29 28
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 9b26976fb084..a6b50e62a495 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -106,7 +106,4 @@ config MSM_GPIOMUX
106 help 106 help
107 Support for MSM V1 TLMM GPIOMUX architecture. 107 Support for MSM V1 TLMM GPIOMUX architecture.
108 108
109config MSM_SCM
110 bool
111
112endif 109endif
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index b9bc599a5fd0..c1e4567a5ab3 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -14,11 +14,15 @@ menuconfig ARCH_MVEBU
14 14
15if ARCH_MVEBU 15if ARCH_MVEBU
16 16
17config MACH_MVEBU_ANY
18 bool
19
17config MACH_MVEBU_V7 20config MACH_MVEBU_V7
18 bool 21 bool
19 select ARMADA_370_XP_TIMER 22 select ARMADA_370_XP_TIMER
20 select CACHE_L2X0 23 select CACHE_L2X0
21 select ARM_CPU_SUSPEND 24 select ARM_CPU_SUSPEND
25 select MACH_MVEBU_ANY
22 26
23config MACH_ARMADA_370 27config MACH_ARMADA_370
24 bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 28 bool "Marvell Armada 370 boards" if ARCH_MULTI_V7
@@ -75,6 +79,7 @@ config MACH_DOVE
75 select CACHE_L2X0 79 select CACHE_L2X0
76 select CPU_PJ4 80 select CPU_PJ4
77 select DOVE_CLK 81 select DOVE_CLK
82 select MACH_MVEBU_ANY
78 select ORION_IRQCHIP 83 select ORION_IRQCHIP
79 select ORION_TIMER 84 select ORION_TIMER
80 select PINCTRL_DOVE 85 select PINCTRL_DOVE
@@ -87,6 +92,7 @@ config MACH_KIRKWOOD
87 select ARCH_REQUIRE_GPIOLIB 92 select ARCH_REQUIRE_GPIOLIB
88 select CPU_FEROCEON 93 select CPU_FEROCEON
89 select KIRKWOOD_CLK 94 select KIRKWOOD_CLK
95 select MACH_MVEBU_ANY
90 select ORION_IRQCHIP 96 select ORION_IRQCHIP
91 select ORION_TIMER 97 select ORION_TIMER
92 select PCI 98 select PCI
@@ -96,4 +102,11 @@ config MACH_KIRKWOOD
96 Say 'Y' here if you want your kernel to support boards based 102 Say 'Y' here if you want your kernel to support boards based
97 on the Marvell Kirkwood device tree. 103 on the Marvell Kirkwood device tree.
98 104
105config MACH_NETXBIG
106 bool "LaCie 2Big and 5Big Network v2"
107 depends on MACH_KIRKWOOD
108 help
109 Say 'Y' here if you want your kernel to support the
110 LaCie 2Big and 5Big Network v2
111
99endif 112endif
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 1636cdbef01a..e24136b42765 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -4,13 +4,13 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a 4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
5CFLAGS_pmsu.o := -march=armv7-a 5CFLAGS_pmsu.o := -march=armv7-a
6 6
7obj-y += 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
11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o 11obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
12obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
13endif 12endif
14 13
15obj-$(CONFIG_MACH_DOVE) += dove.o 14obj-$(CONFIG_MACH_DOVE) += dove.o
16obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o 15obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o
16obj-$(CONFIG_MACH_NETXBIG) += netxbig.o
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index c3465f5b1250..84cd90d9b860 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -24,4 +24,6 @@ void armada_xp_secondary_startup(void);
24extern struct smp_operations armada_xp_smp_ops; 24extern struct smp_operations armada_xp_smp_ops;
25#endif 25#endif
26 26
27int armada_370_xp_pmsu_idle_enter(unsigned long deepidle);
28
27#endif /* __MACH_ARMADA_370_XP_H */ 29#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 b2524d689f21..6478626e3ff6 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -34,14 +34,14 @@
34#include "coherency.h" 34#include "coherency.h"
35#include "mvebu-soc-id.h" 35#include "mvebu-soc-id.h"
36 36
37static void __iomem *scu_base;
38
37/* 39/*
38 * Enables the SCU when available. Obviously, this is only useful on 40 * Enables the SCU when available. Obviously, this is only useful on
39 * Cortex-A based SOCs, not on PJ4B based ones. 41 * Cortex-A based SOCs, not on PJ4B based ones.
40 */ 42 */
41static void __init mvebu_scu_enable(void) 43static void __init mvebu_scu_enable(void)
42{ 44{
43 void __iomem *scu_base;
44
45 struct device_node *np = 45 struct device_node *np =
46 of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); 46 of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
47 if (np) { 47 if (np) {
@@ -51,6 +51,11 @@ static void __init mvebu_scu_enable(void)
51 } 51 }
52} 52}
53 53
54void __iomem *mvebu_get_scu_base(void)
55{
56 return scu_base;
57}
58
54/* 59/*
55 * Early versions of Armada 375 SoC have a bug where the BootROM 60 * Early versions of Armada 375 SoC have a bug where the BootROM
56 * leaves an external data abort pending. The kernel is hit by this 61 * leaves an external data abort pending. The kernel is hit by this
@@ -125,8 +130,16 @@ static void __init thermal_quirk(void)
125{ 130{
126 struct device_node *np; 131 struct device_node *np;
127 u32 dev, rev; 132 u32 dev, rev;
133 int res;
128 134
129 if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV) 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))
130 return; 143 return;
131 144
132 for_each_compatible_node(np, NULL, "marvell,armada375-thermal") { 145 for_each_compatible_node(np, NULL, "marvell,armada375-thermal") {
@@ -160,7 +173,8 @@ static void __init thermal_quirk(void)
160 173
161 /* 174 /*
162 * The thermal controller needs some quirk too, so let's change 175 * The thermal controller needs some quirk too, so let's change
163 * the compatible string to reflect this. 176 * the compatible string to reflect this and allow the driver
177 * the take the necessary action.
164 */ 178 */
165 prop = kzalloc(sizeof(*prop), GFP_KERNEL); 179 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
166 prop->name = kstrdup("compatible", GFP_KERNEL); 180 prop->name = kstrdup("compatible", GFP_KERNEL);
diff --git a/arch/arm/mach-mvebu/board.h b/arch/arm/mach-mvebu/board.h
index 9c7bb4386f8b..98e32cc2ef3d 100644
--- a/arch/arm/mach-mvebu/board.h
+++ b/arch/arm/mach-mvebu/board.h
@@ -13,4 +13,9 @@
13#ifndef __ARCH_MVEBU_BOARD_H 13#ifndef __ARCH_MVEBU_BOARD_H
14#define __ARCH_MVEBU_BOARD_H 14#define __ARCH_MVEBU_BOARD_H
15 15
16#ifdef CONFIG_MACH_NETXBIG
17void netxbig_init(void);
18#else
19static inline void netxbig_init(void) {};
20#endif
16#endif 21#endif
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index 510c29e079ca..f5d881b5d0f7 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -46,7 +46,7 @@ ENTRY(ll_get_coherency_base)
46 ldr r1, =coherency_base 46 ldr r1, =coherency_base
47 ldr r1, [r1] 47 ldr r1, [r1]
482: 482:
49 mov pc, lr 49 ret lr
50ENDPROC(ll_get_coherency_base) 50ENDPROC(ll_get_coherency_base)
51 51
52/* 52/*
@@ -63,7 +63,7 @@ ENTRY(ll_get_coherency_cpumask)
63 mov r2, #(1 << 24) 63 mov r2, #(1 << 24)
64 lsl r3, r2, r3 64 lsl r3, r2, r3
65ARM_BE8(rev r3, r3) 65ARM_BE8(rev r3, r3)
66 mov pc, lr 66 ret lr
67ENDPROC(ll_get_coherency_cpumask) 67ENDPROC(ll_get_coherency_cpumask)
68 68
69/* 69/*
@@ -94,7 +94,7 @@ ENTRY(ll_add_cpu_to_smp_group)
94 strex r1, r2, [r0] 94 strex r1, r2, [r0]
95 cmp r1, #0 95 cmp r1, #0
96 bne 1b 96 bne 1b
97 mov pc, lr 97 ret lr
98ENDPROC(ll_add_cpu_to_smp_group) 98ENDPROC(ll_add_cpu_to_smp_group)
99 99
100ENTRY(ll_enable_coherency) 100ENTRY(ll_enable_coherency)
@@ -118,7 +118,7 @@ ENTRY(ll_enable_coherency)
118 bne 1b 118 bne 1b
119 dsb 119 dsb
120 mov r0, #0 120 mov r0, #0
121 mov pc, lr 121 ret lr
122ENDPROC(ll_enable_coherency) 122ENDPROC(ll_enable_coherency)
123 123
124ENTRY(ll_disable_coherency) 124ENTRY(ll_disable_coherency)
@@ -141,7 +141,7 @@ ENTRY(ll_disable_coherency)
141 cmp r1, #0 141 cmp r1, #0
142 bne 1b 142 bne 1b
143 dsb 143 dsb
144 mov pc, lr 144 ret lr
145ENDPROC(ll_disable_coherency) 145ENDPROC(ll_disable_coherency)
146 146
147 .align 2 147 .align 2
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index b67fb7a10d8b..3ccb40c3bf94 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -21,7 +21,8 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd);
21int mvebu_cpu_reset_deassert(int cpu); 21int mvebu_cpu_reset_deassert(int cpu);
22void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr); 22void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr);
23void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr); 23void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr);
24int mvebu_system_controller_get_soc_id(u32 *dev, u32 *rev);
24 25
25void armada_xp_cpu_die(unsigned int cpu); 26void __iomem *mvebu_get_scu_base(void);
26 27
27#endif 28#endif
diff --git a/arch/arm/mach-mvebu/cpu-reset.c b/arch/arm/mach-mvebu/cpu-reset.c
index 4a8f9eebebea..60fb53787004 100644
--- a/arch/arm/mach-mvebu/cpu-reset.c
+++ b/arch/arm/mach-mvebu/cpu-reset.c
@@ -67,7 +67,7 @@ static int mvebu_cpu_reset_map(struct device_node *np, int res_idx)
67 return 0; 67 return 0;
68} 68}
69 69
70int __init mvebu_cpu_reset_init(void) 70static int __init mvebu_cpu_reset_init(void)
71{ 71{
72 struct device_node *np; 72 struct device_node *np;
73 int res_idx; 73 int res_idx;
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
index da5bb292b91c..be51c998c0cd 100644
--- a/arch/arm/mach-mvebu/headsmp-a9.S
+++ b/arch/arm/mach-mvebu/headsmp-a9.S
@@ -18,21 +18,6 @@
18#include <asm/assembler.h> 18#include <asm/assembler.h>
19 19
20 __CPUINIT 20 __CPUINIT
21#define CPU_RESUME_ADDR_REG 0xf10182d4
22
23.global armada_375_smp_cpu1_enable_code_start
24.global armada_375_smp_cpu1_enable_code_end
25
26armada_375_smp_cpu1_enable_code_start:
27ARM_BE8(setend be)
28 adr r0, 1f
29 ldr r0, [r0]
30 ldr r1, [r0]
31ARM_BE8(rev r1, r1)
32 mov pc, r1
331:
34 .word CPU_RESUME_ADDR_REG
35armada_375_smp_cpu1_enable_code_end:
36 21
37ENTRY(mvebu_cortex_a9_secondary_startup) 22ENTRY(mvebu_cortex_a9_secondary_startup)
38ARM_BE8(setend be) 23ARM_BE8(setend be)
diff --git a/arch/arm/mach-mvebu/hotplug.c b/arch/arm/mach-mvebu/hotplug.c
deleted file mode 100644
index d95e91047168..000000000000
--- a/arch/arm/mach-mvebu/hotplug.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Symmetric Multi Processing (SMP) support for Armada XP
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Lior Amsalem <alior@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/smp.h>
17#include <asm/proc-fns.h>
18#include "common.h"
19
20/*
21 * platform-specific code to shutdown a CPU
22 *
23 * Called with IRQs disabled
24 */
25void __ref armada_xp_cpu_die(unsigned int cpu)
26{
27 cpu_do_idle();
28
29 /* We should never return from idle */
30 panic("mvebu: cpu %d unexpectedly exit from shutdown\n", cpu);
31}
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
index 46f105913c84..6b5310828eb2 100644
--- a/arch/arm/mach-mvebu/kirkwood.c
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -180,6 +180,9 @@ static void __init kirkwood_dt_init(void)
180 kirkwood_pm_init(); 180 kirkwood_pm_init();
181 kirkwood_dt_eth_fixup(); 181 kirkwood_dt_eth_fixup();
182 182
183 if (of_machine_is_compatible("lacie,netxbig"))
184 netxbig_init();
185
183 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); 186 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL);
184} 187}
185 188
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index d0f35b4d4a23..a99434bcee84 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -25,6 +25,7 @@
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/sys_soc.h> 27#include <linux/sys_soc.h>
28#include "common.h"
28#include "mvebu-soc-id.h" 29#include "mvebu-soc-id.h"
29 30
30#define PCIE_DEV_ID_OFF 0x0 31#define PCIE_DEV_ID_OFF 0x0
@@ -51,10 +52,10 @@ int mvebu_get_soc_id(u32 *dev, u32 *rev)
51 *rev = soc_rev; 52 *rev = soc_rev;
52 return 0; 53 return 0;
53 } else 54 } else
54 return -1; 55 return -ENODEV;
55} 56}
56 57
57static int __init mvebu_soc_id_init(void) 58static int __init get_soc_id_by_pci(void)
58{ 59{
59 struct device_node *np; 60 struct device_node *np;
60 int ret = 0; 61 int ret = 0;
@@ -129,6 +130,22 @@ clk_err:
129 130
130 return ret; 131 return ret;
131} 132}
133
134static int __init mvebu_soc_id_init(void)
135{
136
137 /*
138 * First try to get the ID and the revision by the system
139 * register and use PCI registers only if it is not possible
140 */
141 if (!mvebu_system_controller_get_soc_id(&soc_dev_id, &soc_rev)) {
142 is_id_valid = true;
143 pr_info("MVEBU SoC ID=0x%X, Rev=0x%X\n", soc_dev_id, soc_rev);
144 return 0;
145 }
146
147 return get_soc_id_by_pci();
148}
132early_initcall(mvebu_soc_id_init); 149early_initcall(mvebu_soc_id_init);
133 150
134static int __init mvebu_soc_device(void) 151static int __init mvebu_soc_device(void)
diff --git a/arch/arm/mach-mvebu/netxbig.c b/arch/arm/mach-mvebu/netxbig.c
new file mode 100644
index 000000000000..94b11b6585a4
--- /dev/null
+++ b/arch/arm/mach-mvebu/netxbig.c
@@ -0,0 +1,191 @@
1/*
2 * arch/arm/mach-mvbu/board-netxbig.c
3 *
4 * LaCie 2Big and 5Big Network v2 board setup
5 *
6 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/of.h>
21#include <linux/platform_device.h>
22#include <linux/platform_data/leds-kirkwood-netxbig.h>
23#include "common.h"
24
25/*****************************************************************************
26 * GPIO extension LEDs
27 ****************************************************************************/
28
29/*
30 * The LEDs are controlled by a CPLD and can be configured through a GPIO
31 * extension bus:
32 *
33 * - address register : bit [0-2] -> GPIO [47-49]
34 * - data register : bit [0-2] -> GPIO [44-46]
35 * - enable register : GPIO 29
36 */
37
38static int netxbig_v2_gpio_ext_addr[] = { 47, 48, 49 };
39static int netxbig_v2_gpio_ext_data[] = { 44, 45, 46 };
40
41static struct netxbig_gpio_ext netxbig_v2_gpio_ext = {
42 .addr = netxbig_v2_gpio_ext_addr,
43 .num_addr = ARRAY_SIZE(netxbig_v2_gpio_ext_addr),
44 .data = netxbig_v2_gpio_ext_data,
45 .num_data = ARRAY_SIZE(netxbig_v2_gpio_ext_data),
46 .enable = 29,
47};
48
49/*
50 * Address register selection:
51 *
52 * addr | register
53 * ----------------------------
54 * 0 | front LED
55 * 1 | front LED brightness
56 * 2 | SATA LED brightness
57 * 3 | SATA0 LED
58 * 4 | SATA1 LED
59 * 5 | SATA2 LED
60 * 6 | SATA3 LED
61 * 7 | SATA4 LED
62 *
63 * Data register configuration:
64 *
65 * data | LED brightness
66 * -------------------------------------------------
67 * 0 | min (off)
68 * - | -
69 * 7 | max
70 *
71 * data | front LED mode
72 * -------------------------------------------------
73 * 0 | fix off
74 * 1 | fix blue on
75 * 2 | fix red on
76 * 3 | blink blue on=1 sec and blue off=1 sec
77 * 4 | blink red on=1 sec and red off=1 sec
78 * 5 | blink blue on=2.5 sec and red on=0.5 sec
79 * 6 | blink blue on=1 sec and red on=1 sec
80 * 7 | blink blue on=0.5 sec and blue off=2.5 sec
81 *
82 * data | SATA LED mode
83 * -------------------------------------------------
84 * 0 | fix off
85 * 1 | SATA activity blink
86 * 2 | fix red on
87 * 3 | blink blue on=1 sec and blue off=1 sec
88 * 4 | blink red on=1 sec and red off=1 sec
89 * 5 | blink blue on=2.5 sec and red on=0.5 sec
90 * 6 | blink blue on=1 sec and red on=1 sec
91 * 7 | fix blue on
92 */
93
94static int netxbig_v2_red_mled[NETXBIG_LED_MODE_NUM] = {
95 [NETXBIG_LED_OFF] = 0,
96 [NETXBIG_LED_ON] = 2,
97 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
98 [NETXBIG_LED_TIMER1] = 4,
99 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
100};
101
102static int netxbig_v2_blue_pwr_mled[NETXBIG_LED_MODE_NUM] = {
103 [NETXBIG_LED_OFF] = 0,
104 [NETXBIG_LED_ON] = 1,
105 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
106 [NETXBIG_LED_TIMER1] = 3,
107 [NETXBIG_LED_TIMER2] = 7,
108};
109
110static int netxbig_v2_blue_sata_mled[NETXBIG_LED_MODE_NUM] = {
111 [NETXBIG_LED_OFF] = 0,
112 [NETXBIG_LED_ON] = 7,
113 [NETXBIG_LED_SATA] = 1,
114 [NETXBIG_LED_TIMER1] = 3,
115 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
116};
117
118static struct netxbig_led_timer netxbig_v2_led_timer[] = {
119 [0] = {
120 .delay_on = 500,
121 .delay_off = 500,
122 .mode = NETXBIG_LED_TIMER1,
123 },
124 [1] = {
125 .delay_on = 500,
126 .delay_off = 1000,
127 .mode = NETXBIG_LED_TIMER2,
128 },
129};
130
131#define NETXBIG_LED(_name, maddr, mval, baddr) \
132 { .name = _name, \
133 .mode_addr = maddr, \
134 .mode_val = mval, \
135 .bright_addr = baddr }
136
137static struct netxbig_led net2big_v2_leds_ctrl[] = {
138 NETXBIG_LED("net2big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
139 NETXBIG_LED("net2big-v2:red:power", 0, netxbig_v2_red_mled, 1),
140 NETXBIG_LED("net2big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
141 NETXBIG_LED("net2big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
142 NETXBIG_LED("net2big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
143 NETXBIG_LED("net2big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
144};
145
146static struct netxbig_led_platform_data net2big_v2_leds_data = {
147 .gpio_ext = &netxbig_v2_gpio_ext,
148 .timer = netxbig_v2_led_timer,
149 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
150 .leds = net2big_v2_leds_ctrl,
151 .num_leds = ARRAY_SIZE(net2big_v2_leds_ctrl),
152};
153
154static struct netxbig_led net5big_v2_leds_ctrl[] = {
155 NETXBIG_LED("net5big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
156 NETXBIG_LED("net5big-v2:red:power", 0, netxbig_v2_red_mled, 1),
157 NETXBIG_LED("net5big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
158 NETXBIG_LED("net5big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
159 NETXBIG_LED("net5big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
160 NETXBIG_LED("net5big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
161 NETXBIG_LED("net5big-v2:blue:sata2", 5, netxbig_v2_blue_sata_mled, 2),
162 NETXBIG_LED("net5big-v2:red:sata2", 5, netxbig_v2_red_mled, 2),
163 NETXBIG_LED("net5big-v2:blue:sata3", 6, netxbig_v2_blue_sata_mled, 2),
164 NETXBIG_LED("net5big-v2:red:sata3", 6, netxbig_v2_red_mled, 2),
165 NETXBIG_LED("net5big-v2:blue:sata4", 7, netxbig_v2_blue_sata_mled, 2),
166 NETXBIG_LED("net5big-v2:red:sata4", 7, netxbig_v2_red_mled, 2),
167};
168
169static struct netxbig_led_platform_data net5big_v2_leds_data = {
170 .gpio_ext = &netxbig_v2_gpio_ext,
171 .timer = netxbig_v2_led_timer,
172 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
173 .leds = net5big_v2_leds_ctrl,
174 .num_leds = ARRAY_SIZE(net5big_v2_leds_ctrl),
175};
176
177static struct platform_device netxbig_v2_leds = {
178 .name = "leds-netxbig",
179 .id = -1,
180 .dev = {
181 .platform_data = &net2big_v2_leds_data,
182 },
183};
184
185void __init netxbig_init(void)
186{
187
188 if (of_machine_is_compatible("lacie,net5big_v2"))
189 netxbig_v2_leds.dev.platform_data = &net5big_v2_leds_data;
190 platform_device_register(&netxbig_v2_leds);
191}
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
index 96c2c59e34b6..47a71a924b96 100644
--- a/arch/arm/mach-mvebu/platsmp-a9.c
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -20,33 +20,8 @@
20#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
21#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
22#include "common.h" 22#include "common.h"
23#include "mvebu-soc-id.h"
24#include "pmsu.h" 23#include "pmsu.h"
25 24
26#define CRYPT0_ENG_ID 41
27#define CRYPT0_ENG_ATTR 0x1
28#define SRAM_PHYS_BASE 0xFFFF0000
29
30#define BOOTROM_BASE 0xFFF00000
31#define BOOTROM_SIZE 0x100000
32
33extern unsigned char armada_375_smp_cpu1_enable_code_end;
34extern unsigned char armada_375_smp_cpu1_enable_code_start;
35
36void armada_375_smp_cpu1_enable_wa(void)
37{
38 void __iomem *sram_virt_base;
39
40 mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
41 mvebu_mbus_add_window_by_id(CRYPT0_ENG_ID, CRYPT0_ENG_ATTR,
42 SRAM_PHYS_BASE, SZ_64K);
43 sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K);
44
45 memcpy(sram_virt_base, &armada_375_smp_cpu1_enable_code_start,
46 &armada_375_smp_cpu1_enable_code_end
47 - &armada_375_smp_cpu1_enable_code_start);
48}
49
50extern void mvebu_cortex_a9_secondary_startup(void); 25extern void mvebu_cortex_a9_secondary_startup(void);
51 26
52static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu, 27static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
@@ -63,21 +38,10 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
63 * address. 38 * address.
64 */ 39 */
65 hw_cpu = cpu_logical_map(cpu); 40 hw_cpu = cpu_logical_map(cpu);
66 41 if (of_machine_is_compatible("marvell,armada375"))
67 if (of_machine_is_compatible("marvell,armada375")) {
68 u32 dev, rev;
69
70 if (mvebu_get_soc_id(&dev, &rev) == 0 &&
71 rev == ARMADA_375_Z1_REV)
72 armada_375_smp_cpu1_enable_wa();
73
74 mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup); 42 mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup);
75 } 43 else
76 else { 44 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cortex_a9_secondary_startup);
77 mvebu_pmsu_set_cpu_boot_addr(hw_cpu,
78 mvebu_cortex_a9_secondary_startup);
79 }
80
81 smp_wmb(); 45 smp_wmb();
82 ret = mvebu_cpu_reset_deassert(hw_cpu); 46 ret = mvebu_cpu_reset_deassert(hw_cpu);
83 if (ret) { 47 if (ret) {
@@ -91,9 +55,6 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
91 55
92static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = { 56static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
93 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary, 57 .smp_boot_secondary = mvebu_cortex_a9_boot_secondary,
94#ifdef CONFIG_HOTPLUG_CPU
95 .cpu_die = armada_xp_cpu_die,
96#endif
97}; 58};
98 59
99CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp", 60CPU_METHOD_OF_DECLARE(mvebu_armada_375_smp, "marvell,armada-375-smp",
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 88b976b31719..895dc373c8a1 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -67,6 +67,7 @@ static void __init set_secondary_cpus_clock(void)
67 if (!cpu_clk) 67 if (!cpu_clk)
68 return; 68 return;
69 clk_set_rate(cpu_clk, rate); 69 clk_set_rate(cpu_clk, rate);
70 clk_prepare_enable(cpu_clk);
70 } 71 }
71} 72}
72 73
@@ -78,6 +79,17 @@ static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
78 79
79 hw_cpu = cpu_logical_map(cpu); 80 hw_cpu = cpu_logical_map(cpu);
80 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup); 81 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup);
82
83 /*
84 * This is needed to wake up CPUs in the offline state after
85 * using CPU hotplug.
86 */
87 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
88
89 /*
90 * This is needed to take secondary CPUs out of reset on the
91 * initial boot.
92 */
81 ret = mvebu_cpu_reset_deassert(hw_cpu); 93 ret = mvebu_cpu_reset_deassert(hw_cpu);
82 if (ret) { 94 if (ret) {
83 pr_warn("unable to boot CPU: %d\n", ret); 95 pr_warn("unable to boot CPU: %d\n", ret);
@@ -87,6 +99,19 @@ static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
87 return 0; 99 return 0;
88} 100}
89 101
102/*
103 * When a CPU is brought back online, either through CPU hotplug, or
104 * because of the boot of a kexec'ed kernel, the PMSU configuration
105 * for this CPU might be in the deep idle state, preventing this CPU
106 * from receiving interrupts. Here, we therefore take out the current
107 * CPU from this state, which was entered by armada_xp_cpu_die()
108 * below.
109 */
110static void armada_xp_secondary_init(unsigned int cpu)
111{
112 mvebu_v7_pmsu_idle_exit();
113}
114
90static void __init armada_xp_smp_init_cpus(void) 115static void __init armada_xp_smp_init_cpus(void)
91{ 116{
92 unsigned int ncores = num_possible_cpus(); 117 unsigned int ncores = num_possible_cpus();
@@ -122,12 +147,36 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
122 panic("The address for the BootROM is incorrect"); 147 panic("The address for the BootROM is incorrect");
123} 148}
124 149
150#ifdef CONFIG_HOTPLUG_CPU
151static void armada_xp_cpu_die(unsigned int cpu)
152{
153 /*
154 * CPU hotplug is implemented by putting offline CPUs into the
155 * deep idle sleep state.
156 */
157 armada_370_xp_pmsu_idle_enter(true);
158}
159
160/*
161 * We need a dummy function, so that platform_can_cpu_hotplug() knows
162 * we support CPU hotplug. However, the function does not need to do
163 * anything, because CPUs going offline can enter the deep idle state
164 * by themselves, without any help from a still alive CPU.
165 */
166static int armada_xp_cpu_kill(unsigned int cpu)
167{
168 return 1;
169}
170#endif
171
125struct smp_operations armada_xp_smp_ops __initdata = { 172struct smp_operations armada_xp_smp_ops __initdata = {
126 .smp_init_cpus = armada_xp_smp_init_cpus, 173 .smp_init_cpus = armada_xp_smp_init_cpus,
127 .smp_prepare_cpus = armada_xp_smp_prepare_cpus, 174 .smp_prepare_cpus = armada_xp_smp_prepare_cpus,
128 .smp_boot_secondary = armada_xp_boot_secondary, 175 .smp_boot_secondary = armada_xp_boot_secondary,
176 .smp_secondary_init = armada_xp_secondary_init,
129#ifdef CONFIG_HOTPLUG_CPU 177#ifdef CONFIG_HOTPLUG_CPU
130 .cpu_die = armada_xp_cpu_die, 178 .cpu_die = armada_xp_cpu_die,
179 .cpu_kill = armada_xp_cpu_kill,
131#endif 180#endif
132}; 181};
133 182
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 25aa8237d668..8a70a51533fd 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -18,22 +18,29 @@
18 18
19#define pr_fmt(fmt) "mvebu-pmsu: " fmt 19#define pr_fmt(fmt) "mvebu-pmsu: " fmt
20 20
21#include <linux/clk.h>
21#include <linux/cpu_pm.h> 22#include <linux/cpu_pm.h>
22#include <linux/kernel.h> 23#include <linux/delay.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/of_address.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/kernel.h>
27#include <linux/mbus.h>
28#include <linux/of_address.h>
29#include <linux/of_device.h>
26#include <linux/platform_device.h> 30#include <linux/platform_device.h>
27#include <linux/smp.h> 31#include <linux/pm_opp.h>
28#include <linux/resource.h> 32#include <linux/resource.h>
33#include <linux/slab.h>
34#include <linux/smp.h>
29#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
30#include <asm/cp15.h> 36#include <asm/cp15.h>
37#include <asm/smp_scu.h>
31#include <asm/smp_plat.h> 38#include <asm/smp_plat.h>
32#include <asm/suspend.h> 39#include <asm/suspend.h>
33#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
34#include "common.h" 41#include "common.h"
42#include "armada-370-xp.h"
35 43
36static void __iomem *pmsu_mp_base;
37 44
38#define PMSU_BASE_OFFSET 0x100 45#define PMSU_BASE_OFFSET 0x100
39#define PMSU_REG_SIZE 0x1000 46#define PMSU_REG_SIZE 0x1000
@@ -57,20 +64,45 @@ static void __iomem *pmsu_mp_base;
57#define PMSU_STATUS_AND_MASK_IRQ_MASK BIT(24) 64#define PMSU_STATUS_AND_MASK_IRQ_MASK BIT(24)
58#define PMSU_STATUS_AND_MASK_FIQ_MASK BIT(25) 65#define PMSU_STATUS_AND_MASK_FIQ_MASK BIT(25)
59 66
67#define PMSU_EVENT_STATUS_AND_MASK(cpu) ((cpu * 0x100) + 0x120)
68#define PMSU_EVENT_STATUS_AND_MASK_DFS_DONE BIT(1)
69#define PMSU_EVENT_STATUS_AND_MASK_DFS_DONE_MASK BIT(17)
70
60#define PMSU_BOOT_ADDR_REDIRECT_OFFSET(cpu) ((cpu * 0x100) + 0x124) 71#define PMSU_BOOT_ADDR_REDIRECT_OFFSET(cpu) ((cpu * 0x100) + 0x124)
61 72
62/* PMSU fabric registers */ 73/* PMSU fabric registers */
63#define L2C_NFABRIC_PM_CTL 0x4 74#define L2C_NFABRIC_PM_CTL 0x4
64#define L2C_NFABRIC_PM_CTL_PWR_DOWN BIT(20) 75#define L2C_NFABRIC_PM_CTL_PWR_DOWN BIT(20)
65 76
77/* PMSU delay registers */
78#define PMSU_POWERDOWN_DELAY 0xF04
79#define PMSU_POWERDOWN_DELAY_PMU BIT(1)
80#define PMSU_POWERDOWN_DELAY_MASK 0xFFFE
81#define PMSU_DFLT_ARMADA38X_DELAY 0x64
82
83/* CA9 MPcore SoC Control registers */
84
85#define MPCORE_RESET_CTL 0x64
86#define MPCORE_RESET_CTL_L2 BIT(0)
87#define MPCORE_RESET_CTL_DEBUG BIT(16)
88
89#define SRAM_PHYS_BASE 0xFFFF0000
90#define BOOTROM_BASE 0xFFF00000
91#define BOOTROM_SIZE 0x100000
92
93#define ARMADA_370_CRYPT0_ENG_TARGET 0x9
94#define ARMADA_370_CRYPT0_ENG_ATTR 0x1
95
66extern void ll_disable_coherency(void); 96extern void ll_disable_coherency(void);
67extern void ll_enable_coherency(void); 97extern void ll_enable_coherency(void);
68 98
69extern void armada_370_xp_cpu_resume(void); 99extern void armada_370_xp_cpu_resume(void);
100extern void armada_38x_cpu_resume(void);
70 101
71static struct platform_device armada_xp_cpuidle_device = { 102static phys_addr_t pmsu_mp_phys_base;
72 .name = "cpuidle-armada-370-xp", 103static void __iomem *pmsu_mp_base;
73}; 104
105static void *mvebu_cpu_resume;
74 106
75static struct of_device_id of_pmsu_table[] = { 107static struct of_device_id of_pmsu_table[] = {
76 { .compatible = "marvell,armada-370-pmsu", }, 108 { .compatible = "marvell,armada-370-pmsu", },
@@ -85,7 +117,49 @@ void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
85 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); 117 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
86} 118}
87 119
88static int __init armada_370_xp_pmsu_init(void) 120extern unsigned char mvebu_boot_wa_start;
121extern unsigned char mvebu_boot_wa_end;
122
123/*
124 * This function sets up the boot address workaround needed for SMP
125 * boot on Armada 375 Z1 and cpuidle on Armada 370. It unmaps the
126 * BootROM Mbus window, and instead remaps a crypto SRAM into which a
127 * custom piece of code is copied to replace the problematic BootROM.
128 */
129int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
130 unsigned int crypto_eng_attribute,
131 phys_addr_t resume_addr_reg)
132{
133 void __iomem *sram_virt_base;
134 u32 code_len = &mvebu_boot_wa_end - &mvebu_boot_wa_start;
135
136 mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
137 mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute,
138 SRAM_PHYS_BASE, SZ_64K);
139
140 sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K);
141 if (!sram_virt_base) {
142 pr_err("Unable to map SRAM to setup the boot address WA\n");
143 return -ENOMEM;
144 }
145
146 memcpy(sram_virt_base, &mvebu_boot_wa_start, code_len);
147
148 /*
149 * The last word of the code copied in SRAM must contain the
150 * physical base address of the PMSU register. We
151 * intentionally store this address in the native endianness
152 * of the system.
153 */
154 __raw_writel((unsigned long)resume_addr_reg,
155 sram_virt_base + code_len - 4);
156
157 iounmap(sram_virt_base);
158
159 return 0;
160}
161
162static int __init mvebu_v7_pmsu_init(void)
89{ 163{
90 struct device_node *np; 164 struct device_node *np;
91 struct resource res; 165 struct resource res;
@@ -116,6 +190,8 @@ static int __init armada_370_xp_pmsu_init(void)
116 goto out; 190 goto out;
117 } 191 }
118 192
193 pmsu_mp_phys_base = res.start;
194
119 pmsu_mp_base = ioremap(res.start, resource_size(&res)); 195 pmsu_mp_base = ioremap(res.start, resource_size(&res));
120 if (!pmsu_mp_base) { 196 if (!pmsu_mp_base) {
121 pr_err("unable to map registers\n"); 197 pr_err("unable to map registers\n");
@@ -129,7 +205,7 @@ static int __init armada_370_xp_pmsu_init(void)
129 return ret; 205 return ret;
130} 206}
131 207
132static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void) 208static void mvebu_v7_pmsu_enable_l2_powerdown_onidle(void)
133{ 209{
134 u32 reg; 210 u32 reg;
135 211
@@ -142,14 +218,20 @@ static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void)
142 writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); 218 writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL);
143} 219}
144 220
221enum pmsu_idle_prepare_flags {
222 PMSU_PREPARE_NORMAL = 0,
223 PMSU_PREPARE_DEEP_IDLE = BIT(0),
224 PMSU_PREPARE_SNOOP_DISABLE = BIT(1),
225};
226
145/* No locking is needed because we only access per-CPU registers */ 227/* No locking is needed because we only access per-CPU registers */
146void armada_370_xp_pmsu_idle_prepare(bool deepidle) 228static int mvebu_v7_pmsu_idle_prepare(unsigned long flags)
147{ 229{
148 unsigned int hw_cpu = cpu_logical_map(smp_processor_id()); 230 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
149 u32 reg; 231 u32 reg;
150 232
151 if (pmsu_mp_base == NULL) 233 if (pmsu_mp_base == NULL)
152 return; 234 return -EINVAL;
153 235
154 /* 236 /*
155 * Adjust the PMSU configuration to wait for WFI signal, enable 237 * Adjust the PMSU configuration to wait for WFI signal, enable
@@ -167,22 +249,34 @@ void armada_370_xp_pmsu_idle_prepare(bool deepidle)
167 249
168 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu)); 250 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
169 /* ask HW to power down the L2 Cache if needed */ 251 /* ask HW to power down the L2 Cache if needed */
170 if (deepidle) 252 if (flags & PMSU_PREPARE_DEEP_IDLE)
171 reg |= PMSU_CONTROL_AND_CONFIG_L2_PWDDN; 253 reg |= PMSU_CONTROL_AND_CONFIG_L2_PWDDN;
172 254
173 /* request power down */ 255 /* request power down */
174 reg |= PMSU_CONTROL_AND_CONFIG_PWDDN_REQ; 256 reg |= PMSU_CONTROL_AND_CONFIG_PWDDN_REQ;
175 writel(reg, pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu)); 257 writel(reg, pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
176 258
177 /* Disable snoop disable by HW - SW is taking care of it */ 259 if (flags & PMSU_PREPARE_SNOOP_DISABLE) {
178 reg = readl(pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu)); 260 /* Disable snoop disable by HW - SW is taking care of it */
179 reg |= PMSU_CPU_POWER_DOWN_DIS_SNP_Q_SKIP; 261 reg = readl(pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu));
180 writel(reg, pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu)); 262 reg |= PMSU_CPU_POWER_DOWN_DIS_SNP_Q_SKIP;
263 writel(reg, pmsu_mp_base + PMSU_CPU_POWER_DOWN_CONTROL(hw_cpu));
264 }
265
266 return 0;
181} 267}
182 268
183static noinline int do_armada_370_xp_cpu_suspend(unsigned long deepidle) 269int armada_370_xp_pmsu_idle_enter(unsigned long deepidle)
184{ 270{
185 armada_370_xp_pmsu_idle_prepare(deepidle); 271 unsigned long flags = PMSU_PREPARE_SNOOP_DISABLE;
272 int ret;
273
274 if (deepidle)
275 flags |= PMSU_PREPARE_DEEP_IDLE;
276
277 ret = mvebu_v7_pmsu_idle_prepare(flags);
278 if (ret)
279 return ret;
186 280
187 v7_exit_coherency_flush(all); 281 v7_exit_coherency_flush(all);
188 282
@@ -208,25 +302,50 @@ static noinline int do_armada_370_xp_cpu_suspend(unsigned long deepidle)
208 "isb " 302 "isb "
209 : : : "r0"); 303 : : : "r0");
210 304
211 pr_warn("Failed to suspend the system\n"); 305 pr_debug("Failed to suspend the system\n");
212 306
213 return 0; 307 return 0;
214} 308}
215 309
216static int armada_370_xp_cpu_suspend(unsigned long deepidle) 310static int armada_370_xp_cpu_suspend(unsigned long deepidle)
217{ 311{
218 return cpu_suspend(deepidle, do_armada_370_xp_cpu_suspend); 312 return cpu_suspend(deepidle, armada_370_xp_pmsu_idle_enter);
313}
314
315static int armada_38x_do_cpu_suspend(unsigned long deepidle)
316{
317 unsigned long flags = 0;
318
319 if (deepidle)
320 flags |= PMSU_PREPARE_DEEP_IDLE;
321
322 mvebu_v7_pmsu_idle_prepare(flags);
323 /*
324 * Already flushed cache, but do it again as the outer cache
325 * functions dirty the cache with spinlocks
326 */
327 v7_exit_coherency_flush(louis);
328
329 scu_power_mode(mvebu_get_scu_base(), SCU_PM_POWEROFF);
330
331 cpu_do_idle();
332
333 return 1;
334}
335
336static int armada_38x_cpu_suspend(unsigned long deepidle)
337{
338 return cpu_suspend(false, armada_38x_do_cpu_suspend);
219} 339}
220 340
221/* No locking is needed because we only access per-CPU registers */ 341/* No locking is needed because we only access per-CPU registers */
222static noinline void armada_370_xp_pmsu_idle_restore(void) 342void mvebu_v7_pmsu_idle_exit(void)
223{ 343{
224 unsigned int hw_cpu = cpu_logical_map(smp_processor_id()); 344 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
225 u32 reg; 345 u32 reg;
226 346
227 if (pmsu_mp_base == NULL) 347 if (pmsu_mp_base == NULL)
228 return; 348 return;
229
230 /* cancel ask HW to power down the L2 Cache if possible */ 349 /* cancel ask HW to power down the L2 Cache if possible */
231 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu)); 350 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(hw_cpu));
232 reg &= ~PMSU_CONTROL_AND_CONFIG_L2_PWDDN; 351 reg &= ~PMSU_CONTROL_AND_CONFIG_L2_PWDDN;
@@ -241,53 +360,292 @@ static noinline void armada_370_xp_pmsu_idle_restore(void)
241 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu)); 360 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu));
242} 361}
243 362
244static int armada_370_xp_cpu_pm_notify(struct notifier_block *self, 363static int mvebu_v7_cpu_pm_notify(struct notifier_block *self,
245 unsigned long action, void *hcpu) 364 unsigned long action, void *hcpu)
246{ 365{
247 if (action == CPU_PM_ENTER) { 366 if (action == CPU_PM_ENTER) {
248 unsigned int hw_cpu = cpu_logical_map(smp_processor_id()); 367 unsigned int hw_cpu = cpu_logical_map(smp_processor_id());
249 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_370_xp_cpu_resume); 368 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, mvebu_cpu_resume);
250 } else if (action == CPU_PM_EXIT) { 369 } else if (action == CPU_PM_EXIT) {
251 armada_370_xp_pmsu_idle_restore(); 370 mvebu_v7_pmsu_idle_exit();
252 } 371 }
253 372
254 return NOTIFY_OK; 373 return NOTIFY_OK;
255} 374}
256 375
257static struct notifier_block armada_370_xp_cpu_pm_notifier = { 376static struct notifier_block mvebu_v7_cpu_pm_notifier = {
258 .notifier_call = armada_370_xp_cpu_pm_notify, 377 .notifier_call = mvebu_v7_cpu_pm_notify,
259}; 378};
260 379
261int __init armada_370_xp_cpu_pm_init(void) 380static struct platform_device mvebu_v7_cpuidle_device;
381
382static __init int armada_370_cpuidle_init(void)
262{ 383{
263 struct device_node *np; 384 struct device_node *np;
385 phys_addr_t redirect_reg;
386
387 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
388 if (!np)
389 return -ENODEV;
390 of_node_put(np);
264 391
265 /* 392 /*
266 * Check that all the requirements are available to enable 393 * On Armada 370, there is "a slow exit process from the deep
267 * cpuidle. So far, it is only supported on Armada XP, cpuidle 394 * idle state due to heavy L1/L2 cache cleanup operations
268 * needs the coherency fabric and the PMSU enabled 395 * performed by the BootROM software". To avoid this, we
396 * replace the restart code of the bootrom by a a simple jump
397 * to the boot address. Then the code located at this boot
398 * address will take care of the initialization.
269 */ 399 */
400 redirect_reg = pmsu_mp_phys_base + PMSU_BOOT_ADDR_REDIRECT_OFFSET(0);
401 mvebu_setup_boot_addr_wa(ARMADA_370_CRYPT0_ENG_TARGET,
402 ARMADA_370_CRYPT0_ENG_ATTR,
403 redirect_reg);
270 404
271 if (!of_machine_is_compatible("marvell,armadaxp")) 405 mvebu_cpu_resume = armada_370_xp_cpu_resume;
272 return 0; 406 mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
407 mvebu_v7_cpuidle_device.name = "cpuidle-armada-370";
408
409 return 0;
410}
411
412static __init int armada_38x_cpuidle_init(void)
413{
414 struct device_node *np;
415 void __iomem *mpsoc_base;
416 u32 reg;
417
418 np = of_find_compatible_node(NULL, NULL,
419 "marvell,armada-380-coherency-fabric");
420 if (!np)
421 return -ENODEV;
422 of_node_put(np);
423
424 np = of_find_compatible_node(NULL, NULL,
425 "marvell,armada-380-mpcore-soc-ctrl");
426 if (!np)
427 return -ENODEV;
428 mpsoc_base = of_iomap(np, 0);
429 BUG_ON(!mpsoc_base);
430 of_node_put(np);
431
432 /* Set up reset mask when powering down the cpus */
433 reg = readl(mpsoc_base + MPCORE_RESET_CTL);
434 reg |= MPCORE_RESET_CTL_L2;
435 reg |= MPCORE_RESET_CTL_DEBUG;
436 writel(reg, mpsoc_base + MPCORE_RESET_CTL);
437 iounmap(mpsoc_base);
438
439 /* Set up delay */
440 reg = readl(pmsu_mp_base + PMSU_POWERDOWN_DELAY);
441 reg &= ~PMSU_POWERDOWN_DELAY_MASK;
442 reg |= PMSU_DFLT_ARMADA38X_DELAY;
443 reg |= PMSU_POWERDOWN_DELAY_PMU;
444 writel(reg, pmsu_mp_base + PMSU_POWERDOWN_DELAY);
445
446 mvebu_cpu_resume = armada_38x_cpu_resume;
447 mvebu_v7_cpuidle_device.dev.platform_data = armada_38x_cpu_suspend;
448 mvebu_v7_cpuidle_device.name = "cpuidle-armada-38x";
449
450 return 0;
451}
452
453static __init int armada_xp_cpuidle_init(void)
454{
455 struct device_node *np;
273 456
274 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); 457 np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
275 if (!np) 458 if (!np)
276 return 0; 459 return -ENODEV;
277 of_node_put(np); 460 of_node_put(np);
278 461
462 mvebu_cpu_resume = armada_370_xp_cpu_resume;
463 mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend;
464 mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp";
465
466 return 0;
467}
468
469static int __init mvebu_v7_cpu_pm_init(void)
470{
471 struct device_node *np;
472 int ret;
473
279 np = of_find_matching_node(NULL, of_pmsu_table); 474 np = of_find_matching_node(NULL, of_pmsu_table);
280 if (!np) 475 if (!np)
281 return 0; 476 return 0;
282 of_node_put(np); 477 of_node_put(np);
283 478
284 armada_370_xp_pmsu_enable_l2_powerdown_onidle(); 479 if (of_machine_is_compatible("marvell,armadaxp"))
285 armada_xp_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; 480 ret = armada_xp_cpuidle_init();
286 platform_device_register(&armada_xp_cpuidle_device); 481 else if (of_machine_is_compatible("marvell,armada370"))
287 cpu_pm_register_notifier(&armada_370_xp_cpu_pm_notifier); 482 ret = armada_370_cpuidle_init();
483 else if (of_machine_is_compatible("marvell,armada380"))
484 ret = armada_38x_cpuidle_init();
485 else
486 return 0;
487
488 if (ret)
489 return ret;
490
491 mvebu_v7_pmsu_enable_l2_powerdown_onidle();
492 platform_device_register(&mvebu_v7_cpuidle_device);
493 cpu_pm_register_notifier(&mvebu_v7_cpu_pm_notifier);
494
495 return 0;
496}
497
498arch_initcall(mvebu_v7_cpu_pm_init);
499early_initcall(mvebu_v7_pmsu_init);
500
501static void mvebu_pmsu_dfs_request_local(void *data)
502{
503 u32 reg;
504 u32 cpu = smp_processor_id();
505 unsigned long flags;
506
507 local_irq_save(flags);
508
509 /* Prepare to enter idle */
510 reg = readl(pmsu_mp_base + PMSU_STATUS_AND_MASK(cpu));
511 reg |= PMSU_STATUS_AND_MASK_CPU_IDLE_WAIT |
512 PMSU_STATUS_AND_MASK_IRQ_MASK |
513 PMSU_STATUS_AND_MASK_FIQ_MASK;
514 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(cpu));
515
516 /* Request the DFS transition */
517 reg = readl(pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(cpu));
518 reg |= PMSU_CONTROL_AND_CONFIG_DFS_REQ;
519 writel(reg, pmsu_mp_base + PMSU_CONTROL_AND_CONFIG(cpu));
520
521 /* The fact of entering idle will trigger the DFS transition */
522 wfi();
523
524 /*
525 * We're back from idle, the DFS transition has completed,
526 * clear the idle wait indication.
527 */
528 reg = readl(pmsu_mp_base + PMSU_STATUS_AND_MASK(cpu));
529 reg &= ~PMSU_STATUS_AND_MASK_CPU_IDLE_WAIT;
530 writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(cpu));
531
532 local_irq_restore(flags);
533}
534
535int mvebu_pmsu_dfs_request(int cpu)
536{
537 unsigned long timeout;
538 int hwcpu = cpu_logical_map(cpu);
539 u32 reg;
540
541 /* Clear any previous DFS DONE event */
542 reg = readl(pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
543 reg &= ~PMSU_EVENT_STATUS_AND_MASK_DFS_DONE;
544 writel(reg, pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
545
546 /* Mask the DFS done interrupt, since we are going to poll */
547 reg = readl(pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
548 reg |= PMSU_EVENT_STATUS_AND_MASK_DFS_DONE_MASK;
549 writel(reg, pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
550
551 /* Trigger the DFS on the appropriate CPU */
552 smp_call_function_single(cpu, mvebu_pmsu_dfs_request_local,
553 NULL, false);
554
555 /* Poll until the DFS done event is generated */
556 timeout = jiffies + HZ;
557 while (time_before(jiffies, timeout)) {
558 reg = readl(pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
559 if (reg & PMSU_EVENT_STATUS_AND_MASK_DFS_DONE)
560 break;
561 udelay(10);
562 }
563
564 if (time_after(jiffies, timeout))
565 return -ETIME;
566
567 /* Restore the DFS mask to its original state */
568 reg = readl(pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
569 reg &= ~PMSU_EVENT_STATUS_AND_MASK_DFS_DONE_MASK;
570 writel(reg, pmsu_mp_base + PMSU_EVENT_STATUS_AND_MASK(hwcpu));
571
572 return 0;
573}
574
575static int __init armada_xp_pmsu_cpufreq_init(void)
576{
577 struct device_node *np;
578 struct resource res;
579 int ret, cpu;
580
581 if (!of_machine_is_compatible("marvell,armadaxp"))
582 return 0;
583
584 /*
585 * In order to have proper cpufreq handling, we need to ensure
586 * that the Device Tree description of the CPU clock includes
587 * the definition of the PMU DFS registers. If not, we do not
588 * register the clock notifier and the cpufreq driver. This
589 * piece of code is only for compatibility with old Device
590 * Trees.
591 */
592 np = of_find_compatible_node(NULL, NULL, "marvell,armada-xp-cpu-clock");
593 if (!np)
594 return 0;
595
596 ret = of_address_to_resource(np, 1, &res);
597 if (ret) {
598 pr_warn(FW_WARN "not enabling cpufreq, deprecated armada-xp-cpu-clock binding\n");
599 of_node_put(np);
600 return 0;
601 }
602
603 of_node_put(np);
604
605 /*
606 * For each CPU, this loop registers the operating points
607 * supported (which are the nominal CPU frequency and half of
608 * it), and registers the clock notifier that will take care
609 * of doing the PMSU part of a frequency transition.
610 */
611 for_each_possible_cpu(cpu) {
612 struct device *cpu_dev;
613 struct clk *clk;
614 int ret;
615
616 cpu_dev = get_cpu_device(cpu);
617 if (!cpu_dev) {
618 pr_err("Cannot get CPU %d\n", cpu);
619 continue;
620 }
621
622 clk = clk_get(cpu_dev, 0);
623 if (IS_ERR(clk)) {
624 pr_err("Cannot get clock for CPU %d\n", cpu);
625 return PTR_ERR(clk);
626 }
627
628 /*
629 * In case of a failure of dev_pm_opp_add(), we don't
630 * bother with cleaning up the registered OPP (there's
631 * no function to do so), and simply cancel the
632 * registration of the cpufreq device.
633 */
634 ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk), 0);
635 if (ret) {
636 clk_put(clk);
637 return ret;
638 }
639
640 ret = dev_pm_opp_add(cpu_dev, clk_get_rate(clk) / 2, 0);
641 if (ret) {
642 clk_put(clk);
643 return ret;
644 }
645 }
288 646
647 platform_device_register_simple("cpufreq-generic", -1, NULL, 0);
289 return 0; 648 return 0;
290} 649}
291 650
292arch_initcall(armada_370_xp_cpu_pm_init); 651device_initcall(armada_xp_pmsu_cpufreq_init);
293early_initcall(armada_370_xp_pmsu_init);
diff --git a/arch/arm/mach-mvebu/pmsu.h b/arch/arm/mach-mvebu/pmsu.h
index 07a737c6b95d..6b58c1fe2b0d 100644
--- a/arch/arm/mach-mvebu/pmsu.h
+++ b/arch/arm/mach-mvebu/pmsu.h
@@ -12,5 +12,10 @@
12#define __MACH_MVEBU_PMSU_H 12#define __MACH_MVEBU_PMSU_H
13 13
14int armada_xp_boot_cpu(unsigned int cpu_id, void *phys_addr); 14int armada_xp_boot_cpu(unsigned int cpu_id, void *phys_addr);
15int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
16 unsigned int crypto_eng_attribute,
17 phys_addr_t resume_addr_reg);
18
19void mvebu_v7_pmsu_idle_exit(void);
15 20
16#endif /* __MACH_370_XP_PMSU_H */ 21#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 fc3de68d8c54..a945756cfb45 100644
--- a/arch/arm/mach-mvebu/pmsu_ll.S
+++ b/arch/arm/mach-mvebu/pmsu_ll.S
@@ -23,3 +23,39 @@ ARM_BE8(setend be ) @ go BE8 if entered LE
23 b cpu_resume 23 b cpu_resume
24ENDPROC(armada_370_xp_cpu_resume) 24ENDPROC(armada_370_xp_cpu_resume)
25 25
26ENTRY(armada_38x_cpu_resume)
27 /* do we need it for Armada 38x*/
28ARM_BE8(setend be ) @ go BE8 if entered LE
29 bl v7_invalidate_l1
30 mrc p15, 4, r1, c15, c0 @ get SCU base address
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
38ENDPROC(armada_38x_cpu_resume)
39
40.global mvebu_boot_wa_start
41.global mvebu_boot_wa_end
42
43/* The following code will be executed from SRAM */
44ENTRY(mvebu_boot_wa_start)
45mvebu_boot_wa_start:
46ARM_BE8(setend be)
47 adr r0, 1f
48 ldr r0, [r0] @ load the address of the
49 @ resume register
50 ldr r0, [r0] @ load the value in the
51 @ resume register
52ARM_BE8(rev r0, r0) @ the value is stored LE
53 mov pc, r0 @ jump to this value
54/*
55 * the last word of this piece of code will be filled by the physical
56 * address of the boot address register just after being copied in SRAM
57 */
581:
59 .long .
60mvebu_boot_wa_end:
61ENDPROC(mvebu_boot_wa_end)
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 0c5524ac75b7..a068cb5c2ce8 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -28,8 +28,14 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/reboot.h> 29#include <linux/reboot.h>
30#include "common.h" 30#include "common.h"
31#include "mvebu-soc-id.h"
32#include "pmsu.h"
33
34#define ARMADA_375_CRYPT0_ENG_TARGET 41
35#define ARMADA_375_CRYPT0_ENG_ATTR 1
31 36
32static void __iomem *system_controller_base; 37static void __iomem *system_controller_base;
38static phys_addr_t system_controller_phys_base;
33 39
34struct mvebu_system_controller { 40struct mvebu_system_controller {
35 u32 rstoutn_mask_offset; 41 u32 rstoutn_mask_offset;
@@ -39,6 +45,9 @@ struct mvebu_system_controller {
39 u32 system_soft_reset; 45 u32 system_soft_reset;
40 46
41 u32 resume_boot_addr; 47 u32 resume_boot_addr;
48
49 u32 dev_id;
50 u32 rev_id;
42}; 51};
43static struct mvebu_system_controller *mvebu_sc; 52static struct mvebu_system_controller *mvebu_sc;
44 53
@@ -47,6 +56,8 @@ static const struct mvebu_system_controller armada_370_xp_system_controller = {
47 .system_soft_reset_offset = 0x64, 56 .system_soft_reset_offset = 0x64,
48 .rstoutn_mask_reset_out_en = 0x1, 57 .rstoutn_mask_reset_out_en = 0x1,
49 .system_soft_reset = 0x1, 58 .system_soft_reset = 0x1,
59 .dev_id = 0x38,
60 .rev_id = 0x3c,
50}; 61};
51 62
52static const struct mvebu_system_controller armada_375_system_controller = { 63static const struct mvebu_system_controller armada_375_system_controller = {
@@ -55,6 +66,8 @@ static const struct mvebu_system_controller armada_375_system_controller = {
55 .rstoutn_mask_reset_out_en = 0x1, 66 .rstoutn_mask_reset_out_en = 0x1,
56 .system_soft_reset = 0x1, 67 .system_soft_reset = 0x1,
57 .resume_boot_addr = 0xd4, 68 .resume_boot_addr = 0xd4,
69 .dev_id = 0x38,
70 .rev_id = 0x3c,
58}; 71};
59 72
60static const struct mvebu_system_controller orion_system_controller = { 73static const struct mvebu_system_controller orion_system_controller = {
@@ -101,11 +114,45 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd)
101 ; 114 ;
102} 115}
103 116
117int mvebu_system_controller_get_soc_id(u32 *dev, u32 *rev)
118{
119 if (of_machine_is_compatible("marvell,armada380") &&
120 system_controller_base) {
121 *dev = readl(system_controller_base + mvebu_sc->dev_id) >> 16;
122 *rev = (readl(system_controller_base + mvebu_sc->rev_id) >> 8)
123 & 0xF;
124 return 0;
125 } else
126 return -ENODEV;
127}
128
104#ifdef CONFIG_SMP 129#ifdef CONFIG_SMP
130void mvebu_armada375_smp_wa_init(void)
131{
132 u32 dev, rev;
133 phys_addr_t resume_addr_reg;
134
135 if (mvebu_get_soc_id(&dev, &rev) != 0)
136 return;
137
138 if (rev != ARMADA_375_Z1_REV)
139 return;
140
141 resume_addr_reg = system_controller_phys_base +
142 mvebu_sc->resume_boot_addr;
143 mvebu_setup_boot_addr_wa(ARMADA_375_CRYPT0_ENG_TARGET,
144 ARMADA_375_CRYPT0_ENG_ATTR,
145 resume_addr_reg);
146}
147
105void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr) 148void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr)
106{ 149{
107 BUG_ON(system_controller_base == NULL); 150 BUG_ON(system_controller_base == NULL);
108 BUG_ON(mvebu_sc->resume_boot_addr == 0); 151 BUG_ON(mvebu_sc->resume_boot_addr == 0);
152
153 if (of_machine_is_compatible("marvell,armada375"))
154 mvebu_armada375_smp_wa_init();
155
109 writel(virt_to_phys(boot_addr), system_controller_base + 156 writel(virt_to_phys(boot_addr), system_controller_base +
110 mvebu_sc->resume_boot_addr); 157 mvebu_sc->resume_boot_addr);
111} 158}
@@ -119,7 +166,10 @@ static int __init mvebu_system_controller_init(void)
119 np = of_find_matching_node_and_match(NULL, of_system_controller_table, 166 np = of_find_matching_node_and_match(NULL, of_system_controller_table,
120 &match); 167 &match);
121 if (np) { 168 if (np) {
169 struct resource res;
122 system_controller_base = of_iomap(np, 0); 170 system_controller_base = of_iomap(np, 0);
171 of_address_to_resource(np, 0, &res);
172 system_controller_phys_base = res.start;
123 mvebu_sc = (struct mvebu_system_controller *)match->data; 173 mvebu_sc = (struct mvebu_system_controller *)match->data;
124 of_node_put(np); 174 of_node_put(np);
125 } 175 }
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h
index 3c2530523111..058a4f7d44c5 100644
--- a/arch/arm/mach-omap1/include/mach/memory.h
+++ b/arch/arm/mach-omap1/include/mach/memory.h
@@ -6,11 +6,6 @@
6#define __ASM_ARCH_MEMORY_H 6#define __ASM_ARCH_MEMORY_H
7 7
8/* 8/*
9 * Physical DRAM offset.
10 */
11#define PLAT_PHYS_OFFSET UL(0x10000000)
12
13/*
14 * Bus address is physical address, except for OMAP-1510 Local Bus. 9 * Bus address is physical address, except for OMAP-1510 Local Bus.
15 * OMAP-1510 bus address is translated into a Local Bus address if the 10 * OMAP-1510 bus address is translated into a Local Bus address if the
16 * OMAP bus type is lbus. We do the address translation based on the 11 * OMAP bus type is lbus. We do the address translation based on the
diff --git a/arch/arm/mach-omap1/ocpi.c b/arch/arm/mach-omap1/ocpi.c
index 238170cab5b7..44a3d19eb481 100644
--- a/arch/arm/mach-omap1/ocpi.c
+++ b/arch/arm/mach-omap1/ocpi.c
@@ -55,7 +55,6 @@ static struct clk *ocpi_ck;
55 55
56/* 56/*
57 * Enables device access to OMAP buses via the OCPI bridge 57 * Enables device access to OMAP buses via the OCPI bridge
58 * FIXME: Add locking
59 */ 58 */
60int ocpi_enable(void) 59int ocpi_enable(void)
61{ 60{
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1c1ed737f7ab..e7189dcc9309 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -15,7 +15,6 @@ config ARCH_OMAP3
15 bool "TI OMAP3" 15 bool "TI OMAP3"
16 depends on ARCH_MULTI_V7 16 depends on ARCH_MULTI_V7
17 select ARCH_OMAP2PLUS 17 select ARCH_OMAP2PLUS
18 select ARCH_HAS_OPP
19 select ARM_CPU_SUSPEND if PM 18 select ARM_CPU_SUSPEND if PM
20 select OMAP_INTERCONNECT 19 select OMAP_INTERCONNECT
21 select PM_OPP if PM 20 select PM_OPP if PM
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 8ca99e9321e3..69bbcba8842f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -176,13 +176,11 @@ obj-$(CONFIG_SOC_DRA7XX) += clockdomains7xx_data.o
176 176
177# Clock framework 177# Clock framework
178obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o 178obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
179obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o
180obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o 179obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
181obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o 180obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
182obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o 181obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o
183obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o 182obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
184obj-$(CONFIG_SOC_OMAP2420) += cclock2420_data.o 183obj-$(CONFIG_SOC_OMAP2430) += clock2430.o
185obj-$(CONFIG_SOC_OMAP2430) += clock2430.o cclock2430_data.o
186obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o 184obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
187obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o 185obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
188obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o 186obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
@@ -202,6 +200,7 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
202obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o 200obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o
203 201
204# hwmod data 202# hwmod data
203obj-y += omap_hwmod_common_ipblock_data.o
205obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o 204obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o
206obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o 205obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o
207obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o 206obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o
@@ -232,10 +231,6 @@ obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o
232iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o 231iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
233obj-y += $(iommu-m) $(iommu-y) 232obj-y += $(iommu-m) $(iommu-y)
234 233
235ifneq ($(CONFIG_TIDSPBRIDGE),)
236obj-y += dsp.o
237endif
238
239# OMAP2420 MSDI controller integration support ("MMC") 234# OMAP2420 MSDI controller integration support ("MMC")
240obj-$(CONFIG_SOC_OMAP2420) += msdi.o 235obj-$(CONFIG_SOC_OMAP2420) += msdi.o
241 236
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 7da48bc42bbf..70b904c010c6 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -336,7 +336,7 @@ static int __init early_touchbook_revision(char *p)
336 if (!p) 336 if (!p)
337 return 0; 337 return 0;
338 338
339 return strict_strtoul(p, 10, &touchbook_revision); 339 return kstrtoul(p, 10, &touchbook_revision);
340} 340}
341early_param("tbr", early_touchbook_revision); 341early_param("tbr", early_touchbook_revision);
342 342
diff --git a/arch/arm/mach-omap2/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
deleted file mode 100644
index 3662f4d4c8ea..000000000000
--- a/arch/arm/mach-omap2/cclock2420_data.c
+++ /dev/null
@@ -1,1931 +0,0 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 * Updated to COMMON clk format by Rajendra Nayak <rnayak@ti.com>
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 version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/clk-private.h>
21#include <linux/list.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx.h"
29#include "prm2xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
55
56DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
57
58DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
59
60static struct clk osc_ck;
61
62static const struct clk_ops osc_ck_ops = {
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static struct clk func_96m_ck;
226
227static const char *func_96m_ck_parent_names[] = {
228 "apll96_ck",
229};
230
231DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
232DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
233
234static struct clk cam_fck;
235
236static const char *cam_fck_parent_names[] = {
237 "func_96m_ck",
238};
239
240static struct clk_hw_omap cam_fck_hw = {
241 .hw = {
242 .clk = &cam_fck,
243 },
244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
245 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
246 .clkdm_name = "core_l3_clkdm",
247};
248
249DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
250
251static struct clk cam_ick;
252
253static struct clk_hw_omap cam_ick_hw = {
254 .hw = {
255 .clk = &cam_ick,
256 },
257 .ops = &clkhwops_iclk,
258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
259 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
260 .clkdm_name = "core_l4_clkdm",
261};
262
263DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
264
265static struct clk des_ick;
266
267static struct clk_hw_omap des_ick_hw = {
268 .hw = {
269 .clk = &des_ick,
270 },
271 .ops = &clkhwops_iclk_wait,
272 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
273 .enable_bit = OMAP24XX_EN_DES_SHIFT,
274 .clkdm_name = "core_l4_clkdm",
275};
276
277DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
278
279static const struct clksel_rate dsp_fck_core_rates[] = {
280 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
281 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
282 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
283 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
284 { .div = 6, .val = 6, .flags = RATE_IN_242X },
285 { .div = 8, .val = 8, .flags = RATE_IN_242X },
286 { .div = 12, .val = 12, .flags = RATE_IN_242X },
287 { .div = 0 }
288};
289
290static const struct clksel dsp_fck_clksel[] = {
291 { .parent = &core_ck, .rates = dsp_fck_core_rates },
292 { .parent = NULL },
293};
294
295static const char *dsp_fck_parent_names[] = {
296 "core_ck",
297};
298
299static const struct clk_ops dsp_fck_ops = {
300 .init = &omap2_init_clk_clkdm,
301 .enable = &omap2_dflt_clk_enable,
302 .disable = &omap2_dflt_clk_disable,
303 .is_enabled = &omap2_dflt_clk_is_enabled,
304 .recalc_rate = &omap2_clksel_recalc,
305 .set_rate = &omap2_clksel_set_rate,
306 .round_rate = &omap2_clksel_round_rate,
307};
308
309DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
311 OMAP24XX_CLKSEL_DSP_MASK,
312 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
313 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
314 dsp_fck_parent_names, dsp_fck_ops);
315
316static const struct clksel dsp_ick_clksel[] = {
317 { .parent = &dsp_fck, .rates = dsp_ick_rates },
318 { .parent = NULL },
319};
320
321static const char *dsp_ick_parent_names[] = {
322 "dsp_fck",
323};
324
325DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
326 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
327 OMAP24XX_CLKSEL_DSP_IF_MASK,
328 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
329 OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
330 dsp_ick_parent_names, dsp_fck_ops);
331
332static const struct clksel_rate dss1_fck_sys_rates[] = {
333 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
334 { .div = 0 }
335};
336
337static const struct clksel_rate dss1_fck_core_rates[] = {
338 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
339 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
340 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
341 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
342 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
343 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
344 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
345 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
346 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
347 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
348 { .div = 0 }
349};
350
351static const struct clksel dss1_fck_clksel[] = {
352 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
353 { .parent = &core_ck, .rates = dss1_fck_core_rates },
354 { .parent = NULL },
355};
356
357static const char *dss1_fck_parent_names[] = {
358 "sys_ck", "core_ck",
359};
360
361static struct clk dss1_fck;
362
363static const struct clk_ops dss1_fck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap2_dflt_clk_enable,
366 .disable = &omap2_dflt_clk_disable,
367 .is_enabled = &omap2_dflt_clk_is_enabled,
368 .recalc_rate = &omap2_clksel_recalc,
369 .get_parent = &omap2_clksel_find_parent_index,
370 .set_parent = &omap2_clksel_set_parent,
371};
372
373DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
374 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
375 OMAP24XX_CLKSEL_DSS1_MASK,
376 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
377 OMAP24XX_EN_DSS1_SHIFT, NULL,
378 dss1_fck_parent_names, dss1_fck_ops);
379
380static const struct clksel_rate dss2_fck_sys_rates[] = {
381 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
382 { .div = 0 }
383};
384
385static const struct clksel_rate dss2_fck_48m_rates[] = {
386 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
387 { .div = 0 }
388};
389
390static const struct clksel_rate func_48m_apll96_rates[] = {
391 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
392 { .div = 0 }
393};
394
395static const struct clksel_rate func_48m_alt_rates[] = {
396 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
397 { .div = 0 }
398};
399
400static const struct clksel func_48m_clksel[] = {
401 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
402 { .parent = &alt_ck, .rates = func_48m_alt_rates },
403 { .parent = NULL },
404};
405
406static const char *func_48m_ck_parent_names[] = {
407 "apll96_ck", "alt_ck",
408};
409
410static struct clk func_48m_ck;
411
412static const struct clk_ops func_48m_ck_ops = {
413 .init = &omap2_init_clk_clkdm,
414 .recalc_rate = &omap2_clksel_recalc,
415 .set_rate = &omap2_clksel_set_rate,
416 .round_rate = &omap2_clksel_round_rate,
417 .get_parent = &omap2_clksel_find_parent_index,
418 .set_parent = &omap2_clksel_set_parent,
419};
420
421static struct clk_hw_omap func_48m_ck_hw = {
422 .hw = {
423 .clk = &func_48m_ck,
424 },
425 .clksel = func_48m_clksel,
426 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
427 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
428 .clkdm_name = "wkup_clkdm",
429};
430
431DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
432
433static const struct clksel dss2_fck_clksel[] = {
434 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
435 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
436 { .parent = NULL },
437};
438
439static const char *dss2_fck_parent_names[] = {
440 "sys_ck", "func_48m_ck",
441};
442
443DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
444 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
445 OMAP24XX_CLKSEL_DSS2_MASK,
446 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
447 OMAP24XX_EN_DSS2_SHIFT, NULL,
448 dss2_fck_parent_names, dss1_fck_ops);
449
450static const char *func_54m_ck_parent_names[] = {
451 "apll54_ck", "alt_ck",
452};
453
454DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
455 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
456 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
457 0x0, NULL);
458
459static struct clk dss_54m_fck;
460
461static const char *dss_54m_fck_parent_names[] = {
462 "func_54m_ck",
463};
464
465static struct clk_hw_omap dss_54m_fck_hw = {
466 .hw = {
467 .clk = &dss_54m_fck,
468 },
469 .ops = &clkhwops_wait,
470 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
471 .enable_bit = OMAP24XX_EN_TV_SHIFT,
472 .clkdm_name = "dss_clkdm",
473};
474
475DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
476
477static struct clk dss_ick;
478
479static struct clk_hw_omap dss_ick_hw = {
480 .hw = {
481 .clk = &dss_ick,
482 },
483 .ops = &clkhwops_iclk,
484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
485 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
486 .clkdm_name = "dss_clkdm",
487};
488
489DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
490
491static struct clk eac_fck;
492
493static struct clk_hw_omap eac_fck_hw = {
494 .hw = {
495 .clk = &eac_fck,
496 },
497 .ops = &clkhwops_wait,
498 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
499 .enable_bit = OMAP2420_EN_EAC_SHIFT,
500 .clkdm_name = "core_l4_clkdm",
501};
502
503DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
504
505static struct clk eac_ick;
506
507static struct clk_hw_omap eac_ick_hw = {
508 .hw = {
509 .clk = &eac_ick,
510 },
511 .ops = &clkhwops_iclk_wait,
512 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
513 .enable_bit = OMAP2420_EN_EAC_SHIFT,
514 .clkdm_name = "core_l4_clkdm",
515};
516
517DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
518
519static struct clk emul_ck;
520
521static struct clk_hw_omap emul_ck_hw = {
522 .hw = {
523 .clk = &emul_ck,
524 },
525 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
526 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
527 .clkdm_name = "wkup_clkdm",
528};
529
530DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
531
532DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
533
534static struct clk fac_fck;
535
536static const char *fac_fck_parent_names[] = {
537 "func_12m_ck",
538};
539
540static struct clk_hw_omap fac_fck_hw = {
541 .hw = {
542 .clk = &fac_fck,
543 },
544 .ops = &clkhwops_wait,
545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
547 .clkdm_name = "core_l4_clkdm",
548};
549
550DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
551
552static struct clk fac_ick;
553
554static struct clk_hw_omap fac_ick_hw = {
555 .hw = {
556 .clk = &fac_ick,
557 },
558 .ops = &clkhwops_iclk_wait,
559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
560 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
561 .clkdm_name = "core_l4_clkdm",
562};
563
564DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
565
566static const struct clksel gfx_fck_clksel[] = {
567 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
568 { .parent = NULL },
569};
570
571static const char *gfx_2d_fck_parent_names[] = {
572 "core_l3_ck",
573};
574
575DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
576 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
577 OMAP_CLKSEL_GFX_MASK,
578 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
579 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
580 gfx_2d_fck_parent_names, dsp_fck_ops);
581
582DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
583 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
584 OMAP_CLKSEL_GFX_MASK,
585 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
586 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
587 gfx_2d_fck_parent_names, dsp_fck_ops);
588
589static struct clk gfx_ick;
590
591static const char *gfx_ick_parent_names[] = {
592 "core_l3_ck",
593};
594
595static struct clk_hw_omap gfx_ick_hw = {
596 .hw = {
597 .clk = &gfx_ick,
598 },
599 .ops = &clkhwops_wait,
600 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
601 .enable_bit = OMAP_EN_GFX_SHIFT,
602 .clkdm_name = "gfx_clkdm",
603};
604
605DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
606
607static struct clk gpios_fck;
608
609static const char *gpios_fck_parent_names[] = {
610 "func_32k_ck",
611};
612
613static struct clk_hw_omap gpios_fck_hw = {
614 .hw = {
615 .clk = &gpios_fck,
616 },
617 .ops = &clkhwops_wait,
618 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
619 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
620 .clkdm_name = "wkup_clkdm",
621};
622
623DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
624
625static struct clk gpios_ick;
626
627static const char *gpios_ick_parent_names[] = {
628 "sys_ck",
629};
630
631static struct clk_hw_omap gpios_ick_hw = {
632 .hw = {
633 .clk = &gpios_ick,
634 },
635 .ops = &clkhwops_iclk_wait,
636 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
637 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
638 .clkdm_name = "wkup_clkdm",
639};
640
641DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
642
643static struct clk gpmc_fck;
644
645static struct clk_hw_omap gpmc_fck_hw = {
646 .hw = {
647 .clk = &gpmc_fck,
648 },
649 .ops = &clkhwops_iclk,
650 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
651 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
652 .flags = ENABLE_ON_INIT,
653 .clkdm_name = "core_l3_clkdm",
654};
655
656DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
657
658static const struct clksel_rate gpt_alt_rates[] = {
659 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
660 { .div = 0 }
661};
662
663static const struct clksel omap24xx_gpt_clksel[] = {
664 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
665 { .parent = &sys_ck, .rates = gpt_sys_rates },
666 { .parent = &alt_ck, .rates = gpt_alt_rates },
667 { .parent = NULL },
668};
669
670static const char *gpt10_fck_parent_names[] = {
671 "func_32k_ck", "sys_ck", "alt_ck",
672};
673
674DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
675 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
676 OMAP24XX_CLKSEL_GPT10_MASK,
677 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
678 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
679 gpt10_fck_parent_names, dss1_fck_ops);
680
681static struct clk gpt10_ick;
682
683static struct clk_hw_omap gpt10_ick_hw = {
684 .hw = {
685 .clk = &gpt10_ick,
686 },
687 .ops = &clkhwops_iclk_wait,
688 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
689 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
690 .clkdm_name = "core_l4_clkdm",
691};
692
693DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
694
695DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
696 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
697 OMAP24XX_CLKSEL_GPT11_MASK,
698 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
699 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
700 gpt10_fck_parent_names, dss1_fck_ops);
701
702static struct clk gpt11_ick;
703
704static struct clk_hw_omap gpt11_ick_hw = {
705 .hw = {
706 .clk = &gpt11_ick,
707 },
708 .ops = &clkhwops_iclk_wait,
709 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
710 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
711 .clkdm_name = "core_l4_clkdm",
712};
713
714DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
715
716DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
717 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
718 OMAP24XX_CLKSEL_GPT12_MASK,
719 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
720 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
721 gpt10_fck_parent_names, dss1_fck_ops);
722
723static struct clk gpt12_ick;
724
725static struct clk_hw_omap gpt12_ick_hw = {
726 .hw = {
727 .clk = &gpt12_ick,
728 },
729 .ops = &clkhwops_iclk_wait,
730 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
731 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
732 .clkdm_name = "core_l4_clkdm",
733};
734
735DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
736
737static const struct clk_ops gpt1_fck_ops = {
738 .init = &omap2_init_clk_clkdm,
739 .enable = &omap2_dflt_clk_enable,
740 .disable = &omap2_dflt_clk_disable,
741 .is_enabled = &omap2_dflt_clk_is_enabled,
742 .recalc_rate = &omap2_clksel_recalc,
743 .set_rate = &omap2_clksel_set_rate,
744 .round_rate = &omap2_clksel_round_rate,
745 .get_parent = &omap2_clksel_find_parent_index,
746 .set_parent = &omap2_clksel_set_parent,
747};
748
749DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
750 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
751 OMAP24XX_CLKSEL_GPT1_MASK,
752 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
753 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
754 gpt10_fck_parent_names, gpt1_fck_ops);
755
756static struct clk gpt1_ick;
757
758static struct clk_hw_omap gpt1_ick_hw = {
759 .hw = {
760 .clk = &gpt1_ick,
761 },
762 .ops = &clkhwops_iclk_wait,
763 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
764 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
765 .clkdm_name = "wkup_clkdm",
766};
767
768DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
769
770DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
771 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
772 OMAP24XX_CLKSEL_GPT2_MASK,
773 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
774 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
775 gpt10_fck_parent_names, dss1_fck_ops);
776
777static struct clk gpt2_ick;
778
779static struct clk_hw_omap gpt2_ick_hw = {
780 .hw = {
781 .clk = &gpt2_ick,
782 },
783 .ops = &clkhwops_iclk_wait,
784 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
785 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
786 .clkdm_name = "core_l4_clkdm",
787};
788
789DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
790
791DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
792 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
793 OMAP24XX_CLKSEL_GPT3_MASK,
794 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
795 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
796 gpt10_fck_parent_names, dss1_fck_ops);
797
798static struct clk gpt3_ick;
799
800static struct clk_hw_omap gpt3_ick_hw = {
801 .hw = {
802 .clk = &gpt3_ick,
803 },
804 .ops = &clkhwops_iclk_wait,
805 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
806 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
807 .clkdm_name = "core_l4_clkdm",
808};
809
810DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
811
812DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
813 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
814 OMAP24XX_CLKSEL_GPT4_MASK,
815 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
816 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
817 gpt10_fck_parent_names, dss1_fck_ops);
818
819static struct clk gpt4_ick;
820
821static struct clk_hw_omap gpt4_ick_hw = {
822 .hw = {
823 .clk = &gpt4_ick,
824 },
825 .ops = &clkhwops_iclk_wait,
826 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
827 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
828 .clkdm_name = "core_l4_clkdm",
829};
830
831DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
832
833DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
834 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
835 OMAP24XX_CLKSEL_GPT5_MASK,
836 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
837 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
838 gpt10_fck_parent_names, dss1_fck_ops);
839
840static struct clk gpt5_ick;
841
842static struct clk_hw_omap gpt5_ick_hw = {
843 .hw = {
844 .clk = &gpt5_ick,
845 },
846 .ops = &clkhwops_iclk_wait,
847 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
848 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
849 .clkdm_name = "core_l4_clkdm",
850};
851
852DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
853
854DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
855 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
856 OMAP24XX_CLKSEL_GPT6_MASK,
857 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
858 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
859 gpt10_fck_parent_names, dss1_fck_ops);
860
861static struct clk gpt6_ick;
862
863static struct clk_hw_omap gpt6_ick_hw = {
864 .hw = {
865 .clk = &gpt6_ick,
866 },
867 .ops = &clkhwops_iclk_wait,
868 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
869 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
870 .clkdm_name = "core_l4_clkdm",
871};
872
873DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
874
875DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
876 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
877 OMAP24XX_CLKSEL_GPT7_MASK,
878 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
879 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
880 gpt10_fck_parent_names, dss1_fck_ops);
881
882static struct clk gpt7_ick;
883
884static struct clk_hw_omap gpt7_ick_hw = {
885 .hw = {
886 .clk = &gpt7_ick,
887 },
888 .ops = &clkhwops_iclk_wait,
889 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
890 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
891 .clkdm_name = "core_l4_clkdm",
892};
893
894DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
895
896DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
897 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
898 OMAP24XX_CLKSEL_GPT8_MASK,
899 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
900 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
901 gpt10_fck_parent_names, dss1_fck_ops);
902
903static struct clk gpt8_ick;
904
905static struct clk_hw_omap gpt8_ick_hw = {
906 .hw = {
907 .clk = &gpt8_ick,
908 },
909 .ops = &clkhwops_iclk_wait,
910 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
911 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
912 .clkdm_name = "core_l4_clkdm",
913};
914
915DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
916
917DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
918 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
919 OMAP24XX_CLKSEL_GPT9_MASK,
920 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
921 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
922 gpt10_fck_parent_names, dss1_fck_ops);
923
924static struct clk gpt9_ick;
925
926static struct clk_hw_omap gpt9_ick_hw = {
927 .hw = {
928 .clk = &gpt9_ick,
929 },
930 .ops = &clkhwops_iclk_wait,
931 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
932 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
933 .clkdm_name = "core_l4_clkdm",
934};
935
936DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
937
938static struct clk hdq_fck;
939
940static struct clk_hw_omap hdq_fck_hw = {
941 .hw = {
942 .clk = &hdq_fck,
943 },
944 .ops = &clkhwops_wait,
945 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
946 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
947 .clkdm_name = "core_l4_clkdm",
948};
949
950DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
951
952static struct clk hdq_ick;
953
954static struct clk_hw_omap hdq_ick_hw = {
955 .hw = {
956 .clk = &hdq_ick,
957 },
958 .ops = &clkhwops_iclk_wait,
959 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
960 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
961 .clkdm_name = "core_l4_clkdm",
962};
963
964DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
965
966static struct clk i2c1_fck;
967
968static struct clk_hw_omap i2c1_fck_hw = {
969 .hw = {
970 .clk = &i2c1_fck,
971 },
972 .ops = &clkhwops_wait,
973 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
974 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
975 .clkdm_name = "core_l4_clkdm",
976};
977
978DEFINE_STRUCT_CLK(i2c1_fck, fac_fck_parent_names, aes_ick_ops);
979
980static struct clk i2c1_ick;
981
982static struct clk_hw_omap i2c1_ick_hw = {
983 .hw = {
984 .clk = &i2c1_ick,
985 },
986 .ops = &clkhwops_iclk_wait,
987 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
988 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
989 .clkdm_name = "core_l4_clkdm",
990};
991
992DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
993
994static struct clk i2c2_fck;
995
996static struct clk_hw_omap i2c2_fck_hw = {
997 .hw = {
998 .clk = &i2c2_fck,
999 },
1000 .ops = &clkhwops_wait,
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1002 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1003 .clkdm_name = "core_l4_clkdm",
1004};
1005
1006DEFINE_STRUCT_CLK(i2c2_fck, fac_fck_parent_names, aes_ick_ops);
1007
1008static struct clk i2c2_ick;
1009
1010static struct clk_hw_omap i2c2_ick_hw = {
1011 .hw = {
1012 .clk = &i2c2_ick,
1013 },
1014 .ops = &clkhwops_iclk_wait,
1015 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1016 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1017 .clkdm_name = "core_l4_clkdm",
1018};
1019
1020DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
1021
1022DEFINE_CLK_OMAP_MUX_GATE(iva1_ifck, "iva1_clkdm", dsp_fck_clksel,
1023 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1024 OMAP2420_CLKSEL_IVA_MASK,
1025 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1026 OMAP2420_EN_IVA_COP_SHIFT, &clkhwops_wait,
1027 dsp_fck_parent_names, dsp_fck_ops);
1028
1029static struct clk iva1_mpu_int_ifck;
1030
1031static const char *iva1_mpu_int_ifck_parent_names[] = {
1032 "iva1_ifck",
1033};
1034
1035static const struct clk_ops iva1_mpu_int_ifck_ops = {
1036 .init = &omap2_init_clk_clkdm,
1037 .enable = &omap2_dflt_clk_enable,
1038 .disable = &omap2_dflt_clk_disable,
1039 .is_enabled = &omap2_dflt_clk_is_enabled,
1040 .recalc_rate = &omap_fixed_divisor_recalc,
1041};
1042
1043static struct clk_hw_omap iva1_mpu_int_ifck_hw = {
1044 .hw = {
1045 .clk = &iva1_mpu_int_ifck,
1046 },
1047 .ops = &clkhwops_wait,
1048 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1049 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
1050 .clkdm_name = "iva1_clkdm",
1051 .fixed_div = 2,
1052};
1053
1054DEFINE_STRUCT_CLK(iva1_mpu_int_ifck, iva1_mpu_int_ifck_parent_names,
1055 iva1_mpu_int_ifck_ops);
1056
1057static struct clk mailboxes_ick;
1058
1059static struct clk_hw_omap mailboxes_ick_hw = {
1060 .hw = {
1061 .clk = &mailboxes_ick,
1062 },
1063 .ops = &clkhwops_iclk_wait,
1064 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1065 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1066 .clkdm_name = "core_l4_clkdm",
1067};
1068
1069DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1070
1071static const struct clksel_rate common_mcbsp_96m_rates[] = {
1072 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1073 { .div = 0 }
1074};
1075
1076static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1077 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1078 { .div = 0 }
1079};
1080
1081static const struct clksel mcbsp_fck_clksel[] = {
1082 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1083 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1084 { .parent = NULL },
1085};
1086
1087static const char *mcbsp1_fck_parent_names[] = {
1088 "func_96m_ck", "mcbsp_clks",
1089};
1090
1091DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1092 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1093 OMAP2_MCBSP1_CLKS_MASK,
1094 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1095 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1096 mcbsp1_fck_parent_names, dss1_fck_ops);
1097
1098static struct clk mcbsp1_ick;
1099
1100static struct clk_hw_omap mcbsp1_ick_hw = {
1101 .hw = {
1102 .clk = &mcbsp1_ick,
1103 },
1104 .ops = &clkhwops_iclk_wait,
1105 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1106 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1107 .clkdm_name = "core_l4_clkdm",
1108};
1109
1110DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1111
1112DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1113 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1114 OMAP2_MCBSP2_CLKS_MASK,
1115 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1116 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1117 mcbsp1_fck_parent_names, dss1_fck_ops);
1118
1119static struct clk mcbsp2_ick;
1120
1121static struct clk_hw_omap mcbsp2_ick_hw = {
1122 .hw = {
1123 .clk = &mcbsp2_ick,
1124 },
1125 .ops = &clkhwops_iclk_wait,
1126 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1127 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1128 .clkdm_name = "core_l4_clkdm",
1129};
1130
1131DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1132
1133static struct clk mcspi1_fck;
1134
1135static const char *mcspi1_fck_parent_names[] = {
1136 "func_48m_ck",
1137};
1138
1139static struct clk_hw_omap mcspi1_fck_hw = {
1140 .hw = {
1141 .clk = &mcspi1_fck,
1142 },
1143 .ops = &clkhwops_wait,
1144 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1145 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1146 .clkdm_name = "core_l4_clkdm",
1147};
1148
1149DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1150
1151static struct clk mcspi1_ick;
1152
1153static struct clk_hw_omap mcspi1_ick_hw = {
1154 .hw = {
1155 .clk = &mcspi1_ick,
1156 },
1157 .ops = &clkhwops_iclk_wait,
1158 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1159 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1160 .clkdm_name = "core_l4_clkdm",
1161};
1162
1163DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1164
1165static struct clk mcspi2_fck;
1166
1167static struct clk_hw_omap mcspi2_fck_hw = {
1168 .hw = {
1169 .clk = &mcspi2_fck,
1170 },
1171 .ops = &clkhwops_wait,
1172 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1173 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1174 .clkdm_name = "core_l4_clkdm",
1175};
1176
1177DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1178
1179static struct clk mcspi2_ick;
1180
1181static struct clk_hw_omap mcspi2_ick_hw = {
1182 .hw = {
1183 .clk = &mcspi2_ick,
1184 },
1185 .ops = &clkhwops_iclk_wait,
1186 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1187 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1188 .clkdm_name = "core_l4_clkdm",
1189};
1190
1191DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1192
1193static struct clk mmc_fck;
1194
1195static struct clk_hw_omap mmc_fck_hw = {
1196 .hw = {
1197 .clk = &mmc_fck,
1198 },
1199 .ops = &clkhwops_wait,
1200 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1201 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1202 .clkdm_name = "core_l4_clkdm",
1203};
1204
1205DEFINE_STRUCT_CLK(mmc_fck, cam_fck_parent_names, aes_ick_ops);
1206
1207static struct clk mmc_ick;
1208
1209static struct clk_hw_omap mmc_ick_hw = {
1210 .hw = {
1211 .clk = &mmc_ick,
1212 },
1213 .ops = &clkhwops_iclk_wait,
1214 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1215 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1216 .clkdm_name = "core_l4_clkdm",
1217};
1218
1219DEFINE_STRUCT_CLK(mmc_ick, aes_ick_parent_names, aes_ick_ops);
1220
1221DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1222 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1223 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1224 CLK_DIVIDER_ONE_BASED, NULL);
1225
1226static struct clk mpu_wdt_fck;
1227
1228static struct clk_hw_omap mpu_wdt_fck_hw = {
1229 .hw = {
1230 .clk = &mpu_wdt_fck,
1231 },
1232 .ops = &clkhwops_wait,
1233 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1234 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1235 .clkdm_name = "wkup_clkdm",
1236};
1237
1238DEFINE_STRUCT_CLK(mpu_wdt_fck, gpios_fck_parent_names, aes_ick_ops);
1239
1240static struct clk mpu_wdt_ick;
1241
1242static struct clk_hw_omap mpu_wdt_ick_hw = {
1243 .hw = {
1244 .clk = &mpu_wdt_ick,
1245 },
1246 .ops = &clkhwops_iclk_wait,
1247 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1248 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1249 .clkdm_name = "wkup_clkdm",
1250};
1251
1252DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1253
1254static struct clk mspro_fck;
1255
1256static struct clk_hw_omap mspro_fck_hw = {
1257 .hw = {
1258 .clk = &mspro_fck,
1259 },
1260 .ops = &clkhwops_wait,
1261 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1262 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1263 .clkdm_name = "core_l4_clkdm",
1264};
1265
1266DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1267
1268static struct clk mspro_ick;
1269
1270static struct clk_hw_omap mspro_ick_hw = {
1271 .hw = {
1272 .clk = &mspro_ick,
1273 },
1274 .ops = &clkhwops_iclk_wait,
1275 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1276 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1277 .clkdm_name = "core_l4_clkdm",
1278};
1279
1280DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1281
1282static struct clk omapctrl_ick;
1283
1284static struct clk_hw_omap omapctrl_ick_hw = {
1285 .hw = {
1286 .clk = &omapctrl_ick,
1287 },
1288 .ops = &clkhwops_iclk_wait,
1289 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1290 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1291 .flags = ENABLE_ON_INIT,
1292 .clkdm_name = "wkup_clkdm",
1293};
1294
1295DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1296
1297static struct clk pka_ick;
1298
1299static struct clk_hw_omap pka_ick_hw = {
1300 .hw = {
1301 .clk = &pka_ick,
1302 },
1303 .ops = &clkhwops_iclk_wait,
1304 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1305 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1306 .clkdm_name = "core_l4_clkdm",
1307};
1308
1309DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1310
1311static struct clk rng_ick;
1312
1313static struct clk_hw_omap rng_ick_hw = {
1314 .hw = {
1315 .clk = &rng_ick,
1316 },
1317 .ops = &clkhwops_iclk_wait,
1318 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1319 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1320 .clkdm_name = "core_l4_clkdm",
1321};
1322
1323DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1324
1325static struct clk sdma_fck;
1326
1327DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1328DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1329
1330static struct clk sdma_ick;
1331
1332static struct clk_hw_omap sdma_ick_hw = {
1333 .hw = {
1334 .clk = &sdma_ick,
1335 },
1336 .ops = &clkhwops_iclk,
1337 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1338 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1339 .clkdm_name = "core_l3_clkdm",
1340};
1341
1342DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1343
1344static struct clk sdrc_ick;
1345
1346static struct clk_hw_omap sdrc_ick_hw = {
1347 .hw = {
1348 .clk = &sdrc_ick,
1349 },
1350 .ops = &clkhwops_iclk,
1351 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1352 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1353 .flags = ENABLE_ON_INIT,
1354 .clkdm_name = "core_l3_clkdm",
1355};
1356
1357DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1358
1359static struct clk sha_ick;
1360
1361static struct clk_hw_omap sha_ick_hw = {
1362 .hw = {
1363 .clk = &sha_ick,
1364 },
1365 .ops = &clkhwops_iclk_wait,
1366 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1367 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1368 .clkdm_name = "core_l4_clkdm",
1369};
1370
1371DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1372
1373static struct clk ssi_l4_ick;
1374
1375static struct clk_hw_omap ssi_l4_ick_hw = {
1376 .hw = {
1377 .clk = &ssi_l4_ick,
1378 },
1379 .ops = &clkhwops_iclk_wait,
1380 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1381 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1382 .clkdm_name = "core_l4_clkdm",
1383};
1384
1385DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1386
1387static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1388 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1389 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1390 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1391 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1392 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1393 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1394 { .div = 0 }
1395};
1396
1397static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1398 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1399 { .parent = NULL },
1400};
1401
1402static const char *ssi_ssr_sst_fck_parent_names[] = {
1403 "core_ck",
1404};
1405
1406DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1407 ssi_ssr_sst_fck_clksel,
1408 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1409 OMAP24XX_CLKSEL_SSI_MASK,
1410 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1411 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1412 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1413
1414static struct clk sync_32k_ick;
1415
1416static struct clk_hw_omap sync_32k_ick_hw = {
1417 .hw = {
1418 .clk = &sync_32k_ick,
1419 },
1420 .ops = &clkhwops_iclk_wait,
1421 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1422 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1423 .flags = ENABLE_ON_INIT,
1424 .clkdm_name = "wkup_clkdm",
1425};
1426
1427DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1428
1429static const struct clksel_rate common_clkout_src_core_rates[] = {
1430 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1431 { .div = 0 }
1432};
1433
1434static const struct clksel_rate common_clkout_src_sys_rates[] = {
1435 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1436 { .div = 0 }
1437};
1438
1439static const struct clksel_rate common_clkout_src_96m_rates[] = {
1440 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1441 { .div = 0 }
1442};
1443
1444static const struct clksel_rate common_clkout_src_54m_rates[] = {
1445 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1446 { .div = 0 }
1447};
1448
1449static const struct clksel common_clkout_src_clksel[] = {
1450 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1451 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1452 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1453 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1454 { .parent = NULL },
1455};
1456
1457static const char *sys_clkout_src_parent_names[] = {
1458 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1459};
1460
1461DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1462 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1463 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1464 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1465
1466DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1467 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1468 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1469
1470DEFINE_CLK_OMAP_MUX_GATE(sys_clkout2_src, "wkup_clkdm",
1471 common_clkout_src_clksel, OMAP2420_PRCM_CLKOUT_CTRL,
1472 OMAP2420_CLKOUT2_SOURCE_MASK,
1473 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_EN_SHIFT,
1474 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1475
1476DEFINE_CLK_DIVIDER(sys_clkout2, "sys_clkout2_src", &sys_clkout2_src, 0x0,
1477 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_DIV_SHIFT,
1478 OMAP2420_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1479
1480static struct clk uart1_fck;
1481
1482static struct clk_hw_omap uart1_fck_hw = {
1483 .hw = {
1484 .clk = &uart1_fck,
1485 },
1486 .ops = &clkhwops_wait,
1487 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1488 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1489 .clkdm_name = "core_l4_clkdm",
1490};
1491
1492DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1493
1494static struct clk uart1_ick;
1495
1496static struct clk_hw_omap uart1_ick_hw = {
1497 .hw = {
1498 .clk = &uart1_ick,
1499 },
1500 .ops = &clkhwops_iclk_wait,
1501 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1502 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1503 .clkdm_name = "core_l4_clkdm",
1504};
1505
1506DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1507
1508static struct clk uart2_fck;
1509
1510static struct clk_hw_omap uart2_fck_hw = {
1511 .hw = {
1512 .clk = &uart2_fck,
1513 },
1514 .ops = &clkhwops_wait,
1515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1516 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1517 .clkdm_name = "core_l4_clkdm",
1518};
1519
1520DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1521
1522static struct clk uart2_ick;
1523
1524static struct clk_hw_omap uart2_ick_hw = {
1525 .hw = {
1526 .clk = &uart2_ick,
1527 },
1528 .ops = &clkhwops_iclk_wait,
1529 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1530 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1531 .clkdm_name = "core_l4_clkdm",
1532};
1533
1534DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1535
1536static struct clk uart3_fck;
1537
1538static struct clk_hw_omap uart3_fck_hw = {
1539 .hw = {
1540 .clk = &uart3_fck,
1541 },
1542 .ops = &clkhwops_wait,
1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1544 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1545 .clkdm_name = "core_l4_clkdm",
1546};
1547
1548DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1549
1550static struct clk uart3_ick;
1551
1552static struct clk_hw_omap uart3_ick_hw = {
1553 .hw = {
1554 .clk = &uart3_ick,
1555 },
1556 .ops = &clkhwops_iclk_wait,
1557 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1558 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1559 .clkdm_name = "core_l4_clkdm",
1560};
1561
1562DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1563
1564static struct clk usb_fck;
1565
1566static struct clk_hw_omap usb_fck_hw = {
1567 .hw = {
1568 .clk = &usb_fck,
1569 },
1570 .ops = &clkhwops_wait,
1571 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1572 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1573 .clkdm_name = "core_l3_clkdm",
1574};
1575
1576DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1577
1578static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1579 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1580 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1581 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1582 { .div = 0 }
1583};
1584
1585static const struct clksel usb_l4_ick_clksel[] = {
1586 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1587 { .parent = NULL },
1588};
1589
1590static const char *usb_l4_ick_parent_names[] = {
1591 "core_l3_ck",
1592};
1593
1594DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1595 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1596 OMAP24XX_CLKSEL_USB_MASK,
1597 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1598 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1599 usb_l4_ick_parent_names, dsp_fck_ops);
1600
1601static struct clk virt_prcm_set;
1602
1603static const char *virt_prcm_set_parent_names[] = {
1604 "mpu_ck",
1605};
1606
1607static const struct clk_ops virt_prcm_set_ops = {
1608 .recalc_rate = &omap2_table_mpu_recalc,
1609 .set_rate = &omap2_select_table_rate,
1610 .round_rate = &omap2_round_to_table_rate,
1611};
1612
1613DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1614DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1615
1616static const struct clksel_rate vlynq_fck_96m_rates[] = {
1617 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1618 { .div = 0 }
1619};
1620
1621static const struct clksel_rate vlynq_fck_core_rates[] = {
1622 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1623 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1624 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1625 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1626 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1627 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1628 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1629 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1630 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1631 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1632 { .div = 0 }
1633};
1634
1635static const struct clksel vlynq_fck_clksel[] = {
1636 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1637 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1638 { .parent = NULL },
1639};
1640
1641static const char *vlynq_fck_parent_names[] = {
1642 "func_96m_ck", "core_ck",
1643};
1644
1645DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
1646 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1647 OMAP2420_CLKSEL_VLYNQ_MASK,
1648 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1649 OMAP2420_EN_VLYNQ_SHIFT, &clkhwops_wait,
1650 vlynq_fck_parent_names, dss1_fck_ops);
1651
1652static struct clk vlynq_ick;
1653
1654static struct clk_hw_omap vlynq_ick_hw = {
1655 .hw = {
1656 .clk = &vlynq_ick,
1657 },
1658 .ops = &clkhwops_iclk_wait,
1659 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1660 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1661 .clkdm_name = "core_l3_clkdm",
1662};
1663
1664DEFINE_STRUCT_CLK(vlynq_ick, gfx_ick_parent_names, aes_ick_ops);
1665
1666static struct clk wdt1_ick;
1667
1668static struct clk_hw_omap wdt1_ick_hw = {
1669 .hw = {
1670 .clk = &wdt1_ick,
1671 },
1672 .ops = &clkhwops_iclk_wait,
1673 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1674 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1675 .clkdm_name = "wkup_clkdm",
1676};
1677
1678DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1679
1680static struct clk wdt3_fck;
1681
1682static struct clk_hw_omap wdt3_fck_hw = {
1683 .hw = {
1684 .clk = &wdt3_fck,
1685 },
1686 .ops = &clkhwops_wait,
1687 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1688 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1689 .clkdm_name = "core_l4_clkdm",
1690};
1691
1692DEFINE_STRUCT_CLK(wdt3_fck, gpios_fck_parent_names, aes_ick_ops);
1693
1694static struct clk wdt3_ick;
1695
1696static struct clk_hw_omap wdt3_ick_hw = {
1697 .hw = {
1698 .clk = &wdt3_ick,
1699 },
1700 .ops = &clkhwops_iclk_wait,
1701 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1702 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1703 .clkdm_name = "core_l4_clkdm",
1704};
1705
1706DEFINE_STRUCT_CLK(wdt3_ick, aes_ick_parent_names, aes_ick_ops);
1707
1708static struct clk wdt4_fck;
1709
1710static struct clk_hw_omap wdt4_fck_hw = {
1711 .hw = {
1712 .clk = &wdt4_fck,
1713 },
1714 .ops = &clkhwops_wait,
1715 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1716 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1717 .clkdm_name = "core_l4_clkdm",
1718};
1719
1720DEFINE_STRUCT_CLK(wdt4_fck, gpios_fck_parent_names, aes_ick_ops);
1721
1722static struct clk wdt4_ick;
1723
1724static struct clk_hw_omap wdt4_ick_hw = {
1725 .hw = {
1726 .clk = &wdt4_ick,
1727 },
1728 .ops = &clkhwops_iclk_wait,
1729 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1730 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1731 .clkdm_name = "core_l4_clkdm",
1732};
1733
1734DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1735
1736/*
1737 * clkdev integration
1738 */
1739
1740static struct omap_clk omap2420_clks[] = {
1741 /* external root sources */
1742 CLK(NULL, "func_32k_ck", &func_32k_ck),
1743 CLK(NULL, "secure_32k_ck", &secure_32k_ck),
1744 CLK(NULL, "osc_ck", &osc_ck),
1745 CLK(NULL, "sys_ck", &sys_ck),
1746 CLK(NULL, "alt_ck", &alt_ck),
1747 CLK(NULL, "mcbsp_clks", &mcbsp_clks),
1748 /* internal analog sources */
1749 CLK(NULL, "dpll_ck", &dpll_ck),
1750 CLK(NULL, "apll96_ck", &apll96_ck),
1751 CLK(NULL, "apll54_ck", &apll54_ck),
1752 /* internal prcm root sources */
1753 CLK(NULL, "func_54m_ck", &func_54m_ck),
1754 CLK(NULL, "core_ck", &core_ck),
1755 CLK(NULL, "func_96m_ck", &func_96m_ck),
1756 CLK(NULL, "func_48m_ck", &func_48m_ck),
1757 CLK(NULL, "func_12m_ck", &func_12m_ck),
1758 CLK(NULL, "sys_clkout_src", &sys_clkout_src),
1759 CLK(NULL, "sys_clkout", &sys_clkout),
1760 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src),
1761 CLK(NULL, "sys_clkout2", &sys_clkout2),
1762 CLK(NULL, "emul_ck", &emul_ck),
1763 /* mpu domain clocks */
1764 CLK(NULL, "mpu_ck", &mpu_ck),
1765 /* dsp domain clocks */
1766 CLK(NULL, "dsp_fck", &dsp_fck),
1767 CLK(NULL, "dsp_ick", &dsp_ick),
1768 CLK(NULL, "iva1_ifck", &iva1_ifck),
1769 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck),
1770 /* GFX domain clocks */
1771 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck),
1772 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck),
1773 CLK(NULL, "gfx_ick", &gfx_ick),
1774 /* DSS domain clocks */
1775 CLK("omapdss_dss", "ick", &dss_ick),
1776 CLK(NULL, "dss_ick", &dss_ick),
1777 CLK(NULL, "dss1_fck", &dss1_fck),
1778 CLK(NULL, "dss2_fck", &dss2_fck),
1779 CLK(NULL, "dss_54m_fck", &dss_54m_fck),
1780 /* L3 domain clocks */
1781 CLK(NULL, "core_l3_ck", &core_l3_ck),
1782 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck),
1783 CLK(NULL, "usb_l4_ick", &usb_l4_ick),
1784 /* L4 domain clocks */
1785 CLK(NULL, "l4_ck", &l4_ck),
1786 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick),
1787 /* virtual meta-group clock */
1788 CLK(NULL, "virt_prcm_set", &virt_prcm_set),
1789 /* general l4 interface ck, multi-parent functional clk */
1790 CLK(NULL, "gpt1_ick", &gpt1_ick),
1791 CLK(NULL, "gpt1_fck", &gpt1_fck),
1792 CLK(NULL, "gpt2_ick", &gpt2_ick),
1793 CLK(NULL, "gpt2_fck", &gpt2_fck),
1794 CLK(NULL, "gpt3_ick", &gpt3_ick),
1795 CLK(NULL, "gpt3_fck", &gpt3_fck),
1796 CLK(NULL, "gpt4_ick", &gpt4_ick),
1797 CLK(NULL, "gpt4_fck", &gpt4_fck),
1798 CLK(NULL, "gpt5_ick", &gpt5_ick),
1799 CLK(NULL, "gpt5_fck", &gpt5_fck),
1800 CLK(NULL, "gpt6_ick", &gpt6_ick),
1801 CLK(NULL, "gpt6_fck", &gpt6_fck),
1802 CLK(NULL, "gpt7_ick", &gpt7_ick),
1803 CLK(NULL, "gpt7_fck", &gpt7_fck),
1804 CLK(NULL, "gpt8_ick", &gpt8_ick),
1805 CLK(NULL, "gpt8_fck", &gpt8_fck),
1806 CLK(NULL, "gpt9_ick", &gpt9_ick),
1807 CLK(NULL, "gpt9_fck", &gpt9_fck),
1808 CLK(NULL, "gpt10_ick", &gpt10_ick),
1809 CLK(NULL, "gpt10_fck", &gpt10_fck),
1810 CLK(NULL, "gpt11_ick", &gpt11_ick),
1811 CLK(NULL, "gpt11_fck", &gpt11_fck),
1812 CLK(NULL, "gpt12_ick", &gpt12_ick),
1813 CLK(NULL, "gpt12_fck", &gpt12_fck),
1814 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick),
1815 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick),
1816 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck),
1817 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick),
1818 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick),
1819 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck),
1820 CLK("omap2_mcspi.1", "ick", &mcspi1_ick),
1821 CLK(NULL, "mcspi1_ick", &mcspi1_ick),
1822 CLK(NULL, "mcspi1_fck", &mcspi1_fck),
1823 CLK("omap2_mcspi.2", "ick", &mcspi2_ick),
1824 CLK(NULL, "mcspi2_ick", &mcspi2_ick),
1825 CLK(NULL, "mcspi2_fck", &mcspi2_fck),
1826 CLK(NULL, "uart1_ick", &uart1_ick),
1827 CLK(NULL, "uart1_fck", &uart1_fck),
1828 CLK(NULL, "uart2_ick", &uart2_ick),
1829 CLK(NULL, "uart2_fck", &uart2_fck),
1830 CLK(NULL, "uart3_ick", &uart3_ick),
1831 CLK(NULL, "uart3_fck", &uart3_fck),
1832 CLK(NULL, "gpios_ick", &gpios_ick),
1833 CLK(NULL, "gpios_fck", &gpios_fck),
1834 CLK("omap_wdt", "ick", &mpu_wdt_ick),
1835 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick),
1836 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck),
1837 CLK(NULL, "sync_32k_ick", &sync_32k_ick),
1838 CLK(NULL, "wdt1_ick", &wdt1_ick),
1839 CLK(NULL, "omapctrl_ick", &omapctrl_ick),
1840 CLK("omap24xxcam", "fck", &cam_fck),
1841 CLK(NULL, "cam_fck", &cam_fck),
1842 CLK("omap24xxcam", "ick", &cam_ick),
1843 CLK(NULL, "cam_ick", &cam_ick),
1844 CLK(NULL, "mailboxes_ick", &mailboxes_ick),
1845 CLK(NULL, "wdt4_ick", &wdt4_ick),
1846 CLK(NULL, "wdt4_fck", &wdt4_fck),
1847 CLK(NULL, "wdt3_ick", &wdt3_ick),
1848 CLK(NULL, "wdt3_fck", &wdt3_fck),
1849 CLK(NULL, "mspro_ick", &mspro_ick),
1850 CLK(NULL, "mspro_fck", &mspro_fck),
1851 CLK("mmci-omap.0", "ick", &mmc_ick),
1852 CLK(NULL, "mmc_ick", &mmc_ick),
1853 CLK("mmci-omap.0", "fck", &mmc_fck),
1854 CLK(NULL, "mmc_fck", &mmc_fck),
1855 CLK(NULL, "fac_ick", &fac_ick),
1856 CLK(NULL, "fac_fck", &fac_fck),
1857 CLK(NULL, "eac_ick", &eac_ick),
1858 CLK(NULL, "eac_fck", &eac_fck),
1859 CLK("omap_hdq.0", "ick", &hdq_ick),
1860 CLK(NULL, "hdq_ick", &hdq_ick),
1861 CLK("omap_hdq.0", "fck", &hdq_fck),
1862 CLK(NULL, "hdq_fck", &hdq_fck),
1863 CLK("omap_i2c.1", "ick", &i2c1_ick),
1864 CLK(NULL, "i2c1_ick", &i2c1_ick),
1865 CLK(NULL, "i2c1_fck", &i2c1_fck),
1866 CLK("omap_i2c.2", "ick", &i2c2_ick),
1867 CLK(NULL, "i2c2_ick", &i2c2_ick),
1868 CLK(NULL, "i2c2_fck", &i2c2_fck),
1869 CLK(NULL, "gpmc_fck", &gpmc_fck),
1870 CLK(NULL, "sdma_fck", &sdma_fck),
1871 CLK(NULL, "sdma_ick", &sdma_ick),
1872 CLK(NULL, "sdrc_ick", &sdrc_ick),
1873 CLK(NULL, "vlynq_ick", &vlynq_ick),
1874 CLK(NULL, "vlynq_fck", &vlynq_fck),
1875 CLK(NULL, "des_ick", &des_ick),
1876 CLK("omap-sham", "ick", &sha_ick),
1877 CLK(NULL, "sha_ick", &sha_ick),
1878 CLK("omap_rng", "ick", &rng_ick),
1879 CLK(NULL, "rng_ick", &rng_ick),
1880 CLK("omap-aes", "ick", &aes_ick),
1881 CLK(NULL, "aes_ick", &aes_ick),
1882 CLK(NULL, "pka_ick", &pka_ick),
1883 CLK(NULL, "usb_fck", &usb_fck),
1884 CLK("musb-hdrc", "fck", &osc_ck),
1885 CLK(NULL, "timer_32k_ck", &func_32k_ck),
1886 CLK(NULL, "timer_sys_ck", &sys_ck),
1887 CLK(NULL, "timer_ext_ck", &alt_ck),
1888 CLK(NULL, "cpufreq_ck", &virt_prcm_set),
1889};
1890
1891
1892static const char *enable_init_clks[] = {
1893 "apll96_ck",
1894 "apll54_ck",
1895 "sync_32k_ick",
1896 "omapctrl_ick",
1897 "gpmc_fck",
1898 "sdrc_ick",
1899};
1900
1901/*
1902 * init code
1903 */
1904
1905int __init omap2420_clk_init(void)
1906{
1907 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1908 cpu_mask = RATE_IN_242X;
1909 rate_table = omap2420_rate_table;
1910
1911 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
1912
1913 omap2xxx_clkt_vps_check_bootloader_rates();
1914
1915 omap_clocks_register(omap2420_clks, ARRAY_SIZE(omap2420_clks));
1916
1917 omap2xxx_clkt_vps_late_init();
1918
1919 omap2_clk_disable_autoidle_all();
1920
1921 omap2_clk_enable_init_clocks(enable_init_clks,
1922 ARRAY_SIZE(enable_init_clks));
1923
1924 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1925 (clk_get_rate(&sys_ck) / 1000000),
1926 (clk_get_rate(&sys_ck) / 100000) % 10,
1927 (clk_get_rate(&dpll_ck) / 1000000),
1928 (clk_get_rate(&mpu_ck) / 1000000));
1929
1930 return 0;
1931}
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
deleted file mode 100644
index 5e4b037bb24c..000000000000
--- a/arch/arm/mach-omap2/cclock2430_data.c
+++ /dev/null
@@ -1,2048 +0,0 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
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/kernel.h>
17#include <linux/clk.h>
18#include <linux/clk-private.h>
19#include <linux/list.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "clock.h"
24#include "clock2xxx.h"
25#include "opp2xxx.h"
26#include "cm2xxx.h"
27#include "prm2xxx.h"
28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h"
30#include "sdrc.h"
31#include "control.h"
32
33#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
34
35/*
36 * 2430 clock tree.
37 *
38 * NOTE:In many cases here we are assigning a 'default' parent. In
39 * many cases the parent is selectable. The set parent calls will
40 * also switch sources.
41 *
42 * Several sources are given initial rates which may be wrong, this will
43 * be fixed up in the init func.
44 *
45 * Things are broadly separated below by clock domains. It is
46 * noteworthy that most peripherals have dependencies on multiple clock
47 * domains. Many get their interface clocks from the L4 domain, but get
48 * functional clocks from fixed sources or other core domain derived
49 * clocks.
50 */
51
52DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
57
58static struct clk osc_ck;
59
60static const struct clk_ops osc_ck_ops = {
61 .enable = &omap2_enable_osc_ck,
62 .disable = omap2_disable_osc_ck,
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static const char *func_96m_ck_parent_names[] = {
226 "apll96_ck", "alt_ck",
227};
228
229DEFINE_CLK_MUX(func_96m_ck, func_96m_ck_parent_names, NULL, 0x0,
230 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP2430_96M_SOURCE_SHIFT,
231 OMAP2430_96M_SOURCE_WIDTH, 0x0, NULL);
232
233static struct clk cam_fck;
234
235static const char *cam_fck_parent_names[] = {
236 "func_96m_ck",
237};
238
239static struct clk_hw_omap cam_fck_hw = {
240 .hw = {
241 .clk = &cam_fck,
242 },
243 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
244 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
245 .clkdm_name = "core_l3_clkdm",
246};
247
248DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
249
250static struct clk cam_ick;
251
252static struct clk_hw_omap cam_ick_hw = {
253 .hw = {
254 .clk = &cam_ick,
255 },
256 .ops = &clkhwops_iclk,
257 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
258 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
259 .clkdm_name = "core_l4_clkdm",
260};
261
262DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
263
264static struct clk des_ick;
265
266static struct clk_hw_omap des_ick_hw = {
267 .hw = {
268 .clk = &des_ick,
269 },
270 .ops = &clkhwops_iclk_wait,
271 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
272 .enable_bit = OMAP24XX_EN_DES_SHIFT,
273 .clkdm_name = "core_l4_clkdm",
274};
275
276DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
277
278static const struct clksel_rate dsp_fck_core_rates[] = {
279 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
280 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
281 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
282 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
283 { .div = 0 }
284};
285
286static const struct clksel dsp_fck_clksel[] = {
287 { .parent = &core_ck, .rates = dsp_fck_core_rates },
288 { .parent = NULL },
289};
290
291static const char *dsp_fck_parent_names[] = {
292 "core_ck",
293};
294
295static struct clk dsp_fck;
296
297static const struct clk_ops dsp_fck_ops = {
298 .init = &omap2_init_clk_clkdm,
299 .enable = &omap2_dflt_clk_enable,
300 .disable = &omap2_dflt_clk_disable,
301 .is_enabled = &omap2_dflt_clk_is_enabled,
302 .recalc_rate = &omap2_clksel_recalc,
303 .set_rate = &omap2_clksel_set_rate,
304 .round_rate = &omap2_clksel_round_rate,
305};
306
307DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
308 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
309 OMAP24XX_CLKSEL_DSP_MASK,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
311 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
312 dsp_fck_parent_names, dsp_fck_ops);
313
314static const struct clksel_rate dss1_fck_sys_rates[] = {
315 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
316 { .div = 0 }
317};
318
319static const struct clksel_rate dss1_fck_core_rates[] = {
320 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
321 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
322 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
323 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
324 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
325 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
326 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
327 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
328 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
329 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
330 { .div = 0 }
331};
332
333static const struct clksel dss1_fck_clksel[] = {
334 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
335 { .parent = &core_ck, .rates = dss1_fck_core_rates },
336 { .parent = NULL },
337};
338
339static const char *dss1_fck_parent_names[] = {
340 "sys_ck", "core_ck",
341};
342
343static const struct clk_ops dss1_fck_ops = {
344 .init = &omap2_init_clk_clkdm,
345 .enable = &omap2_dflt_clk_enable,
346 .disable = &omap2_dflt_clk_disable,
347 .is_enabled = &omap2_dflt_clk_is_enabled,
348 .recalc_rate = &omap2_clksel_recalc,
349 .get_parent = &omap2_clksel_find_parent_index,
350 .set_parent = &omap2_clksel_set_parent,
351};
352
353DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
354 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
355 OMAP24XX_CLKSEL_DSS1_MASK,
356 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
357 OMAP24XX_EN_DSS1_SHIFT, NULL,
358 dss1_fck_parent_names, dss1_fck_ops);
359
360static const struct clksel_rate dss2_fck_sys_rates[] = {
361 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
362 { .div = 0 }
363};
364
365static const struct clksel_rate dss2_fck_48m_rates[] = {
366 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
367 { .div = 0 }
368};
369
370static const struct clksel_rate func_48m_apll96_rates[] = {
371 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
372 { .div = 0 }
373};
374
375static const struct clksel_rate func_48m_alt_rates[] = {
376 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
377 { .div = 0 }
378};
379
380static const struct clksel func_48m_clksel[] = {
381 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
382 { .parent = &alt_ck, .rates = func_48m_alt_rates },
383 { .parent = NULL },
384};
385
386static const char *func_48m_ck_parent_names[] = {
387 "apll96_ck", "alt_ck",
388};
389
390static struct clk func_48m_ck;
391
392static const struct clk_ops func_48m_ck_ops = {
393 .init = &omap2_init_clk_clkdm,
394 .recalc_rate = &omap2_clksel_recalc,
395 .set_rate = &omap2_clksel_set_rate,
396 .round_rate = &omap2_clksel_round_rate,
397 .get_parent = &omap2_clksel_find_parent_index,
398 .set_parent = &omap2_clksel_set_parent,
399};
400
401static struct clk_hw_omap func_48m_ck_hw = {
402 .hw = {
403 .clk = &func_48m_ck,
404 },
405 .clksel = func_48m_clksel,
406 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
407 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
408 .clkdm_name = "wkup_clkdm",
409};
410
411DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
412
413static const struct clksel dss2_fck_clksel[] = {
414 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
415 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
416 { .parent = NULL },
417};
418
419static const char *dss2_fck_parent_names[] = {
420 "sys_ck", "func_48m_ck",
421};
422
423DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
424 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
425 OMAP24XX_CLKSEL_DSS2_MASK,
426 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
427 OMAP24XX_EN_DSS2_SHIFT, NULL,
428 dss2_fck_parent_names, dss1_fck_ops);
429
430static const char *func_54m_ck_parent_names[] = {
431 "apll54_ck", "alt_ck",
432};
433
434DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
435 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
436 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH, 0x0, NULL);
437
438static struct clk dss_54m_fck;
439
440static const char *dss_54m_fck_parent_names[] = {
441 "func_54m_ck",
442};
443
444static struct clk_hw_omap dss_54m_fck_hw = {
445 .hw = {
446 .clk = &dss_54m_fck,
447 },
448 .ops = &clkhwops_wait,
449 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
450 .enable_bit = OMAP24XX_EN_TV_SHIFT,
451 .clkdm_name = "dss_clkdm",
452};
453
454DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
455
456static struct clk dss_ick;
457
458static struct clk_hw_omap dss_ick_hw = {
459 .hw = {
460 .clk = &dss_ick,
461 },
462 .ops = &clkhwops_iclk,
463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
464 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
465 .clkdm_name = "dss_clkdm",
466};
467
468DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
469
470static struct clk emul_ck;
471
472static struct clk_hw_omap emul_ck_hw = {
473 .hw = {
474 .clk = &emul_ck,
475 },
476 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
477 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
478 .clkdm_name = "wkup_clkdm",
479};
480
481DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
482
483DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
484
485static struct clk fac_fck;
486
487static const char *fac_fck_parent_names[] = {
488 "func_12m_ck",
489};
490
491static struct clk_hw_omap fac_fck_hw = {
492 .hw = {
493 .clk = &fac_fck,
494 },
495 .ops = &clkhwops_wait,
496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
498 .clkdm_name = "core_l4_clkdm",
499};
500
501DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
502
503static struct clk fac_ick;
504
505static struct clk_hw_omap fac_ick_hw = {
506 .hw = {
507 .clk = &fac_ick,
508 },
509 .ops = &clkhwops_iclk_wait,
510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
511 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
512 .clkdm_name = "core_l4_clkdm",
513};
514
515DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
516
517static const struct clksel gfx_fck_clksel[] = {
518 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
519 { .parent = NULL },
520};
521
522static const char *gfx_2d_fck_parent_names[] = {
523 "core_l3_ck",
524};
525
526DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
527 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
528 OMAP_CLKSEL_GFX_MASK,
529 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
530 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
531 gfx_2d_fck_parent_names, dsp_fck_ops);
532
533DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
534 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
535 OMAP_CLKSEL_GFX_MASK,
536 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
537 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
538 gfx_2d_fck_parent_names, dsp_fck_ops);
539
540static struct clk gfx_ick;
541
542static const char *gfx_ick_parent_names[] = {
543 "core_l3_ck",
544};
545
546static struct clk_hw_omap gfx_ick_hw = {
547 .hw = {
548 .clk = &gfx_ick,
549 },
550 .ops = &clkhwops_wait,
551 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
552 .enable_bit = OMAP_EN_GFX_SHIFT,
553 .clkdm_name = "gfx_clkdm",
554};
555
556DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
557
558static struct clk gpio5_fck;
559
560static const char *gpio5_fck_parent_names[] = {
561 "func_32k_ck",
562};
563
564static struct clk_hw_omap gpio5_fck_hw = {
565 .hw = {
566 .clk = &gpio5_fck,
567 },
568 .ops = &clkhwops_wait,
569 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
570 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
571 .clkdm_name = "core_l4_clkdm",
572};
573
574DEFINE_STRUCT_CLK(gpio5_fck, gpio5_fck_parent_names, aes_ick_ops);
575
576static struct clk gpio5_ick;
577
578static struct clk_hw_omap gpio5_ick_hw = {
579 .hw = {
580 .clk = &gpio5_ick,
581 },
582 .ops = &clkhwops_iclk_wait,
583 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
584 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
585 .clkdm_name = "core_l4_clkdm",
586};
587
588DEFINE_STRUCT_CLK(gpio5_ick, aes_ick_parent_names, aes_ick_ops);
589
590static struct clk gpios_fck;
591
592static struct clk_hw_omap gpios_fck_hw = {
593 .hw = {
594 .clk = &gpios_fck,
595 },
596 .ops = &clkhwops_wait,
597 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
598 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
599 .clkdm_name = "wkup_clkdm",
600};
601
602DEFINE_STRUCT_CLK(gpios_fck, gpio5_fck_parent_names, aes_ick_ops);
603
604static struct clk gpios_ick;
605
606static const char *gpios_ick_parent_names[] = {
607 "sys_ck",
608};
609
610static struct clk_hw_omap gpios_ick_hw = {
611 .hw = {
612 .clk = &gpios_ick,
613 },
614 .ops = &clkhwops_iclk_wait,
615 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
616 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
617 .clkdm_name = "wkup_clkdm",
618};
619
620DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
621
622static struct clk gpmc_fck;
623
624static struct clk_hw_omap gpmc_fck_hw = {
625 .hw = {
626 .clk = &gpmc_fck,
627 },
628 .ops = &clkhwops_iclk,
629 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
630 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
631 .flags = ENABLE_ON_INIT,
632 .clkdm_name = "core_l3_clkdm",
633};
634
635DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
636
637static const struct clksel_rate gpt_alt_rates[] = {
638 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
639 { .div = 0 }
640};
641
642static const struct clksel omap24xx_gpt_clksel[] = {
643 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
644 { .parent = &sys_ck, .rates = gpt_sys_rates },
645 { .parent = &alt_ck, .rates = gpt_alt_rates },
646 { .parent = NULL },
647};
648
649static const char *gpt10_fck_parent_names[] = {
650 "func_32k_ck", "sys_ck", "alt_ck",
651};
652
653DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
654 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
655 OMAP24XX_CLKSEL_GPT10_MASK,
656 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
657 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
658 gpt10_fck_parent_names, dss1_fck_ops);
659
660static struct clk gpt10_ick;
661
662static struct clk_hw_omap gpt10_ick_hw = {
663 .hw = {
664 .clk = &gpt10_ick,
665 },
666 .ops = &clkhwops_iclk_wait,
667 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
668 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
669 .clkdm_name = "core_l4_clkdm",
670};
671
672DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
673
674DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
675 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
676 OMAP24XX_CLKSEL_GPT11_MASK,
677 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
678 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
679 gpt10_fck_parent_names, dss1_fck_ops);
680
681static struct clk gpt11_ick;
682
683static struct clk_hw_omap gpt11_ick_hw = {
684 .hw = {
685 .clk = &gpt11_ick,
686 },
687 .ops = &clkhwops_iclk_wait,
688 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
689 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
690 .clkdm_name = "core_l4_clkdm",
691};
692
693DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
694
695DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
696 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
697 OMAP24XX_CLKSEL_GPT12_MASK,
698 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
699 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
700 gpt10_fck_parent_names, dss1_fck_ops);
701
702static struct clk gpt12_ick;
703
704static struct clk_hw_omap gpt12_ick_hw = {
705 .hw = {
706 .clk = &gpt12_ick,
707 },
708 .ops = &clkhwops_iclk_wait,
709 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
710 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
711 .clkdm_name = "core_l4_clkdm",
712};
713
714DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
715
716static const struct clk_ops gpt1_fck_ops = {
717 .init = &omap2_init_clk_clkdm,
718 .enable = &omap2_dflt_clk_enable,
719 .disable = &omap2_dflt_clk_disable,
720 .is_enabled = &omap2_dflt_clk_is_enabled,
721 .recalc_rate = &omap2_clksel_recalc,
722 .set_rate = &omap2_clksel_set_rate,
723 .round_rate = &omap2_clksel_round_rate,
724 .get_parent = &omap2_clksel_find_parent_index,
725 .set_parent = &omap2_clksel_set_parent,
726};
727
728DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
729 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
730 OMAP24XX_CLKSEL_GPT1_MASK,
731 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
732 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
733 gpt10_fck_parent_names, gpt1_fck_ops);
734
735static struct clk gpt1_ick;
736
737static struct clk_hw_omap gpt1_ick_hw = {
738 .hw = {
739 .clk = &gpt1_ick,
740 },
741 .ops = &clkhwops_iclk_wait,
742 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
743 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
744 .clkdm_name = "wkup_clkdm",
745};
746
747DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
748
749DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
750 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
751 OMAP24XX_CLKSEL_GPT2_MASK,
752 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
753 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
754 gpt10_fck_parent_names, dss1_fck_ops);
755
756static struct clk gpt2_ick;
757
758static struct clk_hw_omap gpt2_ick_hw = {
759 .hw = {
760 .clk = &gpt2_ick,
761 },
762 .ops = &clkhwops_iclk_wait,
763 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
764 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
765 .clkdm_name = "core_l4_clkdm",
766};
767
768DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
769
770DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
771 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
772 OMAP24XX_CLKSEL_GPT3_MASK,
773 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
774 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
775 gpt10_fck_parent_names, dss1_fck_ops);
776
777static struct clk gpt3_ick;
778
779static struct clk_hw_omap gpt3_ick_hw = {
780 .hw = {
781 .clk = &gpt3_ick,
782 },
783 .ops = &clkhwops_iclk_wait,
784 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
785 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
786 .clkdm_name = "core_l4_clkdm",
787};
788
789DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
790
791DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
792 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
793 OMAP24XX_CLKSEL_GPT4_MASK,
794 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
795 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
796 gpt10_fck_parent_names, dss1_fck_ops);
797
798static struct clk gpt4_ick;
799
800static struct clk_hw_omap gpt4_ick_hw = {
801 .hw = {
802 .clk = &gpt4_ick,
803 },
804 .ops = &clkhwops_iclk_wait,
805 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
806 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
807 .clkdm_name = "core_l4_clkdm",
808};
809
810DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
811
812DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
813 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
814 OMAP24XX_CLKSEL_GPT5_MASK,
815 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
816 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
817 gpt10_fck_parent_names, dss1_fck_ops);
818
819static struct clk gpt5_ick;
820
821static struct clk_hw_omap gpt5_ick_hw = {
822 .hw = {
823 .clk = &gpt5_ick,
824 },
825 .ops = &clkhwops_iclk_wait,
826 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
827 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
828 .clkdm_name = "core_l4_clkdm",
829};
830
831DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
832
833DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
834 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
835 OMAP24XX_CLKSEL_GPT6_MASK,
836 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
837 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
838 gpt10_fck_parent_names, dss1_fck_ops);
839
840static struct clk gpt6_ick;
841
842static struct clk_hw_omap gpt6_ick_hw = {
843 .hw = {
844 .clk = &gpt6_ick,
845 },
846 .ops = &clkhwops_iclk_wait,
847 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
848 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
849 .clkdm_name = "core_l4_clkdm",
850};
851
852DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
853
854DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
855 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
856 OMAP24XX_CLKSEL_GPT7_MASK,
857 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
858 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
859 gpt10_fck_parent_names, dss1_fck_ops);
860
861static struct clk gpt7_ick;
862
863static struct clk_hw_omap gpt7_ick_hw = {
864 .hw = {
865 .clk = &gpt7_ick,
866 },
867 .ops = &clkhwops_iclk_wait,
868 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
869 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
870 .clkdm_name = "core_l4_clkdm",
871};
872
873DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
874
875static struct clk gpt8_fck;
876
877DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
878 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
879 OMAP24XX_CLKSEL_GPT8_MASK,
880 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
881 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
882 gpt10_fck_parent_names, dss1_fck_ops);
883
884static struct clk gpt8_ick;
885
886static struct clk_hw_omap gpt8_ick_hw = {
887 .hw = {
888 .clk = &gpt8_ick,
889 },
890 .ops = &clkhwops_iclk_wait,
891 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
892 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
893 .clkdm_name = "core_l4_clkdm",
894};
895
896DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
897
898DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
899 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
900 OMAP24XX_CLKSEL_GPT9_MASK,
901 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
902 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
903 gpt10_fck_parent_names, dss1_fck_ops);
904
905static struct clk gpt9_ick;
906
907static struct clk_hw_omap gpt9_ick_hw = {
908 .hw = {
909 .clk = &gpt9_ick,
910 },
911 .ops = &clkhwops_iclk_wait,
912 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
913 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
914 .clkdm_name = "core_l4_clkdm",
915};
916
917DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
918
919static struct clk hdq_fck;
920
921static struct clk_hw_omap hdq_fck_hw = {
922 .hw = {
923 .clk = &hdq_fck,
924 },
925 .ops = &clkhwops_wait,
926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
927 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
928 .clkdm_name = "core_l4_clkdm",
929};
930
931DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
932
933static struct clk hdq_ick;
934
935static struct clk_hw_omap hdq_ick_hw = {
936 .hw = {
937 .clk = &hdq_ick,
938 },
939 .ops = &clkhwops_iclk_wait,
940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
941 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
942 .clkdm_name = "core_l4_clkdm",
943};
944
945DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
946
947static struct clk i2c1_ick;
948
949static struct clk_hw_omap i2c1_ick_hw = {
950 .hw = {
951 .clk = &i2c1_ick,
952 },
953 .ops = &clkhwops_iclk_wait,
954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
955 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
956 .clkdm_name = "core_l4_clkdm",
957};
958
959DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
960
961static struct clk i2c2_ick;
962
963static struct clk_hw_omap i2c2_ick_hw = {
964 .hw = {
965 .clk = &i2c2_ick,
966 },
967 .ops = &clkhwops_iclk_wait,
968 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
969 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
970 .clkdm_name = "core_l4_clkdm",
971};
972
973DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
974
975static struct clk i2chs1_fck;
976
977static struct clk_hw_omap i2chs1_fck_hw = {
978 .hw = {
979 .clk = &i2chs1_fck,
980 },
981 .ops = &clkhwops_omap2430_i2chs_wait,
982 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
983 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
984 .clkdm_name = "core_l4_clkdm",
985};
986
987DEFINE_STRUCT_CLK(i2chs1_fck, cam_fck_parent_names, aes_ick_ops);
988
989static struct clk i2chs2_fck;
990
991static struct clk_hw_omap i2chs2_fck_hw = {
992 .hw = {
993 .clk = &i2chs2_fck,
994 },
995 .ops = &clkhwops_omap2430_i2chs_wait,
996 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
997 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
998 .clkdm_name = "core_l4_clkdm",
999};
1000
1001DEFINE_STRUCT_CLK(i2chs2_fck, cam_fck_parent_names, aes_ick_ops);
1002
1003static struct clk icr_ick;
1004
1005static struct clk_hw_omap icr_ick_hw = {
1006 .hw = {
1007 .clk = &icr_ick,
1008 },
1009 .ops = &clkhwops_iclk_wait,
1010 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1011 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1012 .clkdm_name = "wkup_clkdm",
1013};
1014
1015DEFINE_STRUCT_CLK(icr_ick, gpios_ick_parent_names, aes_ick_ops);
1016
1017static const struct clksel dsp_ick_clksel[] = {
1018 { .parent = &dsp_fck, .rates = dsp_ick_rates },
1019 { .parent = NULL },
1020};
1021
1022static const char *iva2_1_ick_parent_names[] = {
1023 "dsp_fck",
1024};
1025
1026DEFINE_CLK_OMAP_MUX_GATE(iva2_1_ick, "dsp_clkdm", dsp_ick_clksel,
1027 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1028 OMAP24XX_CLKSEL_DSP_IF_MASK,
1029 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1030 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
1031 iva2_1_ick_parent_names, dsp_fck_ops);
1032
1033static struct clk mailboxes_ick;
1034
1035static struct clk_hw_omap mailboxes_ick_hw = {
1036 .hw = {
1037 .clk = &mailboxes_ick,
1038 },
1039 .ops = &clkhwops_iclk_wait,
1040 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1041 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1042 .clkdm_name = "core_l4_clkdm",
1043};
1044
1045DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1046
1047static const struct clksel_rate common_mcbsp_96m_rates[] = {
1048 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1049 { .div = 0 }
1050};
1051
1052static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1053 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1054 { .div = 0 }
1055};
1056
1057static const struct clksel mcbsp_fck_clksel[] = {
1058 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1059 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1060 { .parent = NULL },
1061};
1062
1063static const char *mcbsp1_fck_parent_names[] = {
1064 "func_96m_ck", "mcbsp_clks",
1065};
1066
1067DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1068 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1069 OMAP2_MCBSP1_CLKS_MASK,
1070 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1071 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1072 mcbsp1_fck_parent_names, dss1_fck_ops);
1073
1074static struct clk mcbsp1_ick;
1075
1076static struct clk_hw_omap mcbsp1_ick_hw = {
1077 .hw = {
1078 .clk = &mcbsp1_ick,
1079 },
1080 .ops = &clkhwops_iclk_wait,
1081 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1082 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1083 .clkdm_name = "core_l4_clkdm",
1084};
1085
1086DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1087
1088DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1089 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1090 OMAP2_MCBSP2_CLKS_MASK,
1091 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1092 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1093 mcbsp1_fck_parent_names, dss1_fck_ops);
1094
1095static struct clk mcbsp2_ick;
1096
1097static struct clk_hw_omap mcbsp2_ick_hw = {
1098 .hw = {
1099 .clk = &mcbsp2_ick,
1100 },
1101 .ops = &clkhwops_iclk_wait,
1102 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1103 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1104 .clkdm_name = "core_l4_clkdm",
1105};
1106
1107DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1108
1109DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1110 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1111 OMAP2_MCBSP3_CLKS_MASK,
1112 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1113 OMAP2430_EN_MCBSP3_SHIFT, &clkhwops_wait,
1114 mcbsp1_fck_parent_names, dss1_fck_ops);
1115
1116static struct clk mcbsp3_ick;
1117
1118static struct clk_hw_omap mcbsp3_ick_hw = {
1119 .hw = {
1120 .clk = &mcbsp3_ick,
1121 },
1122 .ops = &clkhwops_iclk_wait,
1123 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1124 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1125 .clkdm_name = "core_l4_clkdm",
1126};
1127
1128DEFINE_STRUCT_CLK(mcbsp3_ick, aes_ick_parent_names, aes_ick_ops);
1129
1130DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1131 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1132 OMAP2_MCBSP4_CLKS_MASK,
1133 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1134 OMAP2430_EN_MCBSP4_SHIFT, &clkhwops_wait,
1135 mcbsp1_fck_parent_names, dss1_fck_ops);
1136
1137static struct clk mcbsp4_ick;
1138
1139static struct clk_hw_omap mcbsp4_ick_hw = {
1140 .hw = {
1141 .clk = &mcbsp4_ick,
1142 },
1143 .ops = &clkhwops_iclk_wait,
1144 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1145 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1146 .clkdm_name = "core_l4_clkdm",
1147};
1148
1149DEFINE_STRUCT_CLK(mcbsp4_ick, aes_ick_parent_names, aes_ick_ops);
1150
1151DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1152 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1153 OMAP2_MCBSP5_CLKS_MASK,
1154 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1155 OMAP2430_EN_MCBSP5_SHIFT, &clkhwops_wait,
1156 mcbsp1_fck_parent_names, dss1_fck_ops);
1157
1158static struct clk mcbsp5_ick;
1159
1160static struct clk_hw_omap mcbsp5_ick_hw = {
1161 .hw = {
1162 .clk = &mcbsp5_ick,
1163 },
1164 .ops = &clkhwops_iclk_wait,
1165 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1166 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1167 .clkdm_name = "core_l4_clkdm",
1168};
1169
1170DEFINE_STRUCT_CLK(mcbsp5_ick, aes_ick_parent_names, aes_ick_ops);
1171
1172static struct clk mcspi1_fck;
1173
1174static const char *mcspi1_fck_parent_names[] = {
1175 "func_48m_ck",
1176};
1177
1178static struct clk_hw_omap mcspi1_fck_hw = {
1179 .hw = {
1180 .clk = &mcspi1_fck,
1181 },
1182 .ops = &clkhwops_wait,
1183 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1184 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1185 .clkdm_name = "core_l4_clkdm",
1186};
1187
1188DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1189
1190static struct clk mcspi1_ick;
1191
1192static struct clk_hw_omap mcspi1_ick_hw = {
1193 .hw = {
1194 .clk = &mcspi1_ick,
1195 },
1196 .ops = &clkhwops_iclk_wait,
1197 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1198 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1199 .clkdm_name = "core_l4_clkdm",
1200};
1201
1202DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1203
1204static struct clk mcspi2_fck;
1205
1206static struct clk_hw_omap mcspi2_fck_hw = {
1207 .hw = {
1208 .clk = &mcspi2_fck,
1209 },
1210 .ops = &clkhwops_wait,
1211 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1212 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1213 .clkdm_name = "core_l4_clkdm",
1214};
1215
1216DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1217
1218static struct clk mcspi2_ick;
1219
1220static struct clk_hw_omap mcspi2_ick_hw = {
1221 .hw = {
1222 .clk = &mcspi2_ick,
1223 },
1224 .ops = &clkhwops_iclk_wait,
1225 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1226 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1227 .clkdm_name = "core_l4_clkdm",
1228};
1229
1230DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1231
1232static struct clk mcspi3_fck;
1233
1234static struct clk_hw_omap mcspi3_fck_hw = {
1235 .hw = {
1236 .clk = &mcspi3_fck,
1237 },
1238 .ops = &clkhwops_wait,
1239 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1240 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1241 .clkdm_name = "core_l4_clkdm",
1242};
1243
1244DEFINE_STRUCT_CLK(mcspi3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1245
1246static struct clk mcspi3_ick;
1247
1248static struct clk_hw_omap mcspi3_ick_hw = {
1249 .hw = {
1250 .clk = &mcspi3_ick,
1251 },
1252 .ops = &clkhwops_iclk_wait,
1253 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1254 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1255 .clkdm_name = "core_l4_clkdm",
1256};
1257
1258DEFINE_STRUCT_CLK(mcspi3_ick, aes_ick_parent_names, aes_ick_ops);
1259
1260static const struct clksel_rate mdm_ick_core_rates[] = {
1261 { .div = 1, .val = 1, .flags = RATE_IN_243X },
1262 { .div = 4, .val = 4, .flags = RATE_IN_243X },
1263 { .div = 6, .val = 6, .flags = RATE_IN_243X },
1264 { .div = 9, .val = 9, .flags = RATE_IN_243X },
1265 { .div = 0 }
1266};
1267
1268static const struct clksel mdm_ick_clksel[] = {
1269 { .parent = &core_ck, .rates = mdm_ick_core_rates },
1270 { .parent = NULL },
1271};
1272
1273static const char *mdm_ick_parent_names[] = {
1274 "core_ck",
1275};
1276
1277DEFINE_CLK_OMAP_MUX_GATE(mdm_ick, "mdm_clkdm", mdm_ick_clksel,
1278 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
1279 OMAP2430_CLKSEL_MDM_MASK,
1280 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
1281 OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
1282 &clkhwops_iclk_wait, mdm_ick_parent_names,
1283 dsp_fck_ops);
1284
1285static struct clk mdm_intc_ick;
1286
1287static struct clk_hw_omap mdm_intc_ick_hw = {
1288 .hw = {
1289 .clk = &mdm_intc_ick,
1290 },
1291 .ops = &clkhwops_iclk_wait,
1292 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1293 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1294 .clkdm_name = "core_l4_clkdm",
1295};
1296
1297DEFINE_STRUCT_CLK(mdm_intc_ick, aes_ick_parent_names, aes_ick_ops);
1298
1299static struct clk mdm_osc_ck;
1300
1301static struct clk_hw_omap mdm_osc_ck_hw = {
1302 .hw = {
1303 .clk = &mdm_osc_ck,
1304 },
1305 .ops = &clkhwops_iclk_wait,
1306 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
1307 .enable_bit = OMAP2430_EN_OSC_SHIFT,
1308 .clkdm_name = "mdm_clkdm",
1309};
1310
1311DEFINE_STRUCT_CLK(mdm_osc_ck, sys_ck_parent_names, aes_ick_ops);
1312
1313static struct clk mmchs1_fck;
1314
1315static struct clk_hw_omap mmchs1_fck_hw = {
1316 .hw = {
1317 .clk = &mmchs1_fck,
1318 },
1319 .ops = &clkhwops_wait,
1320 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1321 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1322 .clkdm_name = "core_l4_clkdm",
1323};
1324
1325DEFINE_STRUCT_CLK(mmchs1_fck, cam_fck_parent_names, aes_ick_ops);
1326
1327static struct clk mmchs1_ick;
1328
1329static struct clk_hw_omap mmchs1_ick_hw = {
1330 .hw = {
1331 .clk = &mmchs1_ick,
1332 },
1333 .ops = &clkhwops_iclk_wait,
1334 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1335 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1336 .clkdm_name = "core_l4_clkdm",
1337};
1338
1339DEFINE_STRUCT_CLK(mmchs1_ick, aes_ick_parent_names, aes_ick_ops);
1340
1341static struct clk mmchs2_fck;
1342
1343static struct clk_hw_omap mmchs2_fck_hw = {
1344 .hw = {
1345 .clk = &mmchs2_fck,
1346 },
1347 .ops = &clkhwops_wait,
1348 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1349 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1350 .clkdm_name = "core_l4_clkdm",
1351};
1352
1353DEFINE_STRUCT_CLK(mmchs2_fck, cam_fck_parent_names, aes_ick_ops);
1354
1355static struct clk mmchs2_ick;
1356
1357static struct clk_hw_omap mmchs2_ick_hw = {
1358 .hw = {
1359 .clk = &mmchs2_ick,
1360 },
1361 .ops = &clkhwops_iclk_wait,
1362 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1363 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1364 .clkdm_name = "core_l4_clkdm",
1365};
1366
1367DEFINE_STRUCT_CLK(mmchs2_ick, aes_ick_parent_names, aes_ick_ops);
1368
1369static struct clk mmchsdb1_fck;
1370
1371static struct clk_hw_omap mmchsdb1_fck_hw = {
1372 .hw = {
1373 .clk = &mmchsdb1_fck,
1374 },
1375 .ops = &clkhwops_wait,
1376 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1377 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1378 .clkdm_name = "core_l4_clkdm",
1379};
1380
1381DEFINE_STRUCT_CLK(mmchsdb1_fck, gpio5_fck_parent_names, aes_ick_ops);
1382
1383static struct clk mmchsdb2_fck;
1384
1385static struct clk_hw_omap mmchsdb2_fck_hw = {
1386 .hw = {
1387 .clk = &mmchsdb2_fck,
1388 },
1389 .ops = &clkhwops_wait,
1390 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1391 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1392 .clkdm_name = "core_l4_clkdm",
1393};
1394
1395DEFINE_STRUCT_CLK(mmchsdb2_fck, gpio5_fck_parent_names, aes_ick_ops);
1396
1397DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1398 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1399 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1400 CLK_DIVIDER_ONE_BASED, NULL);
1401
1402static struct clk mpu_wdt_fck;
1403
1404static struct clk_hw_omap mpu_wdt_fck_hw = {
1405 .hw = {
1406 .clk = &mpu_wdt_fck,
1407 },
1408 .ops = &clkhwops_wait,
1409 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1410 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1411 .clkdm_name = "wkup_clkdm",
1412};
1413
1414DEFINE_STRUCT_CLK(mpu_wdt_fck, gpio5_fck_parent_names, aes_ick_ops);
1415
1416static struct clk mpu_wdt_ick;
1417
1418static struct clk_hw_omap mpu_wdt_ick_hw = {
1419 .hw = {
1420 .clk = &mpu_wdt_ick,
1421 },
1422 .ops = &clkhwops_iclk_wait,
1423 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1424 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1425 .clkdm_name = "wkup_clkdm",
1426};
1427
1428DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1429
1430static struct clk mspro_fck;
1431
1432static struct clk_hw_omap mspro_fck_hw = {
1433 .hw = {
1434 .clk = &mspro_fck,
1435 },
1436 .ops = &clkhwops_wait,
1437 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1438 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1439 .clkdm_name = "core_l4_clkdm",
1440};
1441
1442DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1443
1444static struct clk mspro_ick;
1445
1446static struct clk_hw_omap mspro_ick_hw = {
1447 .hw = {
1448 .clk = &mspro_ick,
1449 },
1450 .ops = &clkhwops_iclk_wait,
1451 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1452 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1453 .clkdm_name = "core_l4_clkdm",
1454};
1455
1456DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1457
1458static struct clk omapctrl_ick;
1459
1460static struct clk_hw_omap omapctrl_ick_hw = {
1461 .hw = {
1462 .clk = &omapctrl_ick,
1463 },
1464 .ops = &clkhwops_iclk_wait,
1465 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1466 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1467 .flags = ENABLE_ON_INIT,
1468 .clkdm_name = "wkup_clkdm",
1469};
1470
1471DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1472
1473static struct clk pka_ick;
1474
1475static struct clk_hw_omap pka_ick_hw = {
1476 .hw = {
1477 .clk = &pka_ick,
1478 },
1479 .ops = &clkhwops_iclk_wait,
1480 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1481 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1482 .clkdm_name = "core_l4_clkdm",
1483};
1484
1485DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1486
1487static struct clk rng_ick;
1488
1489static struct clk_hw_omap rng_ick_hw = {
1490 .hw = {
1491 .clk = &rng_ick,
1492 },
1493 .ops = &clkhwops_iclk_wait,
1494 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1495 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1496 .clkdm_name = "core_l4_clkdm",
1497};
1498
1499DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1500
1501static struct clk sdma_fck;
1502
1503DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1504DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1505
1506static struct clk sdma_ick;
1507
1508static struct clk_hw_omap sdma_ick_hw = {
1509 .hw = {
1510 .clk = &sdma_ick,
1511 },
1512 .ops = &clkhwops_iclk,
1513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1514 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1515 .clkdm_name = "core_l3_clkdm",
1516};
1517
1518DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1519
1520static struct clk sdrc_ick;
1521
1522static struct clk_hw_omap sdrc_ick_hw = {
1523 .hw = {
1524 .clk = &sdrc_ick,
1525 },
1526 .ops = &clkhwops_iclk,
1527 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1528 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1529 .flags = ENABLE_ON_INIT,
1530 .clkdm_name = "core_l3_clkdm",
1531};
1532
1533DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1534
1535static struct clk sha_ick;
1536
1537static struct clk_hw_omap sha_ick_hw = {
1538 .hw = {
1539 .clk = &sha_ick,
1540 },
1541 .ops = &clkhwops_iclk_wait,
1542 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1543 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1544 .clkdm_name = "core_l4_clkdm",
1545};
1546
1547DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1548
1549static struct clk ssi_l4_ick;
1550
1551static struct clk_hw_omap ssi_l4_ick_hw = {
1552 .hw = {
1553 .clk = &ssi_l4_ick,
1554 },
1555 .ops = &clkhwops_iclk_wait,
1556 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1557 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1558 .clkdm_name = "core_l4_clkdm",
1559};
1560
1561DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1562
1563static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1564 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1565 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1566 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1567 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1568 { .div = 5, .val = 5, .flags = RATE_IN_243X },
1569 { .div = 0 }
1570};
1571
1572static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1573 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1574 { .parent = NULL },
1575};
1576
1577static const char *ssi_ssr_sst_fck_parent_names[] = {
1578 "core_ck",
1579};
1580
1581DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1582 ssi_ssr_sst_fck_clksel,
1583 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1584 OMAP24XX_CLKSEL_SSI_MASK,
1585 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1586 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1587 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1588
1589static struct clk sync_32k_ick;
1590
1591static struct clk_hw_omap sync_32k_ick_hw = {
1592 .hw = {
1593 .clk = &sync_32k_ick,
1594 },
1595 .ops = &clkhwops_iclk_wait,
1596 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1597 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1598 .flags = ENABLE_ON_INIT,
1599 .clkdm_name = "wkup_clkdm",
1600};
1601
1602DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1603
1604static const struct clksel_rate common_clkout_src_core_rates[] = {
1605 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1606 { .div = 0 }
1607};
1608
1609static const struct clksel_rate common_clkout_src_sys_rates[] = {
1610 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1611 { .div = 0 }
1612};
1613
1614static const struct clksel_rate common_clkout_src_96m_rates[] = {
1615 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1616 { .div = 0 }
1617};
1618
1619static const struct clksel_rate common_clkout_src_54m_rates[] = {
1620 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1621 { .div = 0 }
1622};
1623
1624static const struct clksel common_clkout_src_clksel[] = {
1625 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1626 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1627 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1628 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1629 { .parent = NULL },
1630};
1631
1632static const char *sys_clkout_src_parent_names[] = {
1633 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1634};
1635
1636DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1637 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1638 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1639 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1640
1641DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1642 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1643 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1644
1645static struct clk uart1_fck;
1646
1647static struct clk_hw_omap uart1_fck_hw = {
1648 .hw = {
1649 .clk = &uart1_fck,
1650 },
1651 .ops = &clkhwops_wait,
1652 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1653 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1654 .clkdm_name = "core_l4_clkdm",
1655};
1656
1657DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1658
1659static struct clk uart1_ick;
1660
1661static struct clk_hw_omap uart1_ick_hw = {
1662 .hw = {
1663 .clk = &uart1_ick,
1664 },
1665 .ops = &clkhwops_iclk_wait,
1666 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1667 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1668 .clkdm_name = "core_l4_clkdm",
1669};
1670
1671DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1672
1673static struct clk uart2_fck;
1674
1675static struct clk_hw_omap uart2_fck_hw = {
1676 .hw = {
1677 .clk = &uart2_fck,
1678 },
1679 .ops = &clkhwops_wait,
1680 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1681 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1682 .clkdm_name = "core_l4_clkdm",
1683};
1684
1685DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1686
1687static struct clk uart2_ick;
1688
1689static struct clk_hw_omap uart2_ick_hw = {
1690 .hw = {
1691 .clk = &uart2_ick,
1692 },
1693 .ops = &clkhwops_iclk_wait,
1694 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1695 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1696 .clkdm_name = "core_l4_clkdm",
1697};
1698
1699DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1700
1701static struct clk uart3_fck;
1702
1703static struct clk_hw_omap uart3_fck_hw = {
1704 .hw = {
1705 .clk = &uart3_fck,
1706 },
1707 .ops = &clkhwops_wait,
1708 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1709 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1710 .clkdm_name = "core_l4_clkdm",
1711};
1712
1713DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1714
1715static struct clk uart3_ick;
1716
1717static struct clk_hw_omap uart3_ick_hw = {
1718 .hw = {
1719 .clk = &uart3_ick,
1720 },
1721 .ops = &clkhwops_iclk_wait,
1722 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1723 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1724 .clkdm_name = "core_l4_clkdm",
1725};
1726
1727DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1728
1729static struct clk usb_fck;
1730
1731static struct clk_hw_omap usb_fck_hw = {
1732 .hw = {
1733 .clk = &usb_fck,
1734 },
1735 .ops = &clkhwops_wait,
1736 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1737 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1738 .clkdm_name = "core_l3_clkdm",
1739};
1740
1741DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1742
1743static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1744 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1745 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1746 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1747 { .div = 0 }
1748};
1749
1750static const struct clksel usb_l4_ick_clksel[] = {
1751 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1752 { .parent = NULL },
1753};
1754
1755static const char *usb_l4_ick_parent_names[] = {
1756 "core_l3_ck",
1757};
1758
1759DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1760 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1761 OMAP24XX_CLKSEL_USB_MASK,
1762 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1763 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1764 usb_l4_ick_parent_names, dsp_fck_ops);
1765
1766static struct clk usbhs_ick;
1767
1768static struct clk_hw_omap usbhs_ick_hw = {
1769 .hw = {
1770 .clk = &usbhs_ick,
1771 },
1772 .ops = &clkhwops_iclk_wait,
1773 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1774 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1775 .clkdm_name = "core_l3_clkdm",
1776};
1777
1778DEFINE_STRUCT_CLK(usbhs_ick, gfx_ick_parent_names, aes_ick_ops);
1779
1780static struct clk virt_prcm_set;
1781
1782static const char *virt_prcm_set_parent_names[] = {
1783 "mpu_ck",
1784};
1785
1786static const struct clk_ops virt_prcm_set_ops = {
1787 .recalc_rate = &omap2_table_mpu_recalc,
1788 .set_rate = &omap2_select_table_rate,
1789 .round_rate = &omap2_round_to_table_rate,
1790};
1791
1792DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1793DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1794
1795static struct clk wdt1_ick;
1796
1797static struct clk_hw_omap wdt1_ick_hw = {
1798 .hw = {
1799 .clk = &wdt1_ick,
1800 },
1801 .ops = &clkhwops_iclk_wait,
1802 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1803 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1804 .clkdm_name = "wkup_clkdm",
1805};
1806
1807DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1808
1809static struct clk wdt4_fck;
1810
1811static struct clk_hw_omap wdt4_fck_hw = {
1812 .hw = {
1813 .clk = &wdt4_fck,
1814 },
1815 .ops = &clkhwops_wait,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1817 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1818 .clkdm_name = "core_l4_clkdm",
1819};
1820
1821DEFINE_STRUCT_CLK(wdt4_fck, gpio5_fck_parent_names, aes_ick_ops);
1822
1823static struct clk wdt4_ick;
1824
1825static struct clk_hw_omap wdt4_ick_hw = {
1826 .hw = {
1827 .clk = &wdt4_ick,
1828 },
1829 .ops = &clkhwops_iclk_wait,
1830 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1831 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1832 .clkdm_name = "core_l4_clkdm",
1833};
1834
1835DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1836
1837/*
1838 * clkdev integration
1839 */
1840
1841static struct omap_clk omap2430_clks[] = {
1842 /* external root sources */
1843 CLK(NULL, "func_32k_ck", &func_32k_ck),
1844 CLK(NULL, "secure_32k_ck", &secure_32k_ck),
1845 CLK(NULL, "osc_ck", &osc_ck),
1846 CLK("twl", "fck", &osc_ck),
1847 CLK(NULL, "sys_ck", &sys_ck),
1848 CLK(NULL, "alt_ck", &alt_ck),
1849 CLK(NULL, "mcbsp_clks", &mcbsp_clks),
1850 /* internal analog sources */
1851 CLK(NULL, "dpll_ck", &dpll_ck),
1852 CLK(NULL, "apll96_ck", &apll96_ck),
1853 CLK(NULL, "apll54_ck", &apll54_ck),
1854 /* internal prcm root sources */
1855 CLK(NULL, "func_54m_ck", &func_54m_ck),
1856 CLK(NULL, "core_ck", &core_ck),
1857 CLK(NULL, "func_96m_ck", &func_96m_ck),
1858 CLK(NULL, "func_48m_ck", &func_48m_ck),
1859 CLK(NULL, "func_12m_ck", &func_12m_ck),
1860 CLK(NULL, "sys_clkout_src", &sys_clkout_src),
1861 CLK(NULL, "sys_clkout", &sys_clkout),
1862 CLK(NULL, "emul_ck", &emul_ck),
1863 /* mpu domain clocks */
1864 CLK(NULL, "mpu_ck", &mpu_ck),
1865 /* dsp domain clocks */
1866 CLK(NULL, "dsp_fck", &dsp_fck),
1867 CLK(NULL, "iva2_1_ick", &iva2_1_ick),
1868 /* GFX domain clocks */
1869 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck),
1870 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck),
1871 CLK(NULL, "gfx_ick", &gfx_ick),
1872 /* Modem domain clocks */
1873 CLK(NULL, "mdm_ick", &mdm_ick),
1874 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck),
1875 /* DSS domain clocks */
1876 CLK("omapdss_dss", "ick", &dss_ick),
1877 CLK(NULL, "dss_ick", &dss_ick),
1878 CLK(NULL, "dss1_fck", &dss1_fck),
1879 CLK(NULL, "dss2_fck", &dss2_fck),
1880 CLK(NULL, "dss_54m_fck", &dss_54m_fck),
1881 /* L3 domain clocks */
1882 CLK(NULL, "core_l3_ck", &core_l3_ck),
1883 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck),
1884 CLK(NULL, "usb_l4_ick", &usb_l4_ick),
1885 /* L4 domain clocks */
1886 CLK(NULL, "l4_ck", &l4_ck),
1887 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick),
1888 /* virtual meta-group clock */
1889 CLK(NULL, "virt_prcm_set", &virt_prcm_set),
1890 /* general l4 interface ck, multi-parent functional clk */
1891 CLK(NULL, "gpt1_ick", &gpt1_ick),
1892 CLK(NULL, "gpt1_fck", &gpt1_fck),
1893 CLK(NULL, "gpt2_ick", &gpt2_ick),
1894 CLK(NULL, "gpt2_fck", &gpt2_fck),
1895 CLK(NULL, "gpt3_ick", &gpt3_ick),
1896 CLK(NULL, "gpt3_fck", &gpt3_fck),
1897 CLK(NULL, "gpt4_ick", &gpt4_ick),
1898 CLK(NULL, "gpt4_fck", &gpt4_fck),
1899 CLK(NULL, "gpt5_ick", &gpt5_ick),
1900 CLK(NULL, "gpt5_fck", &gpt5_fck),
1901 CLK(NULL, "gpt6_ick", &gpt6_ick),
1902 CLK(NULL, "gpt6_fck", &gpt6_fck),
1903 CLK(NULL, "gpt7_ick", &gpt7_ick),
1904 CLK(NULL, "gpt7_fck", &gpt7_fck),
1905 CLK(NULL, "gpt8_ick", &gpt8_ick),
1906 CLK(NULL, "gpt8_fck", &gpt8_fck),
1907 CLK(NULL, "gpt9_ick", &gpt9_ick),
1908 CLK(NULL, "gpt9_fck", &gpt9_fck),
1909 CLK(NULL, "gpt10_ick", &gpt10_ick),
1910 CLK(NULL, "gpt10_fck", &gpt10_fck),
1911 CLK(NULL, "gpt11_ick", &gpt11_ick),
1912 CLK(NULL, "gpt11_fck", &gpt11_fck),
1913 CLK(NULL, "gpt12_ick", &gpt12_ick),
1914 CLK(NULL, "gpt12_fck", &gpt12_fck),
1915 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick),
1916 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick),
1917 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck),
1918 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick),
1919 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick),
1920 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck),
1921 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick),
1922 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick),
1923 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck),
1924 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick),
1925 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick),
1926 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck),
1927 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick),
1928 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick),
1929 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck),
1930 CLK("omap2_mcspi.1", "ick", &mcspi1_ick),
1931 CLK(NULL, "mcspi1_ick", &mcspi1_ick),
1932 CLK(NULL, "mcspi1_fck", &mcspi1_fck),
1933 CLK("omap2_mcspi.2", "ick", &mcspi2_ick),
1934 CLK(NULL, "mcspi2_ick", &mcspi2_ick),
1935 CLK(NULL, "mcspi2_fck", &mcspi2_fck),
1936 CLK("omap2_mcspi.3", "ick", &mcspi3_ick),
1937 CLK(NULL, "mcspi3_ick", &mcspi3_ick),
1938 CLK(NULL, "mcspi3_fck", &mcspi3_fck),
1939 CLK(NULL, "uart1_ick", &uart1_ick),
1940 CLK(NULL, "uart1_fck", &uart1_fck),
1941 CLK(NULL, "uart2_ick", &uart2_ick),
1942 CLK(NULL, "uart2_fck", &uart2_fck),
1943 CLK(NULL, "uart3_ick", &uart3_ick),
1944 CLK(NULL, "uart3_fck", &uart3_fck),
1945 CLK(NULL, "gpios_ick", &gpios_ick),
1946 CLK(NULL, "gpios_fck", &gpios_fck),
1947 CLK("omap_wdt", "ick", &mpu_wdt_ick),
1948 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick),
1949 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck),
1950 CLK(NULL, "sync_32k_ick", &sync_32k_ick),
1951 CLK(NULL, "wdt1_ick", &wdt1_ick),
1952 CLK(NULL, "omapctrl_ick", &omapctrl_ick),
1953 CLK(NULL, "icr_ick", &icr_ick),
1954 CLK("omap24xxcam", "fck", &cam_fck),
1955 CLK(NULL, "cam_fck", &cam_fck),
1956 CLK("omap24xxcam", "ick", &cam_ick),
1957 CLK(NULL, "cam_ick", &cam_ick),
1958 CLK(NULL, "mailboxes_ick", &mailboxes_ick),
1959 CLK(NULL, "wdt4_ick", &wdt4_ick),
1960 CLK(NULL, "wdt4_fck", &wdt4_fck),
1961 CLK(NULL, "mspro_ick", &mspro_ick),
1962 CLK(NULL, "mspro_fck", &mspro_fck),
1963 CLK(NULL, "fac_ick", &fac_ick),
1964 CLK(NULL, "fac_fck", &fac_fck),
1965 CLK("omap_hdq.0", "ick", &hdq_ick),
1966 CLK(NULL, "hdq_ick", &hdq_ick),
1967 CLK("omap_hdq.1", "fck", &hdq_fck),
1968 CLK(NULL, "hdq_fck", &hdq_fck),
1969 CLK("omap_i2c.1", "ick", &i2c1_ick),
1970 CLK(NULL, "i2c1_ick", &i2c1_ick),
1971 CLK(NULL, "i2chs1_fck", &i2chs1_fck),
1972 CLK("omap_i2c.2", "ick", &i2c2_ick),
1973 CLK(NULL, "i2c2_ick", &i2c2_ick),
1974 CLK(NULL, "i2chs2_fck", &i2chs2_fck),
1975 CLK(NULL, "gpmc_fck", &gpmc_fck),
1976 CLK(NULL, "sdma_fck", &sdma_fck),
1977 CLK(NULL, "sdma_ick", &sdma_ick),
1978 CLK(NULL, "sdrc_ick", &sdrc_ick),
1979 CLK(NULL, "des_ick", &des_ick),
1980 CLK("omap-sham", "ick", &sha_ick),
1981 CLK(NULL, "sha_ick", &sha_ick),
1982 CLK("omap_rng", "ick", &rng_ick),
1983 CLK(NULL, "rng_ick", &rng_ick),
1984 CLK("omap-aes", "ick", &aes_ick),
1985 CLK(NULL, "aes_ick", &aes_ick),
1986 CLK(NULL, "pka_ick", &pka_ick),
1987 CLK(NULL, "usb_fck", &usb_fck),
1988 CLK("musb-omap2430", "ick", &usbhs_ick),
1989 CLK(NULL, "usbhs_ick", &usbhs_ick),
1990 CLK("omap_hsmmc.0", "ick", &mmchs1_ick),
1991 CLK(NULL, "mmchs1_ick", &mmchs1_ick),
1992 CLK(NULL, "mmchs1_fck", &mmchs1_fck),
1993 CLK("omap_hsmmc.1", "ick", &mmchs2_ick),
1994 CLK(NULL, "mmchs2_ick", &mmchs2_ick),
1995 CLK(NULL, "mmchs2_fck", &mmchs2_fck),
1996 CLK(NULL, "gpio5_ick", &gpio5_ick),
1997 CLK(NULL, "gpio5_fck", &gpio5_fck),
1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick),
1999 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck),
2000 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck),
2001 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck),
2002 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck),
2003 CLK(NULL, "timer_32k_ck", &func_32k_ck),
2004 CLK(NULL, "timer_sys_ck", &sys_ck),
2005 CLK(NULL, "timer_ext_ck", &alt_ck),
2006 CLK(NULL, "cpufreq_ck", &virt_prcm_set),
2007};
2008
2009static const char *enable_init_clks[] = {
2010 "apll96_ck",
2011 "apll54_ck",
2012 "sync_32k_ick",
2013 "omapctrl_ick",
2014 "gpmc_fck",
2015 "sdrc_ick",
2016};
2017
2018/*
2019 * init code
2020 */
2021
2022int __init omap2430_clk_init(void)
2023{
2024 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2025 cpu_mask = RATE_IN_243X;
2026 rate_table = omap2430_rate_table;
2027
2028 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
2029
2030 omap2xxx_clkt_vps_check_bootloader_rates();
2031
2032 omap_clocks_register(omap2430_clks, ARRAY_SIZE(omap2430_clks));
2033
2034 omap2xxx_clkt_vps_late_init();
2035
2036 omap2_clk_disable_autoidle_all();
2037
2038 omap2_clk_enable_init_clocks(enable_init_clks,
2039 ARRAY_SIZE(enable_init_clks));
2040
2041 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2042 (clk_get_rate(&sys_ck) / 1000000),
2043 (clk_get_rate(&sys_ck) / 100000) % 10,
2044 (clk_get_rate(&dpll_ck) / 1000000),
2045 (clk_get_rate(&mpu_ck) / 1000000));
2046
2047 return 0;
2048}
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
deleted file mode 100644
index 0717dff1bc04..000000000000
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * OMAP2xxx osc_clk-specific clock code
3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Gordon McNutt and RidgeRun, Inc.
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#undef DEBUG
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/errno.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25
26#include "clock.h"
27#include "clock2xxx.h"
28#include "prm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30
31/*
32 * XXX This does not actually enable the osc_ck, since the osc_ck must
33 * be running for this function to be called. Instead, this function
34 * is used to disable an autoidle mode on the osc_ck. The existing
35 * clk_enable/clk_disable()-based usecounting for osc_ck should be
36 * replaced with autoidle-based usecounting.
37 */
38int omap2_enable_osc_ck(struct clk_hw *clk)
39{
40 u32 pcc;
41
42 pcc = readl_relaxed(prcm_clksrc_ctrl);
43
44 writel_relaxed(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
45
46 return 0;
47}
48
49/*
50 * XXX This does not actually disable the osc_ck, since doing so would
51 * immediately halt the system. Instead, this function is used to
52 * enable an autoidle mode on the osc_ck. The existing
53 * clk_enable/clk_disable()-based usecounting for osc_ck should be
54 * replaced with autoidle-based usecounting.
55 */
56void omap2_disable_osc_ck(struct clk_hw *clk)
57{
58 u32 pcc;
59
60 pcc = readl_relaxed(prcm_clksrc_ctrl);
61
62 writel_relaxed(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
63}
64
65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
66 unsigned long parent_rate)
67{
68 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();
69}
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
deleted file mode 100644
index 58dd3a9b726c..000000000000
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * OMAP2xxx sys_clk-specific clock code
3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Gordon McNutt and RidgeRun, Inc.
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#undef DEBUG
19
20#include <linux/kernel.h>
21#include <linux/errno.h>
22#include <linux/clk.h>
23#include <linux/io.h>
24
25#include "clock.h"
26#include "clock2xxx.h"
27#include "prm2xxx_3xxx.h"
28#include "prm-regbits-24xx.h"
29
30void __iomem *prcm_clksrc_ctrl;
31
32u32 omap2xxx_get_sysclkdiv(void)
33{
34 u32 div;
35
36 div = readl_relaxed(prcm_clksrc_ctrl);
37 div &= OMAP_SYSCLKDIV_MASK;
38 div >>= OMAP_SYSCLKDIV_SHIFT;
39
40 return div;
41}
42
43unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
44 unsigned long parent_rate)
45{
46 return parent_rate / omap2xxx_get_sysclkdiv();
47}
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 67fd26a18441..f251a14cbf16 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -21,10 +21,7 @@
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
24#include "soc.h"
25#include "clock.h" 24#include "clock.h"
26#include "cm-regbits-24xx.h"
27#include "cm-regbits-34xx.h"
28 25
29/* DPLL rate rounding: minimum DPLL multiplier, divider values */ 26/* DPLL rate rounding: minimum DPLL multiplier, divider values */
30#define DPLL_MIN_MULTIPLIER 2 27#define DPLL_MIN_MULTIPLIER 2
@@ -44,20 +41,12 @@
44#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \ 41#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \
45 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE)) 42 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE))
46 43
47/* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */
48#define OMAP3430_DPLL_FINT_BAND1_MIN 750000
49#define OMAP3430_DPLL_FINT_BAND1_MAX 2100000
50#define OMAP3430_DPLL_FINT_BAND2_MIN 7500000
51#define OMAP3430_DPLL_FINT_BAND2_MAX 21000000
52
53/* 44/*
54 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx. 45 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx.
55 * From device data manual section 4.3 "DPLL and DLL Specifications". 46 * From device data manual section 4.3 "DPLL and DLL Specifications".
56 */ 47 */
57#define OMAP3PLUS_DPLL_FINT_JTYPE_MIN 500000 48#define OMAP3PLUS_DPLL_FINT_JTYPE_MIN 500000
58#define OMAP3PLUS_DPLL_FINT_JTYPE_MAX 2500000 49#define OMAP3PLUS_DPLL_FINT_JTYPE_MAX 2500000
59#define OMAP3PLUS_DPLL_FINT_MIN 32000
60#define OMAP3PLUS_DPLL_FINT_MAX 52000000
61 50
62/* _dpll_test_fint() return codes */ 51/* _dpll_test_fint() return codes */
63#define DPLL_FINT_UNDERFLOW -1 52#define DPLL_FINT_UNDERFLOW -1
@@ -87,33 +76,31 @@ static int _dpll_test_fint(struct clk_hw_omap *clk, unsigned int n)
87 /* DPLL divider must result in a valid jitter correction val */ 76 /* DPLL divider must result in a valid jitter correction val */
88 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n; 77 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
89 78
90 if (cpu_is_omap24xx()) { 79 if (dd->flags & DPLL_J_TYPE) {
91 /* Should not be called for OMAP2, so warn if it is called */
92 WARN(1, "No fint limits available for OMAP2!\n");
93 return DPLL_FINT_INVALID;
94 } else if (cpu_is_omap3430()) {
95 fint_min = OMAP3430_DPLL_FINT_BAND1_MIN;
96 fint_max = OMAP3430_DPLL_FINT_BAND2_MAX;
97 } else if (dd->flags & DPLL_J_TYPE) {
98 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN; 80 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN;
99 fint_max = OMAP3PLUS_DPLL_FINT_JTYPE_MAX; 81 fint_max = OMAP3PLUS_DPLL_FINT_JTYPE_MAX;
100 } else { 82 } else {
101 fint_min = OMAP3PLUS_DPLL_FINT_MIN; 83 fint_min = ti_clk_features.fint_min;
102 fint_max = OMAP3PLUS_DPLL_FINT_MAX; 84 fint_max = ti_clk_features.fint_max;
85 }
86
87 if (!fint_min || !fint_max) {
88 WARN(1, "No fint limits available!\n");
89 return DPLL_FINT_INVALID;
103 } 90 }
104 91
105 if (fint < fint_min) { 92 if (fint < ti_clk_features.fint_min) {
106 pr_debug("rejecting n=%d due to Fint failure, lowering max_divider\n", 93 pr_debug("rejecting n=%d due to Fint failure, lowering max_divider\n",
107 n); 94 n);
108 dd->max_divider = n; 95 dd->max_divider = n;
109 ret = DPLL_FINT_UNDERFLOW; 96 ret = DPLL_FINT_UNDERFLOW;
110 } else if (fint > fint_max) { 97 } else if (fint > ti_clk_features.fint_max) {
111 pr_debug("rejecting n=%d due to Fint failure, boosting min_divider\n", 98 pr_debug("rejecting n=%d due to Fint failure, boosting min_divider\n",
112 n); 99 n);
113 dd->min_divider = n; 100 dd->min_divider = n;
114 ret = DPLL_FINT_INVALID; 101 ret = DPLL_FINT_INVALID;
115 } else if (cpu_is_omap3430() && fint > OMAP3430_DPLL_FINT_BAND1_MAX && 102 } else if (fint > ti_clk_features.fint_band1_max &&
116 fint < OMAP3430_DPLL_FINT_BAND2_MIN) { 103 fint < ti_clk_features.fint_band2_min) {
117 pr_debug("rejecting n=%d due to Fint failure\n", n); 104 pr_debug("rejecting n=%d due to Fint failure\n", n);
118 ret = DPLL_FINT_INVALID; 105 ret = DPLL_FINT_INVALID;
119 } 106 }
@@ -185,6 +172,34 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
185 return r; 172 return r;
186} 173}
187 174
175/**
176 * _omap2_dpll_is_in_bypass - check if DPLL is in bypass mode or not
177 * @v: bitfield value of the DPLL enable
178 *
179 * Checks given DPLL enable bitfield to see whether the DPLL is in bypass
180 * mode or not. Returns 1 if the DPLL is in bypass, 0 otherwise.
181 */
182static int _omap2_dpll_is_in_bypass(u32 v)
183{
184 u8 mask, val;
185
186 mask = ti_clk_features.dpll_bypass_vals;
187
188 /*
189 * Each set bit in the mask corresponds to a bypass value equal
190 * to the bitshift. Go through each set-bit in the mask and
191 * compare against the given register value.
192 */
193 while (mask) {
194 val = __ffs(mask);
195 mask ^= (1 << val);
196 if (v == val)
197 return 1;
198 }
199
200 return 0;
201}
202
188/* Public functions */ 203/* Public functions */
189u8 omap2_init_dpll_parent(struct clk_hw *hw) 204u8 omap2_init_dpll_parent(struct clk_hw *hw)
190{ 205{
@@ -201,20 +216,9 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
201 v >>= __ffs(dd->enable_mask); 216 v >>= __ffs(dd->enable_mask);
202 217
203 /* Reparent the struct clk in case the dpll is in bypass */ 218 /* Reparent the struct clk in case the dpll is in bypass */
204 if (cpu_is_omap24xx()) { 219 if (_omap2_dpll_is_in_bypass(v))
205 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 220 return 1;
206 v == OMAP2XXX_EN_DPLL_FRBYPASS) 221
207 return 1;
208 } else if (cpu_is_omap34xx()) {
209 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
210 v == OMAP3XXX_EN_DPLL_FRBYPASS)
211 return 1;
212 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
213 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
214 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
215 v == OMAP4XXX_EN_DPLL_MNBYPASS)
216 return 1;
217 }
218 return 0; 222 return 0;
219} 223}
220 224
@@ -247,20 +251,8 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
247 v &= dd->enable_mask; 251 v &= dd->enable_mask;
248 v >>= __ffs(dd->enable_mask); 252 v >>= __ffs(dd->enable_mask);
249 253
250 if (cpu_is_omap24xx()) { 254 if (_omap2_dpll_is_in_bypass(v))
251 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 255 return __clk_get_rate(dd->clk_bypass);
252 v == OMAP2XXX_EN_DPLL_FRBYPASS)
253 return __clk_get_rate(dd->clk_bypass);
254 } else if (cpu_is_omap34xx()) {
255 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
256 v == OMAP3XXX_EN_DPLL_FRBYPASS)
257 return __clk_get_rate(dd->clk_bypass);
258 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
259 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
260 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
261 v == OMAP4XXX_EN_DPLL_MNBYPASS)
262 return __clk_get_rate(dd->clk_bypass);
263 }
264 256
265 v = omap2_clk_readl(clk, dd->mult_div1_reg); 257 v = omap2_clk_readl(clk, dd->mult_div1_reg);
266 dpll_mult = v & dd->mult_mask; 258 dpll_mult = v & dd->mult_mask;
@@ -293,10 +285,13 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
293{ 285{
294 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 286 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
295 int m, n, r, scaled_max_m; 287 int m, n, r, scaled_max_m;
288 int min_delta_m = INT_MAX, min_delta_n = INT_MAX;
296 unsigned long scaled_rt_rp; 289 unsigned long scaled_rt_rp;
297 unsigned long new_rate = 0; 290 unsigned long new_rate = 0;
298 struct dpll_data *dd; 291 struct dpll_data *dd;
299 unsigned long ref_rate; 292 unsigned long ref_rate;
293 long delta;
294 long prev_min_delta = LONG_MAX;
300 const char *clk_name; 295 const char *clk_name;
301 296
302 if (!clk || !clk->dpll_data) 297 if (!clk || !clk->dpll_data)
@@ -342,23 +337,34 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
342 if (r == DPLL_MULT_UNDERFLOW) 337 if (r == DPLL_MULT_UNDERFLOW)
343 continue; 338 continue;
344 339
340 /* skip rates above our target rate */
341 delta = target_rate - new_rate;
342 if (delta < 0)
343 continue;
344
345 if (delta < prev_min_delta) {
346 prev_min_delta = delta;
347 min_delta_m = m;
348 min_delta_n = n;
349 }
350
345 pr_debug("clock: %s: m = %d: n = %d: new_rate = %lu\n", 351 pr_debug("clock: %s: m = %d: n = %d: new_rate = %lu\n",
346 clk_name, m, n, new_rate); 352 clk_name, m, n, new_rate);
347 353
348 if (target_rate == new_rate) { 354 if (delta == 0)
349 dd->last_rounded_m = m;
350 dd->last_rounded_n = n;
351 dd->last_rounded_rate = target_rate;
352 break; 355 break;
353 }
354 } 356 }
355 357
356 if (target_rate != new_rate) { 358 if (prev_min_delta == LONG_MAX) {
357 pr_debug("clock: %s: cannot round to rate %lu\n", 359 pr_debug("clock: %s: cannot round to rate %lu\n",
358 clk_name, target_rate); 360 clk_name, target_rate);
359 return ~0; 361 return ~0;
360 } 362 }
361 363
362 return target_rate; 364 dd->last_rounded_m = min_delta_m;
365 dd->last_rounded_n = min_delta_n;
366 dd->last_rounded_rate = target_rate - prev_min_delta;
367
368 return dd->last_rounded_rate;
363} 369}
364 370
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 333f0a666171..55eb579aeae1 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -14,11 +14,11 @@
14#include <linux/clk-provider.h> 14#include <linux/clk-provider.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17
18#include "clock.h" 17#include "clock.h"
19#include "clock2xxx.h" 18
20#include "cm2xxx_3xxx.h" 19/* Register offsets */
21#include "cm-regbits-24xx.h" 20#define CM_AUTOIDLE 0x30
21#define CM_ICLKEN 0x10
22 22
23/* Private functions */ 23/* Private functions */
24 24
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 591581a66532..500530d1364a 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -47,6 +47,24 @@
47u16 cpu_mask; 47u16 cpu_mask;
48 48
49/* 49/*
50 * Clock features setup. Used instead of CPU type checks.
51 */
52struct ti_clk_features ti_clk_features;
53
54/* DPLL valid Fint frequency band limits - from 34xx TRM Section 4.7.6.2 */
55#define OMAP3430_DPLL_FINT_BAND1_MIN 750000
56#define OMAP3430_DPLL_FINT_BAND1_MAX 2100000
57#define OMAP3430_DPLL_FINT_BAND2_MIN 7500000
58#define OMAP3430_DPLL_FINT_BAND2_MAX 21000000
59
60/*
61 * DPLL valid Fint frequency range for OMAP36xx and OMAP4xxx.
62 * From device data manual section 4.3 "DPLL and DLL Specifications".
63 */
64#define OMAP3PLUS_DPLL_FINT_MIN 32000
65#define OMAP3PLUS_DPLL_FINT_MAX 52000000
66
67/*
50 * clkdm_control: if true, then when a clock is enabled in the 68 * clkdm_control: if true, then when a clock is enabled in the
51 * hardware, its clockdomain will first be enabled; and when a clock 69 * hardware, its clockdomain will first be enabled; and when a clock
52 * is disabled in the hardware, its clockdomain will be disabled 70 * is disabled in the hardware, its clockdomain will be disabled
@@ -82,27 +100,6 @@ u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg)
82} 100}
83 101
84/* 102/*
85 * Used for clocks that have the same value as the parent clock,
86 * divided by some factor
87 */
88unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
89 unsigned long parent_rate)
90{
91 struct clk_hw_omap *oclk;
92
93 if (!hw) {
94 pr_warn("%s: hw is NULL\n", __func__);
95 return -EINVAL;
96 }
97
98 oclk = to_clk_hw_omap(hw);
99
100 WARN_ON(!oclk->fixed_div);
101
102 return parent_rate / oclk->fixed_div;
103}
104
105/*
106 * OMAP2+ specific clock functions 103 * OMAP2+ specific clock functions
107 */ 104 */
108 105
@@ -287,13 +284,7 @@ void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
287 * 34xx reverses this, just to keep us on our toes 284 * 34xx reverses this, just to keep us on our toes
288 * AM35xx uses both, depending on the module. 285 * AM35xx uses both, depending on the module.
289 */ 286 */
290 if (cpu_is_omap24xx()) 287 *idlest_val = ti_clk_features.cm_idlest_val;
291 *idlest_val = OMAP24XX_CM_IDLEST_VAL;
292 else if (cpu_is_omap34xx())
293 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
294 else
295 BUG();
296
297} 288}
298 289
299/** 290/**
@@ -731,3 +722,53 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
731 (clk_get_rate(core_ck) / 1000000), 722 (clk_get_rate(core_ck) / 1000000),
732 (clk_get_rate(mpu_ck) / 1000000)); 723 (clk_get_rate(mpu_ck) / 1000000));
733} 724}
725
726/**
727 * ti_clk_init_features - init clock features struct for the SoC
728 *
729 * Initializes the clock features struct based on the SoC type.
730 */
731void __init ti_clk_init_features(void)
732{
733 /* Fint setup for DPLLs */
734 if (cpu_is_omap3430()) {
735 ti_clk_features.fint_min = OMAP3430_DPLL_FINT_BAND1_MIN;
736 ti_clk_features.fint_max = OMAP3430_DPLL_FINT_BAND2_MAX;
737 ti_clk_features.fint_band1_max = OMAP3430_DPLL_FINT_BAND1_MAX;
738 ti_clk_features.fint_band2_min = OMAP3430_DPLL_FINT_BAND2_MIN;
739 } else {
740 ti_clk_features.fint_min = OMAP3PLUS_DPLL_FINT_MIN;
741 ti_clk_features.fint_max = OMAP3PLUS_DPLL_FINT_MAX;
742 }
743
744 /* Bypass value setup for DPLLs */
745 if (cpu_is_omap24xx()) {
746 ti_clk_features.dpll_bypass_vals |=
747 (1 << OMAP2XXX_EN_DPLL_LPBYPASS) |
748 (1 << OMAP2XXX_EN_DPLL_FRBYPASS);
749 } else if (cpu_is_omap34xx()) {
750 ti_clk_features.dpll_bypass_vals |=
751 (1 << OMAP3XXX_EN_DPLL_LPBYPASS) |
752 (1 << OMAP3XXX_EN_DPLL_FRBYPASS);
753 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx() ||
754 soc_is_omap54xx() || soc_is_dra7xx()) {
755 ti_clk_features.dpll_bypass_vals |=
756 (1 << OMAP4XXX_EN_DPLL_LPBYPASS) |
757 (1 << OMAP4XXX_EN_DPLL_FRBYPASS) |
758 (1 << OMAP4XXX_EN_DPLL_MNBYPASS);
759 }
760
761 /* Jitter correction only available on OMAP343X */
762 if (cpu_is_omap343x())
763 ti_clk_features.flags |= TI_CLK_DPLL_HAS_FREQSEL;
764
765 /* Idlest value for interface clocks.
766 * 24xx uses 0 to indicate not ready, and 1 to indicate ready.
767 * 34xx reverses this, just to keep us on our toes
768 * AM35xx uses both, depending on the module.
769 */
770 if (cpu_is_omap24xx())
771 ti_clk_features.cm_idlest_val = OMAP24XX_CM_IDLEST_VAL;
772 else if (cpu_is_omap34xx())
773 ti_clk_features.cm_idlest_val = OMAP34XX_CM_IDLEST_VAL;
774}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 12f54d428d7c..4592a2762592 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -101,31 +101,6 @@ struct clockdomain;
101 }; \ 101 }; \
102 DEFINE_STRUCT_CLK(_name, _parent_names, _ops); 102 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
103 103
104#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
105 _parent_ptr, _flags, \
106 _clksel_reg, _clksel_mask) \
107 static const struct clksel _name##_div[] = { \
108 { \
109 .parent = _parent_ptr, \
110 .rates = div31_1to31_rates \
111 }, \
112 { .parent = NULL }, \
113 }; \
114 static struct clk _name; \
115 static const char *_name##_parent_names[] = { \
116 _parent_name, \
117 }; \
118 static struct clk_hw_omap _name##_hw = { \
119 .hw = { \
120 .clk = &_name, \
121 }, \
122 .clksel = _name##_div, \
123 .clksel_reg = _clksel_reg, \
124 .clksel_mask = _clksel_mask, \
125 .ops = &clkhwops_omap4_dpllmx, \
126 }; \
127 DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
128
129/* struct clksel_rate.flags possibilities */ 104/* struct clksel_rate.flags possibilities */
130#define RATE_IN_242X (1 << 0) 105#define RATE_IN_242X (1 << 0)
131#define RATE_IN_243X (1 << 1) 106#define RATE_IN_243X (1 << 1)
@@ -178,9 +153,6 @@ struct clksel {
178 const struct clksel_rate *rates; 153 const struct clksel_rate *rates;
179}; 154};
180 155
181unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
182 unsigned long parent_rate);
183
184/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 156/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
185#define CORE_CLK_SRC_32K 0x0 157#define CORE_CLK_SRC_32K 0x0
186#define CORE_CLK_SRC_DPLL 0x1 158#define CORE_CLK_SRC_DPLL 0x1
@@ -248,6 +220,23 @@ void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg);
248 220
249extern u16 cpu_mask; 221extern u16 cpu_mask;
250 222
223/*
224 * Clock features setup. Used instead of CPU type checks.
225 */
226struct ti_clk_features {
227 u32 flags;
228 long fint_min;
229 long fint_max;
230 long fint_band1_max;
231 long fint_band2_min;
232 u8 dpll_bypass_vals;
233 u8 cm_idlest_val;
234};
235
236#define TI_CLK_DPLL_HAS_FREQSEL (1 << 0)
237
238extern struct ti_clk_features ti_clk_features;
239
251extern const struct clkops clkops_omap2_dflt_wait; 240extern const struct clkops clkops_omap2_dflt_wait;
252extern const struct clkops clkops_dummy; 241extern const struct clkops clkops_dummy;
253extern const struct clkops clkops_omap2_dflt; 242extern const struct clkops clkops_omap2_dflt;
@@ -286,4 +275,6 @@ extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
286extern void omap2_clkops_disable_clkdm(struct clk_hw *hw); 275extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
287 276
288extern void omap_clocks_register(struct omap_clk *oclks, int cnt); 277extern void omap_clocks_register(struct omap_clk *oclks, int cnt);
278
279void __init ti_clk_init_features(void);
289#endif 280#endif
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
index 45f41a411603..a090225ceeba 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -45,8 +45,6 @@ int omap2430_clk_init(void);
45#define omap2430_clk_init() do { } while(0) 45#define omap2430_clk_init() do { } while(0)
46#endif 46#endif
47 47
48extern void __iomem *prcm_clksrc_ctrl;
49
50extern struct clk_hw *dclk_hw; 48extern struct clk_hw *dclk_hw;
51int omap2_enable_osc_ck(struct clk_hw *hw); 49int omap2_enable_osc_ck(struct clk_hw *hw);
52void omap2_disable_osc_ck(struct clk_hw *hw); 50void omap2_disable_osc_ck(struct clk_hw *hw);
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index 8538669cc2ad..d7a5d11cbcbf 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -107,6 +107,7 @@
107#define OMAP24XX_AUTO_DPLL_SHIFT 0 107#define OMAP24XX_AUTO_DPLL_SHIFT 0
108#define OMAP24XX_AUTO_DPLL_MASK (0x3 << 0) 108#define OMAP24XX_AUTO_DPLL_MASK (0x3 << 0)
109#define OMAP24XX_APLLS_CLKIN_SHIFT 23 109#define OMAP24XX_APLLS_CLKIN_SHIFT 23
110#define OMAP24XX_APLLS_CLKIN_WIDTH 3
110#define OMAP24XX_APLLS_CLKIN_MASK (0x7 << 23) 111#define OMAP24XX_APLLS_CLKIN_MASK (0x7 << 23)
111#define OMAP24XX_DPLL_MULT_MASK (0x3ff << 12) 112#define OMAP24XX_DPLL_MULT_MASK (0x3ff << 12)
112#define OMAP24XX_DPLL_DIV_MASK (0xf << 8) 113#define OMAP24XX_DPLL_DIV_MASK (0xf << 8)
diff --git a/arch/arm/mach-omap2/cm2_7xx.h b/arch/arm/mach-omap2/cm2_7xx.h
index 9ad7594e7622..e966e3a3c931 100644
--- a/arch/arm/mach-omap2/cm2_7xx.h
+++ b/arch/arm/mach-omap2/cm2_7xx.h
@@ -357,6 +357,10 @@
357#define DRA7XX_CM_L3INIT_SATA_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x0088) 357#define DRA7XX_CM_L3INIT_SATA_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x0088)
358#define DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET 0x00a0 358#define DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET 0x00a0
359#define DRA7XX_CM_PCIE_STATICDEP_OFFSET 0x00a4 359#define DRA7XX_CM_PCIE_STATICDEP_OFFSET 0x00a4
360#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET 0x00b0
361#define DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b0)
362#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET 0x00b8
363#define DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL DRA7XX_CM_CORE_REGADDR(DRA7XX_CM_CORE_L3INIT_INST, 0x00b8)
360#define DRA7XX_CM_GMAC_CLKSTCTRL_OFFSET 0x00c0 364#define DRA7XX_CM_GMAC_CLKSTCTRL_OFFSET 0x00c0
361#define DRA7XX_CM_GMAC_STATICDEP_OFFSET 0x00c4 365#define DRA7XX_CM_GMAC_STATICDEP_OFFSET 0x00c4
362#define DRA7XX_CM_GMAC_DYNAMICDEP_OFFSET 0x00c8 366#define DRA7XX_CM_GMAC_DYNAMICDEP_OFFSET 0x00c8
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 2dabb9ecb986..484cdadfb187 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_data/dsp-omap.h>
18 17
19#include "common.h" 18#include "common.h"
20#include "omap-secure.h" 19#include "omap-secure.h"
@@ -30,7 +29,6 @@ int __weak omap_secure_ram_reserve_memblock(void)
30 29
31void __init omap_reserve(void) 30void __init omap_reserve(void)
32{ 31{
33 omap_dsp_reserve_sdram_memblock();
34 omap_secure_ram_reserve_memblock(); 32 omap_secure_ram_reserve_memblock();
35 omap_barrier_reserve_memblock(); 33 omap_barrier_reserve_memblock();
36} 34}
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 751f3549bf6f..da041b4ab29c 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -44,8 +44,7 @@ struct omap3_scratchpad {
44}; 44};
45 45
46struct omap3_scratchpad_prcm_block { 46struct omap3_scratchpad_prcm_block {
47 u32 prm_clksrc_ctrl; 47 u32 prm_contents[2];
48 u32 prm_clksel;
49 u32 cm_contents[11]; 48 u32 cm_contents[11];
50 u32 prcm_block_size; 49 u32 prcm_block_size;
51}; 50};
@@ -281,14 +280,11 @@ void omap3_clear_scratchpad_contents(void)
281 u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET; 280 u32 max_offset = OMAP343X_SCRATCHPAD_ROM_OFFSET;
282 void __iomem *v_addr; 281 void __iomem *v_addr;
283 u32 offset = 0; 282 u32 offset = 0;
283
284 v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM); 284 v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM);
285 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & 285 if (omap3xxx_prm_clear_global_cold_reset()) {
286 OMAP3430_GLOBAL_COLD_RST_MASK) {
287 for ( ; offset <= max_offset; offset += 0x4) 286 for ( ; offset <= max_offset; offset += 0x4)
288 writel_relaxed(0x0, (v_addr + offset)); 287 writel_relaxed(0x0, (v_addr + offset));
289 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
290 OMAP3430_GR_MOD,
291 OMAP3_PRM_RSTST_OFFSET);
292 } 288 }
293} 289}
294 290
@@ -314,7 +310,8 @@ void omap3_save_scratchpad_contents(void)
314 scratchpad_contents.public_restore_ptr = 310 scratchpad_contents.public_restore_ptr =
315 virt_to_phys(omap3_restore_3630); 311 virt_to_phys(omap3_restore_3630);
316 else if (omap_rev() != OMAP3430_REV_ES3_0 && 312 else if (omap_rev() != OMAP3430_REV_ES3_0 &&
317 omap_rev() != OMAP3430_REV_ES3_1) 313 omap_rev() != OMAP3430_REV_ES3_1 &&
314 omap_rev() != OMAP3430_REV_ES3_1_2)
318 scratchpad_contents.public_restore_ptr = 315 scratchpad_contents.public_restore_ptr =
319 virt_to_phys(omap3_restore); 316 virt_to_phys(omap3_restore);
320 else 317 else
@@ -331,13 +328,7 @@ void omap3_save_scratchpad_contents(void)
331 scratchpad_contents.sdrc_block_offset = 0x64; 328 scratchpad_contents.sdrc_block_offset = 0x64;
332 329
333 /* Populate the PRCM block contents */ 330 /* Populate the PRCM block contents */
334 prcm_block_contents.prm_clksrc_ctrl = 331 omap3_prm_save_scratchpad_contents(prcm_block_contents.prm_contents);
335 omap2_prm_read_mod_reg(OMAP3430_GR_MOD,
336 OMAP3_PRM_CLKSRC_CTRL_OFFSET);
337 prcm_block_contents.prm_clksel =
338 omap2_prm_read_mod_reg(OMAP3430_CCR_MOD,
339 OMAP3_PRM_CLKSEL_OFFSET);
340
341 omap3_cm_save_scratchpad_contents(prcm_block_contents.cm_contents); 332 omap3_cm_save_scratchpad_contents(prcm_block_contents.cm_contents);
342 333
343 prcm_block_contents.prcm_block_size = 0x0; 334 prcm_block_contents.prcm_block_size = 0x0;
@@ -474,7 +465,6 @@ void omap3_control_save_context(void)
474 control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI); 465 control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
475 control_context.padconf_sys_nirq = 466 control_context.padconf_sys_nirq =
476 omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_SYSNIRQ); 467 omap_ctrl_readl(OMAP343X_CONTROL_PADCONF_SYSNIRQ);
477 return;
478} 468}
479 469
480void omap3_control_restore_context(void) 470void omap3_control_restore_context(void)
@@ -532,7 +522,6 @@ void omap3_control_restore_context(void)
532 omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI); 522 omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI);
533 omap_ctrl_writel(control_context.padconf_sys_nirq, 523 omap_ctrl_writel(control_context.padconf_sys_nirq,
534 OMAP343X_CONTROL_PADCONF_SYSNIRQ); 524 OMAP343X_CONTROL_PADCONF_SYSNIRQ);
535 return;
536} 525}
537 526
538void omap3630_ctrl_disable_rta(void) 527void omap3630_ctrl_disable_rta(void)
@@ -575,9 +564,50 @@ int omap3_ctrl_save_padconf(void)
575 * Sets the bootmode for IVA2 to idle. This is needed by the PM code to 564 * Sets the bootmode for IVA2 to idle. This is needed by the PM code to
576 * force disable IVA2 so that it does not prevent any low-power states. 565 * force disable IVA2 so that it does not prevent any low-power states.
577 */ 566 */
578void omap3_ctrl_set_iva_bootmode_idle(void) 567static void __init omap3_ctrl_set_iva_bootmode_idle(void)
579{ 568{
580 omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE, 569 omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE,
581 OMAP343X_CONTROL_IVA2_BOOTMOD); 570 OMAP343X_CONTROL_IVA2_BOOTMOD);
582} 571}
572
573/**
574 * omap3_ctrl_setup_d2d_padconf - setup stacked modem pads for idle
575 *
576 * Sets up the pads controlling the stacked modem in such way that the
577 * device can enter idle.
578 */
579static void __init omap3_ctrl_setup_d2d_padconf(void)
580{
581 u16 mask, padconf;
582
583 /*
584 * In a stand alone OMAP3430 where there is not a stacked
585 * modem for the D2D Idle Ack and D2D MStandby must be pulled
586 * high. S CONTROL_PADCONF_SAD2D_IDLEACK and
587 * CONTROL_PADCONF_SAD2D_MSTDBY to have a pull up.
588 */
589 mask = (1 << 4) | (1 << 3); /* pull-up, enabled */
590 padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_MSTANDBY);
591 padconf |= mask;
592 omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_MSTANDBY);
593
594 padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_IDLEACK);
595 padconf |= mask;
596 omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_IDLEACK);
597}
598
599/**
600 * omap3_ctrl_init - does static initializations for control module
601 *
602 * Initializes system control module. This sets up the sysconfig autoidle,
603 * and sets up modem and iva2 so that they can be idled properly.
604 */
605void __init omap3_ctrl_init(void)
606{
607 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG);
608
609 omap3_ctrl_set_iva_bootmode_idle();
610
611 omap3_ctrl_setup_d2d_padconf();
612}
583#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 613#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index da054801b114..a3c013345c45 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -16,11 +16,6 @@
16#ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H 16#ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H
17#define __ARCH_ARM_MACH_OMAP2_CONTROL_H 17#define __ARCH_ARM_MACH_OMAP2_CONTROL_H
18 18
19#include "ctrl_module_core_44xx.h"
20#include "ctrl_module_wkup_44xx.h"
21#include "ctrl_module_pad_core_44xx.h"
22#include "ctrl_module_pad_wkup_44xx.h"
23
24#include "am33xx.h" 19#include "am33xx.h"
25 20
26#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
@@ -254,6 +249,39 @@
254/* TI81XX CONTROL_DEVCONF register offsets */ 249/* TI81XX CONTROL_DEVCONF register offsets */
255#define TI81XX_CONTROL_DEVICE_ID (TI81XX_CONTROL_DEVCONF + 0x000) 250#define TI81XX_CONTROL_DEVICE_ID (TI81XX_CONTROL_DEVCONF + 0x000)
256 251
252/* OMAP4 CONTROL MODULE */
253#define OMAP4_CTRL_MODULE_PAD_WKUP 0x4a31e000
254#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2 0x0604
255#define OMAP4_CTRL_MODULE_CORE_STATUS 0x02c4
256#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_1 0x0218
257#define OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR 0x0304
258#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY 0x0618
259#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX 0x0608
260
261/* OMAP4 CONTROL_DSIPHY */
262#define OMAP4_DSI2_LANEENABLE_SHIFT 29
263#define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29)
264#define OMAP4_DSI1_LANEENABLE_SHIFT 24
265#define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24)
266#define OMAP4_DSI1_PIPD_SHIFT 19
267#define OMAP4_DSI1_PIPD_MASK (0x1f << 19)
268#define OMAP4_DSI2_PIPD_SHIFT 14
269#define OMAP4_DSI2_PIPD_MASK (0x1f << 14)
270
271/* OMAP4 CONTROL_CAMERA_RX */
272#define OMAP4_CAMERARX_CSI21_LANEENABLE_SHIFT 24
273#define OMAP4_CAMERARX_CSI21_LANEENABLE_MASK (0x1f << 24)
274#define OMAP4_CAMERARX_CSI22_LANEENABLE_SHIFT 29
275#define OMAP4_CAMERARX_CSI22_LANEENABLE_MASK (0x3 << 29)
276#define OMAP4_CAMERARX_CSI22_CTRLCLKEN_SHIFT 21
277#define OMAP4_CAMERARX_CSI22_CTRLCLKEN_MASK (1 << 21)
278#define OMAP4_CAMERARX_CSI22_CAMMODE_SHIFT 19
279#define OMAP4_CAMERARX_CSI22_CAMMODE_MASK (0x3 << 19)
280#define OMAP4_CAMERARX_CSI21_CTRLCLKEN_SHIFT 18
281#define OMAP4_CAMERARX_CSI21_CTRLCLKEN_MASK (1 << 18)
282#define OMAP4_CAMERARX_CSI21_CAMMODE_SHIFT 16
283#define OMAP4_CAMERARX_CSI21_CAMMODE_MASK (0x3 << 16)
284
257/* OMAP54XX CONTROL STATUS register */ 285/* OMAP54XX CONTROL STATUS register */
258#define OMAP5XXX_CONTROL_STATUS 0x134 286#define OMAP5XXX_CONTROL_STATUS 0x134
259#define OMAP5_DEVICETYPE_MASK (0x7 << 6) 287#define OMAP5_DEVICETYPE_MASK (0x7 << 6)
@@ -427,7 +455,7 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
427extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 455extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
428extern void omap3630_ctrl_disable_rta(void); 456extern void omap3630_ctrl_disable_rta(void);
429extern int omap3_ctrl_save_padconf(void); 457extern int omap3_ctrl_save_padconf(void);
430extern void omap3_ctrl_set_iva_bootmode_idle(void); 458void omap3_ctrl_init(void);
431extern void omap2_set_globals_control(void __iomem *ctrl, 459extern void omap2_set_globals_control(void __iomem *ctrl,
432 void __iomem *ctrl_pad); 460 void __iomem *ctrl_pad);
433#else 461#else
diff --git a/arch/arm/mach-omap2/ctrl_module_core_44xx.h b/arch/arm/mach-omap2/ctrl_module_core_44xx.h
deleted file mode 100644
index 01970824e0e5..000000000000
--- a/arch/arm/mach-omap2/ctrl_module_core_44xx.h
+++ /dev/null
@@ -1,392 +0,0 @@
1/*
2 * OMAP44xx CTRL_MODULE_CORE registers and bitfields
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 *
9 * This file is automatically generated from the OMAP hardware databases.
10 * We respectfully ask that any modifications to this file be coordinated
11 * with the public linux-omap@vger.kernel.org mailing list and the
12 * authors above to ensure that the autogeneration scripts are kept
13 * up-to-date with the file contents.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_CORE_44XX_H
21#define __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_CORE_44XX_H
22
23
24/* Base address */
25#define OMAP4_CTRL_MODULE_CORE 0x4a002000
26
27/* Registers offset */
28#define OMAP4_CTRL_MODULE_CORE_IP_REVISION 0x0000
29#define OMAP4_CTRL_MODULE_CORE_IP_HWINFO 0x0004
30#define OMAP4_CTRL_MODULE_CORE_IP_SYSCONFIG 0x0010
31#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_DIE_ID_0 0x0200
32#define OMAP4_CTRL_MODULE_CORE_ID_CODE 0x0204
33#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_DIE_ID_1 0x0208
34#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_DIE_ID_2 0x020c
35#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_DIE_ID_3 0x0210
36#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_0 0x0214
37#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_PROD_ID_1 0x0218
38#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_USB_CONF 0x021c
39#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_VDD_WKUP 0x0228
40#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_BGAP 0x0260
41#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_0 0x0264
42#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_1 0x0268
43#define OMAP4_CTRL_MODULE_CORE_STATUS 0x02c4
44#define OMAP4_CTRL_MODULE_CORE_DEV_CONF 0x0300
45#define OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR 0x0304
46#define OMAP4_CTRL_MODULE_CORE_LDOVBB_IVA_VOLTAGE_CTRL 0x0314
47#define OMAP4_CTRL_MODULE_CORE_LDOVBB_MPU_VOLTAGE_CTRL 0x0318
48#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_IVA_VOLTAGE_CTRL 0x0320
49#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_MPU_VOLTAGE_CTRL 0x0324
50#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_CORE_VOLTAGE_CTRL 0x0328
51#define OMAP4_CTRL_MODULE_CORE_TEMP_SENSOR 0x032c
52#define OMAP4_CTRL_MODULE_CORE_DPLL_NWELL_TRIM_0 0x0330
53#define OMAP4_CTRL_MODULE_CORE_DPLL_NWELL_TRIM_1 0x0334
54#define OMAP4_CTRL_MODULE_CORE_USBOTGHS_CONTROL 0x033c
55#define OMAP4_CTRL_MODULE_CORE_DSS_CONTROL 0x0340
56#define OMAP4_CTRL_MODULE_CORE_HWOBS_CONTROL 0x0350
57#define OMAP4_CTRL_MODULE_CORE_DEBOBS_FINAL_MUX_SEL 0x0400
58#define OMAP4_CTRL_MODULE_CORE_DEBOBS_MMR_MPU 0x0408
59#define OMAP4_CTRL_MODULE_CORE_CONF_SDMA_REQ_SEL0 0x042c
60#define OMAP4_CTRL_MODULE_CORE_CONF_SDMA_REQ_SEL1 0x0430
61#define OMAP4_CTRL_MODULE_CORE_CONF_SDMA_REQ_SEL2 0x0434
62#define OMAP4_CTRL_MODULE_CORE_CONF_SDMA_REQ_SEL3 0x0438
63#define OMAP4_CTRL_MODULE_CORE_CONF_CLK_SEL0 0x0440
64#define OMAP4_CTRL_MODULE_CORE_CONF_CLK_SEL1 0x0444
65#define OMAP4_CTRL_MODULE_CORE_CONF_CLK_SEL2 0x0448
66#define OMAP4_CTRL_MODULE_CORE_CONF_DPLL_FREQLOCK_SEL 0x044c
67#define OMAP4_CTRL_MODULE_CORE_CONF_DPLL_TINITZ_SEL 0x0450
68#define OMAP4_CTRL_MODULE_CORE_CONF_DPLL_PHASELOCK_SEL 0x0454
69#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_0 0x0480
70#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_1 0x0484
71#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_2 0x0488
72#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_3 0x048c
73#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_4 0x0490
74#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_5 0x0494
75#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_6 0x0498
76#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_7 0x049c
77#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_8 0x04a0
78#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_9 0x04a4
79#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_10 0x04a8
80#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_11 0x04ac
81#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_12 0x04b0
82#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_13 0x04b4
83#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_14 0x04b8
84#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_15 0x04bc
85#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_16 0x04c0
86#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_17 0x04c4
87#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_18 0x04c8
88#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_19 0x04cc
89#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_20 0x04d0
90#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_21 0x04d4
91#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_22 0x04d8
92#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_23 0x04dc
93#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_24 0x04e0
94#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_25 0x04e4
95#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_26 0x04e8
96#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_27 0x04ec
97#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_28 0x04f0
98#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_29 0x04f4
99#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_30 0x04f8
100#define OMAP4_CTRL_MODULE_CORE_CONF_DEBUG_SEL_TST_31 0x04fc
101
102/* Registers shifts and masks */
103
104/* IP_REVISION */
105#define OMAP4_IP_REV_SCHEME_SHIFT 30
106#define OMAP4_IP_REV_SCHEME_MASK (0x3 << 30)
107#define OMAP4_IP_REV_FUNC_SHIFT 16
108#define OMAP4_IP_REV_FUNC_MASK (0xfff << 16)
109#define OMAP4_IP_REV_RTL_SHIFT 11
110#define OMAP4_IP_REV_RTL_MASK (0x1f << 11)
111#define OMAP4_IP_REV_MAJOR_SHIFT 8
112#define OMAP4_IP_REV_MAJOR_MASK (0x7 << 8)
113#define OMAP4_IP_REV_CUSTOM_SHIFT 6
114#define OMAP4_IP_REV_CUSTOM_MASK (0x3 << 6)
115#define OMAP4_IP_REV_MINOR_SHIFT 0
116#define OMAP4_IP_REV_MINOR_MASK (0x3f << 0)
117
118/* IP_HWINFO */
119#define OMAP4_IP_HWINFO_SHIFT 0
120#define OMAP4_IP_HWINFO_MASK (0xffffffff << 0)
121
122/* IP_SYSCONFIG */
123#define OMAP4_IP_SYSCONFIG_IDLEMODE_SHIFT 2
124#define OMAP4_IP_SYSCONFIG_IDLEMODE_MASK (0x3 << 2)
125
126/* STD_FUSE_DIE_ID_0 */
127#define OMAP4_STD_FUSE_DIE_ID_0_SHIFT 0
128#define OMAP4_STD_FUSE_DIE_ID_0_MASK (0xffffffff << 0)
129
130/* ID_CODE */
131#define OMAP4_STD_FUSE_IDCODE_SHIFT 0
132#define OMAP4_STD_FUSE_IDCODE_MASK (0xffffffff << 0)
133
134/* STD_FUSE_DIE_ID_1 */
135#define OMAP4_STD_FUSE_DIE_ID_1_SHIFT 0
136#define OMAP4_STD_FUSE_DIE_ID_1_MASK (0xffffffff << 0)
137
138/* STD_FUSE_DIE_ID_2 */
139#define OMAP4_STD_FUSE_DIE_ID_2_SHIFT 0
140#define OMAP4_STD_FUSE_DIE_ID_2_MASK (0xffffffff << 0)
141
142/* STD_FUSE_DIE_ID_3 */
143#define OMAP4_STD_FUSE_DIE_ID_3_SHIFT 0
144#define OMAP4_STD_FUSE_DIE_ID_3_MASK (0xffffffff << 0)
145
146/* STD_FUSE_PROD_ID_0 */
147#define OMAP4_STD_FUSE_PROD_ID_0_SHIFT 0
148#define OMAP4_STD_FUSE_PROD_ID_0_MASK (0xffffffff << 0)
149
150/* STD_FUSE_PROD_ID_1 */
151#define OMAP4_STD_FUSE_PROD_ID_1_SHIFT 0
152#define OMAP4_STD_FUSE_PROD_ID_1_MASK (0xffffffff << 0)
153
154/* STD_FUSE_USB_CONF */
155#define OMAP4_USB_PROD_ID_SHIFT 16
156#define OMAP4_USB_PROD_ID_MASK (0xffff << 16)
157#define OMAP4_USB_VENDOR_ID_SHIFT 0
158#define OMAP4_USB_VENDOR_ID_MASK (0xffff << 0)
159
160/* STD_FUSE_OPP_VDD_WKUP */
161#define OMAP4_STD_FUSE_OPP_VDD_WKUP_SHIFT 0
162#define OMAP4_STD_FUSE_OPP_VDD_WKUP_MASK (0xffffffff << 0)
163
164/* STD_FUSE_OPP_BGAP */
165#define OMAP4_STD_FUSE_OPP_BGAP_SHIFT 0
166#define OMAP4_STD_FUSE_OPP_BGAP_MASK (0xffffffff << 0)
167
168/* STD_FUSE_OPP_DPLL_0 */
169#define OMAP4_STD_FUSE_OPP_DPLL_0_SHIFT 0
170#define OMAP4_STD_FUSE_OPP_DPLL_0_MASK (0xffffffff << 0)
171
172/* STD_FUSE_OPP_DPLL_1 */
173#define OMAP4_STD_FUSE_OPP_DPLL_1_SHIFT 0
174#define OMAP4_STD_FUSE_OPP_DPLL_1_MASK (0xffffffff << 0)
175
176/* STATUS */
177#define OMAP4_ATTILA_CONF_SHIFT 11
178#define OMAP4_ATTILA_CONF_MASK (0x3 << 11)
179#define OMAP4_DEVICE_TYPE_SHIFT 8
180#define OMAP4_DEVICE_TYPE_MASK (0x7 << 8)
181#define OMAP4_SYS_BOOT_SHIFT 0
182#define OMAP4_SYS_BOOT_MASK (0xff << 0)
183
184/* DEV_CONF */
185#define OMAP4_DEV_CONF_SHIFT 1
186#define OMAP4_DEV_CONF_MASK (0x7fffffff << 1)
187#define OMAP4_USBPHY_PD_SHIFT 0
188#define OMAP4_USBPHY_PD_MASK (1 << 0)
189
190/* LDOVBB_IVA_VOLTAGE_CTRL */
191#define OMAP4_LDOVBBIVA_RBB_MUX_CTRL_SHIFT 26
192#define OMAP4_LDOVBBIVA_RBB_MUX_CTRL_MASK (1 << 26)
193#define OMAP4_LDOVBBIVA_RBB_VSET_IN_SHIFT 21
194#define OMAP4_LDOVBBIVA_RBB_VSET_IN_MASK (0x1f << 21)
195#define OMAP4_LDOVBBIVA_RBB_VSET_OUT_SHIFT 16
196#define OMAP4_LDOVBBIVA_RBB_VSET_OUT_MASK (0x1f << 16)
197#define OMAP4_LDOVBBIVA_FBB_MUX_CTRL_SHIFT 10
198#define OMAP4_LDOVBBIVA_FBB_MUX_CTRL_MASK (1 << 10)
199#define OMAP4_LDOVBBIVA_FBB_VSET_IN_SHIFT 5
200#define OMAP4_LDOVBBIVA_FBB_VSET_IN_MASK (0x1f << 5)
201#define OMAP4_LDOVBBIVA_FBB_VSET_OUT_SHIFT 0
202#define OMAP4_LDOVBBIVA_FBB_VSET_OUT_MASK (0x1f << 0)
203
204/* LDOVBB_MPU_VOLTAGE_CTRL */
205#define OMAP4_LDOVBBMPU_RBB_MUX_CTRL_SHIFT 26
206#define OMAP4_LDOVBBMPU_RBB_MUX_CTRL_MASK (1 << 26)
207#define OMAP4_LDOVBBMPU_RBB_VSET_IN_SHIFT 21
208#define OMAP4_LDOVBBMPU_RBB_VSET_IN_MASK (0x1f << 21)
209#define OMAP4_LDOVBBMPU_RBB_VSET_OUT_SHIFT 16
210#define OMAP4_LDOVBBMPU_RBB_VSET_OUT_MASK (0x1f << 16)
211#define OMAP4_LDOVBBMPU_FBB_MUX_CTRL_SHIFT 10
212#define OMAP4_LDOVBBMPU_FBB_MUX_CTRL_MASK (1 << 10)
213#define OMAP4_LDOVBBMPU_FBB_VSET_IN_SHIFT 5
214#define OMAP4_LDOVBBMPU_FBB_VSET_IN_MASK (0x1f << 5)
215#define OMAP4_LDOVBBMPU_FBB_VSET_OUT_SHIFT 0
216#define OMAP4_LDOVBBMPU_FBB_VSET_OUT_MASK (0x1f << 0)
217
218/* LDOSRAM_IVA_VOLTAGE_CTRL */
219#define OMAP4_LDOSRAMIVA_RETMODE_MUX_CTRL_SHIFT 26
220#define OMAP4_LDOSRAMIVA_RETMODE_MUX_CTRL_MASK (1 << 26)
221#define OMAP4_LDOSRAMIVA_RETMODE_VSET_IN_SHIFT 21
222#define OMAP4_LDOSRAMIVA_RETMODE_VSET_IN_MASK (0x1f << 21)
223#define OMAP4_LDOSRAMIVA_RETMODE_VSET_OUT_SHIFT 16
224#define OMAP4_LDOSRAMIVA_RETMODE_VSET_OUT_MASK (0x1f << 16)
225#define OMAP4_LDOSRAMIVA_ACTMODE_MUX_CTRL_SHIFT 10
226#define OMAP4_LDOSRAMIVA_ACTMODE_MUX_CTRL_MASK (1 << 10)
227#define OMAP4_LDOSRAMIVA_ACTMODE_VSET_IN_SHIFT 5
228#define OMAP4_LDOSRAMIVA_ACTMODE_VSET_IN_MASK (0x1f << 5)
229#define OMAP4_LDOSRAMIVA_ACTMODE_VSET_OUT_SHIFT 0
230#define OMAP4_LDOSRAMIVA_ACTMODE_VSET_OUT_MASK (0x1f << 0)
231
232/* LDOSRAM_MPU_VOLTAGE_CTRL */
233#define OMAP4_LDOSRAMMPU_RETMODE_MUX_CTRL_SHIFT 26
234#define OMAP4_LDOSRAMMPU_RETMODE_MUX_CTRL_MASK (1 << 26)
235#define OMAP4_LDOSRAMMPU_RETMODE_VSET_IN_SHIFT 21
236#define OMAP4_LDOSRAMMPU_RETMODE_VSET_IN_MASK (0x1f << 21)
237#define OMAP4_LDOSRAMMPU_RETMODE_VSET_OUT_SHIFT 16
238#define OMAP4_LDOSRAMMPU_RETMODE_VSET_OUT_MASK (0x1f << 16)
239#define OMAP4_LDOSRAMMPU_ACTMODE_MUX_CTRL_SHIFT 10
240#define OMAP4_LDOSRAMMPU_ACTMODE_MUX_CTRL_MASK (1 << 10)
241#define OMAP4_LDOSRAMMPU_ACTMODE_VSET_IN_SHIFT 5
242#define OMAP4_LDOSRAMMPU_ACTMODE_VSET_IN_MASK (0x1f << 5)
243#define OMAP4_LDOSRAMMPU_ACTMODE_VSET_OUT_SHIFT 0
244#define OMAP4_LDOSRAMMPU_ACTMODE_VSET_OUT_MASK (0x1f << 0)
245
246/* LDOSRAM_CORE_VOLTAGE_CTRL */
247#define OMAP4_LDOSRAMCORE_RETMODE_MUX_CTRL_SHIFT 26
248#define OMAP4_LDOSRAMCORE_RETMODE_MUX_CTRL_MASK (1 << 26)
249#define OMAP4_LDOSRAMCORE_RETMODE_VSET_IN_SHIFT 21
250#define OMAP4_LDOSRAMCORE_RETMODE_VSET_IN_MASK (0x1f << 21)
251#define OMAP4_LDOSRAMCORE_RETMODE_VSET_OUT_SHIFT 16
252#define OMAP4_LDOSRAMCORE_RETMODE_VSET_OUT_MASK (0x1f << 16)
253#define OMAP4_LDOSRAMCORE_ACTMODE_MUX_CTRL_SHIFT 10
254#define OMAP4_LDOSRAMCORE_ACTMODE_MUX_CTRL_MASK (1 << 10)
255#define OMAP4_LDOSRAMCORE_ACTMODE_VSET_IN_SHIFT 5
256#define OMAP4_LDOSRAMCORE_ACTMODE_VSET_IN_MASK (0x1f << 5)
257#define OMAP4_LDOSRAMCORE_ACTMODE_VSET_OUT_SHIFT 0
258#define OMAP4_LDOSRAMCORE_ACTMODE_VSET_OUT_MASK (0x1f << 0)
259
260/* TEMP_SENSOR */
261#define OMAP4_BGAP_TEMPSOFF_SHIFT 12
262#define OMAP4_BGAP_TEMPSOFF_MASK (1 << 12)
263#define OMAP4_BGAP_TSHUT_SHIFT 11
264#define OMAP4_BGAP_TSHUT_MASK (1 << 11)
265#define OMAP4_BGAP_TEMP_SENSOR_CONTCONV_SHIFT 10
266#define OMAP4_BGAP_TEMP_SENSOR_CONTCONV_MASK (1 << 10)
267#define OMAP4_BGAP_TEMP_SENSOR_SOC_SHIFT 9
268#define OMAP4_BGAP_TEMP_SENSOR_SOC_MASK (1 << 9)
269#define OMAP4_BGAP_TEMP_SENSOR_EOCZ_SHIFT 8
270#define OMAP4_BGAP_TEMP_SENSOR_EOCZ_MASK (1 << 8)
271#define OMAP4_BGAP_TEMP_SENSOR_DTEMP_SHIFT 0
272#define OMAP4_BGAP_TEMP_SENSOR_DTEMP_MASK (0xff << 0)
273
274/* DPLL_NWELL_TRIM_0 */
275#define OMAP4_DPLL_ABE_NWELL_TRIM_MUX_CTRL_SHIFT 29
276#define OMAP4_DPLL_ABE_NWELL_TRIM_MUX_CTRL_MASK (1 << 29)
277#define OMAP4_DPLL_ABE_NWELL_TRIM_SHIFT 24
278#define OMAP4_DPLL_ABE_NWELL_TRIM_MASK (0x1f << 24)
279#define OMAP4_DPLL_PER_NWELL_TRIM_MUX_CTRL_SHIFT 23
280#define OMAP4_DPLL_PER_NWELL_TRIM_MUX_CTRL_MASK (1 << 23)
281#define OMAP4_DPLL_PER_NWELL_TRIM_SHIFT 18
282#define OMAP4_DPLL_PER_NWELL_TRIM_MASK (0x1f << 18)
283#define OMAP4_DPLL_CORE_NWELL_TRIM_MUX_CTRL_SHIFT 17
284#define OMAP4_DPLL_CORE_NWELL_TRIM_MUX_CTRL_MASK (1 << 17)
285#define OMAP4_DPLL_CORE_NWELL_TRIM_SHIFT 12
286#define OMAP4_DPLL_CORE_NWELL_TRIM_MASK (0x1f << 12)
287#define OMAP4_DPLL_IVA_NWELL_TRIM_MUX_CTRL_SHIFT 11
288#define OMAP4_DPLL_IVA_NWELL_TRIM_MUX_CTRL_MASK (1 << 11)
289#define OMAP4_DPLL_IVA_NWELL_TRIM_SHIFT 6
290#define OMAP4_DPLL_IVA_NWELL_TRIM_MASK (0x1f << 6)
291#define OMAP4_DPLL_MPU_NWELL_TRIM_MUX_CTRL_SHIFT 5
292#define OMAP4_DPLL_MPU_NWELL_TRIM_MUX_CTRL_MASK (1 << 5)
293#define OMAP4_DPLL_MPU_NWELL_TRIM_SHIFT 0
294#define OMAP4_DPLL_MPU_NWELL_TRIM_MASK (0x1f << 0)
295
296/* DPLL_NWELL_TRIM_1 */
297#define OMAP4_DPLL_UNIPRO_NWELL_TRIM_MUX_CTRL_SHIFT 29
298#define OMAP4_DPLL_UNIPRO_NWELL_TRIM_MUX_CTRL_MASK (1 << 29)
299#define OMAP4_DPLL_UNIPRO_NWELL_TRIM_SHIFT 24
300#define OMAP4_DPLL_UNIPRO_NWELL_TRIM_MASK (0x1f << 24)
301#define OMAP4_DPLL_USB_NWELL_TRIM_MUX_CTRL_SHIFT 23
302#define OMAP4_DPLL_USB_NWELL_TRIM_MUX_CTRL_MASK (1 << 23)
303#define OMAP4_DPLL_USB_NWELL_TRIM_SHIFT 18
304#define OMAP4_DPLL_USB_NWELL_TRIM_MASK (0x1f << 18)
305#define OMAP4_DPLL_HDMI_NWELL_TRIM_MUX_CTRL_SHIFT 17
306#define OMAP4_DPLL_HDMI_NWELL_TRIM_MUX_CTRL_MASK (1 << 17)
307#define OMAP4_DPLL_HDMI_NWELL_TRIM_SHIFT 12
308#define OMAP4_DPLL_HDMI_NWELL_TRIM_MASK (0x1f << 12)
309#define OMAP4_DPLL_DSI2_NWELL_TRIM_MUX_CTRL_SHIFT 11
310#define OMAP4_DPLL_DSI2_NWELL_TRIM_MUX_CTRL_MASK (1 << 11)
311#define OMAP4_DPLL_DSI2_NWELL_TRIM_SHIFT 6
312#define OMAP4_DPLL_DSI2_NWELL_TRIM_MASK (0x1f << 6)
313#define OMAP4_DPLL_DSI1_NWELL_TRIM_MUX_CTRL_SHIFT 5
314#define OMAP4_DPLL_DSI1_NWELL_TRIM_MUX_CTRL_MASK (1 << 5)
315#define OMAP4_DPLL_DSI1_NWELL_TRIM_SHIFT 0
316#define OMAP4_DPLL_DSI1_NWELL_TRIM_MASK (0x1f << 0)
317
318/* USBOTGHS_CONTROL */
319#define OMAP4_DISCHRGVBUS_SHIFT 8
320#define OMAP4_DISCHRGVBUS_MASK (1 << 8)
321#define OMAP4_CHRGVBUS_SHIFT 7
322#define OMAP4_CHRGVBUS_MASK (1 << 7)
323#define OMAP4_DRVVBUS_SHIFT 6
324#define OMAP4_DRVVBUS_MASK (1 << 6)
325#define OMAP4_IDPULLUP_SHIFT 5
326#define OMAP4_IDPULLUP_MASK (1 << 5)
327#define OMAP4_IDDIG_SHIFT 4
328#define OMAP4_IDDIG_MASK (1 << 4)
329#define OMAP4_SESSEND_SHIFT 3
330#define OMAP4_SESSEND_MASK (1 << 3)
331#define OMAP4_VBUSVALID_SHIFT 2
332#define OMAP4_VBUSVALID_MASK (1 << 2)
333#define OMAP4_BVALID_SHIFT 1
334#define OMAP4_BVALID_MASK (1 << 1)
335#define OMAP4_AVALID_SHIFT 0
336#define OMAP4_AVALID_MASK (1 << 0)
337
338/* DSS_CONTROL */
339#define OMAP4_DSS_MUX6_SELECT_SHIFT 0
340#define OMAP4_DSS_MUX6_SELECT_MASK (1 << 0)
341
342/* HWOBS_CONTROL */
343#define OMAP4_HWOBS_CLKDIV_SEL_SHIFT 3
344#define OMAP4_HWOBS_CLKDIV_SEL_MASK (0x1f << 3)
345#define OMAP4_HWOBS_ALL_ZERO_MODE_SHIFT 2
346#define OMAP4_HWOBS_ALL_ZERO_MODE_MASK (1 << 2)
347#define OMAP4_HWOBS_ALL_ONE_MODE_SHIFT 1
348#define OMAP4_HWOBS_ALL_ONE_MODE_MASK (1 << 1)
349#define OMAP4_HWOBS_MACRO_ENABLE_SHIFT 0
350#define OMAP4_HWOBS_MACRO_ENABLE_MASK (1 << 0)
351
352/* DEBOBS_FINAL_MUX_SEL */
353#define OMAP4_SELECT_SHIFT 0
354#define OMAP4_SELECT_MASK (0xffffffff << 0)
355
356/* DEBOBS_MMR_MPU */
357#define OMAP4_SELECT_DEBOBS_MMR_MPU_SHIFT 0
358#define OMAP4_SELECT_DEBOBS_MMR_MPU_MASK (0xf << 0)
359
360/* CONF_SDMA_REQ_SEL0 */
361#define OMAP4_MULT_SHIFT 0
362#define OMAP4_MULT_MASK (0x7f << 0)
363
364/* CONF_CLK_SEL0 */
365#define OMAP4_MULT_CONF_CLK_SEL0_SHIFT 0
366#define OMAP4_MULT_CONF_CLK_SEL0_MASK (0x7 << 0)
367
368/* CONF_CLK_SEL1 */
369#define OMAP4_MULT_CONF_CLK_SEL1_SHIFT 0
370#define OMAP4_MULT_CONF_CLK_SEL1_MASK (0x7 << 0)
371
372/* CONF_CLK_SEL2 */
373#define OMAP4_MULT_CONF_CLK_SEL2_SHIFT 0
374#define OMAP4_MULT_CONF_CLK_SEL2_MASK (0x7 << 0)
375
376/* CONF_DPLL_FREQLOCK_SEL */
377#define OMAP4_MULT_CONF_DPLL_FREQLOCK_SEL_SHIFT 0
378#define OMAP4_MULT_CONF_DPLL_FREQLOCK_SEL_MASK (0x7 << 0)
379
380/* CONF_DPLL_TINITZ_SEL */
381#define OMAP4_MULT_CONF_DPLL_TINITZ_SEL_SHIFT 0
382#define OMAP4_MULT_CONF_DPLL_TINITZ_SEL_MASK (0x7 << 0)
383
384/* CONF_DPLL_PHASELOCK_SEL */
385#define OMAP4_MULT_CONF_DPLL_PHASELOCK_SEL_SHIFT 0
386#define OMAP4_MULT_CONF_DPLL_PHASELOCK_SEL_MASK (0x7 << 0)
387
388/* CONF_DEBUG_SEL_TST_0 */
389#define OMAP4_MODE_SHIFT 0
390#define OMAP4_MODE_MASK (0xf << 0)
391
392#endif
diff --git a/arch/arm/mach-omap2/ctrl_module_pad_core_44xx.h b/arch/arm/mach-omap2/ctrl_module_pad_core_44xx.h
deleted file mode 100644
index c88420de1151..000000000000
--- a/arch/arm/mach-omap2/ctrl_module_pad_core_44xx.h
+++ /dev/null
@@ -1,1409 +0,0 @@
1/*
2 * OMAP44xx CTRL_MODULE_PAD_CORE registers and bitfields
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 *
9 * This file is automatically generated from the OMAP hardware databases.
10 * We respectfully ask that any modifications to this file be coordinated
11 * with the public linux-omap@vger.kernel.org mailing list and the
12 * authors above to ensure that the autogeneration scripts are kept
13 * up-to-date with the file contents.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_PAD_CORE_44XX_H
21#define __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_PAD_CORE_44XX_H
22
23
24/* Base address */
25#define OMAP4_CTRL_MODULE_PAD_CORE 0x4a100000
26
27/* Registers offset */
28#define OMAP4_CTRL_MODULE_PAD_CORE_IP_REVISION 0x0000
29#define OMAP4_CTRL_MODULE_PAD_CORE_IP_HWINFO 0x0004
30#define OMAP4_CTRL_MODULE_PAD_CORE_IP_SYSCONFIG 0x0010
31#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_0 0x01d8
32#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_1 0x01dc
33#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_2 0x01e0
34#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_3 0x01e4
35#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_4 0x01e8
36#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_5 0x01ec
37#define OMAP4_CTRL_MODULE_PAD_CORE_PADCONF_WAKEUPEVENT_6 0x01f0
38#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PADCONF_GLOBAL 0x05a0
39#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PADCONF_MODE 0x05a4
40#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART1IO_PADCONF_0 0x05a8
41#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART1IO_PADCONF_1 0x05ac
42#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART2IO_PADCONF_0 0x05b0
43#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART2IO_PADCONF_1 0x05b4
44#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART3IO_PADCONF_0 0x05b8
45#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART3IO_PADCONF_1 0x05bc
46#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SMART3IO_PADCONF_2 0x05c0
47#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_USBB_HSIC 0x05c4
48#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_SLIMBUS 0x05c8
49#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PBIASLITE 0x0600
50#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_0 0x0604
51#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX 0x0608
52#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_AVDAC 0x060c
53#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_HDMI_TX_PHY 0x0610
54#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MMC2 0x0614
55#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY 0x0618
56#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP 0x061c
57#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_USB2PHYCORE 0x0620
58#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1 0x0624
59#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MMC1 0x0628
60#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_HSI 0x062c
61#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_USB 0x0630
62#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_HDQ 0x0634
63#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_0 0x0638
64#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_1 0x063c
65#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_2 0x0640
66#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_3 0x0644
67#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_0 0x0648
68#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_1 0x064c
69#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_2 0x0650
70#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_3 0x0654
71#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_BUS_HOLD 0x0658
72#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_C2C 0x065c
73#define OMAP4_CTRL_MODULE_PAD_CORE_CORE_CONTROL_SPARE_RW 0x0660
74#define OMAP4_CTRL_MODULE_PAD_CORE_CORE_CONTROL_SPARE_R 0x0664
75#define OMAP4_CTRL_MODULE_PAD_CORE_CORE_CONTROL_SPARE_R_C0 0x0668
76#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_EFUSE_1 0x0700
77#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_EFUSE_2 0x0704
78#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_EFUSE_3 0x0708
79#define OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_EFUSE_4 0x070c
80
81/* Registers shifts and masks */
82
83/* IP_REVISION */
84#define OMAP4_IP_REV_SCHEME_SHIFT 30
85#define OMAP4_IP_REV_SCHEME_MASK (0x3 << 30)
86#define OMAP4_IP_REV_FUNC_SHIFT 16
87#define OMAP4_IP_REV_FUNC_MASK (0xfff << 16)
88#define OMAP4_IP_REV_RTL_SHIFT 11
89#define OMAP4_IP_REV_RTL_MASK (0x1f << 11)
90#define OMAP4_IP_REV_MAJOR_SHIFT 8
91#define OMAP4_IP_REV_MAJOR_MASK (0x7 << 8)
92#define OMAP4_IP_REV_CUSTOM_SHIFT 6
93#define OMAP4_IP_REV_CUSTOM_MASK (0x3 << 6)
94#define OMAP4_IP_REV_MINOR_SHIFT 0
95#define OMAP4_IP_REV_MINOR_MASK (0x3f << 0)
96
97/* IP_HWINFO */
98#define OMAP4_IP_HWINFO_SHIFT 0
99#define OMAP4_IP_HWINFO_MASK (0xffffffff << 0)
100
101/* IP_SYSCONFIG */
102#define OMAP4_IP_SYSCONFIG_IDLEMODE_SHIFT 2
103#define OMAP4_IP_SYSCONFIG_IDLEMODE_MASK (0x3 << 2)
104
105/* PADCONF_WAKEUPEVENT_0 */
106#define OMAP4_GPMC_CLK_DUPLICATEWAKEUPEVENT_SHIFT 31
107#define OMAP4_GPMC_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
108#define OMAP4_GPMC_NWP_DUPLICATEWAKEUPEVENT_SHIFT 30
109#define OMAP4_GPMC_NWP_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
110#define OMAP4_GPMC_NCS3_DUPLICATEWAKEUPEVENT_SHIFT 29
111#define OMAP4_GPMC_NCS3_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
112#define OMAP4_GPMC_NCS2_DUPLICATEWAKEUPEVENT_SHIFT 28
113#define OMAP4_GPMC_NCS2_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
114#define OMAP4_GPMC_NCS1_DUPLICATEWAKEUPEVENT_SHIFT 27
115#define OMAP4_GPMC_NCS1_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
116#define OMAP4_GPMC_NCS0_DUPLICATEWAKEUPEVENT_SHIFT 26
117#define OMAP4_GPMC_NCS0_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
118#define OMAP4_GPMC_A25_DUPLICATEWAKEUPEVENT_SHIFT 25
119#define OMAP4_GPMC_A25_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
120#define OMAP4_GPMC_A24_DUPLICATEWAKEUPEVENT_SHIFT 24
121#define OMAP4_GPMC_A24_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
122#define OMAP4_GPMC_A23_DUPLICATEWAKEUPEVENT_SHIFT 23
123#define OMAP4_GPMC_A23_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
124#define OMAP4_GPMC_A22_DUPLICATEWAKEUPEVENT_SHIFT 22
125#define OMAP4_GPMC_A22_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
126#define OMAP4_GPMC_A21_DUPLICATEWAKEUPEVENT_SHIFT 21
127#define OMAP4_GPMC_A21_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
128#define OMAP4_GPMC_A20_DUPLICATEWAKEUPEVENT_SHIFT 20
129#define OMAP4_GPMC_A20_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
130#define OMAP4_GPMC_A19_DUPLICATEWAKEUPEVENT_SHIFT 19
131#define OMAP4_GPMC_A19_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
132#define OMAP4_GPMC_A18_DUPLICATEWAKEUPEVENT_SHIFT 18
133#define OMAP4_GPMC_A18_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
134#define OMAP4_GPMC_A17_DUPLICATEWAKEUPEVENT_SHIFT 17
135#define OMAP4_GPMC_A17_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
136#define OMAP4_GPMC_A16_DUPLICATEWAKEUPEVENT_SHIFT 16
137#define OMAP4_GPMC_A16_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
138#define OMAP4_GPMC_AD15_DUPLICATEWAKEUPEVENT_SHIFT 15
139#define OMAP4_GPMC_AD15_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
140#define OMAP4_GPMC_AD14_DUPLICATEWAKEUPEVENT_SHIFT 14
141#define OMAP4_GPMC_AD14_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
142#define OMAP4_GPMC_AD13_DUPLICATEWAKEUPEVENT_SHIFT 13
143#define OMAP4_GPMC_AD13_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
144#define OMAP4_GPMC_AD12_DUPLICATEWAKEUPEVENT_SHIFT 12
145#define OMAP4_GPMC_AD12_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
146#define OMAP4_GPMC_AD11_DUPLICATEWAKEUPEVENT_SHIFT 11
147#define OMAP4_GPMC_AD11_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
148#define OMAP4_GPMC_AD10_DUPLICATEWAKEUPEVENT_SHIFT 10
149#define OMAP4_GPMC_AD10_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
150#define OMAP4_GPMC_AD9_DUPLICATEWAKEUPEVENT_SHIFT 9
151#define OMAP4_GPMC_AD9_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
152#define OMAP4_GPMC_AD8_DUPLICATEWAKEUPEVENT_SHIFT 8
153#define OMAP4_GPMC_AD8_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
154#define OMAP4_GPMC_AD7_DUPLICATEWAKEUPEVENT_SHIFT 7
155#define OMAP4_GPMC_AD7_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
156#define OMAP4_GPMC_AD6_DUPLICATEWAKEUPEVENT_SHIFT 6
157#define OMAP4_GPMC_AD6_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
158#define OMAP4_GPMC_AD5_DUPLICATEWAKEUPEVENT_SHIFT 5
159#define OMAP4_GPMC_AD5_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
160#define OMAP4_GPMC_AD4_DUPLICATEWAKEUPEVENT_SHIFT 4
161#define OMAP4_GPMC_AD4_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
162#define OMAP4_GPMC_AD3_DUPLICATEWAKEUPEVENT_SHIFT 3
163#define OMAP4_GPMC_AD3_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
164#define OMAP4_GPMC_AD2_DUPLICATEWAKEUPEVENT_SHIFT 2
165#define OMAP4_GPMC_AD2_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
166#define OMAP4_GPMC_AD1_DUPLICATEWAKEUPEVENT_SHIFT 1
167#define OMAP4_GPMC_AD1_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
168#define OMAP4_GPMC_AD0_DUPLICATEWAKEUPEVENT_SHIFT 0
169#define OMAP4_GPMC_AD0_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
170
171/* PADCONF_WAKEUPEVENT_1 */
172#define OMAP4_CAM_STROBE_DUPLICATEWAKEUPEVENT_SHIFT 31
173#define OMAP4_CAM_STROBE_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
174#define OMAP4_CAM_SHUTTER_DUPLICATEWAKEUPEVENT_SHIFT 30
175#define OMAP4_CAM_SHUTTER_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
176#define OMAP4_CSI22_DY1_DUPLICATEWAKEUPEVENT_SHIFT 29
177#define OMAP4_CSI22_DY1_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
178#define OMAP4_CSI22_DX1_DUPLICATEWAKEUPEVENT_SHIFT 28
179#define OMAP4_CSI22_DX1_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
180#define OMAP4_CSI22_DY0_DUPLICATEWAKEUPEVENT_SHIFT 27
181#define OMAP4_CSI22_DY0_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
182#define OMAP4_CSI22_DX0_DUPLICATEWAKEUPEVENT_SHIFT 26
183#define OMAP4_CSI22_DX0_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
184#define OMAP4_CSI21_DY4_DUPLICATEWAKEUPEVENT_SHIFT 25
185#define OMAP4_CSI21_DY4_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
186#define OMAP4_CSI21_DX4_DUPLICATEWAKEUPEVENT_SHIFT 24
187#define OMAP4_CSI21_DX4_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
188#define OMAP4_CSI21_DY3_DUPLICATEWAKEUPEVENT_SHIFT 23
189#define OMAP4_CSI21_DY3_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
190#define OMAP4_CSI21_DX3_DUPLICATEWAKEUPEVENT_SHIFT 22
191#define OMAP4_CSI21_DX3_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
192#define OMAP4_CSI21_DY2_DUPLICATEWAKEUPEVENT_SHIFT 21
193#define OMAP4_CSI21_DY2_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
194#define OMAP4_CSI21_DX2_DUPLICATEWAKEUPEVENT_SHIFT 20
195#define OMAP4_CSI21_DX2_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
196#define OMAP4_CSI21_DY1_DUPLICATEWAKEUPEVENT_SHIFT 19
197#define OMAP4_CSI21_DY1_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
198#define OMAP4_CSI21_DX1_DUPLICATEWAKEUPEVENT_SHIFT 18
199#define OMAP4_CSI21_DX1_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
200#define OMAP4_CSI21_DY0_DUPLICATEWAKEUPEVENT_SHIFT 17
201#define OMAP4_CSI21_DY0_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
202#define OMAP4_CSI21_DX0_DUPLICATEWAKEUPEVENT_SHIFT 16
203#define OMAP4_CSI21_DX0_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
204#define OMAP4_HDMI_DDC_SDA_DUPLICATEWAKEUPEVENT_SHIFT 15
205#define OMAP4_HDMI_DDC_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
206#define OMAP4_HDMI_DDC_SCL_DUPLICATEWAKEUPEVENT_SHIFT 14
207#define OMAP4_HDMI_DDC_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
208#define OMAP4_HDMI_CEC_DUPLICATEWAKEUPEVENT_SHIFT 13
209#define OMAP4_HDMI_CEC_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
210#define OMAP4_HDMI_HPD_DUPLICATEWAKEUPEVENT_SHIFT 12
211#define OMAP4_HDMI_HPD_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
212#define OMAP4_C2C_DATA15_DUPLICATEWAKEUPEVENT_SHIFT 11
213#define OMAP4_C2C_DATA15_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
214#define OMAP4_C2C_DATA14_DUPLICATEWAKEUPEVENT_SHIFT 10
215#define OMAP4_C2C_DATA14_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
216#define OMAP4_C2C_DATA13_DUPLICATEWAKEUPEVENT_SHIFT 9
217#define OMAP4_C2C_DATA13_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
218#define OMAP4_C2C_DATA12_DUPLICATEWAKEUPEVENT_SHIFT 8
219#define OMAP4_C2C_DATA12_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
220#define OMAP4_C2C_DATA11_DUPLICATEWAKEUPEVENT_SHIFT 7
221#define OMAP4_C2C_DATA11_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
222#define OMAP4_GPMC_WAIT1_DUPLICATEWAKEUPEVENT_SHIFT 6
223#define OMAP4_GPMC_WAIT1_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
224#define OMAP4_GPMC_WAIT0_DUPLICATEWAKEUPEVENT_SHIFT 5
225#define OMAP4_GPMC_WAIT0_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
226#define OMAP4_GPMC_NBE1_DUPLICATEWAKEUPEVENT_SHIFT 4
227#define OMAP4_GPMC_NBE1_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
228#define OMAP4_GPMC_NBE0_CLE_DUPLICATEWAKEUPEVENT_SHIFT 3
229#define OMAP4_GPMC_NBE0_CLE_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
230#define OMAP4_GPMC_NWE_DUPLICATEWAKEUPEVENT_SHIFT 2
231#define OMAP4_GPMC_NWE_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
232#define OMAP4_GPMC_NOE_DUPLICATEWAKEUPEVENT_SHIFT 1
233#define OMAP4_GPMC_NOE_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
234#define OMAP4_GPMC_NADV_ALE_DUPLICATEWAKEUPEVENT_SHIFT 0
235#define OMAP4_GPMC_NADV_ALE_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
236
237/* PADCONF_WAKEUPEVENT_2 */
238#define OMAP4_ABE_MCBSP1_CLKX_DUPLICATEWAKEUPEVENT_SHIFT 31
239#define OMAP4_ABE_MCBSP1_CLKX_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
240#define OMAP4_ABE_MCBSP2_FSX_DUPLICATEWAKEUPEVENT_SHIFT 30
241#define OMAP4_ABE_MCBSP2_FSX_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
242#define OMAP4_ABE_MCBSP2_DX_DUPLICATEWAKEUPEVENT_SHIFT 29
243#define OMAP4_ABE_MCBSP2_DX_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
244#define OMAP4_ABE_MCBSP2_DR_DUPLICATEWAKEUPEVENT_SHIFT 28
245#define OMAP4_ABE_MCBSP2_DR_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
246#define OMAP4_ABE_MCBSP2_CLKX_DUPLICATEWAKEUPEVENT_SHIFT 27
247#define OMAP4_ABE_MCBSP2_CLKX_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
248#define OMAP4_SDMMC1_DAT7_DUPLICATEWAKEUPEVENT_SHIFT 26
249#define OMAP4_SDMMC1_DAT7_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
250#define OMAP4_SDMMC1_DAT6_DUPLICATEWAKEUPEVENT_SHIFT 25
251#define OMAP4_SDMMC1_DAT6_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
252#define OMAP4_SDMMC1_DAT5_DUPLICATEWAKEUPEVENT_SHIFT 24
253#define OMAP4_SDMMC1_DAT5_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
254#define OMAP4_SDMMC1_DAT4_DUPLICATEWAKEUPEVENT_SHIFT 23
255#define OMAP4_SDMMC1_DAT4_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
256#define OMAP4_SDMMC1_DAT3_DUPLICATEWAKEUPEVENT_SHIFT 22
257#define OMAP4_SDMMC1_DAT3_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
258#define OMAP4_SDMMC1_DAT2_DUPLICATEWAKEUPEVENT_SHIFT 21
259#define OMAP4_SDMMC1_DAT2_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
260#define OMAP4_SDMMC1_DAT1_DUPLICATEWAKEUPEVENT_SHIFT 20
261#define OMAP4_SDMMC1_DAT1_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
262#define OMAP4_SDMMC1_DAT0_DUPLICATEWAKEUPEVENT_SHIFT 19
263#define OMAP4_SDMMC1_DAT0_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
264#define OMAP4_SDMMC1_CMD_DUPLICATEWAKEUPEVENT_SHIFT 18
265#define OMAP4_SDMMC1_CMD_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
266#define OMAP4_SDMMC1_CLK_DUPLICATEWAKEUPEVENT_SHIFT 17
267#define OMAP4_SDMMC1_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
268#define OMAP4_USBC1_ICUSB_DM_DUPLICATEWAKEUPEVENT_SHIFT 16
269#define OMAP4_USBC1_ICUSB_DM_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
270#define OMAP4_USBC1_ICUSB_DP_DUPLICATEWAKEUPEVENT_SHIFT 15
271#define OMAP4_USBC1_ICUSB_DP_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
272#define OMAP4_USBB1_HSIC_STROBE_DUPLICATEWAKEUPEVENT_SHIFT 14
273#define OMAP4_USBB1_HSIC_STROBE_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
274#define OMAP4_USBB1_HSIC_DATA_DUPLICATEWAKEUPEVENT_SHIFT 13
275#define OMAP4_USBB1_HSIC_DATA_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
276#define OMAP4_USBB1_ULPITLL_DAT7_DUPLICATEWAKEUPEVENT_SHIFT 12
277#define OMAP4_USBB1_ULPITLL_DAT7_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
278#define OMAP4_USBB1_ULPITLL_DAT6_DUPLICATEWAKEUPEVENT_SHIFT 11
279#define OMAP4_USBB1_ULPITLL_DAT6_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
280#define OMAP4_USBB1_ULPITLL_DAT5_DUPLICATEWAKEUPEVENT_SHIFT 10
281#define OMAP4_USBB1_ULPITLL_DAT5_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
282#define OMAP4_USBB1_ULPITLL_DAT4_DUPLICATEWAKEUPEVENT_SHIFT 9
283#define OMAP4_USBB1_ULPITLL_DAT4_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
284#define OMAP4_USBB1_ULPITLL_DAT3_DUPLICATEWAKEUPEVENT_SHIFT 8
285#define OMAP4_USBB1_ULPITLL_DAT3_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
286#define OMAP4_USBB1_ULPITLL_DAT2_DUPLICATEWAKEUPEVENT_SHIFT 7
287#define OMAP4_USBB1_ULPITLL_DAT2_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
288#define OMAP4_USBB1_ULPITLL_DAT1_DUPLICATEWAKEUPEVENT_SHIFT 6
289#define OMAP4_USBB1_ULPITLL_DAT1_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
290#define OMAP4_USBB1_ULPITLL_DAT0_DUPLICATEWAKEUPEVENT_SHIFT 5
291#define OMAP4_USBB1_ULPITLL_DAT0_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
292#define OMAP4_USBB1_ULPITLL_NXT_DUPLICATEWAKEUPEVENT_SHIFT 4
293#define OMAP4_USBB1_ULPITLL_NXT_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
294#define OMAP4_USBB1_ULPITLL_DIR_DUPLICATEWAKEUPEVENT_SHIFT 3
295#define OMAP4_USBB1_ULPITLL_DIR_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
296#define OMAP4_USBB1_ULPITLL_STP_DUPLICATEWAKEUPEVENT_SHIFT 2
297#define OMAP4_USBB1_ULPITLL_STP_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
298#define OMAP4_USBB1_ULPITLL_CLK_DUPLICATEWAKEUPEVENT_SHIFT 1
299#define OMAP4_USBB1_ULPITLL_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
300#define OMAP4_CAM_GLOBALRESET_DUPLICATEWAKEUPEVENT_SHIFT 0
301#define OMAP4_CAM_GLOBALRESET_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
302
303/* PADCONF_WAKEUPEVENT_3 */
304#define OMAP4_MCSPI1_CS3_DUPLICATEWAKEUPEVENT_SHIFT 31
305#define OMAP4_MCSPI1_CS3_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
306#define OMAP4_MCSPI1_CS2_DUPLICATEWAKEUPEVENT_SHIFT 30
307#define OMAP4_MCSPI1_CS2_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
308#define OMAP4_MCSPI1_CS1_DUPLICATEWAKEUPEVENT_SHIFT 29
309#define OMAP4_MCSPI1_CS1_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
310#define OMAP4_MCSPI1_CS0_DUPLICATEWAKEUPEVENT_SHIFT 28
311#define OMAP4_MCSPI1_CS0_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
312#define OMAP4_MCSPI1_SIMO_DUPLICATEWAKEUPEVENT_SHIFT 27
313#define OMAP4_MCSPI1_SIMO_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
314#define OMAP4_MCSPI1_SOMI_DUPLICATEWAKEUPEVENT_SHIFT 26
315#define OMAP4_MCSPI1_SOMI_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
316#define OMAP4_MCSPI1_CLK_DUPLICATEWAKEUPEVENT_SHIFT 25
317#define OMAP4_MCSPI1_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
318#define OMAP4_I2C4_SDA_DUPLICATEWAKEUPEVENT_SHIFT 24
319#define OMAP4_I2C4_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
320#define OMAP4_I2C4_SCL_DUPLICATEWAKEUPEVENT_SHIFT 23
321#define OMAP4_I2C4_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
322#define OMAP4_I2C3_SDA_DUPLICATEWAKEUPEVENT_SHIFT 22
323#define OMAP4_I2C3_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
324#define OMAP4_I2C3_SCL_DUPLICATEWAKEUPEVENT_SHIFT 21
325#define OMAP4_I2C3_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
326#define OMAP4_I2C2_SDA_DUPLICATEWAKEUPEVENT_SHIFT 20
327#define OMAP4_I2C2_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
328#define OMAP4_I2C2_SCL_DUPLICATEWAKEUPEVENT_SHIFT 19
329#define OMAP4_I2C2_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
330#define OMAP4_I2C1_SDA_DUPLICATEWAKEUPEVENT_SHIFT 18
331#define OMAP4_I2C1_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
332#define OMAP4_I2C1_SCL_DUPLICATEWAKEUPEVENT_SHIFT 17
333#define OMAP4_I2C1_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
334#define OMAP4_HDQ_SIO_DUPLICATEWAKEUPEVENT_SHIFT 16
335#define OMAP4_HDQ_SIO_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
336#define OMAP4_UART2_TX_DUPLICATEWAKEUPEVENT_SHIFT 15
337#define OMAP4_UART2_TX_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
338#define OMAP4_UART2_RX_DUPLICATEWAKEUPEVENT_SHIFT 14
339#define OMAP4_UART2_RX_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
340#define OMAP4_UART2_RTS_DUPLICATEWAKEUPEVENT_SHIFT 13
341#define OMAP4_UART2_RTS_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
342#define OMAP4_UART2_CTS_DUPLICATEWAKEUPEVENT_SHIFT 12
343#define OMAP4_UART2_CTS_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
344#define OMAP4_ABE_DMIC_DIN3_DUPLICATEWAKEUPEVENT_SHIFT 11
345#define OMAP4_ABE_DMIC_DIN3_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
346#define OMAP4_ABE_DMIC_DIN2_DUPLICATEWAKEUPEVENT_SHIFT 10
347#define OMAP4_ABE_DMIC_DIN2_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
348#define OMAP4_ABE_DMIC_DIN1_DUPLICATEWAKEUPEVENT_SHIFT 9
349#define OMAP4_ABE_DMIC_DIN1_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
350#define OMAP4_ABE_DMIC_CLK1_DUPLICATEWAKEUPEVENT_SHIFT 8
351#define OMAP4_ABE_DMIC_CLK1_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
352#define OMAP4_ABE_CLKS_DUPLICATEWAKEUPEVENT_SHIFT 7
353#define OMAP4_ABE_CLKS_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
354#define OMAP4_ABE_PDM_LB_CLK_DUPLICATEWAKEUPEVENT_SHIFT 6
355#define OMAP4_ABE_PDM_LB_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
356#define OMAP4_ABE_PDM_FRAME_DUPLICATEWAKEUPEVENT_SHIFT 5
357#define OMAP4_ABE_PDM_FRAME_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
358#define OMAP4_ABE_PDM_DL_DATA_DUPLICATEWAKEUPEVENT_SHIFT 4
359#define OMAP4_ABE_PDM_DL_DATA_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
360#define OMAP4_ABE_PDM_UL_DATA_DUPLICATEWAKEUPEVENT_SHIFT 3
361#define OMAP4_ABE_PDM_UL_DATA_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
362#define OMAP4_ABE_MCBSP1_FSX_DUPLICATEWAKEUPEVENT_SHIFT 2
363#define OMAP4_ABE_MCBSP1_FSX_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
364#define OMAP4_ABE_MCBSP1_DX_DUPLICATEWAKEUPEVENT_SHIFT 1
365#define OMAP4_ABE_MCBSP1_DX_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
366#define OMAP4_ABE_MCBSP1_DR_DUPLICATEWAKEUPEVENT_SHIFT 0
367#define OMAP4_ABE_MCBSP1_DR_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
368
369/* PADCONF_WAKEUPEVENT_4 */
370#define OMAP4_UNIPRO_TY0_DUPLICATEWAKEUPEVENT_SHIFT 31
371#define OMAP4_UNIPRO_TY0_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
372#define OMAP4_UNIPRO_TX0_DUPLICATEWAKEUPEVENT_SHIFT 30
373#define OMAP4_UNIPRO_TX0_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
374#define OMAP4_USBB2_HSIC_STROBE_DUPLICATEWAKEUPEVENT_SHIFT 29
375#define OMAP4_USBB2_HSIC_STROBE_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
376#define OMAP4_USBB2_HSIC_DATA_DUPLICATEWAKEUPEVENT_SHIFT 28
377#define OMAP4_USBB2_HSIC_DATA_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
378#define OMAP4_USBB2_ULPITLL_DAT7_DUPLICATEWAKEUPEVENT_SHIFT 27
379#define OMAP4_USBB2_ULPITLL_DAT7_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
380#define OMAP4_USBB2_ULPITLL_DAT6_DUPLICATEWAKEUPEVENT_SHIFT 26
381#define OMAP4_USBB2_ULPITLL_DAT6_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
382#define OMAP4_USBB2_ULPITLL_DAT5_DUPLICATEWAKEUPEVENT_SHIFT 25
383#define OMAP4_USBB2_ULPITLL_DAT5_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
384#define OMAP4_USBB2_ULPITLL_DAT4_DUPLICATEWAKEUPEVENT_SHIFT 24
385#define OMAP4_USBB2_ULPITLL_DAT4_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
386#define OMAP4_USBB2_ULPITLL_DAT3_DUPLICATEWAKEUPEVENT_SHIFT 23
387#define OMAP4_USBB2_ULPITLL_DAT3_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
388#define OMAP4_USBB2_ULPITLL_DAT2_DUPLICATEWAKEUPEVENT_SHIFT 22
389#define OMAP4_USBB2_ULPITLL_DAT2_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
390#define OMAP4_USBB2_ULPITLL_DAT1_DUPLICATEWAKEUPEVENT_SHIFT 21
391#define OMAP4_USBB2_ULPITLL_DAT1_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
392#define OMAP4_USBB2_ULPITLL_DAT0_DUPLICATEWAKEUPEVENT_SHIFT 20
393#define OMAP4_USBB2_ULPITLL_DAT0_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
394#define OMAP4_USBB2_ULPITLL_NXT_DUPLICATEWAKEUPEVENT_SHIFT 19
395#define OMAP4_USBB2_ULPITLL_NXT_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
396#define OMAP4_USBB2_ULPITLL_DIR_DUPLICATEWAKEUPEVENT_SHIFT 18
397#define OMAP4_USBB2_ULPITLL_DIR_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
398#define OMAP4_USBB2_ULPITLL_STP_DUPLICATEWAKEUPEVENT_SHIFT 17
399#define OMAP4_USBB2_ULPITLL_STP_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
400#define OMAP4_USBB2_ULPITLL_CLK_DUPLICATEWAKEUPEVENT_SHIFT 16
401#define OMAP4_USBB2_ULPITLL_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
402#define OMAP4_UART4_TX_DUPLICATEWAKEUPEVENT_SHIFT 15
403#define OMAP4_UART4_TX_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
404#define OMAP4_UART4_RX_DUPLICATEWAKEUPEVENT_SHIFT 14
405#define OMAP4_UART4_RX_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
406#define OMAP4_MCSPI4_CS0_DUPLICATEWAKEUPEVENT_SHIFT 13
407#define OMAP4_MCSPI4_CS0_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
408#define OMAP4_MCSPI4_SOMI_DUPLICATEWAKEUPEVENT_SHIFT 12
409#define OMAP4_MCSPI4_SOMI_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
410#define OMAP4_MCSPI4_SIMO_DUPLICATEWAKEUPEVENT_SHIFT 11
411#define OMAP4_MCSPI4_SIMO_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
412#define OMAP4_MCSPI4_CLK_DUPLICATEWAKEUPEVENT_SHIFT 10
413#define OMAP4_MCSPI4_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
414#define OMAP4_SDMMC5_DAT3_DUPLICATEWAKEUPEVENT_SHIFT 9
415#define OMAP4_SDMMC5_DAT3_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
416#define OMAP4_SDMMC5_DAT2_DUPLICATEWAKEUPEVENT_SHIFT 8
417#define OMAP4_SDMMC5_DAT2_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
418#define OMAP4_SDMMC5_DAT1_DUPLICATEWAKEUPEVENT_SHIFT 7
419#define OMAP4_SDMMC5_DAT1_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
420#define OMAP4_SDMMC5_DAT0_DUPLICATEWAKEUPEVENT_SHIFT 6
421#define OMAP4_SDMMC5_DAT0_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
422#define OMAP4_SDMMC5_CMD_DUPLICATEWAKEUPEVENT_SHIFT 5
423#define OMAP4_SDMMC5_CMD_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
424#define OMAP4_SDMMC5_CLK_DUPLICATEWAKEUPEVENT_SHIFT 4
425#define OMAP4_SDMMC5_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
426#define OMAP4_UART3_TX_IRTX_DUPLICATEWAKEUPEVENT_SHIFT 3
427#define OMAP4_UART3_TX_IRTX_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
428#define OMAP4_UART3_RX_IRRX_DUPLICATEWAKEUPEVENT_SHIFT 2
429#define OMAP4_UART3_RX_IRRX_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
430#define OMAP4_UART3_RTS_SD_DUPLICATEWAKEUPEVENT_SHIFT 1
431#define OMAP4_UART3_RTS_SD_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
432#define OMAP4_UART3_CTS_RCTX_DUPLICATEWAKEUPEVENT_SHIFT 0
433#define OMAP4_UART3_CTS_RCTX_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
434
435/* PADCONF_WAKEUPEVENT_5 */
436#define OMAP4_DPM_EMU11_DUPLICATEWAKEUPEVENT_SHIFT 31
437#define OMAP4_DPM_EMU11_DUPLICATEWAKEUPEVENT_MASK (1 << 31)
438#define OMAP4_DPM_EMU10_DUPLICATEWAKEUPEVENT_SHIFT 30
439#define OMAP4_DPM_EMU10_DUPLICATEWAKEUPEVENT_MASK (1 << 30)
440#define OMAP4_DPM_EMU9_DUPLICATEWAKEUPEVENT_SHIFT 29
441#define OMAP4_DPM_EMU9_DUPLICATEWAKEUPEVENT_MASK (1 << 29)
442#define OMAP4_DPM_EMU8_DUPLICATEWAKEUPEVENT_SHIFT 28
443#define OMAP4_DPM_EMU8_DUPLICATEWAKEUPEVENT_MASK (1 << 28)
444#define OMAP4_DPM_EMU7_DUPLICATEWAKEUPEVENT_SHIFT 27
445#define OMAP4_DPM_EMU7_DUPLICATEWAKEUPEVENT_MASK (1 << 27)
446#define OMAP4_DPM_EMU6_DUPLICATEWAKEUPEVENT_SHIFT 26
447#define OMAP4_DPM_EMU6_DUPLICATEWAKEUPEVENT_MASK (1 << 26)
448#define OMAP4_DPM_EMU5_DUPLICATEWAKEUPEVENT_SHIFT 25
449#define OMAP4_DPM_EMU5_DUPLICATEWAKEUPEVENT_MASK (1 << 25)
450#define OMAP4_DPM_EMU4_DUPLICATEWAKEUPEVENT_SHIFT 24
451#define OMAP4_DPM_EMU4_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
452#define OMAP4_DPM_EMU3_DUPLICATEWAKEUPEVENT_SHIFT 23
453#define OMAP4_DPM_EMU3_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
454#define OMAP4_DPM_EMU2_DUPLICATEWAKEUPEVENT_SHIFT 22
455#define OMAP4_DPM_EMU2_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
456#define OMAP4_DPM_EMU1_DUPLICATEWAKEUPEVENT_SHIFT 21
457#define OMAP4_DPM_EMU1_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
458#define OMAP4_DPM_EMU0_DUPLICATEWAKEUPEVENT_SHIFT 20
459#define OMAP4_DPM_EMU0_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
460#define OMAP4_SYS_BOOT5_DUPLICATEWAKEUPEVENT_SHIFT 19
461#define OMAP4_SYS_BOOT5_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
462#define OMAP4_SYS_BOOT4_DUPLICATEWAKEUPEVENT_SHIFT 18
463#define OMAP4_SYS_BOOT4_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
464#define OMAP4_SYS_BOOT3_DUPLICATEWAKEUPEVENT_SHIFT 17
465#define OMAP4_SYS_BOOT3_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
466#define OMAP4_SYS_BOOT2_DUPLICATEWAKEUPEVENT_SHIFT 16
467#define OMAP4_SYS_BOOT2_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
468#define OMAP4_SYS_BOOT1_DUPLICATEWAKEUPEVENT_SHIFT 15
469#define OMAP4_SYS_BOOT1_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
470#define OMAP4_SYS_BOOT0_DUPLICATEWAKEUPEVENT_SHIFT 14
471#define OMAP4_SYS_BOOT0_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
472#define OMAP4_SYS_NIRQ2_DUPLICATEWAKEUPEVENT_SHIFT 13
473#define OMAP4_SYS_NIRQ2_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
474#define OMAP4_SYS_NIRQ1_DUPLICATEWAKEUPEVENT_SHIFT 12
475#define OMAP4_SYS_NIRQ1_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
476#define OMAP4_FREF_CLK2_OUT_DUPLICATEWAKEUPEVENT_SHIFT 11
477#define OMAP4_FREF_CLK2_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
478#define OMAP4_FREF_CLK1_OUT_DUPLICATEWAKEUPEVENT_SHIFT 10
479#define OMAP4_FREF_CLK1_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
480#define OMAP4_UNIPRO_RY2_DUPLICATEWAKEUPEVENT_SHIFT 9
481#define OMAP4_UNIPRO_RY2_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
482#define OMAP4_UNIPRO_RX2_DUPLICATEWAKEUPEVENT_SHIFT 8
483#define OMAP4_UNIPRO_RX2_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
484#define OMAP4_UNIPRO_RY1_DUPLICATEWAKEUPEVENT_SHIFT 7
485#define OMAP4_UNIPRO_RY1_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
486#define OMAP4_UNIPRO_RX1_DUPLICATEWAKEUPEVENT_SHIFT 6
487#define OMAP4_UNIPRO_RX1_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
488#define OMAP4_UNIPRO_RY0_DUPLICATEWAKEUPEVENT_SHIFT 5
489#define OMAP4_UNIPRO_RY0_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
490#define OMAP4_UNIPRO_RX0_DUPLICATEWAKEUPEVENT_SHIFT 4
491#define OMAP4_UNIPRO_RX0_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
492#define OMAP4_UNIPRO_TY2_DUPLICATEWAKEUPEVENT_SHIFT 3
493#define OMAP4_UNIPRO_TY2_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
494#define OMAP4_UNIPRO_TX2_DUPLICATEWAKEUPEVENT_SHIFT 2
495#define OMAP4_UNIPRO_TX2_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
496#define OMAP4_UNIPRO_TY1_DUPLICATEWAKEUPEVENT_SHIFT 1
497#define OMAP4_UNIPRO_TY1_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
498#define OMAP4_UNIPRO_TX1_DUPLICATEWAKEUPEVENT_SHIFT 0
499#define OMAP4_UNIPRO_TX1_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
500
501/* PADCONF_WAKEUPEVENT_6 */
502#define OMAP4_DPM_EMU19_DUPLICATEWAKEUPEVENT_SHIFT 7
503#define OMAP4_DPM_EMU19_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
504#define OMAP4_DPM_EMU18_DUPLICATEWAKEUPEVENT_SHIFT 6
505#define OMAP4_DPM_EMU18_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
506#define OMAP4_DPM_EMU17_DUPLICATEWAKEUPEVENT_SHIFT 5
507#define OMAP4_DPM_EMU17_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
508#define OMAP4_DPM_EMU16_DUPLICATEWAKEUPEVENT_SHIFT 4
509#define OMAP4_DPM_EMU16_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
510#define OMAP4_DPM_EMU15_DUPLICATEWAKEUPEVENT_SHIFT 3
511#define OMAP4_DPM_EMU15_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
512#define OMAP4_DPM_EMU14_DUPLICATEWAKEUPEVENT_SHIFT 2
513#define OMAP4_DPM_EMU14_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
514#define OMAP4_DPM_EMU13_DUPLICATEWAKEUPEVENT_SHIFT 1
515#define OMAP4_DPM_EMU13_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
516#define OMAP4_DPM_EMU12_DUPLICATEWAKEUPEVENT_SHIFT 0
517#define OMAP4_DPM_EMU12_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
518
519/* CONTROL_PADCONF_GLOBAL */
520#define OMAP4_FORCE_OFFMODE_EN_SHIFT 31
521#define OMAP4_FORCE_OFFMODE_EN_MASK (1 << 31)
522
523/* CONTROL_PADCONF_MODE */
524#define OMAP4_VDDS_DV_BANK0_SHIFT 31
525#define OMAP4_VDDS_DV_BANK0_MASK (1 << 31)
526#define OMAP4_VDDS_DV_BANK1_SHIFT 30
527#define OMAP4_VDDS_DV_BANK1_MASK (1 << 30)
528#define OMAP4_VDDS_DV_BANK3_SHIFT 29
529#define OMAP4_VDDS_DV_BANK3_MASK (1 << 29)
530#define OMAP4_VDDS_DV_BANK4_SHIFT 28
531#define OMAP4_VDDS_DV_BANK4_MASK (1 << 28)
532#define OMAP4_VDDS_DV_BANK5_SHIFT 27
533#define OMAP4_VDDS_DV_BANK5_MASK (1 << 27)
534#define OMAP4_VDDS_DV_BANK6_SHIFT 26
535#define OMAP4_VDDS_DV_BANK6_MASK (1 << 26)
536#define OMAP4_VDDS_DV_C2C_SHIFT 25
537#define OMAP4_VDDS_DV_C2C_MASK (1 << 25)
538#define OMAP4_VDDS_DV_CAM_SHIFT 24
539#define OMAP4_VDDS_DV_CAM_MASK (1 << 24)
540#define OMAP4_VDDS_DV_GPMC_SHIFT 23
541#define OMAP4_VDDS_DV_GPMC_MASK (1 << 23)
542#define OMAP4_VDDS_DV_SDMMC2_SHIFT 22
543#define OMAP4_VDDS_DV_SDMMC2_MASK (1 << 22)
544
545/* CONTROL_SMART1IO_PADCONF_0 */
546#define OMAP4_ABE_DR0_SC_SHIFT 30
547#define OMAP4_ABE_DR0_SC_MASK (0x3 << 30)
548#define OMAP4_CAM_DR0_SC_SHIFT 28
549#define OMAP4_CAM_DR0_SC_MASK (0x3 << 28)
550#define OMAP4_FREF_DR2_SC_SHIFT 26
551#define OMAP4_FREF_DR2_SC_MASK (0x3 << 26)
552#define OMAP4_FREF_DR3_SC_SHIFT 24
553#define OMAP4_FREF_DR3_SC_MASK (0x3 << 24)
554#define OMAP4_GPIO_DR8_SC_SHIFT 22
555#define OMAP4_GPIO_DR8_SC_MASK (0x3 << 22)
556#define OMAP4_GPIO_DR9_SC_SHIFT 20
557#define OMAP4_GPIO_DR9_SC_MASK (0x3 << 20)
558#define OMAP4_GPMC_DR2_SC_SHIFT 18
559#define OMAP4_GPMC_DR2_SC_MASK (0x3 << 18)
560#define OMAP4_GPMC_DR3_SC_SHIFT 16
561#define OMAP4_GPMC_DR3_SC_MASK (0x3 << 16)
562#define OMAP4_GPMC_DR6_SC_SHIFT 14
563#define OMAP4_GPMC_DR6_SC_MASK (0x3 << 14)
564#define OMAP4_HDMI_DR0_SC_SHIFT 12
565#define OMAP4_HDMI_DR0_SC_MASK (0x3 << 12)
566#define OMAP4_MCSPI1_DR0_SC_SHIFT 10
567#define OMAP4_MCSPI1_DR0_SC_MASK (0x3 << 10)
568#define OMAP4_UART1_DR0_SC_SHIFT 8
569#define OMAP4_UART1_DR0_SC_MASK (0x3 << 8)
570#define OMAP4_UART3_DR0_SC_SHIFT 6
571#define OMAP4_UART3_DR0_SC_MASK (0x3 << 6)
572#define OMAP4_UART3_DR1_SC_SHIFT 4
573#define OMAP4_UART3_DR1_SC_MASK (0x3 << 4)
574#define OMAP4_UNIPRO_DR0_SC_SHIFT 2
575#define OMAP4_UNIPRO_DR0_SC_MASK (0x3 << 2)
576#define OMAP4_UNIPRO_DR1_SC_SHIFT 0
577#define OMAP4_UNIPRO_DR1_SC_MASK (0x3 << 0)
578
579/* CONTROL_SMART1IO_PADCONF_1 */
580#define OMAP4_ABE_DR0_LB_SHIFT 30
581#define OMAP4_ABE_DR0_LB_MASK (0x3 << 30)
582#define OMAP4_CAM_DR0_LB_SHIFT 28
583#define OMAP4_CAM_DR0_LB_MASK (0x3 << 28)
584#define OMAP4_FREF_DR2_LB_SHIFT 26
585#define OMAP4_FREF_DR2_LB_MASK (0x3 << 26)
586#define OMAP4_FREF_DR3_LB_SHIFT 24
587#define OMAP4_FREF_DR3_LB_MASK (0x3 << 24)
588#define OMAP4_GPIO_DR8_LB_SHIFT 22
589#define OMAP4_GPIO_DR8_LB_MASK (0x3 << 22)
590#define OMAP4_GPIO_DR9_LB_SHIFT 20
591#define OMAP4_GPIO_DR9_LB_MASK (0x3 << 20)
592#define OMAP4_GPMC_DR2_LB_SHIFT 18
593#define OMAP4_GPMC_DR2_LB_MASK (0x3 << 18)
594#define OMAP4_GPMC_DR3_LB_SHIFT 16
595#define OMAP4_GPMC_DR3_LB_MASK (0x3 << 16)
596#define OMAP4_GPMC_DR6_LB_SHIFT 14
597#define OMAP4_GPMC_DR6_LB_MASK (0x3 << 14)
598#define OMAP4_HDMI_DR0_LB_SHIFT 12
599#define OMAP4_HDMI_DR0_LB_MASK (0x3 << 12)
600#define OMAP4_MCSPI1_DR0_LB_SHIFT 10
601#define OMAP4_MCSPI1_DR0_LB_MASK (0x3 << 10)
602#define OMAP4_UART1_DR0_LB_SHIFT 8
603#define OMAP4_UART1_DR0_LB_MASK (0x3 << 8)
604#define OMAP4_UART3_DR0_LB_SHIFT 6
605#define OMAP4_UART3_DR0_LB_MASK (0x3 << 6)
606#define OMAP4_UART3_DR1_LB_SHIFT 4
607#define OMAP4_UART3_DR1_LB_MASK (0x3 << 4)
608#define OMAP4_UNIPRO_DR0_LB_SHIFT 2
609#define OMAP4_UNIPRO_DR0_LB_MASK (0x3 << 2)
610#define OMAP4_UNIPRO_DR1_LB_SHIFT 0
611#define OMAP4_UNIPRO_DR1_LB_MASK (0x3 << 0)
612
613/* CONTROL_SMART2IO_PADCONF_0 */
614#define OMAP4_C2C_DR0_LB_SHIFT 31
615#define OMAP4_C2C_DR0_LB_MASK (1 << 31)
616#define OMAP4_DPM_DR1_LB_SHIFT 30
617#define OMAP4_DPM_DR1_LB_MASK (1 << 30)
618#define OMAP4_DPM_DR2_LB_SHIFT 29
619#define OMAP4_DPM_DR2_LB_MASK (1 << 29)
620#define OMAP4_DPM_DR3_LB_SHIFT 28
621#define OMAP4_DPM_DR3_LB_MASK (1 << 28)
622#define OMAP4_GPIO_DR0_LB_SHIFT 27
623#define OMAP4_GPIO_DR0_LB_MASK (1 << 27)
624#define OMAP4_GPIO_DR1_LB_SHIFT 26
625#define OMAP4_GPIO_DR1_LB_MASK (1 << 26)
626#define OMAP4_GPIO_DR10_LB_SHIFT 25
627#define OMAP4_GPIO_DR10_LB_MASK (1 << 25)
628#define OMAP4_GPIO_DR2_LB_SHIFT 24
629#define OMAP4_GPIO_DR2_LB_MASK (1 << 24)
630#define OMAP4_GPMC_DR0_LB_SHIFT 23
631#define OMAP4_GPMC_DR0_LB_MASK (1 << 23)
632#define OMAP4_GPMC_DR1_LB_SHIFT 22
633#define OMAP4_GPMC_DR1_LB_MASK (1 << 22)
634#define OMAP4_GPMC_DR4_LB_SHIFT 21
635#define OMAP4_GPMC_DR4_LB_MASK (1 << 21)
636#define OMAP4_GPMC_DR5_LB_SHIFT 20
637#define OMAP4_GPMC_DR5_LB_MASK (1 << 20)
638#define OMAP4_GPMC_DR7_LB_SHIFT 19
639#define OMAP4_GPMC_DR7_LB_MASK (1 << 19)
640#define OMAP4_HSI2_DR0_LB_SHIFT 18
641#define OMAP4_HSI2_DR0_LB_MASK (1 << 18)
642#define OMAP4_HSI2_DR1_LB_SHIFT 17
643#define OMAP4_HSI2_DR1_LB_MASK (1 << 17)
644#define OMAP4_HSI2_DR2_LB_SHIFT 16
645#define OMAP4_HSI2_DR2_LB_MASK (1 << 16)
646#define OMAP4_KPD_DR0_LB_SHIFT 15
647#define OMAP4_KPD_DR0_LB_MASK (1 << 15)
648#define OMAP4_KPD_DR1_LB_SHIFT 14
649#define OMAP4_KPD_DR1_LB_MASK (1 << 14)
650#define OMAP4_PDM_DR0_LB_SHIFT 13
651#define OMAP4_PDM_DR0_LB_MASK (1 << 13)
652#define OMAP4_SDMMC2_DR0_LB_SHIFT 12
653#define OMAP4_SDMMC2_DR0_LB_MASK (1 << 12)
654#define OMAP4_SDMMC3_DR0_LB_SHIFT 11
655#define OMAP4_SDMMC3_DR0_LB_MASK (1 << 11)
656#define OMAP4_SDMMC4_DR0_LB_SHIFT 10
657#define OMAP4_SDMMC4_DR0_LB_MASK (1 << 10)
658#define OMAP4_SDMMC4_DR1_LB_SHIFT 9
659#define OMAP4_SDMMC4_DR1_LB_MASK (1 << 9)
660#define OMAP4_SPI3_DR0_LB_SHIFT 8
661#define OMAP4_SPI3_DR0_LB_MASK (1 << 8)
662#define OMAP4_SPI3_DR1_LB_SHIFT 7
663#define OMAP4_SPI3_DR1_LB_MASK (1 << 7)
664#define OMAP4_UART3_DR2_LB_SHIFT 6
665#define OMAP4_UART3_DR2_LB_MASK (1 << 6)
666#define OMAP4_UART3_DR3_LB_SHIFT 5
667#define OMAP4_UART3_DR3_LB_MASK (1 << 5)
668#define OMAP4_UART3_DR4_LB_SHIFT 4
669#define OMAP4_UART3_DR4_LB_MASK (1 << 4)
670#define OMAP4_UART3_DR5_LB_SHIFT 3
671#define OMAP4_UART3_DR5_LB_MASK (1 << 3)
672#define OMAP4_USBA0_DR1_LB_SHIFT 2
673#define OMAP4_USBA0_DR1_LB_MASK (1 << 2)
674#define OMAP4_USBA_DR2_LB_SHIFT 1
675#define OMAP4_USBA_DR2_LB_MASK (1 << 1)
676
677/* CONTROL_SMART2IO_PADCONF_1 */
678#define OMAP4_USBB1_DR0_LB_SHIFT 31
679#define OMAP4_USBB1_DR0_LB_MASK (1 << 31)
680#define OMAP4_USBB2_DR0_LB_SHIFT 30
681#define OMAP4_USBB2_DR0_LB_MASK (1 << 30)
682#define OMAP4_USBA0_DR0_LB_SHIFT 29
683#define OMAP4_USBA0_DR0_LB_MASK (1 << 29)
684
685/* CONTROL_SMART3IO_PADCONF_0 */
686#define OMAP4_DMIC_DR0_MB_SHIFT 30
687#define OMAP4_DMIC_DR0_MB_MASK (0x3 << 30)
688#define OMAP4_GPIO_DR3_MB_SHIFT 28
689#define OMAP4_GPIO_DR3_MB_MASK (0x3 << 28)
690#define OMAP4_GPIO_DR4_MB_SHIFT 26
691#define OMAP4_GPIO_DR4_MB_MASK (0x3 << 26)
692#define OMAP4_GPIO_DR5_MB_SHIFT 24
693#define OMAP4_GPIO_DR5_MB_MASK (0x3 << 24)
694#define OMAP4_GPIO_DR6_MB_SHIFT 22
695#define OMAP4_GPIO_DR6_MB_MASK (0x3 << 22)
696#define OMAP4_HSI_DR1_MB_SHIFT 20
697#define OMAP4_HSI_DR1_MB_MASK (0x3 << 20)
698#define OMAP4_HSI_DR2_MB_SHIFT 18
699#define OMAP4_HSI_DR2_MB_MASK (0x3 << 18)
700#define OMAP4_HSI_DR3_MB_SHIFT 16
701#define OMAP4_HSI_DR3_MB_MASK (0x3 << 16)
702#define OMAP4_MCBSP2_DR0_MB_SHIFT 14
703#define OMAP4_MCBSP2_DR0_MB_MASK (0x3 << 14)
704#define OMAP4_MCSPI4_DR0_MB_SHIFT 12
705#define OMAP4_MCSPI4_DR0_MB_MASK (0x3 << 12)
706#define OMAP4_MCSPI4_DR1_MB_SHIFT 10
707#define OMAP4_MCSPI4_DR1_MB_MASK (0x3 << 10)
708#define OMAP4_SDMMC3_DR0_MB_SHIFT 8
709#define OMAP4_SDMMC3_DR0_MB_MASK (0x3 << 8)
710#define OMAP4_SPI2_DR0_MB_SHIFT 0
711#define OMAP4_SPI2_DR0_MB_MASK (0x3 << 0)
712
713/* CONTROL_SMART3IO_PADCONF_1 */
714#define OMAP4_SPI2_DR1_MB_SHIFT 30
715#define OMAP4_SPI2_DR1_MB_MASK (0x3 << 30)
716#define OMAP4_SPI2_DR2_MB_SHIFT 28
717#define OMAP4_SPI2_DR2_MB_MASK (0x3 << 28)
718#define OMAP4_UART2_DR0_MB_SHIFT 26
719#define OMAP4_UART2_DR0_MB_MASK (0x3 << 26)
720#define OMAP4_UART2_DR1_MB_SHIFT 24
721#define OMAP4_UART2_DR1_MB_MASK (0x3 << 24)
722#define OMAP4_UART4_DR0_MB_SHIFT 22
723#define OMAP4_UART4_DR0_MB_MASK (0x3 << 22)
724#define OMAP4_HSI_DR0_MB_SHIFT 20
725#define OMAP4_HSI_DR0_MB_MASK (0x3 << 20)
726
727/* CONTROL_SMART3IO_PADCONF_2 */
728#define OMAP4_DMIC_DR0_LB_SHIFT 31
729#define OMAP4_DMIC_DR0_LB_MASK (1 << 31)
730#define OMAP4_GPIO_DR3_LB_SHIFT 30
731#define OMAP4_GPIO_DR3_LB_MASK (1 << 30)
732#define OMAP4_GPIO_DR4_LB_SHIFT 29
733#define OMAP4_GPIO_DR4_LB_MASK (1 << 29)
734#define OMAP4_GPIO_DR5_LB_SHIFT 28
735#define OMAP4_GPIO_DR5_LB_MASK (1 << 28)
736#define OMAP4_GPIO_DR6_LB_SHIFT 27
737#define OMAP4_GPIO_DR6_LB_MASK (1 << 27)
738#define OMAP4_HSI_DR1_LB_SHIFT 26
739#define OMAP4_HSI_DR1_LB_MASK (1 << 26)
740#define OMAP4_HSI_DR2_LB_SHIFT 25
741#define OMAP4_HSI_DR2_LB_MASK (1 << 25)
742#define OMAP4_HSI_DR3_LB_SHIFT 24
743#define OMAP4_HSI_DR3_LB_MASK (1 << 24)
744#define OMAP4_MCBSP2_DR0_LB_SHIFT 23
745#define OMAP4_MCBSP2_DR0_LB_MASK (1 << 23)
746#define OMAP4_MCSPI4_DR0_LB_SHIFT 22
747#define OMAP4_MCSPI4_DR0_LB_MASK (1 << 22)
748#define OMAP4_MCSPI4_DR1_LB_SHIFT 21
749#define OMAP4_MCSPI4_DR1_LB_MASK (1 << 21)
750#define OMAP4_SLIMBUS2_DR0_LB_SHIFT 18
751#define OMAP4_SLIMBUS2_DR0_LB_MASK (1 << 18)
752#define OMAP4_SPI2_DR0_LB_SHIFT 16
753#define OMAP4_SPI2_DR0_LB_MASK (1 << 16)
754#define OMAP4_SPI2_DR1_LB_SHIFT 15
755#define OMAP4_SPI2_DR1_LB_MASK (1 << 15)
756#define OMAP4_SPI2_DR2_LB_SHIFT 14
757#define OMAP4_SPI2_DR2_LB_MASK (1 << 14)
758#define OMAP4_UART2_DR0_LB_SHIFT 13
759#define OMAP4_UART2_DR0_LB_MASK (1 << 13)
760#define OMAP4_UART2_DR1_LB_SHIFT 12
761#define OMAP4_UART2_DR1_LB_MASK (1 << 12)
762#define OMAP4_UART4_DR0_LB_SHIFT 11
763#define OMAP4_UART4_DR0_LB_MASK (1 << 11)
764#define OMAP4_HSI_DR0_LB_SHIFT 10
765#define OMAP4_HSI_DR0_LB_MASK (1 << 10)
766
767/* CONTROL_USBB_HSIC */
768#define OMAP4_USBB2_DR1_SR_SHIFT 30
769#define OMAP4_USBB2_DR1_SR_MASK (0x3 << 30)
770#define OMAP4_USBB2_DR1_I_SHIFT 27
771#define OMAP4_USBB2_DR1_I_MASK (0x7 << 27)
772#define OMAP4_USBB1_DR1_SR_SHIFT 25
773#define OMAP4_USBB1_DR1_SR_MASK (0x3 << 25)
774#define OMAP4_USBB1_DR1_I_SHIFT 22
775#define OMAP4_USBB1_DR1_I_MASK (0x7 << 22)
776#define OMAP4_USBB1_HSIC_DATA_WD_SHIFT 20
777#define OMAP4_USBB1_HSIC_DATA_WD_MASK (0x3 << 20)
778#define OMAP4_USBB1_HSIC_STROBE_WD_SHIFT 18
779#define OMAP4_USBB1_HSIC_STROBE_WD_MASK (0x3 << 18)
780#define OMAP4_USBB2_HSIC_DATA_WD_SHIFT 16
781#define OMAP4_USBB2_HSIC_DATA_WD_MASK (0x3 << 16)
782#define OMAP4_USBB2_HSIC_STROBE_WD_SHIFT 14
783#define OMAP4_USBB2_HSIC_STROBE_WD_MASK (0x3 << 14)
784#define OMAP4_USBB1_HSIC_DATA_OFFMODE_WD_ENABLE_SHIFT 13
785#define OMAP4_USBB1_HSIC_DATA_OFFMODE_WD_ENABLE_MASK (1 << 13)
786#define OMAP4_USBB1_HSIC_DATA_OFFMODE_WD_SHIFT 11
787#define OMAP4_USBB1_HSIC_DATA_OFFMODE_WD_MASK (0x3 << 11)
788#define OMAP4_USBB1_HSIC_STROBE_OFFMODE_WD_ENABLE_SHIFT 10
789#define OMAP4_USBB1_HSIC_STROBE_OFFMODE_WD_ENABLE_MASK (1 << 10)
790#define OMAP4_USBB1_HSIC_STROBE_OFFMODE_WD_SHIFT 8
791#define OMAP4_USBB1_HSIC_STROBE_OFFMODE_WD_MASK (0x3 << 8)
792#define OMAP4_USBB2_HSIC_DATA_OFFMODE_WD_ENABLE_SHIFT 7
793#define OMAP4_USBB2_HSIC_DATA_OFFMODE_WD_ENABLE_MASK (1 << 7)
794#define OMAP4_USBB2_HSIC_DATA_OFFMODE_WD_SHIFT 5
795#define OMAP4_USBB2_HSIC_DATA_OFFMODE_WD_MASK (0x3 << 5)
796#define OMAP4_USBB2_HSIC_STROBE_OFFMODE_WD_ENABLE_SHIFT 4
797#define OMAP4_USBB2_HSIC_STROBE_OFFMODE_WD_ENABLE_MASK (1 << 4)
798#define OMAP4_USBB2_HSIC_STROBE_OFFMODE_WD_SHIFT 2
799#define OMAP4_USBB2_HSIC_STROBE_OFFMODE_WD_MASK (0x3 << 2)
800
801/* CONTROL_SLIMBUS */
802#define OMAP4_SLIMBUS1_DR0_MB_SHIFT 30
803#define OMAP4_SLIMBUS1_DR0_MB_MASK (0x3 << 30)
804#define OMAP4_SLIMBUS1_DR1_MB_SHIFT 28
805#define OMAP4_SLIMBUS1_DR1_MB_MASK (0x3 << 28)
806#define OMAP4_SLIMBUS2_DR0_MB_SHIFT 26
807#define OMAP4_SLIMBUS2_DR0_MB_MASK (0x3 << 26)
808#define OMAP4_SLIMBUS2_DR1_MB_SHIFT 24
809#define OMAP4_SLIMBUS2_DR1_MB_MASK (0x3 << 24)
810#define OMAP4_SLIMBUS2_DR2_MB_SHIFT 22
811#define OMAP4_SLIMBUS2_DR2_MB_MASK (0x3 << 22)
812#define OMAP4_SLIMBUS2_DR3_MB_SHIFT 20
813#define OMAP4_SLIMBUS2_DR3_MB_MASK (0x3 << 20)
814#define OMAP4_SLIMBUS1_DR0_LB_SHIFT 19
815#define OMAP4_SLIMBUS1_DR0_LB_MASK (1 << 19)
816#define OMAP4_SLIMBUS2_DR1_LB_SHIFT 18
817#define OMAP4_SLIMBUS2_DR1_LB_MASK (1 << 18)
818
819/* CONTROL_PBIASLITE */
820#define OMAP4_USIM_PBIASLITE_HIZ_MODE_SHIFT 31
821#define OMAP4_USIM_PBIASLITE_HIZ_MODE_MASK (1 << 31)
822#define OMAP4_USIM_PBIASLITE_SUPPLY_HI_OUT_SHIFT 30
823#define OMAP4_USIM_PBIASLITE_SUPPLY_HI_OUT_MASK (1 << 30)
824#define OMAP4_USIM_PBIASLITE_VMODE_ERROR_SHIFT 29
825#define OMAP4_USIM_PBIASLITE_VMODE_ERROR_MASK (1 << 29)
826#define OMAP4_USIM_PBIASLITE_PWRDNZ_SHIFT 28
827#define OMAP4_USIM_PBIASLITE_PWRDNZ_MASK (1 << 28)
828#define OMAP4_USIM_PBIASLITE_VMODE_SHIFT 27
829#define OMAP4_USIM_PBIASLITE_VMODE_MASK (1 << 27)
830#define OMAP4_MMC1_PWRDNZ_SHIFT 26
831#define OMAP4_MMC1_PWRDNZ_MASK (1 << 26)
832#define OMAP4_MMC1_PBIASLITE_HIZ_MODE_SHIFT 25
833#define OMAP4_MMC1_PBIASLITE_HIZ_MODE_MASK (1 << 25)
834#define OMAP4_MMC1_PBIASLITE_SUPPLY_HI_OUT_SHIFT 24
835#define OMAP4_MMC1_PBIASLITE_SUPPLY_HI_OUT_MASK (1 << 24)
836#define OMAP4_MMC1_PBIASLITE_VMODE_ERROR_SHIFT 23
837#define OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK (1 << 23)
838#define OMAP4_MMC1_PBIASLITE_PWRDNZ_SHIFT 22
839#define OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK (1 << 22)
840#define OMAP4_MMC1_PBIASLITE_VMODE_SHIFT 21
841#define OMAP4_MMC1_PBIASLITE_VMODE_MASK (1 << 21)
842#define OMAP4_USBC1_ICUSB_PWRDNZ_SHIFT 20
843#define OMAP4_USBC1_ICUSB_PWRDNZ_MASK (1 << 20)
844
845/* CONTROL_I2C_0 */
846#define OMAP4_I2C4_SDA_GLFENB_SHIFT 31
847#define OMAP4_I2C4_SDA_GLFENB_MASK (1 << 31)
848#define OMAP4_I2C4_SDA_LOAD_BITS_SHIFT 29
849#define OMAP4_I2C4_SDA_LOAD_BITS_MASK (0x3 << 29)
850#define OMAP4_I2C4_SDA_PULLUPRESX_SHIFT 28
851#define OMAP4_I2C4_SDA_PULLUPRESX_MASK (1 << 28)
852#define OMAP4_I2C3_SDA_GLFENB_SHIFT 27
853#define OMAP4_I2C3_SDA_GLFENB_MASK (1 << 27)
854#define OMAP4_I2C3_SDA_LOAD_BITS_SHIFT 25
855#define OMAP4_I2C3_SDA_LOAD_BITS_MASK (0x3 << 25)
856#define OMAP4_I2C3_SDA_PULLUPRESX_SHIFT 24
857#define OMAP4_I2C3_SDA_PULLUPRESX_MASK (1 << 24)
858#define OMAP4_I2C2_SDA_GLFENB_SHIFT 23
859#define OMAP4_I2C2_SDA_GLFENB_MASK (1 << 23)
860#define OMAP4_I2C2_SDA_LOAD_BITS_SHIFT 21
861#define OMAP4_I2C2_SDA_LOAD_BITS_MASK (0x3 << 21)
862#define OMAP4_I2C2_SDA_PULLUPRESX_SHIFT 20
863#define OMAP4_I2C2_SDA_PULLUPRESX_MASK (1 << 20)
864#define OMAP4_I2C1_SDA_GLFENB_SHIFT 19
865#define OMAP4_I2C1_SDA_GLFENB_MASK (1 << 19)
866#define OMAP4_I2C1_SDA_LOAD_BITS_SHIFT 17
867#define OMAP4_I2C1_SDA_LOAD_BITS_MASK (0x3 << 17)
868#define OMAP4_I2C1_SDA_PULLUPRESX_SHIFT 16
869#define OMAP4_I2C1_SDA_PULLUPRESX_MASK (1 << 16)
870#define OMAP4_I2C4_SCL_GLFENB_SHIFT 15
871#define OMAP4_I2C4_SCL_GLFENB_MASK (1 << 15)
872#define OMAP4_I2C4_SCL_LOAD_BITS_SHIFT 13
873#define OMAP4_I2C4_SCL_LOAD_BITS_MASK (0x3 << 13)
874#define OMAP4_I2C4_SCL_PULLUPRESX_SHIFT 12
875#define OMAP4_I2C4_SCL_PULLUPRESX_MASK (1 << 12)
876#define OMAP4_I2C3_SCL_GLFENB_SHIFT 11
877#define OMAP4_I2C3_SCL_GLFENB_MASK (1 << 11)
878#define OMAP4_I2C3_SCL_LOAD_BITS_SHIFT 9
879#define OMAP4_I2C3_SCL_LOAD_BITS_MASK (0x3 << 9)
880#define OMAP4_I2C3_SCL_PULLUPRESX_SHIFT 8
881#define OMAP4_I2C3_SCL_PULLUPRESX_MASK (1 << 8)
882#define OMAP4_I2C2_SCL_GLFENB_SHIFT 7
883#define OMAP4_I2C2_SCL_GLFENB_MASK (1 << 7)
884#define OMAP4_I2C2_SCL_LOAD_BITS_SHIFT 5
885#define OMAP4_I2C2_SCL_LOAD_BITS_MASK (0x3 << 5)
886#define OMAP4_I2C2_SCL_PULLUPRESX_SHIFT 4
887#define OMAP4_I2C2_SCL_PULLUPRESX_MASK (1 << 4)
888#define OMAP4_I2C1_SCL_GLFENB_SHIFT 3
889#define OMAP4_I2C1_SCL_GLFENB_MASK (1 << 3)
890#define OMAP4_I2C1_SCL_LOAD_BITS_SHIFT 1
891#define OMAP4_I2C1_SCL_LOAD_BITS_MASK (0x3 << 1)
892#define OMAP4_I2C1_SCL_PULLUPRESX_SHIFT 0
893#define OMAP4_I2C1_SCL_PULLUPRESX_MASK (1 << 0)
894
895/* CONTROL_CAMERA_RX */
896#define OMAP4_CAMERARX_UNIPRO_CTRLCLKEN_SHIFT 31
897#define OMAP4_CAMERARX_UNIPRO_CTRLCLKEN_MASK (1 << 31)
898#define OMAP4_CAMERARX_CSI22_LANEENABLE_SHIFT 29
899#define OMAP4_CAMERARX_CSI22_LANEENABLE_MASK (0x3 << 29)
900#define OMAP4_CAMERARX_CSI21_LANEENABLE_SHIFT 24
901#define OMAP4_CAMERARX_CSI21_LANEENABLE_MASK (0x1f << 24)
902#define OMAP4_CAMERARX_UNIPRO_CAMMODE_SHIFT 22
903#define OMAP4_CAMERARX_UNIPRO_CAMMODE_MASK (0x3 << 22)
904#define OMAP4_CAMERARX_CSI22_CTRLCLKEN_SHIFT 21
905#define OMAP4_CAMERARX_CSI22_CTRLCLKEN_MASK (1 << 21)
906#define OMAP4_CAMERARX_CSI22_CAMMODE_SHIFT 19
907#define OMAP4_CAMERARX_CSI22_CAMMODE_MASK (0x3 << 19)
908#define OMAP4_CAMERARX_CSI21_CTRLCLKEN_SHIFT 18
909#define OMAP4_CAMERARX_CSI21_CTRLCLKEN_MASK (1 << 18)
910#define OMAP4_CAMERARX_CSI21_CAMMODE_SHIFT 16
911#define OMAP4_CAMERARX_CSI21_CAMMODE_MASK (0x3 << 16)
912
913/* CONTROL_AVDAC */
914#define OMAP4_AVDAC_ACEN_SHIFT 31
915#define OMAP4_AVDAC_ACEN_MASK (1 << 31)
916#define OMAP4_AVDAC_TVOUTBYPASS_SHIFT 30
917#define OMAP4_AVDAC_TVOUTBYPASS_MASK (1 << 30)
918#define OMAP4_AVDAC_INPUTINV_SHIFT 29
919#define OMAP4_AVDAC_INPUTINV_MASK (1 << 29)
920#define OMAP4_AVDAC_CTL_SHIFT 13
921#define OMAP4_AVDAC_CTL_MASK (0xffff << 13)
922#define OMAP4_AVDAC_CTL_WR_ACK_SHIFT 12
923#define OMAP4_AVDAC_CTL_WR_ACK_MASK (1 << 12)
924
925/* CONTROL_HDMI_TX_PHY */
926#define OMAP4_HDMITXPHY_PADORDER_SHIFT 31
927#define OMAP4_HDMITXPHY_PADORDER_MASK (1 << 31)
928#define OMAP4_HDMITXPHY_TXVALID_SHIFT 30
929#define OMAP4_HDMITXPHY_TXVALID_MASK (1 << 30)
930#define OMAP4_HDMITXPHY_ENBYPASSCLK_SHIFT 29
931#define OMAP4_HDMITXPHY_ENBYPASSCLK_MASK (1 << 29)
932#define OMAP4_HDMITXPHY_PD_PULLUPDET_SHIFT 28
933#define OMAP4_HDMITXPHY_PD_PULLUPDET_MASK (1 << 28)
934
935/* CONTROL_MMC2 */
936#define OMAP4_MMC2_FEEDBACK_CLK_SEL_SHIFT 31
937#define OMAP4_MMC2_FEEDBACK_CLK_SEL_MASK (1 << 31)
938
939/* CONTROL_DSIPHY */
940#define OMAP4_DSI2_LANEENABLE_SHIFT 29
941#define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29)
942#define OMAP4_DSI1_LANEENABLE_SHIFT 24
943#define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24)
944#define OMAP4_DSI1_PIPD_SHIFT 19
945#define OMAP4_DSI1_PIPD_MASK (0x1f << 19)
946#define OMAP4_DSI2_PIPD_SHIFT 14
947#define OMAP4_DSI2_PIPD_MASK (0x1f << 14)
948
949/* CONTROL_MCBSPLP */
950#define OMAP4_ALBCTRLRX_FSX_SHIFT 31
951#define OMAP4_ALBCTRLRX_FSX_MASK (1 << 31)
952#define OMAP4_ALBCTRLRX_CLKX_SHIFT 30
953#define OMAP4_ALBCTRLRX_CLKX_MASK (1 << 30)
954#define OMAP4_ABE_MCBSP1_DR_EN_SHIFT 29
955#define OMAP4_ABE_MCBSP1_DR_EN_MASK (1 << 29)
956
957/* CONTROL_USB2PHYCORE */
958#define OMAP4_USB2PHY_AUTORESUME_EN_SHIFT 31
959#define OMAP4_USB2PHY_AUTORESUME_EN_MASK (1 << 31)
960#define OMAP4_USB2PHY_DISCHGDET_SHIFT 30
961#define OMAP4_USB2PHY_DISCHGDET_MASK (1 << 30)
962#define OMAP4_USB2PHY_GPIOMODE_SHIFT 29
963#define OMAP4_USB2PHY_GPIOMODE_MASK (1 << 29)
964#define OMAP4_USB2PHY_CHG_DET_EXT_CTL_SHIFT 28
965#define OMAP4_USB2PHY_CHG_DET_EXT_CTL_MASK (1 << 28)
966#define OMAP4_USB2PHY_RDM_PD_CHGDET_EN_SHIFT 27
967#define OMAP4_USB2PHY_RDM_PD_CHGDET_EN_MASK (1 << 27)
968#define OMAP4_USB2PHY_RDP_PU_CHGDET_EN_SHIFT 26
969#define OMAP4_USB2PHY_RDP_PU_CHGDET_EN_MASK (1 << 26)
970#define OMAP4_USB2PHY_CHG_VSRC_EN_SHIFT 25
971#define OMAP4_USB2PHY_CHG_VSRC_EN_MASK (1 << 25)
972#define OMAP4_USB2PHY_CHG_ISINK_EN_SHIFT 24
973#define OMAP4_USB2PHY_CHG_ISINK_EN_MASK (1 << 24)
974#define OMAP4_USB2PHY_CHG_DET_STATUS_SHIFT 21
975#define OMAP4_USB2PHY_CHG_DET_STATUS_MASK (0x7 << 21)
976#define OMAP4_USB2PHY_CHG_DET_DM_COMP_SHIFT 20
977#define OMAP4_USB2PHY_CHG_DET_DM_COMP_MASK (1 << 20)
978#define OMAP4_USB2PHY_CHG_DET_DP_COMP_SHIFT 19
979#define OMAP4_USB2PHY_CHG_DET_DP_COMP_MASK (1 << 19)
980#define OMAP4_USB2PHY_DATADET_SHIFT 18
981#define OMAP4_USB2PHY_DATADET_MASK (1 << 18)
982#define OMAP4_USB2PHY_SINKONDP_SHIFT 17
983#define OMAP4_USB2PHY_SINKONDP_MASK (1 << 17)
984#define OMAP4_USB2PHY_SRCONDM_SHIFT 16
985#define OMAP4_USB2PHY_SRCONDM_MASK (1 << 16)
986#define OMAP4_USB2PHY_RESTARTCHGDET_SHIFT 15
987#define OMAP4_USB2PHY_RESTARTCHGDET_MASK (1 << 15)
988#define OMAP4_USB2PHY_CHGDETDONE_SHIFT 14
989#define OMAP4_USB2PHY_CHGDETDONE_MASK (1 << 14)
990#define OMAP4_USB2PHY_CHGDETECTED_SHIFT 13
991#define OMAP4_USB2PHY_CHGDETECTED_MASK (1 << 13)
992#define OMAP4_USB2PHY_MCPCPUEN_SHIFT 12
993#define OMAP4_USB2PHY_MCPCPUEN_MASK (1 << 12)
994#define OMAP4_USB2PHY_MCPCMODEEN_SHIFT 11
995#define OMAP4_USB2PHY_MCPCMODEEN_MASK (1 << 11)
996#define OMAP4_USB2PHY_RESETDONEMCLK_SHIFT 10
997#define OMAP4_USB2PHY_RESETDONEMCLK_MASK (1 << 10)
998#define OMAP4_USB2PHY_UTMIRESETDONE_SHIFT 9
999#define OMAP4_USB2PHY_UTMIRESETDONE_MASK (1 << 9)
1000#define OMAP4_USB2PHY_TXBITSTUFFENABLE_SHIFT 8
1001#define OMAP4_USB2PHY_TXBITSTUFFENABLE_MASK (1 << 8)
1002#define OMAP4_USB2PHY_DATAPOLARITYN_SHIFT 7
1003#define OMAP4_USB2PHY_DATAPOLARITYN_MASK (1 << 7)
1004#define OMAP4_USBDPLL_FREQLOCK_SHIFT 6
1005#define OMAP4_USBDPLL_FREQLOCK_MASK (1 << 6)
1006#define OMAP4_USB2PHY_RESETDONETCLK_SHIFT 5
1007#define OMAP4_USB2PHY_RESETDONETCLK_MASK (1 << 5)
1008
1009/* CONTROL_I2C_1 */
1010#define OMAP4_HDMI_DDC_SDA_GLFENB_SHIFT 31
1011#define OMAP4_HDMI_DDC_SDA_GLFENB_MASK (1 << 31)
1012#define OMAP4_HDMI_DDC_SDA_LOAD_BITS_SHIFT 29
1013#define OMAP4_HDMI_DDC_SDA_LOAD_BITS_MASK (0x3 << 29)
1014#define OMAP4_HDMI_DDC_SDA_PULLUPRESX_SHIFT 28
1015#define OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK (1 << 28)
1016#define OMAP4_HDMI_DDC_SCL_GLFENB_SHIFT 27
1017#define OMAP4_HDMI_DDC_SCL_GLFENB_MASK (1 << 27)
1018#define OMAP4_HDMI_DDC_SCL_LOAD_BITS_SHIFT 25
1019#define OMAP4_HDMI_DDC_SCL_LOAD_BITS_MASK (0x3 << 25)
1020#define OMAP4_HDMI_DDC_SCL_PULLUPRESX_SHIFT 24
1021#define OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK (1 << 24)
1022#define OMAP4_HDMI_DDC_SDA_HSMODE_SHIFT 23
1023#define OMAP4_HDMI_DDC_SDA_HSMODE_MASK (1 << 23)
1024#define OMAP4_HDMI_DDC_SDA_NMODE_SHIFT 22
1025#define OMAP4_HDMI_DDC_SDA_NMODE_MASK (1 << 22)
1026#define OMAP4_HDMI_DDC_SCL_HSMODE_SHIFT 21
1027#define OMAP4_HDMI_DDC_SCL_HSMODE_MASK (1 << 21)
1028#define OMAP4_HDMI_DDC_SCL_NMODE_SHIFT 20
1029#define OMAP4_HDMI_DDC_SCL_NMODE_MASK (1 << 20)
1030
1031/* CONTROL_MMC1 */
1032#define OMAP4_SDMMC1_PUSTRENGTH_GRP0_SHIFT 31
1033#define OMAP4_SDMMC1_PUSTRENGTH_GRP0_MASK (1 << 31)
1034#define OMAP4_SDMMC1_PUSTRENGTH_GRP1_SHIFT 30
1035#define OMAP4_SDMMC1_PUSTRENGTH_GRP1_MASK (1 << 30)
1036#define OMAP4_SDMMC1_PUSTRENGTH_GRP2_SHIFT 29
1037#define OMAP4_SDMMC1_PUSTRENGTH_GRP2_MASK (1 << 29)
1038#define OMAP4_SDMMC1_PUSTRENGTH_GRP3_SHIFT 28
1039#define OMAP4_SDMMC1_PUSTRENGTH_GRP3_MASK (1 << 28)
1040#define OMAP4_SDMMC1_DR0_SPEEDCTRL_SHIFT 27
1041#define OMAP4_SDMMC1_DR0_SPEEDCTRL_MASK (1 << 27)
1042#define OMAP4_SDMMC1_DR1_SPEEDCTRL_SHIFT 26
1043#define OMAP4_SDMMC1_DR1_SPEEDCTRL_MASK (1 << 26)
1044#define OMAP4_SDMMC1_DR2_SPEEDCTRL_SHIFT 25
1045#define OMAP4_SDMMC1_DR2_SPEEDCTRL_MASK (1 << 25)
1046#define OMAP4_USBC1_DR0_SPEEDCTRL_SHIFT 24
1047#define OMAP4_USBC1_DR0_SPEEDCTRL_MASK (1 << 24)
1048#define OMAP4_USB_FD_CDEN_SHIFT 23
1049#define OMAP4_USB_FD_CDEN_MASK (1 << 23)
1050#define OMAP4_USBC1_ICUSB_DP_PDDIS_SHIFT 22
1051#define OMAP4_USBC1_ICUSB_DP_PDDIS_MASK (1 << 22)
1052#define OMAP4_USBC1_ICUSB_DM_PDDIS_SHIFT 21
1053#define OMAP4_USBC1_ICUSB_DM_PDDIS_MASK (1 << 21)
1054
1055/* CONTROL_HSI */
1056#define OMAP4_HSI1_CALLOOP_SEL_SHIFT 31
1057#define OMAP4_HSI1_CALLOOP_SEL_MASK (1 << 31)
1058#define OMAP4_HSI1_CALMUX_SEL_SHIFT 30
1059#define OMAP4_HSI1_CALMUX_SEL_MASK (1 << 30)
1060#define OMAP4_HSI2_CALLOOP_SEL_SHIFT 29
1061#define OMAP4_HSI2_CALLOOP_SEL_MASK (1 << 29)
1062#define OMAP4_HSI2_CALMUX_SEL_SHIFT 28
1063#define OMAP4_HSI2_CALMUX_SEL_MASK (1 << 28)
1064
1065/* CONTROL_USB */
1066#define OMAP4_CARKIT_USBA0_ULPIPHY_DAT0_AUTO_EN_SHIFT 31
1067#define OMAP4_CARKIT_USBA0_ULPIPHY_DAT0_AUTO_EN_MASK (1 << 31)
1068#define OMAP4_CARKIT_USBA0_ULPIPHY_DAT1_AUTO_EN_SHIFT 30
1069#define OMAP4_CARKIT_USBA0_ULPIPHY_DAT1_AUTO_EN_MASK (1 << 30)
1070
1071/* CONTROL_HDQ */
1072#define OMAP4_HDQ_SIO_PWRDNZ_SHIFT 31
1073#define OMAP4_HDQ_SIO_PWRDNZ_MASK (1 << 31)
1074
1075/* CONTROL_LPDDR2IO1_0 */
1076#define OMAP4_LPDDR2IO1_GR4_SR_SHIFT 30
1077#define OMAP4_LPDDR2IO1_GR4_SR_MASK (0x3 << 30)
1078#define OMAP4_LPDDR2IO1_GR4_I_SHIFT 27
1079#define OMAP4_LPDDR2IO1_GR4_I_MASK (0x7 << 27)
1080#define OMAP4_LPDDR2IO1_GR4_WD_SHIFT 25
1081#define OMAP4_LPDDR2IO1_GR4_WD_MASK (0x3 << 25)
1082#define OMAP4_LPDDR2IO1_GR3_SR_SHIFT 22
1083#define OMAP4_LPDDR2IO1_GR3_SR_MASK (0x3 << 22)
1084#define OMAP4_LPDDR2IO1_GR3_I_SHIFT 19
1085#define OMAP4_LPDDR2IO1_GR3_I_MASK (0x7 << 19)
1086#define OMAP4_LPDDR2IO1_GR3_WD_SHIFT 17
1087#define OMAP4_LPDDR2IO1_GR3_WD_MASK (0x3 << 17)
1088#define OMAP4_LPDDR2IO1_GR2_SR_SHIFT 14
1089#define OMAP4_LPDDR2IO1_GR2_SR_MASK (0x3 << 14)
1090#define OMAP4_LPDDR2IO1_GR2_I_SHIFT 11
1091#define OMAP4_LPDDR2IO1_GR2_I_MASK (0x7 << 11)
1092#define OMAP4_LPDDR2IO1_GR2_WD_SHIFT 9
1093#define OMAP4_LPDDR2IO1_GR2_WD_MASK (0x3 << 9)
1094#define OMAP4_LPDDR2IO1_GR1_SR_SHIFT 6
1095#define OMAP4_LPDDR2IO1_GR1_SR_MASK (0x3 << 6)
1096#define OMAP4_LPDDR2IO1_GR1_I_SHIFT 3
1097#define OMAP4_LPDDR2IO1_GR1_I_MASK (0x7 << 3)
1098#define OMAP4_LPDDR2IO1_GR1_WD_SHIFT 1
1099#define OMAP4_LPDDR2IO1_GR1_WD_MASK (0x3 << 1)
1100
1101/* CONTROL_LPDDR2IO1_1 */
1102#define OMAP4_LPDDR2IO1_GR8_SR_SHIFT 30
1103#define OMAP4_LPDDR2IO1_GR8_SR_MASK (0x3 << 30)
1104#define OMAP4_LPDDR2IO1_GR8_I_SHIFT 27
1105#define OMAP4_LPDDR2IO1_GR8_I_MASK (0x7 << 27)
1106#define OMAP4_LPDDR2IO1_GR8_WD_SHIFT 25
1107#define OMAP4_LPDDR2IO1_GR8_WD_MASK (0x3 << 25)
1108#define OMAP4_LPDDR2IO1_GR7_SR_SHIFT 22
1109#define OMAP4_LPDDR2IO1_GR7_SR_MASK (0x3 << 22)
1110#define OMAP4_LPDDR2IO1_GR7_I_SHIFT 19
1111#define OMAP4_LPDDR2IO1_GR7_I_MASK (0x7 << 19)
1112#define OMAP4_LPDDR2IO1_GR7_WD_SHIFT 17
1113#define OMAP4_LPDDR2IO1_GR7_WD_MASK (0x3 << 17)
1114#define OMAP4_LPDDR2IO1_GR6_SR_SHIFT 14
1115#define OMAP4_LPDDR2IO1_GR6_SR_MASK (0x3 << 14)
1116#define OMAP4_LPDDR2IO1_GR6_I_SHIFT 11
1117#define OMAP4_LPDDR2IO1_GR6_I_MASK (0x7 << 11)
1118#define OMAP4_LPDDR2IO1_GR6_WD_SHIFT 9
1119#define OMAP4_LPDDR2IO1_GR6_WD_MASK (0x3 << 9)
1120#define OMAP4_LPDDR2IO1_GR5_SR_SHIFT 6
1121#define OMAP4_LPDDR2IO1_GR5_SR_MASK (0x3 << 6)
1122#define OMAP4_LPDDR2IO1_GR5_I_SHIFT 3
1123#define OMAP4_LPDDR2IO1_GR5_I_MASK (0x7 << 3)
1124#define OMAP4_LPDDR2IO1_GR5_WD_SHIFT 1
1125#define OMAP4_LPDDR2IO1_GR5_WD_MASK (0x3 << 1)
1126
1127/* CONTROL_LPDDR2IO1_2 */
1128#define OMAP4_LPDDR2IO1_GR11_SR_SHIFT 30
1129#define OMAP4_LPDDR2IO1_GR11_SR_MASK (0x3 << 30)
1130#define OMAP4_LPDDR2IO1_GR11_I_SHIFT 27
1131#define OMAP4_LPDDR2IO1_GR11_I_MASK (0x7 << 27)
1132#define OMAP4_LPDDR2IO1_GR11_WD_SHIFT 25
1133#define OMAP4_LPDDR2IO1_GR11_WD_MASK (0x3 << 25)
1134#define OMAP4_LPDDR2IO1_GR10_SR_SHIFT 22
1135#define OMAP4_LPDDR2IO1_GR10_SR_MASK (0x3 << 22)
1136#define OMAP4_LPDDR2IO1_GR10_I_SHIFT 19
1137#define OMAP4_LPDDR2IO1_GR10_I_MASK (0x7 << 19)
1138#define OMAP4_LPDDR2IO1_GR10_WD_SHIFT 17
1139#define OMAP4_LPDDR2IO1_GR10_WD_MASK (0x3 << 17)
1140#define OMAP4_LPDDR2IO1_GR9_SR_SHIFT 14
1141#define OMAP4_LPDDR2IO1_GR9_SR_MASK (0x3 << 14)
1142#define OMAP4_LPDDR2IO1_GR9_I_SHIFT 11
1143#define OMAP4_LPDDR2IO1_GR9_I_MASK (0x7 << 11)
1144#define OMAP4_LPDDR2IO1_GR9_WD_SHIFT 9
1145#define OMAP4_LPDDR2IO1_GR9_WD_MASK (0x3 << 9)
1146
1147/* CONTROL_LPDDR2IO1_3 */
1148#define OMAP4_LPDDR21_VREF_CA_CCAP0_SHIFT 31
1149#define OMAP4_LPDDR21_VREF_CA_CCAP0_MASK (1 << 31)
1150#define OMAP4_LPDDR21_VREF_CA_CCAP1_SHIFT 30
1151#define OMAP4_LPDDR21_VREF_CA_CCAP1_MASK (1 << 30)
1152#define OMAP4_LPDDR21_VREF_CA_INT_CCAP0_SHIFT 29
1153#define OMAP4_LPDDR21_VREF_CA_INT_CCAP0_MASK (1 << 29)
1154#define OMAP4_LPDDR21_VREF_CA_INT_CCAP1_SHIFT 28
1155#define OMAP4_LPDDR21_VREF_CA_INT_CCAP1_MASK (1 << 28)
1156#define OMAP4_LPDDR21_VREF_CA_INT_TAP0_SHIFT 27
1157#define OMAP4_LPDDR21_VREF_CA_INT_TAP0_MASK (1 << 27)
1158#define OMAP4_LPDDR21_VREF_CA_INT_TAP1_SHIFT 26
1159#define OMAP4_LPDDR21_VREF_CA_INT_TAP1_MASK (1 << 26)
1160#define OMAP4_LPDDR21_VREF_CA_TAP0_SHIFT 25
1161#define OMAP4_LPDDR21_VREF_CA_TAP0_MASK (1 << 25)
1162#define OMAP4_LPDDR21_VREF_CA_TAP1_SHIFT 24
1163#define OMAP4_LPDDR21_VREF_CA_TAP1_MASK (1 << 24)
1164#define OMAP4_LPDDR21_VREF_DQ0_INT_CCAP0_SHIFT 23
1165#define OMAP4_LPDDR21_VREF_DQ0_INT_CCAP0_MASK (1 << 23)
1166#define OMAP4_LPDDR21_VREF_DQ0_INT_CCAP1_SHIFT 22
1167#define OMAP4_LPDDR21_VREF_DQ0_INT_CCAP1_MASK (1 << 22)
1168#define OMAP4_LPDDR21_VREF_DQ0_INT_TAP0_SHIFT 21
1169#define OMAP4_LPDDR21_VREF_DQ0_INT_TAP0_MASK (1 << 21)
1170#define OMAP4_LPDDR21_VREF_DQ0_INT_TAP1_SHIFT 20
1171#define OMAP4_LPDDR21_VREF_DQ0_INT_TAP1_MASK (1 << 20)
1172#define OMAP4_LPDDR21_VREF_DQ1_INT_CCAP0_SHIFT 19
1173#define OMAP4_LPDDR21_VREF_DQ1_INT_CCAP0_MASK (1 << 19)
1174#define OMAP4_LPDDR21_VREF_DQ1_INT_CCAP1_SHIFT 18
1175#define OMAP4_LPDDR21_VREF_DQ1_INT_CCAP1_MASK (1 << 18)
1176#define OMAP4_LPDDR21_VREF_DQ1_INT_TAP0_SHIFT 17
1177#define OMAP4_LPDDR21_VREF_DQ1_INT_TAP0_MASK (1 << 17)
1178#define OMAP4_LPDDR21_VREF_DQ1_INT_TAP1_SHIFT 16
1179#define OMAP4_LPDDR21_VREF_DQ1_INT_TAP1_MASK (1 << 16)
1180#define OMAP4_LPDDR21_VREF_DQ_CCAP0_SHIFT 15
1181#define OMAP4_LPDDR21_VREF_DQ_CCAP0_MASK (1 << 15)
1182#define OMAP4_LPDDR21_VREF_DQ_CCAP1_SHIFT 14
1183#define OMAP4_LPDDR21_VREF_DQ_CCAP1_MASK (1 << 14)
1184#define OMAP4_LPDDR21_VREF_DQ_TAP0_SHIFT 13
1185#define OMAP4_LPDDR21_VREF_DQ_TAP0_MASK (1 << 13)
1186#define OMAP4_LPDDR21_VREF_DQ_TAP1_SHIFT 12
1187#define OMAP4_LPDDR21_VREF_DQ_TAP1_MASK (1 << 12)
1188
1189/* CONTROL_LPDDR2IO2_0 */
1190#define OMAP4_LPDDR2IO2_GR4_SR_SHIFT 30
1191#define OMAP4_LPDDR2IO2_GR4_SR_MASK (0x3 << 30)
1192#define OMAP4_LPDDR2IO2_GR4_I_SHIFT 27
1193#define OMAP4_LPDDR2IO2_GR4_I_MASK (0x7 << 27)
1194#define OMAP4_LPDDR2IO2_GR4_WD_SHIFT 25
1195#define OMAP4_LPDDR2IO2_GR4_WD_MASK (0x3 << 25)
1196#define OMAP4_LPDDR2IO2_GR3_SR_SHIFT 22
1197#define OMAP4_LPDDR2IO2_GR3_SR_MASK (0x3 << 22)
1198#define OMAP4_LPDDR2IO2_GR3_I_SHIFT 19
1199#define OMAP4_LPDDR2IO2_GR3_I_MASK (0x7 << 19)
1200#define OMAP4_LPDDR2IO2_GR3_WD_SHIFT 17
1201#define OMAP4_LPDDR2IO2_GR3_WD_MASK (0x3 << 17)
1202#define OMAP4_LPDDR2IO2_GR2_SR_SHIFT 14
1203#define OMAP4_LPDDR2IO2_GR2_SR_MASK (0x3 << 14)
1204#define OMAP4_LPDDR2IO2_GR2_I_SHIFT 11
1205#define OMAP4_LPDDR2IO2_GR2_I_MASK (0x7 << 11)
1206#define OMAP4_LPDDR2IO2_GR2_WD_SHIFT 9
1207#define OMAP4_LPDDR2IO2_GR2_WD_MASK (0x3 << 9)
1208#define OMAP4_LPDDR2IO2_GR1_SR_SHIFT 6
1209#define OMAP4_LPDDR2IO2_GR1_SR_MASK (0x3 << 6)
1210#define OMAP4_LPDDR2IO2_GR1_I_SHIFT 3
1211#define OMAP4_LPDDR2IO2_GR1_I_MASK (0x7 << 3)
1212#define OMAP4_LPDDR2IO2_GR1_WD_SHIFT 1
1213#define OMAP4_LPDDR2IO2_GR1_WD_MASK (0x3 << 1)
1214
1215/* CONTROL_LPDDR2IO2_1 */
1216#define OMAP4_LPDDR2IO2_GR8_SR_SHIFT 30
1217#define OMAP4_LPDDR2IO2_GR8_SR_MASK (0x3 << 30)
1218#define OMAP4_LPDDR2IO2_GR8_I_SHIFT 27
1219#define OMAP4_LPDDR2IO2_GR8_I_MASK (0x7 << 27)
1220#define OMAP4_LPDDR2IO2_GR8_WD_SHIFT 25
1221#define OMAP4_LPDDR2IO2_GR8_WD_MASK (0x3 << 25)
1222#define OMAP4_LPDDR2IO2_GR7_SR_SHIFT 22
1223#define OMAP4_LPDDR2IO2_GR7_SR_MASK (0x3 << 22)
1224#define OMAP4_LPDDR2IO2_GR7_I_SHIFT 19
1225#define OMAP4_LPDDR2IO2_GR7_I_MASK (0x7 << 19)
1226#define OMAP4_LPDDR2IO2_GR7_WD_SHIFT 17
1227#define OMAP4_LPDDR2IO2_GR7_WD_MASK (0x3 << 17)
1228#define OMAP4_LPDDR2IO2_GR6_SR_SHIFT 14
1229#define OMAP4_LPDDR2IO2_GR6_SR_MASK (0x3 << 14)
1230#define OMAP4_LPDDR2IO2_GR6_I_SHIFT 11
1231#define OMAP4_LPDDR2IO2_GR6_I_MASK (0x7 << 11)
1232#define OMAP4_LPDDR2IO2_GR6_WD_SHIFT 9
1233#define OMAP4_LPDDR2IO2_GR6_WD_MASK (0x3 << 9)
1234#define OMAP4_LPDDR2IO2_GR5_SR_SHIFT 6
1235#define OMAP4_LPDDR2IO2_GR5_SR_MASK (0x3 << 6)
1236#define OMAP4_LPDDR2IO2_GR5_I_SHIFT 3
1237#define OMAP4_LPDDR2IO2_GR5_I_MASK (0x7 << 3)
1238#define OMAP4_LPDDR2IO2_GR5_WD_SHIFT 1
1239#define OMAP4_LPDDR2IO2_GR5_WD_MASK (0x3 << 1)
1240
1241/* CONTROL_LPDDR2IO2_2 */
1242#define OMAP4_LPDDR2IO2_GR11_SR_SHIFT 30
1243#define OMAP4_LPDDR2IO2_GR11_SR_MASK (0x3 << 30)
1244#define OMAP4_LPDDR2IO2_GR11_I_SHIFT 27
1245#define OMAP4_LPDDR2IO2_GR11_I_MASK (0x7 << 27)
1246#define OMAP4_LPDDR2IO2_GR11_WD_SHIFT 25
1247#define OMAP4_LPDDR2IO2_GR11_WD_MASK (0x3 << 25)
1248#define OMAP4_LPDDR2IO2_GR10_SR_SHIFT 22
1249#define OMAP4_LPDDR2IO2_GR10_SR_MASK (0x3 << 22)
1250#define OMAP4_LPDDR2IO2_GR10_I_SHIFT 19
1251#define OMAP4_LPDDR2IO2_GR10_I_MASK (0x7 << 19)
1252#define OMAP4_LPDDR2IO2_GR10_WD_SHIFT 17
1253#define OMAP4_LPDDR2IO2_GR10_WD_MASK (0x3 << 17)
1254#define OMAP4_LPDDR2IO2_GR9_SR_SHIFT 14
1255#define OMAP4_LPDDR2IO2_GR9_SR_MASK (0x3 << 14)
1256#define OMAP4_LPDDR2IO2_GR9_I_SHIFT 11
1257#define OMAP4_LPDDR2IO2_GR9_I_MASK (0x7 << 11)
1258#define OMAP4_LPDDR2IO2_GR9_WD_SHIFT 9
1259#define OMAP4_LPDDR2IO2_GR9_WD_MASK (0x3 << 9)
1260
1261/* CONTROL_LPDDR2IO2_3 */
1262#define OMAP4_LPDDR22_VREF_CA_CCAP0_SHIFT 31
1263#define OMAP4_LPDDR22_VREF_CA_CCAP0_MASK (1 << 31)
1264#define OMAP4_LPDDR22_VREF_CA_CCAP1_SHIFT 30
1265#define OMAP4_LPDDR22_VREF_CA_CCAP1_MASK (1 << 30)
1266#define OMAP4_LPDDR22_VREF_CA_INT_CCAP0_SHIFT 29
1267#define OMAP4_LPDDR22_VREF_CA_INT_CCAP0_MASK (1 << 29)
1268#define OMAP4_LPDDR22_VREF_CA_INT_CCAP1_SHIFT 28
1269#define OMAP4_LPDDR22_VREF_CA_INT_CCAP1_MASK (1 << 28)
1270#define OMAP4_LPDDR22_VREF_CA_INT_TAP0_SHIFT 27
1271#define OMAP4_LPDDR22_VREF_CA_INT_TAP0_MASK (1 << 27)
1272#define OMAP4_LPDDR22_VREF_CA_INT_TAP1_SHIFT 26
1273#define OMAP4_LPDDR22_VREF_CA_INT_TAP1_MASK (1 << 26)
1274#define OMAP4_LPDDR22_VREF_CA_TAP0_SHIFT 25
1275#define OMAP4_LPDDR22_VREF_CA_TAP0_MASK (1 << 25)
1276#define OMAP4_LPDDR22_VREF_CA_TAP1_SHIFT 24
1277#define OMAP4_LPDDR22_VREF_CA_TAP1_MASK (1 << 24)
1278#define OMAP4_LPDDR22_VREF_DQ0_INT_CCAP0_SHIFT 23
1279#define OMAP4_LPDDR22_VREF_DQ0_INT_CCAP0_MASK (1 << 23)
1280#define OMAP4_LPDDR22_VREF_DQ0_INT_CCAP1_SHIFT 22
1281#define OMAP4_LPDDR22_VREF_DQ0_INT_CCAP1_MASK (1 << 22)
1282#define OMAP4_LPDDR22_VREF_DQ0_INT_TAP0_SHIFT 21
1283#define OMAP4_LPDDR22_VREF_DQ0_INT_TAP0_MASK (1 << 21)
1284#define OMAP4_LPDDR22_VREF_DQ0_INT_TAP1_SHIFT 20
1285#define OMAP4_LPDDR22_VREF_DQ0_INT_TAP1_MASK (1 << 20)
1286#define OMAP4_LPDDR22_VREF_DQ1_INT_CCAP0_SHIFT 19
1287#define OMAP4_LPDDR22_VREF_DQ1_INT_CCAP0_MASK (1 << 19)
1288#define OMAP4_LPDDR22_VREF_DQ1_INT_CCAP1_SHIFT 18
1289#define OMAP4_LPDDR22_VREF_DQ1_INT_CCAP1_MASK (1 << 18)
1290#define OMAP4_LPDDR22_VREF_DQ1_INT_TAP0_SHIFT 17
1291#define OMAP4_LPDDR22_VREF_DQ1_INT_TAP0_MASK (1 << 17)
1292#define OMAP4_LPDDR22_VREF_DQ1_INT_TAP1_SHIFT 16
1293#define OMAP4_LPDDR22_VREF_DQ1_INT_TAP1_MASK (1 << 16)
1294#define OMAP4_LPDDR22_VREF_DQ_CCAP0_SHIFT 15
1295#define OMAP4_LPDDR22_VREF_DQ_CCAP0_MASK (1 << 15)
1296#define OMAP4_LPDDR22_VREF_DQ_CCAP1_SHIFT 14
1297#define OMAP4_LPDDR22_VREF_DQ_CCAP1_MASK (1 << 14)
1298#define OMAP4_LPDDR22_VREF_DQ_TAP0_SHIFT 13
1299#define OMAP4_LPDDR22_VREF_DQ_TAP0_MASK (1 << 13)
1300#define OMAP4_LPDDR22_VREF_DQ_TAP1_SHIFT 12
1301#define OMAP4_LPDDR22_VREF_DQ_TAP1_MASK (1 << 12)
1302
1303/* CONTROL_BUS_HOLD */
1304#define OMAP4_ABE_DMIC_DIN3_EN_SHIFT 31
1305#define OMAP4_ABE_DMIC_DIN3_EN_MASK (1 << 31)
1306#define OMAP4_MCSPI1_CS3_EN_SHIFT 30
1307#define OMAP4_MCSPI1_CS3_EN_MASK (1 << 30)
1308
1309/* CONTROL_C2C */
1310#define OMAP4_MIRROR_MODE_EN_SHIFT 31
1311#define OMAP4_MIRROR_MODE_EN_MASK (1 << 31)
1312#define OMAP4_C2C_SPARE_SHIFT 24
1313#define OMAP4_C2C_SPARE_MASK (0x7f << 24)
1314
1315/* CORE_CONTROL_SPARE_RW */
1316#define OMAP4_CORE_CONTROL_SPARE_RW_SHIFT 0
1317#define OMAP4_CORE_CONTROL_SPARE_RW_MASK (0xffffffff << 0)
1318
1319/* CORE_CONTROL_SPARE_R */
1320#define OMAP4_CORE_CONTROL_SPARE_R_SHIFT 0
1321#define OMAP4_CORE_CONTROL_SPARE_R_MASK (0xffffffff << 0)
1322
1323/* CORE_CONTROL_SPARE_R_C0 */
1324#define OMAP4_CORE_CONTROL_SPARE_R_C0_SHIFT 31
1325#define OMAP4_CORE_CONTROL_SPARE_R_C0_MASK (1 << 31)
1326#define OMAP4_CORE_CONTROL_SPARE_R_C1_SHIFT 30
1327#define OMAP4_CORE_CONTROL_SPARE_R_C1_MASK (1 << 30)
1328#define OMAP4_CORE_CONTROL_SPARE_R_C2_SHIFT 29
1329#define OMAP4_CORE_CONTROL_SPARE_R_C2_MASK (1 << 29)
1330#define OMAP4_CORE_CONTROL_SPARE_R_C3_SHIFT 28
1331#define OMAP4_CORE_CONTROL_SPARE_R_C3_MASK (1 << 28)
1332#define OMAP4_CORE_CONTROL_SPARE_R_C4_SHIFT 27
1333#define OMAP4_CORE_CONTROL_SPARE_R_C4_MASK (1 << 27)
1334#define OMAP4_CORE_CONTROL_SPARE_R_C5_SHIFT 26
1335#define OMAP4_CORE_CONTROL_SPARE_R_C5_MASK (1 << 26)
1336#define OMAP4_CORE_CONTROL_SPARE_R_C6_SHIFT 25
1337#define OMAP4_CORE_CONTROL_SPARE_R_C6_MASK (1 << 25)
1338#define OMAP4_CORE_CONTROL_SPARE_R_C7_SHIFT 24
1339#define OMAP4_CORE_CONTROL_SPARE_R_C7_MASK (1 << 24)
1340
1341/* CONTROL_EFUSE_1 */
1342#define OMAP4_AVDAC_TRIM_BYTE3_SHIFT 24
1343#define OMAP4_AVDAC_TRIM_BYTE3_MASK (0x7f << 24)
1344#define OMAP4_AVDAC_TRIM_BYTE2_SHIFT 16
1345#define OMAP4_AVDAC_TRIM_BYTE2_MASK (0xff << 16)
1346#define OMAP4_AVDAC_TRIM_BYTE1_SHIFT 8
1347#define OMAP4_AVDAC_TRIM_BYTE1_MASK (0xff << 8)
1348#define OMAP4_AVDAC_TRIM_BYTE0_SHIFT 0
1349#define OMAP4_AVDAC_TRIM_BYTE0_MASK (0xff << 0)
1350
1351/* CONTROL_EFUSE_2 */
1352#define OMAP4_EFUSE_SMART2TEST_P0_SHIFT 31
1353#define OMAP4_EFUSE_SMART2TEST_P0_MASK (1 << 31)
1354#define OMAP4_EFUSE_SMART2TEST_P1_SHIFT 30
1355#define OMAP4_EFUSE_SMART2TEST_P1_MASK (1 << 30)
1356#define OMAP4_EFUSE_SMART2TEST_P2_SHIFT 29
1357#define OMAP4_EFUSE_SMART2TEST_P2_MASK (1 << 29)
1358#define OMAP4_EFUSE_SMART2TEST_P3_SHIFT 28
1359#define OMAP4_EFUSE_SMART2TEST_P3_MASK (1 << 28)
1360#define OMAP4_EFUSE_SMART2TEST_N0_SHIFT 27
1361#define OMAP4_EFUSE_SMART2TEST_N0_MASK (1 << 27)
1362#define OMAP4_EFUSE_SMART2TEST_N1_SHIFT 26
1363#define OMAP4_EFUSE_SMART2TEST_N1_MASK (1 << 26)
1364#define OMAP4_EFUSE_SMART2TEST_N2_SHIFT 25
1365#define OMAP4_EFUSE_SMART2TEST_N2_MASK (1 << 25)
1366#define OMAP4_EFUSE_SMART2TEST_N3_SHIFT 24
1367#define OMAP4_EFUSE_SMART2TEST_N3_MASK (1 << 24)
1368#define OMAP4_LPDDR2_PTV_N1_SHIFT 23
1369#define OMAP4_LPDDR2_PTV_N1_MASK (1 << 23)
1370#define OMAP4_LPDDR2_PTV_N2_SHIFT 22
1371#define OMAP4_LPDDR2_PTV_N2_MASK (1 << 22)
1372#define OMAP4_LPDDR2_PTV_N3_SHIFT 21
1373#define OMAP4_LPDDR2_PTV_N3_MASK (1 << 21)
1374#define OMAP4_LPDDR2_PTV_N4_SHIFT 20
1375#define OMAP4_LPDDR2_PTV_N4_MASK (1 << 20)
1376#define OMAP4_LPDDR2_PTV_N5_SHIFT 19
1377#define OMAP4_LPDDR2_PTV_N5_MASK (1 << 19)
1378#define OMAP4_LPDDR2_PTV_P1_SHIFT 18
1379#define OMAP4_LPDDR2_PTV_P1_MASK (1 << 18)
1380#define OMAP4_LPDDR2_PTV_P2_SHIFT 17
1381#define OMAP4_LPDDR2_PTV_P2_MASK (1 << 17)
1382#define OMAP4_LPDDR2_PTV_P3_SHIFT 16
1383#define OMAP4_LPDDR2_PTV_P3_MASK (1 << 16)
1384#define OMAP4_LPDDR2_PTV_P4_SHIFT 15
1385#define OMAP4_LPDDR2_PTV_P4_MASK (1 << 15)
1386#define OMAP4_LPDDR2_PTV_P5_SHIFT 14
1387#define OMAP4_LPDDR2_PTV_P5_MASK (1 << 14)
1388
1389/* CONTROL_EFUSE_3 */
1390#define OMAP4_STD_FUSE_SPARE_1_SHIFT 24
1391#define OMAP4_STD_FUSE_SPARE_1_MASK (0xff << 24)
1392#define OMAP4_STD_FUSE_SPARE_2_SHIFT 16
1393#define OMAP4_STD_FUSE_SPARE_2_MASK (0xff << 16)
1394#define OMAP4_STD_FUSE_SPARE_3_SHIFT 8
1395#define OMAP4_STD_FUSE_SPARE_3_MASK (0xff << 8)
1396#define OMAP4_STD_FUSE_SPARE_4_SHIFT 0
1397#define OMAP4_STD_FUSE_SPARE_4_MASK (0xff << 0)
1398
1399/* CONTROL_EFUSE_4 */
1400#define OMAP4_STD_FUSE_SPARE_5_SHIFT 24
1401#define OMAP4_STD_FUSE_SPARE_5_MASK (0xff << 24)
1402#define OMAP4_STD_FUSE_SPARE_6_SHIFT 16
1403#define OMAP4_STD_FUSE_SPARE_6_MASK (0xff << 16)
1404#define OMAP4_STD_FUSE_SPARE_7_SHIFT 8
1405#define OMAP4_STD_FUSE_SPARE_7_MASK (0xff << 8)
1406#define OMAP4_STD_FUSE_SPARE_8_SHIFT 0
1407#define OMAP4_STD_FUSE_SPARE_8_MASK (0xff << 0)
1408
1409#endif
diff --git a/arch/arm/mach-omap2/ctrl_module_pad_wkup_44xx.h b/arch/arm/mach-omap2/ctrl_module_pad_wkup_44xx.h
deleted file mode 100644
index 17c9b37042c0..000000000000
--- a/arch/arm/mach-omap2/ctrl_module_pad_wkup_44xx.h
+++ /dev/null
@@ -1,236 +0,0 @@
1/*
2 * OMAP44xx CTRL_MODULE_PAD_WKUP registers and bitfields
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 *
9 * This file is automatically generated from the OMAP hardware databases.
10 * We respectfully ask that any modifications to this file be coordinated
11 * with the public linux-omap@vger.kernel.org mailing list and the
12 * authors above to ensure that the autogeneration scripts are kept
13 * up-to-date with the file contents.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_PAD_WKUP_44XX_H
21#define __ARCH_ARM_MACH_OMAP2_CTRL_MODULE_PAD_WKUP_44XX_H
22
23
24/* Base address */
25#define OMAP4_CTRL_MODULE_PAD_WKUP 0x4a31e000
26
27/* Registers offset */
28#define OMAP4_CTRL_MODULE_PAD_WKUP_IP_REVISION 0x0000
29#define OMAP4_CTRL_MODULE_PAD_WKUP_IP_HWINFO 0x0004
30#define OMAP4_CTRL_MODULE_PAD_WKUP_IP_SYSCONFIG 0x0010
31#define OMAP4_CTRL_MODULE_PAD_WKUP_PADCONF_WAKEUPEVENT_0 0x007c
32#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_SMART1NOPMIO_PADCONF_0 0x05a0
33#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_SMART1NOPMIO_PADCONF_1 0x05a4
34#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_PADCONF_MODE 0x05a8
35#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_XTAL_OSCILLATOR 0x05ac
36#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_USIMIO 0x0600
37#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2 0x0604
38#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_JTAG 0x0608
39#define OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_SYS 0x060c
40#define OMAP4_CTRL_MODULE_PAD_WKUP_WKUP_CONTROL_SPARE_RW 0x0614
41#define OMAP4_CTRL_MODULE_PAD_WKUP_WKUP_CONTROL_SPARE_R 0x0618
42#define OMAP4_CTRL_MODULE_PAD_WKUP_WKUP_CONTROL_SPARE_R_C0 0x061c
43
44/* Registers shifts and masks */
45
46/* IP_REVISION */
47#define OMAP4_IP_REV_SCHEME_SHIFT 30
48#define OMAP4_IP_REV_SCHEME_MASK (0x3 << 30)
49#define OMAP4_IP_REV_FUNC_SHIFT 16
50#define OMAP4_IP_REV_FUNC_MASK (0xfff << 16)
51#define OMAP4_IP_REV_RTL_SHIFT 11
52#define OMAP4_IP_REV_RTL_MASK (0x1f << 11)
53#define OMAP4_IP_REV_MAJOR_SHIFT 8
54#define OMAP4_IP_REV_MAJOR_MASK (0x7 << 8)
55#define OMAP4_IP_REV_CUSTOM_SHIFT 6
56#define OMAP4_IP_REV_CUSTOM_MASK (0x3 << 6)
57#define OMAP4_IP_REV_MINOR_SHIFT 0
58#define OMAP4_IP_REV_MINOR_MASK (0x3f << 0)
59
60/* IP_HWINFO */
61#define OMAP4_IP_HWINFO_SHIFT 0
62#define OMAP4_IP_HWINFO_MASK (0xffffffff << 0)
63
64/* IP_SYSCONFIG */
65#define OMAP4_IP_SYSCONFIG_IDLEMODE_SHIFT 2
66#define OMAP4_IP_SYSCONFIG_IDLEMODE_MASK (0x3 << 2)
67
68/* PADCONF_WAKEUPEVENT_0 */
69#define OMAP4_JTAG_TDO_DUPLICATEWAKEUPEVENT_SHIFT 24
70#define OMAP4_JTAG_TDO_DUPLICATEWAKEUPEVENT_MASK (1 << 24)
71#define OMAP4_JTAG_TDI_DUPLICATEWAKEUPEVENT_SHIFT 23
72#define OMAP4_JTAG_TDI_DUPLICATEWAKEUPEVENT_MASK (1 << 23)
73#define OMAP4_JTAG_TMS_TMSC_DUPLICATEWAKEUPEVENT_SHIFT 22
74#define OMAP4_JTAG_TMS_TMSC_DUPLICATEWAKEUPEVENT_MASK (1 << 22)
75#define OMAP4_JTAG_RTCK_DUPLICATEWAKEUPEVENT_SHIFT 21
76#define OMAP4_JTAG_RTCK_DUPLICATEWAKEUPEVENT_MASK (1 << 21)
77#define OMAP4_JTAG_TCK_DUPLICATEWAKEUPEVENT_SHIFT 20
78#define OMAP4_JTAG_TCK_DUPLICATEWAKEUPEVENT_MASK (1 << 20)
79#define OMAP4_JTAG_NTRST_DUPLICATEWAKEUPEVENT_SHIFT 19
80#define OMAP4_JTAG_NTRST_DUPLICATEWAKEUPEVENT_MASK (1 << 19)
81#define OMAP4_SYS_BOOT7_DUPLICATEWAKEUPEVENT_SHIFT 18
82#define OMAP4_SYS_BOOT7_DUPLICATEWAKEUPEVENT_MASK (1 << 18)
83#define OMAP4_SYS_BOOT6_DUPLICATEWAKEUPEVENT_SHIFT 17
84#define OMAP4_SYS_BOOT6_DUPLICATEWAKEUPEVENT_MASK (1 << 17)
85#define OMAP4_SYS_PWRON_RESET_OUT_DUPLICATEWAKEUPEVENT_SHIFT 16
86#define OMAP4_SYS_PWRON_RESET_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 16)
87#define OMAP4_SYS_PWR_REQ_DUPLICATEWAKEUPEVENT_SHIFT 15
88#define OMAP4_SYS_PWR_REQ_DUPLICATEWAKEUPEVENT_MASK (1 << 15)
89#define OMAP4_SYS_NRESWARM_DUPLICATEWAKEUPEVENT_SHIFT 14
90#define OMAP4_SYS_NRESWARM_DUPLICATEWAKEUPEVENT_MASK (1 << 14)
91#define OMAP4_SYS_32K_DUPLICATEWAKEUPEVENT_SHIFT 13
92#define OMAP4_SYS_32K_DUPLICATEWAKEUPEVENT_MASK (1 << 13)
93#define OMAP4_FREF_CLK4_OUT_DUPLICATEWAKEUPEVENT_SHIFT 12
94#define OMAP4_FREF_CLK4_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 12)
95#define OMAP4_FREF_CLK4_REQ_DUPLICATEWAKEUPEVENT_SHIFT 11
96#define OMAP4_FREF_CLK4_REQ_DUPLICATEWAKEUPEVENT_MASK (1 << 11)
97#define OMAP4_FREF_CLK3_OUT_DUPLICATEWAKEUPEVENT_SHIFT 10
98#define OMAP4_FREF_CLK3_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 10)
99#define OMAP4_FREF_CLK3_REQ_DUPLICATEWAKEUPEVENT_SHIFT 9
100#define OMAP4_FREF_CLK3_REQ_DUPLICATEWAKEUPEVENT_MASK (1 << 9)
101#define OMAP4_FREF_CLK0_OUT_DUPLICATEWAKEUPEVENT_SHIFT 8
102#define OMAP4_FREF_CLK0_OUT_DUPLICATEWAKEUPEVENT_MASK (1 << 8)
103#define OMAP4_FREF_CLK_IOREQ_DUPLICATEWAKEUPEVENT_SHIFT 7
104#define OMAP4_FREF_CLK_IOREQ_DUPLICATEWAKEUPEVENT_MASK (1 << 7)
105#define OMAP4_SR_SDA_DUPLICATEWAKEUPEVENT_SHIFT 6
106#define OMAP4_SR_SDA_DUPLICATEWAKEUPEVENT_MASK (1 << 6)
107#define OMAP4_SR_SCL_DUPLICATEWAKEUPEVENT_SHIFT 5
108#define OMAP4_SR_SCL_DUPLICATEWAKEUPEVENT_MASK (1 << 5)
109#define OMAP4_SIM_PWRCTRL_DUPLICATEWAKEUPEVENT_SHIFT 4
110#define OMAP4_SIM_PWRCTRL_DUPLICATEWAKEUPEVENT_MASK (1 << 4)
111#define OMAP4_SIM_CD_DUPLICATEWAKEUPEVENT_SHIFT 3
112#define OMAP4_SIM_CD_DUPLICATEWAKEUPEVENT_MASK (1 << 3)
113#define OMAP4_SIM_RESET_DUPLICATEWAKEUPEVENT_SHIFT 2
114#define OMAP4_SIM_RESET_DUPLICATEWAKEUPEVENT_MASK (1 << 2)
115#define OMAP4_SIM_CLK_DUPLICATEWAKEUPEVENT_SHIFT 1
116#define OMAP4_SIM_CLK_DUPLICATEWAKEUPEVENT_MASK (1 << 1)
117#define OMAP4_SIM_IO_DUPLICATEWAKEUPEVENT_SHIFT 0
118#define OMAP4_SIM_IO_DUPLICATEWAKEUPEVENT_MASK (1 << 0)
119
120/* CONTROL_SMART1NOPMIO_PADCONF_0 */
121#define OMAP4_FREF_DR0_SC_SHIFT 30
122#define OMAP4_FREF_DR0_SC_MASK (0x3 << 30)
123#define OMAP4_FREF_DR1_SC_SHIFT 28
124#define OMAP4_FREF_DR1_SC_MASK (0x3 << 28)
125#define OMAP4_FREF_DR4_SC_SHIFT 26
126#define OMAP4_FREF_DR4_SC_MASK (0x3 << 26)
127#define OMAP4_FREF_DR5_SC_SHIFT 24
128#define OMAP4_FREF_DR5_SC_MASK (0x3 << 24)
129#define OMAP4_FREF_DR6_SC_SHIFT 22
130#define OMAP4_FREF_DR6_SC_MASK (0x3 << 22)
131#define OMAP4_FREF_DR7_SC_SHIFT 20
132#define OMAP4_FREF_DR7_SC_MASK (0x3 << 20)
133#define OMAP4_GPIO_DR7_SC_SHIFT 18
134#define OMAP4_GPIO_DR7_SC_MASK (0x3 << 18)
135#define OMAP4_DPM_DR0_SC_SHIFT 14
136#define OMAP4_DPM_DR0_SC_MASK (0x3 << 14)
137#define OMAP4_SIM_DR0_SC_SHIFT 12
138#define OMAP4_SIM_DR0_SC_MASK (0x3 << 12)
139
140/* CONTROL_SMART1NOPMIO_PADCONF_1 */
141#define OMAP4_FREF_DR0_LB_SHIFT 30
142#define OMAP4_FREF_DR0_LB_MASK (0x3 << 30)
143#define OMAP4_FREF_DR1_LB_SHIFT 28
144#define OMAP4_FREF_DR1_LB_MASK (0x3 << 28)
145#define OMAP4_FREF_DR4_LB_SHIFT 26
146#define OMAP4_FREF_DR4_LB_MASK (0x3 << 26)
147#define OMAP4_FREF_DR5_LB_SHIFT 24
148#define OMAP4_FREF_DR5_LB_MASK (0x3 << 24)
149#define OMAP4_FREF_DR6_LB_SHIFT 22
150#define OMAP4_FREF_DR6_LB_MASK (0x3 << 22)
151#define OMAP4_FREF_DR7_LB_SHIFT 20
152#define OMAP4_FREF_DR7_LB_MASK (0x3 << 20)
153#define OMAP4_GPIO_DR7_LB_SHIFT 18
154#define OMAP4_GPIO_DR7_LB_MASK (0x3 << 18)
155#define OMAP4_DPM_DR0_LB_SHIFT 14
156#define OMAP4_DPM_DR0_LB_MASK (0x3 << 14)
157#define OMAP4_SIM_DR0_LB_SHIFT 12
158#define OMAP4_SIM_DR0_LB_MASK (0x3 << 12)
159
160/* CONTROL_PADCONF_MODE */
161#define OMAP4_VDDS_DV_FREF_SHIFT 31
162#define OMAP4_VDDS_DV_FREF_MASK (1 << 31)
163#define OMAP4_VDDS_DV_BANK2_SHIFT 30
164#define OMAP4_VDDS_DV_BANK2_MASK (1 << 30)
165
166/* CONTROL_XTAL_OSCILLATOR */
167#define OMAP4_OSCILLATOR_BOOST_SHIFT 31
168#define OMAP4_OSCILLATOR_BOOST_MASK (1 << 31)
169#define OMAP4_OSCILLATOR_OS_OUT_SHIFT 30
170#define OMAP4_OSCILLATOR_OS_OUT_MASK (1 << 30)
171
172/* CONTROL_USIMIO */
173#define OMAP4_PAD_USIM_CLK_LOW_SHIFT 31
174#define OMAP4_PAD_USIM_CLK_LOW_MASK (1 << 31)
175#define OMAP4_PAD_USIM_RST_LOW_SHIFT 29
176#define OMAP4_PAD_USIM_RST_LOW_MASK (1 << 29)
177#define OMAP4_USIM_PWRDNZ_SHIFT 28
178#define OMAP4_USIM_PWRDNZ_MASK (1 << 28)
179
180/* CONTROL_I2C_2 */
181#define OMAP4_SR_SDA_GLFENB_SHIFT 31
182#define OMAP4_SR_SDA_GLFENB_MASK (1 << 31)
183#define OMAP4_SR_SDA_LOAD_BITS_SHIFT 29
184#define OMAP4_SR_SDA_LOAD_BITS_MASK (0x3 << 29)
185#define OMAP4_SR_SDA_PULLUPRESX_SHIFT 28
186#define OMAP4_SR_SDA_PULLUPRESX_MASK (1 << 28)
187#define OMAP4_SR_SCL_GLFENB_SHIFT 27
188#define OMAP4_SR_SCL_GLFENB_MASK (1 << 27)
189#define OMAP4_SR_SCL_LOAD_BITS_SHIFT 25
190#define OMAP4_SR_SCL_LOAD_BITS_MASK (0x3 << 25)
191#define OMAP4_SR_SCL_PULLUPRESX_SHIFT 24
192#define OMAP4_SR_SCL_PULLUPRESX_MASK (1 << 24)
193
194/* CONTROL_JTAG */
195#define OMAP4_JTAG_NTRST_EN_SHIFT 31
196#define OMAP4_JTAG_NTRST_EN_MASK (1 << 31)
197#define OMAP4_JTAG_TCK_EN_SHIFT 30
198#define OMAP4_JTAG_TCK_EN_MASK (1 << 30)
199#define OMAP4_JTAG_RTCK_EN_SHIFT 29
200#define OMAP4_JTAG_RTCK_EN_MASK (1 << 29)
201#define OMAP4_JTAG_TDI_EN_SHIFT 28
202#define OMAP4_JTAG_TDI_EN_MASK (1 << 28)
203#define OMAP4_JTAG_TDO_EN_SHIFT 27
204#define OMAP4_JTAG_TDO_EN_MASK (1 << 27)
205
206/* CONTROL_SYS */
207#define OMAP4_SYS_NRESWARM_PIPU_SHIFT 31
208#define OMAP4_SYS_NRESWARM_PIPU_MASK (1 << 31)
209
210/* WKUP_CONTROL_SPARE_RW */
211#define OMAP4_WKUP_CONTROL_SPARE_RW_SHIFT 0
212#define OMAP4_WKUP_CONTROL_SPARE_RW_MASK (0xffffffff << 0)
213
214/* WKUP_CONTROL_SPARE_R */
215#define OMAP4_WKUP_CONTROL_SPARE_R_SHIFT 0
216#define OMAP4_WKUP_CONTROL_SPARE_R_MASK (0xffffffff << 0)
217
218/* WKUP_CONTROL_SPARE_R_C0 */
219#define OMAP4_WKUP_CONTROL_SPARE_R_C0_SHIFT 31
220#define OMAP4_WKUP_CONTROL_SPARE_R_C0_MASK (1 << 31)
221#define OMAP4_WKUP_CONTROL_SPARE_R_C1_SHIFT 30
222#define OMAP4_WKUP_CONTROL_SPARE_R_C1_MASK (1 << 30)
223#define OMAP4_WKUP_CONTROL_SPARE_R_C2_SHIFT 29
224#define OMAP4_WKUP_CONTROL_SPARE_R_C2_MASK (1 << 29)
225#define OMAP4_WKUP_CONTROL_SPARE_R_C3_SHIFT 28
226#define OMAP4_WKUP_CONTROL_SPARE_R_C3_MASK (1 << 28)
227#define OMAP4_WKUP_CONTROL_SPARE_R_C4_SHIFT 27
228#define OMAP4_WKUP_CONTROL_SPARE_R_C4_MASK (1 << 27)
229#define OMAP4_WKUP_CONTROL_SPARE_R_C5_SHIFT 26
230#define OMAP4_WKUP_CONTROL_SPARE_R_C5_MASK (1 << 26)
231#define OMAP4_WKUP_CONTROL_SPARE_R_C6_SHIFT 25
232#define OMAP4_WKUP_CONTROL_SPARE_R_C6_MASK (1 << 25)
233#define OMAP4_WKUP_CONTROL_SPARE_R_C7_SHIFT 24
234#define OMAP4_WKUP_CONTROL_SPARE_R_C7_MASK (1 << 24)
235
236#endif
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index b6f8f348296e..324f02bf8a51 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -432,9 +432,9 @@ static int __init omap2_init_devices(void)
432 */ 432 */
433 omap_init_audio(); 433 omap_init_audio();
434 omap_init_camera(); 434 omap_init_camera();
435 omap_init_mbox();
436 /* If dtb is there, the devices will be created dynamically */ 435 /* If dtb is there, the devices will be created dynamically */
437 if (!of_have_populated_dt()) { 436 if (!of_have_populated_dt()) {
437 omap_init_mbox();
438 omap_init_mcspi(); 438 omap_init_mcspi();
439 omap_init_sham(); 439 omap_init_sham();
440 omap_init_aes(); 440 omap_init_aes();
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index a6d2cf1f8d02..e1a56d87599e 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -259,6 +259,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
259 if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP)) 259 if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
260 d->dev_caps |= HS_CHANNELS_RESERVED; 260 d->dev_caps |= HS_CHANNELS_RESERVED;
261 261
262 if (platform_get_irq_byname(pdev, "0") < 0)
263 d->dev_caps |= DMA_ENGINE_HANDLE_IRQ;
264
262 /* Check the capabilities register for descriptor loading feature */ 265 /* Check the capabilities register for descriptor loading feature */
263 if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS) 266 if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
264 dma_common_ch_end = CCDN; 267 dma_common_ch_end = CCDN;
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 6d7ba37e2257..ac3d789ac3cd 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -28,11 +28,8 @@
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/clkdev.h> 29#include <linux/clkdev.h>
30 30
31#include "soc.h"
32#include "clockdomain.h" 31#include "clockdomain.h"
33#include "clock.h" 32#include "clock.h"
34#include "cm2xxx_3xxx.h"
35#include "cm-regbits-34xx.h"
36 33
37/* CM_AUTOIDLE_PLL*.AUTO_* bit values */ 34/* CM_AUTOIDLE_PLL*.AUTO_* bit values */
38#define DPLL_AUTOIDLE_DISABLE 0x0 35#define DPLL_AUTOIDLE_DISABLE 0x0
@@ -310,7 +307,7 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
310 * Set jitter correction. Jitter correction applicable for OMAP343X 307 * Set jitter correction. Jitter correction applicable for OMAP343X
311 * only since freqsel field is no longer present on other devices. 308 * only since freqsel field is no longer present on other devices.
312 */ 309 */
313 if (cpu_is_omap343x()) { 310 if (ti_clk_features.flags & TI_CLK_DPLL_HAS_FREQSEL) {
314 v = omap2_clk_readl(clk, dd->control_reg); 311 v = omap2_clk_readl(clk, dd->control_reg);
315 v &= ~dd->freqsel_mask; 312 v &= ~dd->freqsel_mask;
316 v |= freqsel << __ffs(dd->freqsel_mask); 313 v |= freqsel << __ffs(dd->freqsel_mask);
@@ -478,6 +475,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
478{ 475{
479 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 476 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
480 struct clk *new_parent = NULL; 477 struct clk *new_parent = NULL;
478 unsigned long rrate;
481 u16 freqsel = 0; 479 u16 freqsel = 0;
482 struct dpll_data *dd; 480 struct dpll_data *dd;
483 int ret; 481 int ret;
@@ -505,14 +503,22 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
505 __clk_prepare(dd->clk_ref); 503 __clk_prepare(dd->clk_ref);
506 clk_enable(dd->clk_ref); 504 clk_enable(dd->clk_ref);
507 505
508 if (dd->last_rounded_rate != rate) 506 /* XXX this check is probably pointless in the CCF context */
509 rate = __clk_round_rate(hw->clk, rate); 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 }
510 516
511 if (dd->last_rounded_rate == 0) 517 if (dd->last_rounded_rate == 0)
512 return -EINVAL; 518 return -EINVAL;
513 519
514 /* Freqsel is available only on OMAP343X devices */ 520 /* Freqsel is available only on OMAP343X devices */
515 if (cpu_is_omap343x()) { 521 if (ti_clk_features.flags & TI_CLK_DPLL_HAS_FREQSEL) {
516 freqsel = _omap3_dpll_compute_freqsel(clk, 522 freqsel = _omap3_dpll_compute_freqsel(clk,
517 dd->last_rounded_n); 523 dd->last_rounded_n);
518 WARN_ON(!freqsel); 524 WARN_ON(!freqsel);
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 52f9438b92f2..4613f1e86988 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -15,10 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include "soc.h"
19#include "clock.h" 18#include "clock.h"
20#include "clock44xx.h"
21#include "cm-regbits-44xx.h"
22 19
23/* 20/*
24 * Maximum DPLL input frequency (FINT) and output frequency (FOUT) that 21 * Maximum DPLL input frequency (FINT) and output frequency (FOUT) that
@@ -29,13 +26,23 @@
29#define OMAP4_DPLL_LP_FINT_MAX 1000000 26#define OMAP4_DPLL_LP_FINT_MAX 1000000
30#define OMAP4_DPLL_LP_FOUT_MAX 100000000 27#define OMAP4_DPLL_LP_FOUT_MAX 100000000
31 28
29/*
30 * Bitfield declarations
31 */
32#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8)
33#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK (1 << 10)
34#define OMAP4430_DPLL_REGM4XEN_MASK (1 << 11)
35
36/* Static rate multiplier for OMAP4 REGM4XEN clocks */
37#define OMAP4430_REGM4XEN_MULT 4
38
32/* Supported only on OMAP4 */ 39/* Supported only on OMAP4 */
33int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk) 40int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
34{ 41{
35 u32 v; 42 u32 v;
36 u32 mask; 43 u32 mask;
37 44
38 if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) 45 if (!clk || !clk->clksel_reg)
39 return -EINVAL; 46 return -EINVAL;
40 47
41 mask = clk->flags & CLOCK_CLKOUTX2 ? 48 mask = clk->flags & CLOCK_CLKOUTX2 ?
@@ -54,7 +61,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
54 u32 v; 61 u32 v;
55 u32 mask; 62 u32 mask;
56 63
57 if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) 64 if (!clk || !clk->clksel_reg)
58 return; 65 return;
59 66
60 mask = clk->flags & CLOCK_CLKOUTX2 ? 67 mask = clk->flags & CLOCK_CLKOUTX2 ?
@@ -72,7 +79,7 @@ void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
72 u32 v; 79 u32 v;
73 u32 mask; 80 u32 mask;
74 81
75 if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) 82 if (!clk || !clk->clksel_reg)
76 return; 83 return;
77 84
78 mask = clk->flags & CLOCK_CLKOUTX2 ? 85 mask = clk->flags & CLOCK_CLKOUTX2 ?
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
deleted file mode 100644
index f7492df1cbba..000000000000
--- a/arch/arm/mach-omap2/dsp.c
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * TI's OMAP DSP platform device registration
3 *
4 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14/*
15 * XXX The function pointers to the PRM/CM functions are incorrect and
16 * should be removed. No device driver should be changing PRM/CM bits
17 * directly; that's a layering violation -- those bits are the responsibility
18 * of the OMAP PM core code.
19 */
20
21#include <linux/module.h>
22#include <linux/platform_device.h>
23
24#include <asm/memblock.h>
25
26#include "control.h"
27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h"
29#ifdef CONFIG_TIDSPBRIDGE_DVFS
30#include "omap-pm.h"
31#endif
32#include "soc.h"
33
34#include <linux/platform_data/dsp-omap.h>
35
36static struct platform_device *omap_dsp_pdev;
37
38static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
39#ifdef CONFIG_TIDSPBRIDGE_DVFS
40 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
41 .dsp_get_opp = omap_pm_dsp_get_opp,
42 .cpu_set_freq = omap_pm_cpu_set_freq,
43 .cpu_get_freq = omap_pm_cpu_get_freq,
44#endif
45 .dsp_prm_read = omap2_prm_read_mod_reg,
46 .dsp_prm_write = omap2_prm_write_mod_reg,
47 .dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
48 .dsp_cm_read = omap2_cm_read_mod_reg,
49 .dsp_cm_write = omap2_cm_write_mod_reg,
50 .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
51
52 .set_bootaddr = omap_ctrl_write_dsp_boot_addr,
53 .set_bootmode = omap_ctrl_write_dsp_boot_mode,
54};
55
56static phys_addr_t omap_dsp_phys_mempool_base;
57
58void __init omap_dsp_reserve_sdram_memblock(void)
59{
60 phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
61 phys_addr_t paddr;
62
63 if (!cpu_is_omap34xx())
64 return;
65
66 if (!size)
67 return;
68
69 paddr = arm_memblock_steal(size, SZ_1M);
70 if (!paddr) {
71 pr_err("%s: failed to reserve %llx bytes\n",
72 __func__, (unsigned long long)size);
73 return;
74 }
75
76 omap_dsp_phys_mempool_base = paddr;
77}
78
79static phys_addr_t omap_dsp_get_mempool_base(void)
80{
81 return omap_dsp_phys_mempool_base;
82}
83
84static int __init omap_dsp_init(void)
85{
86 struct platform_device *pdev;
87 int err = -ENOMEM;
88 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
89
90 if (!cpu_is_omap34xx())
91 return 0;
92
93 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
94
95 if (pdata->phys_mempool_base) {
96 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
97 pr_info("%s: %llx bytes @ %llx\n", __func__,
98 (unsigned long long)pdata->phys_mempool_size,
99 (unsigned long long)pdata->phys_mempool_base);
100 }
101
102 pdev = platform_device_alloc("omap-dsp", -1);
103 if (!pdev)
104 goto err_out;
105
106 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
107 if (err)
108 goto err_out;
109
110 err = platform_device_add(pdev);
111 if (err)
112 goto err_out;
113
114 omap_dsp_pdev = pdev;
115 return 0;
116
117err_out:
118 platform_device_put(pdev);
119 return err;
120}
121module_init(omap_dsp_init);
122
123static void __exit omap_dsp_exit(void)
124{
125 if (!cpu_is_omap34xx())
126 return;
127
128 platform_device_unregister(omap_dsp_pdev);
129}
130module_exit(omap_dsp_exit);
131
132MODULE_AUTHOR("Hiroshi DOYU");
133MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
134MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 93914d220069..8897ad7035fd 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -24,25 +24,6 @@
24/* minimum size for IO mapping */ 24/* minimum size for IO mapping */
25#define NAND_IO_SIZE 4 25#define NAND_IO_SIZE 4
26 26
27static struct resource gpmc_nand_resource[] = {
28 {
29 .flags = IORESOURCE_MEM,
30 },
31 {
32 .flags = IORESOURCE_IRQ,
33 },
34 {
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39static struct platform_device gpmc_nand_device = {
40 .name = "omap2-nand",
41 .id = 0,
42 .num_resources = ARRAY_SIZE(gpmc_nand_resource),
43 .resource = gpmc_nand_resource,
44};
45
46static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) 27static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
47{ 28{
48 /* platforms which support all ECC schemes */ 29 /* platforms which support all ECC schemes */
@@ -95,43 +76,41 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
95{ 76{
96 int err = 0; 77 int err = 0;
97 struct gpmc_settings s; 78 struct gpmc_settings s;
98 struct device *dev = &gpmc_nand_device.dev; 79 struct platform_device *pdev;
99 80 struct resource gpmc_nand_res[] = {
100 memset(&s, 0, sizeof(struct gpmc_settings)); 81 { .flags = IORESOURCE_MEM, },
82 { .flags = IORESOURCE_IRQ, },
83 { .flags = IORESOURCE_IRQ, },
84 };
101 85
102 gpmc_nand_device.dev.platform_data = gpmc_nand_data; 86 BUG_ON(gpmc_nand_data->cs >= GPMC_CS_NUM);
103 87
104 err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, 88 err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE,
105 (unsigned long *)&gpmc_nand_resource[0].start); 89 (unsigned long *)&gpmc_nand_res[0].start);
106 if (err < 0) { 90 if (err < 0) {
107 dev_err(dev, "Cannot request GPMC CS %d, error %d\n", 91 pr_err("omap2-gpmc: Cannot request GPMC CS %d, error %d\n",
108 gpmc_nand_data->cs, err); 92 gpmc_nand_data->cs, err);
109 return err; 93 return err;
110 } 94 }
111 95 gpmc_nand_res[0].end = gpmc_nand_res[0].start + NAND_IO_SIZE - 1;
112 gpmc_nand_resource[0].end = gpmc_nand_resource[0].start + 96 gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
113 NAND_IO_SIZE - 1; 97 gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
114
115 gpmc_nand_resource[1].start =
116 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
117 gpmc_nand_resource[2].start =
118 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
119 98
120 if (gpmc_t) { 99 if (gpmc_t) {
121 err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t); 100 err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t);
122 if (err < 0) { 101 if (err < 0) {
123 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 102 pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n", err);
124 return err; 103 return err;
125 } 104 }
126 } 105 }
127 106
107 memset(&s, 0, sizeof(struct gpmc_settings));
128 if (gpmc_nand_data->of_node) 108 if (gpmc_nand_data->of_node)
129 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); 109 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
130 else 110 else
131 gpmc_set_legacy(gpmc_nand_data, &s); 111 gpmc_set_legacy(gpmc_nand_data, &s);
132 112
133 s.device_nand = true; 113 s.device_nand = true;
134
135 err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); 114 err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
136 if (err < 0) 115 if (err < 0)
137 goto out_free_cs; 116 goto out_free_cs;
@@ -143,18 +122,34 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
143 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 122 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
144 123
145 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) { 124 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) {
146 dev_err(dev, "Unsupported NAND ECC scheme selected\n"); 125 pr_err("omap2-nand: Unsupported NAND ECC scheme selected\n");
147 return -EINVAL; 126 err = -EINVAL;
127 goto out_free_cs;
148 } 128 }
149 129
150 err = platform_device_register(&gpmc_nand_device); 130
151 if (err < 0) { 131 pdev = platform_device_alloc("omap2-nand", gpmc_nand_data->cs);
152 dev_err(dev, "Unable to register NAND device\n"); 132 if (pdev) {
153 goto out_free_cs; 133 err = platform_device_add_resources(pdev, gpmc_nand_res,
134 ARRAY_SIZE(gpmc_nand_res));
135 if (!err)
136 pdev->dev.platform_data = gpmc_nand_data;
137 } else {
138 err = -ENOMEM;
139 }
140 if (err)
141 goto out_free_pdev;
142
143 err = platform_device_add(pdev);
144 if (err) {
145 dev_err(&pdev->dev, "Unable to register NAND device\n");
146 goto out_free_pdev;
154 } 147 }
155 148
156 return 0; 149 return 0;
157 150
151out_free_pdev:
152 platform_device_put(pdev);
158out_free_cs: 153out_free_cs:
159 gpmc_cs_free(gpmc_nand_data->cs); 154 gpmc_cs_free(gpmc_nand_data->cs);
160 155
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 8f559450c876..5d0667c119f6 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -53,6 +53,7 @@
53#include "prm2xxx.h" 53#include "prm2xxx.h"
54#include "prm3xxx.h" 54#include "prm3xxx.h"
55#include "prm44xx.h" 55#include "prm44xx.h"
56#include "opp2xxx.h"
56 57
57/* 58/*
58 * omap_clk_soc_init: points to a function that does the SoC-specific 59 * omap_clk_soc_init: points to a function that does the SoC-specific
@@ -410,7 +411,8 @@ void __init omap2420_init_early(void)
410 omap242x_clockdomains_init(); 411 omap242x_clockdomains_init();
411 omap2420_hwmod_init(); 412 omap2420_hwmod_init();
412 omap_hwmod_init_postsetup(); 413 omap_hwmod_init_postsetup();
413 omap_clk_soc_init = omap2420_clk_init; 414 omap_clk_soc_init = omap2420_dt_clk_init;
415 rate_table = omap2420_rate_table;
414} 416}
415 417
416void __init omap2420_init_late(void) 418void __init omap2420_init_late(void)
@@ -439,7 +441,8 @@ void __init omap2430_init_early(void)
439 omap243x_clockdomains_init(); 441 omap243x_clockdomains_init();
440 omap2430_hwmod_init(); 442 omap2430_hwmod_init();
441 omap_hwmod_init_postsetup(); 443 omap_hwmod_init_postsetup();
442 omap_clk_soc_init = omap2430_clk_init; 444 omap_clk_soc_init = omap2430_dt_clk_init;
445 rate_table = omap2430_rate_table;
443} 446}
444 447
445void __init omap2430_init_late(void) 448void __init omap2430_init_late(void)
@@ -728,6 +731,8 @@ int __init omap_clk_init(void)
728 if (!omap_clk_soc_init) 731 if (!omap_clk_soc_init)
729 return 0; 732 return 0;
730 733
734 ti_clk_init_features();
735
731 ret = of_prcm_init(); 736 ret = of_prcm_init();
732 if (!ret) 737 if (!ret)
733 ret = omap_clk_soc_init(); 738 ret = omap_clk_soc_init();
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index f62f7537d899..ac8a249779f2 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -681,29 +681,19 @@ static ssize_t omap_mux_dbg_signal_write(struct file *file,
681 const char __user *user_buf, 681 const char __user *user_buf,
682 size_t count, loff_t *ppos) 682 size_t count, loff_t *ppos)
683{ 683{
684 char buf[OMAP_MUX_MAX_ARG_CHAR];
685 struct seq_file *seqf; 684 struct seq_file *seqf;
686 struct omap_mux *m; 685 struct omap_mux *m;
687 unsigned long val; 686 u16 val;
688 int buf_size, ret; 687 int ret;
689 struct omap_mux_partition *partition; 688 struct omap_mux_partition *partition;
690 689
691 if (count > OMAP_MUX_MAX_ARG_CHAR) 690 if (count > OMAP_MUX_MAX_ARG_CHAR)
692 return -EINVAL; 691 return -EINVAL;
693 692
694 memset(buf, 0, sizeof(buf)); 693 ret = kstrtou16_from_user(user_buf, count, 0x10, &val);
695 buf_size = min(count, sizeof(buf) - 1);
696
697 if (copy_from_user(buf, user_buf, buf_size))
698 return -EFAULT;
699
700 ret = strict_strtoul(buf, 0x10, &val);
701 if (ret < 0) 694 if (ret < 0)
702 return ret; 695 return ret;
703 696
704 if (val > 0xffff)
705 return -EINVAL;
706
707 seqf = file->private_data; 697 seqf = file->private_data;
708 m = seqf->private; 698 m = seqf->private;
709 699
@@ -711,7 +701,7 @@ static ssize_t omap_mux_dbg_signal_write(struct file *file,
711 if (!partition) 701 if (!partition)
712 return -ENODEV; 702 return -ENODEV;
713 703
714 omap_mux_write(partition, (u16)val, m->reg_offset); 704 omap_mux_write(partition, val, m->reg_offset);
715 *ppos += count; 705 *ppos += count;
716 706
717 return count; 707 return count;
@@ -917,14 +907,14 @@ static void __init omap_mux_set_cmdline_signals(void)
917 907
918 while ((token = strsep(&next_opt, ",")) != NULL) { 908 while ((token = strsep(&next_opt, ",")) != NULL) {
919 char *keyval, *name; 909 char *keyval, *name;
920 unsigned long val; 910 u16 val;
921 911
922 keyval = token; 912 keyval = token;
923 name = strsep(&keyval, "="); 913 name = strsep(&keyval, "=");
924 if (name) { 914 if (name) {
925 int res; 915 int res;
926 916
927 res = strict_strtoul(keyval, 0x10, &val); 917 res = kstrtou16(keyval, 0x10, &val);
928 if (res < 0) 918 if (res < 0)
929 continue; 919 continue;
930 920
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index f1fab5684a24..4068350f9059 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -34,8 +34,6 @@ static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
34 34
35 pdata->name = oh->name; 35 pdata->name = oh->name;
36 pdata->nr_tlb_entries = a->nr_tlb_entries; 36 pdata->nr_tlb_entries = a->nr_tlb_entries;
37 pdata->da_start = a->da_start;
38 pdata->da_end = a->da_end;
39 37
40 if (oh->rst_lines_cnt == 1) { 38 if (oh->rst_lines_cnt == 1) {
41 pdata->reset_name = oh->rst_lines->name; 39 pdata->reset_name = oh->rst_lines->name;
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 2f15979c2e9c..65b1647092bd 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -16,7 +16,6 @@
16#include <linux/i2c-omap.h> 16#include <linux/i2c-omap.h>
17#include <linux/platform_data/spi-omap2-mcspi.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
18#include <linux/omap-dma.h> 18#include <linux/omap-dma.h>
19#include <linux/platform_data/mailbox-omap.h>
20#include <plat/dmtimer.h> 19#include <plat/dmtimer.h>
21 20
22#include "omap_hwmod.h" 21#include "omap_hwmod.h"
@@ -163,18 +162,6 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
163}; 162};
164 163
165/* mailbox */ 164/* mailbox */
166static struct omap_mbox_dev_info omap2420_mailbox_info[] = {
167 { .name = "dsp", .tx_id = 0, .rx_id = 1, .irq_id = 0, .usr_id = 0 },
168 { .name = "iva", .tx_id = 2, .rx_id = 3, .irq_id = 1, .usr_id = 3 },
169};
170
171static struct omap_mbox_pdata omap2420_mailbox_attrs = {
172 .num_users = 4,
173 .num_fifos = 6,
174 .info_cnt = ARRAY_SIZE(omap2420_mailbox_info),
175 .info = omap2420_mailbox_info,
176};
177
178static struct omap_hwmod omap2420_mailbox_hwmod = { 165static struct omap_hwmod omap2420_mailbox_hwmod = {
179 .name = "mailbox", 166 .name = "mailbox",
180 .class = &omap2xxx_mailbox_hwmod_class, 167 .class = &omap2xxx_mailbox_hwmod_class,
@@ -188,7 +175,6 @@ static struct omap_hwmod omap2420_mailbox_hwmod = {
188 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT, 175 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
189 }, 176 },
190 }, 177 },
191 .dev_attr = &omap2420_mailbox_attrs,
192}; 178};
193 179
194/* 180/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 6d1b60902179..c2555cb95e71 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -17,7 +17,6 @@
17#include <linux/platform_data/asoc-ti-mcbsp.h> 17#include <linux/platform_data/asoc-ti-mcbsp.h>
18#include <linux/platform_data/spi-omap2-mcspi.h> 18#include <linux/platform_data/spi-omap2-mcspi.h>
19#include <linux/omap-dma.h> 19#include <linux/omap-dma.h>
20#include <linux/platform_data/mailbox-omap.h>
21#include <plat/dmtimer.h> 20#include <plat/dmtimer.h>
22 21
23#include "omap_hwmod.h" 22#include "omap_hwmod.h"
@@ -161,17 +160,6 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
161}; 160};
162 161
163/* mailbox */ 162/* mailbox */
164static struct omap_mbox_dev_info omap2430_mailbox_info[] = {
165 { .name = "dsp", .tx_id = 0, .rx_id = 1 },
166};
167
168static struct omap_mbox_pdata omap2430_mailbox_attrs = {
169 .num_users = 4,
170 .num_fifos = 6,
171 .info_cnt = ARRAY_SIZE(omap2430_mailbox_info),
172 .info = omap2430_mailbox_info,
173};
174
175static struct omap_hwmod omap2430_mailbox_hwmod = { 163static struct omap_hwmod omap2430_mailbox_hwmod = {
176 .name = "mailbox", 164 .name = "mailbox",
177 .class = &omap2xxx_mailbox_hwmod_class, 165 .class = &omap2xxx_mailbox_hwmod_class,
@@ -185,7 +173,6 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
185 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT, 173 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
186 }, 174 },
187 }, 175 },
188 .dev_attr = &omap2430_mailbox_attrs,
189}; 176};
190 177
191/* mcspi3 */ 178/* mcspi3 */
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
index 0413daba2dba..c1e98d589100 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
@@ -152,15 +152,6 @@ struct omap_hwmod_addr_space omap2_dma_system_addrs[] = {
152 { } 152 { }
153}; 153};
154 154
155struct omap_hwmod_addr_space omap2_mailbox_addrs[] = {
156 {
157 .pa_start = 0x48094000,
158 .pa_end = 0x48094000 + SZ_512 - 1,
159 .flags = ADDR_TYPE_RT,
160 },
161 { }
162};
163
164struct omap_hwmod_addr_space omap2_mcbsp1_addrs[] = { 155struct omap_hwmod_addr_space omap2_mcbsp1_addrs[] = {
165 { 156 {
166 .name = "mpu", 157 .name = "mpu",
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index 5da7a42a6d90..c6c6384de867 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -37,46 +37,6 @@ struct omap_hwmod_class omap2_uart_class = {
37}; 37};
38 38
39/* 39/*
40 * 'dss' class
41 * display sub-system
42 */
43
44static struct omap_hwmod_class_sysconfig omap2_dss_sysc = {
45 .rev_offs = 0x0000,
46 .sysc_offs = 0x0010,
47 .syss_offs = 0x0014,
48 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
49 SYSS_HAS_RESET_STATUS),
50 .sysc_fields = &omap_hwmod_sysc_type1,
51};
52
53struct omap_hwmod_class omap2_dss_hwmod_class = {
54 .name = "dss",
55 .sysc = &omap2_dss_sysc,
56 .reset = omap_dss_reset,
57};
58
59/*
60 * 'rfbi' class
61 * remote frame buffer interface
62 */
63
64static struct omap_hwmod_class_sysconfig omap2_rfbi_sysc = {
65 .rev_offs = 0x0000,
66 .sysc_offs = 0x0010,
67 .syss_offs = 0x0014,
68 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
69 SYSC_HAS_AUTOIDLE),
70 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
71 .sysc_fields = &omap_hwmod_sysc_type1,
72};
73
74struct omap_hwmod_class omap2_rfbi_hwmod_class = {
75 .name = "rfbi",
76 .sysc = &omap2_rfbi_sysc,
77};
78
79/*
80 * 'venc' class 40 * 'venc' class
81 * video encoder 41 * video encoder
82 */ 42 */
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
index e2db378b849e..8f5989d48a80 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
@@ -317,21 +317,11 @@ struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = {
317 .user = OCP_USER_MPU, 317 .user = OCP_USER_MPU,
318}; 318};
319 319
320static struct omap_hwmod_addr_space am33xx_mailbox_addrs[] = {
321 {
322 .pa_start = 0x480C8000,
323 .pa_end = 0x480C8000 + (SZ_4K - 1),
324 .flags = ADDR_TYPE_RT
325 },
326 { }
327};
328
329/* l4 ls -> mailbox */ 320/* l4 ls -> mailbox */
330struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = { 321struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = {
331 .master = &am33xx_l4_ls_hwmod, 322 .master = &am33xx_l4_ls_hwmod,
332 .slave = &am33xx_mailbox_hwmod, 323 .slave = &am33xx_mailbox_hwmod,
333 .clk = "l4ls_gclk", 324 .clk = "l4ls_gclk",
334 .addr = am33xx_mailbox_addrs,
335 .user = OCP_USER_MPU, 325 .user = OCP_USER_MPU,
336}; 326};
337 327
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 1cd0cfdc03e0..e9516b454e76 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -2986,8 +2986,6 @@ static struct omap_hwmod_class omap3xxx_mmu_hwmod_class = {
2986/* mmu isp */ 2986/* mmu isp */
2987 2987
2988static struct omap_mmu_dev_attr mmu_isp_dev_attr = { 2988static struct omap_mmu_dev_attr mmu_isp_dev_attr = {
2989 .da_start = 0x0,
2990 .da_end = 0xfffff000,
2991 .nr_tlb_entries = 8, 2989 .nr_tlb_entries = 8,
2992}; 2990};
2993 2991
@@ -3026,8 +3024,6 @@ static struct omap_hwmod omap3xxx_mmu_isp_hwmod = {
3026/* mmu iva */ 3024/* mmu iva */
3027 3025
3028static struct omap_mmu_dev_attr mmu_iva_dev_attr = { 3026static struct omap_mmu_dev_attr mmu_iva_dev_attr = {
3029 .da_start = 0x11000000,
3030 .da_end = 0xfffff000,
3031 .nr_tlb_entries = 32, 3027 .nr_tlb_entries = 32,
3032}; 3028};
3033 3029
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
index 5c2cc8083fdd..fea01aa3ef42 100644
--- a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
@@ -19,6 +19,8 @@
19#include "omap_hwmod.h" 19#include "omap_hwmod.h"
20#include "omap_hwmod_33xx_43xx_common_data.h" 20#include "omap_hwmod_33xx_43xx_common_data.h"
21#include "prcm43xx.h" 21#include "prcm43xx.h"
22#include "omap_hwmod_common_data.h"
23
22 24
23/* IP blocks */ 25/* IP blocks */
24static struct omap_hwmod am43xx_l4_hs_hwmod = { 26static struct omap_hwmod am43xx_l4_hs_hwmod = {
@@ -415,6 +417,72 @@ static struct omap_hwmod am43xx_qspi_hwmod = {
415 }, 417 },
416}; 418};
417 419
420/* dss */
421
422static struct omap_hwmod am43xx_dss_core_hwmod = {
423 .name = "dss_core",
424 .class = &omap2_dss_hwmod_class,
425 .clkdm_name = "dss_clkdm",
426 .main_clk = "disp_clk",
427 .prcm = {
428 .omap4 = {
429 .clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
430 .modulemode = MODULEMODE_SWCTRL,
431 },
432 },
433};
434
435/* dispc */
436
437struct omap_dss_dispc_dev_attr am43xx_dss_dispc_dev_attr = {
438 .manager_count = 1,
439 .has_framedonetv_irq = 0
440};
441
442static struct omap_hwmod_class_sysconfig am43xx_dispc_sysc = {
443 .rev_offs = 0x0000,
444 .sysc_offs = 0x0010,
445 .syss_offs = 0x0014,
446 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SOFTRESET |
447 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
448 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_MIDLEMODE),
449 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
450 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
451 .sysc_fields = &omap_hwmod_sysc_type1,
452};
453
454static struct omap_hwmod_class am43xx_dispc_hwmod_class = {
455 .name = "dispc",
456 .sysc = &am43xx_dispc_sysc,
457};
458
459static struct omap_hwmod am43xx_dss_dispc_hwmod = {
460 .name = "dss_dispc",
461 .class = &am43xx_dispc_hwmod_class,
462 .clkdm_name = "dss_clkdm",
463 .main_clk = "disp_clk",
464 .prcm = {
465 .omap4 = {
466 .clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
467 },
468 },
469 .dev_attr = &am43xx_dss_dispc_dev_attr,
470};
471
472/* rfbi */
473
474static struct omap_hwmod am43xx_dss_rfbi_hwmod = {
475 .name = "dss_rfbi",
476 .class = &omap2_rfbi_hwmod_class,
477 .clkdm_name = "dss_clkdm",
478 .main_clk = "disp_clk",
479 .prcm = {
480 .omap4 = {
481 .clkctrl_offs = AM43XX_CM_PER_DSS_CLKCTRL_OFFSET,
482 },
483 },
484};
485
418/* Interfaces */ 486/* Interfaces */
419static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = { 487static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
420 .master = &am33xx_l3_main_hwmod, 488 .master = &am33xx_l3_main_hwmod,
@@ -654,6 +722,34 @@ static struct omap_hwmod_ocp_if am43xx_l3_s__qspi = {
654 .user = OCP_USER_MPU | OCP_USER_SDMA, 722 .user = OCP_USER_MPU | OCP_USER_SDMA,
655}; 723};
656 724
725static struct omap_hwmod_ocp_if am43xx_dss__l3_main = {
726 .master = &am43xx_dss_core_hwmod,
727 .slave = &am33xx_l3_main_hwmod,
728 .clk = "l3_gclk",
729 .user = OCP_USER_MPU | OCP_USER_SDMA,
730};
731
732static struct omap_hwmod_ocp_if am43xx_l4_ls__dss = {
733 .master = &am33xx_l4_ls_hwmod,
734 .slave = &am43xx_dss_core_hwmod,
735 .clk = "l4ls_gclk",
736 .user = OCP_USER_MPU | OCP_USER_SDMA,
737};
738
739static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_dispc = {
740 .master = &am33xx_l4_ls_hwmod,
741 .slave = &am43xx_dss_dispc_hwmod,
742 .clk = "l4ls_gclk",
743 .user = OCP_USER_MPU | OCP_USER_SDMA,
744};
745
746static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_rfbi = {
747 .master = &am33xx_l4_ls_hwmod,
748 .slave = &am43xx_dss_rfbi_hwmod,
749 .clk = "l4ls_gclk",
750 .user = OCP_USER_MPU | OCP_USER_SDMA,
751};
752
657static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = { 753static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
658 &am33xx_l4_wkup__synctimer, 754 &am33xx_l4_wkup__synctimer,
659 &am43xx_l4_ls__timer8, 755 &am43xx_l4_ls__timer8,
@@ -748,6 +844,10 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
748 &am43xx_l4_ls__ocp2scp1, 844 &am43xx_l4_ls__ocp2scp1,
749 &am43xx_l3_s__usbotgss0, 845 &am43xx_l3_s__usbotgss0,
750 &am43xx_l3_s__usbotgss1, 846 &am43xx_l3_s__usbotgss1,
847 &am43xx_dss__l3_main,
848 &am43xx_l4_ls__dss,
849 &am43xx_l4_ls__dss_dispc,
850 &am43xx_l4_ls__dss_rfbi,
751 NULL, 851 NULL,
752}; 852};
753 853
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 41e54f759934..44e5634bba34 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2084,8 +2084,6 @@ static struct omap_hwmod_class omap44xx_mmu_hwmod_class = {
2084/* mmu ipu */ 2084/* mmu ipu */
2085 2085
2086static struct omap_mmu_dev_attr mmu_ipu_dev_attr = { 2086static struct omap_mmu_dev_attr mmu_ipu_dev_attr = {
2087 .da_start = 0x0,
2088 .da_end = 0xfffff000,
2089 .nr_tlb_entries = 32, 2087 .nr_tlb_entries = 32,
2090}; 2088};
2091 2089
@@ -2133,8 +2131,6 @@ static struct omap_hwmod omap44xx_mmu_ipu_hwmod = {
2133/* mmu dsp */ 2131/* mmu dsp */
2134 2132
2135static struct omap_mmu_dev_attr mmu_dsp_dev_attr = { 2133static struct omap_mmu_dev_attr mmu_dsp_dev_attr = {
2136 .da_start = 0x0,
2137 .da_end = 0xfffff000,
2138 .nr_tlb_entries = 32, 2134 .nr_tlb_entries = 32,
2139}; 2135};
2140 2136
@@ -4142,21 +4138,11 @@ static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
4142 .user = OCP_USER_MPU | OCP_USER_SDMA, 4138 .user = OCP_USER_MPU | OCP_USER_SDMA,
4143}; 4139};
4144 4140
4145static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
4146 {
4147 .pa_start = 0x4a0f4000,
4148 .pa_end = 0x4a0f41ff,
4149 .flags = ADDR_TYPE_RT
4150 },
4151 { }
4152};
4153
4154/* l4_cfg -> mailbox */ 4141/* l4_cfg -> mailbox */
4155static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = { 4142static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = {
4156 .master = &omap44xx_l4_cfg_hwmod, 4143 .master = &omap44xx_l4_cfg_hwmod,
4157 .slave = &omap44xx_mailbox_hwmod, 4144 .slave = &omap44xx_mailbox_hwmod,
4158 .clk = "l4_div_ck", 4145 .clk = "l4_div_ck",
4159 .addr = omap44xx_mailbox_addrs,
4160 .user = OCP_USER_MPU | OCP_USER_SDMA, 4146 .user = OCP_USER_MPU | OCP_USER_SDMA,
4161}; 4147};
4162 4148
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 284324f2b98a..2757abf87fbc 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -273,6 +273,56 @@ static struct omap_hwmod dra7xx_ctrl_module_wkup_hwmod = {
273}; 273};
274 274
275/* 275/*
276 * 'gmac' class
277 * cpsw/gmac sub system
278 */
279static struct omap_hwmod_class_sysconfig dra7xx_gmac_sysc = {
280 .rev_offs = 0x0,
281 .sysc_offs = 0x8,
282 .syss_offs = 0x4,
283 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE |
284 SYSS_HAS_RESET_STATUS),
285 .idlemodes = (SIDLE_FORCE | SIDLE_NO | MSTANDBY_FORCE |
286 MSTANDBY_NO),
287 .sysc_fields = &omap_hwmod_sysc_type3,
288};
289
290static struct omap_hwmod_class dra7xx_gmac_hwmod_class = {
291 .name = "gmac",
292 .sysc = &dra7xx_gmac_sysc,
293};
294
295static struct omap_hwmod dra7xx_gmac_hwmod = {
296 .name = "gmac",
297 .class = &dra7xx_gmac_hwmod_class,
298 .clkdm_name = "gmac_clkdm",
299 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
300 .main_clk = "dpll_gmac_ck",
301 .mpu_rt_idx = 1,
302 .prcm = {
303 .omap4 = {
304 .clkctrl_offs = DRA7XX_CM_GMAC_GMAC_CLKCTRL_OFFSET,
305 .context_offs = DRA7XX_RM_GMAC_GMAC_CONTEXT_OFFSET,
306 .modulemode = MODULEMODE_SWCTRL,
307 },
308 },
309};
310
311/*
312 * 'mdio' class
313 */
314static struct omap_hwmod_class dra7xx_mdio_hwmod_class = {
315 .name = "davinci_mdio",
316};
317
318static struct omap_hwmod dra7xx_mdio_hwmod = {
319 .name = "davinci_mdio",
320 .class = &dra7xx_mdio_hwmod_class,
321 .clkdm_name = "gmac_clkdm",
322 .main_clk = "dpll_gmac_ck",
323};
324
325/*
276 * 'dcan' class 326 * 'dcan' class
277 * 327 *
278 */ 328 */
@@ -343,19 +393,10 @@ static struct omap_dma_dev_attr dma_dev_attr = {
343}; 393};
344 394
345/* dma_system */ 395/* dma_system */
346static struct omap_hwmod_irq_info dra7xx_dma_system_irqs[] = {
347 { .name = "0", .irq = 12 + DRA7XX_IRQ_GIC_START },
348 { .name = "1", .irq = 13 + DRA7XX_IRQ_GIC_START },
349 { .name = "2", .irq = 14 + DRA7XX_IRQ_GIC_START },
350 { .name = "3", .irq = 15 + DRA7XX_IRQ_GIC_START },
351 { .irq = -1 }
352};
353
354static struct omap_hwmod dra7xx_dma_system_hwmod = { 396static struct omap_hwmod dra7xx_dma_system_hwmod = {
355 .name = "dma_system", 397 .name = "dma_system",
356 .class = &dra7xx_dma_hwmod_class, 398 .class = &dra7xx_dma_hwmod_class,
357 .clkdm_name = "dma_clkdm", 399 .clkdm_name = "dma_clkdm",
358 .mpu_irqs = dra7xx_dma_system_irqs,
359 .main_clk = "l3_iclk_div", 400 .main_clk = "l3_iclk_div",
360 .prcm = { 401 .prcm = {
361 .omap4 = { 402 .omap4 = {
@@ -939,6 +980,194 @@ static struct omap_hwmod dra7xx_i2c5_hwmod = {
939}; 980};
940 981
941/* 982/*
983 * 'mailbox' class
984 *
985 */
986
987static struct omap_hwmod_class_sysconfig dra7xx_mailbox_sysc = {
988 .rev_offs = 0x0000,
989 .sysc_offs = 0x0010,
990 .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
991 SYSC_HAS_SOFTRESET),
992 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
993 .sysc_fields = &omap_hwmod_sysc_type2,
994};
995
996static struct omap_hwmod_class dra7xx_mailbox_hwmod_class = {
997 .name = "mailbox",
998 .sysc = &dra7xx_mailbox_sysc,
999};
1000
1001/* mailbox1 */
1002static struct omap_hwmod dra7xx_mailbox1_hwmod = {
1003 .name = "mailbox1",
1004 .class = &dra7xx_mailbox_hwmod_class,
1005 .clkdm_name = "l4cfg_clkdm",
1006 .prcm = {
1007 .omap4 = {
1008 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX1_CLKCTRL_OFFSET,
1009 .context_offs = DRA7XX_RM_L4CFG_MAILBOX1_CONTEXT_OFFSET,
1010 },
1011 },
1012};
1013
1014/* mailbox2 */
1015static struct omap_hwmod dra7xx_mailbox2_hwmod = {
1016 .name = "mailbox2",
1017 .class = &dra7xx_mailbox_hwmod_class,
1018 .clkdm_name = "l4cfg_clkdm",
1019 .prcm = {
1020 .omap4 = {
1021 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX2_CLKCTRL_OFFSET,
1022 .context_offs = DRA7XX_RM_L4CFG_MAILBOX2_CONTEXT_OFFSET,
1023 },
1024 },
1025};
1026
1027/* mailbox3 */
1028static struct omap_hwmod dra7xx_mailbox3_hwmod = {
1029 .name = "mailbox3",
1030 .class = &dra7xx_mailbox_hwmod_class,
1031 .clkdm_name = "l4cfg_clkdm",
1032 .prcm = {
1033 .omap4 = {
1034 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX3_CLKCTRL_OFFSET,
1035 .context_offs = DRA7XX_RM_L4CFG_MAILBOX3_CONTEXT_OFFSET,
1036 },
1037 },
1038};
1039
1040/* mailbox4 */
1041static struct omap_hwmod dra7xx_mailbox4_hwmod = {
1042 .name = "mailbox4",
1043 .class = &dra7xx_mailbox_hwmod_class,
1044 .clkdm_name = "l4cfg_clkdm",
1045 .prcm = {
1046 .omap4 = {
1047 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX4_CLKCTRL_OFFSET,
1048 .context_offs = DRA7XX_RM_L4CFG_MAILBOX4_CONTEXT_OFFSET,
1049 },
1050 },
1051};
1052
1053/* mailbox5 */
1054static struct omap_hwmod dra7xx_mailbox5_hwmod = {
1055 .name = "mailbox5",
1056 .class = &dra7xx_mailbox_hwmod_class,
1057 .clkdm_name = "l4cfg_clkdm",
1058 .prcm = {
1059 .omap4 = {
1060 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX5_CLKCTRL_OFFSET,
1061 .context_offs = DRA7XX_RM_L4CFG_MAILBOX5_CONTEXT_OFFSET,
1062 },
1063 },
1064};
1065
1066/* mailbox6 */
1067static struct omap_hwmod dra7xx_mailbox6_hwmod = {
1068 .name = "mailbox6",
1069 .class = &dra7xx_mailbox_hwmod_class,
1070 .clkdm_name = "l4cfg_clkdm",
1071 .prcm = {
1072 .omap4 = {
1073 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX6_CLKCTRL_OFFSET,
1074 .context_offs = DRA7XX_RM_L4CFG_MAILBOX6_CONTEXT_OFFSET,
1075 },
1076 },
1077};
1078
1079/* mailbox7 */
1080static struct omap_hwmod dra7xx_mailbox7_hwmod = {
1081 .name = "mailbox7",
1082 .class = &dra7xx_mailbox_hwmod_class,
1083 .clkdm_name = "l4cfg_clkdm",
1084 .prcm = {
1085 .omap4 = {
1086 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX7_CLKCTRL_OFFSET,
1087 .context_offs = DRA7XX_RM_L4CFG_MAILBOX7_CONTEXT_OFFSET,
1088 },
1089 },
1090};
1091
1092/* mailbox8 */
1093static struct omap_hwmod dra7xx_mailbox8_hwmod = {
1094 .name = "mailbox8",
1095 .class = &dra7xx_mailbox_hwmod_class,
1096 .clkdm_name = "l4cfg_clkdm",
1097 .prcm = {
1098 .omap4 = {
1099 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX8_CLKCTRL_OFFSET,
1100 .context_offs = DRA7XX_RM_L4CFG_MAILBOX8_CONTEXT_OFFSET,
1101 },
1102 },
1103};
1104
1105/* mailbox9 */
1106static struct omap_hwmod dra7xx_mailbox9_hwmod = {
1107 .name = "mailbox9",
1108 .class = &dra7xx_mailbox_hwmod_class,
1109 .clkdm_name = "l4cfg_clkdm",
1110 .prcm = {
1111 .omap4 = {
1112 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX9_CLKCTRL_OFFSET,
1113 .context_offs = DRA7XX_RM_L4CFG_MAILBOX9_CONTEXT_OFFSET,
1114 },
1115 },
1116};
1117
1118/* mailbox10 */
1119static struct omap_hwmod dra7xx_mailbox10_hwmod = {
1120 .name = "mailbox10",
1121 .class = &dra7xx_mailbox_hwmod_class,
1122 .clkdm_name = "l4cfg_clkdm",
1123 .prcm = {
1124 .omap4 = {
1125 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX10_CLKCTRL_OFFSET,
1126 .context_offs = DRA7XX_RM_L4CFG_MAILBOX10_CONTEXT_OFFSET,
1127 },
1128 },
1129};
1130
1131/* mailbox11 */
1132static struct omap_hwmod dra7xx_mailbox11_hwmod = {
1133 .name = "mailbox11",
1134 .class = &dra7xx_mailbox_hwmod_class,
1135 .clkdm_name = "l4cfg_clkdm",
1136 .prcm = {
1137 .omap4 = {
1138 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX11_CLKCTRL_OFFSET,
1139 .context_offs = DRA7XX_RM_L4CFG_MAILBOX11_CONTEXT_OFFSET,
1140 },
1141 },
1142};
1143
1144/* mailbox12 */
1145static struct omap_hwmod dra7xx_mailbox12_hwmod = {
1146 .name = "mailbox12",
1147 .class = &dra7xx_mailbox_hwmod_class,
1148 .clkdm_name = "l4cfg_clkdm",
1149 .prcm = {
1150 .omap4 = {
1151 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX12_CLKCTRL_OFFSET,
1152 .context_offs = DRA7XX_RM_L4CFG_MAILBOX12_CONTEXT_OFFSET,
1153 },
1154 },
1155};
1156
1157/* mailbox13 */
1158static struct omap_hwmod dra7xx_mailbox13_hwmod = {
1159 .name = "mailbox13",
1160 .class = &dra7xx_mailbox_hwmod_class,
1161 .clkdm_name = "l4cfg_clkdm",
1162 .prcm = {
1163 .omap4 = {
1164 .clkctrl_offs = DRA7XX_CM_L4CFG_MAILBOX13_CLKCTRL_OFFSET,
1165 .context_offs = DRA7XX_RM_L4CFG_MAILBOX13_CONTEXT_OFFSET,
1166 },
1167 },
1168};
1169
1170/*
942 * 'mcspi' class 1171 * 'mcspi' class
943 * 1172 *
944 */ 1173 */
@@ -1215,6 +1444,97 @@ static struct omap_hwmod dra7xx_ocp2scp1_hwmod = {
1215 }, 1444 },
1216}; 1445};
1217 1446
1447/* ocp2scp3 */
1448static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
1449 .name = "ocp2scp3",
1450 .class = &dra7xx_ocp2scp_hwmod_class,
1451 .clkdm_name = "l3init_clkdm",
1452 .main_clk = "l4_root_clk_div",
1453 .prcm = {
1454 .omap4 = {
1455 .clkctrl_offs = DRA7XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET,
1456 .context_offs = DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET,
1457 .modulemode = MODULEMODE_HWCTRL,
1458 },
1459 },
1460};
1461
1462/*
1463 * 'PCIE' class
1464 *
1465 */
1466
1467static struct omap_hwmod_class dra7xx_pcie_hwmod_class = {
1468 .name = "pcie",
1469};
1470
1471/* pcie1 */
1472static struct omap_hwmod dra7xx_pcie1_hwmod = {
1473 .name = "pcie1",
1474 .class = &dra7xx_pcie_hwmod_class,
1475 .clkdm_name = "pcie_clkdm",
1476 .main_clk = "l4_root_clk_div",
1477 .prcm = {
1478 .omap4 = {
1479 .clkctrl_offs = DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET,
1480 .modulemode = MODULEMODE_SWCTRL,
1481 },
1482 },
1483};
1484
1485/* pcie2 */
1486static struct omap_hwmod dra7xx_pcie2_hwmod = {
1487 .name = "pcie2",
1488 .class = &dra7xx_pcie_hwmod_class,
1489 .clkdm_name = "pcie_clkdm",
1490 .main_clk = "l4_root_clk_div",
1491 .prcm = {
1492 .omap4 = {
1493 .clkctrl_offs = DRA7XX_CM_PCIE_CLKSTCTRL_OFFSET,
1494 .modulemode = MODULEMODE_SWCTRL,
1495 },
1496 },
1497};
1498
1499/*
1500 * 'PCIE PHY' class
1501 *
1502 */
1503
1504static struct omap_hwmod_class dra7xx_pcie_phy_hwmod_class = {
1505 .name = "pcie-phy",
1506};
1507
1508/* pcie1 phy */
1509static struct omap_hwmod dra7xx_pcie1_phy_hwmod = {
1510 .name = "pcie1-phy",
1511 .class = &dra7xx_pcie_phy_hwmod_class,
1512 .clkdm_name = "l3init_clkdm",
1513 .main_clk = "l4_root_clk_div",
1514 .prcm = {
1515 .omap4 = {
1516 .clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS1_CLKCTRL_OFFSET,
1517 .context_offs = DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET,
1518 .modulemode = MODULEMODE_SWCTRL,
1519 },
1520 },
1521};
1522
1523/* pcie2 phy */
1524static struct omap_hwmod dra7xx_pcie2_phy_hwmod = {
1525 .name = "pcie2-phy",
1526 .class = &dra7xx_pcie_phy_hwmod_class,
1527 .clkdm_name = "l3init_clkdm",
1528 .main_clk = "l4_root_clk_div",
1529 .prcm = {
1530 .omap4 = {
1531 .clkctrl_offs = DRA7XX_CM_L3INIT_PCIESS2_CLKCTRL_OFFSET,
1532 .context_offs = DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET,
1533 .modulemode = MODULEMODE_SWCTRL,
1534 },
1535 },
1536};
1537
1218/* 1538/*
1219 * 'qspi' class 1539 * 'qspi' class
1220 * 1540 *
@@ -1249,6 +1569,38 @@ static struct omap_hwmod dra7xx_qspi_hwmod = {
1249}; 1569};
1250 1570
1251/* 1571/*
1572 * 'rtcss' class
1573 *
1574 */
1575static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = {
1576 .sysc_offs = 0x0078,
1577 .sysc_flags = SYSC_HAS_SIDLEMODE,
1578 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1579 SIDLE_SMART_WKUP),
1580 .sysc_fields = &omap_hwmod_sysc_type3,
1581};
1582
1583static struct omap_hwmod_class dra7xx_rtcss_hwmod_class = {
1584 .name = "rtcss",
1585 .sysc = &dra7xx_rtcss_sysc,
1586};
1587
1588/* rtcss */
1589static struct omap_hwmod dra7xx_rtcss_hwmod = {
1590 .name = "rtcss",
1591 .class = &dra7xx_rtcss_hwmod_class,
1592 .clkdm_name = "rtc_clkdm",
1593 .main_clk = "sys_32k_ck",
1594 .prcm = {
1595 .omap4 = {
1596 .clkctrl_offs = DRA7XX_CM_RTC_RTCSS_CLKCTRL_OFFSET,
1597 .context_offs = DRA7XX_RM_RTC_RTCSS_CONTEXT_OFFSET,
1598 .modulemode = MODULEMODE_SWCTRL,
1599 },
1600 },
1601};
1602
1603/*
1252 * 'sata' class 1604 * 'sata' class
1253 * 1605 *
1254 */ 1606 */
@@ -2007,6 +2359,19 @@ static struct omap_hwmod_ocp_if dra7xx_l4_wkup__ctrl_module_wkup = {
2007 .user = OCP_USER_MPU | OCP_USER_SDMA, 2359 .user = OCP_USER_MPU | OCP_USER_SDMA,
2008}; 2360};
2009 2361
2362static struct omap_hwmod_ocp_if dra7xx_l4_per2__cpgmac0 = {
2363 .master = &dra7xx_l4_per2_hwmod,
2364 .slave = &dra7xx_gmac_hwmod,
2365 .clk = "dpll_gmac_ck",
2366 .user = OCP_USER_MPU,
2367};
2368
2369static struct omap_hwmod_ocp_if dra7xx_gmac__mdio = {
2370 .master = &dra7xx_gmac_hwmod,
2371 .slave = &dra7xx_mdio_hwmod,
2372 .user = OCP_USER_MPU,
2373};
2374
2010/* l4_wkup -> dcan1 */ 2375/* l4_wkup -> dcan1 */
2011static struct omap_hwmod_ocp_if dra7xx_l4_wkup__dcan1 = { 2376static struct omap_hwmod_ocp_if dra7xx_l4_wkup__dcan1 = {
2012 .master = &dra7xx_l4_wkup_hwmod, 2377 .master = &dra7xx_l4_wkup_hwmod,
@@ -2254,6 +2619,110 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c5 = {
2254 .user = OCP_USER_MPU | OCP_USER_SDMA, 2619 .user = OCP_USER_MPU | OCP_USER_SDMA,
2255}; 2620};
2256 2621
2622/* l4_cfg -> mailbox1 */
2623static struct omap_hwmod_ocp_if dra7xx_l4_cfg__mailbox1 = {
2624 .master = &dra7xx_l4_cfg_hwmod,
2625 .slave = &dra7xx_mailbox1_hwmod,
2626 .clk = "l3_iclk_div",
2627 .user = OCP_USER_MPU | OCP_USER_SDMA,
2628};
2629
2630/* l4_per3 -> mailbox2 */
2631static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox2 = {
2632 .master = &dra7xx_l4_per3_hwmod,
2633 .slave = &dra7xx_mailbox2_hwmod,
2634 .clk = "l3_iclk_div",
2635 .user = OCP_USER_MPU | OCP_USER_SDMA,
2636};
2637
2638/* l4_per3 -> mailbox3 */
2639static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox3 = {
2640 .master = &dra7xx_l4_per3_hwmod,
2641 .slave = &dra7xx_mailbox3_hwmod,
2642 .clk = "l3_iclk_div",
2643 .user = OCP_USER_MPU | OCP_USER_SDMA,
2644};
2645
2646/* l4_per3 -> mailbox4 */
2647static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox4 = {
2648 .master = &dra7xx_l4_per3_hwmod,
2649 .slave = &dra7xx_mailbox4_hwmod,
2650 .clk = "l3_iclk_div",
2651 .user = OCP_USER_MPU | OCP_USER_SDMA,
2652};
2653
2654/* l4_per3 -> mailbox5 */
2655static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox5 = {
2656 .master = &dra7xx_l4_per3_hwmod,
2657 .slave = &dra7xx_mailbox5_hwmod,
2658 .clk = "l3_iclk_div",
2659 .user = OCP_USER_MPU | OCP_USER_SDMA,
2660};
2661
2662/* l4_per3 -> mailbox6 */
2663static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox6 = {
2664 .master = &dra7xx_l4_per3_hwmod,
2665 .slave = &dra7xx_mailbox6_hwmod,
2666 .clk = "l3_iclk_div",
2667 .user = OCP_USER_MPU | OCP_USER_SDMA,
2668};
2669
2670/* l4_per3 -> mailbox7 */
2671static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox7 = {
2672 .master = &dra7xx_l4_per3_hwmod,
2673 .slave = &dra7xx_mailbox7_hwmod,
2674 .clk = "l3_iclk_div",
2675 .user = OCP_USER_MPU | OCP_USER_SDMA,
2676};
2677
2678/* l4_per3 -> mailbox8 */
2679static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox8 = {
2680 .master = &dra7xx_l4_per3_hwmod,
2681 .slave = &dra7xx_mailbox8_hwmod,
2682 .clk = "l3_iclk_div",
2683 .user = OCP_USER_MPU | OCP_USER_SDMA,
2684};
2685
2686/* l4_per3 -> mailbox9 */
2687static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox9 = {
2688 .master = &dra7xx_l4_per3_hwmod,
2689 .slave = &dra7xx_mailbox9_hwmod,
2690 .clk = "l3_iclk_div",
2691 .user = OCP_USER_MPU | OCP_USER_SDMA,
2692};
2693
2694/* l4_per3 -> mailbox10 */
2695static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox10 = {
2696 .master = &dra7xx_l4_per3_hwmod,
2697 .slave = &dra7xx_mailbox10_hwmod,
2698 .clk = "l3_iclk_div",
2699 .user = OCP_USER_MPU | OCP_USER_SDMA,
2700};
2701
2702/* l4_per3 -> mailbox11 */
2703static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox11 = {
2704 .master = &dra7xx_l4_per3_hwmod,
2705 .slave = &dra7xx_mailbox11_hwmod,
2706 .clk = "l3_iclk_div",
2707 .user = OCP_USER_MPU | OCP_USER_SDMA,
2708};
2709
2710/* l4_per3 -> mailbox12 */
2711static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox12 = {
2712 .master = &dra7xx_l4_per3_hwmod,
2713 .slave = &dra7xx_mailbox12_hwmod,
2714 .clk = "l3_iclk_div",
2715 .user = OCP_USER_MPU | OCP_USER_SDMA,
2716};
2717
2718/* l4_per3 -> mailbox13 */
2719static struct omap_hwmod_ocp_if dra7xx_l4_per3__mailbox13 = {
2720 .master = &dra7xx_l4_per3_hwmod,
2721 .slave = &dra7xx_mailbox13_hwmod,
2722 .clk = "l3_iclk_div",
2723 .user = OCP_USER_MPU | OCP_USER_SDMA,
2724};
2725
2257/* l4_per1 -> mcspi1 */ 2726/* l4_per1 -> mcspi1 */
2258static struct omap_hwmod_ocp_if dra7xx_l4_per1__mcspi1 = { 2727static struct omap_hwmod_ocp_if dra7xx_l4_per1__mcspi1 = {
2259 .master = &dra7xx_l4_per1_hwmod, 2728 .master = &dra7xx_l4_per1_hwmod,
@@ -2334,6 +2803,62 @@ static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp1 = {
2334 .user = OCP_USER_MPU | OCP_USER_SDMA, 2803 .user = OCP_USER_MPU | OCP_USER_SDMA,
2335}; 2804};
2336 2805
2806/* l4_cfg -> ocp2scp3 */
2807static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp3 = {
2808 .master = &dra7xx_l4_cfg_hwmod,
2809 .slave = &dra7xx_ocp2scp3_hwmod,
2810 .clk = "l4_root_clk_div",
2811 .user = OCP_USER_MPU | OCP_USER_SDMA,
2812};
2813
2814/* l3_main_1 -> pcie1 */
2815static struct omap_hwmod_ocp_if dra7xx_l3_main_1__pcie1 = {
2816 .master = &dra7xx_l3_main_1_hwmod,
2817 .slave = &dra7xx_pcie1_hwmod,
2818 .clk = "l3_iclk_div",
2819 .user = OCP_USER_MPU | OCP_USER_SDMA,
2820};
2821
2822/* l4_cfg -> pcie1 */
2823static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1 = {
2824 .master = &dra7xx_l4_cfg_hwmod,
2825 .slave = &dra7xx_pcie1_hwmod,
2826 .clk = "l4_root_clk_div",
2827 .user = OCP_USER_MPU | OCP_USER_SDMA,
2828};
2829
2830/* l3_main_1 -> pcie2 */
2831static struct omap_hwmod_ocp_if dra7xx_l3_main_1__pcie2 = {
2832 .master = &dra7xx_l3_main_1_hwmod,
2833 .slave = &dra7xx_pcie2_hwmod,
2834 .clk = "l3_iclk_div",
2835 .user = OCP_USER_MPU | OCP_USER_SDMA,
2836};
2837
2838/* l4_cfg -> pcie2 */
2839static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie2 = {
2840 .master = &dra7xx_l4_cfg_hwmod,
2841 .slave = &dra7xx_pcie2_hwmod,
2842 .clk = "l4_root_clk_div",
2843 .user = OCP_USER_MPU | OCP_USER_SDMA,
2844};
2845
2846/* l4_cfg -> pcie1 phy */
2847static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie1_phy = {
2848 .master = &dra7xx_l4_cfg_hwmod,
2849 .slave = &dra7xx_pcie1_phy_hwmod,
2850 .clk = "l4_root_clk_div",
2851 .user = OCP_USER_MPU | OCP_USER_SDMA,
2852};
2853
2854/* l4_cfg -> pcie2 phy */
2855static struct omap_hwmod_ocp_if dra7xx_l4_cfg__pcie2_phy = {
2856 .master = &dra7xx_l4_cfg_hwmod,
2857 .slave = &dra7xx_pcie2_phy_hwmod,
2858 .clk = "l4_root_clk_div",
2859 .user = OCP_USER_MPU | OCP_USER_SDMA,
2860};
2861
2337static struct omap_hwmod_addr_space dra7xx_qspi_addrs[] = { 2862static struct omap_hwmod_addr_space dra7xx_qspi_addrs[] = {
2338 { 2863 {
2339 .pa_start = 0x4b300000, 2864 .pa_start = 0x4b300000,
@@ -2352,6 +2877,14 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__qspi = {
2352 .user = OCP_USER_MPU | OCP_USER_SDMA, 2877 .user = OCP_USER_MPU | OCP_USER_SDMA,
2353}; 2878};
2354 2879
2880/* l4_per3 -> rtcss */
2881static struct omap_hwmod_ocp_if dra7xx_l4_per3__rtcss = {
2882 .master = &dra7xx_l4_per3_hwmod,
2883 .slave = &dra7xx_rtcss_hwmod,
2884 .clk = "l4_root_clk_div",
2885 .user = OCP_USER_MPU | OCP_USER_SDMA,
2886};
2887
2355static struct omap_hwmod_addr_space dra7xx_sata_addrs[] = { 2888static struct omap_hwmod_addr_space dra7xx_sata_addrs[] = {
2356 { 2889 {
2357 .name = "sysc", 2890 .name = "sysc",
@@ -2650,6 +3183,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
2650 &dra7xx_l4_wkup__ctrl_module_wkup, 3183 &dra7xx_l4_wkup__ctrl_module_wkup,
2651 &dra7xx_l4_wkup__dcan1, 3184 &dra7xx_l4_wkup__dcan1,
2652 &dra7xx_l4_per2__dcan2, 3185 &dra7xx_l4_per2__dcan2,
3186 &dra7xx_l4_per2__cpgmac0,
3187 &dra7xx_gmac__mdio,
2653 &dra7xx_l4_cfg__dma_system, 3188 &dra7xx_l4_cfg__dma_system,
2654 &dra7xx_l3_main_1__dss, 3189 &dra7xx_l3_main_1__dss,
2655 &dra7xx_l3_main_1__dispc, 3190 &dra7xx_l3_main_1__dispc,
@@ -2670,6 +3205,19 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
2670 &dra7xx_l4_per1__i2c3, 3205 &dra7xx_l4_per1__i2c3,
2671 &dra7xx_l4_per1__i2c4, 3206 &dra7xx_l4_per1__i2c4,
2672 &dra7xx_l4_per1__i2c5, 3207 &dra7xx_l4_per1__i2c5,
3208 &dra7xx_l4_cfg__mailbox1,
3209 &dra7xx_l4_per3__mailbox2,
3210 &dra7xx_l4_per3__mailbox3,
3211 &dra7xx_l4_per3__mailbox4,
3212 &dra7xx_l4_per3__mailbox5,
3213 &dra7xx_l4_per3__mailbox6,
3214 &dra7xx_l4_per3__mailbox7,
3215 &dra7xx_l4_per3__mailbox8,
3216 &dra7xx_l4_per3__mailbox9,
3217 &dra7xx_l4_per3__mailbox10,
3218 &dra7xx_l4_per3__mailbox11,
3219 &dra7xx_l4_per3__mailbox12,
3220 &dra7xx_l4_per3__mailbox13,
2673 &dra7xx_l4_per1__mcspi1, 3221 &dra7xx_l4_per1__mcspi1,
2674 &dra7xx_l4_per1__mcspi2, 3222 &dra7xx_l4_per1__mcspi2,
2675 &dra7xx_l4_per1__mcspi3, 3223 &dra7xx_l4_per1__mcspi3,
@@ -2680,7 +3228,15 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
2680 &dra7xx_l4_per1__mmc4, 3228 &dra7xx_l4_per1__mmc4,
2681 &dra7xx_l4_cfg__mpu, 3229 &dra7xx_l4_cfg__mpu,
2682 &dra7xx_l4_cfg__ocp2scp1, 3230 &dra7xx_l4_cfg__ocp2scp1,
3231 &dra7xx_l4_cfg__ocp2scp3,
3232 &dra7xx_l3_main_1__pcie1,
3233 &dra7xx_l4_cfg__pcie1,
3234 &dra7xx_l3_main_1__pcie2,
3235 &dra7xx_l4_cfg__pcie2,
3236 &dra7xx_l4_cfg__pcie1_phy,
3237 &dra7xx_l4_cfg__pcie2_phy,
2683 &dra7xx_l3_main_1__qspi, 3238 &dra7xx_l3_main_1__qspi,
3239 &dra7xx_l4_per3__rtcss,
2684 &dra7xx_l4_cfg__sata, 3240 &dra7xx_l4_cfg__sata,
2685 &dra7xx_l4_cfg__smartreflex_core, 3241 &dra7xx_l4_cfg__smartreflex_core,
2686 &dra7xx_l4_cfg__smartreflex_mpu, 3242 &dra7xx_l4_cfg__smartreflex_mpu,
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 2c38c6b0ee03..11ed5a17dd77 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -33,7 +33,6 @@ extern struct omap_hwmod_addr_space omap2_mcspi1_addr_space[];
33extern struct omap_hwmod_addr_space omap2_mcspi2_addr_space[]; 33extern struct omap_hwmod_addr_space omap2_mcspi2_addr_space[];
34extern struct omap_hwmod_addr_space omap2430_mcspi3_addr_space[]; 34extern struct omap_hwmod_addr_space omap2430_mcspi3_addr_space[];
35extern struct omap_hwmod_addr_space omap2_dma_system_addrs[]; 35extern struct omap_hwmod_addr_space omap2_dma_system_addrs[];
36extern struct omap_hwmod_addr_space omap2_mailbox_addrs[];
37extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[]; 36extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[];
38extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[]; 37extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[];
39 38
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_common_ipblock_data.c
new file mode 100644
index 000000000000..f21664da25a2
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_common_ipblock_data.c
@@ -0,0 +1,55 @@
1/*
2 * omap_hwmod_common_ipblock_data.c - common IP block data for OMAP2+
3 *
4 * Copyright (C) 2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include "omap_hwmod.h"
14#include "omap_hwmod_common_data.h"
15
16/*
17 * 'dss' class
18 * display sub-system
19 */
20
21static struct omap_hwmod_class_sysconfig omap2_dss_sysc = {
22 .rev_offs = 0x0000,
23 .sysc_offs = 0x0010,
24 .syss_offs = 0x0014,
25 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
26 SYSS_HAS_RESET_STATUS),
27 .sysc_fields = &omap_hwmod_sysc_type1,
28};
29
30struct omap_hwmod_class omap2_dss_hwmod_class = {
31 .name = "dss",
32 .sysc = &omap2_dss_sysc,
33 .reset = omap_dss_reset,
34};
35
36/*
37 * 'rfbi' class
38 * remote frame buffer interface
39 */
40
41static struct omap_hwmod_class_sysconfig omap2_rfbi_sysc = {
42 .rev_offs = 0x0000,
43 .sysc_offs = 0x0010,
44 .syss_offs = 0x0014,
45 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
46 SYSC_HAS_AUTOIDLE),
47 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
48 .sysc_fields = &omap_hwmod_sysc_type1,
49};
50
51struct omap_hwmod_class omap2_rfbi_hwmod_class = {
52 .name = "rfbi",
53 .sysc = &omap2_rfbi_sysc,
54};
55
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index a5ea988ff340..fe01c5a03aa2 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -75,9 +75,9 @@ static int omap2_enter_full_retention(void)
75 75
76 /* Clear old wake-up events */ 76 /* Clear old wake-up events */
77 /* REVISIT: These write to reserved bits? */ 77 /* REVISIT: These write to reserved bits? */
78 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1); 78 omap2xxx_prm_clear_mod_irqs(CORE_MOD, PM_WKST1, ~0);
79 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2); 79 omap2xxx_prm_clear_mod_irqs(CORE_MOD, OMAP24XX_PM_WKST2, ~0);
80 omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); 80 omap2xxx_prm_clear_mod_irqs(WKUP_MOD, PM_WKST, ~0);
81 81
82 pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_RET); 82 pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_RET);
83 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); 83 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET);
@@ -104,23 +104,18 @@ no_sleep:
104 clk_enable(osc_ck); 104 clk_enable(osc_ck);
105 105
106 /* clear CORE wake-up events */ 106 /* clear CORE wake-up events */
107 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1); 107 omap2xxx_prm_clear_mod_irqs(CORE_MOD, PM_WKST1, ~0);
108 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2); 108 omap2xxx_prm_clear_mod_irqs(CORE_MOD, OMAP24XX_PM_WKST2, ~0);
109 109
110 /* wakeup domain events - bit 1: GPT1, bit5 GPIO */ 110 /* wakeup domain events - bit 1: GPT1, bit5 GPIO */
111 omap2_prm_clear_mod_reg_bits(0x4 | 0x1, WKUP_MOD, PM_WKST); 111 omap2xxx_prm_clear_mod_irqs(WKUP_MOD, PM_WKST, 0x4 | 0x1);
112 112
113 /* MPU domain wake events */ 113 /* MPU domain wake events */
114 l = omap2_prm_read_mod_reg(OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); 114 omap2xxx_prm_clear_mod_irqs(OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET,
115 if (l & 0x01) 115 0x1);
116 omap2_prm_write_mod_reg(0x01, OCP_MOD,
117 OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
118 if (l & 0x20)
119 omap2_prm_write_mod_reg(0x20, OCP_MOD,
120 OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
121 116
122 /* Mask future PRCM-to-MPU interrupts */ 117 omap2xxx_prm_clear_mod_irqs(OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET,
123 omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); 118 0x20);
124 119
125 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); 120 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
126 pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_ON); 121 pwrdm_set_next_pwrst(core_pwrdm, PWRDM_POWER_ON);
@@ -148,9 +143,9 @@ static void omap2_enter_mpu_retention(void)
148 * it is in retention mode. */ 143 * it is in retention mode. */
149 if (omap2_allow_mpu_retention()) { 144 if (omap2_allow_mpu_retention()) {
150 /* REVISIT: These write to reserved bits? */ 145 /* REVISIT: These write to reserved bits? */
151 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1); 146 omap2xxx_prm_clear_mod_irqs(CORE_MOD, PM_WKST1, ~0);
152 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2); 147 omap2xxx_prm_clear_mod_irqs(CORE_MOD, OMAP24XX_PM_WKST2, ~0);
153 omap2_prm_write_mod_reg(0xffffffff, WKUP_MOD, PM_WKST); 148 omap2xxx_prm_clear_mod_irqs(WKUP_MOD, PM_WKST, ~0);
154 149
155 /* Try to enter MPU retention */ 150 /* Try to enter MPU retention */
156 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET); 151 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_RET);
@@ -249,6 +244,10 @@ static void __init prcm_setup_regs(void)
249 /* Enable wake-up events */ 244 /* Enable wake-up events */
250 omap2_prm_write_mod_reg(OMAP24XX_EN_GPIOS_MASK | OMAP24XX_EN_GPT1_MASK, 245 omap2_prm_write_mod_reg(OMAP24XX_EN_GPIOS_MASK | OMAP24XX_EN_GPT1_MASK,
251 WKUP_MOD, PM_WKEN); 246 WKUP_MOD, PM_WKEN);
247
248 /* Enable SYS_CLKEN control when all domains idle */
249 omap2_prm_set_mod_reg_bits(OMAP_AUTOEXTCLKMODE_MASK, OMAP24XX_GR_MOD,
250 OMAP2_PRCM_CLKSRC_CTRL_OFFSET);
252} 251}
253 252
254int __init omap2_pm_init(void) 253int __init omap2_pm_init(void)
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 507d8eeaab95..3f80929a5f7e 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -133,60 +133,13 @@ static void omap3_save_secure_ram_context(void)
133 } 133 }
134} 134}
135 135
136/*
137 * PRCM Interrupt Handler Helper Function
138 *
139 * The purpose of this function is to clear any wake-up events latched
140 * in the PRCM PM_WKST_x registers. It is possible that a wake-up event
141 * may occur whilst attempting to clear a PM_WKST_x register and thus
142 * set another bit in this register. A while loop is used to ensure
143 * that any peripheral wake-up events occurring while attempting to
144 * clear the PM_WKST_x are detected and cleared.
145 */
146static int prcm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits)
147{
148 u32 wkst, fclk, iclk, clken;
149 u16 wkst_off = (regs == 3) ? OMAP3430ES2_PM_WKST3 : PM_WKST1;
150 u16 fclk_off = (regs == 3) ? OMAP3430ES2_CM_FCLKEN3 : CM_FCLKEN1;
151 u16 iclk_off = (regs == 3) ? CM_ICLKEN3 : CM_ICLKEN1;
152 u16 grpsel_off = (regs == 3) ?
153 OMAP3430ES2_PM_MPUGRPSEL3 : OMAP3430_PM_MPUGRPSEL;
154 int c = 0;
155
156 wkst = omap2_prm_read_mod_reg(module, wkst_off);
157 wkst &= omap2_prm_read_mod_reg(module, grpsel_off);
158 wkst &= ~ignore_bits;
159 if (wkst) {
160 iclk = omap2_cm_read_mod_reg(module, iclk_off);
161 fclk = omap2_cm_read_mod_reg(module, fclk_off);
162 while (wkst) {
163 clken = wkst;
164 omap2_cm_set_mod_reg_bits(clken, module, iclk_off);
165 /*
166 * For USBHOST, we don't know whether HOST1 or
167 * HOST2 woke us up, so enable both f-clocks
168 */
169 if (module == OMAP3430ES2_USBHOST_MOD)
170 clken |= 1 << OMAP3430ES2_EN_USBHOST2_SHIFT;
171 omap2_cm_set_mod_reg_bits(clken, module, fclk_off);
172 omap2_prm_write_mod_reg(wkst, module, wkst_off);
173 wkst = omap2_prm_read_mod_reg(module, wkst_off);
174 wkst &= ~ignore_bits;
175 c++;
176 }
177 omap2_cm_write_mod_reg(iclk, module, iclk_off);
178 omap2_cm_write_mod_reg(fclk, module, fclk_off);
179 }
180
181 return c;
182}
183
184static irqreturn_t _prcm_int_handle_io(int irq, void *unused) 136static irqreturn_t _prcm_int_handle_io(int irq, void *unused)
185{ 137{
186 int c; 138 int c;
187 139
188 c = prcm_clear_mod_irqs(WKUP_MOD, 1, 140 c = omap3xxx_prm_clear_mod_irqs(WKUP_MOD, 1,
189 ~(OMAP3430_ST_IO_MASK | OMAP3430_ST_IO_CHAIN_MASK)); 141 ~(OMAP3430_ST_IO_MASK |
142 OMAP3430_ST_IO_CHAIN_MASK));
190 143
191 return c ? IRQ_HANDLED : IRQ_NONE; 144 return c ? IRQ_HANDLED : IRQ_NONE;
192} 145}
@@ -200,13 +153,14 @@ static irqreturn_t _prcm_int_handle_wakeup(int irq, void *unused)
200 * these are handled in a separate handler to avoid acking 153 * these are handled in a separate handler to avoid acking
201 * IO events before parsing in mux code 154 * IO events before parsing in mux code
202 */ 155 */
203 c = prcm_clear_mod_irqs(WKUP_MOD, 1, 156 c = omap3xxx_prm_clear_mod_irqs(WKUP_MOD, 1,
204 OMAP3430_ST_IO_MASK | OMAP3430_ST_IO_CHAIN_MASK); 157 OMAP3430_ST_IO_MASK |
205 c += prcm_clear_mod_irqs(CORE_MOD, 1, 0); 158 OMAP3430_ST_IO_CHAIN_MASK);
206 c += prcm_clear_mod_irqs(OMAP3430_PER_MOD, 1, 0); 159 c += omap3xxx_prm_clear_mod_irqs(CORE_MOD, 1, 0);
160 c += omap3xxx_prm_clear_mod_irqs(OMAP3430_PER_MOD, 1, 0);
207 if (omap_rev() > OMAP3430_REV_ES1_0) { 161 if (omap_rev() > OMAP3430_REV_ES1_0) {
208 c += prcm_clear_mod_irqs(CORE_MOD, 3, 0); 162 c += omap3xxx_prm_clear_mod_irqs(CORE_MOD, 3, 0);
209 c += prcm_clear_mod_irqs(OMAP3430ES2_USBHOST_MOD, 1, 0); 163 c += omap3xxx_prm_clear_mod_irqs(OMAP3430ES2_USBHOST_MOD, 1, 0);
210 } 164 }
211 165
212 return c ? IRQ_HANDLED : IRQ_NONE; 166 return c ? IRQ_HANDLED : IRQ_NONE;
@@ -399,159 +353,11 @@ restore:
399#define omap3_pm_suspend NULL 353#define omap3_pm_suspend NULL
400#endif /* CONFIG_SUSPEND */ 354#endif /* CONFIG_SUSPEND */
401 355
402
403/**
404 * omap3_iva_idle(): ensure IVA is in idle so it can be put into
405 * retention
406 *
407 * In cases where IVA2 is activated by bootcode, it may prevent
408 * full-chip retention or off-mode because it is not idle. This
409 * function forces the IVA2 into idle state so it can go
410 * into retention/off and thus allow full-chip retention/off.
411 *
412 **/
413static void __init omap3_iva_idle(void)
414{
415 /* ensure IVA2 clock is disabled */
416 omap2_cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
417
418 /* if no clock activity, nothing else to do */
419 if (!(omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSTST) &
420 OMAP3430_CLKACTIVITY_IVA2_MASK))
421 return;
422
423 /* Reset IVA2 */
424 omap2_prm_write_mod_reg(OMAP3430_RST1_IVA2_MASK |
425 OMAP3430_RST2_IVA2_MASK |
426 OMAP3430_RST3_IVA2_MASK,
427 OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
428
429 /* Enable IVA2 clock */
430 omap2_cm_write_mod_reg(OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK,
431 OMAP3430_IVA2_MOD, CM_FCLKEN);
432
433 /* Set IVA2 boot mode to 'idle' */
434 omap3_ctrl_set_iva_bootmode_idle();
435
436 /* Un-reset IVA2 */
437 omap2_prm_write_mod_reg(0, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
438
439 /* Disable IVA2 clock */
440 omap2_cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
441
442 /* Reset IVA2 */
443 omap2_prm_write_mod_reg(OMAP3430_RST1_IVA2_MASK |
444 OMAP3430_RST2_IVA2_MASK |
445 OMAP3430_RST3_IVA2_MASK,
446 OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
447}
448
449static void __init omap3_d2d_idle(void)
450{
451 u16 mask, padconf;
452
453 /* In a stand alone OMAP3430 where there is not a stacked
454 * modem for the D2D Idle Ack and D2D MStandby must be pulled
455 * high. S CONTROL_PADCONF_SAD2D_IDLEACK and
456 * CONTROL_PADCONF_SAD2D_MSTDBY to have a pull up. */
457 mask = (1 << 4) | (1 << 3); /* pull-up, enabled */
458 padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_MSTANDBY);
459 padconf |= mask;
460 omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_MSTANDBY);
461
462 padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_IDLEACK);
463 padconf |= mask;
464 omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_IDLEACK);
465
466 /* reset modem */
467 omap2_prm_write_mod_reg(OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RSTPWRON_MASK |
468 OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RST_MASK,
469 CORE_MOD, OMAP2_RM_RSTCTRL);
470 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP2_RM_RSTCTRL);
471}
472
473static void __init prcm_setup_regs(void) 356static void __init prcm_setup_regs(void)
474{ 357{
475 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ? 358 omap3_ctrl_init();
476 OMAP3630_EN_UART4_MASK : 0;
477 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ?
478 OMAP3630_GRPSEL_UART4_MASK : 0;
479
480 /* XXX This should be handled by hwmod code or SCM init code */
481 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG);
482
483 /*
484 * Enable control of expternal oscillator through
485 * sys_clkreq. In the long run clock framework should
486 * take care of this.
487 */
488 omap2_prm_rmw_mod_reg_bits(OMAP_AUTOEXTCLKMODE_MASK,
489 1 << OMAP_AUTOEXTCLKMODE_SHIFT,
490 OMAP3430_GR_MOD,
491 OMAP3_PRM_CLKSRC_CTRL_OFFSET);
492
493 /* setup wakup source */
494 omap2_prm_write_mod_reg(OMAP3430_EN_IO_MASK | OMAP3430_EN_GPIO1_MASK |
495 OMAP3430_EN_GPT1_MASK | OMAP3430_EN_GPT12_MASK,
496 WKUP_MOD, PM_WKEN);
497 /* No need to write EN_IO, that is always enabled */
498 omap2_prm_write_mod_reg(OMAP3430_GRPSEL_GPIO1_MASK |
499 OMAP3430_GRPSEL_GPT1_MASK |
500 OMAP3430_GRPSEL_GPT12_MASK,
501 WKUP_MOD, OMAP3430_PM_MPUGRPSEL);
502
503 /* Enable PM_WKEN to support DSS LPR */
504 omap2_prm_write_mod_reg(OMAP3430_PM_WKEN_DSS_EN_DSS_MASK,
505 OMAP3430_DSS_MOD, PM_WKEN);
506
507 /* Enable wakeups in PER */
508 omap2_prm_write_mod_reg(omap3630_en_uart4_mask |
509 OMAP3430_EN_GPIO2_MASK | OMAP3430_EN_GPIO3_MASK |
510 OMAP3430_EN_GPIO4_MASK | OMAP3430_EN_GPIO5_MASK |
511 OMAP3430_EN_GPIO6_MASK | OMAP3430_EN_UART3_MASK |
512 OMAP3430_EN_MCBSP2_MASK | OMAP3430_EN_MCBSP3_MASK |
513 OMAP3430_EN_MCBSP4_MASK,
514 OMAP3430_PER_MOD, PM_WKEN);
515 /* and allow them to wake up MPU */
516 omap2_prm_write_mod_reg(omap3630_grpsel_uart4_mask |
517 OMAP3430_GRPSEL_GPIO2_MASK |
518 OMAP3430_GRPSEL_GPIO3_MASK |
519 OMAP3430_GRPSEL_GPIO4_MASK |
520 OMAP3430_GRPSEL_GPIO5_MASK |
521 OMAP3430_GRPSEL_GPIO6_MASK |
522 OMAP3430_GRPSEL_UART3_MASK |
523 OMAP3430_GRPSEL_MCBSP2_MASK |
524 OMAP3430_GRPSEL_MCBSP3_MASK |
525 OMAP3430_GRPSEL_MCBSP4_MASK,
526 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
527
528 /* Don't attach IVA interrupts */
529 if (omap3_has_iva()) {
530 omap2_prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
531 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
532 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
533 omap2_prm_write_mod_reg(0, OMAP3430_PER_MOD,
534 OMAP3430_PM_IVAGRPSEL);
535 }
536
537 /* Clear any pending 'reset' flags */
538 omap2_prm_write_mod_reg(0xffffffff, MPU_MOD, OMAP2_RM_RSTST);
539 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP2_RM_RSTST);
540 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, OMAP2_RM_RSTST);
541 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, OMAP2_RM_RSTST);
542 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, OMAP2_RM_RSTST);
543 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, OMAP2_RM_RSTST);
544 omap2_prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD, OMAP2_RM_RSTST);
545
546 /* Clear any pending PRCM interrupts */
547 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
548
549 /*
550 * We need to idle iva2_pwrdm even on am3703 with no iva2.
551 */
552 omap3_iva_idle();
553 359
554 omap3_d2d_idle(); 360 omap3_prm_init_pm(cpu_is_omap3630(), omap3_has_iva());
555} 361}
556 362
557void omap3_pm_off_mode_enable(int enable) 363void omap3_pm_off_mode_enable(int enable)
diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h
index 7785be984edd..ad7b3e9977f8 100644
--- a/arch/arm/mach-omap2/prcm43xx.h
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -142,5 +142,6 @@
142#define AM43XX_CM_PER_USBPHYOCP2SCP0_CLKCTRL_OFFSET 0x05B8 142#define AM43XX_CM_PER_USBPHYOCP2SCP0_CLKCTRL_OFFSET 0x05B8
143#define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET 0x0268 143#define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET 0x0268
144#define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET 0x05C0 144#define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET 0x05C0
145#define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET 0x0a20
145 146
146#endif 147#endif
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index a3a3cca2bcc4..86958050547a 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -114,6 +114,24 @@ void omap2xxx_prm_dpll_reset(void)
114 omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL); 114 omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL);
115} 115}
116 116
117/**
118 * omap2xxx_prm_clear_mod_irqs - clear wakeup status bits for a module
119 * @module: PRM module to clear wakeups from
120 * @regs: register offset to clear
121 * @wkst_mask: wakeup status mask to clear
122 *
123 * Clears wakeup status bits for a given module, so that the device can
124 * re-enter idle.
125 */
126void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask)
127{
128 u32 wkst;
129
130 wkst = omap2_prm_read_mod_reg(module, regs);
131 wkst &= wkst_mask;
132 omap2_prm_write_mod_reg(wkst, module, regs);
133}
134
117int omap2xxx_clkdm_sleep(struct clockdomain *clkdm) 135int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
118{ 136{
119 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, 137 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index d2cb6365716f..d73414139292 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -125,6 +125,7 @@ extern 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); 127extern void omap2xxx_prm_dpll_reset(void);
128void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask);
128 129
129extern int __init omap2xxx_prm_init(void); 130extern int __init omap2xxx_prm_init(void);
130 131
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 4bd7a2dca8af..2458be6fc67b 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -26,6 +26,8 @@
26#include "prm2xxx_3xxx.h" 26#include "prm2xxx_3xxx.h"
27#include "cm2xxx_3xxx.h" 27#include "cm2xxx_3xxx.h"
28#include "prm-regbits-34xx.h" 28#include "prm-regbits-34xx.h"
29#include "cm3xxx.h"
30#include "cm-regbits-34xx.h"
29 31
30static const struct omap_prcm_irq omap3_prcm_irqs[] = { 32static const struct omap_prcm_irq omap3_prcm_irqs[] = {
31 OMAP_PRCM_IRQ("wkup", 0, 0), 33 OMAP_PRCM_IRQ("wkup", 0, 0),
@@ -206,6 +208,167 @@ void omap3xxx_prm_restore_irqen(u32 *saved_mask)
206} 208}
207 209
208/** 210/**
211 * omap3xxx_prm_clear_mod_irqs - clear wake-up events from PRCM interrupt
212 * @module: PRM module to clear wakeups from
213 * @regs: register set to clear, 1 or 3
214 * @ignore_bits: wakeup status bits to ignore
215 *
216 * The purpose of this function is to clear any wake-up events latched
217 * in the PRCM PM_WKST_x registers. It is possible that a wake-up event
218 * may occur whilst attempting to clear a PM_WKST_x register and thus
219 * set another bit in this register. A while loop is used to ensure
220 * that any peripheral wake-up events occurring while attempting to
221 * clear the PM_WKST_x are detected and cleared.
222 */
223int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits)
224{
225 u32 wkst, fclk, iclk, clken;
226 u16 wkst_off = (regs == 3) ? OMAP3430ES2_PM_WKST3 : PM_WKST1;
227 u16 fclk_off = (regs == 3) ? OMAP3430ES2_CM_FCLKEN3 : CM_FCLKEN1;
228 u16 iclk_off = (regs == 3) ? CM_ICLKEN3 : CM_ICLKEN1;
229 u16 grpsel_off = (regs == 3) ?
230 OMAP3430ES2_PM_MPUGRPSEL3 : OMAP3430_PM_MPUGRPSEL;
231 int c = 0;
232
233 wkst = omap2_prm_read_mod_reg(module, wkst_off);
234 wkst &= omap2_prm_read_mod_reg(module, grpsel_off);
235 wkst &= ~ignore_bits;
236 if (wkst) {
237 iclk = omap2_cm_read_mod_reg(module, iclk_off);
238 fclk = omap2_cm_read_mod_reg(module, fclk_off);
239 while (wkst) {
240 clken = wkst;
241 omap2_cm_set_mod_reg_bits(clken, module, iclk_off);
242 /*
243 * For USBHOST, we don't know whether HOST1 or
244 * HOST2 woke us up, so enable both f-clocks
245 */
246 if (module == OMAP3430ES2_USBHOST_MOD)
247 clken |= 1 << OMAP3430ES2_EN_USBHOST2_SHIFT;
248 omap2_cm_set_mod_reg_bits(clken, module, fclk_off);
249 omap2_prm_write_mod_reg(wkst, module, wkst_off);
250 wkst = omap2_prm_read_mod_reg(module, wkst_off);
251 wkst &= ~ignore_bits;
252 c++;
253 }
254 omap2_cm_write_mod_reg(iclk, module, iclk_off);
255 omap2_cm_write_mod_reg(fclk, module, fclk_off);
256 }
257
258 return c;
259}
260
261/**
262 * omap3_prm_reset_modem - toggle reset signal for modem
263 *
264 * Toggles the reset signal to modem IP block. Required to allow
265 * OMAP3430 without stacked modem to idle properly.
266 */
267void __init omap3_prm_reset_modem(void)
268{
269 omap2_prm_write_mod_reg(
270 OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RSTPWRON_MASK |
271 OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RST_MASK,
272 CORE_MOD, OMAP2_RM_RSTCTRL);
273 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP2_RM_RSTCTRL);
274}
275
276/**
277 * omap3_prm_init_pm - initialize PM related registers for PRM
278 * @has_uart4: SoC has UART4
279 * @has_iva: SoC has IVA
280 *
281 * Initializes PRM registers for PM use. Called from PM init.
282 */
283void __init omap3_prm_init_pm(bool has_uart4, bool has_iva)
284{
285 u32 en_uart4_mask;
286 u32 grpsel_uart4_mask;
287
288 /*
289 * Enable control of expternal oscillator through
290 * sys_clkreq. In the long run clock framework should
291 * take care of this.
292 */
293 omap2_prm_rmw_mod_reg_bits(OMAP_AUTOEXTCLKMODE_MASK,
294 1 << OMAP_AUTOEXTCLKMODE_SHIFT,
295 OMAP3430_GR_MOD,
296 OMAP3_PRM_CLKSRC_CTRL_OFFSET);
297
298 /* setup wakup source */
299 omap2_prm_write_mod_reg(OMAP3430_EN_IO_MASK | OMAP3430_EN_GPIO1_MASK |
300 OMAP3430_EN_GPT1_MASK | OMAP3430_EN_GPT12_MASK,
301 WKUP_MOD, PM_WKEN);
302 /* No need to write EN_IO, that is always enabled */
303 omap2_prm_write_mod_reg(OMAP3430_GRPSEL_GPIO1_MASK |
304 OMAP3430_GRPSEL_GPT1_MASK |
305 OMAP3430_GRPSEL_GPT12_MASK,
306 WKUP_MOD, OMAP3430_PM_MPUGRPSEL);
307
308 /* Enable PM_WKEN to support DSS LPR */
309 omap2_prm_write_mod_reg(OMAP3430_PM_WKEN_DSS_EN_DSS_MASK,
310 OMAP3430_DSS_MOD, PM_WKEN);
311
312 if (has_uart4) {
313 en_uart4_mask = OMAP3630_EN_UART4_MASK;
314 grpsel_uart4_mask = OMAP3630_GRPSEL_UART4_MASK;
315 }
316
317 /* Enable wakeups in PER */
318 omap2_prm_write_mod_reg(en_uart4_mask |
319 OMAP3430_EN_GPIO2_MASK |
320 OMAP3430_EN_GPIO3_MASK |
321 OMAP3430_EN_GPIO4_MASK |
322 OMAP3430_EN_GPIO5_MASK |
323 OMAP3430_EN_GPIO6_MASK |
324 OMAP3430_EN_UART3_MASK |
325 OMAP3430_EN_MCBSP2_MASK |
326 OMAP3430_EN_MCBSP3_MASK |
327 OMAP3430_EN_MCBSP4_MASK,
328 OMAP3430_PER_MOD, PM_WKEN);
329
330 /* and allow them to wake up MPU */
331 omap2_prm_write_mod_reg(grpsel_uart4_mask |
332 OMAP3430_GRPSEL_GPIO2_MASK |
333 OMAP3430_GRPSEL_GPIO3_MASK |
334 OMAP3430_GRPSEL_GPIO4_MASK |
335 OMAP3430_GRPSEL_GPIO5_MASK |
336 OMAP3430_GRPSEL_GPIO6_MASK |
337 OMAP3430_GRPSEL_UART3_MASK |
338 OMAP3430_GRPSEL_MCBSP2_MASK |
339 OMAP3430_GRPSEL_MCBSP3_MASK |
340 OMAP3430_GRPSEL_MCBSP4_MASK,
341 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
342
343 /* Don't attach IVA interrupts */
344 if (has_iva) {
345 omap2_prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
346 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
347 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
348 omap2_prm_write_mod_reg(0, OMAP3430_PER_MOD,
349 OMAP3430_PM_IVAGRPSEL);
350 }
351
352 /* Clear any pending 'reset' flags */
353 omap2_prm_write_mod_reg(0xffffffff, MPU_MOD, OMAP2_RM_RSTST);
354 omap2_prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP2_RM_RSTST);
355 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, OMAP2_RM_RSTST);
356 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, OMAP2_RM_RSTST);
357 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, OMAP2_RM_RSTST);
358 omap2_prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, OMAP2_RM_RSTST);
359 omap2_prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD,
360 OMAP2_RM_RSTST);
361
362 /* Clear any pending PRCM interrupts */
363 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
364
365 /* We need to idle iva2_pwrdm even on am3703 with no iva2. */
366 omap3xxx_prm_iva_idle();
367
368 omap3_prm_reset_modem();
369}
370
371/**
209 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain 372 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
210 * 373 *
211 * Clear any previously-latched I/O wakeup events and ensure that the 374 * Clear any previously-latched I/O wakeup events and ensure that the
@@ -276,6 +439,76 @@ static u32 omap3xxx_prm_read_reset_sources(void)
276 return r; 439 return r;
277} 440}
278 441
442/**
443 * omap3xxx_prm_iva_idle - ensure IVA is in idle so it can be put into retention
444 *
445 * In cases where IVA2 is activated by bootcode, it may prevent
446 * full-chip retention or off-mode because it is not idle. This
447 * function forces the IVA2 into idle state so it can go
448 * into retention/off and thus allow full-chip retention/off.
449 */
450void omap3xxx_prm_iva_idle(void)
451{
452 /* ensure IVA2 clock is disabled */
453 omap2_cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
454
455 /* if no clock activity, nothing else to do */
456 if (!(omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSTST) &
457 OMAP3430_CLKACTIVITY_IVA2_MASK))
458 return;
459
460 /* Reset IVA2 */
461 omap2_prm_write_mod_reg(OMAP3430_RST1_IVA2_MASK |
462 OMAP3430_RST2_IVA2_MASK |
463 OMAP3430_RST3_IVA2_MASK,
464 OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
465
466 /* Enable IVA2 clock */
467 omap2_cm_write_mod_reg(OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK,
468 OMAP3430_IVA2_MOD, CM_FCLKEN);
469
470 /* Un-reset IVA2 */
471 omap2_prm_write_mod_reg(0, OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
472
473 /* Disable IVA2 clock */
474 omap2_cm_write_mod_reg(0, OMAP3430_IVA2_MOD, CM_FCLKEN);
475
476 /* Reset IVA2 */
477 omap2_prm_write_mod_reg(OMAP3430_RST1_IVA2_MASK |
478 OMAP3430_RST2_IVA2_MASK |
479 OMAP3430_RST3_IVA2_MASK,
480 OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
481}
482
483/**
484 * omap3xxx_prm_clear_global_cold_reset - checks the global cold reset status
485 * and clears it if asserted
486 *
487 * Checks if cold-reset has occurred and clears the status bit if yes. Returns
488 * 1 if cold-reset has occurred, 0 otherwise.
489 */
490int omap3xxx_prm_clear_global_cold_reset(void)
491{
492 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
493 OMAP3430_GLOBAL_COLD_RST_MASK) {
494 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
495 OMAP3430_GR_MOD,
496 OMAP3_PRM_RSTST_OFFSET);
497 return 1;
498 }
499
500 return 0;
501}
502
503void omap3_prm_save_scratchpad_contents(u32 *ptr)
504{
505 *ptr++ = omap2_prm_read_mod_reg(OMAP3430_GR_MOD,
506 OMAP3_PRM_CLKSRC_CTRL_OFFSET);
507
508 *ptr++ = omap2_prm_read_mod_reg(OMAP3430_GR_MOD,
509 OMAP3_PRM_CLKSEL_OFFSET);
510}
511
279/* Powerdomain low-level functions */ 512/* Powerdomain low-level functions */
280 513
281static int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) 514static int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index 1dacfc5b1959..bc37d42a8704 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -162,6 +162,12 @@ extern void omap3xxx_prm_dpll3_reset(void);
162 162
163extern int __init omap3xxx_prm_init(void); 163extern int __init omap3xxx_prm_init(void);
164extern u32 omap3xxx_prm_get_reset_sources(void); 164extern u32 omap3xxx_prm_get_reset_sources(void);
165int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits);
166void omap3xxx_prm_iva_idle(void);
167void omap3_prm_reset_modem(void);
168int omap3xxx_prm_clear_global_cold_reset(void);
169void omap3_prm_save_scratchpad_contents(u32 *ptr);
170void omap3_prm_init_pm(bool has_uart4, bool has_iva);
165 171
166#endif /* __ASSEMBLER */ 172#endif /* __ASSEMBLER */
167 173
diff --git a/arch/arm/mach-omap2/prm7xx.h b/arch/arm/mach-omap2/prm7xx.h
index d92a8404edc7..4bb50fbf29be 100644
--- a/arch/arm/mach-omap2/prm7xx.h
+++ b/arch/arm/mach-omap2/prm7xx.h
@@ -374,6 +374,10 @@
374#define DRA7XX_RM_L3INIT_IEEE1500_2_OCP_CONTEXT_OFFSET 0x007c 374#define DRA7XX_RM_L3INIT_IEEE1500_2_OCP_CONTEXT_OFFSET 0x007c
375#define DRA7XX_PM_L3INIT_SATA_WKDEP_OFFSET 0x0088 375#define DRA7XX_PM_L3INIT_SATA_WKDEP_OFFSET 0x0088
376#define DRA7XX_RM_L3INIT_SATA_CONTEXT_OFFSET 0x008c 376#define DRA7XX_RM_L3INIT_SATA_CONTEXT_OFFSET 0x008c
377#define DRA7XX_PM_L3INIT_PCIESS1_WKDEP_OFFSET 0x00b0
378#define DRA7XX_RM_L3INIT_PCIESS1_CONTEXT_OFFSET 0x00b4
379#define DRA7XX_PM_L3INIT_PCIESS2_WKDEP_OFFSET 0x00b8
380#define DRA7XX_RM_L3INIT_PCIESS2_CONTEXT_OFFSET 0x00bc
377#define DRA7XX_RM_GMAC_GMAC_CONTEXT_OFFSET 0x00d4 381#define DRA7XX_RM_GMAC_GMAC_CONTEXT_OFFSET 0x00d4
378#define DRA7XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET 0x00e4 382#define DRA7XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET 0x00e4
379#define DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET 0x00ec 383#define DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET 0x00ec
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 25e8b8232115..76ca320f007c 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -472,6 +472,8 @@ static struct of_device_id omap_prcm_dt_match_table[] = {
472 { .compatible = "ti,am3-scrm" }, 472 { .compatible = "ti,am3-scrm" },
473 { .compatible = "ti,am4-prcm" }, 473 { .compatible = "ti,am4-prcm" },
474 { .compatible = "ti,am4-scrm" }, 474 { .compatible = "ti,am4-scrm" },
475 { .compatible = "ti,omap2-prcm" },
476 { .compatible = "ti,omap2-scrm" },
475 { .compatible = "ti,omap3-prm" }, 477 { .compatible = "ti,omap3-prm" },
476 { .compatible = "ti,omap3-cm" }, 478 { .compatible = "ti,omap3-cm" },
477 { .compatible = "ti,omap3-scrm" }, 479 { .compatible = "ti,omap3-scrm" },
diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
index 9086ce03ae12..b84a0122d823 100644
--- a/arch/arm/mach-omap2/sleep44xx.S
+++ b/arch/arm/mach-omap2/sleep44xx.S
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h>
13#include <asm/smp_scu.h> 14#include <asm/smp_scu.h>
14#include <asm/memory.h> 15#include <asm/memory.h>
15#include <asm/hardware/cache-l2x0.h> 16#include <asm/hardware/cache-l2x0.h>
@@ -334,7 +335,7 @@ ENDPROC(omap4_cpu_resume)
334 335
335#ifndef CONFIG_OMAP4_ERRATA_I688 336#ifndef CONFIG_OMAP4_ERRATA_I688
336ENTRY(omap_bus_sync) 337ENTRY(omap_bus_sync)
337 mov pc, lr 338 ret lr
338ENDPROC(omap_bus_sync) 339ENDPROC(omap_bus_sync)
339#endif 340#endif
340 341
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 680a7c56cc3e..2c88ff2d0236 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -101,7 +101,7 @@ i_dll_wait:
101i_dll_delay: 101i_dll_delay:
102 subs r4, r4, #0x1 102 subs r4, r4, #0x1
103 bne i_dll_delay 103 bne i_dll_delay
104 mov pc, lr 104 ret lr
105 105
106 /* 106 /*
107 * shift up or down voltage, use R9 as input to tell level. 107 * shift up or down voltage, use R9 as input to tell level.
@@ -125,7 +125,7 @@ volt_delay:
125 ldr r7, [r3] @ get timer value 125 ldr r7, [r3] @ get timer value
126 cmp r5, r7 @ time up? 126 cmp r5, r7 @ time up?
127 bhi volt_delay @ not yet->branch 127 bhi volt_delay @ not yet->branch
128 mov pc, lr @ back to caller. 128 ret lr @ back to caller.
129 129
130omap242x_sdi_cm_clksel2_pll: 130omap242x_sdi_cm_clksel2_pll:
131 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 131 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
@@ -220,7 +220,7 @@ volt_delay_c:
220 ldr r7, [r10] @ get timer value 220 ldr r7, [r10] @ get timer value
221 cmp r8, r7 @ time up? 221 cmp r8, r7 @ time up?
222 bhi volt_delay_c @ not yet->branch 222 bhi volt_delay_c @ not yet->branch
223 mov pc, lr @ back to caller 223 ret lr @ back to caller
224 224
225omap242x_srs_cm_clksel2_pll: 225omap242x_srs_cm_clksel2_pll:
226 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 226 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index a1e9edd673f4..d5deb9761fc7 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -101,7 +101,7 @@ i_dll_wait:
101i_dll_delay: 101i_dll_delay:
102 subs r4, r4, #0x1 102 subs r4, r4, #0x1
103 bne i_dll_delay 103 bne i_dll_delay
104 mov pc, lr 104 ret lr
105 105
106 /* 106 /*
107 * shift up or down voltage, use R9 as input to tell level. 107 * shift up or down voltage, use R9 as input to tell level.
@@ -125,7 +125,7 @@ volt_delay:
125 ldr r7, [r3] @ get timer value 125 ldr r7, [r3] @ get timer value
126 cmp r5, r7 @ time up? 126 cmp r5, r7 @ time up?
127 bhi volt_delay @ not yet->branch 127 bhi volt_delay @ not yet->branch
128 mov pc, lr @ back to caller. 128 ret lr @ back to caller.
129 129
130omap243x_sdi_cm_clksel2_pll: 130omap243x_sdi_cm_clksel2_pll:
131 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 131 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
@@ -220,7 +220,7 @@ volt_delay_c:
220 ldr r7, [r10] @ get timer value 220 ldr r7, [r10] @ get timer value
221 cmp r8, r7 @ time up? 221 cmp r8, r7 @ time up?
222 bhi volt_delay_c @ not yet->branch 222 bhi volt_delay_c @ not yet->branch
223 mov pc, lr @ back to caller 223 ret lr @ back to caller
224 224
225omap243x_srs_cm_clksel2_pll: 225omap243x_srs_cm_clksel2_pll:
226 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 226 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index e832bc7b8e2d..8333400898fb 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -95,7 +95,6 @@ static int tusb_set_sync_mode(unsigned sysclk_ps)
95 dev_t.t_avdp_w = t_scsnh_advnh; 95 dev_t.t_avdp_w = t_scsnh_advnh;
96 dev_t.cyc_aavdh_we = 3; 96 dev_t.cyc_aavdh_we = 3;
97 dev_t.cyc_wpl = 6; 97 dev_t.cyc_wpl = 6;
98 dev_t.t_ce_rdyz = 7000;
99 98
100 gpmc_calc_timings(&t, &tusb_sync, &dev_t); 99 gpmc_calc_timings(&t, &tusb_sync, &dev_t);
101 100
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 648867a8caa8..2fe1824c6dcb 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += clock.o devices.o generic.o irq.o \ 6obj-y += clock.o devices.o generic.o irq.o \
7 time.o reset.o 7 reset.o
8obj-$(CONFIG_PM) += pm.o sleep.o standby.o 8obj-$(CONFIG_PM) += pm.o sleep.o standby.o
9 9
10# Generic drivers that other drivers may depend upon 10# Generic drivers that other drivers may depend upon
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 43596e0ed051..d897292712eb 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -90,7 +90,7 @@ int __init parse_balloon3_features(char *arg)
90 if (!arg) 90 if (!arg)
91 return 0; 91 return 0;
92 92
93 return strict_strtoul(arg, 0, &balloon3_features_present); 93 return kstrtoul(arg, 0, &balloon3_features_present);
94} 94}
95early_param("balloon3_features", parse_balloon3_features); 95early_param("balloon3_features", parse_balloon3_features);
96 96
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 91dd1c7cdbcd..06022b235730 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -514,7 +514,7 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
514 .gpio_pullup = CORGI_GPIO_USB_PULLUP, 514 .gpio_pullup = CORGI_GPIO_USB_PULLUP,
515}; 515};
516 516
517#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MASTER) 517#if IS_ENABLED(CONFIG_SPI_PXA2XX)
518static struct pxa2xx_spi_master corgi_spi_info = { 518static struct pxa2xx_spi_master corgi_spi_info = {
519 .num_chipselect = 3, 519 .num_chipselect = 3,
520}; 520};
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 42254175fcf4..630fa916bbc6 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -25,11 +25,13 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27 27
28#include <mach/irqs.h>
28#include <mach/reset.h> 29#include <mach/reset.h>
29#include <mach/smemc.h> 30#include <mach/smemc.h>
30#include <mach/pxa3xx-regs.h> 31#include <mach/pxa3xx-regs.h>
31 32
32#include "generic.h" 33#include "generic.h"
34#include <clocksource/pxa.h>
33 35
34void clear_reset_status(unsigned int mask) 36void clear_reset_status(unsigned int mask)
35{ 37{
@@ -57,6 +59,15 @@ unsigned long get_clock_tick_rate(void)
57EXPORT_SYMBOL(get_clock_tick_rate); 59EXPORT_SYMBOL(get_clock_tick_rate);
58 60
59/* 61/*
62 * For non device-tree builds, keep legacy timer init
63 */
64void pxa_timer_init(void)
65{
66 pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000),
67 get_clock_tick_rate());
68}
69
70/*
60 * Get the clock frequency as reflected by CCCR and the turbo flag. 71 * Get the clock frequency as reflected by CCCR and the turbo flag.
61 * We assume these values have been applied via a fcs. 72 * We assume these values have been applied via a fcs.
62 * If info is not 0 we also display the current settings. 73 * If info is not 0 we also display the current settings.
@@ -79,19 +90,15 @@ EXPORT_SYMBOL(get_clk_frequency_khz);
79 */ 90 */
80static struct map_desc common_io_desc[] __initdata = { 91static struct map_desc common_io_desc[] __initdata = {
81 { /* Devs */ 92 { /* Devs */
82 .virtual = 0xf2000000, 93 .virtual = (unsigned long)PERIPH_VIRT,
83 .pfn = __phys_to_pfn(0x40000000), 94 .pfn = __phys_to_pfn(PERIPH_PHYS),
84 .length = 0x02000000, 95 .length = PERIPH_SIZE,
85 .type = MT_DEVICE
86 }, { /* UNCACHED_PHYS_0 */
87 .virtual = 0xff000000,
88 .pfn = __phys_to_pfn(0x00000000),
89 .length = 0x00100000,
90 .type = MT_DEVICE 96 .type = MT_DEVICE
91 } 97 }
92}; 98};
93 99
94void __init pxa_map_io(void) 100void __init pxa_map_io(void)
95{ 101{
102 debug_ll_io_init();
96 iotable_init(ARRAY_AND_SIZE(common_io_desc)); 103 iotable_init(ARRAY_AND_SIZE(common_io_desc));
97} 104}
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index ccb06e485520..8d63c211b22f 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -19,8 +19,8 @@
19 * Workarounds for at least 2 errata so far require this. 19 * Workarounds for at least 2 errata so far require this.
20 * The mapping is set in mach-pxa/generic.c. 20 * The mapping is set in mach-pxa/generic.c.
21 */ 21 */
22#define UNCACHED_PHYS_0 0xff000000 22#define UNCACHED_PHYS_0 0xfe000000
23#define UNCACHED_ADDR UNCACHED_PHYS_0 23#define UNCACHED_PHYS_0_SIZE 0x00100000
24 24
25/* 25/*
26 * Intel PXA2xx internal register mapping: 26 * Intel PXA2xx internal register mapping:
diff --git a/arch/arm/mach-pxa/mioa701_bootresume.S b/arch/arm/mach-pxa/mioa701_bootresume.S
index 324d25a48c85..81591491ab94 100644
--- a/arch/arm/mach-pxa/mioa701_bootresume.S
+++ b/arch/arm/mach-pxa/mioa701_bootresume.S
@@ -29,7 +29,7 @@ ENTRY(mioa701_jumpaddr)
29 str r1, [r0] @ Early disable resume for next boot 29 str r1, [r0] @ Early disable resume for next boot
30 ldr r0, mioa701_jumpaddr @ (Murphy's Law) 30 ldr r0, mioa701_jumpaddr @ (Murphy's Law)
31 ldr r0, [r0] 31 ldr r0, [r0]
32 mov pc, r0 32 ret r0
332: 332:
34 34
35ENTRY(mioa701_bootstrap_lg) 35ENTRY(mioa701_bootstrap_lg)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index f2c28972084d..66e4a2b6316e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -331,7 +331,12 @@ static struct map_desc pxa25x_io_desc[] __initdata = {
331 { /* Mem Ctl */ 331 { /* Mem Ctl */
332 .virtual = (unsigned long)SMEMC_VIRT, 332 .virtual = (unsigned long)SMEMC_VIRT,
333 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE), 333 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
334 .length = 0x00200000, 334 .length = SMEMC_SIZE,
335 .type = MT_DEVICE
336 }, { /* UNCACHED_PHYS_0 */
337 .virtual = UNCACHED_PHYS_0,
338 .pfn = __phys_to_pfn(0x00000000),
339 .length = UNCACHED_PHYS_0_SIZE,
335 .type = MT_DEVICE 340 .type = MT_DEVICE
336 }, 341 },
337}; 342};
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 301471a07a10..b040d7d14888 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -402,12 +402,12 @@ static struct map_desc pxa27x_io_desc[] __initdata = {
402 { /* Mem Ctl */ 402 { /* Mem Ctl */
403 .virtual = (unsigned long)SMEMC_VIRT, 403 .virtual = (unsigned long)SMEMC_VIRT,
404 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE), 404 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
405 .length = 0x00200000, 405 .length = SMEMC_SIZE,
406 .type = MT_DEVICE 406 .type = MT_DEVICE
407 }, { /* IMem ctl */ 407 }, { /* UNCACHED_PHYS_0 */
408 .virtual = 0xfe000000, 408 .virtual = UNCACHED_PHYS_0,
409 .pfn = __phys_to_pfn(0x58000000), 409 .pfn = __phys_to_pfn(0x00000000),
410 .length = 0x00100000, 410 .length = UNCACHED_PHYS_0_SIZE,
411 .type = MT_DEVICE 411 .type = MT_DEVICE
412 }, 412 },
413}; 413};
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 87011f3de69d..593ccd35ca97 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -416,7 +416,7 @@ static struct map_desc pxa3xx_io_desc[] __initdata = {
416 { /* Mem Ctl */ 416 { /* Mem Ctl */
417 .virtual = (unsigned long)SMEMC_VIRT, 417 .virtual = (unsigned long)SMEMC_VIRT,
418 .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE), 418 .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE),
419 .length = 0x00200000, 419 .length = SMEMC_SIZE,
420 .type = MT_DEVICE 420 .type = MT_DEVICE
421 } 421 }
422}; 422};
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 1e544be9905d..6c5b3ffd2cd3 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -157,7 +157,7 @@ pxa_cpu_do_suspend:
157 @ Do not reorder... 157 @ Do not reorder...
158 @ Intel PXA270 Specification Update notes problems performing 158 @ Intel PXA270 Specification Update notes problems performing
159 @ external accesses after SDRAM is put in self-refresh mode 159 @ external accesses after SDRAM is put in self-refresh mode
160 @ (see Errata 39 ...hangs when entering self-refresh mode) 160 @ (see Errata 38 ...hangs when entering self-refresh mode)
161 161
162 @ force address lines low by reading at physical address 0 162 @ force address lines low by reading at physical address 0
163 ldr r3, [r2] 163 ldr r3, [r2]
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
index 29f5f5c180b7..eab1645bb4ad 100644
--- a/arch/arm/mach-pxa/standby.S
+++ b/arch/arm/mach-pxa/standby.S
@@ -29,7 +29,7 @@ ENTRY(pxa_cpu_standby)
29 .align 5 29 .align 5
301: mcr p14, 0, r2, c7, c0, 0 @ put the system into Standby 301: mcr p14, 0, r2, c7, c0, 0 @ put the system into Standby
31 str r1, [r0] @ make sure PSSR_PH/STS are clear 31 str r1, [r0] @ make sure PSSR_PH/STS are clear
32 mov pc, lr 32 ret lr
33 33
34#endif 34#endif
35 35
@@ -108,7 +108,7 @@ ENTRY(pm_enter_standby_start)
108 bic r0, r0, #0x20000000 108 bic r0, r0, #0x20000000
109 str r0, [r1, #PXA3_DMCIER] 109 str r0, [r1, #PXA3_DMCIER]
110 110
111 mov pc, lr 111 ret lr
112ENTRY(pm_enter_standby_end) 112ENTRY(pm_enter_standby_end)
113 113
114#endif 114#endif
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
deleted file mode 100644
index fca174e3865d..000000000000
--- a/arch/arm/mach-pxa/time.c
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2 * arch/arm/mach-pxa/time.c
3 *
4 * PXA clocksource, clockevents, and OST interrupt handlers.
5 * Copyright (c) 2007 by Bill Gatliff <bgat@billgatliff.com>.
6 *
7 * Derived from Nicolas Pitre's PXA timer handler Copyright (c) 2001
8 * by MontaVista Software, Inc. (Nico, your code rocks!)
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/interrupt.h>
18#include <linux/clockchips.h>
19#include <linux/sched_clock.h>
20
21#include <asm/div64.h>
22#include <asm/mach/irq.h>
23#include <asm/mach/time.h>
24#include <mach/regs-ost.h>
25#include <mach/irqs.h>
26
27/*
28 * This is PXA's sched_clock implementation. This has a resolution
29 * of at least 308 ns and a maximum value of 208 days.
30 *
31 * The return value is guaranteed to be monotonic in that range as
32 * long as there is always less than 582 seconds between successive
33 * calls to sched_clock() which should always be the case in practice.
34 */
35
36static u64 notrace pxa_read_sched_clock(void)
37{
38 return readl_relaxed(OSCR);
39}
40
41
42#define MIN_OSCR_DELTA 16
43
44static irqreturn_t
45pxa_ost0_interrupt(int irq, void *dev_id)
46{
47 struct clock_event_device *c = dev_id;
48
49 /* Disarm the compare/match, signal the event. */
50 writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER);
51 writel_relaxed(OSSR_M0, OSSR);
52 c->event_handler(c);
53
54 return IRQ_HANDLED;
55}
56
57static int
58pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev)
59{
60 unsigned long next, oscr;
61
62 writel_relaxed(readl_relaxed(OIER) | OIER_E0, OIER);
63 next = readl_relaxed(OSCR) + delta;
64 writel_relaxed(next, OSMR0);
65 oscr = readl_relaxed(OSCR);
66
67 return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0;
68}
69
70static void
71pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
72{
73 switch (mode) {
74 case CLOCK_EVT_MODE_ONESHOT:
75 writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER);
76 writel_relaxed(OSSR_M0, OSSR);
77 break;
78
79 case CLOCK_EVT_MODE_UNUSED:
80 case CLOCK_EVT_MODE_SHUTDOWN:
81 /* initializing, released, or preparing for suspend */
82 writel_relaxed(readl_relaxed(OIER) & ~OIER_E0, OIER);
83 writel_relaxed(OSSR_M0, OSSR);
84 break;
85
86 case CLOCK_EVT_MODE_RESUME:
87 case CLOCK_EVT_MODE_PERIODIC:
88 break;
89 }
90}
91
92#ifdef CONFIG_PM
93static unsigned long osmr[4], oier, oscr;
94
95static void pxa_timer_suspend(struct clock_event_device *cedev)
96{
97 osmr[0] = readl_relaxed(OSMR0);
98 osmr[1] = readl_relaxed(OSMR1);
99 osmr[2] = readl_relaxed(OSMR2);
100 osmr[3] = readl_relaxed(OSMR3);
101 oier = readl_relaxed(OIER);
102 oscr = readl_relaxed(OSCR);
103}
104
105static void pxa_timer_resume(struct clock_event_device *cedev)
106{
107 /*
108 * Ensure that we have at least MIN_OSCR_DELTA between match
109 * register 0 and the OSCR, to guarantee that we will receive
110 * the one-shot timer interrupt. We adjust OSMR0 in preference
111 * to OSCR to guarantee that OSCR is monotonically incrementing.
112 */
113 if (osmr[0] - oscr < MIN_OSCR_DELTA)
114 osmr[0] += MIN_OSCR_DELTA;
115
116 writel_relaxed(osmr[0], OSMR0);
117 writel_relaxed(osmr[1], OSMR1);
118 writel_relaxed(osmr[2], OSMR2);
119 writel_relaxed(osmr[3], OSMR3);
120 writel_relaxed(oier, OIER);
121 writel_relaxed(oscr, OSCR);
122}
123#else
124#define pxa_timer_suspend NULL
125#define pxa_timer_resume NULL
126#endif
127
128static struct clock_event_device ckevt_pxa_osmr0 = {
129 .name = "osmr0",
130 .features = CLOCK_EVT_FEAT_ONESHOT,
131 .rating = 200,
132 .set_next_event = pxa_osmr0_set_next_event,
133 .set_mode = pxa_osmr0_set_mode,
134 .suspend = pxa_timer_suspend,
135 .resume = pxa_timer_resume,
136};
137
138static struct irqaction pxa_ost0_irq = {
139 .name = "ost0",
140 .flags = IRQF_TIMER | IRQF_IRQPOLL,
141 .handler = pxa_ost0_interrupt,
142 .dev_id = &ckevt_pxa_osmr0,
143};
144
145void __init pxa_timer_init(void)
146{
147 unsigned long clock_tick_rate = get_clock_tick_rate();
148
149 writel_relaxed(0, OIER);
150 writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
151
152 sched_clock_register(pxa_read_sched_clock, 32, clock_tick_rate);
153
154 ckevt_pxa_osmr0.cpumask = cpumask_of(0);
155
156 setup_irq(IRQ_OST0, &pxa_ost0_irq);
157
158 clocksource_mmio_init(OSCR, "oscr0", clock_tick_rate, 200, 32,
159 clocksource_mmio_readl_up);
160 clockevents_config_and_register(&ckevt_pxa_osmr0, clock_tick_rate,
161 MIN_OSCR_DELTA * 2, 0x7fffffff);
162}
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 41f27f667ca8..de3b08073fe7 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -769,7 +769,7 @@ static unsigned long viper_tpm;
769 769
770static int __init viper_tpm_setup(char *str) 770static int __init viper_tpm_setup(char *str)
771{ 771{
772 return strict_strtoul(str, 10, &viper_tpm) >= 0; 772 return kstrtoul(str, 10, &viper_tpm) >= 0;
773} 773}
774 774
775__setup("tpm=", viper_tpm_setup); 775__setup("tpm=", viper_tpm_setup);
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 8c1b39a0caa0..850e506926df 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/amba/clcd.h> 27#include <linux/amba/clcd.h>
28#include <linux/platform_data/video-clcd-versatile.h>
28#include <linux/io.h> 29#include <linux/io.h>
29#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
30#include <linux/ata_platform.h> 31#include <linux/ata_platform.h>
@@ -48,7 +49,6 @@
48#include <mach/irqs.h> 49#include <mach/irqs.h>
49#include <asm/hardware/timer-sp.h> 50#include <asm/hardware/timer-sp.h>
50 51
51#include <plat/clcd.h>
52#include <plat/sched_clock.h> 52#include <plat/sched_clock.h>
53 53
54#include "core.h" 54#include "core.h"
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index db09170e3832..23e7a313f75d 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -20,15 +20,6 @@
20#ifndef __ASM_ARCH_MEMORY_H 20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H 21#define __ASM_ARCH_MEMORY_H
22 22
23/*
24 * Physical DRAM offset.
25 */
26#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
27#define PLAT_PHYS_OFFSET UL(0x70000000)
28#else
29#define PLAT_PHYS_OFFSET UL(0x00000000)
30#endif
31
32#ifdef CONFIG_SPARSEMEM 23#ifdef CONFIG_SPARSEMEM
33 24
34/* 25/*
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index e4564c259ed1..d1686696ca41 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -6,6 +6,7 @@ config ARCH_ROCKCHIP
6 select ARCH_REQUIRE_GPIOLIB 6 select ARCH_REQUIRE_GPIOLIB
7 select ARM_GIC 7 select ARM_GIC
8 select CACHE_L2X0 8 select CACHE_L2X0
9 select HAVE_ARM_ARCH_TIMER
9 select HAVE_ARM_SCU if SMP 10 select HAVE_ARM_SCU if SMP
10 select HAVE_ARM_TWD if SMP 11 select HAVE_ARM_TWD if SMP
11 select DW_APB_TIMER_OF 12 select DW_APB_TIMER_OF
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 4377a1436a98..b29d8ead4cf2 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1,2 +1,4 @@
1CFLAGS_platsmp.o := -march=armv7-a
2
1obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o 3obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
2obj-$(CONFIG_SMP) += headsmp.o platsmp.o 4obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index 910835d4ccf4..189684f55927 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -21,6 +21,7 @@
21#include <linux/of_address.h> 21#include <linux/of_address.h>
22 22
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/cp15.h>
24#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
25#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
@@ -178,8 +179,27 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
178 pmu_set_power_domain(0 + i, false); 179 pmu_set_power_domain(0 + i, false);
179} 180}
180 181
182#ifdef CONFIG_HOTPLUG_CPU
183static int rockchip_cpu_kill(unsigned int cpu)
184{
185 pmu_set_power_domain(0 + cpu, false);
186 return 1;
187}
188
189static void rockchip_cpu_die(unsigned int cpu)
190{
191 v7_exit_coherency_flush(louis);
192 while(1)
193 cpu_do_idle();
194}
195#endif
196
181static struct smp_operations rockchip_smp_ops __initdata = { 197static struct smp_operations rockchip_smp_ops __initdata = {
182 .smp_prepare_cpus = rockchip_smp_prepare_cpus, 198 .smp_prepare_cpus = rockchip_smp_prepare_cpus,
183 .smp_boot_secondary = rockchip_boot_secondary, 199 .smp_boot_secondary = rockchip_boot_secondary,
200#ifdef CONFIG_HOTPLUG_CPU
201 .cpu_kill = rockchip_cpu_kill,
202 .cpu_die = rockchip_cpu_die,
203#endif
184}; 204};
185CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops); 205CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 968cc348e624..8ab9e0e7ff04 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -29,6 +29,7 @@ static const char * const rockchip_board_dt_compat[] = {
29 "rockchip,rk3066a", 29 "rockchip,rk3066a",
30 "rockchip,rk3066b", 30 "rockchip,rk3066b",
31 "rockchip,rk3188", 31 "rockchip,rk3188",
32 "rockchip,rk3288",
32 NULL, 33 NULL,
33}; 34};
34 35
diff --git a/arch/arm/mach-rpc/include/mach/memory.h b/arch/arm/mach-rpc/include/mach/memory.h
index 18a221093bf5..b7e49571417d 100644
--- a/arch/arm/mach-rpc/include/mach/memory.h
+++ b/arch/arm/mach-rpc/include/mach/memory.h
@@ -19,11 +19,6 @@
19#define __ASM_ARCH_MEMORY_H 19#define __ASM_ARCH_MEMORY_H
20 20
21/* 21/*
22 * Physical DRAM offset.
23 */
24#define PLAT_PHYS_OFFSET UL(0x10000000)
25
26/*
27 * Cache flushing area - ROM 22 * Cache flushing area - ROM
28 */ 23 */
29#define FLUSH_BASE_PHYS 0x00000000 24#define FLUSH_BASE_PHYS 0x00000000
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index c0763b837745..44fa95df9262 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -49,9 +49,7 @@
49 49
50#include <plat/cpu.h> 50#include <plat/cpu.h>
51#include <plat/devs.h> 51#include <plat/devs.h>
52#include <plat/clock.h>
53#include <plat/cpu-freq.h> 52#include <plat/cpu-freq.h>
54#include <plat/pll.h>
55#include <plat/pwm-core.h> 53#include <plat/pwm-core.h>
56#include <plat/watchdog-reset.h> 54#include <plat/watchdog-reset.h>
57 55
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
index bd064c05c473..28b13951de87 100644
--- a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
@@ -29,7 +29,6 @@
29 29
30#include <plat/cpu.h> 30#include <plat/cpu.h>
31#include <plat/cpu-freq-core.h> 31#include <plat/cpu-freq-core.h>
32#include <plat/clock.h>
33 32
34#include <mach/s3c2412.h> 33#include <mach/s3c2412.h>
35 34
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index fbf5487ae5d1..c9a99bbad545 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -60,7 +60,6 @@
60#include <plat/cpu.h> 60#include <plat/cpu.h>
61#include <plat/devs.h> 61#include <plat/devs.h>
62#include <plat/gpio-cfg.h> 62#include <plat/gpio-cfg.h>
63#include <plat/pll.h>
64#include <plat/pm.h> 63#include <plat/pm.h>
65#include <plat/samsung-time.h> 64#include <plat/samsung-time.h>
66 65
@@ -73,6 +72,10 @@
73 72
74#define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END)) 73#define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END))
75 74
75#define S3C24XX_PLL_MDIV_SHIFT (12)
76#define S3C24XX_PLL_PDIV_SHIFT (4)
77#define S3C24XX_PLL_SDIV_SHIFT (0)
78
76static struct map_desc h1940_iodesc[] __initdata = { 79static struct map_desc h1940_iodesc[] __initdata = {
77 [0] = { 80 [0] = {
78 .virtual = (unsigned long)H1940_LATCH, 81 .virtual = (unsigned long)H1940_LATCH,
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index e81ea82c55f9..7804d3c6991b 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -48,7 +48,6 @@
48#include <linux/mtd/partitions.h> 48#include <linux/mtd/partitions.h>
49 49
50#include <plat/gpio-cfg.h> 50#include <plat/gpio-cfg.h>
51#include <plat/clock.h>
52#include <plat/devs.h> 51#include <plat/devs.h>
53#include <plat/cpu.h> 52#include <plat/cpu.h>
54#include <plat/pm.h> 53#include <plat/pm.h>
@@ -243,7 +242,7 @@ static int __init jive_mtdset(char *options)
243 if (options == NULL || options[0] == '\0') 242 if (options == NULL || options[0] == '\0')
244 return 0; 243 return 0;
245 244
246 if (strict_strtoul(options, 10, &set)) { 245 if (kstrtoul(options, 10, &set)) {
247 printk(KERN_ERR "failed to parse mtdset=%s\n", options); 246 printk(KERN_ERR "failed to parse mtdset=%s\n", options);
248 return 0; 247 return 0;
249 } 248 }
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index fb3b80e44595..10726bf84920 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -43,7 +43,6 @@
43#include <mach/gpio-samsung.h> 43#include <mach/gpio-samsung.h>
44#include <mach/fb.h> 44#include <mach/fb.h>
45 45
46#include <plat/clock.h>
47#include <plat/devs.h> 46#include <plat/devs.h>
48#include <plat/cpu.h> 47#include <plat/cpu.h>
49#include <plat/samsung-time.h> 48#include <plat/samsung-time.h>
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index fa6f30d23601..24189e8e8560 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -44,7 +44,6 @@
44#include <linux/platform_data/i2c-s3c2410.h> 44#include <linux/platform_data/i2c-s3c2410.h>
45 45
46#include <plat/gpio-cfg.h> 46#include <plat/gpio-cfg.h>
47#include <plat/clock.h>
48#include <plat/devs.h> 47#include <plat/devs.h>
49#include <plat/cpu.h> 48#include <plat/cpu.h>
50#include <linux/platform_data/mtd-nand-s3c2410.h> 49#include <linux/platform_data/mtd-nand-s3c2410.h>
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index ef5d5ea33182..0ed77614dcfe 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -38,7 +38,6 @@
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <linux/platform_data/i2c-s3c2410.h> 39#include <linux/platform_data/i2c-s3c2410.h>
40 40
41#include <plat/clock.h>
42#include <plat/devs.h> 41#include <plat/devs.h>
43#include <plat/cpu.h> 42#include <plat/cpu.h>
44#include <plat/samsung-time.h> 43#include <plat/samsung-time.h>
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 9104c2be36c9..9d4f64750698 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -42,7 +42,6 @@
42#include <linux/platform_data/i2c-s3c2410.h> 42#include <linux/platform_data/i2c-s3c2410.h>
43#include <linux/platform_data/mtd-nand-s3c2410.h> 43#include <linux/platform_data/mtd-nand-s3c2410.h>
44 44
45#include <plat/clock.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/samsung-time.h> 47#include <plat/samsung-time.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 7eab88829883..5ffe828cd659 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -41,8 +41,6 @@
41 41
42#include <plat/cpu.h> 42#include <plat/cpu.h>
43#include <plat/devs.h> 43#include <plat/devs.h>
44#include <plat/clock.h>
45#include <plat/pll.h>
46#include <plat/pm.h> 44#include <plat/pm.h>
47#include <plat/watchdog-reset.h> 45#include <plat/watchdog-reset.h>
48 46
@@ -83,10 +81,6 @@ void __init s3c2410_map_io(void)
83 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); 81 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
84} 82}
85 83
86void __init_or_cpufreq s3c2410_setup_clocks(void)
87{
88}
89
90struct bus_type s3c2410_subsys = { 84struct bus_type s3c2410_subsys = {
91 .name = "s3c2410-core", 85 .name = "s3c2410-core",
92 .dev_name = "s3c2410-core", 86 .dev_name = "s3c2410-core",
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index d49f52fbc842..569f3f5a6c71 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -37,12 +37,10 @@
37#include <mach/regs-clock.h> 37#include <mach/regs-clock.h>
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39 39
40#include <plat/clock.h>
41#include <plat/cpu.h> 40#include <plat/cpu.h>
42#include <plat/cpu-freq.h> 41#include <plat/cpu-freq.h>
43#include <plat/devs.h> 42#include <plat/devs.h>
44#include <plat/nand-core.h> 43#include <plat/nand-core.h>
45#include <plat/pll.h>
46#include <plat/pm.h> 44#include <plat/pm.h>
47#include <plat/regs-spi.h> 45#include <plat/regs-spi.h>
48 46
@@ -171,10 +169,6 @@ void __init s3c2412_map_io(void)
171 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); 169 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
172} 170}
173 171
174void __init_or_cpufreq s3c2412_setup_clocks(void)
175{
176}
177
178/* need to register the subsystem before we actually register the device, and 172/* need to register the subsystem before we actually register the device, and
179 * we also need to ensure that it has been initialised before any of the 173 * we also need to ensure that it has been initialised before any of the
180 * drivers even try to use it (even if not on an s3c2412 based system) 174 * drivers even try to use it (even if not on an s3c2412 based system)
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index fb9da2b603a2..7b043349f1c8 100644
--- a/arch/arm/mach-s3c24xx/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
@@ -43,7 +43,6 @@
43 43
44#include <mach/regs-clock.h> 44#include <mach/regs-clock.h>
45 45
46#include <plat/clock.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/pm.h> 47#include <plat/pm.h>
49 48
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index 4a64bcc9eb51..d1c3e65785a1 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -38,11 +38,9 @@
38#include <mach/regs-clock.h> 38#include <mach/regs-clock.h>
39#include <mach/regs-gpio.h> 39#include <mach/regs-gpio.h>
40 40
41#include <plat/clock.h>
42#include <plat/devs.h> 41#include <plat/devs.h>
43#include <plat/cpu.h> 42#include <plat/cpu.h>
44#include <plat/pm.h> 43#include <plat/pm.h>
45#include <plat/pll.h>
46#include <plat/nand-core.h> 44#include <plat/nand-core.h>
47#include <plat/watchdog-reset.h> 45#include <plat/watchdog-reset.h>
48 46
@@ -78,10 +76,6 @@ void __init s3c244x_map_io(void)
78 s3c2410_device_dclk.name = "s3c2440-dclk"; 76 s3c2410_device_dclk.name = "s3c2440-dclk";
79} 77}
80 78
81void __init_or_cpufreq s3c244x_setup_clocks(void)
82{
83}
84
85/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ 79/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
86 80
87struct bus_type s3c2440_subsys = { 81struct bus_type s3c2440_subsys = {
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
index c9b91223697c..875ba8911127 100644
--- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S
+++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
@@ -66,4 +66,4 @@ s3c2410_do_sleep:
66 streq r8, [r5] @ SDRAM power-down config 66 streq r8, [r5] @ SDRAM power-down config
67 streq r9, [r6] @ CPU sleep 67 streq r9, [r6] @ CPU sleep
681: beq 1b 681: beq 1b
69 mov pc, r14 69 ret lr
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
index 5adaceb7da13..6bf5b4d8743c 100644
--- a/arch/arm/mach-s3c24xx/sleep-s3c2412.S
+++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
@@ -65,4 +65,4 @@ s3c2412_sleep_enter1:
65 strne r9, [r3] 65 strne r9, [r3]
66 bne s3c2412_sleep_enter1 66 bne s3c2412_sleep_enter1
67 67
68 mov pc, r14 68 ret lr
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 55eb6a69655b..60576dfbea8d 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -45,7 +45,6 @@
45#include <linux/platform_data/i2c-s3c2410.h> 45#include <linux/platform_data/i2c-s3c2410.h>
46#include <plat/fb.h> 46#include <plat/fb.h>
47 47
48#include <plat/clock.h>
49#include <plat/devs.h> 48#include <plat/devs.h>
50#include <plat/cpu.h> 49#include <plat/cpu.h>
51#include <mach/regs-gpio.h> 50#include <mach/regs-gpio.h>
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 4b0199fff9f5..fe116334afda 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -58,7 +58,6 @@
58#include <linux/platform_data/spi-s3c64xx.h> 58#include <linux/platform_data/spi-s3c64xx.h>
59 59
60#include <plat/keypad.h> 60#include <plat/keypad.h>
61#include <plat/clock.h>
62#include <plat/devs.h> 61#include <plat/devs.h>
63#include <plat/cpu.h> 62#include <plat/cpu.h>
64#include <plat/adc.h> 63#include <plat/adc.h>
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 72cee08c8bf5..19e8feb908fd 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -39,7 +39,6 @@
39#include <plat/fb.h> 39#include <plat/fb.h>
40#include <linux/platform_data/mtd-nand-s3c2410.h> 40#include <linux/platform_data/mtd-nand-s3c2410.h>
41 41
42#include <plat/clock.h>
43#include <plat/devs.h> 42#include <plat/devs.h>
44#include <plat/cpu.h> 43#include <plat/cpu.h>
45#include <plat/samsung-time.h> 44#include <plat/samsung-time.h>
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 67f06a9ae656..4bae7dc49eea 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -40,7 +40,6 @@
40#include <linux/platform_data/i2c-s3c2410.h> 40#include <linux/platform_data/i2c-s3c2410.h>
41#include <plat/fb.h> 41#include <plat/fb.h>
42 42
43#include <plat/clock.h>
44#include <plat/devs.h> 43#include <plat/devs.h>
45#include <plat/cpu.h> 44#include <plat/cpu.h>
46#include <plat/samsung-time.h> 45#include <plat/samsung-time.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 78dd6f73c072..b3d13537a7f0 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -28,7 +28,6 @@
28#include <mach/regs-gpio.h> 28#include <mach/regs-gpio.h>
29#include <mach/gpio-samsung.h> 29#include <mach/gpio-samsung.h>
30 30
31#include <plat/clock.h>
32#include <plat/cpu.h> 31#include <plat/cpu.h>
33#include <plat/devs.h> 32#include <plat/devs.h>
34#include <linux/platform_data/i2c-s3c2410.h> 33#include <linux/platform_data/i2c-s3c2410.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index c85d1cbe769f..910749768340 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/map.h> 31#include <mach/map.h>
32 32
33#include <plat/clock.h>
34#include <plat/devs.h> 33#include <plat/devs.h>
35#include <plat/cpu.h> 34#include <plat/cpu.h>
36#include <linux/platform_data/i2c-s3c2410.h> 35#include <linux/platform_data/i2c-s3c2410.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index c6a8b2ab0240..1dc86d76b530 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -63,7 +63,6 @@
63#include <plat/fb.h> 63#include <plat/fb.h>
64#include <plat/gpio-cfg.h> 64#include <plat/gpio-cfg.h>
65 65
66#include <plat/clock.h>
67#include <plat/devs.h> 66#include <plat/devs.h>
68#include <plat/cpu.h> 67#include <plat/cpu.h>
69#include <plat/adc.h> 68#include <plat/adc.h>
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 8c42807bf579..1ce48c54cd9c 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -39,7 +39,6 @@
39 39
40#include <plat/cpu.h> 40#include <plat/cpu.h>
41#include <plat/devs.h> 41#include <plat/devs.h>
42#include <plat/clock.h>
43#include <plat/sdhci.h> 42#include <plat/sdhci.h>
44#include <plat/iic-core.h> 43#include <plat/iic-core.h>
45#include <plat/onenand-core.h> 44#include <plat/onenand-core.h>
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index 5be3f09bac92..b2a7930548d9 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -40,7 +40,6 @@
40 40
41#include <plat/cpu.h> 41#include <plat/cpu.h>
42#include <plat/devs.h> 42#include <plat/devs.h>
43#include <plat/clock.h>
44#include <plat/sdhci.h> 43#include <plat/sdhci.h>
45#include <plat/ata-core.h> 44#include <plat/ata-core.h>
46#include <plat/adc-core.h> 45#include <plat/adc-core.h>
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
deleted file mode 100644
index 26003e23796d..000000000000
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ /dev/null
@@ -1,102 +0,0 @@
1# arch/arm/mach-s5p64x0/Kconfig
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com/
5#
6# Licensed under GPLv2
7
8if ARCH_S5P64X0
9
10config CPU_S5P6440
11 bool
12 select ARM_AMBA
13 select PL330_DMA if DMADEVICES
14 select S5P_SLEEP if PM
15 select SAMSUNG_WAKEMASK if PM
16 help
17 Enable S5P6440 CPU support
18
19config CPU_S5P6450
20 bool
21 select ARM_AMBA
22 select PL330_DMA if DMADEVICES
23 select S5P_SLEEP if PM
24 select SAMSUNG_WAKEMASK if PM
25 help
26 Enable S5P6450 CPU support
27
28config S5P64X0_SETUP_FB_24BPP
29 bool
30 help
31 Common setup code for S5P64X0 based boards with a LCD display
32 through RGB interface.
33
34config S5P64X0_SETUP_I2C1
35 bool
36 help
37 Common setup code for i2c bus 1.
38
39config S5P64X0_SETUP_SPI
40 bool
41 help
42 Common setup code for SPI GPIO configurations
43
44config S5P64X0_SETUP_SDHCI_GPIO
45 bool
46 help
47 Common setup code for SDHCI gpio.
48
49# machine support
50
51config MACH_SMDK6440
52 bool "SMDK6440"
53 select CPU_S5P6440
54 select S3C_DEV_FB
55 select S3C_DEV_HSMMC
56 select S3C_DEV_HSMMC1
57 select S3C_DEV_HSMMC2
58 select S3C_DEV_I2C1
59 select S3C_DEV_RTC
60 select S3C_DEV_WDT
61 select S5P64X0_SETUP_FB_24BPP
62 select S5P64X0_SETUP_I2C1
63 select S5P64X0_SETUP_SDHCI_GPIO
64 select SAMSUNG_DEV_ADC
65 select SAMSUNG_DEV_BACKLIGHT
66 select SAMSUNG_DEV_PWM
67 select SAMSUNG_DEV_TS
68 help
69 Machine support for the Samsung SMDK6440
70
71config MACH_SMDK6450
72 bool "SMDK6450"
73 select CPU_S5P6450
74 select S3C_DEV_FB
75 select S3C_DEV_HSMMC
76 select S3C_DEV_HSMMC1
77 select S3C_DEV_HSMMC2
78 select S3C_DEV_I2C1
79 select S3C_DEV_RTC
80 select S3C_DEV_WDT
81 select S5P64X0_SETUP_FB_24BPP
82 select S5P64X0_SETUP_I2C1
83 select S5P64X0_SETUP_SDHCI_GPIO
84 select SAMSUNG_DEV_ADC
85 select SAMSUNG_DEV_BACKLIGHT
86 select SAMSUNG_DEV_PWM
87 select SAMSUNG_DEV_TS
88 help
89 Machine support for the Samsung SMDK6450
90
91menu "Use 8-bit SDHCI bus width"
92
93config S5P64X0_SD_CH1_8BIT
94 bool "SDHCI Channel 1 (Slot 1)"
95 depends on MACH_SMDK6450 || MACH_SMDK6440
96 help
97 Support SDHCI Channel 1 8-bit bus.
98 If selected, Channel 2 is disabled.
99
100endmenu
101
102endif
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
deleted file mode 100644
index 12bb951187a4..000000000000
--- a/arch/arm/mach-s5p64x0/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
1# arch/arm/mach-s5p64x0/Makefile
2#
3# Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4# http://www.samsung.com
5#
6# Licensed under GPLv2
7
8obj-y :=
9obj-m :=
10obj-n :=
11obj- :=
12
13# Core
14
15obj-y += common.o clock.o
16obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o
17obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o
18
19obj-$(CONFIG_PM) += pm.o irq-pm.o
20
21obj-y += dma.o
22
23# machine support
24
25obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o
26obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o
27
28# device support
29
30obj-y += dev-audio.o
31
32obj-y += setup-i2c0.o
33obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
34obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
35obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o
36obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5p64x0/Makefile.boot b/arch/arm/mach-s5p64x0/Makefile.boot
deleted file mode 100644
index 79ece4055b02..000000000000
--- a/arch/arm/mach-s5p64x0/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
deleted file mode 100644
index ae34a1d5e10a..000000000000
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ /dev/null
@@ -1,632 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6440.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6440 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "clock.h"
35#include "common.h"
36
37static u32 epll_div[][5] = {
38 { 36000000, 0, 48, 1, 4 },
39 { 48000000, 0, 32, 1, 3 },
40 { 60000000, 0, 40, 1, 3 },
41 { 72000000, 0, 48, 1, 3 },
42 { 84000000, 0, 28, 1, 2 },
43 { 96000000, 0, 32, 1, 2 },
44 { 32768000, 45264, 43, 1, 4 },
45 { 45158000, 6903, 30, 1, 3 },
46 { 49152000, 50332, 32, 1, 3 },
47 { 67738000, 10398, 45, 1, 3 },
48 { 73728000, 9961, 49, 1, 3 }
49};
50
51static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
83 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
86 clk->rate = rate;
87
88 return 0;
89}
90
91static struct clk_ops s5p6440_epll_ops = {
92 .get_rate = s5p_epll_get_rate,
93 .set_rate = s5p6440_epll_set_rate,
94};
95
96static struct clksrc_clk clk_hclk = {
97 .clk = {
98 .name = "clk_hclk",
99 .parent = &clk_armclk.clk,
100 },
101 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
102};
103
104static struct clksrc_clk clk_pclk = {
105 .clk = {
106 .name = "clk_pclk",
107 .parent = &clk_hclk.clk,
108 },
109 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
110};
111static struct clksrc_clk clk_hclk_low = {
112 .clk = {
113 .name = "clk_hclk_low",
114 },
115 .sources = &clkset_hclk_low,
116 .reg_src = { .reg = S5P64X0_SYS_OTHERS, .shift = 6, .size = 1 },
117 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
118};
119
120static struct clksrc_clk clk_pclk_low = {
121 .clk = {
122 .name = "clk_pclk_low",
123 .parent = &clk_hclk_low.clk,
124 },
125 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
126};
127
128/*
129 * The following clocks will be disabled during clock initialization. It is
130 * recommended to keep the following clocks disabled until the driver requests
131 * for enabling the clock.
132 */
133static struct clk init_clocks_off[] = {
134 {
135 .name = "nand",
136 .parent = &clk_hclk.clk,
137 .enable = s5p64x0_mem_ctrl,
138 .ctrlbit = (1 << 2),
139 }, {
140 .name = "post",
141 .parent = &clk_hclk_low.clk,
142 .enable = s5p64x0_hclk0_ctrl,
143 .ctrlbit = (1 << 5)
144 }, {
145 .name = "2d",
146 .parent = &clk_hclk.clk,
147 .enable = s5p64x0_hclk0_ctrl,
148 .ctrlbit = (1 << 8),
149 }, {
150 .name = "dma",
151 .devname = "dma-pl330",
152 .parent = &clk_hclk_low.clk,
153 .enable = s5p64x0_hclk0_ctrl,
154 .ctrlbit = (1 << 12),
155 }, {
156 .name = "hsmmc",
157 .devname = "s3c-sdhci.0",
158 .parent = &clk_hclk_low.clk,
159 .enable = s5p64x0_hclk0_ctrl,
160 .ctrlbit = (1 << 17),
161 }, {
162 .name = "hsmmc",
163 .devname = "s3c-sdhci.1",
164 .parent = &clk_hclk_low.clk,
165 .enable = s5p64x0_hclk0_ctrl,
166 .ctrlbit = (1 << 18),
167 }, {
168 .name = "hsmmc",
169 .devname = "s3c-sdhci.2",
170 .parent = &clk_hclk_low.clk,
171 .enable = s5p64x0_hclk0_ctrl,
172 .ctrlbit = (1 << 19),
173 }, {
174 .name = "otg",
175 .parent = &clk_hclk_low.clk,
176 .enable = s5p64x0_hclk0_ctrl,
177 .ctrlbit = (1 << 20)
178 }, {
179 .name = "irom",
180 .parent = &clk_hclk.clk,
181 .enable = s5p64x0_hclk0_ctrl,
182 .ctrlbit = (1 << 25),
183 }, {
184 .name = "lcd",
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk1_ctrl,
187 .ctrlbit = (1 << 1),
188 }, {
189 .name = "hclk_fimgvg",
190 .parent = &clk_hclk.clk,
191 .enable = s5p64x0_hclk1_ctrl,
192 .ctrlbit = (1 << 2),
193 }, {
194 .name = "tsi",
195 .parent = &clk_hclk_low.clk,
196 .enable = s5p64x0_hclk1_ctrl,
197 .ctrlbit = (1 << 0),
198 }, {
199 .name = "watchdog",
200 .parent = &clk_pclk_low.clk,
201 .enable = s5p64x0_pclk_ctrl,
202 .ctrlbit = (1 << 5),
203 }, {
204 .name = "rtc",
205 .parent = &clk_pclk_low.clk,
206 .enable = s5p64x0_pclk_ctrl,
207 .ctrlbit = (1 << 6),
208 }, {
209 .name = "timers",
210 .parent = &clk_pclk_low.clk,
211 .enable = s5p64x0_pclk_ctrl,
212 .ctrlbit = (1 << 7),
213 }, {
214 .name = "pcm",
215 .parent = &clk_pclk_low.clk,
216 .enable = s5p64x0_pclk_ctrl,
217 .ctrlbit = (1 << 8),
218 }, {
219 .name = "adc",
220 .parent = &clk_pclk_low.clk,
221 .enable = s5p64x0_pclk_ctrl,
222 .ctrlbit = (1 << 12),
223 }, {
224 .name = "i2c",
225 .parent = &clk_pclk_low.clk,
226 .enable = s5p64x0_pclk_ctrl,
227 .ctrlbit = (1 << 17),
228 }, {
229 .name = "spi",
230 .devname = "s5p64x0-spi.0",
231 .parent = &clk_pclk_low.clk,
232 .enable = s5p64x0_pclk_ctrl,
233 .ctrlbit = (1 << 21),
234 }, {
235 .name = "spi",
236 .devname = "s5p64x0-spi.1",
237 .parent = &clk_pclk_low.clk,
238 .enable = s5p64x0_pclk_ctrl,
239 .ctrlbit = (1 << 22),
240 }, {
241 .name = "gps",
242 .parent = &clk_pclk_low.clk,
243 .enable = s5p64x0_pclk_ctrl,
244 .ctrlbit = (1 << 25),
245 }, {
246 .name = "dsim",
247 .parent = &clk_pclk_low.clk,
248 .enable = s5p64x0_pclk_ctrl,
249 .ctrlbit = (1 << 28),
250 }, {
251 .name = "etm",
252 .parent = &clk_pclk.clk,
253 .enable = s5p64x0_pclk_ctrl,
254 .ctrlbit = (1 << 29),
255 }, {
256 .name = "dmc0",
257 .parent = &clk_pclk.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 30),
260 }, {
261 .name = "pclk_fimgvg",
262 .parent = &clk_pclk.clk,
263 .enable = s5p64x0_pclk_ctrl,
264 .ctrlbit = (1 << 31),
265 }, {
266 .name = "mmc_48m",
267 .devname = "s3c-sdhci.0",
268 .parent = &clk_48m,
269 .enable = s5p64x0_sclk_ctrl,
270 .ctrlbit = (1 << 27),
271 }, {
272 .name = "mmc_48m",
273 .devname = "s3c-sdhci.1",
274 .parent = &clk_48m,
275 .enable = s5p64x0_sclk_ctrl,
276 .ctrlbit = (1 << 28),
277 }, {
278 .name = "mmc_48m",
279 .devname = "s3c-sdhci.2",
280 .parent = &clk_48m,
281 .enable = s5p64x0_sclk_ctrl,
282 .ctrlbit = (1 << 29),
283 },
284};
285
286/*
287 * The following clocks will be enabled during clock initialization.
288 */
289static struct clk init_clocks[] = {
290 {
291 .name = "intc",
292 .parent = &clk_hclk.clk,
293 .enable = s5p64x0_hclk0_ctrl,
294 .ctrlbit = (1 << 1),
295 }, {
296 .name = "mem",
297 .parent = &clk_hclk.clk,
298 .enable = s5p64x0_hclk0_ctrl,
299 .ctrlbit = (1 << 21),
300 }, {
301 .name = "uart",
302 .devname = "s3c6400-uart.0",
303 .parent = &clk_pclk_low.clk,
304 .enable = s5p64x0_pclk_ctrl,
305 .ctrlbit = (1 << 1),
306 }, {
307 .name = "uart",
308 .devname = "s3c6400-uart.1",
309 .parent = &clk_pclk_low.clk,
310 .enable = s5p64x0_pclk_ctrl,
311 .ctrlbit = (1 << 2),
312 }, {
313 .name = "uart",
314 .devname = "s3c6400-uart.2",
315 .parent = &clk_pclk_low.clk,
316 .enable = s5p64x0_pclk_ctrl,
317 .ctrlbit = (1 << 3),
318 }, {
319 .name = "uart",
320 .devname = "s3c6400-uart.3",
321 .parent = &clk_pclk_low.clk,
322 .enable = s5p64x0_pclk_ctrl,
323 .ctrlbit = (1 << 4),
324 }, {
325 .name = "gpio",
326 .parent = &clk_pclk_low.clk,
327 .enable = s5p64x0_pclk_ctrl,
328 .ctrlbit = (1 << 18),
329 },
330};
331
332static struct clk clk_iis_cd_v40 = {
333 .name = "iis_cdclk_v40",
334};
335
336static struct clk clk_pcm_cd = {
337 .name = "pcm_cdclk",
338};
339
340static struct clk *clkset_group1_list[] = {
341 &clk_mout_epll.clk,
342 &clk_dout_mpll.clk,
343 &clk_fin_epll,
344};
345
346static struct clksrc_sources clkset_group1 = {
347 .sources = clkset_group1_list,
348 .nr_sources = ARRAY_SIZE(clkset_group1_list),
349};
350
351static struct clk *clkset_uart_list[] = {
352 &clk_mout_epll.clk,
353 &clk_dout_mpll.clk,
354};
355
356static struct clksrc_sources clkset_uart = {
357 .sources = clkset_uart_list,
358 .nr_sources = ARRAY_SIZE(clkset_uart_list),
359};
360
361static struct clk *clkset_audio_list[] = {
362 &clk_mout_epll.clk,
363 &clk_dout_mpll.clk,
364 &clk_fin_epll,
365 &clk_iis_cd_v40,
366 &clk_pcm_cd,
367};
368
369static struct clksrc_sources clkset_audio = {
370 .sources = clkset_audio_list,
371 .nr_sources = ARRAY_SIZE(clkset_audio_list),
372};
373
374static struct clksrc_clk clksrcs[] = {
375 {
376 .clk = {
377 .name = "sclk_post",
378 .ctrlbit = (1 << 10),
379 .enable = s5p64x0_sclk_ctrl,
380 },
381 .sources = &clkset_group1,
382 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
383 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
384 }, {
385 .clk = {
386 .name = "sclk_dispcon",
387 .ctrlbit = (1 << 1),
388 .enable = s5p64x0_sclk1_ctrl,
389 },
390 .sources = &clkset_group1,
391 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
392 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
393 }, {
394 .clk = {
395 .name = "sclk_fimgvg",
396 .ctrlbit = (1 << 2),
397 .enable = s5p64x0_sclk1_ctrl,
398 },
399 .sources = &clkset_group1,
400 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
401 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
402 },
403};
404
405static struct clksrc_clk clk_sclk_mmc0 = {
406 .clk = {
407 .name = "sclk_mmc",
408 .devname = "s3c-sdhci.0",
409 .ctrlbit = (1 << 24),
410 .enable = s5p64x0_sclk_ctrl,
411 },
412 .sources = &clkset_group1,
413 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
414 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
415};
416
417static struct clksrc_clk clk_sclk_mmc1 = {
418 .clk = {
419 .name = "sclk_mmc",
420 .devname = "s3c-sdhci.1",
421 .ctrlbit = (1 << 25),
422 .enable = s5p64x0_sclk_ctrl,
423 },
424 .sources = &clkset_group1,
425 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
426 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
427};
428
429static struct clksrc_clk clk_sclk_mmc2 = {
430 .clk = {
431 .name = "sclk_mmc",
432 .devname = "s3c-sdhci.2",
433 .ctrlbit = (1 << 26),
434 .enable = s5p64x0_sclk_ctrl,
435 },
436 .sources = &clkset_group1,
437 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
438 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
439};
440
441static struct clksrc_clk clk_sclk_uclk = {
442 .clk = {
443 .name = "uclk1",
444 .ctrlbit = (1 << 5),
445 .enable = s5p64x0_sclk_ctrl,
446 },
447 .sources = &clkset_uart,
448 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
449 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
450};
451
452static struct clk clk_i2s0 = {
453 .name = "iis",
454 .devname = "samsung-i2s.0",
455 .parent = &clk_pclk_low.clk,
456 .enable = s5p64x0_pclk_ctrl,
457 .ctrlbit = (1 << 26),
458};
459
460static struct clksrc_clk clk_audio_bus2 = {
461 .clk = {
462 .name = "sclk_audio2",
463 .devname = "samsung-i2s.0",
464 .ctrlbit = (1 << 11),
465 .enable = s5p64x0_sclk_ctrl,
466 },
467 .sources = &clkset_audio,
468 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
469 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
470};
471
472static struct clksrc_clk clk_sclk_spi0 = {
473 .clk = {
474 .name = "sclk_spi",
475 .devname = "s5p64x0-spi.0",
476 .ctrlbit = (1 << 20),
477 .enable = s5p64x0_sclk_ctrl,
478 },
479 .sources = &clkset_group1,
480 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
481 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
482};
483
484static struct clksrc_clk clk_sclk_spi1 = {
485 .clk = {
486 .name = "sclk_spi",
487 .devname = "s5p64x0-spi.1",
488 .ctrlbit = (1 << 21),
489 .enable = s5p64x0_sclk_ctrl,
490 },
491 .sources = &clkset_group1,
492 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
493 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
494};
495
496/* Clock initialization code */
497static struct clksrc_clk *sysclks[] = {
498 &clk_mout_apll,
499 &clk_mout_epll,
500 &clk_mout_mpll,
501 &clk_dout_mpll,
502 &clk_armclk,
503 &clk_hclk,
504 &clk_pclk,
505 &clk_hclk_low,
506 &clk_pclk_low,
507};
508
509static struct clk dummy_apb_pclk = {
510 .name = "apb_pclk",
511 .id = -1,
512};
513
514static struct clk *clk_cdev[] = {
515 &clk_i2s0,
516};
517
518static struct clksrc_clk *clksrc_cdev[] = {
519 &clk_sclk_uclk,
520 &clk_sclk_spi0,
521 &clk_sclk_spi1,
522 &clk_sclk_mmc0,
523 &clk_sclk_mmc1,
524 &clk_sclk_mmc2,
525 &clk_audio_bus2,
526};
527
528static struct clk_lookup s5p6440_clk_lookup[] = {
529 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
530 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
531 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
532 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
533 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
534 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
535 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
536 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
537 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
538 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_audio_bus2.clk),
539};
540
541void __init_or_cpufreq s5p6440_setup_clocks(void)
542{
543 struct clk *xtal_clk;
544
545 unsigned long xtal;
546 unsigned long fclk;
547 unsigned long hclk;
548 unsigned long hclk_low;
549 unsigned long pclk;
550 unsigned long pclk_low;
551
552 unsigned long apll;
553 unsigned long mpll;
554 unsigned long epll;
555 unsigned int ptr;
556
557 /* Set S5P6440 functions for clk_fout_epll */
558
559 clk_fout_epll.enable = s5p_epll_enable;
560 clk_fout_epll.ops = &s5p6440_epll_ops;
561
562 clk_48m.enable = s5p64x0_clk48m_ctrl;
563
564 xtal_clk = clk_get(NULL, "ext_xtal");
565 BUG_ON(IS_ERR(xtal_clk));
566
567 xtal = clk_get_rate(xtal_clk);
568 clk_put(xtal_clk);
569
570 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
571 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
572 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
573 __raw_readl(S5P64X0_EPLL_CON_K));
574
575 clk_fout_apll.rate = apll;
576 clk_fout_mpll.rate = mpll;
577 clk_fout_epll.rate = epll;
578
579 printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
580 " E=%ld.%ldMHz\n",
581 print_mhz(apll), print_mhz(mpll), print_mhz(epll));
582
583 fclk = clk_get_rate(&clk_armclk.clk);
584 hclk = clk_get_rate(&clk_hclk.clk);
585 pclk = clk_get_rate(&clk_pclk.clk);
586 hclk_low = clk_get_rate(&clk_hclk_low.clk);
587 pclk_low = clk_get_rate(&clk_pclk_low.clk);
588
589 printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
590 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
591 print_mhz(hclk), print_mhz(hclk_low),
592 print_mhz(pclk), print_mhz(pclk_low));
593
594 clk_f.rate = fclk;
595 clk_h.rate = hclk;
596 clk_p.rate = pclk;
597
598 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
599 s3c_set_clksrc(&clksrcs[ptr], true);
600}
601
602static struct clk *clks[] __initdata = {
603 &clk_ext,
604 &clk_iis_cd_v40,
605 &clk_pcm_cd,
606};
607
608void __init s5p6440_register_clocks(void)
609{
610 int ptr;
611 unsigned int cnt;
612
613 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
614
615 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
616 s3c_register_clksrc(sysclks[ptr], 1);
617
618 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
619 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
620 s3c_disable_clocks(clk_cdev[cnt], 1);
621
622 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
623 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
624 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
625 s3c_register_clksrc(clksrc_cdev[ptr], 1);
626
627 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
628 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
629 clkdev_add_table(s5p6440_clk_lookup, ARRAY_SIZE(s5p6440_clk_lookup));
630
631 s3c24xx_register_clock(&dummy_apb_pclk);
632}
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
deleted file mode 100644
index 0b3ca2ed53e9..000000000000
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ /dev/null
@@ -1,701 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock-s5p6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P6450 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "clock.h"
35#include "common.h"
36
37static struct clksrc_clk clk_mout_dpll = {
38 .clk = {
39 .name = "mout_dpll",
40 },
41 .sources = &clk_src_dpll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 5, .size = 1 },
43};
44
45static u32 epll_div[][5] = {
46 { 133000000, 27307, 55, 2, 2 },
47 { 100000000, 43691, 41, 2, 2 },
48 { 480000000, 0, 80, 2, 0 },
49};
50
51static int s5p6450_epll_set_rate(struct clk *clk, unsigned long rate)
52{
53 unsigned int epll_con, epll_con_k;
54 unsigned int i;
55
56 if (clk->rate == rate) /* Return if nothing changed */
57 return 0;
58
59 epll_con = __raw_readl(S5P64X0_EPLL_CON);
60 epll_con_k = __raw_readl(S5P64X0_EPLL_CON_K);
61
62 epll_con_k &= ~(PLL90XX_KDIV_MASK);
63 epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK);
64
65 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
66 if (epll_div[i][0] == rate) {
67 epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT);
68 epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) |
69 (epll_div[i][3] << PLL90XX_PDIV_SHIFT) |
70 (epll_div[i][4] << PLL90XX_SDIV_SHIFT);
71 break;
72 }
73 }
74
75 if (i == ARRAY_SIZE(epll_div)) {
76 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
77 return -EINVAL;
78 }
79
80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82
83 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
86 clk->rate = rate;
87
88 return 0;
89}
90
91static struct clk_ops s5p6450_epll_ops = {
92 .get_rate = s5p_epll_get_rate,
93 .set_rate = s5p6450_epll_set_rate,
94};
95
96static struct clksrc_clk clk_dout_epll = {
97 .clk = {
98 .name = "dout_epll",
99 .parent = &clk_mout_epll.clk,
100 },
101 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 24, .size = 4 },
102};
103
104static struct clksrc_clk clk_mout_hclk_sel = {
105 .clk = {
106 .name = "mout_hclk_sel",
107 },
108 .sources = &clkset_hclk_low,
109 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 15, .size = 1 },
110};
111
112static struct clk *clkset_hclk_list[] = {
113 &clk_mout_hclk_sel.clk,
114 &clk_armclk.clk,
115};
116
117static struct clksrc_sources clkset_hclk = {
118 .sources = clkset_hclk_list,
119 .nr_sources = ARRAY_SIZE(clkset_hclk_list),
120};
121
122static struct clksrc_clk clk_hclk = {
123 .clk = {
124 .name = "clk_hclk",
125 },
126 .sources = &clkset_hclk,
127 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 14, .size = 1 },
128 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 8, .size = 4 },
129};
130
131static struct clksrc_clk clk_pclk = {
132 .clk = {
133 .name = "clk_pclk",
134 .parent = &clk_hclk.clk,
135 },
136 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 12, .size = 4 },
137};
138static struct clksrc_clk clk_dout_pwm_ratio0 = {
139 .clk = {
140 .name = "clk_dout_pwm_ratio0",
141 .parent = &clk_mout_hclk_sel.clk,
142 },
143 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 16, .size = 4 },
144};
145
146static struct clksrc_clk clk_pclk_to_wdt_pwm = {
147 .clk = {
148 .name = "clk_pclk_to_wdt_pwm",
149 .parent = &clk_dout_pwm_ratio0.clk,
150 },
151 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 20, .size = 4 },
152};
153
154static struct clksrc_clk clk_hclk_low = {
155 .clk = {
156 .name = "clk_hclk_low",
157 },
158 .sources = &clkset_hclk_low,
159 .reg_src = { .reg = S5P64X0_OTHERS, .shift = 6, .size = 1 },
160 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 8, .size = 4 },
161};
162
163static struct clksrc_clk clk_pclk_low = {
164 .clk = {
165 .name = "clk_pclk_low",
166 .parent = &clk_hclk_low.clk,
167 },
168 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 12, .size = 4 },
169};
170
171/*
172 * The following clocks will be disabled during clock initialization. It is
173 * recommended to keep the following clocks disabled until the driver requests
174 * for enabling the clock.
175 */
176static struct clk init_clocks_off[] = {
177 {
178 .name = "usbhost",
179 .parent = &clk_hclk_low.clk,
180 .enable = s5p64x0_hclk0_ctrl,
181 .ctrlbit = (1 << 3),
182 }, {
183 .name = "dma",
184 .devname = "dma-pl330",
185 .parent = &clk_hclk_low.clk,
186 .enable = s5p64x0_hclk0_ctrl,
187 .ctrlbit = (1 << 12),
188 }, {
189 .name = "hsmmc",
190 .devname = "s3c-sdhci.0",
191 .parent = &clk_hclk_low.clk,
192 .enable = s5p64x0_hclk0_ctrl,
193 .ctrlbit = (1 << 17),
194 }, {
195 .name = "hsmmc",
196 .devname = "s3c-sdhci.1",
197 .parent = &clk_hclk_low.clk,
198 .enable = s5p64x0_hclk0_ctrl,
199 .ctrlbit = (1 << 18),
200 }, {
201 .name = "hsmmc",
202 .devname = "s3c-sdhci.2",
203 .parent = &clk_hclk_low.clk,
204 .enable = s5p64x0_hclk0_ctrl,
205 .ctrlbit = (1 << 19),
206 }, {
207 .name = "usbotg",
208 .parent = &clk_hclk_low.clk,
209 .enable = s5p64x0_hclk0_ctrl,
210 .ctrlbit = (1 << 20),
211 }, {
212 .name = "lcd",
213 .parent = &clk_h,
214 .enable = s5p64x0_hclk1_ctrl,
215 .ctrlbit = (1 << 1),
216 }, {
217 .name = "watchdog",
218 .parent = &clk_pclk_low.clk,
219 .enable = s5p64x0_pclk_ctrl,
220 .ctrlbit = (1 << 5),
221 }, {
222 .name = "rtc",
223 .parent = &clk_pclk_low.clk,
224 .enable = s5p64x0_pclk_ctrl,
225 .ctrlbit = (1 << 6),
226 }, {
227 .name = "adc",
228 .parent = &clk_pclk_low.clk,
229 .enable = s5p64x0_pclk_ctrl,
230 .ctrlbit = (1 << 12),
231 }, {
232 .name = "i2c",
233 .devname = "s3c2440-i2c.0",
234 .parent = &clk_pclk_low.clk,
235 .enable = s5p64x0_pclk_ctrl,
236 .ctrlbit = (1 << 17),
237 }, {
238 .name = "spi",
239 .devname = "s5p64x0-spi.0",
240 .parent = &clk_pclk_low.clk,
241 .enable = s5p64x0_pclk_ctrl,
242 .ctrlbit = (1 << 21),
243 }, {
244 .name = "spi",
245 .devname = "s5p64x0-spi.1",
246 .parent = &clk_pclk_low.clk,
247 .enable = s5p64x0_pclk_ctrl,
248 .ctrlbit = (1 << 22),
249 }, {
250 .name = "i2c",
251 .devname = "s3c2440-i2c.1",
252 .parent = &clk_pclk_low.clk,
253 .enable = s5p64x0_pclk_ctrl,
254 .ctrlbit = (1 << 27),
255 }, {
256 .name = "dmc0",
257 .parent = &clk_pclk.clk,
258 .enable = s5p64x0_pclk_ctrl,
259 .ctrlbit = (1 << 30),
260 }
261};
262
263/*
264 * The following clocks will be enabled during clock initialization.
265 */
266static struct clk init_clocks[] = {
267 {
268 .name = "intc",
269 .parent = &clk_hclk.clk,
270 .enable = s5p64x0_hclk0_ctrl,
271 .ctrlbit = (1 << 1),
272 }, {
273 .name = "mem",
274 .parent = &clk_hclk.clk,
275 .enable = s5p64x0_hclk0_ctrl,
276 .ctrlbit = (1 << 21),
277 }, {
278 .name = "uart",
279 .devname = "s3c6400-uart.0",
280 .parent = &clk_pclk_low.clk,
281 .enable = s5p64x0_pclk_ctrl,
282 .ctrlbit = (1 << 1),
283 }, {
284 .name = "uart",
285 .devname = "s3c6400-uart.1",
286 .parent = &clk_pclk_low.clk,
287 .enable = s5p64x0_pclk_ctrl,
288 .ctrlbit = (1 << 2),
289 }, {
290 .name = "uart",
291 .devname = "s3c6400-uart.2",
292 .parent = &clk_pclk_low.clk,
293 .enable = s5p64x0_pclk_ctrl,
294 .ctrlbit = (1 << 3),
295 }, {
296 .name = "uart",
297 .devname = "s3c6400-uart.3",
298 .parent = &clk_pclk_low.clk,
299 .enable = s5p64x0_pclk_ctrl,
300 .ctrlbit = (1 << 4),
301 }, {
302 .name = "timers",
303 .parent = &clk_pclk_to_wdt_pwm.clk,
304 .enable = s5p64x0_pclk_ctrl,
305 .ctrlbit = (1 << 7),
306 }, {
307 .name = "gpio",
308 .parent = &clk_pclk_low.clk,
309 .enable = s5p64x0_pclk_ctrl,
310 .ctrlbit = (1 << 18),
311 },
312};
313
314static struct clk *clkset_uart_list[] = {
315 &clk_dout_epll.clk,
316 &clk_dout_mpll.clk,
317};
318
319static struct clksrc_sources clkset_uart = {
320 .sources = clkset_uart_list,
321 .nr_sources = ARRAY_SIZE(clkset_uart_list),
322};
323
324static struct clk *clkset_mali_list[] = {
325 &clk_mout_epll.clk,
326 &clk_mout_apll.clk,
327 &clk_mout_mpll.clk,
328};
329
330static struct clksrc_sources clkset_mali = {
331 .sources = clkset_mali_list,
332 .nr_sources = ARRAY_SIZE(clkset_mali_list),
333};
334
335static struct clk *clkset_group2_list[] = {
336 &clk_dout_epll.clk,
337 &clk_dout_mpll.clk,
338 &clk_ext_xtal_mux,
339};
340
341static struct clksrc_sources clkset_group2 = {
342 .sources = clkset_group2_list,
343 .nr_sources = ARRAY_SIZE(clkset_group2_list),
344};
345
346static struct clk *clkset_dispcon_list[] = {
347 &clk_dout_epll.clk,
348 &clk_dout_mpll.clk,
349 &clk_ext_xtal_mux,
350 &clk_mout_dpll.clk,
351};
352
353static struct clksrc_sources clkset_dispcon = {
354 .sources = clkset_dispcon_list,
355 .nr_sources = ARRAY_SIZE(clkset_dispcon_list),
356};
357
358static struct clk *clkset_hsmmc44_list[] = {
359 &clk_dout_epll.clk,
360 &clk_dout_mpll.clk,
361 &clk_ext_xtal_mux,
362 &s5p_clk_27m,
363 &clk_48m,
364};
365
366static struct clksrc_sources clkset_hsmmc44 = {
367 .sources = clkset_hsmmc44_list,
368 .nr_sources = ARRAY_SIZE(clkset_hsmmc44_list),
369};
370
371static struct clk *clkset_sclk_audio0_list[] = {
372 [0] = &clk_dout_epll.clk,
373 [1] = &clk_dout_mpll.clk,
374 [2] = &clk_ext_xtal_mux,
375 [3] = NULL,
376 [4] = NULL,
377};
378
379static struct clksrc_sources clkset_sclk_audio0 = {
380 .sources = clkset_sclk_audio0_list,
381 .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list),
382};
383
384static struct clksrc_clk clk_sclk_audio0 = {
385 .clk = {
386 .name = "audio-bus",
387 .devname = "samsung-i2s.0",
388 .enable = s5p64x0_sclk_ctrl,
389 .ctrlbit = (1 << 8),
390 .parent = &clk_dout_epll.clk,
391 },
392 .sources = &clkset_sclk_audio0,
393 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 10, .size = 3 },
394 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 8, .size = 4 },
395};
396
397static struct clksrc_clk clksrcs[] = {
398 {
399 .clk = {
400 .name = "sclk_fimc",
401 .ctrlbit = (1 << 10),
402 .enable = s5p64x0_sclk_ctrl,
403 },
404 .sources = &clkset_group2,
405 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 26, .size = 2 },
406 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 12, .size = 4 },
407 }, {
408 .clk = {
409 .name = "aclk_mali",
410 .ctrlbit = (1 << 2),
411 .enable = s5p64x0_sclk1_ctrl,
412 },
413 .sources = &clkset_mali,
414 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
415 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
416 }, {
417 .clk = {
418 .name = "sclk_2d",
419 .ctrlbit = (1 << 12),
420 .enable = s5p64x0_sclk_ctrl,
421 },
422 .sources = &clkset_mali,
423 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 30, .size = 2 },
424 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 20, .size = 4 },
425 }, {
426 .clk = {
427 .name = "sclk_usi",
428 .ctrlbit = (1 << 7),
429 .enable = s5p64x0_sclk_ctrl,
430 },
431 .sources = &clkset_group2,
432 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 10, .size = 2 },
433 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 16, .size = 4 },
434 }, {
435 .clk = {
436 .name = "sclk_camif",
437 .ctrlbit = (1 << 6),
438 .enable = s5p64x0_sclk_ctrl,
439 },
440 .sources = &clkset_group2,
441 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 28, .size = 2 },
442 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 20, .size = 4 },
443 }, {
444 .clk = {
445 .name = "sclk_dispcon",
446 .ctrlbit = (1 << 1),
447 .enable = s5p64x0_sclk1_ctrl,
448 },
449 .sources = &clkset_dispcon,
450 .reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 4, .size = 2 },
451 .reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 0, .size = 4 },
452 }, {
453 .clk = {
454 .name = "sclk_hsmmc44",
455 .ctrlbit = (1 << 30),
456 .enable = s5p64x0_sclk_ctrl,
457 },
458 .sources = &clkset_hsmmc44,
459 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 6, .size = 3 },
460 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 28, .size = 4 },
461 },
462};
463
464static struct clksrc_clk clk_sclk_mmc0 = {
465 .clk = {
466 .name = "sclk_mmc",
467 .devname = "s3c-sdhci.0",
468 .ctrlbit = (1 << 24),
469 .enable = s5p64x0_sclk_ctrl,
470 },
471 .sources = &clkset_group2,
472 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 18, .size = 2 },
473 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
474};
475
476static struct clksrc_clk clk_sclk_mmc1 = {
477 .clk = {
478 .name = "sclk_mmc",
479 .devname = "s3c-sdhci.1",
480 .ctrlbit = (1 << 25),
481 .enable = s5p64x0_sclk_ctrl,
482 },
483 .sources = &clkset_group2,
484 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 20, .size = 2 },
485 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
486};
487
488static struct clksrc_clk clk_sclk_mmc2 = {
489 .clk = {
490 .name = "sclk_mmc",
491 .devname = "s3c-sdhci.2",
492 .ctrlbit = (1 << 26),
493 .enable = s5p64x0_sclk_ctrl,
494 },
495 .sources = &clkset_group2,
496 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 22, .size = 2 },
497 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
498};
499
500static struct clksrc_clk clk_sclk_uclk = {
501 .clk = {
502 .name = "uclk1",
503 .ctrlbit = (1 << 5),
504 .enable = s5p64x0_sclk_ctrl,
505 },
506 .sources = &clkset_uart,
507 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 13, .size = 1 },
508 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
509};
510
511static struct clksrc_clk clk_sclk_spi0 = {
512 .clk = {
513 .name = "sclk_spi",
514 .devname = "s5p64x0-spi.0",
515 .ctrlbit = (1 << 20),
516 .enable = s5p64x0_sclk_ctrl,
517 },
518 .sources = &clkset_group2,
519 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
520 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
521};
522
523static struct clksrc_clk clk_sclk_spi1 = {
524 .clk = {
525 .name = "sclk_spi",
526 .devname = "s5p64x0-spi.1",
527 .ctrlbit = (1 << 21),
528 .enable = s5p64x0_sclk_ctrl,
529 },
530 .sources = &clkset_group2,
531 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
532 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
533};
534
535static struct clk clk_i2s0 = {
536 .name = "iis",
537 .devname = "samsung-i2s.0",
538 .parent = &clk_pclk_low.clk,
539 .enable = s5p64x0_pclk_ctrl,
540 .ctrlbit = (1 << 26),
541};
542
543static struct clk clk_i2s1 = {
544 .name = "iis",
545 .devname = "samsung-i2s.1",
546 .parent = &clk_pclk_low.clk,
547 .enable = s5p64x0_pclk_ctrl,
548 .ctrlbit = (1 << 15),
549};
550
551static struct clk clk_i2s2 = {
552 .name = "iis",
553 .devname = "samsung-i2s.2",
554 .parent = &clk_pclk_low.clk,
555 .enable = s5p64x0_pclk_ctrl,
556 .ctrlbit = (1 << 16),
557};
558
559static struct clk *clk_cdev[] = {
560 &clk_i2s0,
561 &clk_i2s1,
562 &clk_i2s2,
563};
564
565static struct clksrc_clk *clksrc_cdev[] = {
566 &clk_sclk_uclk,
567 &clk_sclk_spi0,
568 &clk_sclk_spi1,
569 &clk_sclk_mmc0,
570 &clk_sclk_mmc1,
571 &clk_sclk_mmc2,
572 &clk_sclk_audio0,
573};
574
575static struct clk_lookup s5p6450_clk_lookup[] = {
576 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
577 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
578 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
579 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
580 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
581 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
582 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
583 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
584 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
585 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk1", &clk_sclk_audio0.clk),
586 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
587 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
588};
589
590/* Clock initialization code */
591static struct clksrc_clk *sysclks[] = {
592 &clk_mout_apll,
593 &clk_mout_epll,
594 &clk_dout_epll,
595 &clk_mout_mpll,
596 &clk_dout_mpll,
597 &clk_armclk,
598 &clk_mout_hclk_sel,
599 &clk_dout_pwm_ratio0,
600 &clk_pclk_to_wdt_pwm,
601 &clk_hclk,
602 &clk_pclk,
603 &clk_hclk_low,
604 &clk_pclk_low,
605};
606
607static struct clk dummy_apb_pclk = {
608 .name = "apb_pclk",
609 .id = -1,
610};
611
612void __init_or_cpufreq s5p6450_setup_clocks(void)
613{
614 struct clk *xtal_clk;
615
616 unsigned long xtal;
617 unsigned long fclk;
618 unsigned long hclk;
619 unsigned long hclk_low;
620 unsigned long pclk;
621 unsigned long pclk_low;
622
623 unsigned long apll;
624 unsigned long mpll;
625 unsigned long epll;
626 unsigned long dpll;
627 unsigned int ptr;
628
629 /* Set S5P6450 functions for clk_fout_epll */
630
631 clk_fout_epll.enable = s5p_epll_enable;
632 clk_fout_epll.ops = &s5p6450_epll_ops;
633
634 clk_48m.enable = s5p64x0_clk48m_ctrl;
635
636 xtal_clk = clk_get(NULL, "ext_xtal");
637 BUG_ON(IS_ERR(xtal_clk));
638
639 xtal = clk_get_rate(xtal_clk);
640 clk_put(xtal_clk);
641
642 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_APLL_CON), pll_4502);
643 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P64X0_MPLL_CON), pll_4502);
644 epll = s5p_get_pll90xx(xtal, __raw_readl(S5P64X0_EPLL_CON),
645 __raw_readl(S5P64X0_EPLL_CON_K));
646 dpll = s5p_get_pll46xx(xtal, __raw_readl(S5P6450_DPLL_CON),
647 __raw_readl(S5P6450_DPLL_CON_K), pll_4650c);
648
649 clk_fout_apll.rate = apll;
650 clk_fout_mpll.rate = mpll;
651 clk_fout_epll.rate = epll;
652 clk_fout_dpll.rate = dpll;
653
654 printk(KERN_INFO "S5P6450: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
655 " E=%ld.%ldMHz, D=%ld.%ldMHz\n",
656 print_mhz(apll), print_mhz(mpll), print_mhz(epll),
657 print_mhz(dpll));
658
659 fclk = clk_get_rate(&clk_armclk.clk);
660 hclk = clk_get_rate(&clk_hclk.clk);
661 pclk = clk_get_rate(&clk_pclk.clk);
662 hclk_low = clk_get_rate(&clk_hclk_low.clk);
663 pclk_low = clk_get_rate(&clk_pclk_low.clk);
664
665 printk(KERN_INFO "S5P6450: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \
666 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
667 print_mhz(hclk), print_mhz(hclk_low),
668 print_mhz(pclk), print_mhz(pclk_low));
669
670 clk_f.rate = fclk;
671 clk_h.rate = hclk;
672 clk_p.rate = pclk;
673
674 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
675 s3c_set_clksrc(&clksrcs[ptr], true);
676}
677
678void __init s5p6450_register_clocks(void)
679{
680 int ptr;
681 unsigned int cnt;
682
683 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
684 s3c_register_clksrc(sysclks[ptr], 1);
685
686
687 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
688 for (cnt = 0; cnt < ARRAY_SIZE(clk_cdev); cnt++)
689 s3c_disable_clocks(clk_cdev[cnt], 1);
690
691 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
692 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
693 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
694 s3c_register_clksrc(clksrc_cdev[ptr], 1);
695
696 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
697 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
698 clkdev_add_table(s5p6450_clk_lookup, ARRAY_SIZE(s5p6450_clk_lookup));
699
700 s3c24xx_register_clock(&dummy_apb_pclk);
701}
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
deleted file mode 100644
index 57e718957ef3..000000000000
--- a/arch/arm/mach-s5p64x0/clock.c
+++ /dev/null
@@ -1,236 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/hardware.h>
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/cpu-freq.h>
28#include <plat/clock.h>
29#include <plat/cpu.h>
30#include <plat/pll.h>
31#include <plat/s5p-clock.h>
32#include <plat/clock-clksrc.h>
33
34#include "common.h"
35
36struct clksrc_clk clk_mout_apll = {
37 .clk = {
38 .name = "mout_apll",
39 .id = -1,
40 },
41 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 0, .size = 1 },
43};
44
45struct clksrc_clk clk_mout_mpll = {
46 .clk = {
47 .name = "mout_mpll",
48 .id = -1,
49 },
50 .sources = &clk_src_mpll,
51 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 1, .size = 1 },
52};
53
54struct clksrc_clk clk_mout_epll = {
55 .clk = {
56 .name = "mout_epll",
57 .id = -1,
58 },
59 .sources = &clk_src_epll,
60 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 2, .size = 1 },
61};
62
63enum perf_level {
64 L0 = 532*1000,
65 L1 = 266*1000,
66 L2 = 133*1000,
67};
68
69static const u32 clock_table[][3] = {
70 /*{ARM_CLK, DIVarm, DIVhclk}*/
71 {L0 * 1000, (0 << ARM_DIV_RATIO_SHIFT), (3 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
72 {L1 * 1000, (1 << ARM_DIV_RATIO_SHIFT), (1 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
74};
75
76static unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
77{
78 unsigned long rate = clk_get_rate(clk->parent);
79 u32 clkdiv;
80
81 /* divisor mask starts at bit0, so no need to shift */
82 clkdiv = __raw_readl(ARM_CLK_DIV) & ARM_DIV_MASK;
83
84 return rate / (clkdiv + 1);
85}
86
87static unsigned long s5p64x0_armclk_round_rate(struct clk *clk,
88 unsigned long rate)
89{
90 u32 iter;
91
92 for (iter = 1 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
93 if (rate > clock_table[iter][0])
94 return clock_table[iter-1][0];
95 }
96
97 return clock_table[ARRAY_SIZE(clock_table) - 1][0];
98}
99
100static int s5p64x0_armclk_set_rate(struct clk *clk, unsigned long rate)
101{
102 u32 round_tmp;
103 u32 iter;
104 u32 clk_div0_tmp;
105 u32 cur_rate = clk->ops->get_rate(clk);
106 unsigned long flags;
107
108 round_tmp = clk->ops->round_rate(clk, rate);
109 if (round_tmp == cur_rate)
110 return 0;
111
112
113 for (iter = 0 ; iter < ARRAY_SIZE(clock_table) ; iter++) {
114 if (round_tmp == clock_table[iter][0])
115 break;
116 }
117
118 if (iter >= ARRAY_SIZE(clock_table))
119 iter = ARRAY_SIZE(clock_table) - 1;
120
121 local_irq_save(flags);
122 if (cur_rate > round_tmp) {
123 /* Frequency Down */
124 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
125 clk_div0_tmp |= clock_table[iter][1];
126 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
127
128 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
129 ~(S5P64X0_CLKDIV0_HCLK_MASK);
130 clk_div0_tmp |= clock_table[iter][2];
131 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
132
133
134 } else {
135 /* Frequency Up */
136 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) &
137 ~(S5P64X0_CLKDIV0_HCLK_MASK);
138 clk_div0_tmp |= clock_table[iter][2];
139 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
140
141 clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK);
142 clk_div0_tmp |= clock_table[iter][1];
143 __raw_writel(clk_div0_tmp, ARM_CLK_DIV);
144 }
145 local_irq_restore(flags);
146
147 clk->rate = clock_table[iter][0];
148
149 return 0;
150}
151
152static struct clk_ops s5p64x0_clkarm_ops = {
153 .get_rate = s5p64x0_armclk_get_rate,
154 .set_rate = s5p64x0_armclk_set_rate,
155 .round_rate = s5p64x0_armclk_round_rate,
156};
157
158struct clksrc_clk clk_armclk = {
159 .clk = {
160 .name = "armclk",
161 .id = 1,
162 .parent = &clk_mout_apll.clk,
163 .ops = &s5p64x0_clkarm_ops,
164 },
165 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 0, .size = 4 },
166};
167
168struct clksrc_clk clk_dout_mpll = {
169 .clk = {
170 .name = "dout_mpll",
171 .id = -1,
172 .parent = &clk_mout_mpll.clk,
173 },
174 .reg_div = { .reg = S5P64X0_CLK_DIV0, .shift = 4, .size = 1 },
175};
176
177static struct clk *clkset_hclk_low_list[] = {
178 &clk_mout_apll.clk,
179 &clk_mout_mpll.clk,
180};
181
182struct clksrc_sources clkset_hclk_low = {
183 .sources = clkset_hclk_low_list,
184 .nr_sources = ARRAY_SIZE(clkset_hclk_low_list),
185};
186
187int s5p64x0_pclk_ctrl(struct clk *clk, int enable)
188{
189 return s5p_gatectrl(S5P64X0_CLK_GATE_PCLK, clk, enable);
190}
191
192int s5p64x0_hclk0_ctrl(struct clk *clk, int enable)
193{
194 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK0, clk, enable);
195}
196
197int s5p64x0_hclk1_ctrl(struct clk *clk, int enable)
198{
199 return s5p_gatectrl(S5P64X0_CLK_GATE_HCLK1, clk, enable);
200}
201
202int s5p64x0_sclk_ctrl(struct clk *clk, int enable)
203{
204 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK0, clk, enable);
205}
206
207int s5p64x0_sclk1_ctrl(struct clk *clk, int enable)
208{
209 return s5p_gatectrl(S5P64X0_CLK_GATE_SCLK1, clk, enable);
210}
211
212int s5p64x0_mem_ctrl(struct clk *clk, int enable)
213{
214 return s5p_gatectrl(S5P64X0_CLK_GATE_MEM0, clk, enable);
215}
216
217int s5p64x0_clk48m_ctrl(struct clk *clk, int enable)
218{
219 unsigned long flags;
220 u32 val;
221
222 /* can't rely on clock lock, this register has other usages */
223 local_irq_save(flags);
224
225 val = __raw_readl(S5P64X0_OTHERS);
226 if (enable)
227 val |= S5P64X0_OTHERS_USB_SIG_MASK;
228 else
229 val &= ~S5P64X0_OTHERS_USB_SIG_MASK;
230
231 __raw_writel(val, S5P64X0_OTHERS);
232
233 local_irq_restore(flags);
234
235 return 0;
236}
diff --git a/arch/arm/mach-s5p64x0/clock.h b/arch/arm/mach-s5p64x0/clock.h
deleted file mode 100644
index 28b8e3c6bd24..000000000000
--- a/arch/arm/mach-s5p64x0/clock.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for s5p64x0 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __MACH_S5P64X0_CLOCK_H
13#define __MACH_S5P64X0_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk clk_mout_apll;
18extern struct clksrc_clk clk_mout_mpll;
19extern struct clksrc_clk clk_mout_epll;
20
21extern int s5p64x0_epll_enable(struct clk *clk, int enable);
22extern unsigned long s5p64x0_epll_get_rate(struct clk *clk);
23
24extern struct clksrc_clk clk_armclk;
25extern struct clksrc_clk clk_dout_mpll;
26
27extern struct clksrc_sources clkset_hclk_low;
28
29extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable);
30extern int s5p64x0_hclk0_ctrl(struct clk *clk, int enable);
31extern int s5p64x0_hclk1_ctrl(struct clk *clk, int enable);
32extern int s5p64x0_sclk_ctrl(struct clk *clk, int enable);
33extern int s5p64x0_sclk1_ctrl(struct clk *clk, int enable);
34extern int s5p64x0_mem_ctrl(struct clk *clk, int enable);
35
36extern int s5p64x0_clk48m_ctrl(struct clk *clk, int enable);
37
38#endif /* __MACH_S5P64X0_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
deleted file mode 100644
index 9a43be002d78..000000000000
--- a/arch/arm/mach-s5p64x0/common.c
+++ /dev/null
@@ -1,490 +0,0 @@
1/*
2 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Codes for S5P64X0 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/device.h>
21#include <linux/serial_core.h>
22#include <linux/serial_s3c.h>
23#include <clocksource/samsung_pwm.h>
24#include <linux/platform_device.h>
25#include <linux/sched.h>
26#include <linux/dma-mapping.h>
27#include <linux/gpio.h>
28#include <linux/irq.h>
29#include <linux/reboot.h>
30
31#include <asm/irq.h>
32#include <asm/proc-fns.h>
33#include <asm/system_misc.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <mach/map.h>
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/cpu.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/pm.h>
47#include <plat/sdhci.h>
48#include <plat/adc-core.h>
49#include <plat/fb-core.h>
50#include <plat/spi-core.h>
51#include <plat/gpio-cfg.h>
52#include <plat/pwm-core.h>
53#include <plat/regs-irqtype.h>
54#include <plat/watchdog-reset.h>
55
56#include "common.h"
57
58static const char name_s5p6440[] = "S5P6440";
59static const char name_s5p6450[] = "S5P6450";
60
61static struct cpu_table cpu_ids[] __initdata = {
62 {
63 .idcode = S5P6440_CPU_ID,
64 .idmask = S5P64XX_CPU_MASK,
65 .map_io = s5p6440_map_io,
66 .init_clocks = s5p6440_init_clocks,
67 .init_uarts = s5p6440_init_uarts,
68 .init = s5p64x0_init,
69 .name = name_s5p6440,
70 }, {
71 .idcode = S5P6450_CPU_ID,
72 .idmask = S5P64XX_CPU_MASK,
73 .map_io = s5p6450_map_io,
74 .init_clocks = s5p6450_init_clocks,
75 .init_uarts = s5p6450_init_uarts,
76 .init = s5p64x0_init,
77 .name = name_s5p6450,
78 },
79};
80
81/* Initial IO mappings */
82
83static struct map_desc s5p64x0_iodesc[] __initdata = {
84 {
85 .virtual = (unsigned long)S5P_VA_CHIPID,
86 .pfn = __phys_to_pfn(S5P64X0_PA_CHIPID),
87 .length = SZ_4K,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (unsigned long)S3C_VA_SYS,
91 .pfn = __phys_to_pfn(S5P64X0_PA_SYSCON),
92 .length = SZ_64K,
93 .type = MT_DEVICE,
94 }, {
95 .virtual = (unsigned long)S3C_VA_TIMER,
96 .pfn = __phys_to_pfn(S5P64X0_PA_TIMER),
97 .length = SZ_16K,
98 .type = MT_DEVICE,
99 }, {
100 .virtual = (unsigned long)S3C_VA_WATCHDOG,
101 .pfn = __phys_to_pfn(S5P64X0_PA_WDT),
102 .length = SZ_4K,
103 .type = MT_DEVICE,
104 }, {
105 .virtual = (unsigned long)S5P_VA_SROMC,
106 .pfn = __phys_to_pfn(S5P64X0_PA_SROMC),
107 .length = SZ_4K,
108 .type = MT_DEVICE,
109 }, {
110 .virtual = (unsigned long)S5P_VA_GPIO,
111 .pfn = __phys_to_pfn(S5P64X0_PA_GPIO),
112 .length = SZ_4K,
113 .type = MT_DEVICE,
114 }, {
115 .virtual = (unsigned long)VA_VIC0,
116 .pfn = __phys_to_pfn(S5P64X0_PA_VIC0),
117 .length = SZ_16K,
118 .type = MT_DEVICE,
119 }, {
120 .virtual = (unsigned long)VA_VIC1,
121 .pfn = __phys_to_pfn(S5P64X0_PA_VIC1),
122 .length = SZ_16K,
123 .type = MT_DEVICE,
124 },
125};
126
127static struct map_desc s5p6440_iodesc[] __initdata = {
128 {
129 .virtual = (unsigned long)S3C_VA_UART,
130 .pfn = __phys_to_pfn(S5P6440_PA_UART(0)),
131 .length = SZ_4K,
132 .type = MT_DEVICE,
133 },
134};
135
136static struct map_desc s5p6450_iodesc[] __initdata = {
137 {
138 .virtual = (unsigned long)S3C_VA_UART,
139 .pfn = __phys_to_pfn(S5P6450_PA_UART(0)),
140 .length = SZ_512K,
141 .type = MT_DEVICE,
142 }, {
143 .virtual = (unsigned long)S3C_VA_UART + SZ_512K,
144 .pfn = __phys_to_pfn(S5P6450_PA_UART(5)),
145 .length = SZ_4K,
146 .type = MT_DEVICE,
147 },
148};
149
150static void s5p64x0_idle(void)
151{
152 unsigned long val;
153
154 val = __raw_readl(S5P64X0_PWR_CFG);
155 val &= ~(0x3 << 5);
156 val |= (0x1 << 5);
157 __raw_writel(val, S5P64X0_PWR_CFG);
158
159 cpu_do_idle();
160}
161
162static struct samsung_pwm_variant s5p64x0_pwm_variant = {
163 .bits = 32,
164 .div_base = 0,
165 .has_tint_cstat = true,
166 .tclk_mask = 0,
167};
168
169void __init samsung_set_timer_source(unsigned int event, unsigned int source)
170{
171 s5p64x0_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
172 s5p64x0_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
173}
174
175void __init samsung_timer_init(void)
176{
177 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
178 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
179 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
180 };
181
182 samsung_pwm_clocksource_init(S3C_VA_TIMER,
183 timer_irqs, &s5p64x0_pwm_variant);
184}
185
186/*
187 * s5p64x0_map_io
188 *
189 * register the standard CPU IO areas
190 */
191
192void __init s5p64x0_init_io(struct map_desc *mach_desc, int size)
193{
194 /* initialize the io descriptors we need for initialization */
195 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
196 if (mach_desc)
197 iotable_init(mach_desc, size);
198
199 /* detect cpu id and rev. */
200 s5p_init_cpu(S5P64X0_SYS_ID);
201
202 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
203 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
204
205 samsung_pwm_set_platdata(&s5p64x0_pwm_variant);
206}
207
208#ifdef CONFIG_CPU_S5P6440
209void __init s5p6440_map_io(void)
210{
211 /* initialize any device information early */
212 s3c_adc_setname("s3c64xx-adc");
213 s3c_fb_setname("s5p64x0-fb");
214 s3c64xx_spi_setname("s5p64x0-spi");
215
216 s5p64x0_default_sdhci0();
217 s5p64x0_default_sdhci1();
218 s5p6440_default_sdhci2();
219
220 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
221}
222#endif
223
224#ifdef CONFIG_CPU_S5P6450
225void __init s5p6450_map_io(void)
226{
227 /* initialize any device information early */
228 s3c_adc_setname("s3c64xx-adc");
229 s3c_fb_setname("s5p64x0-fb");
230 s3c64xx_spi_setname("s5p64x0-spi");
231
232 s5p64x0_default_sdhci0();
233 s5p64x0_default_sdhci1();
234 s5p6450_default_sdhci2();
235
236 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
237}
238#endif
239
240/*
241 * s5p64x0_init_clocks
242 *
243 * register and setup the CPU clocks
244 */
245#ifdef CONFIG_CPU_S5P6440
246void __init s5p6440_init_clocks(int xtal)
247{
248 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
249
250 s3c24xx_register_baseclocks(xtal);
251 s5p_register_clocks(xtal);
252 s5p6440_register_clocks();
253 s5p6440_setup_clocks();
254}
255#endif
256
257#ifdef CONFIG_CPU_S5P6450
258void __init s5p6450_init_clocks(int xtal)
259{
260 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
261
262 s3c24xx_register_baseclocks(xtal);
263 s5p_register_clocks(xtal);
264 s5p6450_register_clocks();
265 s5p6450_setup_clocks();
266}
267#endif
268
269/*
270 * s5p64x0_init_irq
271 *
272 * register the CPU interrupts
273 */
274#ifdef CONFIG_CPU_S5P6440
275void __init s5p6440_init_irq(void)
276{
277 /* S5P6440 supports 2 VIC */
278 u32 vic[2];
279
280 /*
281 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
282 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
283 */
284 vic[0] = 0xff800ae7;
285 vic[1] = 0xffbf23e5;
286
287 s5p_init_irq(vic, ARRAY_SIZE(vic));
288}
289#endif
290
291#ifdef CONFIG_CPU_S5P6450
292void __init s5p6450_init_irq(void)
293{
294 /* S5P6450 supports only 2 VIC */
295 u32 vic[2];
296
297 /*
298 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
299 * VIC1 is missing IRQ VIC1[12, 14, 23]
300 */
301 vic[0] = 0xff9f1fff;
302 vic[1] = 0xff7fafff;
303
304 s5p_init_irq(vic, ARRAY_SIZE(vic));
305}
306#endif
307
308struct bus_type s5p64x0_subsys = {
309 .name = "s5p64x0-core",
310 .dev_name = "s5p64x0-core",
311};
312
313static struct device s5p64x0_dev = {
314 .bus = &s5p64x0_subsys,
315};
316
317static int __init s5p64x0_core_init(void)
318{
319 return subsys_system_register(&s5p64x0_subsys, NULL);
320}
321core_initcall(s5p64x0_core_init);
322
323int __init s5p64x0_init(void)
324{
325 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
326
327 /* set idle function */
328 arm_pm_idle = s5p64x0_idle;
329
330 return device_register(&s5p64x0_dev);
331}
332
333/* uart registration process */
334#ifdef CONFIG_CPU_S5P6440
335void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no)
336{
337 int uart;
338
339 for (uart = 0; uart < no; uart++) {
340 s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart);
341 s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART;
342 }
343
344 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
345}
346#endif
347
348#ifdef CONFIG_CPU_S5P6450
349void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no)
350{
351 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
352}
353#endif
354
355#define eint_offset(irq) ((irq) - IRQ_EINT(0))
356
357static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type)
358{
359 int offs = eint_offset(data->irq);
360 int shift;
361 u32 ctrl, mask;
362 u32 newvalue = 0;
363
364 if (offs > 15)
365 return -EINVAL;
366
367 switch (type) {
368 case IRQ_TYPE_NONE:
369 printk(KERN_WARNING "No edge setting!\n");
370 break;
371 case IRQ_TYPE_EDGE_RISING:
372 newvalue = S3C2410_EXTINT_RISEEDGE;
373 break;
374 case IRQ_TYPE_EDGE_FALLING:
375 newvalue = S3C2410_EXTINT_FALLEDGE;
376 break;
377 case IRQ_TYPE_EDGE_BOTH:
378 newvalue = S3C2410_EXTINT_BOTHEDGE;
379 break;
380 case IRQ_TYPE_LEVEL_LOW:
381 newvalue = S3C2410_EXTINT_LOWLEV;
382 break;
383 case IRQ_TYPE_LEVEL_HIGH:
384 newvalue = S3C2410_EXTINT_HILEV;
385 break;
386 default:
387 printk(KERN_ERR "No such irq type %d", type);
388 return -EINVAL;
389 }
390
391 shift = (offs / 2) * 4;
392 mask = 0x7 << shift;
393
394 ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask;
395 ctrl |= newvalue << shift;
396 __raw_writel(ctrl, S5P64X0_EINT0CON0);
397
398 /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */
399 if (soc_is_s5p6450())
400 s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2));
401 else
402 s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2));
403
404 return 0;
405}
406
407/*
408 * s5p64x0_irq_demux_eint
409 *
410 * This function demuxes the IRQ from the group0 external interrupts,
411 * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into
412 * the specific handlers s5p64x0_irq_demux_eintX_Y.
413 */
414static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end)
415{
416 u32 status = __raw_readl(S5P64X0_EINT0PEND);
417 u32 mask = __raw_readl(S5P64X0_EINT0MASK);
418 unsigned int irq;
419
420 status &= ~mask;
421 status >>= start;
422 status &= (1 << (end - start + 1)) - 1;
423
424 for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
425 if (status & 1)
426 generic_handle_irq(irq);
427 status >>= 1;
428 }
429}
430
431static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
432{
433 s5p64x0_irq_demux_eint(0, 3);
434}
435
436static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
437{
438 s5p64x0_irq_demux_eint(4, 11);
439}
440
441static void s5p64x0_irq_demux_eint12_15(unsigned int irq,
442 struct irq_desc *desc)
443{
444 s5p64x0_irq_demux_eint(12, 15);
445}
446
447static int s5p64x0_alloc_gc(void)
448{
449 struct irq_chip_generic *gc;
450 struct irq_chip_type *ct;
451
452 gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE,
453 S5P_VA_GPIO, handle_level_irq);
454 if (!gc) {
455 printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0"
456 "external interrupts failed\n", __func__);
457 return -EINVAL;
458 }
459
460 ct = gc->chip_types;
461 ct->chip.irq_ack = irq_gc_ack_set_bit;
462 ct->chip.irq_mask = irq_gc_mask_set_bit;
463 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
464 ct->chip.irq_set_type = s5p64x0_irq_eint_set_type;
465 ct->chip.irq_set_wake = s3c_irqext_wake;
466 ct->regs.ack = EINT0PEND_OFFSET;
467 ct->regs.mask = EINT0MASK_OFFSET;
468 irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE,
469 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
470 return 0;
471}
472
473static int __init s5p64x0_init_irq_eint(void)
474{
475 int ret = s5p64x0_alloc_gc();
476 irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3);
477 irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11);
478 irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15);
479
480 return ret;
481}
482arch_initcall(s5p64x0_init_irq_eint);
483
484void s5p64x0_restart(enum reboot_mode mode, const char *cmd)
485{
486 if (mode != REBOOT_SOFT)
487 samsung_wdt_reset();
488
489 soft_restart(0);
490}
diff --git a/arch/arm/mach-s5p64x0/common.h b/arch/arm/mach-s5p64x0/common.h
deleted file mode 100644
index cbe7f3d731d0..000000000000
--- a/arch/arm/mach-s5p64x0/common.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S5P64X0 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H
13#define __ARCH_ARM_MACH_S5P64X0_COMMON_H
14
15#include <linux/reboot.h>
16
17void s5p6440_init_irq(void);
18void s5p6450_init_irq(void);
19void s5p64x0_init_io(struct map_desc *mach_desc, int size);
20
21void s5p6440_register_clocks(void);
22void s5p6440_setup_clocks(void);
23
24void s5p6450_register_clocks(void);
25void s5p6450_setup_clocks(void);
26
27void s5p64x0_restart(enum reboot_mode mode, const char *cmd);
28extern int s5p64x0_init(void);
29
30#ifdef CONFIG_CPU_S5P6440
31
32extern void s5p6440_map_io(void);
33extern void s5p6440_init_clocks(int xtal);
34
35extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no);
36
37#else
38#define s5p6440_init_clocks NULL
39#define s5p6440_init_uarts NULL
40#define s5p6440_map_io NULL
41#endif
42
43#ifdef CONFIG_CPU_S5P6450
44
45extern void s5p6450_map_io(void);
46extern void s5p6450_init_clocks(int xtal);
47
48extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no);
49
50#else
51#define s5p6450_init_clocks NULL
52#define s5p6450_init_uarts NULL
53#define s5p6450_map_io NULL
54#endif
55
56#endif /* __ARCH_ARM_MACH_S5P64X0_COMMON_H */
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
deleted file mode 100644
index 723d4773c323..000000000000
--- a/arch/arm/mach-s5p64x0/dev-audio.c
+++ /dev/null
@@ -1,176 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5p6440_cfg_i2s(struct platform_device *pdev)
23{
24 switch (pdev->id) {
25 case 0:
26 s3c_gpio_cfgpin_range(S5P6440_GPC(4), 2, S3C_GPIO_SFN(5));
27 s3c_gpio_cfgpin(S5P6440_GPC(7), S3C_GPIO_SFN(5));
28 s3c_gpio_cfgpin_range(S5P6440_GPH(6), 4, S3C_GPIO_SFN(5));
29 break;
30 default:
31 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
32 return -EINVAL;
33 }
34
35 return 0;
36}
37
38static struct s3c_audio_pdata s5p6440_i2s_pdata = {
39 .cfg_gpio = s5p6440_cfg_i2s,
40 .type = {
41 .i2s = {
42 .quirks = QUIRK_PRI_6CHAN,
43 },
44 },
45};
46
47static struct resource s5p64x0_i2s0_resource[] = {
48 [0] = DEFINE_RES_MEM(S5P64X0_PA_I2S, SZ_256),
49 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
50 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
51};
52
53struct platform_device s5p6440_device_iis = {
54 .name = "samsung-i2s",
55 .id = 0,
56 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
57 .resource = s5p64x0_i2s0_resource,
58 .dev = {
59 .platform_data = &s5p6440_i2s_pdata,
60 },
61};
62
63static int s5p6450_cfg_i2s(struct platform_device *pdev)
64{
65 switch (pdev->id) {
66 case 0:
67 s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5));
68 s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5));
69 break;
70 case 1:
71 s3c_gpio_cfgpin(S5P6440_GPB(4), S3C_GPIO_SFN(5));
72 s3c_gpio_cfgpin_range(S5P6450_GPC(0), 4, S3C_GPIO_SFN(5));
73 break;
74 case 2:
75 s3c_gpio_cfgpin_range(S5P6450_GPK(0), 5, S3C_GPIO_SFN(5));
76 break;
77 default:
78 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
79 return -EINVAL;
80 }
81
82 return 0;
83}
84
85static struct s3c_audio_pdata s5p6450_i2s0_pdata = {
86 .cfg_gpio = s5p6450_cfg_i2s,
87 .type = {
88 .i2s = {
89 .quirks = QUIRK_PRI_6CHAN,
90 },
91 },
92};
93
94struct platform_device s5p6450_device_iis0 = {
95 .name = "samsung-i2s",
96 .id = 0,
97 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
98 .resource = s5p64x0_i2s0_resource,
99 .dev = {
100 .platform_data = &s5p6450_i2s0_pdata,
101 },
102};
103
104static struct s3c_audio_pdata s5p6450_i2s_pdata = {
105 .cfg_gpio = s5p6450_cfg_i2s,
106};
107
108static struct resource s5p6450_i2s1_resource[] = {
109 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S1, SZ_256),
110 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
111 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
112};
113
114struct platform_device s5p6450_device_iis1 = {
115 .name = "samsung-i2s",
116 .id = 1,
117 .num_resources = ARRAY_SIZE(s5p6450_i2s1_resource),
118 .resource = s5p6450_i2s1_resource,
119 .dev = {
120 .platform_data = &s5p6450_i2s_pdata,
121 },
122};
123
124static struct resource s5p6450_i2s2_resource[] = {
125 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S2, SZ_256),
126 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
127 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
128};
129
130struct platform_device s5p6450_device_iis2 = {
131 .name = "samsung-i2s",
132 .id = 2,
133 .num_resources = ARRAY_SIZE(s5p6450_i2s2_resource),
134 .resource = s5p6450_i2s2_resource,
135 .dev = {
136 .platform_data = &s5p6450_i2s_pdata,
137 },
138};
139
140/* PCM Controller platform_devices */
141
142static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev)
143{
144 switch (pdev->id) {
145 case 0:
146 s3c_gpio_cfgpin_range(S5P6440_GPR(6), 3, S3C_GPIO_SFN(2));
147 s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(2));
148 break;
149
150 default:
151 printk(KERN_DEBUG "Invalid PCM Controller number!");
152 return -EINVAL;
153 }
154
155 return 0;
156}
157
158static struct s3c_audio_pdata s5p6440_pcm_pdata = {
159 .cfg_gpio = s5p6440_pcm_cfg_gpio,
160};
161
162static struct resource s5p6440_pcm0_resource[] = {
163 [0] = DEFINE_RES_MEM(S5P64X0_PA_PCM, SZ_256),
164 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
165 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
166};
167
168struct platform_device s5p6440_device_pcm = {
169 .name = "samsung-pcm",
170 .id = 0,
171 .num_resources = ARRAY_SIZE(s5p6440_pcm0_resource),
172 .resource = s5p6440_pcm0_resource,
173 .dev = {
174 .platform_data = &s5p6440_pcm_pdata,
175 },
176};
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c
deleted file mode 100644
index 9c4ce085f585..000000000000
--- a/arch/arm/mach-s5p64x0/dma.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/dma.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/
23
24#include <linux/dma-mapping.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
29
30#include <mach/map.h>
31#include <mach/irqs.h>
32#include <mach/regs-clock.h>
33#include <mach/dma.h>
34
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/irqs.h>
38
39static u8 s5p6440_pdma_peri[] = {
40 DMACH_UART0_RX,
41 DMACH_UART0_TX,
42 DMACH_UART1_RX,
43 DMACH_UART1_TX,
44 DMACH_UART2_RX,
45 DMACH_UART2_TX,
46 DMACH_UART3_RX,
47 DMACH_UART3_TX,
48 DMACH_MAX,
49 DMACH_MAX,
50 DMACH_PCM0_TX,
51 DMACH_PCM0_RX,
52 DMACH_I2S0_TX,
53 DMACH_I2S0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI0_RX,
56 DMACH_MAX,
57 DMACH_MAX,
58 DMACH_MAX,
59 DMACH_MAX,
60 DMACH_SPI1_TX,
61 DMACH_SPI1_RX,
62};
63
64static struct dma_pl330_platdata s5p6440_pdma_pdata = {
65 .nr_valid_peri = ARRAY_SIZE(s5p6440_pdma_peri),
66 .peri_id = s5p6440_pdma_peri,
67};
68
69static u8 s5p6450_pdma_peri[] = {
70 DMACH_UART0_RX,
71 DMACH_UART0_TX,
72 DMACH_UART1_RX,
73 DMACH_UART1_TX,
74 DMACH_UART2_RX,
75 DMACH_UART2_TX,
76 DMACH_UART3_RX,
77 DMACH_UART3_TX,
78 DMACH_UART4_RX,
79 DMACH_UART4_TX,
80 DMACH_PCM0_TX,
81 DMACH_PCM0_RX,
82 DMACH_I2S0_TX,
83 DMACH_I2S0_RX,
84 DMACH_SPI0_TX,
85 DMACH_SPI0_RX,
86 DMACH_PCM1_TX,
87 DMACH_PCM1_RX,
88 DMACH_PCM2_TX,
89 DMACH_PCM2_RX,
90 DMACH_SPI1_TX,
91 DMACH_SPI1_RX,
92 DMACH_USI_TX,
93 DMACH_USI_RX,
94 DMACH_MAX,
95 DMACH_I2S1_TX,
96 DMACH_I2S1_RX,
97 DMACH_I2S2_TX,
98 DMACH_I2S2_RX,
99 DMACH_PWM,
100 DMACH_UART5_RX,
101 DMACH_UART5_TX,
102};
103
104static struct dma_pl330_platdata s5p6450_pdma_pdata = {
105 .nr_valid_peri = ARRAY_SIZE(s5p6450_pdma_peri),
106 .peri_id = s5p6450_pdma_peri,
107};
108
109static AMBA_AHB_DEVICE(s5p64x0_pdma, "dma-pl330", 0x00041330,
110 S5P64X0_PA_PDMA, {IRQ_DMA0}, NULL);
111
112static int __init s5p64x0_dma_init(void)
113{
114 if (soc_is_s5p6450()) {
115 dma_cap_set(DMA_SLAVE, s5p6450_pdma_pdata.cap_mask);
116 dma_cap_set(DMA_CYCLIC, s5p6450_pdma_pdata.cap_mask);
117 s5p64x0_pdma_device.dev.platform_data = &s5p6450_pdma_pdata;
118 } else {
119 dma_cap_set(DMA_SLAVE, s5p6440_pdma_pdata.cap_mask);
120 dma_cap_set(DMA_CYCLIC, s5p6440_pdma_pdata.cap_mask);
121 s5p64x0_pdma_device.dev.platform_data = &s5p6440_pdma_pdata;
122 }
123
124 amba_device_register(&s5p64x0_pdma_device, &iomem_resource);
125
126 return 0;
127}
128arch_initcall(s5p64x0_dma_init);
diff --git a/arch/arm/mach-s5p64x0/i2c.h b/arch/arm/mach-s5p64x0/i2c.h
deleted file mode 100644
index 1e5bb4ea200d..000000000000
--- a/arch/arm/mach-s5p64x0/i2c.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * S5P64X0 I2C configuration
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12extern void s5p6440_i2c0_cfg_gpio(struct platform_device *dev);
13extern void s5p6440_i2c1_cfg_gpio(struct platform_device *dev);
14
15extern void s5p6450_i2c0_cfg_gpio(struct platform_device *dev);
16extern void s5p6450_i2c1_cfg_gpio(struct platform_device *dev);
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
deleted file mode 100644
index 8759e7882bcb..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
+++ /dev/null
@@ -1,32 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11/* pull in the relevant register and map files. */
12
13#include <linux/serial_s3c.h>
14#include <plat/map-base.h>
15#include <plat/map-s5p.h>
16
17 .macro addruart, rp, rv, tmp
18 mov \rp, #0xE0000000
19 orr \rp, \rp, #0x00100000
20 ldr \rp, [\rp, #0x118 ]
21 and \rp, \rp, #0xff000
22 teq \rp, #0x50000 @@ S5P6450
23 ldreq \rp, =0xEC800000
24 movne \rp, #0xEC000000 @@ S5P6440
25 ldrne \rv, = S3C_VA_UART
26#if CONFIG_DEBUG_S3C_UART != 0
27 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
28 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
29#endif
30 .endm
31
32#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
deleted file mode 100644
index 06cd3c9b16ac..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/gpio.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/gpio.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - GPIO lib support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__
15
16/* GPIO bank sizes */
17
18#define S5P6440_GPIO_A_NR (6)
19#define S5P6440_GPIO_B_NR (7)
20#define S5P6440_GPIO_C_NR (8)
21#define S5P6440_GPIO_F_NR (16)
22#define S5P6440_GPIO_G_NR (7)
23#define S5P6440_GPIO_H_NR (10)
24#define S5P6440_GPIO_I_NR (16)
25#define S5P6440_GPIO_J_NR (12)
26#define S5P6440_GPIO_N_NR (16)
27#define S5P6440_GPIO_P_NR (8)
28#define S5P6440_GPIO_R_NR (15)
29
30#define S5P6450_GPIO_A_NR (6)
31#define S5P6450_GPIO_B_NR (7)
32#define S5P6450_GPIO_C_NR (8)
33#define S5P6450_GPIO_D_NR (8)
34#define S5P6450_GPIO_F_NR (16)
35#define S5P6450_GPIO_G_NR (14)
36#define S5P6450_GPIO_H_NR (10)
37#define S5P6450_GPIO_I_NR (16)
38#define S5P6450_GPIO_J_NR (12)
39#define S5P6450_GPIO_K_NR (5)
40#define S5P6450_GPIO_N_NR (16)
41#define S5P6450_GPIO_P_NR (11)
42#define S5P6450_GPIO_Q_NR (14)
43#define S5P6450_GPIO_R_NR (15)
44#define S5P6450_GPIO_S_NR (8)
45
46/* GPIO bank numbers */
47
48/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
49 * space for debugging purposes so that any accidental
50 * change from one gpio bank to another can be caught.
51*/
52
53#define S5P64X0_GPIO_NEXT(__gpio) \
54 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
55
56enum s5p6440_gpio_number {
57 S5P6440_GPIO_A_START = 0,
58 S5P6440_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_A),
59 S5P6440_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_B),
60 S5P6440_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_C),
61 S5P6440_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_F),
62 S5P6440_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_G),
63 S5P6440_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_H),
64 S5P6440_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_I),
65 S5P6440_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_J),
66 S5P6440_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_N),
67 S5P6440_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6440_GPIO_P),
68};
69
70enum s5p6450_gpio_number {
71 S5P6450_GPIO_A_START = 0,
72 S5P6450_GPIO_B_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_A),
73 S5P6450_GPIO_C_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_B),
74 S5P6450_GPIO_D_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_C),
75 S5P6450_GPIO_F_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_D),
76 S5P6450_GPIO_G_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_F),
77 S5P6450_GPIO_H_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_G),
78 S5P6450_GPIO_I_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_H),
79 S5P6450_GPIO_J_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_I),
80 S5P6450_GPIO_K_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_J),
81 S5P6450_GPIO_N_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_K),
82 S5P6450_GPIO_P_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_N),
83 S5P6450_GPIO_Q_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_P),
84 S5P6450_GPIO_R_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_Q),
85 S5P6450_GPIO_S_START = S5P64X0_GPIO_NEXT(S5P6450_GPIO_R),
86};
87
88/* GPIO number definitions */
89
90#define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr))
91#define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr))
92#define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr))
93#define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr))
94#define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr))
95#define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr))
96#define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr))
97#define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr))
98#define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr))
99#define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr))
100#define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr))
101
102#define S5P6450_GPA(_nr) (S5P6450_GPIO_A_START + (_nr))
103#define S5P6450_GPB(_nr) (S5P6450_GPIO_B_START + (_nr))
104#define S5P6450_GPC(_nr) (S5P6450_GPIO_C_START + (_nr))
105#define S5P6450_GPD(_nr) (S5P6450_GPIO_D_START + (_nr))
106#define S5P6450_GPF(_nr) (S5P6450_GPIO_F_START + (_nr))
107#define S5P6450_GPG(_nr) (S5P6450_GPIO_G_START + (_nr))
108#define S5P6450_GPH(_nr) (S5P6450_GPIO_H_START + (_nr))
109#define S5P6450_GPI(_nr) (S5P6450_GPIO_I_START + (_nr))
110#define S5P6450_GPJ(_nr) (S5P6450_GPIO_J_START + (_nr))
111#define S5P6450_GPK(_nr) (S5P6450_GPIO_K_START + (_nr))
112#define S5P6450_GPN(_nr) (S5P6450_GPIO_N_START + (_nr))
113#define S5P6450_GPP(_nr) (S5P6450_GPIO_P_START + (_nr))
114#define S5P6450_GPQ(_nr) (S5P6450_GPIO_Q_START + (_nr))
115#define S5P6450_GPR(_nr) (S5P6450_GPIO_R_START + (_nr))
116#define S5P6450_GPS(_nr) (S5P6450_GPIO_S_START + (_nr))
117
118/* the end of the S5P64X0 specific gpios */
119
120#define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
121#define S5P6450_GPIO_END (S5P6450_GPS(S5P6450_GPIO_S_NR) + 1)
122
123#define S5P64X0_GPIO_END (S5P6440_GPIO_END > S5P6450_GPIO_END ? \
124 S5P6440_GPIO_END : S5P6450_GPIO_END)
125
126#define S3C_GPIO_END S5P64X0_GPIO_END
127
128/* define the number of gpios we need to the one after the last GPIO range */
129
130#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
131
132#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/hardware.h b/arch/arm/mach-s5p64x0/include/mach/hardware.h
deleted file mode 100644
index d3e87996dd9a..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/hardware.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/hardware.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Hardware support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H __FILE__
15
16/* currently nothing here, placeholder */
17
18#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
deleted file mode 100644
index 53982db9d259..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/irqs.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/irqs.h
2 *
3 * Copyright 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - IRQ definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_IRQS_H __FILE__
15
16#include <plat/irqs.h>
17
18/* VIC0 */
19
20#define IRQ_EINT0_3 S5P_IRQ_VIC0(0)
21#define IRQ_EINT4_11 S5P_IRQ_VIC0(1)
22#define IRQ_RTC_TIC S5P_IRQ_VIC0(2)
23#define IRQ_IIS1 S5P_IRQ_VIC0(3) /* for only S5P6450 */
24#define IRQ_IIS2 S5P_IRQ_VIC0(4) /* for only S5P6450 */
25#define IRQ_IIC1 S5P_IRQ_VIC0(5)
26#define IRQ_I2SV40 S5P_IRQ_VIC0(6)
27#define IRQ_GPS S5P_IRQ_VIC0(7) /* for only S5P6450 */
28
29#define IRQ_2D S5P_IRQ_VIC0(11)
30#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(23)
31#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(24)
32#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(25)
33#define IRQ_WDT S5P_IRQ_VIC0(26)
34#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(27)
35#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(28)
36#define IRQ_DISPCON0 S5P_IRQ_VIC0(29)
37#define IRQ_DISPCON1 S5P_IRQ_VIC0(30)
38#define IRQ_DISPCON2 S5P_IRQ_VIC0(31)
39
40/* VIC1 */
41
42#define IRQ_EINT12_15 S5P_IRQ_VIC1(0)
43#define IRQ_PCM0 S5P_IRQ_VIC1(2)
44#define IRQ_PCM1 S5P_IRQ_VIC1(3) /* for only S5P6450 */
45#define IRQ_PCM2 S5P_IRQ_VIC1(4) /* for only S5P6450 */
46#define IRQ_UART0 S5P_IRQ_VIC1(5)
47#define IRQ_UART1 S5P_IRQ_VIC1(6)
48#define IRQ_UART2 S5P_IRQ_VIC1(7)
49#define IRQ_UART3 S5P_IRQ_VIC1(8)
50#define IRQ_DMA0 S5P_IRQ_VIC1(9)
51#define IRQ_UART4 S5P_IRQ_VIC1(10) /* S5P6450 */
52#define IRQ_UART5 S5P_IRQ_VIC1(11) /* S5P6450 */
53#define IRQ_NFC S5P_IRQ_VIC1(13)
54#define IRQ_USI S5P_IRQ_VIC1(15) /* S5P6450 */
55#define IRQ_SPI0 S5P_IRQ_VIC1(16)
56#define IRQ_SPI1 S5P_IRQ_VIC1(17)
57#define IRQ_HSMMC2 S5P_IRQ_VIC1(17) /* Shared */
58#define IRQ_IIC S5P_IRQ_VIC1(18)
59#define IRQ_DISPCON3 S5P_IRQ_VIC1(19)
60#define IRQ_EINT_GROUPS S5P_IRQ_VIC1(21)
61#define IRQ_PMU S5P_IRQ_VIC1(23) /* S5P6440 */
62#define IRQ_HSMMC0 S5P_IRQ_VIC1(24)
63#define IRQ_HSMMC1 S5P_IRQ_VIC1(25)
64#define IRQ_OTG S5P_IRQ_VIC1(26)
65#define IRQ_DSI S5P_IRQ_VIC1(27)
66#define IRQ_RTC_ALARM S5P_IRQ_VIC1(28)
67#define IRQ_TSI S5P_IRQ_VIC1(29)
68#define IRQ_PENDN S5P_IRQ_VIC1(30)
69#define IRQ_TC IRQ_PENDN
70#define IRQ_ADC S5P_IRQ_VIC1(31)
71
72/* UART interrupts, S5P6450 has 5 UARTs */
73#define IRQ_S5P_UART_BASE4 (96)
74#define IRQ_S5P_UART_BASE5 (100)
75
76#define IRQ_S5P_UART_RX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_RXD)
77#define IRQ_S5P_UART_TX4 (IRQ_S5P_UART_BASE4 + UART_IRQ_TXD)
78#define IRQ_S5P_UART_ERR4 (IRQ_S5P_UART_BASE4 + UART_IRQ_ERR)
79
80#define IRQ_S5P_UART_RX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_RXD)
81#define IRQ_S5P_UART_TX5 (IRQ_S5P_UART_BASE5 + UART_IRQ_TXD)
82#define IRQ_S5P_UART_ERR5 (IRQ_S5P_UART_BASE5 + UART_IRQ_ERR)
83
84/* S3C compatibilty defines */
85#define IRQ_S3CUART_RX4 IRQ_S5P_UART_RX4
86#define IRQ_S3CUART_RX5 IRQ_S5P_UART_RX5
87
88#define IRQ_I2S0 IRQ_I2SV40
89
90#define IRQ_LCD_FIFO IRQ_DISPCON0
91#define IRQ_LCD_VSYNC IRQ_DISPCON1
92#define IRQ_LCD_SYSTEM IRQ_DISPCON2
93
94/* S5P6450 EINT feature will be added */
95
96/*
97 * Since the IRQ_EINT(x) are a linear mapping on s5p6440 we just defined
98 * them as an IRQ_EINT(x) macro from S5P_IRQ_EINT_BASE which we place
99 * after the pair of VICs.
100 */
101
102#define S5P_IRQ_EINT_BASE (S5P_IRQ_VIC1(31) + 6)
103
104#define S5P_EINT(x) ((x) + S5P_IRQ_EINT_BASE)
105
106#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE)
107/*
108 * S5P6440 has 0-15 external interrupts in group 0. Only these can be used
109 * to wake up from sleep. If request is beyond this range, by mistake, a large
110 * return value for an irq number should be indication of something amiss.
111 */
112#define S5P_EINT_BASE2 (0xf0000000)
113
114/*
115 * Next the external interrupt groups. These are similar to the IRQ_EINT(x)
116 * that they are sourced from the GPIO pins but with a different scheme for
117 * priority and source indication.
118 *
119 * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
120 * interrupts, but for historical reasons they are kept apart from these
121 * next interrupts.
122 *
123 * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
124 * machine specific support files.
125 */
126
127/* Actually, #6 and #7 are missing in the EINT_GROUP1 */
128#define IRQ_EINT_GROUP1_NR (15)
129#define IRQ_EINT_GROUP2_NR (8)
130#define IRQ_EINT_GROUP5_NR (7)
131#define IRQ_EINT_GROUP6_NR (10)
132/* Actually, #0, #1 and #2 are missing in the EINT_GROUP8 */
133#define IRQ_EINT_GROUP8_NR (11)
134
135#define IRQ_EINT_GROUP_BASE S5P_EINT(16)
136#define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0)
137#define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
138#define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
139#define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
140#define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
141
142#define IRQ_EINT_GROUP(grp, x) (IRQ_EINT_GROUP##grp##_BASE + (x))
143
144/* Set the default NR_IRQS */
145
146#define NR_IRQS (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1)
147
148#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
deleted file mode 100644
index 50a6e96d6389..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/map.h
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H __FILE__
15
16#include <plat/map-base.h>
17#include <plat/map-s5p.h>
18
19#define S5P64X0_PA_SDRAM 0x20000000
20
21#define S5P64X0_PA_CHIPID 0xE0000000
22
23#define S5P64X0_PA_SYSCON 0xE0100000
24
25#define S5P64X0_PA_GPIO 0xE0308000
26
27#define S5P64X0_PA_VIC0 0xE4000000
28#define S5P64X0_PA_VIC1 0xE4100000
29
30#define S5P64X0_PA_SROMC 0xE7000000
31
32#define S5P64X0_PA_PDMA 0xE9000000
33
34#define S5P64X0_PA_TIMER 0xEA000000
35#define S5P64X0_PA_RTC 0xEA100000
36#define S5P64X0_PA_WDT 0xEA200000
37
38#define S5P6440_PA_IIC0 0xEC104000
39#define S5P6440_PA_IIC1 0xEC20F000
40#define S5P6450_PA_IIC0 0xEC100000
41#define S5P6450_PA_IIC1 0xEC200000
42
43#define S5P64X0_PA_SPI0 0xEC400000
44#define S5P64X0_PA_SPI1 0xEC500000
45
46#define S5P64X0_PA_HSOTG 0xED100000
47
48#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
49
50#define S5P64X0_PA_FB 0xEE000000
51
52#define S5P64X0_PA_I2S 0xF2000000
53#define S5P6450_PA_I2S1 0xF2800000
54#define S5P6450_PA_I2S2 0xF2900000
55
56#define S5P64X0_PA_PCM 0xF2100000
57
58#define S5P64X0_PA_ADC 0xF3000000
59
60/* Compatibiltiy Defines */
61
62#define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0)
63#define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1)
64#define S3C_PA_HSMMC2 S5P64X0_PA_HSMMC(2)
65#define S3C_PA_IIC S5P6440_PA_IIC0
66#define S3C_PA_IIC1 S5P6440_PA_IIC1
67#define S3C_PA_RTC S5P64X0_PA_RTC
68#define S3C_PA_WDT S5P64X0_PA_WDT
69#define S3C_PA_FB S5P64X0_PA_FB
70#define S3C_PA_SPI0 S5P64X0_PA_SPI0
71#define S3C_PA_SPI1 S5P64X0_PA_SPI1
72
73#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
74#define S5P_PA_SROMC S5P64X0_PA_SROMC
75#define S5P_PA_SYSCON S5P64X0_PA_SYSCON
76#define S5P_PA_TIMER S5P64X0_PA_TIMER
77
78#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
79#define SAMSUNG_PA_TIMER S5P64X0_PA_TIMER
80
81/* UART */
82
83#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET))
84#define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000))
85
86#define S5P_PA_UART0 S5P6450_PA_UART(0)
87#define S5P_PA_UART1 S5P6450_PA_UART(1)
88#define S5P_PA_UART2 S5P6450_PA_UART(2)
89#define S5P_PA_UART3 S5P6450_PA_UART(3)
90#define S5P_PA_UART4 S5P6450_PA_UART(4)
91#define S5P_PA_UART5 S5P6450_PA_UART(5)
92
93#define S5P_SZ_UART SZ_256
94#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
95
96#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/pm-core.h b/arch/arm/mach-s5p64x0/include/mach/pm-core.h
deleted file mode 100644
index 1e0eb65b2b82..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/pm-core.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/pm-core.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - PM core support for arch/arm/plat-samsung/pm.c
7 *
8 * Based on PM core support for S3C64XX by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/serial_s3c.h>
16
17#include <mach/regs-gpio.h>
18
19static inline void s3c_pm_debug_init_uart(void)
20{
21 u32 tmp = __raw_readl(S5P64X0_CLK_GATE_PCLK);
22
23 /*
24 * As a note, since the S5P64X0 UARTs generally have multiple
25 * clock sources, we simply enable PCLK at the moment and hope
26 * that the resume settings for the UART are suitable for the
27 * use with PCLK.
28 */
29 tmp |= S5P64X0_CLK_GATE_PCLK_UART0;
30 tmp |= S5P64X0_CLK_GATE_PCLK_UART1;
31 tmp |= S5P64X0_CLK_GATE_PCLK_UART2;
32 tmp |= S5P64X0_CLK_GATE_PCLK_UART3;
33
34 __raw_writel(tmp, S5P64X0_CLK_GATE_PCLK);
35 udelay(10);
36}
37
38static inline void s3c_pm_arch_prepare_irqs(void)
39{
40 /* VIC should have already been taken care of */
41
42 /* clear any pending EINT0 interrupts */
43 __raw_writel(__raw_readl(S5P64X0_EINT0PEND), S5P64X0_EINT0PEND);
44}
45
46static inline void s3c_pm_arch_stop_clocks(void) { }
47static inline void s3c_pm_arch_show_resume_irqs(void) { }
48
49/*
50 * make these defines, we currently do not have any need to change
51 * the IRQ wake controls depending on the CPU we are running on
52 */
53#define s3c_irqwake_eintallow ((1 << 16) - 1)
54#define s3c_irqwake_intallow (~0)
55
56static inline void s3c_pm_arch_update_uart(void __iomem *regs,
57 struct pm_uart_save *save)
58{
59 u32 ucon = __raw_readl(regs + S3C2410_UCON);
60 u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;
61 u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;
62 u32 new_ucon;
63 u32 delta;
64
65 /*
66 * S5P64X0 UART blocks only support level interrupts, so ensure that
67 * when we restore unused UART blocks we force the level interrupt
68 * settings.
69 */
70 save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
71
72 /*
73 * We have a constraint on changing the clock type of the UART
74 * between UCLKx and PCLK, so ensure that when we restore UCON
75 * that the CLK field is correctly modified if the bootloader
76 * has changed anything.
77 */
78 if (ucon_clk != save_clk) {
79 new_ucon = save->ucon;
80 delta = ucon_clk ^ save_clk;
81
82 /*
83 * change from UCLKx => wrong PCLK,
84 * either UCLK can be tested for by a bit-test
85 * with UCLK0
86 */
87 if (ucon_clk & S3C6400_UCON_UCLK0 &&
88 !(save_clk & S3C6400_UCON_UCLK0) &&
89 delta & S3C6400_UCON_PCLK2) {
90 new_ucon &= ~S3C6400_UCON_UCLK0;
91 } else if (delta == S3C6400_UCON_PCLK2) {
92 /*
93 * as a precaution, don't change from
94 * PCLK2 => PCLK or vice-versa
95 */
96 new_ucon ^= S3C6400_UCON_PCLK2;
97 }
98
99 S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
100 ucon, new_ucon, save->ucon);
101 save->ucon = new_ucon;
102 }
103}
104
105static inline void s3c_pm_restored_gpios(void)
106{
107 /* ensure sleep mode has been cleared from the system */
108 __raw_writel(0, S5P64X0_SLPEN);
109}
110
111static inline void samsung_pm_saved_gpios(void)
112{
113 /*
114 * turn on the sleep mode and keep it there, as it seems that during
115 * suspend the xCON registers get re-set and thus you can end up with
116 * problems between going to sleep and resuming.
117 */
118 __raw_writel(S5P64X0_SLPEN_USE_xSLP, S5P64X0_SLPEN);
119}
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
deleted file mode 100644
index bd91112c813c..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5P64X0_APLL_CON S5P_CLKREG(0x0C)
21#define S5P64X0_MPLL_CON S5P_CLKREG(0x10)
22#define S5P64X0_EPLL_CON S5P_CLKREG(0x14)
23#define S5P64X0_EPLL_CON_K S5P_CLKREG(0x18)
24
25#define S5P64X0_CLK_SRC0 S5P_CLKREG(0x1C)
26
27#define S5P64X0_CLK_DIV0 S5P_CLKREG(0x20)
28#define S5P64X0_CLK_DIV1 S5P_CLKREG(0x24)
29#define S5P64X0_CLK_DIV2 S5P_CLKREG(0x28)
30
31#define S5P64X0_CLK_GATE_HCLK0 S5P_CLKREG(0x30)
32#define S5P64X0_CLK_GATE_PCLK S5P_CLKREG(0x34)
33#define S5P64X0_CLK_GATE_SCLK0 S5P_CLKREG(0x38)
34#define S5P64X0_CLK_GATE_MEM0 S5P_CLKREG(0x3C)
35
36#define S5P64X0_CLK_DIV3 S5P_CLKREG(0x40)
37
38#define S5P64X0_CLK_GATE_HCLK1 S5P_CLKREG(0x44)
39#define S5P64X0_CLK_GATE_SCLK1 S5P_CLKREG(0x48)
40
41#define S5P6450_DPLL_CON S5P_CLKREG(0x50)
42#define S5P6450_DPLL_CON_K S5P_CLKREG(0x54)
43
44#define S5P64X0_AHB_CON0 S5P_CLKREG(0x100)
45#define S5P64X0_CLK_SRC1 S5P_CLKREG(0x10C)
46
47#define S5P64X0_SYS_ID S5P_CLKREG(0x118)
48#define S5P64X0_SYS_OTHERS S5P_CLKREG(0x11C)
49
50#define S5P64X0_PWR_CFG S5P_CLKREG(0x804)
51#define S5P64X0_EINT_WAKEUP_MASK S5P_CLKREG(0x808)
52#define S5P64X0_SLEEP_CFG S5P_CLKREG(0x818)
53#define S5P64X0_PWR_STABLE S5P_CLKREG(0x828)
54
55#define S5P64X0_OTHERS S5P_CLKREG(0x900)
56#define S5P64X0_WAKEUP_STAT S5P_CLKREG(0x908)
57
58#define S5P64X0_INFORM0 S5P_CLKREG(0xA00)
59
60#define S5P64X0_CLKDIV0_HCLK_SHIFT (8)
61#define S5P64X0_CLKDIV0_HCLK_MASK (0xF << S5P64X0_CLKDIV0_HCLK_SHIFT)
62
63/* HCLK GATE Registers */
64#define S5P64X0_CLK_GATE_HCLK1_FIMGVG (1 << 2)
65#define S5P64X0_CLK_GATE_SCLK1_FIMGVG (1 << 2)
66
67/* PCLK GATE Registers */
68#define S5P64X0_CLK_GATE_PCLK_UART3 (1 << 4)
69#define S5P64X0_CLK_GATE_PCLK_UART2 (1 << 3)
70#define S5P64X0_CLK_GATE_PCLK_UART1 (1 << 2)
71#define S5P64X0_CLK_GATE_PCLK_UART0 (1 << 1)
72
73#define S5P64X0_PWR_CFG_MMC1_DISABLE (1 << 15)
74#define S5P64X0_PWR_CFG_MMC0_DISABLE (1 << 14)
75#define S5P64X0_PWR_CFG_RTC_TICK_DISABLE (1 << 11)
76#define S5P64X0_PWR_CFG_RTC_ALRM_DISABLE (1 << 10)
77#define S5P64X0_PWR_CFG_WFI_MASK (3 << 5)
78#define S5P64X0_PWR_CFG_WFI_SLEEP (3 << 5)
79
80#define S5P64X0_SLEEP_CFG_OSC_EN (1 << 0)
81
82#define S5P64X0_PWR_STABLE_PWR_CNT_VAL4 (4 << 0)
83
84#define S5P6450_OTHERS_DISABLE_INT (1 << 31)
85#define S5P64X0_OTHERS_RET_UART (1 << 26)
86#define S5P64X0_OTHERS_RET_MMC1 (1 << 25)
87#define S5P64X0_OTHERS_RET_MMC0 (1 << 24)
88#define S5P64X0_OTHERS_USB_SIG_MASK (1 << 16)
89
90/* Compatibility defines */
91
92#define ARM_CLK_DIV S5P64X0_CLK_DIV0
93#define ARM_DIV_RATIO_SHIFT 0
94#define ARM_DIV_MASK (0xF << ARM_DIV_RATIO_SHIFT)
95
96#define S5P_EPLL_CON S5P64X0_EPLL_CON
97
98#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
deleted file mode 100644
index cfdfa4fdadf2..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - GPIO register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_GPIO_H
14#define __ASM_ARCH_REGS_GPIO_H __FILE__
15
16#include <mach/map.h>
17
18/* Base addresses for each of the banks */
19
20#define S5P64X0_GPA_BASE (S5P_VA_GPIO + 0x0000)
21#define S5P64X0_GPB_BASE (S5P_VA_GPIO + 0x0020)
22#define S5P64X0_GPC_BASE (S5P_VA_GPIO + 0x0040)
23#define S5P64X0_GPF_BASE (S5P_VA_GPIO + 0x00A0)
24#define S5P64X0_GPG_BASE (S5P_VA_GPIO + 0x00C0)
25#define S5P64X0_GPH_BASE (S5P_VA_GPIO + 0x00E0)
26#define S5P64X0_GPI_BASE (S5P_VA_GPIO + 0x0100)
27#define S5P64X0_GPJ_BASE (S5P_VA_GPIO + 0x0120)
28#define S5P64X0_GPN_BASE (S5P_VA_GPIO + 0x0830)
29#define S5P64X0_GPP_BASE (S5P_VA_GPIO + 0x0160)
30#define S5P64X0_GPR_BASE (S5P_VA_GPIO + 0x0290)
31
32#define S5P6450_GPD_BASE (S5P_VA_GPIO + 0x0060)
33#define S5P6450_GPK_BASE (S5P_VA_GPIO + 0x0140)
34#define S5P6450_GPQ_BASE (S5P_VA_GPIO + 0x0180)
35#define S5P6450_GPS_BASE (S5P_VA_GPIO + 0x0300)
36
37#define S5P64X0_SPCON0 (S5P_VA_GPIO + 0x1A0)
38#define S5P64X0_SPCON0_LCD_SEL_MASK (0x3 << 0)
39#define S5P64X0_SPCON0_LCD_SEL_RGB (0x1 << 0)
40#define S5P64X0_SPCON1 (S5P_VA_GPIO + 0x2B0)
41
42#define S5P64X0_MEM0CONSLP0 (S5P_VA_GPIO + 0x1C0)
43#define S5P64X0_MEM0CONSLP1 (S5P_VA_GPIO + 0x1C4)
44#define S5P64X0_MEM0DRVCON (S5P_VA_GPIO + 0x1D0)
45#define S5P64X0_MEM1DRVCON (S5P_VA_GPIO + 0x1D4)
46
47#define S5P64X0_EINT12CON (S5P_VA_GPIO + 0x200)
48#define S5P64X0_EINT12FLTCON (S5P_VA_GPIO + 0x220)
49#define S5P64X0_EINT12MASK (S5P_VA_GPIO + 0x240)
50
51/* External interrupt control registers for group0 */
52
53#define EINT0CON0_OFFSET (0x900)
54#define EINT0FLTCON0_OFFSET (0x910)
55#define EINT0FLTCON1_OFFSET (0x914)
56#define EINT0MASK_OFFSET (0x920)
57#define EINT0PEND_OFFSET (0x924)
58
59#define S5P64X0_EINT0CON0 (S5P_VA_GPIO + EINT0CON0_OFFSET)
60#define S5P64X0_EINT0FLTCON0 (S5P_VA_GPIO + EINT0FLTCON0_OFFSET)
61#define S5P64X0_EINT0FLTCON1 (S5P_VA_GPIO + EINT0FLTCON1_OFFSET)
62#define S5P64X0_EINT0MASK (S5P_VA_GPIO + EINT0MASK_OFFSET)
63#define S5P64X0_EINT0PEND (S5P_VA_GPIO + EINT0PEND_OFFSET)
64
65#define S5P64X0_SLPEN (S5P_VA_GPIO + 0x930)
66#define S5P64X0_SLPEN_USE_xSLP (1 << 0)
67
68#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-irq.h b/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
deleted file mode 100644
index d60397d1ff40..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17
18#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5p64x0/irq-pm.c b/arch/arm/mach-s5p64x0/irq-pm.c
deleted file mode 100644
index 2ed921e095dc..000000000000
--- a/arch/arm/mach-s5p64x0/irq-pm.c
+++ /dev/null
@@ -1,98 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/irq-pm.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 - Interrupt handling Power Management
7 *
8 * Based on arch/arm/mach-s3c64xx/irq-pm.c by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/syscore_ops.h>
16#include <linux/serial_core.h>
17#include <linux/serial_s3c.h>
18#include <linux/io.h>
19
20#include <plat/pm.h>
21
22#include <mach/regs-gpio.h>
23
24static struct sleep_save irq_save[] = {
25 SAVE_ITEM(S5P64X0_EINT0CON0),
26 SAVE_ITEM(S5P64X0_EINT0FLTCON0),
27 SAVE_ITEM(S5P64X0_EINT0FLTCON1),
28 SAVE_ITEM(S5P64X0_EINT0MASK),
29};
30
31static struct irq_grp_save {
32 u32 con;
33 u32 fltcon;
34 u32 mask;
35} eint_grp_save[4];
36
37#ifdef CONFIG_SERIAL_SAMSUNG
38static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS];
39#endif
40
41static int s5p64x0_irq_pm_suspend(void)
42{
43 struct irq_grp_save *grp = eint_grp_save;
44 int i;
45
46 S3C_PMDBG("%s: suspending IRQs\n", __func__);
47
48 s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
49
50#ifdef CONFIG_SERIAL_SAMSUNG
51 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)
52 irq_uart_mask[i] = __raw_readl(S3C_VA_UARTx(i) + S3C64XX_UINTM);
53#endif
54
55 for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
56 grp->con = __raw_readl(S5P64X0_EINT12CON + (i * 4));
57 grp->mask = __raw_readl(S5P64X0_EINT12MASK + (i * 4));
58 grp->fltcon = __raw_readl(S5P64X0_EINT12FLTCON + (i * 4));
59 }
60
61 return 0;
62}
63
64static void s5p64x0_irq_pm_resume(void)
65{
66 struct irq_grp_save *grp = eint_grp_save;
67 int i;
68
69 S3C_PMDBG("%s: resuming IRQs\n", __func__);
70
71 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
72
73#ifdef CONFIG_SERIAL_SAMSUNG
74 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)
75 __raw_writel(irq_uart_mask[i], S3C_VA_UARTx(i) + S3C64XX_UINTM);
76#endif
77
78 for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
79 __raw_writel(grp->con, S5P64X0_EINT12CON + (i * 4));
80 __raw_writel(grp->mask, S5P64X0_EINT12MASK + (i * 4));
81 __raw_writel(grp->fltcon, S5P64X0_EINT12FLTCON + (i * 4));
82 }
83
84 S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
85}
86
87static struct syscore_ops s5p64x0_irq_syscore_ops = {
88 .suspend = s5p64x0_irq_pm_suspend,
89 .resume = s5p64x0_irq_pm_resume,
90};
91
92static int __init s5p64x0_syscore_init(void)
93{
94 register_syscore_ops(&s5p64x0_irq_syscore_ops);
95
96 return 0;
97}
98core_initcall(s5p64x0_syscore_init);
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
deleted file mode 100644
index 6840e197cb2d..000000000000
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ /dev/null
@@ -1,280 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/serial_s3c.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/clk.h>
25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h>
27#include <linux/fb.h>
28#include <linux/mmc/host.h>
29
30#include <video/platform_lcd.h>
31#include <video/samsung_fimd.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <mach/hardware.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/gpio-cfg.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/cpu.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <plat/pll.h>
49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/samsung-time.h>
52#include <plat/backlight.h>
53#include <plat/fb.h>
54#include <plat/sdhci.h>
55
56#include "common.h"
57#include "i2c.h"
58
59#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_TXTRIG16 | \
70 S3C2410_UFCON_RXTRIG8)
71
72static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDK6440_UCON_DEFAULT,
77 .ulcon = SMDK6440_ULCON_DEFAULT,
78 .ufcon = SMDK6440_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDK6440_UCON_DEFAULT,
84 .ulcon = SMDK6440_ULCON_DEFAULT,
85 .ufcon = SMDK6440_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDK6440_UCON_DEFAULT,
91 .ulcon = SMDK6440_ULCON_DEFAULT,
92 .ufcon = SMDK6440_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDK6440_UCON_DEFAULT,
98 .ulcon = SMDK6440_ULCON_DEFAULT,
99 .ufcon = SMDK6440_UFCON_DEFAULT,
100 },
101};
102
103/* Frame Buffer */
104static struct s3c_fb_pd_win smdk6440_fb_win0 = {
105 .max_bpp = 32,
106 .default_bpp = 24,
107 .xres = 800,
108 .yres = 480,
109};
110
111static struct fb_videomode smdk6440_lcd_timing = {
112 .left_margin = 8,
113 .right_margin = 13,
114 .upper_margin = 7,
115 .lower_margin = 5,
116 .hsync_len = 3,
117 .vsync_len = 1,
118 .xres = 800,
119 .yres = 480,
120};
121
122static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = {
123 .win[0] = &smdk6440_fb_win0,
124 .vtiming = &smdk6440_lcd_timing,
125 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
126 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
127 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
128};
129
130/* LCD power controller */
131static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd,
132 unsigned int power)
133{
134 int err;
135
136 if (power) {
137 err = gpio_request(S5P6440_GPN(5), "GPN");
138 if (err) {
139 printk(KERN_ERR "failed to request GPN for lcd reset\n");
140 return;
141 }
142
143 gpio_direction_output(S5P6440_GPN(5), 1);
144 gpio_set_value(S5P6440_GPN(5), 0);
145 gpio_set_value(S5P6440_GPN(5), 1);
146 gpio_free(S5P6440_GPN(5));
147 }
148}
149
150static struct plat_lcd_data smdk6440_lcd_power_data = {
151 .set_power = smdk6440_lte480_reset_power,
152};
153
154static struct platform_device smdk6440_lcd_lte480wv = {
155 .name = "platform-lcd",
156 .dev.parent = &s3c_device_fb.dev,
157 .dev.platform_data = &smdk6440_lcd_power_data,
158};
159
160static struct platform_device *smdk6440_devices[] __initdata = {
161 &s3c_device_adc,
162 &s3c_device_rtc,
163 &s3c_device_i2c0,
164 &s3c_device_i2c1,
165 &samsung_device_pwm,
166 &s3c_device_ts,
167 &s3c_device_wdt,
168 &s5p6440_device_iis,
169 &s3c_device_fb,
170 &smdk6440_lcd_lte480wv,
171 &s3c_device_hsmmc0,
172 &s3c_device_hsmmc1,
173 &s3c_device_hsmmc2,
174};
175
176static struct s3c_sdhci_platdata smdk6440_hsmmc0_pdata __initdata = {
177 .cd_type = S3C_SDHCI_CD_NONE,
178};
179
180static struct s3c_sdhci_platdata smdk6440_hsmmc1_pdata __initdata = {
181 .cd_type = S3C_SDHCI_CD_INTERNAL,
182#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
183 .max_width = 8,
184 .host_caps = MMC_CAP_8_BIT_DATA,
185#endif
186};
187
188static struct s3c_sdhci_platdata smdk6440_hsmmc2_pdata __initdata = {
189 .cd_type = S3C_SDHCI_CD_NONE,
190};
191
192static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
193 .flags = 0,
194 .slave_addr = 0x10,
195 .frequency = 100*1000,
196 .sda_delay = 100,
197 .cfg_gpio = s5p6440_i2c0_cfg_gpio,
198};
199
200static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
201 .flags = 0,
202 .bus_num = 1,
203 .slave_addr = 0x10,
204 .frequency = 100*1000,
205 .sda_delay = 100,
206 .cfg_gpio = s5p6440_i2c1_cfg_gpio,
207};
208
209static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
210 { I2C_BOARD_INFO("24c08", 0x50), },
211 { I2C_BOARD_INFO("wm8580", 0x1b), },
212};
213
214static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
215 /* To be populated */
216};
217
218/* LCD Backlight data */
219static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
220 .no = S5P6440_GPF(15),
221 .func = S3C_GPIO_SFN(2),
222};
223
224static struct platform_pwm_backlight_data smdk6440_bl_data = {
225 .pwm_id = 1,
226 .enable_gpio = -1,
227};
228
229static void __init smdk6440_map_io(void)
230{
231 s5p64x0_init_io(NULL, 0);
232 s3c24xx_init_clocks(12000000);
233 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
234 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
235}
236
237static void s5p6440_set_lcd_interface(void)
238{
239 unsigned int cfg;
240
241 /* select TFT LCD type (RGB I/F) */
242 cfg = __raw_readl(S5P64X0_SPCON0);
243 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
244 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
245 __raw_writel(cfg, S5P64X0_SPCON0);
246}
247
248static void __init smdk6440_machine_init(void)
249{
250 s3c24xx_ts_set_platdata(NULL);
251
252 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
253 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
254 i2c_register_board_info(0, smdk6440_i2c_devs0,
255 ARRAY_SIZE(smdk6440_i2c_devs0));
256 i2c_register_board_info(1, smdk6440_i2c_devs1,
257 ARRAY_SIZE(smdk6440_i2c_devs1));
258
259 s5p6440_set_lcd_interface();
260 s3c_fb_set_platdata(&smdk6440_lcd_pdata);
261
262 s3c_sdhci0_set_platdata(&smdk6440_hsmmc0_pdata);
263 s3c_sdhci1_set_platdata(&smdk6440_hsmmc1_pdata);
264 s3c_sdhci2_set_platdata(&smdk6440_hsmmc2_pdata);
265
266 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
267
268 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
269}
270
271MACHINE_START(SMDK6440, "SMDK6440")
272 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
273 .atag_offset = 0x100,
274
275 .init_irq = s5p6440_init_irq,
276 .map_io = smdk6440_map_io,
277 .init_machine = smdk6440_machine_init,
278 .init_time = samsung_timer_init,
279 .restart = s5p64x0_restart,
280MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
deleted file mode 100644
index fa1341c074ca..000000000000
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ /dev/null
@@ -1,299 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/serial_s3c.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/clk.h>
25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h>
27#include <linux/fb.h>
28#include <linux/mmc/host.h>
29
30#include <video/platform_lcd.h>
31#include <video/samsung_fimd.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <mach/hardware.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/gpio-cfg.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/cpu.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <plat/pll.h>
49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/samsung-time.h>
52#include <plat/backlight.h>
53#include <plat/fb.h>
54#include <plat/sdhci.h>
55
56#include "common.h"
57#include "i2c.h"
58
59#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_TXTRIG16 | \
70 S3C2410_UFCON_RXTRIG8)
71
72static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDK6450_UCON_DEFAULT,
77 .ulcon = SMDK6450_ULCON_DEFAULT,
78 .ufcon = SMDK6450_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDK6450_UCON_DEFAULT,
84 .ulcon = SMDK6450_ULCON_DEFAULT,
85 .ufcon = SMDK6450_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDK6450_UCON_DEFAULT,
91 .ulcon = SMDK6450_ULCON_DEFAULT,
92 .ufcon = SMDK6450_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDK6450_UCON_DEFAULT,
98 .ulcon = SMDK6450_ULCON_DEFAULT,
99 .ufcon = SMDK6450_UFCON_DEFAULT,
100 },
101#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
102 [4] = {
103 .hwport = 4,
104 .flags = 0,
105 .ucon = SMDK6450_UCON_DEFAULT,
106 .ulcon = SMDK6450_ULCON_DEFAULT,
107 .ufcon = SMDK6450_UFCON_DEFAULT,
108 },
109#endif
110#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
111 [5] = {
112 .hwport = 5,
113 .flags = 0,
114 .ucon = SMDK6450_UCON_DEFAULT,
115 .ulcon = SMDK6450_ULCON_DEFAULT,
116 .ufcon = SMDK6450_UFCON_DEFAULT,
117 },
118#endif
119};
120
121/* Frame Buffer */
122static struct s3c_fb_pd_win smdk6450_fb_win0 = {
123 .max_bpp = 32,
124 .default_bpp = 24,
125 .xres = 800,
126 .yres = 480,
127};
128
129static struct fb_videomode smdk6450_lcd_timing = {
130 .left_margin = 8,
131 .right_margin = 13,
132 .upper_margin = 7,
133 .lower_margin = 5,
134 .hsync_len = 3,
135 .vsync_len = 1,
136 .xres = 800,
137 .yres = 480,
138};
139
140static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
141 .win[0] = &smdk6450_fb_win0,
142 .vtiming = &smdk6450_lcd_timing,
143 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
144 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
145 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
146};
147
148/* LCD power controller */
149static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
150 unsigned int power)
151{
152 int err;
153
154 if (power) {
155 err = gpio_request(S5P6450_GPN(5), "GPN");
156 if (err) {
157 printk(KERN_ERR "failed to request GPN for lcd reset\n");
158 return;
159 }
160
161 gpio_direction_output(S5P6450_GPN(5), 1);
162 gpio_set_value(S5P6450_GPN(5), 0);
163 gpio_set_value(S5P6450_GPN(5), 1);
164 gpio_free(S5P6450_GPN(5));
165 }
166}
167
168static struct plat_lcd_data smdk6450_lcd_power_data = {
169 .set_power = smdk6450_lte480_reset_power,
170};
171
172static struct platform_device smdk6450_lcd_lte480wv = {
173 .name = "platform-lcd",
174 .dev.parent = &s3c_device_fb.dev,
175 .dev.platform_data = &smdk6450_lcd_power_data,
176};
177
178static struct platform_device *smdk6450_devices[] __initdata = {
179 &s3c_device_adc,
180 &s3c_device_rtc,
181 &s3c_device_i2c0,
182 &s3c_device_i2c1,
183 &samsung_device_pwm,
184 &s3c_device_ts,
185 &s3c_device_wdt,
186 &s5p6450_device_iis0,
187 &s3c_device_fb,
188 &smdk6450_lcd_lte480wv,
189 &s3c_device_hsmmc0,
190 &s3c_device_hsmmc1,
191 &s3c_device_hsmmc2,
192 /* s5p6450_device_spi0 will be added */
193};
194
195static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = {
196 .cd_type = S3C_SDHCI_CD_NONE,
197};
198
199static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = {
200 .cd_type = S3C_SDHCI_CD_NONE,
201#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
202 .max_width = 8,
203 .host_caps = MMC_CAP_8_BIT_DATA,
204#endif
205};
206
207static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = {
208 .cd_type = S3C_SDHCI_CD_NONE,
209};
210
211static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
212 .flags = 0,
213 .slave_addr = 0x10,
214 .frequency = 100*1000,
215 .sda_delay = 100,
216 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
217};
218
219static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
220 .flags = 0,
221 .bus_num = 1,
222 .slave_addr = 0x10,
223 .frequency = 100*1000,
224 .sda_delay = 100,
225 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
226};
227
228static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
229 { I2C_BOARD_INFO("wm8580", 0x1b), },
230 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
231};
232
233static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
234 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
235};
236
237/* LCD Backlight data */
238static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
239 .no = S5P6450_GPF(15),
240 .func = S3C_GPIO_SFN(2),
241};
242
243static struct platform_pwm_backlight_data smdk6450_bl_data = {
244 .pwm_id = 1,
245 .enable_gpio = -1,
246};
247
248static void __init smdk6450_map_io(void)
249{
250 s5p64x0_init_io(NULL, 0);
251 s3c24xx_init_clocks(19200000);
252 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
253 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
254}
255
256static void s5p6450_set_lcd_interface(void)
257{
258 unsigned int cfg;
259
260 /* select TFT LCD type (RGB I/F) */
261 cfg = __raw_readl(S5P64X0_SPCON0);
262 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
263 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
264 __raw_writel(cfg, S5P64X0_SPCON0);
265}
266
267static void __init smdk6450_machine_init(void)
268{
269 s3c24xx_ts_set_platdata(NULL);
270
271 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
272 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
273 i2c_register_board_info(0, smdk6450_i2c_devs0,
274 ARRAY_SIZE(smdk6450_i2c_devs0));
275 i2c_register_board_info(1, smdk6450_i2c_devs1,
276 ARRAY_SIZE(smdk6450_i2c_devs1));
277
278 s5p6450_set_lcd_interface();
279 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
280
281 s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata);
282 s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata);
283 s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata);
284
285 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
286
287 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
288}
289
290MACHINE_START(SMDK6450, "SMDK6450")
291 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
292 .atag_offset = 0x100,
293
294 .init_irq = s5p6450_init_irq,
295 .map_io = smdk6450_map_io,
296 .init_machine = smdk6450_machine_init,
297 .init_time = samsung_timer_init,
298 .restart = s5p64x0_restart,
299MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/pm.c b/arch/arm/mach-s5p64x0/pm.c
deleted file mode 100644
index ec8229cee716..000000000000
--- a/arch/arm/mach-s5p64x0/pm.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/pm.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P64X0 Power Management Support
7 *
8 * Based on arch/arm/mach-s3c64xx/pm.c by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/suspend.h>
16#include <linux/syscore_ops.h>
17#include <linux/io.h>
18
19#include <plat/cpu.h>
20#include <plat/pm.h>
21#include <plat/wakeup-mask.h>
22
23#include <mach/regs-clock.h>
24#include <mach/regs-gpio.h>
25
26static struct sleep_save s5p64x0_core_save[] = {
27 SAVE_ITEM(S5P64X0_APLL_CON),
28 SAVE_ITEM(S5P64X0_MPLL_CON),
29 SAVE_ITEM(S5P64X0_EPLL_CON),
30 SAVE_ITEM(S5P64X0_EPLL_CON_K),
31 SAVE_ITEM(S5P64X0_CLK_SRC0),
32 SAVE_ITEM(S5P64X0_CLK_SRC1),
33 SAVE_ITEM(S5P64X0_CLK_DIV0),
34 SAVE_ITEM(S5P64X0_CLK_DIV1),
35 SAVE_ITEM(S5P64X0_CLK_DIV2),
36 SAVE_ITEM(S5P64X0_CLK_DIV3),
37 SAVE_ITEM(S5P64X0_CLK_GATE_MEM0),
38 SAVE_ITEM(S5P64X0_CLK_GATE_HCLK1),
39 SAVE_ITEM(S5P64X0_CLK_GATE_SCLK1),
40};
41
42static struct sleep_save s5p64x0_misc_save[] = {
43 SAVE_ITEM(S5P64X0_AHB_CON0),
44 SAVE_ITEM(S5P64X0_SPCON0),
45 SAVE_ITEM(S5P64X0_SPCON1),
46 SAVE_ITEM(S5P64X0_MEM0CONSLP0),
47 SAVE_ITEM(S5P64X0_MEM0CONSLP1),
48 SAVE_ITEM(S5P64X0_MEM0DRVCON),
49 SAVE_ITEM(S5P64X0_MEM1DRVCON),
50};
51
52/* DPLL is present only in S5P6450 */
53static struct sleep_save s5p6450_core_save[] = {
54 SAVE_ITEM(S5P6450_DPLL_CON),
55 SAVE_ITEM(S5P6450_DPLL_CON_K),
56};
57
58void s3c_pm_configure_extint(void)
59{
60 __raw_writel(s3c_irqwake_eintmask, S5P64X0_EINT_WAKEUP_MASK);
61}
62
63void s3c_pm_restore_core(void)
64{
65 __raw_writel(0, S5P64X0_EINT_WAKEUP_MASK);
66
67 s3c_pm_do_restore_core(s5p64x0_core_save,
68 ARRAY_SIZE(s5p64x0_core_save));
69
70 if (soc_is_s5p6450())
71 s3c_pm_do_restore_core(s5p6450_core_save,
72 ARRAY_SIZE(s5p6450_core_save));
73
74 s3c_pm_do_restore(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
75}
76
77void s3c_pm_save_core(void)
78{
79 s3c_pm_do_save(s5p64x0_misc_save, ARRAY_SIZE(s5p64x0_misc_save));
80
81 if (soc_is_s5p6450())
82 s3c_pm_do_save(s5p6450_core_save,
83 ARRAY_SIZE(s5p6450_core_save));
84
85 s3c_pm_do_save(s5p64x0_core_save, ARRAY_SIZE(s5p64x0_core_save));
86}
87
88static int s5p64x0_cpu_suspend(unsigned long arg)
89{
90 unsigned long tmp = 0;
91
92 /*
93 * Issue the standby signal into the pm unit. Note, we
94 * issue a write-buffer drain just in case.
95 */
96 asm("b 1f\n\t"
97 ".align 5\n\t"
98 "1:\n\t"
99 "mcr p15, 0, %0, c7, c10, 5\n\t"
100 "mcr p15, 0, %0, c7, c10, 4\n\t"
101 "mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));
102
103 pr_info("Failed to suspend the system\n");
104 return 1; /* Aborting suspend */
105}
106
107/* mapping of interrupts to parts of the wakeup mask */
108static struct samsung_wakeup_mask s5p64x0_wake_irqs[] = {
109 { .irq = IRQ_RTC_ALARM, .bit = S5P64X0_PWR_CFG_RTC_ALRM_DISABLE, },
110 { .irq = IRQ_RTC_TIC, .bit = S5P64X0_PWR_CFG_RTC_TICK_DISABLE, },
111 { .irq = IRQ_HSMMC0, .bit = S5P64X0_PWR_CFG_MMC0_DISABLE, },
112 { .irq = IRQ_HSMMC1, .bit = S5P64X0_PWR_CFG_MMC1_DISABLE, },
113};
114
115static void s5p64x0_pm_prepare(void)
116{
117 u32 tmp;
118
119 samsung_sync_wakemask(S5P64X0_PWR_CFG,
120 s5p64x0_wake_irqs, ARRAY_SIZE(s5p64x0_wake_irqs));
121
122 /* store the resume address in INFORM0 register */
123 __raw_writel(virt_to_phys(s3c_cpu_resume), S5P64X0_INFORM0);
124
125 /* setup clock gating for FIMGVG block */
126 __raw_writel((__raw_readl(S5P64X0_CLK_GATE_HCLK1) | \
127 (S5P64X0_CLK_GATE_HCLK1_FIMGVG)), S5P64X0_CLK_GATE_HCLK1);
128 __raw_writel((__raw_readl(S5P64X0_CLK_GATE_SCLK1) | \
129 (S5P64X0_CLK_GATE_SCLK1_FIMGVG)), S5P64X0_CLK_GATE_SCLK1);
130
131 /* Configure the stabilization counter with wait time required */
132 __raw_writel(S5P64X0_PWR_STABLE_PWR_CNT_VAL4, S5P64X0_PWR_STABLE);
133
134 /* set WFI to SLEEP mode configuration */
135 tmp = __raw_readl(S5P64X0_SLEEP_CFG);
136 tmp &= ~(S5P64X0_SLEEP_CFG_OSC_EN);
137 __raw_writel(tmp, S5P64X0_SLEEP_CFG);
138
139 tmp = __raw_readl(S5P64X0_PWR_CFG);
140 tmp &= ~(S5P64X0_PWR_CFG_WFI_MASK);
141 tmp |= S5P64X0_PWR_CFG_WFI_SLEEP;
142 __raw_writel(tmp, S5P64X0_PWR_CFG);
143
144 /*
145 * set OTHERS register to disable interrupt before going to
146 * sleep. This bit is present only in S5P6450, it is reserved
147 * in S5P6440.
148 */
149 if (soc_is_s5p6450()) {
150 tmp = __raw_readl(S5P64X0_OTHERS);
151 tmp |= S5P6450_OTHERS_DISABLE_INT;
152 __raw_writel(tmp, S5P64X0_OTHERS);
153 }
154
155 /* ensure previous wakeup state is cleared before sleeping */
156 __raw_writel(__raw_readl(S5P64X0_WAKEUP_STAT), S5P64X0_WAKEUP_STAT);
157
158}
159
160static int s5p64x0_pm_add(struct device *dev, struct subsys_interface *sif)
161{
162 pm_cpu_prep = s5p64x0_pm_prepare;
163 pm_cpu_sleep = s5p64x0_cpu_suspend;
164
165 return 0;
166}
167
168static struct subsys_interface s5p64x0_pm_interface = {
169 .name = "s5p64x0_pm",
170 .subsys = &s5p64x0_subsys,
171 .add_dev = s5p64x0_pm_add,
172};
173
174static __init int s5p64x0_pm_drvinit(void)
175{
176 s3c_pm_init();
177
178 return subsys_interface_register(&s5p64x0_pm_interface);
179}
180arch_initcall(s5p64x0_pm_drvinit);
181
182static void s5p64x0_pm_resume(void)
183{
184 u32 tmp;
185
186 tmp = __raw_readl(S5P64X0_OTHERS);
187 tmp |= (S5P64X0_OTHERS_RET_MMC0 | S5P64X0_OTHERS_RET_MMC1 | \
188 S5P64X0_OTHERS_RET_UART);
189 __raw_writel(tmp , S5P64X0_OTHERS);
190}
191
192static struct syscore_ops s5p64x0_pm_syscore_ops = {
193 .resume = s5p64x0_pm_resume,
194};
195
196static __init int s5p64x0_pm_syscore_init(void)
197{
198 register_syscore_ops(&s5p64x0_pm_syscore_ops);
199
200 return 0;
201}
202arch_initcall(s5p64x0_pm_syscore_init);
diff --git a/arch/arm/mach-s5p64x0/setup-fb-24bpp.c b/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
deleted file mode 100644
index f346ee4af54d..000000000000
--- a/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-fb-24bpp.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Base S5P64X0 GPIO setup information for LCD framebuffer
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/fb.h>
14#include <linux/gpio.h>
15
16#include <plat/cpu.h>
17#include <plat/fb.h>
18#include <plat/gpio-cfg.h>
19
20void s5p64x0_fb_gpio_setup_24bpp(void)
21{
22 if (soc_is_s5p6440()) {
23 s3c_gpio_cfgrange_nopull(S5P6440_GPI(0), 16, S3C_GPIO_SFN(2));
24 s3c_gpio_cfgrange_nopull(S5P6440_GPJ(0), 12, S3C_GPIO_SFN(2));
25 } else if (soc_is_s5p6450()) {
26 s3c_gpio_cfgrange_nopull(S5P6450_GPI(0), 16, S3C_GPIO_SFN(2));
27 s3c_gpio_cfgrange_nopull(S5P6450_GPJ(0), 12, S3C_GPIO_SFN(2));
28 }
29}
diff --git a/arch/arm/mach-s5p64x0/setup-i2c0.c b/arch/arm/mach-s5p64x0/setup-i2c0.c
deleted file mode 100644
index 569b76ac98cb..000000000000
--- a/arch/arm/mach-s5p64x0/setup-i2c0.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-i2c0.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * I2C0 GPIO configuration.
7 *
8 * Based on plat-s3c64x0/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <plat/gpio-cfg.h>
22#include <linux/platform_data/i2c-s3c2410.h>
23
24#include "i2c.h"
25
26void s5p6440_i2c0_cfg_gpio(struct platform_device *dev)
27{
28 s3c_gpio_cfgall_range(S5P6440_GPB(5), 2,
29 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
30}
31
32void s5p6450_i2c0_cfg_gpio(struct platform_device *dev)
33{
34 s3c_gpio_cfgall_range(S5P6450_GPB(5), 2,
35 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
36}
37
38void s3c_i2c0_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p64x0/setup-i2c1.c b/arch/arm/mach-s5p64x0/setup-i2c1.c
deleted file mode 100644
index 867374e6d0bc..000000000000
--- a/arch/arm/mach-s5p64x0/setup-i2c1.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64xx/setup-i2c1.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * I2C1 GPIO configuration.
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <plat/gpio-cfg.h>
22#include <linux/platform_data/i2c-s3c2410.h>
23
24#include "i2c.h"
25
26void s5p6440_i2c1_cfg_gpio(struct platform_device *dev)
27{
28 s3c_gpio_cfgall_range(S5P6440_GPR(9), 2,
29 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
30}
31
32void s5p6450_i2c1_cfg_gpio(struct platform_device *dev)
33{
34 s3c_gpio_cfgall_range(S5P6450_GPR(9), 2,
35 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
36}
37
38void s3c_i2c1_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
deleted file mode 100644
index 8410af0d12bf..000000000000
--- a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P64X0 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/platform_device.h>
14#include <linux/io.h>
15#include <linux/gpio.h>
16
17#include <mach/regs-gpio.h>
18#include <mach/regs-clock.h>
19
20#include <plat/gpio-cfg.h>
21#include <plat/sdhci.h>
22#include <plat/cpu.h>
23
24void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{
26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27
28 /* Set all the necessary GPG pins to special-function 2 */
29 if (soc_is_s5p6450())
30 s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width,
31 S3C_GPIO_SFN(2));
32 else
33 s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width,
34 S3C_GPIO_SFN(2));
35
36 /* Set GPG[6] pin to special-function 2 - MMC0 CDn */
37 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
38 if (soc_is_s5p6450()) {
39 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
40 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
41 } else {
42 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
43 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
44 }
45 }
46}
47
48void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
49{
50 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
51
52 /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
53 if (soc_is_s5p6450())
54 s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
55 else
56 s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
57
58 switch (width) {
59 case 8:
60 /* Set data pins GPH[6:9] special-function 2 */
61 if (soc_is_s5p6450())
62 s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
63 S3C_GPIO_SFN(2));
64 else
65 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
66 S3C_GPIO_SFN(2));
67 case 4:
68 /* set data pins GPH[2:5] special-function 2 */
69 if (soc_is_s5p6450())
70 s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
71 S3C_GPIO_SFN(2));
72 else
73 s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
74 S3C_GPIO_SFN(2));
75 default:
76 break;
77 }
78
79 /* Set GPG[6] pin to special-funtion 3 : MMC1 CDn */
80 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
81 if (soc_is_s5p6450()) {
82 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
83 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
84 } else {
85 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
86 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
87 }
88 }
89}
90
91void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
92{
93 /* Set GPC[4:5] pins to special-function 3 - CLK and CMD */
94 s3c_gpio_cfgrange_nopull(S5P6440_GPC(4), 2, S3C_GPIO_SFN(3));
95
96 /* Set data pins GPH[6:9] pins to special-function 3 */
97 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4, S3C_GPIO_SFN(3));
98}
99
100void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
101{
102 /* Set all the necessary GPG pins to special-function 3 */
103 s3c_gpio_cfgrange_nopull(S5P6450_GPG(7), 2 + width, S3C_GPIO_SFN(3));
104}
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
deleted file mode 100644
index 7664356720ca..000000000000
--- a/arch/arm/mach-s5p64x0/setup-spi.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void)
16{
17 if (soc_is_s5p6450())
18 s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
19 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
20 else
21 s3c_gpio_cfgall_range(S5P6440_GPC(0), 3,
22 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
23 return 0;
24}
25#endif
26
27#ifdef CONFIG_S3C64XX_DEV_SPI1
28int s3c64xx_spi1_cfg_gpio(void)
29{
30 if (soc_is_s5p6450())
31 s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
32 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
33 else
34 s3c_gpio_cfgall_range(S5P6440_GPC(4), 3,
35 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
36 return 0;
37}
38#endif
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
deleted file mode 100644
index c5e3a969b063..000000000000
--- a/arch/arm/mach-s5pc100/Kconfig
+++ /dev/null
@@ -1,81 +0,0 @@
1# Copyright 2009 Samsung Electronics Co.
2# Byungho Min <bhmin@samsung.com>
3#
4# Licensed under GPLv2
5
6# Configuration options for the S5PC100 CPU
7
8if ARCH_S5PC100
9
10config CPU_S5PC100
11 bool
12 select ARM_AMBA
13 select PL330_DMA if DMADEVICES
14 select S5P_EXT_INT
15 help
16 Enable S5PC100 CPU support
17
18config S5PC100_SETUP_FB_24BPP
19 bool
20 help
21 Common setup code for S5PC1XX with an 24bpp RGB display helper.
22
23config S5PC100_SETUP_I2C1
24 bool
25 help
26 Common setup code for i2c bus 1.
27
28config S5PC100_SETUP_IDE
29 bool
30 help
31 Common setup code for S5PC100 IDE GPIO configurations
32
33config S5PC100_SETUP_KEYPAD
34 bool
35 help
36 Common setup code for KEYPAD GPIO configurations.
37
38config S5PC100_SETUP_SDHCI
39 bool
40 select S5PC100_SETUP_SDHCI_GPIO
41 help
42 Internal helper functions for S5PC100 based SDHCI systems
43
44config S5PC100_SETUP_SDHCI_GPIO
45 bool
46 help
47 Common setup code for SDHCI gpio.
48
49config S5PC100_SETUP_SPI
50 bool
51 help
52 Common setup code for SPI GPIO configurations.
53
54config MACH_SMDKC100
55 bool "SMDKC100"
56 select CPU_S5PC100
57 select S3C_DEV_FB
58 select S3C_DEV_HSMMC
59 select S3C_DEV_HSMMC1
60 select S3C_DEV_HSMMC2
61 select S3C_DEV_I2C1
62 select S3C_DEV_RTC
63 select S3C_DEV_WDT
64 select S5PC100_SETUP_FB_24BPP
65 select S5PC100_SETUP_I2C1
66 select S5PC100_SETUP_IDE
67 select S5PC100_SETUP_KEYPAD
68 select S5PC100_SETUP_SDHCI
69 select S5P_DEV_FIMC0
70 select S5P_DEV_FIMC1
71 select S5P_DEV_FIMC2
72 select SAMSUNG_DEV_ADC
73 select SAMSUNG_DEV_BACKLIGHT
74 select SAMSUNG_DEV_IDE
75 select SAMSUNG_DEV_KEYPAD
76 select SAMSUNG_DEV_PWM
77 select SAMSUNG_DEV_TS
78 help
79 Machine support for the Samsung SMDKC100
80
81endif
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
deleted file mode 100644
index 118c711f74e8..000000000000
--- a/arch/arm/mach-s5pc100/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
1# arch/arm/mach-s5pc100/Makefile
2#
3# Copyright 2009 Samsung Electronics Co.
4#
5# Licensed under GPLv2
6
7obj-y :=
8obj-m :=
9obj-n :=
10obj- :=
11
12# Core
13
14obj-y += common.o clock.o
15
16obj-y += dma.o
17
18# machine support
19
20obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o
21
22# device support
23
24obj-y += dev-audio.o
25
26obj-y += setup-i2c0.o
27obj-$(CONFIG_S5PC100_SETUP_FB_24BPP) += setup-fb-24bpp.o
28obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
29obj-$(CONFIG_S5PC100_SETUP_IDE) += setup-ide.o
30obj-$(CONFIG_S5PC100_SETUP_KEYPAD) += setup-keypad.o
31obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
32obj-$(CONFIG_S5PC100_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-s5pc100/Makefile.boot b/arch/arm/mach-s5pc100/Makefile.boot
deleted file mode 100644
index 79ece4055b02..000000000000
--- a/arch/arm/mach-s5pc100/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
deleted file mode 100644
index d0dc10ee7729..000000000000
--- a/arch/arm/mach-s5pc100/clock.c
+++ /dev/null
@@ -1,1361 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PC100 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20
21#include <mach/map.h>
22
23#include <plat/cpu-freq.h>
24#include <mach/regs-clock.h>
25#include <plat/clock.h>
26#include <plat/cpu.h>
27#include <plat/pll.h>
28#include <plat/s5p-clock.h>
29#include <plat/clock-clksrc.h>
30
31#include "common.h"
32
33static struct clk s5p_clk_otgphy = {
34 .name = "otg_phy",
35};
36
37static struct clk dummy_apb_pclk = {
38 .name = "apb_pclk",
39 .id = -1,
40};
41
42static struct clk *clk_src_mout_href_list[] = {
43 [0] = &s5p_clk_27m,
44 [1] = &clk_fin_hpll,
45};
46
47static struct clksrc_sources clk_src_mout_href = {
48 .sources = clk_src_mout_href_list,
49 .nr_sources = ARRAY_SIZE(clk_src_mout_href_list),
50};
51
52static struct clksrc_clk clk_mout_href = {
53 .clk = {
54 .name = "mout_href",
55 },
56 .sources = &clk_src_mout_href,
57 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
58};
59
60static struct clk *clk_src_mout_48m_list[] = {
61 [0] = &clk_xusbxti,
62 [1] = &s5p_clk_otgphy,
63};
64
65static struct clksrc_sources clk_src_mout_48m = {
66 .sources = clk_src_mout_48m_list,
67 .nr_sources = ARRAY_SIZE(clk_src_mout_48m_list),
68};
69
70static struct clksrc_clk clk_mout_48m = {
71 .clk = {
72 .name = "mout_48m",
73 },
74 .sources = &clk_src_mout_48m,
75 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 1 },
76};
77
78static struct clksrc_clk clk_mout_mpll = {
79 .clk = {
80 .name = "mout_mpll",
81 },
82 .sources = &clk_src_mpll,
83 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
84};
85
86
87static struct clksrc_clk clk_mout_apll = {
88 .clk = {
89 .name = "mout_apll",
90 },
91 .sources = &clk_src_apll,
92 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
93};
94
95static struct clksrc_clk clk_mout_epll = {
96 .clk = {
97 .name = "mout_epll",
98 },
99 .sources = &clk_src_epll,
100 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
101};
102
103static struct clk *clk_src_mout_hpll_list[] = {
104 [0] = &s5p_clk_27m,
105};
106
107static struct clksrc_sources clk_src_mout_hpll = {
108 .sources = clk_src_mout_hpll_list,
109 .nr_sources = ARRAY_SIZE(clk_src_mout_hpll_list),
110};
111
112static struct clksrc_clk clk_mout_hpll = {
113 .clk = {
114 .name = "mout_hpll",
115 },
116 .sources = &clk_src_mout_hpll,
117 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
118};
119
120static struct clksrc_clk clk_div_apll = {
121 .clk = {
122 .name = "div_apll",
123 .parent = &clk_mout_apll.clk,
124 },
125 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 1 },
126};
127
128static struct clksrc_clk clk_div_arm = {
129 .clk = {
130 .name = "div_arm",
131 .parent = &clk_div_apll.clk,
132 },
133 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
134};
135
136static struct clksrc_clk clk_div_d0_bus = {
137 .clk = {
138 .name = "div_d0_bus",
139 .parent = &clk_div_arm.clk,
140 },
141 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
142};
143
144static struct clksrc_clk clk_div_pclkd0 = {
145 .clk = {
146 .name = "div_pclkd0",
147 .parent = &clk_div_d0_bus.clk,
148 },
149 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
150};
151
152static struct clksrc_clk clk_div_secss = {
153 .clk = {
154 .name = "div_secss",
155 .parent = &clk_div_d0_bus.clk,
156 },
157 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 3 },
158};
159
160static struct clksrc_clk clk_div_apll2 = {
161 .clk = {
162 .name = "div_apll2",
163 .parent = &clk_mout_apll.clk,
164 },
165 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 3 },
166};
167
168static struct clk *clk_src_mout_am_list[] = {
169 [0] = &clk_mout_mpll.clk,
170 [1] = &clk_div_apll2.clk,
171};
172
173static struct clksrc_sources clk_src_mout_am = {
174 .sources = clk_src_mout_am_list,
175 .nr_sources = ARRAY_SIZE(clk_src_mout_am_list),
176};
177
178static struct clksrc_clk clk_mout_am = {
179 .clk = {
180 .name = "mout_am",
181 },
182 .sources = &clk_src_mout_am,
183 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
184};
185
186static struct clksrc_clk clk_div_d1_bus = {
187 .clk = {
188 .name = "div_d1_bus",
189 .parent = &clk_mout_am.clk,
190 },
191 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 3 },
192};
193
194static struct clksrc_clk clk_div_mpll2 = {
195 .clk = {
196 .name = "div_mpll2",
197 .parent = &clk_mout_am.clk,
198 },
199 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 1 },
200};
201
202static struct clksrc_clk clk_div_mpll = {
203 .clk = {
204 .name = "div_mpll",
205 .parent = &clk_mout_am.clk,
206 },
207 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 2 },
208};
209
210static struct clk *clk_src_mout_onenand_list[] = {
211 [0] = &clk_div_d0_bus.clk,
212 [1] = &clk_div_d1_bus.clk,
213};
214
215static struct clksrc_sources clk_src_mout_onenand = {
216 .sources = clk_src_mout_onenand_list,
217 .nr_sources = ARRAY_SIZE(clk_src_mout_onenand_list),
218};
219
220static struct clksrc_clk clk_mout_onenand = {
221 .clk = {
222 .name = "mout_onenand",
223 },
224 .sources = &clk_src_mout_onenand,
225 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
226};
227
228static struct clksrc_clk clk_div_onenand = {
229 .clk = {
230 .name = "div_onenand",
231 .parent = &clk_mout_onenand.clk,
232 },
233 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 2 },
234};
235
236static struct clksrc_clk clk_div_pclkd1 = {
237 .clk = {
238 .name = "div_pclkd1",
239 .parent = &clk_div_d1_bus.clk,
240 },
241 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 3 },
242};
243
244static struct clksrc_clk clk_div_cam = {
245 .clk = {
246 .name = "div_cam",
247 .parent = &clk_div_mpll2.clk,
248 },
249 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 24, .size = 5 },
250};
251
252static struct clksrc_clk clk_div_hdmi = {
253 .clk = {
254 .name = "div_hdmi",
255 .parent = &clk_mout_hpll.clk,
256 },
257 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 },
258};
259
260static u32 epll_div[][4] = {
261 { 32750000, 131, 3, 4 },
262 { 32768000, 131, 3, 4 },
263 { 36000000, 72, 3, 3 },
264 { 45000000, 90, 3, 3 },
265 { 45158000, 90, 3, 3 },
266 { 45158400, 90, 3, 3 },
267 { 48000000, 96, 3, 3 },
268 { 49125000, 131, 4, 3 },
269 { 49152000, 131, 4, 3 },
270 { 60000000, 120, 3, 3 },
271 { 67737600, 226, 5, 3 },
272 { 67738000, 226, 5, 3 },
273 { 73800000, 246, 5, 3 },
274 { 73728000, 246, 5, 3 },
275 { 72000000, 144, 3, 3 },
276 { 84000000, 168, 3, 3 },
277 { 96000000, 96, 3, 2 },
278 { 144000000, 144, 3, 2 },
279 { 192000000, 96, 3, 1 }
280};
281
282static int s5pc100_epll_set_rate(struct clk *clk, unsigned long rate)
283{
284 unsigned int epll_con;
285 unsigned int i;
286
287 if (clk->rate == rate) /* Return if nothing changed */
288 return 0;
289
290 epll_con = __raw_readl(S5P_EPLL_CON);
291
292 epll_con &= ~(PLL65XX_MDIV_MASK | PLL65XX_PDIV_MASK | PLL65XX_SDIV_MASK);
293
294 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
295 if (epll_div[i][0] == rate) {
296 epll_con |= (epll_div[i][1] << PLL65XX_MDIV_SHIFT) |
297 (epll_div[i][2] << PLL65XX_PDIV_SHIFT) |
298 (epll_div[i][3] << PLL65XX_SDIV_SHIFT);
299 break;
300 }
301 }
302
303 if (i == ARRAY_SIZE(epll_div)) {
304 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__);
305 return -EINVAL;
306 }
307
308 __raw_writel(epll_con, S5P_EPLL_CON);
309
310 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
311 clk->rate, rate);
312
313 clk->rate = rate;
314
315 return 0;
316}
317
318static struct clk_ops s5pc100_epll_ops = {
319 .get_rate = s5p_epll_get_rate,
320 .set_rate = s5pc100_epll_set_rate,
321};
322
323static int s5pc100_d0_0_ctrl(struct clk *clk, int enable)
324{
325 return s5p_gatectrl(S5P_CLKGATE_D00, clk, enable);
326}
327
328static int s5pc100_d0_1_ctrl(struct clk *clk, int enable)
329{
330 return s5p_gatectrl(S5P_CLKGATE_D01, clk, enable);
331}
332
333static int s5pc100_d0_2_ctrl(struct clk *clk, int enable)
334{
335 return s5p_gatectrl(S5P_CLKGATE_D02, clk, enable);
336}
337
338static int s5pc100_d1_0_ctrl(struct clk *clk, int enable)
339{
340 return s5p_gatectrl(S5P_CLKGATE_D10, clk, enable);
341}
342
343static int s5pc100_d1_1_ctrl(struct clk *clk, int enable)
344{
345 return s5p_gatectrl(S5P_CLKGATE_D11, clk, enable);
346}
347
348static int s5pc100_d1_2_ctrl(struct clk *clk, int enable)
349{
350 return s5p_gatectrl(S5P_CLKGATE_D12, clk, enable);
351}
352
353static int s5pc100_d1_3_ctrl(struct clk *clk, int enable)
354{
355 return s5p_gatectrl(S5P_CLKGATE_D13, clk, enable);
356}
357
358static int s5pc100_d1_4_ctrl(struct clk *clk, int enable)
359{
360 return s5p_gatectrl(S5P_CLKGATE_D14, clk, enable);
361}
362
363static int s5pc100_d1_5_ctrl(struct clk *clk, int enable)
364{
365 return s5p_gatectrl(S5P_CLKGATE_D15, clk, enable);
366}
367
368static int s5pc100_sclk0_ctrl(struct clk *clk, int enable)
369{
370 return s5p_gatectrl(S5P_CLKGATE_SCLK0, clk, enable);
371}
372
373static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
374{
375 return s5p_gatectrl(S5P_CLKGATE_SCLK1, clk, enable);
376}
377
378/*
379 * The following clocks will be disabled during clock initialization. It is
380 * recommended to keep the following clocks disabled until the driver requests
381 * for enabling the clock.
382 */
383static struct clk init_clocks_off[] = {
384 {
385 .name = "cssys",
386 .parent = &clk_div_d0_bus.clk,
387 .enable = s5pc100_d0_0_ctrl,
388 .ctrlbit = (1 << 6),
389 }, {
390 .name = "secss",
391 .parent = &clk_div_d0_bus.clk,
392 .enable = s5pc100_d0_0_ctrl,
393 .ctrlbit = (1 << 5),
394 }, {
395 .name = "g2d",
396 .parent = &clk_div_d0_bus.clk,
397 .enable = s5pc100_d0_0_ctrl,
398 .ctrlbit = (1 << 4),
399 }, {
400 .name = "mdma",
401 .parent = &clk_div_d0_bus.clk,
402 .enable = s5pc100_d0_0_ctrl,
403 .ctrlbit = (1 << 3),
404 }, {
405 .name = "cfcon",
406 .parent = &clk_div_d0_bus.clk,
407 .enable = s5pc100_d0_0_ctrl,
408 .ctrlbit = (1 << 2),
409 }, {
410 .name = "nfcon",
411 .parent = &clk_div_d0_bus.clk,
412 .enable = s5pc100_d0_1_ctrl,
413 .ctrlbit = (1 << 3),
414 }, {
415 .name = "onenandc",
416 .parent = &clk_div_d0_bus.clk,
417 .enable = s5pc100_d0_1_ctrl,
418 .ctrlbit = (1 << 2),
419 }, {
420 .name = "sdm",
421 .parent = &clk_div_d0_bus.clk,
422 .enable = s5pc100_d0_2_ctrl,
423 .ctrlbit = (1 << 2),
424 }, {
425 .name = "seckey",
426 .parent = &clk_div_d0_bus.clk,
427 .enable = s5pc100_d0_2_ctrl,
428 .ctrlbit = (1 << 1),
429 }, {
430 .name = "modemif",
431 .parent = &clk_div_d1_bus.clk,
432 .enable = s5pc100_d1_0_ctrl,
433 .ctrlbit = (1 << 4),
434 }, {
435 .name = "otg",
436 .parent = &clk_div_d1_bus.clk,
437 .enable = s5pc100_d1_0_ctrl,
438 .ctrlbit = (1 << 3),
439 }, {
440 .name = "usbhost",
441 .parent = &clk_div_d1_bus.clk,
442 .enable = s5pc100_d1_0_ctrl,
443 .ctrlbit = (1 << 2),
444 }, {
445 .name = "dma",
446 .devname = "dma-pl330.1",
447 .parent = &clk_div_d1_bus.clk,
448 .enable = s5pc100_d1_0_ctrl,
449 .ctrlbit = (1 << 1),
450 }, {
451 .name = "dma",
452 .devname = "dma-pl330.0",
453 .parent = &clk_div_d1_bus.clk,
454 .enable = s5pc100_d1_0_ctrl,
455 .ctrlbit = (1 << 0),
456 }, {
457 .name = "lcd",
458 .parent = &clk_div_d1_bus.clk,
459 .enable = s5pc100_d1_1_ctrl,
460 .ctrlbit = (1 << 0),
461 }, {
462 .name = "rotator",
463 .parent = &clk_div_d1_bus.clk,
464 .enable = s5pc100_d1_1_ctrl,
465 .ctrlbit = (1 << 1),
466 }, {
467 .name = "fimc",
468 .devname = "s5p-fimc.0",
469 .parent = &clk_div_d1_bus.clk,
470 .enable = s5pc100_d1_1_ctrl,
471 .ctrlbit = (1 << 2),
472 }, {
473 .name = "fimc",
474 .devname = "s5p-fimc.1",
475 .parent = &clk_div_d1_bus.clk,
476 .enable = s5pc100_d1_1_ctrl,
477 .ctrlbit = (1 << 3),
478 }, {
479 .name = "fimc",
480 .devname = "s5p-fimc.2",
481 .enable = s5pc100_d1_1_ctrl,
482 .ctrlbit = (1 << 4),
483 }, {
484 .name = "jpeg",
485 .parent = &clk_div_d1_bus.clk,
486 .enable = s5pc100_d1_1_ctrl,
487 .ctrlbit = (1 << 5),
488 }, {
489 .name = "mipi-dsim",
490 .parent = &clk_div_d1_bus.clk,
491 .enable = s5pc100_d1_1_ctrl,
492 .ctrlbit = (1 << 6),
493 }, {
494 .name = "mipi-csis",
495 .parent = &clk_div_d1_bus.clk,
496 .enable = s5pc100_d1_1_ctrl,
497 .ctrlbit = (1 << 7),
498 }, {
499 .name = "g3d",
500 .parent = &clk_div_d1_bus.clk,
501 .enable = s5pc100_d1_0_ctrl,
502 .ctrlbit = (1 << 8),
503 }, {
504 .name = "tv",
505 .parent = &clk_div_d1_bus.clk,
506 .enable = s5pc100_d1_2_ctrl,
507 .ctrlbit = (1 << 0),
508 }, {
509 .name = "vp",
510 .parent = &clk_div_d1_bus.clk,
511 .enable = s5pc100_d1_2_ctrl,
512 .ctrlbit = (1 << 1),
513 }, {
514 .name = "mixer",
515 .parent = &clk_div_d1_bus.clk,
516 .enable = s5pc100_d1_2_ctrl,
517 .ctrlbit = (1 << 2),
518 }, {
519 .name = "hdmi",
520 .parent = &clk_div_d1_bus.clk,
521 .enable = s5pc100_d1_2_ctrl,
522 .ctrlbit = (1 << 3),
523 }, {
524 .name = "mfc",
525 .parent = &clk_div_d1_bus.clk,
526 .enable = s5pc100_d1_2_ctrl,
527 .ctrlbit = (1 << 4),
528 }, {
529 .name = "apc",
530 .parent = &clk_div_d1_bus.clk,
531 .enable = s5pc100_d1_3_ctrl,
532 .ctrlbit = (1 << 2),
533 }, {
534 .name = "iec",
535 .parent = &clk_div_d1_bus.clk,
536 .enable = s5pc100_d1_3_ctrl,
537 .ctrlbit = (1 << 3),
538 }, {
539 .name = "systimer",
540 .parent = &clk_div_d1_bus.clk,
541 .enable = s5pc100_d1_3_ctrl,
542 .ctrlbit = (1 << 7),
543 }, {
544 .name = "watchdog",
545 .parent = &clk_div_d1_bus.clk,
546 .enable = s5pc100_d1_3_ctrl,
547 .ctrlbit = (1 << 8),
548 }, {
549 .name = "rtc",
550 .parent = &clk_div_d1_bus.clk,
551 .enable = s5pc100_d1_3_ctrl,
552 .ctrlbit = (1 << 9),
553 }, {
554 .name = "i2c",
555 .devname = "s3c2440-i2c.0",
556 .parent = &clk_div_d1_bus.clk,
557 .enable = s5pc100_d1_4_ctrl,
558 .ctrlbit = (1 << 4),
559 }, {
560 .name = "i2c",
561 .devname = "s3c2440-i2c.1",
562 .parent = &clk_div_d1_bus.clk,
563 .enable = s5pc100_d1_4_ctrl,
564 .ctrlbit = (1 << 5),
565 }, {
566 .name = "spi",
567 .devname = "s5pc100-spi.0",
568 .parent = &clk_div_d1_bus.clk,
569 .enable = s5pc100_d1_4_ctrl,
570 .ctrlbit = (1 << 6),
571 }, {
572 .name = "spi",
573 .devname = "s5pc100-spi.1",
574 .parent = &clk_div_d1_bus.clk,
575 .enable = s5pc100_d1_4_ctrl,
576 .ctrlbit = (1 << 7),
577 }, {
578 .name = "spi",
579 .devname = "s5pc100-spi.2",
580 .parent = &clk_div_d1_bus.clk,
581 .enable = s5pc100_d1_4_ctrl,
582 .ctrlbit = (1 << 8),
583 }, {
584 .name = "irda",
585 .parent = &clk_div_d1_bus.clk,
586 .enable = s5pc100_d1_4_ctrl,
587 .ctrlbit = (1 << 9),
588 }, {
589 .name = "ccan",
590 .parent = &clk_div_d1_bus.clk,
591 .enable = s5pc100_d1_4_ctrl,
592 .ctrlbit = (1 << 10),
593 }, {
594 .name = "ccan",
595 .parent = &clk_div_d1_bus.clk,
596 .enable = s5pc100_d1_4_ctrl,
597 .ctrlbit = (1 << 11),
598 }, {
599 .name = "hsitx",
600 .parent = &clk_div_d1_bus.clk,
601 .enable = s5pc100_d1_4_ctrl,
602 .ctrlbit = (1 << 12),
603 }, {
604 .name = "hsirx",
605 .parent = &clk_div_d1_bus.clk,
606 .enable = s5pc100_d1_4_ctrl,
607 .ctrlbit = (1 << 13),
608 }, {
609 .name = "ac97",
610 .parent = &clk_div_pclkd1.clk,
611 .enable = s5pc100_d1_5_ctrl,
612 .ctrlbit = (1 << 3),
613 }, {
614 .name = "pcm",
615 .devname = "samsung-pcm.0",
616 .parent = &clk_div_pclkd1.clk,
617 .enable = s5pc100_d1_5_ctrl,
618 .ctrlbit = (1 << 4),
619 }, {
620 .name = "pcm",
621 .devname = "samsung-pcm.1",
622 .parent = &clk_div_pclkd1.clk,
623 .enable = s5pc100_d1_5_ctrl,
624 .ctrlbit = (1 << 5),
625 }, {
626 .name = "spdif",
627 .parent = &clk_div_pclkd1.clk,
628 .enable = s5pc100_d1_5_ctrl,
629 .ctrlbit = (1 << 6),
630 }, {
631 .name = "adc",
632 .parent = &clk_div_pclkd1.clk,
633 .enable = s5pc100_d1_5_ctrl,
634 .ctrlbit = (1 << 7),
635 }, {
636 .name = "keypad",
637 .parent = &clk_div_pclkd1.clk,
638 .enable = s5pc100_d1_5_ctrl,
639 .ctrlbit = (1 << 8),
640 }, {
641 .name = "mmc_48m",
642 .devname = "s3c-sdhci.0",
643 .parent = &clk_mout_48m.clk,
644 .enable = s5pc100_sclk0_ctrl,
645 .ctrlbit = (1 << 15),
646 }, {
647 .name = "mmc_48m",
648 .devname = "s3c-sdhci.1",
649 .parent = &clk_mout_48m.clk,
650 .enable = s5pc100_sclk0_ctrl,
651 .ctrlbit = (1 << 16),
652 }, {
653 .name = "mmc_48m",
654 .devname = "s3c-sdhci.2",
655 .parent = &clk_mout_48m.clk,
656 .enable = s5pc100_sclk0_ctrl,
657 .ctrlbit = (1 << 17),
658 },
659};
660
661static struct clk clk_hsmmc2 = {
662 .name = "hsmmc",
663 .devname = "s3c-sdhci.2",
664 .parent = &clk_div_d1_bus.clk,
665 .enable = s5pc100_d1_0_ctrl,
666 .ctrlbit = (1 << 7),
667};
668
669static struct clk clk_hsmmc1 = {
670 .name = "hsmmc",
671 .devname = "s3c-sdhci.1",
672 .parent = &clk_div_d1_bus.clk,
673 .enable = s5pc100_d1_0_ctrl,
674 .ctrlbit = (1 << 6),
675};
676
677static struct clk clk_hsmmc0 = {
678 .name = "hsmmc",
679 .devname = "s3c-sdhci.0",
680 .parent = &clk_div_d1_bus.clk,
681 .enable = s5pc100_d1_0_ctrl,
682 .ctrlbit = (1 << 5),
683};
684
685static struct clk clk_48m_spi0 = {
686 .name = "spi_48m",
687 .devname = "s5pc100-spi.0",
688 .parent = &clk_mout_48m.clk,
689 .enable = s5pc100_sclk0_ctrl,
690 .ctrlbit = (1 << 7),
691};
692
693static struct clk clk_48m_spi1 = {
694 .name = "spi_48m",
695 .devname = "s5pc100-spi.1",
696 .parent = &clk_mout_48m.clk,
697 .enable = s5pc100_sclk0_ctrl,
698 .ctrlbit = (1 << 8),
699};
700
701static struct clk clk_48m_spi2 = {
702 .name = "spi_48m",
703 .devname = "s5pc100-spi.2",
704 .parent = &clk_mout_48m.clk,
705 .enable = s5pc100_sclk0_ctrl,
706 .ctrlbit = (1 << 9),
707};
708
709static struct clk clk_i2s0 = {
710 .name = "iis",
711 .devname = "samsung-i2s.0",
712 .parent = &clk_div_pclkd1.clk,
713 .enable = s5pc100_d1_5_ctrl,
714 .ctrlbit = (1 << 0),
715};
716
717static struct clk clk_i2s1 = {
718 .name = "iis",
719 .devname = "samsung-i2s.1",
720 .parent = &clk_div_pclkd1.clk,
721 .enable = s5pc100_d1_5_ctrl,
722 .ctrlbit = (1 << 1),
723};
724
725static struct clk clk_i2s2 = {
726 .name = "iis",
727 .devname = "samsung-i2s.2",
728 .parent = &clk_div_pclkd1.clk,
729 .enable = s5pc100_d1_5_ctrl,
730 .ctrlbit = (1 << 2),
731};
732
733static struct clk clk_vclk54m = {
734 .name = "vclk_54m",
735 .rate = 54000000,
736};
737
738static struct clk clk_i2scdclk0 = {
739 .name = "i2s_cdclk0",
740};
741
742static struct clk clk_i2scdclk1 = {
743 .name = "i2s_cdclk1",
744};
745
746static struct clk clk_i2scdclk2 = {
747 .name = "i2s_cdclk2",
748};
749
750static struct clk clk_pcmcdclk0 = {
751 .name = "pcm_cdclk0",
752};
753
754static struct clk clk_pcmcdclk1 = {
755 .name = "pcm_cdclk1",
756};
757
758static struct clk *clk_src_group1_list[] = {
759 [0] = &clk_mout_epll.clk,
760 [1] = &clk_div_mpll2.clk,
761 [2] = &clk_fin_epll,
762 [3] = &clk_mout_hpll.clk,
763};
764
765static struct clksrc_sources clk_src_group1 = {
766 .sources = clk_src_group1_list,
767 .nr_sources = ARRAY_SIZE(clk_src_group1_list),
768};
769
770static struct clk *clk_src_group2_list[] = {
771 [0] = &clk_mout_epll.clk,
772 [1] = &clk_div_mpll.clk,
773};
774
775static struct clksrc_sources clk_src_group2 = {
776 .sources = clk_src_group2_list,
777 .nr_sources = ARRAY_SIZE(clk_src_group2_list),
778};
779
780static struct clk *clk_src_group3_list[] = {
781 [0] = &clk_mout_epll.clk,
782 [1] = &clk_div_mpll.clk,
783 [2] = &clk_fin_epll,
784 [3] = &clk_i2scdclk0,
785 [4] = &clk_pcmcdclk0,
786 [5] = &clk_mout_hpll.clk,
787};
788
789static struct clksrc_sources clk_src_group3 = {
790 .sources = clk_src_group3_list,
791 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
792};
793
794static struct clksrc_clk clk_sclk_audio0 = {
795 .clk = {
796 .name = "sclk_audio",
797 .devname = "samsung-pcm.0",
798 .ctrlbit = (1 << 8),
799 .enable = s5pc100_sclk1_ctrl,
800 },
801 .sources = &clk_src_group3,
802 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
803 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
804};
805
806static struct clk *clk_src_group4_list[] = {
807 [0] = &clk_mout_epll.clk,
808 [1] = &clk_div_mpll.clk,
809 [2] = &clk_fin_epll,
810 [3] = &clk_i2scdclk1,
811 [4] = &clk_pcmcdclk1,
812 [5] = &clk_mout_hpll.clk,
813};
814
815static struct clksrc_sources clk_src_group4 = {
816 .sources = clk_src_group4_list,
817 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
818};
819
820static struct clksrc_clk clk_sclk_audio1 = {
821 .clk = {
822 .name = "sclk_audio",
823 .devname = "samsung-pcm.1",
824 .ctrlbit = (1 << 9),
825 .enable = s5pc100_sclk1_ctrl,
826 },
827 .sources = &clk_src_group4,
828 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
829 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
830};
831
832static struct clk *clk_src_group5_list[] = {
833 [0] = &clk_mout_epll.clk,
834 [1] = &clk_div_mpll.clk,
835 [2] = &clk_fin_epll,
836 [3] = &clk_i2scdclk2,
837 [4] = &clk_mout_hpll.clk,
838};
839
840static struct clksrc_sources clk_src_group5 = {
841 .sources = clk_src_group5_list,
842 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
843};
844
845static struct clksrc_clk clk_sclk_audio2 = {
846 .clk = {
847 .name = "sclk_audio",
848 .devname = "samsung-pcm.2",
849 .ctrlbit = (1 << 10),
850 .enable = s5pc100_sclk1_ctrl,
851 },
852 .sources = &clk_src_group5,
853 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
854 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
855};
856
857static struct clk *clk_src_group6_list[] = {
858 [0] = &s5p_clk_27m,
859 [1] = &clk_vclk54m,
860 [2] = &clk_div_hdmi.clk,
861};
862
863static struct clksrc_sources clk_src_group6 = {
864 .sources = clk_src_group6_list,
865 .nr_sources = ARRAY_SIZE(clk_src_group6_list),
866};
867
868static struct clk *clk_src_group7_list[] = {
869 [0] = &clk_mout_epll.clk,
870 [1] = &clk_div_mpll.clk,
871 [2] = &clk_mout_hpll.clk,
872 [3] = &clk_vclk54m,
873};
874
875static struct clksrc_sources clk_src_group7 = {
876 .sources = clk_src_group7_list,
877 .nr_sources = ARRAY_SIZE(clk_src_group7_list),
878};
879
880static struct clk *clk_src_mmc0_list[] = {
881 [0] = &clk_mout_epll.clk,
882 [1] = &clk_div_mpll.clk,
883 [2] = &clk_fin_epll,
884};
885
886static struct clksrc_sources clk_src_mmc0 = {
887 .sources = clk_src_mmc0_list,
888 .nr_sources = ARRAY_SIZE(clk_src_mmc0_list),
889};
890
891static struct clk *clk_src_mmc12_list[] = {
892 [0] = &clk_mout_epll.clk,
893 [1] = &clk_div_mpll.clk,
894 [2] = &clk_fin_epll,
895 [3] = &clk_mout_hpll.clk,
896};
897
898static struct clksrc_sources clk_src_mmc12 = {
899 .sources = clk_src_mmc12_list,
900 .nr_sources = ARRAY_SIZE(clk_src_mmc12_list),
901};
902
903static struct clk *clk_src_irda_usb_list[] = {
904 [0] = &clk_mout_epll.clk,
905 [1] = &clk_div_mpll.clk,
906 [2] = &clk_fin_epll,
907 [3] = &clk_mout_hpll.clk,
908};
909
910static struct clksrc_sources clk_src_irda_usb = {
911 .sources = clk_src_irda_usb_list,
912 .nr_sources = ARRAY_SIZE(clk_src_irda_usb_list),
913};
914
915static struct clk *clk_src_pwi_list[] = {
916 [0] = &clk_fin_epll,
917 [1] = &clk_mout_epll.clk,
918 [2] = &clk_div_mpll.clk,
919};
920
921static struct clksrc_sources clk_src_pwi = {
922 .sources = clk_src_pwi_list,
923 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
924};
925
926static struct clk *clk_sclk_spdif_list[] = {
927 [0] = &clk_sclk_audio0.clk,
928 [1] = &clk_sclk_audio1.clk,
929 [2] = &clk_sclk_audio2.clk,
930};
931
932static struct clksrc_sources clk_src_sclk_spdif = {
933 .sources = clk_sclk_spdif_list,
934 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
935};
936
937static struct clksrc_clk clk_sclk_spdif = {
938 .clk = {
939 .name = "sclk_spdif",
940 .ctrlbit = (1 << 11),
941 .enable = s5pc100_sclk1_ctrl,
942 .ops = &s5p_sclk_spdif_ops,
943 },
944 .sources = &clk_src_sclk_spdif,
945 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
946};
947
948static struct clksrc_clk clksrcs[] = {
949 {
950 .clk = {
951 .name = "sclk_mixer",
952 .ctrlbit = (1 << 6),
953 .enable = s5pc100_sclk0_ctrl,
954
955 },
956 .sources = &clk_src_group6,
957 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 },
958 }, {
959 .clk = {
960 .name = "sclk_lcd",
961 .ctrlbit = (1 << 0),
962 .enable = s5pc100_sclk1_ctrl,
963
964 },
965 .sources = &clk_src_group7,
966 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 12, .size = 2 },
967 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
968 }, {
969 .clk = {
970 .name = "sclk_fimc",
971 .devname = "s5p-fimc.0",
972 .ctrlbit = (1 << 1),
973 .enable = s5pc100_sclk1_ctrl,
974
975 },
976 .sources = &clk_src_group7,
977 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 16, .size = 2 },
978 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
979 }, {
980 .clk = {
981 .name = "sclk_fimc",
982 .devname = "s5p-fimc.1",
983 .ctrlbit = (1 << 2),
984 .enable = s5pc100_sclk1_ctrl,
985
986 },
987 .sources = &clk_src_group7,
988 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 20, .size = 2 },
989 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
990 }, {
991 .clk = {
992 .name = "sclk_fimc",
993 .devname = "s5p-fimc.2",
994 .ctrlbit = (1 << 3),
995 .enable = s5pc100_sclk1_ctrl,
996
997 },
998 .sources = &clk_src_group7,
999 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 24, .size = 2 },
1000 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 24, .size = 4 },
1001 }, {
1002 .clk = {
1003 .name = "sclk_irda",
1004 .ctrlbit = (1 << 10),
1005 .enable = s5pc100_sclk0_ctrl,
1006
1007 },
1008 .sources = &clk_src_irda_usb,
1009 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1010 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1011 }, {
1012 .clk = {
1013 .name = "sclk_irda",
1014 .ctrlbit = (1 << 10),
1015 .enable = s5pc100_sclk0_ctrl,
1016
1017 },
1018 .sources = &clk_src_mmc12,
1019 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 2 },
1020 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 },
1021 }, {
1022 .clk = {
1023 .name = "sclk_pwi",
1024 .ctrlbit = (1 << 1),
1025 .enable = s5pc100_sclk0_ctrl,
1026
1027 },
1028 .sources = &clk_src_pwi,
1029 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 0, .size = 2 },
1030 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 3 },
1031 }, {
1032 .clk = {
1033 .name = "sclk_uhost",
1034 .ctrlbit = (1 << 11),
1035 .enable = s5pc100_sclk0_ctrl,
1036
1037 },
1038 .sources = &clk_src_irda_usb,
1039 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 2 },
1040 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 20, .size = 4 },
1041 },
1042};
1043
1044static struct clksrc_clk clk_sclk_uart = {
1045 .clk = {
1046 .name = "uclk1",
1047 .ctrlbit = (1 << 3),
1048 .enable = s5pc100_sclk0_ctrl,
1049 },
1050 .sources = &clk_src_group2,
1051 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
1052 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
1053};
1054
1055static struct clksrc_clk clk_sclk_mmc0 = {
1056 .clk = {
1057 .name = "sclk_mmc",
1058 .devname = "s3c-sdhci.0",
1059 .ctrlbit = (1 << 12),
1060 .enable = s5pc100_sclk1_ctrl,
1061 },
1062 .sources = &clk_src_mmc0,
1063 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
1064 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 0, .size = 4 },
1065};
1066
1067static struct clksrc_clk clk_sclk_mmc1 = {
1068 .clk = {
1069 .name = "sclk_mmc",
1070 .devname = "s3c-sdhci.1",
1071 .ctrlbit = (1 << 13),
1072 .enable = s5pc100_sclk1_ctrl,
1073 },
1074 .sources = &clk_src_mmc12,
1075 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
1076 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 4, .size = 4 },
1077};
1078
1079static struct clksrc_clk clk_sclk_mmc2 = {
1080 .clk = {
1081 .name = "sclk_mmc",
1082 .devname = "s3c-sdhci.2",
1083 .ctrlbit = (1 << 14),
1084 .enable = s5pc100_sclk1_ctrl,
1085 },
1086 .sources = &clk_src_mmc12,
1087 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
1088 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 8, .size = 4 },
1089};
1090
1091static struct clksrc_clk clk_sclk_spi0 = {
1092 .clk = {
1093 .name = "sclk_spi",
1094 .devname = "s5pc100-spi.0",
1095 .ctrlbit = (1 << 4),
1096 .enable = s5pc100_sclk0_ctrl,
1097 },
1098 .sources = &clk_src_group1,
1099 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 2 },
1100 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
1101};
1102
1103static struct clksrc_clk clk_sclk_spi1 = {
1104 .clk = {
1105 .name = "sclk_spi",
1106 .devname = "s5pc100-spi.1",
1107 .ctrlbit = (1 << 5),
1108 .enable = s5pc100_sclk0_ctrl,
1109 },
1110 .sources = &clk_src_group1,
1111 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 2 },
1112 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
1113};
1114
1115static struct clksrc_clk clk_sclk_spi2 = {
1116 .clk = {
1117 .name = "sclk_spi",
1118 .devname = "s5pc100-spi.2",
1119 .ctrlbit = (1 << 6),
1120 .enable = s5pc100_sclk0_ctrl,
1121 },
1122 .sources = &clk_src_group1,
1123 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 2 },
1124 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 12, .size = 4 },
1125};
1126
1127/* Clock initialisation code */
1128static struct clksrc_clk *sysclks[] = {
1129 &clk_mout_apll,
1130 &clk_mout_epll,
1131 &clk_mout_mpll,
1132 &clk_mout_hpll,
1133 &clk_mout_href,
1134 &clk_mout_48m,
1135 &clk_div_apll,
1136 &clk_div_arm,
1137 &clk_div_d0_bus,
1138 &clk_div_pclkd0,
1139 &clk_div_secss,
1140 &clk_div_apll2,
1141 &clk_mout_am,
1142 &clk_div_d1_bus,
1143 &clk_div_mpll2,
1144 &clk_div_mpll,
1145 &clk_mout_onenand,
1146 &clk_div_onenand,
1147 &clk_div_pclkd1,
1148 &clk_div_cam,
1149 &clk_div_hdmi,
1150 &clk_sclk_audio0,
1151 &clk_sclk_audio1,
1152 &clk_sclk_audio2,
1153 &clk_sclk_spdif,
1154};
1155
1156static struct clk *clk_cdev[] = {
1157 &clk_hsmmc0,
1158 &clk_hsmmc1,
1159 &clk_hsmmc2,
1160 &clk_48m_spi0,
1161 &clk_48m_spi1,
1162 &clk_48m_spi2,
1163 &clk_i2s0,
1164 &clk_i2s1,
1165 &clk_i2s2,
1166};
1167
1168static struct clksrc_clk *clksrc_cdev[] = {
1169 &clk_sclk_uart,
1170 &clk_sclk_mmc0,
1171 &clk_sclk_mmc1,
1172 &clk_sclk_mmc2,
1173 &clk_sclk_spi0,
1174 &clk_sclk_spi1,
1175 &clk_sclk_spi2,
1176};
1177
1178void __init_or_cpufreq s5pc100_setup_clocks(void)
1179{
1180 unsigned long xtal;
1181 unsigned long arm;
1182 unsigned long hclkd0;
1183 unsigned long hclkd1;
1184 unsigned long pclkd0;
1185 unsigned long pclkd1;
1186 unsigned long apll;
1187 unsigned long mpll;
1188 unsigned long epll;
1189 unsigned long hpll;
1190 unsigned int ptr;
1191
1192 /* Set S5PC100 functions for clk_fout_epll */
1193 clk_fout_epll.enable = s5p_epll_enable;
1194 clk_fout_epll.ops = &s5pc100_epll_ops;
1195
1196 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1197
1198 xtal = clk_get_rate(&clk_xtal);
1199
1200 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1201
1202 apll = s5p_get_pll65xx(xtal, __raw_readl(S5P_APLL_CON));
1203 mpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_MPLL_CON));
1204 epll = s5p_get_pll65xx(xtal, __raw_readl(S5P_EPLL_CON));
1205 hpll = s5p_get_pll65xx(xtal, __raw_readl(S5P_HPLL_CON));
1206
1207 printk(KERN_INFO "S5PC100: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz, E=%ld.%ldMHz, H=%ld.%ldMHz\n",
1208 print_mhz(apll), print_mhz(mpll), print_mhz(epll), print_mhz(hpll));
1209
1210 clk_fout_apll.rate = apll;
1211 clk_fout_mpll.rate = mpll;
1212 clk_fout_epll.rate = epll;
1213 clk_mout_hpll.clk.rate = hpll;
1214
1215 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1216 s3c_set_clksrc(&clksrcs[ptr], true);
1217
1218 arm = clk_get_rate(&clk_div_arm.clk);
1219 hclkd0 = clk_get_rate(&clk_div_d0_bus.clk);
1220 pclkd0 = clk_get_rate(&clk_div_pclkd0.clk);
1221 hclkd1 = clk_get_rate(&clk_div_d1_bus.clk);
1222 pclkd1 = clk_get_rate(&clk_div_pclkd1.clk);
1223
1224 printk(KERN_INFO "S5PC100: HCLKD0=%ld.%ldMHz, HCLKD1=%ld.%ldMHz, PCLKD0=%ld.%ldMHz, PCLKD1=%ld.%ldMHz\n",
1225 print_mhz(hclkd0), print_mhz(hclkd1), print_mhz(pclkd0), print_mhz(pclkd1));
1226
1227 clk_f.rate = arm;
1228 clk_h.rate = hclkd1;
1229 clk_p.rate = pclkd1;
1230}
1231
1232/*
1233 * The following clocks will be enabled during clock initialization.
1234 */
1235static struct clk init_clocks[] = {
1236 {
1237 .name = "tzic",
1238 .parent = &clk_div_d0_bus.clk,
1239 .enable = s5pc100_d0_0_ctrl,
1240 .ctrlbit = (1 << 1),
1241 }, {
1242 .name = "intc",
1243 .parent = &clk_div_d0_bus.clk,
1244 .enable = s5pc100_d0_0_ctrl,
1245 .ctrlbit = (1 << 0),
1246 }, {
1247 .name = "ebi",
1248 .parent = &clk_div_d0_bus.clk,
1249 .enable = s5pc100_d0_1_ctrl,
1250 .ctrlbit = (1 << 5),
1251 }, {
1252 .name = "intmem",
1253 .parent = &clk_div_d0_bus.clk,
1254 .enable = s5pc100_d0_1_ctrl,
1255 .ctrlbit = (1 << 4),
1256 }, {
1257 .name = "sromc",
1258 .parent = &clk_div_d0_bus.clk,
1259 .enable = s5pc100_d0_1_ctrl,
1260 .ctrlbit = (1 << 1),
1261 }, {
1262 .name = "dmc",
1263 .parent = &clk_div_d0_bus.clk,
1264 .enable = s5pc100_d0_1_ctrl,
1265 .ctrlbit = (1 << 0),
1266 }, {
1267 .name = "chipid",
1268 .parent = &clk_div_d0_bus.clk,
1269 .enable = s5pc100_d0_1_ctrl,
1270 .ctrlbit = (1 << 0),
1271 }, {
1272 .name = "gpio",
1273 .parent = &clk_div_d1_bus.clk,
1274 .enable = s5pc100_d1_3_ctrl,
1275 .ctrlbit = (1 << 1),
1276 }, {
1277 .name = "uart",
1278 .devname = "s3c6400-uart.0",
1279 .parent = &clk_div_d1_bus.clk,
1280 .enable = s5pc100_d1_4_ctrl,
1281 .ctrlbit = (1 << 0),
1282 }, {
1283 .name = "uart",
1284 .devname = "s3c6400-uart.1",
1285 .parent = &clk_div_d1_bus.clk,
1286 .enable = s5pc100_d1_4_ctrl,
1287 .ctrlbit = (1 << 1),
1288 }, {
1289 .name = "uart",
1290 .devname = "s3c6400-uart.2",
1291 .parent = &clk_div_d1_bus.clk,
1292 .enable = s5pc100_d1_4_ctrl,
1293 .ctrlbit = (1 << 2),
1294 }, {
1295 .name = "uart",
1296 .devname = "s3c6400-uart.3",
1297 .parent = &clk_div_d1_bus.clk,
1298 .enable = s5pc100_d1_4_ctrl,
1299 .ctrlbit = (1 << 3),
1300 }, {
1301 .name = "timers",
1302 .parent = &clk_div_d1_bus.clk,
1303 .enable = s5pc100_d1_3_ctrl,
1304 .ctrlbit = (1 << 6),
1305 },
1306};
1307
1308static struct clk *clks[] __initdata = {
1309 &clk_ext,
1310 &clk_i2scdclk0,
1311 &clk_i2scdclk1,
1312 &clk_i2scdclk2,
1313 &clk_pcmcdclk0,
1314 &clk_pcmcdclk1,
1315};
1316
1317static struct clk_lookup s5pc100_clk_lookup[] = {
1318 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
1319 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uart.clk),
1320 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0),
1321 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1),
1322 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2),
1323 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1324 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1325 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1326 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1327 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk1", &clk_48m_spi0),
1328 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk2", &clk_sclk_spi0.clk),
1329 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk1", &clk_48m_spi1),
1330 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk2", &clk_sclk_spi1.clk),
1331 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk1", &clk_48m_spi2),
1332 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk2", &clk_sclk_spi2.clk),
1333 CLKDEV_INIT("samsung-i2s.0", "i2s_opclk0", &clk_i2s0),
1334 CLKDEV_INIT("samsung-i2s.1", "i2s_opclk0", &clk_i2s1),
1335 CLKDEV_INIT("samsung-i2s.2", "i2s_opclk0", &clk_i2s2),
1336};
1337
1338void __init s5pc100_register_clocks(void)
1339{
1340 int ptr;
1341
1342 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1343
1344 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1345 s3c_register_clksrc(sysclks[ptr], 1);
1346
1347 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1348 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1349 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1350 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1351
1352 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1353 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1354 clkdev_add_table(s5pc100_clk_lookup, ARRAY_SIZE(s5pc100_clk_lookup));
1355
1356 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1357 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1358 s3c_disable_clocks(clk_cdev[ptr], 1);
1359
1360 s3c24xx_register_clock(&dummy_apb_pclk);
1361}
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
deleted file mode 100644
index 6a41bf7dacf6..000000000000
--- a/arch/arm/mach-s5pc100/common.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Copyright 2009 Samsung Electronics Co.
6 * Byungho Min <bhmin@samsung.com>
7 *
8 * Common Codes for S5PC100
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/timer.h>
20#include <linux/init.h>
21#include <linux/clk.h>
22#include <linux/io.h>
23#include <linux/device.h>
24#include <linux/serial_core.h>
25#include <linux/serial_s3c.h>
26#include <clocksource/samsung_pwm.h>
27#include <linux/platform_device.h>
28#include <linux/sched.h>
29#include <linux/reboot.h>
30
31#include <asm/irq.h>
32#include <asm/proc-fns.h>
33#include <asm/system_misc.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <mach/map.h>
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41
42#include <plat/cpu.h>
43#include <plat/devs.h>
44#include <plat/clock.h>
45#include <plat/sdhci.h>
46#include <plat/adc-core.h>
47#include <plat/ata-core.h>
48#include <plat/fb-core.h>
49#include <plat/iic-core.h>
50#include <plat/onenand-core.h>
51#include <plat/pwm-core.h>
52#include <plat/spi-core.h>
53#include <plat/watchdog-reset.h>
54
55#include "common.h"
56
57static const char name_s5pc100[] = "S5PC100";
58
59static struct cpu_table cpu_ids[] __initdata = {
60 {
61 .idcode = S5PC100_CPU_ID,
62 .idmask = S5PC100_CPU_MASK,
63 .map_io = s5pc100_map_io,
64 .init_clocks = s5pc100_init_clocks,
65 .init_uarts = s5pc100_init_uarts,
66 .init = s5pc100_init,
67 .name = name_s5pc100,
68 },
69};
70
71/* Initial IO mappings */
72
73static struct map_desc s5pc100_iodesc[] __initdata = {
74 {
75 .virtual = (unsigned long)S5P_VA_CHIPID,
76 .pfn = __phys_to_pfn(S5PC100_PA_CHIPID),
77 .length = SZ_4K,
78 .type = MT_DEVICE,
79 }, {
80 .virtual = (unsigned long)S3C_VA_SYS,
81 .pfn = __phys_to_pfn(S5PC100_PA_SYSCON),
82 .length = SZ_64K,
83 .type = MT_DEVICE,
84 }, {
85 .virtual = (unsigned long)S3C_VA_TIMER,
86 .pfn = __phys_to_pfn(S5PC100_PA_TIMER),
87 .length = SZ_16K,
88 .type = MT_DEVICE,
89 }, {
90 .virtual = (unsigned long)S3C_VA_WATCHDOG,
91 .pfn = __phys_to_pfn(S5PC100_PA_WATCHDOG),
92 .length = SZ_4K,
93 .type = MT_DEVICE,
94 }, {
95 .virtual = (unsigned long)S5P_VA_SROMC,
96 .pfn = __phys_to_pfn(S5PC100_PA_SROMC),
97 .length = SZ_4K,
98 .type = MT_DEVICE,
99 }, {
100 .virtual = (unsigned long)S5P_VA_SYSTIMER,
101 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER),
102 .length = SZ_16K,
103 .type = MT_DEVICE,
104 }, {
105 .virtual = (unsigned long)S5P_VA_GPIO,
106 .pfn = __phys_to_pfn(S5PC100_PA_GPIO),
107 .length = SZ_4K,
108 .type = MT_DEVICE,
109 }, {
110 .virtual = (unsigned long)VA_VIC0,
111 .pfn = __phys_to_pfn(S5PC100_PA_VIC0),
112 .length = SZ_16K,
113 .type = MT_DEVICE,
114 }, {
115 .virtual = (unsigned long)VA_VIC1,
116 .pfn = __phys_to_pfn(S5PC100_PA_VIC1),
117 .length = SZ_16K,
118 .type = MT_DEVICE,
119 }, {
120 .virtual = (unsigned long)VA_VIC2,
121 .pfn = __phys_to_pfn(S5PC100_PA_VIC2),
122 .length = SZ_16K,
123 .type = MT_DEVICE,
124 }, {
125 .virtual = (unsigned long)S3C_VA_UART,
126 .pfn = __phys_to_pfn(S3C_PA_UART),
127 .length = SZ_512K,
128 .type = MT_DEVICE,
129 }, {
130 .virtual = (unsigned long)S5PC100_VA_OTHERS,
131 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS),
132 .length = SZ_4K,
133 .type = MT_DEVICE,
134 }
135};
136
137static struct samsung_pwm_variant s5pc100_pwm_variant = {
138 .bits = 32,
139 .div_base = 0,
140 .has_tint_cstat = true,
141 .tclk_mask = (1 << 5),
142};
143
144void __init samsung_set_timer_source(unsigned int event, unsigned int source)
145{
146 s5pc100_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
147 s5pc100_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
148}
149
150void __init samsung_timer_init(void)
151{
152 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
153 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
154 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
155 };
156
157 samsung_pwm_clocksource_init(S3C_VA_TIMER,
158 timer_irqs, &s5pc100_pwm_variant);
159}
160
161/*
162 * s5pc100_map_io
163 *
164 * register the standard CPU IO areas
165 */
166
167void __init s5pc100_init_io(struct map_desc *mach_desc, int size)
168{
169 /* initialize the io descriptors we need for initialization */
170 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
171 if (mach_desc)
172 iotable_init(mach_desc, size);
173
174 /* detect cpu id and rev. */
175 s5p_init_cpu(S5P_VA_CHIPID);
176
177 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
178
179 samsung_pwm_set_platdata(&s5pc100_pwm_variant);
180}
181
182void __init s5pc100_map_io(void)
183{
184 /* initialise device information early */
185 s5pc100_default_sdhci0();
186 s5pc100_default_sdhci1();
187 s5pc100_default_sdhci2();
188
189 s3c_adc_setname("s3c64xx-adc");
190
191 /* the i2c devices are directly compatible with s3c2440 */
192 s3c_i2c0_setname("s3c2440-i2c");
193 s3c_i2c1_setname("s3c2440-i2c");
194
195 s3c_onenand_setname("s5pc100-onenand");
196 s3c_fb_setname("s5pc100-fb");
197 s3c_cfcon_setname("s5pc100-pata");
198
199 s3c64xx_spi_setname("s5pc100-spi");
200}
201
202void __init s5pc100_init_clocks(int xtal)
203{
204 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
205
206 s3c24xx_register_baseclocks(xtal);
207 s5p_register_clocks(xtal);
208 s5pc100_register_clocks();
209 s5pc100_setup_clocks();
210 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
211}
212
213void __init s5pc100_init_irq(void)
214{
215 u32 vic[] = {~0, ~0, ~0};
216
217 /* VIC0, VIC1, and VIC2 are fully populated. */
218 s5p_init_irq(vic, ARRAY_SIZE(vic));
219}
220
221static struct bus_type s5pc100_subsys = {
222 .name = "s5pc100-core",
223 .dev_name = "s5pc100-core",
224};
225
226static struct device s5pc100_dev = {
227 .bus = &s5pc100_subsys,
228};
229
230static int __init s5pc100_core_init(void)
231{
232 return subsys_system_register(&s5pc100_subsys, NULL);
233}
234core_initcall(s5pc100_core_init);
235
236int __init s5pc100_init(void)
237{
238 printk(KERN_INFO "S5PC100: Initializing architecture\n");
239 return device_register(&s5pc100_dev);
240}
241
242/* uart registration process */
243
244void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)
245{
246 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
247}
248
249void s5pc100_restart(enum reboot_mode mode, const char *cmd)
250{
251 if (mode != REBOOT_SOFT)
252 samsung_wdt_reset();
253
254 soft_restart(0);
255}
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
deleted file mode 100644
index 08d782d65d7b..000000000000
--- a/arch/arm/mach-s5pc100/common.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S5PC100 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H
13#define __ARCH_ARM_MACH_S5PC100_COMMON_H
14
15#include <linux/reboot.h>
16
17void s5pc100_init_io(struct map_desc *mach_desc, int size);
18void s5pc100_init_irq(void);
19
20void s5pc100_register_clocks(void);
21void s5pc100_setup_clocks(void);
22
23void s5pc100_restart(enum reboot_mode mode, const char *cmd);
24
25extern int s5pc100_init(void);
26extern void s5pc100_map_io(void);
27extern void s5pc100_init_clocks(int xtal);
28extern void s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29
30#endif /* __ARCH_ARM_MACH_S5PC100_COMMON_H */
diff --git a/arch/arm/mach-s5pc100/dev-audio.c b/arch/arm/mach-s5pc100/dev-audio.c
deleted file mode 100644
index 46f488b09391..000000000000
--- a/arch/arm/mach-s5pc100/dev-audio.c
+++ /dev/null
@@ -1,239 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22static int s5pc100_cfg_i2s(struct platform_device *pdev)
23{
24 /* configure GPIO for i2s port */
25 switch (pdev->id) {
26 case 0: /* Dedicated pins */
27 break;
28 case 1:
29 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(2));
30 break;
31 case 2:
32 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(4));
33 break;
34 default:
35 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
36 return -EINVAL;
37 }
38
39 return 0;
40}
41
42static struct s3c_audio_pdata i2sv5_pdata = {
43 .cfg_gpio = s5pc100_cfg_i2s,
44 .type = {
45 .i2s = {
46 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
47 | QUIRK_NEED_RSTCLR,
48 },
49 },
50};
51
52static struct resource s5pc100_iis0_resource[] = {
53 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S0, SZ_256),
54 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
55 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
56 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
57};
58
59struct platform_device s5pc100_device_iis0 = {
60 .name = "samsung-i2s",
61 .id = 0,
62 .num_resources = ARRAY_SIZE(s5pc100_iis0_resource),
63 .resource = s5pc100_iis0_resource,
64 .dev = {
65 .platform_data = &i2sv5_pdata,
66 },
67};
68
69static struct s3c_audio_pdata i2sv3_pdata = {
70 .cfg_gpio = s5pc100_cfg_i2s,
71};
72
73static struct resource s5pc100_iis1_resource[] = {
74 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S1, SZ_256),
75 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
76 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
77};
78
79struct platform_device s5pc100_device_iis1 = {
80 .name = "samsung-i2s",
81 .id = 1,
82 .num_resources = ARRAY_SIZE(s5pc100_iis1_resource),
83 .resource = s5pc100_iis1_resource,
84 .dev = {
85 .platform_data = &i2sv3_pdata,
86 },
87};
88
89static struct resource s5pc100_iis2_resource[] = {
90 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S2, SZ_256),
91 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
92 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
93};
94
95struct platform_device s5pc100_device_iis2 = {
96 .name = "samsung-i2s",
97 .id = 2,
98 .num_resources = ARRAY_SIZE(s5pc100_iis2_resource),
99 .resource = s5pc100_iis2_resource,
100 .dev = {
101 .platform_data = &i2sv3_pdata,
102 },
103};
104
105/* PCM Controller platform_devices */
106
107static int s5pc100_pcm_cfg_gpio(struct platform_device *pdev)
108{
109 switch (pdev->id) {
110 case 0:
111 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(5));
112 break;
113
114 case 1:
115 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(3));
116 break;
117
118 default:
119 printk(KERN_DEBUG "Invalid PCM Controller number!");
120 return -EINVAL;
121 }
122
123 return 0;
124}
125
126static struct s3c_audio_pdata s3c_pcm_pdata = {
127 .cfg_gpio = s5pc100_pcm_cfg_gpio,
128};
129
130static struct resource s5pc100_pcm0_resource[] = {
131 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM0, SZ_256),
132 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
133 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
134};
135
136struct platform_device s5pc100_device_pcm0 = {
137 .name = "samsung-pcm",
138 .id = 0,
139 .num_resources = ARRAY_SIZE(s5pc100_pcm0_resource),
140 .resource = s5pc100_pcm0_resource,
141 .dev = {
142 .platform_data = &s3c_pcm_pdata,
143 },
144};
145
146static struct resource s5pc100_pcm1_resource[] = {
147 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM1, SZ_256),
148 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
149 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
150};
151
152struct platform_device s5pc100_device_pcm1 = {
153 .name = "samsung-pcm",
154 .id = 1,
155 .num_resources = ARRAY_SIZE(s5pc100_pcm1_resource),
156 .resource = s5pc100_pcm1_resource,
157 .dev = {
158 .platform_data = &s3c_pcm_pdata,
159 },
160};
161
162/* AC97 Controller platform devices */
163
164static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev)
165{
166 return s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(4));
167}
168
169static struct resource s5pc100_ac97_resource[] = {
170 [0] = DEFINE_RES_MEM(S5PC100_PA_AC97, SZ_256),
171 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
172 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
173 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
174 [4] = DEFINE_RES_IRQ(IRQ_AC97),
175};
176
177static struct s3c_audio_pdata s3c_ac97_pdata = {
178 .cfg_gpio = s5pc100_ac97_cfg_gpio,
179};
180
181static u64 s5pc100_ac97_dmamask = DMA_BIT_MASK(32);
182
183struct platform_device s5pc100_device_ac97 = {
184 .name = "samsung-ac97",
185 .id = -1,
186 .num_resources = ARRAY_SIZE(s5pc100_ac97_resource),
187 .resource = s5pc100_ac97_resource,
188 .dev = {
189 .platform_data = &s3c_ac97_pdata,
190 .dma_mask = &s5pc100_ac97_dmamask,
191 .coherent_dma_mask = DMA_BIT_MASK(32),
192 },
193};
194
195/* S/PDIF Controller platform_device */
196static int s5pc100_spdif_cfg_gpd(struct platform_device *pdev)
197{
198 s3c_gpio_cfgpin_range(S5PC100_GPD(5), 2, S3C_GPIO_SFN(3));
199
200 return 0;
201}
202
203static int s5pc100_spdif_cfg_gpg3(struct platform_device *pdev)
204{
205 s3c_gpio_cfgpin_range(S5PC100_GPG3(5), 2, S3C_GPIO_SFN(3));
206
207 return 0;
208}
209
210static struct resource s5pc100_spdif_resource[] = {
211 [0] = DEFINE_RES_MEM(S5PC100_PA_SPDIF, SZ_256),
212 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
213};
214
215static struct s3c_audio_pdata s5p_spdif_pdata = {
216 .cfg_gpio = s5pc100_spdif_cfg_gpd,
217};
218
219static u64 s5pc100_spdif_dmamask = DMA_BIT_MASK(32);
220
221struct platform_device s5pc100_device_spdif = {
222 .name = "samsung-spdif",
223 .id = -1,
224 .num_resources = ARRAY_SIZE(s5pc100_spdif_resource),
225 .resource = s5pc100_spdif_resource,
226 .dev = {
227 .platform_data = &s5p_spdif_pdata,
228 .dma_mask = &s5pc100_spdif_dmamask,
229 .coherent_dma_mask = DMA_BIT_MASK(32),
230 },
231};
232
233void __init s5pc100_spdif_setup_gpio(int gpio)
234{
235 if (gpio == S5PC100_SPDIF_GPD)
236 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpd;
237 else
238 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpg3;
239}
diff --git a/arch/arm/mach-s5pc100/dma.c b/arch/arm/mach-s5pc100/dma.c
deleted file mode 100644
index b1418409709e..000000000000
--- a/arch/arm/mach-s5pc100/dma.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/dma.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/dma-mapping.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
29#include <plat/devs.h>
30#include <plat/irqs.h>
31
32#include <mach/map.h>
33#include <mach/irqs.h>
34#include <mach/dma.h>
35
36static u8 pdma0_peri[] = {
37 DMACH_UART0_RX,
38 DMACH_UART0_TX,
39 DMACH_UART1_RX,
40 DMACH_UART1_TX,
41 DMACH_UART2_RX,
42 DMACH_UART2_TX,
43 DMACH_UART3_RX,
44 DMACH_UART3_TX,
45 DMACH_IRDA,
46 DMACH_I2S0_RX,
47 DMACH_I2S0_TX,
48 DMACH_I2S0S_TX,
49 DMACH_I2S1_RX,
50 DMACH_I2S1_TX,
51 DMACH_I2S2_RX,
52 DMACH_I2S2_TX,
53 DMACH_SPI0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI1_RX,
56 DMACH_SPI1_TX,
57 DMACH_SPI2_RX,
58 DMACH_SPI2_TX,
59 DMACH_AC97_MICIN,
60 DMACH_AC97_PCMIN,
61 DMACH_AC97_PCMOUT,
62 DMACH_EXTERNAL,
63 DMACH_PWM,
64 DMACH_SPDIF,
65 DMACH_HSI_RX,
66 DMACH_HSI_TX,
67};
68
69static struct dma_pl330_platdata s5pc100_pdma0_pdata = {
70 .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
71 .peri_id = pdma0_peri,
72};
73
74static AMBA_AHB_DEVICE(s5pc100_pdma0, "dma-pl330.0", 0x00041330,
75 S5PC100_PA_PDMA0, {IRQ_PDMA0}, &s5pc100_pdma0_pdata);
76
77static u8 pdma1_peri[] = {
78 DMACH_UART0_RX,
79 DMACH_UART0_TX,
80 DMACH_UART1_RX,
81 DMACH_UART1_TX,
82 DMACH_UART2_RX,
83 DMACH_UART2_TX,
84 DMACH_UART3_RX,
85 DMACH_UART3_TX,
86 DMACH_IRDA,
87 DMACH_I2S0_RX,
88 DMACH_I2S0_TX,
89 DMACH_I2S0S_TX,
90 DMACH_I2S1_RX,
91 DMACH_I2S1_TX,
92 DMACH_I2S2_RX,
93 DMACH_I2S2_TX,
94 DMACH_SPI0_RX,
95 DMACH_SPI0_TX,
96 DMACH_SPI1_RX,
97 DMACH_SPI1_TX,
98 DMACH_SPI2_RX,
99 DMACH_SPI2_TX,
100 DMACH_PCM0_RX,
101 DMACH_PCM0_TX,
102 DMACH_PCM1_RX,
103 DMACH_PCM1_TX,
104 DMACH_MSM_REQ0,
105 DMACH_MSM_REQ1,
106 DMACH_MSM_REQ2,
107 DMACH_MSM_REQ3,
108};
109
110static struct dma_pl330_platdata s5pc100_pdma1_pdata = {
111 .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
112 .peri_id = pdma1_peri,
113};
114
115static AMBA_AHB_DEVICE(s5pc100_pdma1, "dma-pl330.1", 0x00041330,
116 S5PC100_PA_PDMA1, {IRQ_PDMA1}, &s5pc100_pdma1_pdata);
117
118static int __init s5pc100_dma_init(void)
119{
120 dma_cap_set(DMA_SLAVE, s5pc100_pdma0_pdata.cap_mask);
121 dma_cap_set(DMA_CYCLIC, s5pc100_pdma0_pdata.cap_mask);
122 amba_device_register(&s5pc100_pdma0_device, &iomem_resource);
123
124 dma_cap_set(DMA_SLAVE, s5pc100_pdma1_pdata.cap_mask);
125 dma_cap_set(DMA_CYCLIC, s5pc100_pdma1_pdata.cap_mask);
126 amba_device_register(&s5pc100_pdma1_device, &iomem_resource);
127
128 return 0;
129}
130arch_initcall(s5pc100_dma_init);
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
deleted file mode 100644
index 22c23859e45e..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/debug-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 *
7 * Based on mach-s3c6400/include/mach/debug-macro.S
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/* pull in the relevant register and map files. */
15
16#include <linux/serial_s3c.h>
17#include <mach/map.h>
18
19 /* note, for the boot process to work we have to keep the UART
20 * virtual address aligned to an 1MiB boundary for the L1
21 * mapping the head code makes. We keep the UART virtual address
22 * aligned and add in the offset when we load the value here.
23 */
24
25 .macro addruart, rp, rv, tmp
26 ldr \rp, = S3C_PA_UART
27 ldr \rv, = S3C_VA_UART
28#if CONFIG_DEBUG_S3C_UART != 0
29 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
30 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif
32 .endm
33
34/* include the reset of the code which will do the work, we're only
35 * compiling for a single cpu processor type so the default of s3c2440
36 * will be fine with us.
37 */
38
39#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pc100/include/mach/entry-macro.S b/arch/arm/mach-s5pc100/include/mach/entry-macro.S
deleted file mode 100644
index bad0700457db..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/entry-macro.S
+++ /dev/null
@@ -1,19 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/entry-macro.S
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6400/include/mach/entry-macro.S
7 *
8 * Low-level IRQ helper macros for the Samsung S5PC1XX series
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13*/
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 .endm
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
deleted file mode 100644
index 5e1a924b595f..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO lib support
7 *
8 * Base on mach-s3c6400/include/mach/gpio.h
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __ASM_ARCH_GPIO_H
16#define __ASM_ARCH_GPIO_H __FILE__
17
18/* GPIO bank sizes */
19#define S5PC100_GPIO_A0_NR (8)
20#define S5PC100_GPIO_A1_NR (5)
21#define S5PC100_GPIO_B_NR (8)
22#define S5PC100_GPIO_C_NR (5)
23#define S5PC100_GPIO_D_NR (7)
24#define S5PC100_GPIO_E0_NR (8)
25#define S5PC100_GPIO_E1_NR (6)
26#define S5PC100_GPIO_F0_NR (8)
27#define S5PC100_GPIO_F1_NR (8)
28#define S5PC100_GPIO_F2_NR (8)
29#define S5PC100_GPIO_F3_NR (4)
30#define S5PC100_GPIO_G0_NR (8)
31#define S5PC100_GPIO_G1_NR (3)
32#define S5PC100_GPIO_G2_NR (7)
33#define S5PC100_GPIO_G3_NR (7)
34#define S5PC100_GPIO_H0_NR (8)
35#define S5PC100_GPIO_H1_NR (8)
36#define S5PC100_GPIO_H2_NR (8)
37#define S5PC100_GPIO_H3_NR (8)
38#define S5PC100_GPIO_I_NR (8)
39#define S5PC100_GPIO_J0_NR (8)
40#define S5PC100_GPIO_J1_NR (5)
41#define S5PC100_GPIO_J2_NR (8)
42#define S5PC100_GPIO_J3_NR (8)
43#define S5PC100_GPIO_J4_NR (4)
44#define S5PC100_GPIO_K0_NR (8)
45#define S5PC100_GPIO_K1_NR (6)
46#define S5PC100_GPIO_K2_NR (8)
47#define S5PC100_GPIO_K3_NR (8)
48#define S5PC100_GPIO_L0_NR (8)
49#define S5PC100_GPIO_L1_NR (8)
50#define S5PC100_GPIO_L2_NR (8)
51#define S5PC100_GPIO_L3_NR (8)
52#define S5PC100_GPIO_L4_NR (8)
53
54/* GPIO bank numbes */
55
56/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
57 * space for debugging purposes so that any accidental
58 * change from one gpio bank to another can be caught.
59*/
60
61#define S5PC100_GPIO_NEXT(__gpio) \
62 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
63
64enum s5p_gpio_number {
65 S5PC100_GPIO_A0_START = 0,
66 S5PC100_GPIO_A1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A0),
67 S5PC100_GPIO_B_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A1),
68 S5PC100_GPIO_C_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_B),
69 S5PC100_GPIO_D_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_C),
70 S5PC100_GPIO_E0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_D),
71 S5PC100_GPIO_E1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E0),
72 S5PC100_GPIO_F0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E1),
73 S5PC100_GPIO_F1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F0),
74 S5PC100_GPIO_F2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F1),
75 S5PC100_GPIO_F3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F2),
76 S5PC100_GPIO_G0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F3),
77 S5PC100_GPIO_G1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G0),
78 S5PC100_GPIO_G2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G1),
79 S5PC100_GPIO_G3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G2),
80 S5PC100_GPIO_H0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G3),
81 S5PC100_GPIO_H1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H0),
82 S5PC100_GPIO_H2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H1),
83 S5PC100_GPIO_H3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H2),
84 S5PC100_GPIO_I_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H3),
85 S5PC100_GPIO_J0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_I),
86 S5PC100_GPIO_J1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J0),
87 S5PC100_GPIO_J2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J1),
88 S5PC100_GPIO_J3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J2),
89 S5PC100_GPIO_J4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J3),
90 S5PC100_GPIO_K0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J4),
91 S5PC100_GPIO_K1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K0),
92 S5PC100_GPIO_K2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K1),
93 S5PC100_GPIO_K3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K2),
94 S5PC100_GPIO_L0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K3),
95 S5PC100_GPIO_L1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L0),
96 S5PC100_GPIO_L2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L1),
97 S5PC100_GPIO_L3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L2),
98 S5PC100_GPIO_L4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L3),
99 S5PC100_GPIO_END = S5PC100_GPIO_NEXT(S5PC100_GPIO_L4),
100};
101
102/* S5PC100 GPIO number definitions. */
103#define S5PC100_GPA0(_nr) (S5PC100_GPIO_A0_START + (_nr))
104#define S5PC100_GPA1(_nr) (S5PC100_GPIO_A1_START + (_nr))
105#define S5PC100_GPB(_nr) (S5PC100_GPIO_B_START + (_nr))
106#define S5PC100_GPC(_nr) (S5PC100_GPIO_C_START + (_nr))
107#define S5PC100_GPD(_nr) (S5PC100_GPIO_D_START + (_nr))
108#define S5PC100_GPE0(_nr) (S5PC100_GPIO_E0_START + (_nr))
109#define S5PC100_GPE1(_nr) (S5PC100_GPIO_E1_START + (_nr))
110#define S5PC100_GPF0(_nr) (S5PC100_GPIO_F0_START + (_nr))
111#define S5PC100_GPF1(_nr) (S5PC100_GPIO_F1_START + (_nr))
112#define S5PC100_GPF2(_nr) (S5PC100_GPIO_F2_START + (_nr))
113#define S5PC100_GPF3(_nr) (S5PC100_GPIO_F3_START + (_nr))
114#define S5PC100_GPG0(_nr) (S5PC100_GPIO_G0_START + (_nr))
115#define S5PC100_GPG1(_nr) (S5PC100_GPIO_G1_START + (_nr))
116#define S5PC100_GPG2(_nr) (S5PC100_GPIO_G2_START + (_nr))
117#define S5PC100_GPG3(_nr) (S5PC100_GPIO_G3_START + (_nr))
118#define S5PC100_GPH0(_nr) (S5PC100_GPIO_H0_START + (_nr))
119#define S5PC100_GPH1(_nr) (S5PC100_GPIO_H1_START + (_nr))
120#define S5PC100_GPH2(_nr) (S5PC100_GPIO_H2_START + (_nr))
121#define S5PC100_GPH3(_nr) (S5PC100_GPIO_H3_START + (_nr))
122#define S5PC100_GPI(_nr) (S5PC100_GPIO_I_START + (_nr))
123#define S5PC100_GPJ0(_nr) (S5PC100_GPIO_J0_START + (_nr))
124#define S5PC100_GPJ1(_nr) (S5PC100_GPIO_J1_START + (_nr))
125#define S5PC100_GPJ2(_nr) (S5PC100_GPIO_J2_START + (_nr))
126#define S5PC100_GPJ3(_nr) (S5PC100_GPIO_J3_START + (_nr))
127#define S5PC100_GPJ4(_nr) (S5PC100_GPIO_J4_START + (_nr))
128#define S5PC100_GPK0(_nr) (S5PC100_GPIO_K0_START + (_nr))
129#define S5PC100_GPK1(_nr) (S5PC100_GPIO_K1_START + (_nr))
130#define S5PC100_GPK2(_nr) (S5PC100_GPIO_K2_START + (_nr))
131#define S5PC100_GPK3(_nr) (S5PC100_GPIO_K3_START + (_nr))
132#define S5PC100_GPL0(_nr) (S5PC100_GPIO_L0_START + (_nr))
133#define S5PC100_GPL1(_nr) (S5PC100_GPIO_L1_START + (_nr))
134#define S5PC100_GPL2(_nr) (S5PC100_GPIO_L2_START + (_nr))
135#define S5PC100_GPL3(_nr) (S5PC100_GPIO_L3_START + (_nr))
136#define S5PC100_GPL4(_nr) (S5PC100_GPIO_L4_START + (_nr))
137
138/* It used the end of the S5PC100 gpios */
139#define S3C_GPIO_END S5PC100_GPIO_END
140
141/* define the number of gpios we need to the one after the MP04() range */
142#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
143
144#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/hardware.h b/arch/arm/mach-s5pc100/include/mach/hardware.h
deleted file mode 100644
index 6b38618c2fd9..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/hardware.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/hardware.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - Hardware support
7 */
8
9#ifndef __ASM_ARCH_HARDWARE_H
10#define __ASM_ARCH_HARDWARE_H __FILE__
11
12/* currently nothing here, placeholder */
13
14#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
deleted file mode 100644
index d2eb4757381f..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/irqs.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - IRQ definitions
7 */
8
9#ifndef __ASM_ARCH_IRQS_H
10#define __ASM_ARCH_IRQS_H __FILE__
11
12#include <plat/irqs.h>
13
14/* VIC0: system, DMA, timer */
15#define IRQ_EINT16_31 S5P_IRQ_VIC0(16)
16#define IRQ_BATF S5P_IRQ_VIC0(17)
17#define IRQ_MDMA S5P_IRQ_VIC0(18)
18#define IRQ_PDMA0 S5P_IRQ_VIC0(19)
19#define IRQ_PDMA1 S5P_IRQ_VIC0(20)
20#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(21)
21#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(22)
22#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(23)
23#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(24)
24#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(25)
25#define IRQ_SYSTIMER S5P_IRQ_VIC0(26)
26#define IRQ_WDT S5P_IRQ_VIC0(27)
27#define IRQ_RTC_ALARM S5P_IRQ_VIC0(28)
28#define IRQ_RTC_TIC S5P_IRQ_VIC0(29)
29#define IRQ_GPIOINT S5P_IRQ_VIC0(30)
30
31/* VIC1: ARM, power, memory, connectivity */
32#define IRQ_PMU S5P_IRQ_VIC1(0)
33#define IRQ_CORTEX1 S5P_IRQ_VIC1(1)
34#define IRQ_CORTEX2 S5P_IRQ_VIC1(2)
35#define IRQ_CORTEX3 S5P_IRQ_VIC1(3)
36#define IRQ_CORTEX4 S5P_IRQ_VIC1(4)
37#define IRQ_IEMAPC S5P_IRQ_VIC1(5)
38#define IRQ_IEMIEC S5P_IRQ_VIC1(6)
39#define IRQ_ONENAND S5P_IRQ_VIC1(7)
40#define IRQ_NFC S5P_IRQ_VIC1(8)
41#define IRQ_CFCON S5P_IRQ_VIC1(9)
42#define IRQ_UART0 S5P_IRQ_VIC1(10)
43#define IRQ_UART1 S5P_IRQ_VIC1(11)
44#define IRQ_UART2 S5P_IRQ_VIC1(12)
45#define IRQ_UART3 S5P_IRQ_VIC1(13)
46#define IRQ_IIC S5P_IRQ_VIC1(14)
47#define IRQ_SPI0 S5P_IRQ_VIC1(15)
48#define IRQ_SPI1 S5P_IRQ_VIC1(16)
49#define IRQ_SPI2 S5P_IRQ_VIC1(17)
50#define IRQ_IRDA S5P_IRQ_VIC1(18)
51#define IRQ_IIC2 S5P_IRQ_VIC1(19)
52#define IRQ_IIC3 S5P_IRQ_VIC1(20)
53#define IRQ_HSIRX S5P_IRQ_VIC1(21)
54#define IRQ_HSITX S5P_IRQ_VIC1(22)
55#define IRQ_UHOST S5P_IRQ_VIC1(23)
56#define IRQ_OTG S5P_IRQ_VIC1(24)
57#define IRQ_MSM S5P_IRQ_VIC1(25)
58#define IRQ_HSMMC0 S5P_IRQ_VIC1(26)
59#define IRQ_HSMMC1 S5P_IRQ_VIC1(27)
60#define IRQ_HSMMC2 S5P_IRQ_VIC1(28)
61#define IRQ_MIPICSI S5P_IRQ_VIC1(29)
62#define IRQ_MIPIDSI S5P_IRQ_VIC1(30)
63
64/* VIC2: multimedia, audio, security */
65#define IRQ_LCD0 S5P_IRQ_VIC2(0)
66#define IRQ_LCD1 S5P_IRQ_VIC2(1)
67#define IRQ_LCD2 S5P_IRQ_VIC2(2)
68#define IRQ_LCD3 S5P_IRQ_VIC2(3)
69#define IRQ_ROTATOR S5P_IRQ_VIC2(4)
70#define IRQ_FIMC0 S5P_IRQ_VIC2(5)
71#define IRQ_FIMC1 S5P_IRQ_VIC2(6)
72#define IRQ_FIMC2 S5P_IRQ_VIC2(7)
73#define IRQ_JPEG S5P_IRQ_VIC2(8)
74#define IRQ_2D S5P_IRQ_VIC2(9)
75#define IRQ_3D S5P_IRQ_VIC2(10)
76#define IRQ_MIXER S5P_IRQ_VIC2(11)
77#define IRQ_HDMI S5P_IRQ_VIC2(12)
78#define IRQ_IIC1 S5P_IRQ_VIC2(13)
79#define IRQ_MFC S5P_IRQ_VIC2(14)
80#define IRQ_TVENC S5P_IRQ_VIC2(15)
81#define IRQ_I2S0 S5P_IRQ_VIC2(16)
82#define IRQ_I2S1 S5P_IRQ_VIC2(17)
83#define IRQ_I2S2 S5P_IRQ_VIC2(18)
84#define IRQ_AC97 S5P_IRQ_VIC2(19)
85#define IRQ_PCM0 S5P_IRQ_VIC2(20)
86#define IRQ_PCM1 S5P_IRQ_VIC2(21)
87#define IRQ_SPDIF S5P_IRQ_VIC2(22)
88#define IRQ_ADC S5P_IRQ_VIC2(23)
89#define IRQ_PENDN S5P_IRQ_VIC2(24)
90#define IRQ_TC IRQ_PENDN
91#define IRQ_KEYPAD S5P_IRQ_VIC2(25)
92#define IRQ_CG S5P_IRQ_VIC2(26)
93#define IRQ_SEC S5P_IRQ_VIC2(27)
94#define IRQ_SECRX S5P_IRQ_VIC2(28)
95#define IRQ_SECTX S5P_IRQ_VIC2(29)
96#define IRQ_SDMIRQ S5P_IRQ_VIC2(30)
97#define IRQ_SDMFIQ S5P_IRQ_VIC2(31)
98#define IRQ_VIC_END S5P_IRQ_VIC2(31)
99
100#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
101#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
102
103/* GPIO interrupt */
104#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
105#define S5P_GPIOINT_GROUP_MAXNR 21
106
107/* Set the default NR_IRQS */
108#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)
109
110/* Compatibility */
111#define IRQ_LCD_FIFO IRQ_LCD0
112#define IRQ_LCD_VSYNC IRQ_LCD1
113#define IRQ_LCD_SYSTEM IRQ_LCD2
114
115#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
deleted file mode 100644
index 2550b6112b82..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/map.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Copyright 2009 Samsung Electronics Co.
7 * Byungho Min <bhmin@samsung.com>
8 *
9 * S5PC100 - Memory map definitions
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __ASM_ARCH_MAP_H
17#define __ASM_ARCH_MAP_H __FILE__
18
19#include <plat/map-base.h>
20#include <plat/map-s5p.h>
21
22#define S5PC100_PA_SDRAM 0x20000000
23
24#define S5PC100_PA_ONENAND 0xE7100000
25#define S5PC100_PA_ONENAND_BUF 0xB0000000
26
27#define S5PC100_PA_CHIPID 0xE0000000
28
29#define S5PC100_PA_SYSCON 0xE0100000
30
31#define S5PC100_PA_OTHERS 0xE0200000
32
33#define S5PC100_PA_GPIO 0xE0300000
34
35#define S5PC100_PA_VIC0 0xE4000000
36#define S5PC100_PA_VIC1 0xE4100000
37#define S5PC100_PA_VIC2 0xE4200000
38
39#define S5PC100_PA_SROMC 0xE7000000
40
41#define S5PC100_PA_CFCON 0xE7800000
42
43#define S5PC100_PA_MDMA 0xE8100000
44#define S5PC100_PA_PDMA0 0xE9000000
45#define S5PC100_PA_PDMA1 0xE9200000
46
47#define S5PC100_PA_TIMER 0xEA000000
48#define S5PC100_PA_SYSTIMER 0xEA100000
49#define S5PC100_PA_WATCHDOG 0xEA200000
50#define S5PC100_PA_RTC 0xEA300000
51
52#define S5PC100_PA_UART 0xEC000000
53
54#define S5PC100_PA_IIC0 0xEC100000
55#define S5PC100_PA_IIC1 0xEC200000
56
57#define S5PC100_PA_SPI0 0xEC300000
58#define S5PC100_PA_SPI1 0xEC400000
59#define S5PC100_PA_SPI2 0xEC500000
60
61#define S5PC100_PA_USB_HSOTG 0xED200000
62#define S5PC100_PA_USB_HSPHY 0xED300000
63
64#define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
65
66#define S5PC100_PA_FB 0xEE000000
67
68#define S5PC100_PA_FIMC0 0xEE200000
69#define S5PC100_PA_FIMC1 0xEE300000
70#define S5PC100_PA_FIMC2 0xEE400000
71
72#define S5PC100_PA_I2S0 0xF2000000
73#define S5PC100_PA_I2S1 0xF2100000
74#define S5PC100_PA_I2S2 0xF2200000
75
76#define S5PC100_PA_AC97 0xF2300000
77
78#define S5PC100_PA_PCM0 0xF2400000
79#define S5PC100_PA_PCM1 0xF2500000
80
81#define S5PC100_PA_SPDIF 0xF2600000
82
83#define S5PC100_PA_TSADC 0xF3000000
84
85#define S5PC100_PA_KEYPAD 0xF3100000
86
87/* Compatibiltiy Defines */
88
89#define S3C_PA_FB S5PC100_PA_FB
90#define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0)
91#define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1)
92#define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2)
93#define S3C_PA_IIC S5PC100_PA_IIC0
94#define S3C_PA_IIC1 S5PC100_PA_IIC1
95#define S3C_PA_KEYPAD S5PC100_PA_KEYPAD
96#define S3C_PA_ONENAND S5PC100_PA_ONENAND
97#define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF
98#define S3C_PA_RTC S5PC100_PA_RTC
99#define S3C_PA_TSADC S5PC100_PA_TSADC
100#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
101#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
102#define S3C_PA_WDT S5PC100_PA_WATCHDOG
103#define S3C_PA_SPI0 S5PC100_PA_SPI0
104#define S3C_PA_SPI1 S5PC100_PA_SPI1
105#define S3C_PA_SPI2 S5PC100_PA_SPI2
106
107#define S5P_PA_CHIPID S5PC100_PA_CHIPID
108#define S5P_PA_FIMC0 S5PC100_PA_FIMC0
109#define S5P_PA_FIMC1 S5PC100_PA_FIMC1
110#define S5P_PA_FIMC2 S5PC100_PA_FIMC2
111#define S5P_PA_SDRAM S5PC100_PA_SDRAM
112#define S5P_PA_SROMC S5PC100_PA_SROMC
113#define S5P_PA_SYSCON S5PC100_PA_SYSCON
114#define S5P_PA_TIMER S5PC100_PA_TIMER
115
116#define SAMSUNG_PA_ADC S5PC100_PA_TSADC
117#define SAMSUNG_PA_CFCON S5PC100_PA_CFCON
118#define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD
119#define SAMSUNG_PA_TIMER S5PC100_PA_TIMER
120
121#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000)
122
123#define S3C_SZ_ONENAND_BUF (SZ_256M - SZ_32M)
124
125/* UART */
126
127#define S3C_PA_UART S5PC100_PA_UART
128
129#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
130#define S5P_PA_UART0 S5P_PA_UART(0)
131#define S5P_PA_UART1 S5P_PA_UART(1)
132#define S5P_PA_UART2 S5P_PA_UART(2)
133#define S5P_PA_UART3 S5P_PA_UART(3)
134
135#define S5P_SZ_UART SZ_256
136
137#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-clock.h b/arch/arm/mach-s5pc100/include/mach/regs-clock.h
deleted file mode 100644
index bc92da2e0ba2..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-clock.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PC100 - Clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19
20#define S5PC100_REG_OTHERS(x) (S5PC100_VA_OTHERS + (x))
21
22#define S5P_APLL_LOCK S5P_CLKREG(0x00)
23#define S5P_MPLL_LOCK S5P_CLKREG(0x04)
24#define S5P_EPLL_LOCK S5P_CLKREG(0x08)
25#define S5P_HPLL_LOCK S5P_CLKREG(0x0C)
26
27#define S5P_APLL_CON S5P_CLKREG(0x100)
28#define S5P_MPLL_CON S5P_CLKREG(0x104)
29#define S5P_EPLL_CON S5P_CLKREG(0x108)
30#define S5P_HPLL_CON S5P_CLKREG(0x10C)
31
32#define S5P_CLK_SRC0 S5P_CLKREG(0x200)
33#define S5P_CLK_SRC1 S5P_CLKREG(0x204)
34#define S5P_CLK_SRC2 S5P_CLKREG(0x208)
35#define S5P_CLK_SRC3 S5P_CLKREG(0x20C)
36
37#define S5P_CLK_DIV0 S5P_CLKREG(0x300)
38#define S5P_CLK_DIV1 S5P_CLKREG(0x304)
39#define S5P_CLK_DIV2 S5P_CLKREG(0x308)
40#define S5P_CLK_DIV3 S5P_CLKREG(0x30C)
41#define S5P_CLK_DIV4 S5P_CLKREG(0x310)
42
43#define S5P_CLK_OUT S5P_CLKREG(0x400)
44
45#define S5P_CLKGATE_D00 S5P_CLKREG(0x500)
46#define S5P_CLKGATE_D01 S5P_CLKREG(0x504)
47#define S5P_CLKGATE_D02 S5P_CLKREG(0x508)
48
49#define S5P_CLKGATE_D10 S5P_CLKREG(0x520)
50#define S5P_CLKGATE_D11 S5P_CLKREG(0x524)
51#define S5P_CLKGATE_D12 S5P_CLKREG(0x528)
52#define S5P_CLKGATE_D13 S5P_CLKREG(0x52C)
53#define S5P_CLKGATE_D14 S5P_CLKREG(0x530)
54#define S5P_CLKGATE_D15 S5P_CLKREG(0x534)
55
56#define S5P_CLKGATE_D20 S5P_CLKREG(0x540)
57
58#define S5P_CLKGATE_SCLK0 S5P_CLKREG(0x560)
59#define S5P_CLKGATE_SCLK1 S5P_CLKREG(0x564)
60
61/* CLKDIV0 */
62#define S5P_CLKDIV0_D0_MASK (0x7<<8)
63#define S5P_CLKDIV0_D0_SHIFT (8)
64#define S5P_CLKDIV0_PCLKD0_MASK (0x7<<12)
65#define S5P_CLKDIV0_PCLKD0_SHIFT (12)
66
67/* CLKDIV1 */
68#define S5P_CLKDIV1_D1_MASK (0x7<<12)
69#define S5P_CLKDIV1_D1_SHIFT (12)
70#define S5P_CLKDIV1_PCLKD1_MASK (0x7<<16)
71#define S5P_CLKDIV1_PCLKD1_SHIFT (16)
72
73#define S5PC100_SWRESET S5PC100_REG_OTHERS(0x000)
74#define S5PC100_MEM_SYS_CFG S5PC100_REG_OTHERS(0x200)
75
76#define S5PC100_SWRESET_RESETVAL 0xc100
77
78#define MEM_SYS_CFG_EBI_FIX_PRI_CFCON 0x30
79
80#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h b/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
deleted file mode 100644
index 0bf73209ec7b..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* linux/arch/arm/plat-s5pc100/include/plat/regs-gpio.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - GPIO register definitions
7 */
8
9#ifndef __ASM_MACH_S5PC100_REGS_GPIO_H
10#define __ASM_MACH_S5PC100_REGS_GPIO_H __FILE__
11
12#include <mach/map.h>
13
14#define S5PC100EINT30CON (S5P_VA_GPIO + 0xE00)
15#define S5P_EINT_CON(x) (S5PC100EINT30CON + ((x) * 0x4))
16
17#define S5PC100EINT30FLTCON0 (S5P_VA_GPIO + 0xE80)
18#define S5P_EINT_FLTCON(x) (S5PC100EINT30FLTCON0 + ((x) * 0x4))
19
20#define S5PC100EINT30MASK (S5P_VA_GPIO + 0xF00)
21#define S5P_EINT_MASK(x) (S5PC100EINT30MASK + ((x) * 0x4))
22
23#define S5PC100EINT30PEND (S5P_VA_GPIO + 0xF40)
24#define S5P_EINT_PEND(x) (S5PC100EINT30PEND + ((x) * 0x4))
25
26#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
27
28#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
29
30#define EINT_MODE S3C_GPIO_SFN(0x2)
31
32#define EINT_GPIO_0(x) S5PC100_GPH0(x)
33#define EINT_GPIO_1(x) S5PC100_GPH1(x)
34#define EINT_GPIO_2(x) S5PC100_GPH2(x)
35#define EINT_GPIO_3(x) S5PC100_GPH3(x)
36
37#endif /* __ASM_MACH_S5PC100_REGS_GPIO_H */
38
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-irq.h b/arch/arm/mach-s5pc100/include/mach/regs-irq.h
deleted file mode 100644
index 761627897f30..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/regs-irq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/regs-irq.h
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * S5PC100 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17
18#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
deleted file mode 100644
index 668af3ac31f3..000000000000
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ /dev/null
@@ -1,264 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/mach-smdkc100.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Author: Byungho Min <bhmin@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/serial_s3c.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/gpio.h>
23#include <linux/i2c.h>
24#include <linux/fb.h>
25#include <linux/delay.h>
26#include <linux/input.h>
27#include <linux/pwm_backlight.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
32#include <mach/map.h>
33#include <mach/regs-gpio.h>
34
35#include <video/platform_lcd.h>
36#include <video/samsung_fimd.h>
37
38#include <asm/irq.h>
39#include <asm/mach-types.h>
40
41#include <plat/gpio-cfg.h>
42
43#include <plat/clock.h>
44#include <plat/devs.h>
45#include <plat/cpu.h>
46#include <plat/fb.h>
47#include <linux/platform_data/i2c-s3c2410.h>
48#include <linux/platform_data/ata-samsung_cf.h>
49#include <plat/adc.h>
50#include <plat/keypad.h>
51#include <linux/platform_data/touchscreen-s3c2410.h>
52#include <linux/platform_data/asoc-s3c.h>
53#include <plat/backlight.h>
54#include <plat/samsung-time.h>
55
56#include "common.h"
57
58/* Following are default values for UCON, ULCON and UFCON UART registers */
59#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
60 S3C2410_UCON_RXILEVEL | \
61 S3C2410_UCON_TXIRQMODE | \
62 S3C2410_UCON_RXIRQMODE | \
63 S3C2410_UCON_RXFIFO_TOI | \
64 S3C2443_UCON_RXERR_IRQEN)
65
66#define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
67
68#define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
69 S3C2440_UFCON_RXTRIG8 | \
70 S3C2440_UFCON_TXTRIG16)
71
72static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
73 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = SMDKC100_UCON_DEFAULT,
77 .ulcon = SMDKC100_ULCON_DEFAULT,
78 .ufcon = SMDKC100_UFCON_DEFAULT,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = SMDKC100_UCON_DEFAULT,
84 .ulcon = SMDKC100_ULCON_DEFAULT,
85 .ufcon = SMDKC100_UFCON_DEFAULT,
86 },
87 [2] = {
88 .hwport = 2,
89 .flags = 0,
90 .ucon = SMDKC100_UCON_DEFAULT,
91 .ulcon = SMDKC100_ULCON_DEFAULT,
92 .ufcon = SMDKC100_UFCON_DEFAULT,
93 },
94 [3] = {
95 .hwport = 3,
96 .flags = 0,
97 .ucon = SMDKC100_UCON_DEFAULT,
98 .ulcon = SMDKC100_ULCON_DEFAULT,
99 .ufcon = SMDKC100_UFCON_DEFAULT,
100 },
101};
102
103/* I2C0 */
104static struct i2c_board_info i2c_devs0[] __initdata = {
105 {I2C_BOARD_INFO("wm8580", 0x1b),},
106};
107
108/* I2C1 */
109static struct i2c_board_info i2c_devs1[] __initdata = {
110};
111
112/* LCD power controller */
113static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
114 unsigned int power)
115{
116 if (power) {
117 /* module reset */
118 gpio_direction_output(S5PC100_GPH0(6), 1);
119 mdelay(100);
120 gpio_direction_output(S5PC100_GPH0(6), 0);
121 mdelay(10);
122 gpio_direction_output(S5PC100_GPH0(6), 1);
123 mdelay(10);
124 }
125}
126
127static struct plat_lcd_data smdkc100_lcd_power_data = {
128 .set_power = smdkc100_lcd_power_set,
129};
130
131static struct platform_device smdkc100_lcd_powerdev = {
132 .name = "platform-lcd",
133 .dev.parent = &s3c_device_fb.dev,
134 .dev.platform_data = &smdkc100_lcd_power_data,
135};
136
137/* Frame Buffer */
138static struct s3c_fb_pd_win smdkc100_fb_win0 = {
139 .max_bpp = 32,
140 .default_bpp = 16,
141 .xres = 800,
142 .yres = 480,
143};
144
145static struct fb_videomode smdkc100_lcd_timing = {
146 .left_margin = 8,
147 .right_margin = 13,
148 .upper_margin = 7,
149 .lower_margin = 5,
150 .hsync_len = 3,
151 .vsync_len = 1,
152 .xres = 800,
153 .yres = 480,
154 .refresh = 80,
155};
156
157static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
158 .win[0] = &smdkc100_fb_win0,
159 .vtiming = &smdkc100_lcd_timing,
160 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
161 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
162 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
163};
164
165static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
166 .setup_gpio = s5pc100_ide_setup_gpio,
167};
168
169static uint32_t smdkc100_keymap[] __initdata = {
170 /* KEY(row, col, keycode) */
171 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
172 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
173 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
174 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
175};
176
177static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
178 .keymap = smdkc100_keymap,
179 .keymap_size = ARRAY_SIZE(smdkc100_keymap),
180};
181
182static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
183 .keymap_data = &smdkc100_keymap_data,
184 .rows = 2,
185 .cols = 8,
186};
187
188static struct platform_device *smdkc100_devices[] __initdata = {
189 &s3c_device_adc,
190 &s3c_device_cfcon,
191 &s3c_device_i2c0,
192 &s3c_device_i2c1,
193 &s3c_device_fb,
194 &s3c_device_hsmmc0,
195 &s3c_device_hsmmc1,
196 &s3c_device_hsmmc2,
197 &samsung_device_pwm,
198 &s3c_device_ts,
199 &s3c_device_wdt,
200 &smdkc100_lcd_powerdev,
201 &s5pc100_device_iis0,
202 &samsung_device_keypad,
203 &s5pc100_device_ac97,
204 &s3c_device_rtc,
205 &s5p_device_fimc0,
206 &s5p_device_fimc1,
207 &s5p_device_fimc2,
208 &s5pc100_device_spdif,
209};
210
211/* LCD Backlight data */
212static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = {
213 .no = S5PC100_GPD(0),
214 .func = S3C_GPIO_SFN(2),
215};
216
217static struct platform_pwm_backlight_data smdkc100_bl_data = {
218 .pwm_id = 0,
219 .enable_gpio = -1,
220};
221
222static void __init smdkc100_map_io(void)
223{
224 s5pc100_init_io(NULL, 0);
225 s3c24xx_init_clocks(12000000);
226 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
227 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
228}
229
230static void __init smdkc100_machine_init(void)
231{
232 s3c24xx_ts_set_platdata(NULL);
233
234 /* I2C */
235 s3c_i2c0_set_platdata(NULL);
236 s3c_i2c1_set_platdata(NULL);
237 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
238 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
239
240 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
241 s3c_ide_set_platdata(&smdkc100_ide_pdata);
242
243 samsung_keypad_set_platdata(&smdkc100_keypad_data);
244
245 s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
246
247 /* LCD init */
248 gpio_request(S5PC100_GPH0(6), "GPH0");
249 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
250
251 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
252
253 samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data);
254}
255
256MACHINE_START(SMDKC100, "SMDKC100")
257 /* Maintainer: Byungho Min <bhmin@samsung.com> */
258 .atag_offset = 0x100,
259 .init_irq = s5pc100_init_irq,
260 .map_io = smdkc100_map_io,
261 .init_machine = smdkc100_machine_init,
262 .init_time = samsung_timer_init,
263 .restart = s5pc100_restart,
264MACHINE_END
diff --git a/arch/arm/mach-s5pc100/setup-fb-24bpp.c b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
deleted file mode 100644
index 8978e4cf9ed5..000000000000
--- a/arch/arm/mach-s5pc100/setup-fb-24bpp.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/arm/mach-s5pc100/setup-fb-24bpp.c
3 *
4 * Copyright 2009 Samsung Electronics
5 *
6 * Base S5PC100 setup information for 24bpp LCD framebuffer
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/fb.h>
16#include <linux/gpio.h>
17
18#include <mach/map.h>
19#include <plat/fb.h>
20#include <plat/gpio-cfg.h>
21
22#define DISR_OFFSET 0x7008
23
24static void s5pc100_fb_setgpios(unsigned int base, unsigned int nr)
25{
26 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));
27}
28
29void s5pc100_fb_gpio_setup_24bpp(void)
30{
31 s5pc100_fb_setgpios(S5PC100_GPF0(0), 8);
32 s5pc100_fb_setgpios(S5PC100_GPF1(0), 8);
33 s5pc100_fb_setgpios(S5PC100_GPF2(0), 8);
34 s5pc100_fb_setgpios(S5PC100_GPF3(0), 4);
35}
diff --git a/arch/arm/mach-s5pc100/setup-i2c0.c b/arch/arm/mach-s5pc100/setup-i2c0.c
deleted file mode 100644
index 89a6a769d622..000000000000
--- a/arch/arm/mach-s5pc100/setup-i2c0.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-i2c0.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC100 I2C bus 0 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <linux/gpio.h>
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPD(3), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pc100/setup-i2c1.c b/arch/arm/mach-s5pc100/setup-i2c1.c
deleted file mode 100644
index faa667ef02cb..000000000000
--- a/arch/arm/mach-s5pc100/setup-i2c1.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-i2c1.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Base S5PC100 I2C bus 1 gpio configuration
7 *
8 * Based on plat-s3c64xx/setup-i2c1.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17
18struct platform_device; /* don't need the contents */
19
20#include <linux/gpio.h>
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPD(5), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pc100/setup-ide.c b/arch/arm/mach-s5pc100/setup-ide.c
deleted file mode 100644
index 223aae044466..000000000000
--- a/arch/arm/mach-s5pc100/setup-ide.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-ide.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PC100 setup information for IDE
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/gpio.h>
15#include <linux/io.h>
16
17#include <mach/regs-clock.h>
18#include <plat/gpio-cfg.h>
19
20static void s5pc100_ide_cfg_gpios(unsigned int base, unsigned int nr)
21{
22 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(4));
23
24 for (; nr > 0; nr--, base++)
25 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
26}
27
28void s5pc100_ide_setup_gpio(void)
29{
30 u32 reg;
31
32 /* Independent CF interface, CF chip select configuration */
33 reg = readl(S5PC100_MEM_SYS_CFG) & (~0x3f);
34 writel(reg | MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S5PC100_MEM_SYS_CFG);
35
36 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
37 s5pc100_ide_cfg_gpios(S5PC100_GPJ0(0), 8);
38
39 /*CF_Data[0 - 7] */
40 s5pc100_ide_cfg_gpios(S5PC100_GPJ2(0), 8);
41
42 /* CF_Data[8 - 15] */
43 s5pc100_ide_cfg_gpios(S5PC100_GPJ3(0), 8);
44
45 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
46 s5pc100_ide_cfg_gpios(S5PC100_GPJ4(0), 4);
47
48 /* EBI_OE, EBI_WE */
49 s3c_gpio_cfgpin_range(S5PC100_GPK0(6), 2, S3C_GPIO_SFN(0));
50
51 /* CF_OE, CF_WE */
52 s3c_gpio_cfgrange_nopull(S5PC100_GPK1(6), 8, S3C_GPIO_SFN(2));
53
54 /* CF_CD */
55 s3c_gpio_cfgpin(S5PC100_GPK3(5), S3C_GPIO_SFN(2));
56 s3c_gpio_setpull(S5PC100_GPK3(5), S3C_GPIO_PULL_NONE);
57}
diff --git a/arch/arm/mach-s5pc100/setup-keypad.c b/arch/arm/mach-s5pc100/setup-keypad.c
deleted file mode 100644
index ada377f0c206..000000000000
--- a/arch/arm/mach-s5pc100/setup-keypad.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-keypad.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * GPIO configuration for S5PC100 KeyPad device
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/gpio.h>
14#include <plat/gpio-cfg.h>
15
16void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
17{
18 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
19 s3c_gpio_cfgrange_nopull(S5PC100_GPH3(0), rows, S3C_GPIO_SFN(3));
20
21 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
22 s3c_gpio_cfgrange_nopull(S5PC100_GPH2(0), cols, S3C_GPIO_SFN(3));
23}
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
deleted file mode 100644
index 6010c0310cb5..000000000000
--- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/* linux/arch/arm/plat-s5pc100/setup-sdhci-gpio.c
2 *
3 * Copyright 2009 Samsung Eletronics
4 *
5 * S5PC100 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18#include <linux/mmc/host.h>
19#include <linux/mmc/card.h>
20
21#include <plat/gpio-cfg.h>
22#include <plat/sdhci.h>
23
24void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{
26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27 unsigned int num;
28
29 num = width;
30 /* In case of 8 width, we should decrease the 2 */
31 if (width == 8)
32 num = width - 2;
33
34 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */
35 s3c_gpio_cfgrange_nopull(S5PC100_GPG0(0), 2 + num, S3C_GPIO_SFN(2));
36
37 if (width == 8)
38 s3c_gpio_cfgrange_nopull(S5PC100_GPG1(0), 2, S3C_GPIO_SFN(2));
39
40 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
41 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
42 s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
43 }
44}
45
46void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
47{
48 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
49
50 /* Set all the necessary GPG2 pins to special-function 2 */
51 s3c_gpio_cfgrange_nopull(S5PC100_GPG2(0), 2 + width, S3C_GPIO_SFN(2));
52
53 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
54 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
55 s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
56 }
57}
58
59void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
60{
61 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
62
63 /* Set all the necessary GPG3 pins to special-function 2 */
64 s3c_gpio_cfgrange_nopull(S5PC100_GPG3(0), 2 + width, S3C_GPIO_SFN(2));
65
66 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
67 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
68 s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));
69 }
70}
diff --git a/arch/arm/mach-s5pc100/setup-spi.c b/arch/arm/mach-s5pc100/setup-spi.c
deleted file mode 100644
index 183567961de1..000000000000
--- a/arch/arm/mach-s5pc100/setup-spi.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/* linux/arch/arm/mach-s5pc100/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void)
16{
17 s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
18 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
19 return 0;
20}
21#endif
22
23#ifdef CONFIG_S3C64XX_DEV_SPI1
24int s3c64xx_spi1_cfg_gpio(void)
25{
26 s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 return 0;
29}
30#endif
31
32#ifdef CONFIG_S3C64XX_DEV_SPI2
33int s3c64xx_spi2_cfg_gpio(void)
34{
35 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
36 s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
37 s3c_gpio_cfgall_range(S5PC100_GPB(2), 2,
38 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
39 return 0;
40}
41#endif
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index f60f2862856d..330bfc8fcd52 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -7,193 +7,28 @@
7 7
8# Configuration options for the S5PV210/S5PC110 8# Configuration options for the S5PV210/S5PC110
9 9
10config ARCH_S5PV210
11 bool "Samsung S5PV210/S5PC110" if ARCH_MULTI_V7
12 select ARCH_HAS_HOLES_MEMORYMODEL
13 select ARCH_REQUIRE_GPIOLIB
14 select ARM_VIC
15 select CLKSRC_SAMSUNG_PWM
16 select COMMON_CLK_SAMSUNG
17 select HAVE_S3C2410_I2C if I2C
18 select HAVE_S3C2410_WATCHDOG if WATCHDOG
19 select HAVE_S3C_RTC if RTC_CLASS
20 select PINCTRL
21 select PINCTRL_EXYNOS
22 help
23 Samsung S5PV210/S5PC110 series based systems
24
10if ARCH_S5PV210 25if ARCH_S5PV210
11 26
12config CPU_S5PV210 27config CPU_S5PV210
13 bool 28 def_bool y
14 select ARM_AMBA 29 select ARM_AMBA
15 select PL330_DMA if DMADEVICES 30 select PL330_DMA if DMADEVICES
16 select S5P_EXT_INT
17 select S5P_PM if PM
18 select S5P_SLEEP if PM
19 help 31 help
20 Enable S5PV210 CPU support 32 Enable S5PV210 CPU support
21 33
22config S5PV210_SETUP_I2C1
23 bool
24 help
25 Common setup code for i2c bus 1.
26
27config S5PV210_SETUP_I2C2
28 bool
29 help
30 Common setup code for i2c bus 2.
31
32config S5PV210_SETUP_IDE
33 bool
34 help
35 Common setup code for S5PV210 IDE GPIO configurations
36
37config S5PV210_SETUP_FB_24BPP
38 bool
39 help
40 Common setup code for S5PV210 with an 24bpp RGB display helper.
41
42config S5PV210_SETUP_KEYPAD
43 bool
44 help
45 Common setup code for keypad.
46
47config S5PV210_SETUP_SDHCI
48 bool
49 select S5PV210_SETUP_SDHCI_GPIO
50 help
51 Internal helper functions for S5PV210 based SDHCI systems
52
53config S5PV210_SETUP_SDHCI_GPIO
54 bool
55 help
56 Common setup code for SDHCI gpio.
57
58config S5PV210_SETUP_FIMC
59 bool
60 help
61 Common setup code for the camera interfaces.
62
63config S5PV210_SETUP_SPI
64 bool
65 help
66 Common setup code for SPI GPIO configurations.
67
68config S5PV210_SETUP_USB_PHY
69 bool
70 help
71 Common setup code for USB PHY controller
72
73menu "S5PC110 Machines"
74
75config MACH_AQUILA
76 bool "Aquila"
77 select CPU_S5PV210
78 select S3C_DEV_FB
79 select S3C_DEV_HSMMC
80 select S3C_DEV_HSMMC1
81 select S3C_DEV_HSMMC2
82 select S5PV210_SETUP_FB_24BPP
83 select S5PV210_SETUP_SDHCI
84 select S5PV210_SETUP_USB_PHY
85 select S5P_DEV_FIMC0
86 select S5P_DEV_FIMC1
87 select S5P_DEV_FIMC2
88 select S5P_DEV_ONENAND
89 help
90 Machine support for the Samsung Aquila target based on S5PC110 SoC
91
92config MACH_GONI
93 bool "GONI"
94 select CPU_S5PV210
95 select S3C_DEV_FB
96 select S3C_DEV_HSMMC
97 select S3C_DEV_HSMMC1
98 select S3C_DEV_HSMMC2
99 select S3C_DEV_I2C1
100 select S3C_DEV_I2C2
101 select S3C_DEV_USB_HSOTG
102 select S5PV210_SETUP_FB_24BPP
103 select S5PV210_SETUP_FIMC
104 select S5PV210_SETUP_I2C1
105 select S5PV210_SETUP_I2C2
106 select S5PV210_SETUP_KEYPAD
107 select S5PV210_SETUP_SDHCI
108 select S5PV210_SETUP_USB_PHY
109 select S5P_DEV_FIMC0
110 select S5P_DEV_FIMC1
111 select S5P_DEV_FIMC2
112 select S5P_DEV_MFC
113 select S5P_DEV_ONENAND
114 select S5P_DEV_TV
115 select S5P_GPIO_INT
116 select SAMSUNG_DEV_KEYPAD
117 help
118 Machine support for Samsung GONI board
119 S5PC110(MCP) is one of package option of S5PV210
120
121config MACH_SMDKC110
122 bool "SMDKC110"
123 select CPU_S5PV210
124 select S3C_DEV_I2C1
125 select S3C_DEV_I2C2
126 select S3C_DEV_RTC
127 select S3C_DEV_WDT
128 select S5PV210_SETUP_I2C1
129 select S5PV210_SETUP_I2C2
130 select S5PV210_SETUP_IDE
131 select S5P_DEV_FIMC0
132 select S5P_DEV_FIMC1
133 select S5P_DEV_FIMC2
134 select S5P_DEV_MFC
135 select SAMSUNG_DEV_IDE
136 help
137 Machine support for Samsung SMDKC110
138 S5PC110(MCP) is one of package option of S5PV210
139
140endmenu
141
142menu "S5PV210 Machines"
143
144config MACH_SMDKV210
145 bool "SMDKV210"
146 select CPU_S5PV210
147 select S3C_DEV_FB
148 select S3C_DEV_HSMMC
149 select S3C_DEV_HSMMC1
150 select S3C_DEV_HSMMC2
151 select S3C_DEV_HSMMC3
152 select S3C_DEV_I2C1
153 select S3C_DEV_I2C2
154 select S3C_DEV_RTC
155 select S3C_DEV_USB_HSOTG
156 select S3C_DEV_WDT
157 select S5PV210_SETUP_FB_24BPP
158 select S5PV210_SETUP_I2C1
159 select S5PV210_SETUP_I2C2
160 select S5PV210_SETUP_IDE
161 select S5PV210_SETUP_KEYPAD
162 select S5PV210_SETUP_SDHCI
163 select S5PV210_SETUP_USB_PHY
164 select S5P_DEV_FIMC0
165 select S5P_DEV_FIMC1
166 select S5P_DEV_FIMC2
167 select S5P_DEV_JPEG
168 select S5P_DEV_MFC
169 select SAMSUNG_DEV_ADC
170 select SAMSUNG_DEV_BACKLIGHT
171 select SAMSUNG_DEV_IDE
172 select SAMSUNG_DEV_KEYPAD
173 select SAMSUNG_DEV_PWM
174 select SAMSUNG_DEV_TS
175 help
176 Machine support for Samsung SMDKV210
177
178config MACH_TORBRECK
179 bool "Torbreck"
180 select ARCH_SPARSEMEM_ENABLE
181 select CPU_S5PV210
182 select S3C_DEV_HSMMC
183 select S3C_DEV_HSMMC1
184 select S3C_DEV_HSMMC2
185 select S3C_DEV_HSMMC3
186 select S3C_DEV_I2C1
187 select S3C_DEV_I2C2
188 select S3C_DEV_RTC
189 select S3C_DEV_WDT
190 select S5PV210_SETUP_I2C1
191 select S5PV210_SETUP_I2C2
192 select S5PV210_SETUP_SDHCI
193 select SAMSUNG_DEV_IDE
194 help
195 Machine support for aESOP Torbreck
196
197endmenu
198
199endif 34endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 1c4e41998a10..7dc2d0e25a83 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -5,6 +5,8 @@
5# 5#
6# Licensed under GPLv2 6# Licensed under GPLv2
7 7
8ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
9
8obj-y := 10obj-y :=
9obj-m := 11obj-m :=
10obj-n := 12obj-n :=
@@ -12,31 +14,8 @@ obj- :=
12 14
13# Core 15# Core
14 16
15obj-y += common.o clock.o 17obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o
16
17obj-$(CONFIG_PM) += pm.o
18
19obj-y += dma.o
20 18
21# machine support 19# machine support
22 20
23obj-$(CONFIG_MACH_AQUILA) += mach-aquila.o 21obj-y += s5pv210.o
24obj-$(CONFIG_MACH_GONI) += mach-goni.o
25obj-$(CONFIG_MACH_SMDKC110) += mach-smdkc110.o
26obj-$(CONFIG_MACH_SMDKV210) += mach-smdkv210.o
27obj-$(CONFIG_MACH_TORBRECK) += mach-torbreck.o
28
29# device support
30
31obj-y += dev-audio.o
32
33obj-y += setup-i2c0.o
34obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) += setup-fb-24bpp.o
35obj-$(CONFIG_S5PV210_SETUP_FIMC) += setup-fimc.o
36obj-$(CONFIG_S5PV210_SETUP_I2C1) += setup-i2c1.o
37obj-$(CONFIG_S5PV210_SETUP_I2C2) += setup-i2c2.o
38obj-$(CONFIG_S5PV210_SETUP_IDE) += setup-ide.o
39obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o
40obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
41obj-$(CONFIG_S5PV210_SETUP_SPI) += setup-spi.o
42obj-$(CONFIG_S5PV210_SETUP_USB_PHY) += setup-usb-phy.o
diff --git a/arch/arm/mach-s5pv210/Makefile.boot b/arch/arm/mach-s5pv210/Makefile.boot
deleted file mode 100644
index 79ece4055b02..000000000000
--- a/arch/arm/mach-s5pv210/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
deleted file mode 100644
index ca463724a3df..000000000000
--- a/arch/arm/mach-s5pv210/clock.c
+++ /dev/null
@@ -1,1365 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/clock.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - Clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/list.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/clk.h>
20#include <linux/device.h>
21#include <linux/io.h>
22
23#include <mach/map.h>
24
25#include <plat/cpu-freq.h>
26#include <mach/regs-clock.h>
27#include <plat/clock.h>
28#include <plat/cpu.h>
29#include <plat/pll.h>
30#include <plat/s5p-clock.h>
31#include <plat/clock-clksrc.h>
32
33#include "common.h"
34
35static unsigned long xtal;
36
37static struct clksrc_clk clk_mout_apll = {
38 .clk = {
39 .name = "mout_apll",
40 },
41 .sources = &clk_src_apll,
42 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 },
43};
44
45static struct clksrc_clk clk_mout_epll = {
46 .clk = {
47 .name = "mout_epll",
48 },
49 .sources = &clk_src_epll,
50 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 },
51};
52
53static struct clksrc_clk clk_mout_mpll = {
54 .clk = {
55 .name = "mout_mpll",
56 },
57 .sources = &clk_src_mpll,
58 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 },
59};
60
61static struct clk *clkset_armclk_list[] = {
62 [0] = &clk_mout_apll.clk,
63 [1] = &clk_mout_mpll.clk,
64};
65
66static struct clksrc_sources clkset_armclk = {
67 .sources = clkset_armclk_list,
68 .nr_sources = ARRAY_SIZE(clkset_armclk_list),
69};
70
71static struct clksrc_clk clk_armclk = {
72 .clk = {
73 .name = "armclk",
74 },
75 .sources = &clkset_armclk,
76 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 },
77 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 3 },
78};
79
80static struct clksrc_clk clk_hclk_msys = {
81 .clk = {
82 .name = "hclk_msys",
83 .parent = &clk_armclk.clk,
84 },
85 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 },
86};
87
88static struct clksrc_clk clk_pclk_msys = {
89 .clk = {
90 .name = "pclk_msys",
91 .parent = &clk_hclk_msys.clk,
92 },
93 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 },
94};
95
96static struct clksrc_clk clk_sclk_a2m = {
97 .clk = {
98 .name = "sclk_a2m",
99 .parent = &clk_mout_apll.clk,
100 },
101 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 },
102};
103
104static struct clk *clkset_hclk_sys_list[] = {
105 [0] = &clk_mout_mpll.clk,
106 [1] = &clk_sclk_a2m.clk,
107};
108
109static struct clksrc_sources clkset_hclk_sys = {
110 .sources = clkset_hclk_sys_list,
111 .nr_sources = ARRAY_SIZE(clkset_hclk_sys_list),
112};
113
114static struct clksrc_clk clk_hclk_dsys = {
115 .clk = {
116 .name = "hclk_dsys",
117 },
118 .sources = &clkset_hclk_sys,
119 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 },
120 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 },
121};
122
123static struct clksrc_clk clk_pclk_dsys = {
124 .clk = {
125 .name = "pclk_dsys",
126 .parent = &clk_hclk_dsys.clk,
127 },
128 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 },
129};
130
131static struct clksrc_clk clk_hclk_psys = {
132 .clk = {
133 .name = "hclk_psys",
134 },
135 .sources = &clkset_hclk_sys,
136 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 },
137 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 },
138};
139
140static struct clksrc_clk clk_pclk_psys = {
141 .clk = {
142 .name = "pclk_psys",
143 .parent = &clk_hclk_psys.clk,
144 },
145 .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 },
146};
147
148static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable)
149{
150 return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable);
151}
152
153static int s5pv210_clk_ip1_ctrl(struct clk *clk, int enable)
154{
155 return s5p_gatectrl(S5P_CLKGATE_IP1, clk, enable);
156}
157
158static int s5pv210_clk_ip2_ctrl(struct clk *clk, int enable)
159{
160 return s5p_gatectrl(S5P_CLKGATE_IP2, clk, enable);
161}
162
163static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable)
164{
165 return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable);
166}
167
168static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable)
169{
170 return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable);
171}
172
173static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable)
174{
175 return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable);
176}
177
178static int s5pv210_clk_hdmiphy_ctrl(struct clk *clk, int enable)
179{
180 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
181}
182
183static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
184{
185 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
186}
187
188static struct clk clk_sclk_hdmi27m = {
189 .name = "sclk_hdmi27m",
190 .rate = 27000000,
191};
192
193static struct clk clk_sclk_hdmiphy = {
194 .name = "sclk_hdmiphy",
195};
196
197static struct clk clk_sclk_usbphy0 = {
198 .name = "sclk_usbphy0",
199};
200
201static struct clk clk_sclk_usbphy1 = {
202 .name = "sclk_usbphy1",
203};
204
205static struct clk clk_pcmcdclk0 = {
206 .name = "pcmcdclk",
207};
208
209static struct clk clk_pcmcdclk1 = {
210 .name = "pcmcdclk",
211};
212
213static struct clk clk_pcmcdclk2 = {
214 .name = "pcmcdclk",
215};
216
217static struct clk *clkset_vpllsrc_list[] = {
218 [0] = &clk_fin_vpll,
219 [1] = &clk_sclk_hdmi27m,
220};
221
222static struct clksrc_sources clkset_vpllsrc = {
223 .sources = clkset_vpllsrc_list,
224 .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list),
225};
226
227static struct clksrc_clk clk_vpllsrc = {
228 .clk = {
229 .name = "vpll_src",
230 .enable = s5pv210_clk_mask0_ctrl,
231 .ctrlbit = (1 << 7),
232 },
233 .sources = &clkset_vpllsrc,
234 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 28, .size = 1 },
235};
236
237static struct clk *clkset_sclk_vpll_list[] = {
238 [0] = &clk_vpllsrc.clk,
239 [1] = &clk_fout_vpll,
240};
241
242static struct clksrc_sources clkset_sclk_vpll = {
243 .sources = clkset_sclk_vpll_list,
244 .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list),
245};
246
247static struct clksrc_clk clk_sclk_vpll = {
248 .clk = {
249 .name = "sclk_vpll",
250 },
251 .sources = &clkset_sclk_vpll,
252 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
253};
254
255static struct clk *clkset_moutdmc0src_list[] = {
256 [0] = &clk_sclk_a2m.clk,
257 [1] = &clk_mout_mpll.clk,
258 [2] = NULL,
259 [3] = NULL,
260};
261
262static struct clksrc_sources clkset_moutdmc0src = {
263 .sources = clkset_moutdmc0src_list,
264 .nr_sources = ARRAY_SIZE(clkset_moutdmc0src_list),
265};
266
267static struct clksrc_clk clk_mout_dmc0 = {
268 .clk = {
269 .name = "mout_dmc0",
270 },
271 .sources = &clkset_moutdmc0src,
272 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
273};
274
275static struct clksrc_clk clk_sclk_dmc0 = {
276 .clk = {
277 .name = "sclk_dmc0",
278 .parent = &clk_mout_dmc0.clk,
279 },
280 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
281};
282
283static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk)
284{
285 return clk_get_rate(clk->parent) / 2;
286}
287
288static struct clk_ops clk_hclk_imem_ops = {
289 .get_rate = s5pv210_clk_imem_get_rate,
290};
291
292static unsigned long s5pv210_clk_fout_apll_get_rate(struct clk *clk)
293{
294 return s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
295}
296
297static struct clk_ops clk_fout_apll_ops = {
298 .get_rate = s5pv210_clk_fout_apll_get_rate,
299};
300
301static struct clk init_clocks_off[] = {
302 {
303 .name = "rot",
304 .parent = &clk_hclk_dsys.clk,
305 .enable = s5pv210_clk_ip0_ctrl,
306 .ctrlbit = (1<<29),
307 }, {
308 .name = "fimc",
309 .devname = "s5pv210-fimc.0",
310 .parent = &clk_hclk_dsys.clk,
311 .enable = s5pv210_clk_ip0_ctrl,
312 .ctrlbit = (1 << 24),
313 }, {
314 .name = "fimc",
315 .devname = "s5pv210-fimc.1",
316 .parent = &clk_hclk_dsys.clk,
317 .enable = s5pv210_clk_ip0_ctrl,
318 .ctrlbit = (1 << 25),
319 }, {
320 .name = "fimc",
321 .devname = "s5pv210-fimc.2",
322 .parent = &clk_hclk_dsys.clk,
323 .enable = s5pv210_clk_ip0_ctrl,
324 .ctrlbit = (1 << 26),
325 }, {
326 .name = "jpeg",
327 .parent = &clk_hclk_dsys.clk,
328 .enable = s5pv210_clk_ip0_ctrl,
329 .ctrlbit = (1 << 28),
330 }, {
331 .name = "mfc",
332 .devname = "s5p-mfc",
333 .parent = &clk_pclk_psys.clk,
334 .enable = s5pv210_clk_ip0_ctrl,
335 .ctrlbit = (1 << 16),
336 }, {
337 .name = "dac",
338 .devname = "s5p-sdo",
339 .parent = &clk_hclk_dsys.clk,
340 .enable = s5pv210_clk_ip1_ctrl,
341 .ctrlbit = (1 << 10),
342 }, {
343 .name = "mixer",
344 .devname = "s5p-mixer",
345 .parent = &clk_hclk_dsys.clk,
346 .enable = s5pv210_clk_ip1_ctrl,
347 .ctrlbit = (1 << 9),
348 }, {
349 .name = "vp",
350 .devname = "s5p-mixer",
351 .parent = &clk_hclk_dsys.clk,
352 .enable = s5pv210_clk_ip1_ctrl,
353 .ctrlbit = (1 << 8),
354 }, {
355 .name = "hdmi",
356 .devname = "s5pv210-hdmi",
357 .parent = &clk_hclk_dsys.clk,
358 .enable = s5pv210_clk_ip1_ctrl,
359 .ctrlbit = (1 << 11),
360 }, {
361 .name = "hdmiphy",
362 .devname = "s5pv210-hdmi",
363 .enable = s5pv210_clk_hdmiphy_ctrl,
364 .ctrlbit = (1 << 0),
365 }, {
366 .name = "dacphy",
367 .devname = "s5p-sdo",
368 .enable = exynos4_clk_dac_ctrl,
369 .ctrlbit = (1 << 0),
370 }, {
371 .name = "otg",
372 .parent = &clk_hclk_psys.clk,
373 .enable = s5pv210_clk_ip1_ctrl,
374 .ctrlbit = (1<<16),
375 }, {
376 .name = "usb-host",
377 .parent = &clk_hclk_psys.clk,
378 .enable = s5pv210_clk_ip1_ctrl,
379 .ctrlbit = (1<<17),
380 }, {
381 .name = "lcd",
382 .parent = &clk_hclk_dsys.clk,
383 .enable = s5pv210_clk_ip1_ctrl,
384 .ctrlbit = (1<<0),
385 }, {
386 .name = "cfcon",
387 .parent = &clk_hclk_psys.clk,
388 .enable = s5pv210_clk_ip1_ctrl,
389 .ctrlbit = (1<<25),
390 }, {
391 .name = "systimer",
392 .parent = &clk_pclk_psys.clk,
393 .enable = s5pv210_clk_ip3_ctrl,
394 .ctrlbit = (1<<16),
395 }, {
396 .name = "watchdog",
397 .parent = &clk_pclk_psys.clk,
398 .enable = s5pv210_clk_ip3_ctrl,
399 .ctrlbit = (1<<22),
400 }, {
401 .name = "rtc",
402 .parent = &clk_pclk_psys.clk,
403 .enable = s5pv210_clk_ip3_ctrl,
404 .ctrlbit = (1<<15),
405 }, {
406 .name = "i2c",
407 .devname = "s3c2440-i2c.0",
408 .parent = &clk_pclk_psys.clk,
409 .enable = s5pv210_clk_ip3_ctrl,
410 .ctrlbit = (1<<7),
411 }, {
412 .name = "i2c",
413 .devname = "s3c2440-i2c.1",
414 .parent = &clk_pclk_psys.clk,
415 .enable = s5pv210_clk_ip3_ctrl,
416 .ctrlbit = (1 << 10),
417 }, {
418 .name = "i2c",
419 .devname = "s3c2440-i2c.2",
420 .parent = &clk_pclk_psys.clk,
421 .enable = s5pv210_clk_ip3_ctrl,
422 .ctrlbit = (1<<9),
423 }, {
424 .name = "i2c",
425 .devname = "s3c2440-hdmiphy-i2c",
426 .parent = &clk_pclk_psys.clk,
427 .enable = s5pv210_clk_ip3_ctrl,
428 .ctrlbit = (1 << 11),
429 }, {
430 .name = "spi",
431 .devname = "s5pv210-spi.0",
432 .parent = &clk_pclk_psys.clk,
433 .enable = s5pv210_clk_ip3_ctrl,
434 .ctrlbit = (1<<12),
435 }, {
436 .name = "spi",
437 .devname = "s5pv210-spi.1",
438 .parent = &clk_pclk_psys.clk,
439 .enable = s5pv210_clk_ip3_ctrl,
440 .ctrlbit = (1<<13),
441 }, {
442 .name = "spi",
443 .devname = "s5pv210-spi.2",
444 .parent = &clk_pclk_psys.clk,
445 .enable = s5pv210_clk_ip3_ctrl,
446 .ctrlbit = (1<<14),
447 }, {
448 .name = "timers",
449 .parent = &clk_pclk_psys.clk,
450 .enable = s5pv210_clk_ip3_ctrl,
451 .ctrlbit = (1<<23),
452 }, {
453 .name = "adc",
454 .parent = &clk_pclk_psys.clk,
455 .enable = s5pv210_clk_ip3_ctrl,
456 .ctrlbit = (1<<24),
457 }, {
458 .name = "keypad",
459 .parent = &clk_pclk_psys.clk,
460 .enable = s5pv210_clk_ip3_ctrl,
461 .ctrlbit = (1<<21),
462 }, {
463 .name = "iis",
464 .devname = "samsung-i2s.0",
465 .parent = &clk_p,
466 .enable = s5pv210_clk_ip3_ctrl,
467 .ctrlbit = (1<<4),
468 }, {
469 .name = "iis",
470 .devname = "samsung-i2s.1",
471 .parent = &clk_p,
472 .enable = s5pv210_clk_ip3_ctrl,
473 .ctrlbit = (1 << 5),
474 }, {
475 .name = "iis",
476 .devname = "samsung-i2s.2",
477 .parent = &clk_p,
478 .enable = s5pv210_clk_ip3_ctrl,
479 .ctrlbit = (1 << 6),
480 }, {
481 .name = "spdif",
482 .parent = &clk_p,
483 .enable = s5pv210_clk_ip3_ctrl,
484 .ctrlbit = (1 << 0),
485 },
486};
487
488static struct clk init_clocks[] = {
489 {
490 .name = "hclk_imem",
491 .parent = &clk_hclk_msys.clk,
492 .ctrlbit = (1 << 5),
493 .enable = s5pv210_clk_ip0_ctrl,
494 .ops = &clk_hclk_imem_ops,
495 }, {
496 .name = "uart",
497 .devname = "s5pv210-uart.0",
498 .parent = &clk_pclk_psys.clk,
499 .enable = s5pv210_clk_ip3_ctrl,
500 .ctrlbit = (1 << 17),
501 }, {
502 .name = "uart",
503 .devname = "s5pv210-uart.1",
504 .parent = &clk_pclk_psys.clk,
505 .enable = s5pv210_clk_ip3_ctrl,
506 .ctrlbit = (1 << 18),
507 }, {
508 .name = "uart",
509 .devname = "s5pv210-uart.2",
510 .parent = &clk_pclk_psys.clk,
511 .enable = s5pv210_clk_ip3_ctrl,
512 .ctrlbit = (1 << 19),
513 }, {
514 .name = "uart",
515 .devname = "s5pv210-uart.3",
516 .parent = &clk_pclk_psys.clk,
517 .enable = s5pv210_clk_ip3_ctrl,
518 .ctrlbit = (1 << 20),
519 }, {
520 .name = "sromc",
521 .parent = &clk_hclk_psys.clk,
522 .enable = s5pv210_clk_ip1_ctrl,
523 .ctrlbit = (1 << 26),
524 },
525};
526
527static struct clk clk_hsmmc0 = {
528 .name = "hsmmc",
529 .devname = "s3c-sdhci.0",
530 .parent = &clk_hclk_psys.clk,
531 .enable = s5pv210_clk_ip2_ctrl,
532 .ctrlbit = (1<<16),
533};
534
535static struct clk clk_hsmmc1 = {
536 .name = "hsmmc",
537 .devname = "s3c-sdhci.1",
538 .parent = &clk_hclk_psys.clk,
539 .enable = s5pv210_clk_ip2_ctrl,
540 .ctrlbit = (1<<17),
541};
542
543static struct clk clk_hsmmc2 = {
544 .name = "hsmmc",
545 .devname = "s3c-sdhci.2",
546 .parent = &clk_hclk_psys.clk,
547 .enable = s5pv210_clk_ip2_ctrl,
548 .ctrlbit = (1<<18),
549};
550
551static struct clk clk_hsmmc3 = {
552 .name = "hsmmc",
553 .devname = "s3c-sdhci.3",
554 .parent = &clk_hclk_psys.clk,
555 .enable = s5pv210_clk_ip2_ctrl,
556 .ctrlbit = (1<<19),
557};
558
559static struct clk clk_pdma0 = {
560 .name = "pdma0",
561 .parent = &clk_hclk_psys.clk,
562 .enable = s5pv210_clk_ip0_ctrl,
563 .ctrlbit = (1 << 3),
564};
565
566static struct clk clk_pdma1 = {
567 .name = "pdma1",
568 .parent = &clk_hclk_psys.clk,
569 .enable = s5pv210_clk_ip0_ctrl,
570 .ctrlbit = (1 << 4),
571};
572
573static struct clk *clkset_uart_list[] = {
574 [6] = &clk_mout_mpll.clk,
575 [7] = &clk_mout_epll.clk,
576};
577
578static struct clksrc_sources clkset_uart = {
579 .sources = clkset_uart_list,
580 .nr_sources = ARRAY_SIZE(clkset_uart_list),
581};
582
583static struct clk *clkset_group1_list[] = {
584 [0] = &clk_sclk_a2m.clk,
585 [1] = &clk_mout_mpll.clk,
586 [2] = &clk_mout_epll.clk,
587 [3] = &clk_sclk_vpll.clk,
588};
589
590static struct clksrc_sources clkset_group1 = {
591 .sources = clkset_group1_list,
592 .nr_sources = ARRAY_SIZE(clkset_group1_list),
593};
594
595static struct clk *clkset_sclk_onenand_list[] = {
596 [0] = &clk_hclk_psys.clk,
597 [1] = &clk_hclk_dsys.clk,
598};
599
600static struct clksrc_sources clkset_sclk_onenand = {
601 .sources = clkset_sclk_onenand_list,
602 .nr_sources = ARRAY_SIZE(clkset_sclk_onenand_list),
603};
604
605static struct clk *clkset_sclk_dac_list[] = {
606 [0] = &clk_sclk_vpll.clk,
607 [1] = &clk_sclk_hdmiphy,
608};
609
610static struct clksrc_sources clkset_sclk_dac = {
611 .sources = clkset_sclk_dac_list,
612 .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list),
613};
614
615static struct clksrc_clk clk_sclk_dac = {
616 .clk = {
617 .name = "sclk_dac",
618 .enable = s5pv210_clk_mask0_ctrl,
619 .ctrlbit = (1 << 2),
620 },
621 .sources = &clkset_sclk_dac,
622 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 1 },
623};
624
625static struct clksrc_clk clk_sclk_pixel = {
626 .clk = {
627 .name = "sclk_pixel",
628 .parent = &clk_sclk_vpll.clk,
629 },
630 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4},
631};
632
633static struct clk *clkset_sclk_hdmi_list[] = {
634 [0] = &clk_sclk_pixel.clk,
635 [1] = &clk_sclk_hdmiphy,
636};
637
638static struct clksrc_sources clkset_sclk_hdmi = {
639 .sources = clkset_sclk_hdmi_list,
640 .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list),
641};
642
643static struct clksrc_clk clk_sclk_hdmi = {
644 .clk = {
645 .name = "sclk_hdmi",
646 .enable = s5pv210_clk_mask0_ctrl,
647 .ctrlbit = (1 << 0),
648 },
649 .sources = &clkset_sclk_hdmi,
650 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 },
651};
652
653static struct clk *clkset_sclk_mixer_list[] = {
654 [0] = &clk_sclk_dac.clk,
655 [1] = &clk_sclk_hdmi.clk,
656};
657
658static struct clksrc_sources clkset_sclk_mixer = {
659 .sources = clkset_sclk_mixer_list,
660 .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list),
661};
662
663static struct clksrc_clk clk_sclk_mixer = {
664 .clk = {
665 .name = "sclk_mixer",
666 .enable = s5pv210_clk_mask0_ctrl,
667 .ctrlbit = (1 << 1),
668 },
669 .sources = &clkset_sclk_mixer,
670 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 },
671};
672
673static struct clksrc_clk *sclk_tv[] = {
674 &clk_sclk_dac,
675 &clk_sclk_pixel,
676 &clk_sclk_hdmi,
677 &clk_sclk_mixer,
678};
679
680static struct clk *clkset_sclk_audio0_list[] = {
681 [0] = &clk_ext_xtal_mux,
682 [1] = &clk_pcmcdclk0,
683 [2] = &clk_sclk_hdmi27m,
684 [3] = &clk_sclk_usbphy0,
685 [4] = &clk_sclk_usbphy1,
686 [5] = &clk_sclk_hdmiphy,
687 [6] = &clk_mout_mpll.clk,
688 [7] = &clk_mout_epll.clk,
689 [8] = &clk_sclk_vpll.clk,
690};
691
692static struct clksrc_sources clkset_sclk_audio0 = {
693 .sources = clkset_sclk_audio0_list,
694 .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list),
695};
696
697static struct clksrc_clk clk_sclk_audio0 = {
698 .clk = {
699 .name = "sclk_audio",
700 .devname = "soc-audio.0",
701 .enable = s5pv210_clk_mask0_ctrl,
702 .ctrlbit = (1 << 24),
703 },
704 .sources = &clkset_sclk_audio0,
705 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 0, .size = 4 },
706 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 0, .size = 4 },
707};
708
709static struct clk *clkset_sclk_audio1_list[] = {
710 [0] = &clk_ext_xtal_mux,
711 [1] = &clk_pcmcdclk1,
712 [2] = &clk_sclk_hdmi27m,
713 [3] = &clk_sclk_usbphy0,
714 [4] = &clk_sclk_usbphy1,
715 [5] = &clk_sclk_hdmiphy,
716 [6] = &clk_mout_mpll.clk,
717 [7] = &clk_mout_epll.clk,
718 [8] = &clk_sclk_vpll.clk,
719};
720
721static struct clksrc_sources clkset_sclk_audio1 = {
722 .sources = clkset_sclk_audio1_list,
723 .nr_sources = ARRAY_SIZE(clkset_sclk_audio1_list),
724};
725
726static struct clksrc_clk clk_sclk_audio1 = {
727 .clk = {
728 .name = "sclk_audio",
729 .devname = "soc-audio.1",
730 .enable = s5pv210_clk_mask0_ctrl,
731 .ctrlbit = (1 << 25),
732 },
733 .sources = &clkset_sclk_audio1,
734 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 4, .size = 4 },
735 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 4, .size = 4 },
736};
737
738static struct clk *clkset_sclk_audio2_list[] = {
739 [0] = &clk_ext_xtal_mux,
740 [1] = &clk_pcmcdclk0,
741 [2] = &clk_sclk_hdmi27m,
742 [3] = &clk_sclk_usbphy0,
743 [4] = &clk_sclk_usbphy1,
744 [5] = &clk_sclk_hdmiphy,
745 [6] = &clk_mout_mpll.clk,
746 [7] = &clk_mout_epll.clk,
747 [8] = &clk_sclk_vpll.clk,
748};
749
750static struct clksrc_sources clkset_sclk_audio2 = {
751 .sources = clkset_sclk_audio2_list,
752 .nr_sources = ARRAY_SIZE(clkset_sclk_audio2_list),
753};
754
755static struct clksrc_clk clk_sclk_audio2 = {
756 .clk = {
757 .name = "sclk_audio",
758 .devname = "soc-audio.2",
759 .enable = s5pv210_clk_mask0_ctrl,
760 .ctrlbit = (1 << 26),
761 },
762 .sources = &clkset_sclk_audio2,
763 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 8, .size = 4 },
764 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 8, .size = 4 },
765};
766
767static struct clk *clkset_sclk_spdif_list[] = {
768 [0] = &clk_sclk_audio0.clk,
769 [1] = &clk_sclk_audio1.clk,
770 [2] = &clk_sclk_audio2.clk,
771};
772
773static struct clksrc_sources clkset_sclk_spdif = {
774 .sources = clkset_sclk_spdif_list,
775 .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list),
776};
777
778static struct clksrc_clk clk_sclk_spdif = {
779 .clk = {
780 .name = "sclk_spdif",
781 .enable = s5pv210_clk_mask0_ctrl,
782 .ctrlbit = (1 << 27),
783 .ops = &s5p_sclk_spdif_ops,
784 },
785 .sources = &clkset_sclk_spdif,
786 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 },
787};
788
789static struct clk *clkset_group2_list[] = {
790 [0] = &clk_ext_xtal_mux,
791 [1] = &clk_xusbxti,
792 [2] = &clk_sclk_hdmi27m,
793 [3] = &clk_sclk_usbphy0,
794 [4] = &clk_sclk_usbphy1,
795 [5] = &clk_sclk_hdmiphy,
796 [6] = &clk_mout_mpll.clk,
797 [7] = &clk_mout_epll.clk,
798 [8] = &clk_sclk_vpll.clk,
799};
800
801static struct clksrc_sources clkset_group2 = {
802 .sources = clkset_group2_list,
803 .nr_sources = ARRAY_SIZE(clkset_group2_list),
804};
805
806static struct clksrc_clk clksrcs[] = {
807 {
808 .clk = {
809 .name = "sclk_dmc",
810 },
811 .sources = &clkset_group1,
812 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
813 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
814 }, {
815 .clk = {
816 .name = "sclk_onenand",
817 },
818 .sources = &clkset_sclk_onenand,
819 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 },
820 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 12, .size = 3 },
821 }, {
822 .clk = {
823 .name = "sclk_fimc",
824 .devname = "s5pv210-fimc.0",
825 .enable = s5pv210_clk_mask1_ctrl,
826 .ctrlbit = (1 << 2),
827 },
828 .sources = &clkset_group2,
829 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 4 },
830 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 },
831 }, {
832 .clk = {
833 .name = "sclk_fimc",
834 .devname = "s5pv210-fimc.1",
835 .enable = s5pv210_clk_mask1_ctrl,
836 .ctrlbit = (1 << 3),
837 },
838 .sources = &clkset_group2,
839 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 4 },
840 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 },
841 }, {
842 .clk = {
843 .name = "sclk_fimc",
844 .devname = "s5pv210-fimc.2",
845 .enable = s5pv210_clk_mask1_ctrl,
846 .ctrlbit = (1 << 4),
847 },
848 .sources = &clkset_group2,
849 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 4 },
850 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
851 }, {
852 .clk = {
853 .name = "sclk_cam0",
854 .enable = s5pv210_clk_mask0_ctrl,
855 .ctrlbit = (1 << 3),
856 },
857 .sources = &clkset_group2,
858 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 4 },
859 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 },
860 }, {
861 .clk = {
862 .name = "sclk_cam1",
863 .enable = s5pv210_clk_mask0_ctrl,
864 .ctrlbit = (1 << 4),
865 },
866 .sources = &clkset_group2,
867 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 4 },
868 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 4 },
869 }, {
870 .clk = {
871 .name = "sclk_fimd",
872 .enable = s5pv210_clk_mask0_ctrl,
873 .ctrlbit = (1 << 5),
874 },
875 .sources = &clkset_group2,
876 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 4 },
877 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 4 },
878 }, {
879 .clk = {
880 .name = "sclk_mfc",
881 .devname = "s5p-mfc",
882 .enable = s5pv210_clk_ip0_ctrl,
883 .ctrlbit = (1 << 16),
884 },
885 .sources = &clkset_group1,
886 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 },
887 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 },
888 }, {
889 .clk = {
890 .name = "sclk_g2d",
891 .enable = s5pv210_clk_ip0_ctrl,
892 .ctrlbit = (1 << 12),
893 },
894 .sources = &clkset_group1,
895 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 },
896 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 },
897 }, {
898 .clk = {
899 .name = "sclk_g3d",
900 .enable = s5pv210_clk_ip0_ctrl,
901 .ctrlbit = (1 << 8),
902 },
903 .sources = &clkset_group1,
904 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 },
905 .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 },
906 }, {
907 .clk = {
908 .name = "sclk_csis",
909 .enable = s5pv210_clk_mask0_ctrl,
910 .ctrlbit = (1 << 6),
911 },
912 .sources = &clkset_group2,
913 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 4 },
914 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 28, .size = 4 },
915 }, {
916 .clk = {
917 .name = "sclk_pwi",
918 .enable = s5pv210_clk_mask0_ctrl,
919 .ctrlbit = (1 << 29),
920 },
921 .sources = &clkset_group2,
922 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 20, .size = 4 },
923 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 24, .size = 4 },
924 }, {
925 .clk = {
926 .name = "sclk_pwm",
927 .enable = s5pv210_clk_mask0_ctrl,
928 .ctrlbit = (1 << 19),
929 },
930 .sources = &clkset_group2,
931 .reg_src = { .reg = S5P_CLK_SRC5, .shift = 12, .size = 4 },
932 .reg_div = { .reg = S5P_CLK_DIV5, .shift = 12, .size = 4 },
933 },
934};
935
936static struct clksrc_clk clk_sclk_uart0 = {
937 .clk = {
938 .name = "uclk1",
939 .devname = "s5pv210-uart.0",
940 .enable = s5pv210_clk_mask0_ctrl,
941 .ctrlbit = (1 << 12),
942 },
943 .sources = &clkset_uart,
944 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 16, .size = 4 },
945 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
946};
947
948static struct clksrc_clk clk_sclk_uart1 = {
949 .clk = {
950 .name = "uclk1",
951 .devname = "s5pv210-uart.1",
952 .enable = s5pv210_clk_mask0_ctrl,
953 .ctrlbit = (1 << 13),
954 },
955 .sources = &clkset_uart,
956 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 20, .size = 4 },
957 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
958};
959
960static struct clksrc_clk clk_sclk_uart2 = {
961 .clk = {
962 .name = "uclk1",
963 .devname = "s5pv210-uart.2",
964 .enable = s5pv210_clk_mask0_ctrl,
965 .ctrlbit = (1 << 14),
966 },
967 .sources = &clkset_uart,
968 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 24, .size = 4 },
969 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 24, .size = 4 },
970};
971
972static struct clksrc_clk clk_sclk_uart3 = {
973 .clk = {
974 .name = "uclk1",
975 .devname = "s5pv210-uart.3",
976 .enable = s5pv210_clk_mask0_ctrl,
977 .ctrlbit = (1 << 15),
978 },
979 .sources = &clkset_uart,
980 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 28, .size = 4 },
981 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 28, .size = 4 },
982};
983
984static struct clksrc_clk clk_sclk_mmc0 = {
985 .clk = {
986 .name = "sclk_mmc",
987 .devname = "s3c-sdhci.0",
988 .enable = s5pv210_clk_mask0_ctrl,
989 .ctrlbit = (1 << 8),
990 },
991 .sources = &clkset_group2,
992 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 0, .size = 4 },
993 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 4 },
994};
995
996static struct clksrc_clk clk_sclk_mmc1 = {
997 .clk = {
998 .name = "sclk_mmc",
999 .devname = "s3c-sdhci.1",
1000 .enable = s5pv210_clk_mask0_ctrl,
1001 .ctrlbit = (1 << 9),
1002 },
1003 .sources = &clkset_group2,
1004 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 4, .size = 4 },
1005 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 4, .size = 4 },
1006};
1007
1008static struct clksrc_clk clk_sclk_mmc2 = {
1009 .clk = {
1010 .name = "sclk_mmc",
1011 .devname = "s3c-sdhci.2",
1012 .enable = s5pv210_clk_mask0_ctrl,
1013 .ctrlbit = (1 << 10),
1014 },
1015 .sources = &clkset_group2,
1016 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 8, .size = 4 },
1017 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 8, .size = 4 },
1018};
1019
1020static struct clksrc_clk clk_sclk_mmc3 = {
1021 .clk = {
1022 .name = "sclk_mmc",
1023 .devname = "s3c-sdhci.3",
1024 .enable = s5pv210_clk_mask0_ctrl,
1025 .ctrlbit = (1 << 11),
1026 },
1027 .sources = &clkset_group2,
1028 .reg_src = { .reg = S5P_CLK_SRC4, .shift = 12, .size = 4 },
1029 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
1030};
1031
1032static struct clksrc_clk clk_sclk_spi0 = {
1033 .clk = {
1034 .name = "sclk_spi",
1035 .devname = "s5pv210-spi.0",
1036 .enable = s5pv210_clk_mask0_ctrl,
1037 .ctrlbit = (1 << 16),
1038 },
1039 .sources = &clkset_group2,
1040 .reg_src = { .reg = S5P_CLK_SRC5, .shift = 0, .size = 4 },
1041 .reg_div = { .reg = S5P_CLK_DIV5, .shift = 0, .size = 4 },
1042 };
1043
1044static struct clksrc_clk clk_sclk_spi1 = {
1045 .clk = {
1046 .name = "sclk_spi",
1047 .devname = "s5pv210-spi.1",
1048 .enable = s5pv210_clk_mask0_ctrl,
1049 .ctrlbit = (1 << 17),
1050 },
1051 .sources = &clkset_group2,
1052 .reg_src = { .reg = S5P_CLK_SRC5, .shift = 4, .size = 4 },
1053 .reg_div = { .reg = S5P_CLK_DIV5, .shift = 4, .size = 4 },
1054 };
1055
1056
1057static struct clksrc_clk *clksrc_cdev[] = {
1058 &clk_sclk_uart0,
1059 &clk_sclk_uart1,
1060 &clk_sclk_uart2,
1061 &clk_sclk_uart3,
1062 &clk_sclk_mmc0,
1063 &clk_sclk_mmc1,
1064 &clk_sclk_mmc2,
1065 &clk_sclk_mmc3,
1066 &clk_sclk_spi0,
1067 &clk_sclk_spi1,
1068};
1069
1070static struct clk *clk_cdev[] = {
1071 &clk_hsmmc0,
1072 &clk_hsmmc1,
1073 &clk_hsmmc2,
1074 &clk_hsmmc3,
1075 &clk_pdma0,
1076 &clk_pdma1,
1077};
1078
1079/* Clock initialisation code */
1080static struct clksrc_clk *sysclks[] = {
1081 &clk_mout_apll,
1082 &clk_mout_epll,
1083 &clk_mout_mpll,
1084 &clk_armclk,
1085 &clk_hclk_msys,
1086 &clk_sclk_a2m,
1087 &clk_hclk_dsys,
1088 &clk_hclk_psys,
1089 &clk_pclk_msys,
1090 &clk_pclk_dsys,
1091 &clk_pclk_psys,
1092 &clk_vpllsrc,
1093 &clk_sclk_vpll,
1094 &clk_mout_dmc0,
1095 &clk_sclk_dmc0,
1096 &clk_sclk_audio0,
1097 &clk_sclk_audio1,
1098 &clk_sclk_audio2,
1099 &clk_sclk_spdif,
1100};
1101
1102static u32 epll_div[][6] = {
1103 { 48000000, 0, 48, 3, 3, 0 },
1104 { 96000000, 0, 48, 3, 2, 0 },
1105 { 144000000, 1, 72, 3, 2, 0 },
1106 { 192000000, 0, 48, 3, 1, 0 },
1107 { 288000000, 1, 72, 3, 1, 0 },
1108 { 32750000, 1, 65, 3, 4, 35127 },
1109 { 32768000, 1, 65, 3, 4, 35127 },
1110 { 45158400, 0, 45, 3, 3, 10355 },
1111 { 45000000, 0, 45, 3, 3, 10355 },
1112 { 45158000, 0, 45, 3, 3, 10355 },
1113 { 49125000, 0, 49, 3, 3, 9961 },
1114 { 49152000, 0, 49, 3, 3, 9961 },
1115 { 67737600, 1, 67, 3, 3, 48366 },
1116 { 67738000, 1, 67, 3, 3, 48366 },
1117 { 73800000, 1, 73, 3, 3, 47710 },
1118 { 73728000, 1, 73, 3, 3, 47710 },
1119 { 36000000, 1, 32, 3, 4, 0 },
1120 { 60000000, 1, 60, 3, 3, 0 },
1121 { 72000000, 1, 72, 3, 3, 0 },
1122 { 80000000, 1, 80, 3, 3, 0 },
1123 { 84000000, 0, 42, 3, 2, 0 },
1124 { 50000000, 0, 50, 3, 3, 0 },
1125};
1126
1127static int s5pv210_epll_set_rate(struct clk *clk, unsigned long rate)
1128{
1129 unsigned int epll_con, epll_con_k;
1130 unsigned int i;
1131
1132 /* Return if nothing changed */
1133 if (clk->rate == rate)
1134 return 0;
1135
1136 epll_con = __raw_readl(S5P_EPLL_CON);
1137 epll_con_k = __raw_readl(S5P_EPLL_CON1);
1138
1139 epll_con_k &= ~PLL46XX_KDIV_MASK;
1140 epll_con &= ~(1 << 27 |
1141 PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT |
1142 PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT |
1143 PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1144
1145 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
1146 if (epll_div[i][0] == rate) {
1147 epll_con_k |= epll_div[i][5] << 0;
1148 epll_con |= (epll_div[i][1] << 27 |
1149 epll_div[i][2] << PLL46XX_MDIV_SHIFT |
1150 epll_div[i][3] << PLL46XX_PDIV_SHIFT |
1151 epll_div[i][4] << PLL46XX_SDIV_SHIFT);
1152 break;
1153 }
1154 }
1155
1156 if (i == ARRAY_SIZE(epll_div)) {
1157 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
1158 __func__);
1159 return -EINVAL;
1160 }
1161
1162 __raw_writel(epll_con, S5P_EPLL_CON);
1163 __raw_writel(epll_con_k, S5P_EPLL_CON1);
1164
1165 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
1166 clk->rate, rate);
1167
1168 clk->rate = rate;
1169
1170 return 0;
1171}
1172
1173static struct clk_ops s5pv210_epll_ops = {
1174 .set_rate = s5pv210_epll_set_rate,
1175 .get_rate = s5p_epll_get_rate,
1176};
1177
1178static u32 vpll_div[][5] = {
1179 { 54000000, 3, 53, 3, 0 },
1180 { 108000000, 3, 53, 2, 0 },
1181};
1182
1183static unsigned long s5pv210_vpll_get_rate(struct clk *clk)
1184{
1185 return clk->rate;
1186}
1187
1188static int s5pv210_vpll_set_rate(struct clk *clk, unsigned long rate)
1189{
1190 unsigned int vpll_con;
1191 unsigned int i;
1192
1193 /* Return if nothing changed */
1194 if (clk->rate == rate)
1195 return 0;
1196
1197 vpll_con = __raw_readl(S5P_VPLL_CON);
1198 vpll_con &= ~(0x1 << 27 | \
1199 PLL90XX_MDIV_MASK << PLL90XX_MDIV_SHIFT | \
1200 PLL90XX_PDIV_MASK << PLL90XX_PDIV_SHIFT | \
1201 PLL90XX_SDIV_MASK << PLL90XX_SDIV_SHIFT);
1202
1203 for (i = 0; i < ARRAY_SIZE(vpll_div); i++) {
1204 if (vpll_div[i][0] == rate) {
1205 vpll_con |= vpll_div[i][1] << PLL90XX_PDIV_SHIFT;
1206 vpll_con |= vpll_div[i][2] << PLL90XX_MDIV_SHIFT;
1207 vpll_con |= vpll_div[i][3] << PLL90XX_SDIV_SHIFT;
1208 vpll_con |= vpll_div[i][4] << 27;
1209 break;
1210 }
1211 }
1212
1213 if (i == ARRAY_SIZE(vpll_div)) {
1214 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1215 __func__);
1216 return -EINVAL;
1217 }
1218
1219 __raw_writel(vpll_con, S5P_VPLL_CON);
1220
1221 /* Wait for VPLL lock */
1222 while (!(__raw_readl(S5P_VPLL_CON) & (1 << PLL90XX_LOCKED_SHIFT)))
1223 continue;
1224
1225 clk->rate = rate;
1226 return 0;
1227}
1228static struct clk_ops s5pv210_vpll_ops = {
1229 .get_rate = s5pv210_vpll_get_rate,
1230 .set_rate = s5pv210_vpll_set_rate,
1231};
1232
1233void __init_or_cpufreq s5pv210_setup_clocks(void)
1234{
1235 struct clk *xtal_clk;
1236 unsigned long vpllsrc;
1237 unsigned long armclk;
1238 unsigned long hclk_msys;
1239 unsigned long hclk_dsys;
1240 unsigned long hclk_psys;
1241 unsigned long pclk_msys;
1242 unsigned long pclk_dsys;
1243 unsigned long pclk_psys;
1244 unsigned long apll;
1245 unsigned long mpll;
1246 unsigned long epll;
1247 unsigned long vpll;
1248 unsigned int ptr;
1249 u32 clkdiv0, clkdiv1;
1250
1251 /* Set functions for clk_fout_epll */
1252 clk_fout_epll.enable = s5p_epll_enable;
1253 clk_fout_epll.ops = &s5pv210_epll_ops;
1254
1255 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1256
1257 clkdiv0 = __raw_readl(S5P_CLK_DIV0);
1258 clkdiv1 = __raw_readl(S5P_CLK_DIV1);
1259
1260 printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n",
1261 __func__, clkdiv0, clkdiv1);
1262
1263 xtal_clk = clk_get(NULL, "xtal");
1264 BUG_ON(IS_ERR(xtal_clk));
1265
1266 xtal = clk_get_rate(xtal_clk);
1267 clk_put(xtal_clk);
1268
1269 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1270
1271 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
1272 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
1273 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON),
1274 __raw_readl(S5P_EPLL_CON1), pll_4600);
1275 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1276 vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502);
1277
1278 clk_fout_apll.ops = &clk_fout_apll_ops;
1279 clk_fout_mpll.rate = mpll;
1280 clk_fout_epll.rate = epll;
1281 clk_fout_vpll.ops = &s5pv210_vpll_ops;
1282 clk_fout_vpll.rate = vpll;
1283
1284 printk(KERN_INFO "S5PV210: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1285 apll, mpll, epll, vpll);
1286
1287 armclk = clk_get_rate(&clk_armclk.clk);
1288 hclk_msys = clk_get_rate(&clk_hclk_msys.clk);
1289 hclk_dsys = clk_get_rate(&clk_hclk_dsys.clk);
1290 hclk_psys = clk_get_rate(&clk_hclk_psys.clk);
1291 pclk_msys = clk_get_rate(&clk_pclk_msys.clk);
1292 pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk);
1293 pclk_psys = clk_get_rate(&clk_pclk_psys.clk);
1294
1295 printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n"
1296 "HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n",
1297 armclk, hclk_msys, hclk_dsys, hclk_psys,
1298 pclk_msys, pclk_dsys, pclk_psys);
1299
1300 clk_f.rate = armclk;
1301 clk_h.rate = hclk_psys;
1302 clk_p.rate = pclk_psys;
1303
1304 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
1305 s3c_set_clksrc(&clksrcs[ptr], true);
1306}
1307
1308static struct clk *clks[] __initdata = {
1309 &clk_sclk_hdmi27m,
1310 &clk_sclk_hdmiphy,
1311 &clk_sclk_usbphy0,
1312 &clk_sclk_usbphy1,
1313 &clk_pcmcdclk0,
1314 &clk_pcmcdclk1,
1315 &clk_pcmcdclk2,
1316};
1317
1318static struct clk_lookup s5pv210_clk_lookup[] = {
1319 CLKDEV_INIT(NULL, "clk_uart_baud0", &clk_p),
1320 CLKDEV_INIT("s5pv210-uart.0", "clk_uart_baud1", &clk_sclk_uart0.clk),
1321 CLKDEV_INIT("s5pv210-uart.1", "clk_uart_baud1", &clk_sclk_uart1.clk),
1322 CLKDEV_INIT("s5pv210-uart.2", "clk_uart_baud1", &clk_sclk_uart2.clk),
1323 CLKDEV_INIT("s5pv210-uart.3", "clk_uart_baud1", &clk_sclk_uart3.clk),
1324 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &clk_hsmmc0),
1325 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &clk_hsmmc1),
1326 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.0", &clk_hsmmc2),
1327 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.0", &clk_hsmmc3),
1328 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
1329 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1330 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1331 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
1332 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1333 CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
1334 CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
1335 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1336 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
1337};
1338
1339void __init s5pv210_register_clocks(void)
1340{
1341 int ptr;
1342
1343 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1344
1345 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1346 s3c_register_clksrc(sysclks[ptr], 1);
1347
1348 for (ptr = 0; ptr < ARRAY_SIZE(sclk_tv); ptr++)
1349 s3c_register_clksrc(sclk_tv[ptr], 1);
1350
1351 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_cdev); ptr++)
1352 s3c_register_clksrc(clksrc_cdev[ptr], 1);
1353
1354 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1355 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1356
1357 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1358 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1359 clkdev_add_table(s5pv210_clk_lookup, ARRAY_SIZE(s5pv210_clk_lookup));
1360
1361 s3c24xx_register_clocks(clk_cdev, ARRAY_SIZE(clk_cdev));
1362 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1363 s3c_disable_clocks(clk_cdev[ptr], 1);
1364
1365}
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
deleted file mode 100644
index 7024dcd0e40a..000000000000
--- a/arch/arm/mach-s5pv210/common.c
+++ /dev/null
@@ -1,279 +0,0 @@
1/*
2 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Codes for S5PV210
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21#include <linux/device.h>
22#include <clocksource/samsung_pwm.h>
23#include <linux/platform_device.h>
24#include <linux/sched.h>
25#include <linux/dma-mapping.h>
26#include <linux/serial_core.h>
27#include <linux/serial_s3c.h>
28
29#include <asm/proc-fns.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32#include <asm/mach/irq.h>
33
34#include <mach/map.h>
35#include <mach/regs-clock.h>
36
37#include <plat/cpu.h>
38#include <plat/clock.h>
39#include <plat/devs.h>
40#include <plat/sdhci.h>
41#include <plat/adc-core.h>
42#include <plat/ata-core.h>
43#include <plat/fb-core.h>
44#include <plat/fimc-core.h>
45#include <plat/iic-core.h>
46#include <plat/keypad-core.h>
47#include <plat/pwm-core.h>
48#include <plat/tv-core.h>
49#include <plat/spi-core.h>
50
51#include "common.h"
52
53static const char name_s5pv210[] = "S5PV210/S5PC110";
54
55static struct cpu_table cpu_ids[] __initdata = {
56 {
57 .idcode = S5PV210_CPU_ID,
58 .idmask = S5PV210_CPU_MASK,
59 .map_io = s5pv210_map_io,
60 .init_clocks = s5pv210_init_clocks,
61 .init_uarts = s5pv210_init_uarts,
62 .init = s5pv210_init,
63 .name = name_s5pv210,
64 },
65};
66
67/* Initial IO mappings */
68
69static struct map_desc s5pv210_iodesc[] __initdata = {
70 {
71 .virtual = (unsigned long)S5P_VA_CHIPID,
72 .pfn = __phys_to_pfn(S5PV210_PA_CHIPID),
73 .length = SZ_4K,
74 .type = MT_DEVICE,
75 }, {
76 .virtual = (unsigned long)S3C_VA_SYS,
77 .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
78 .length = SZ_64K,
79 .type = MT_DEVICE,
80 }, {
81 .virtual = (unsigned long)S3C_VA_TIMER,
82 .pfn = __phys_to_pfn(S5PV210_PA_TIMER),
83 .length = SZ_16K,
84 .type = MT_DEVICE,
85 }, {
86 .virtual = (unsigned long)S3C_VA_WATCHDOG,
87 .pfn = __phys_to_pfn(S5PV210_PA_WATCHDOG),
88 .length = SZ_4K,
89 .type = MT_DEVICE,
90 }, {
91 .virtual = (unsigned long)S5P_VA_SROMC,
92 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
93 .length = SZ_4K,
94 .type = MT_DEVICE,
95 }, {
96 .virtual = (unsigned long)S5P_VA_SYSTIMER,
97 .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER),
98 .length = SZ_4K,
99 .type = MT_DEVICE,
100 }, {
101 .virtual = (unsigned long)S5P_VA_GPIO,
102 .pfn = __phys_to_pfn(S5PV210_PA_GPIO),
103 .length = SZ_4K,
104 .type = MT_DEVICE,
105 }, {
106 .virtual = (unsigned long)VA_VIC0,
107 .pfn = __phys_to_pfn(S5PV210_PA_VIC0),
108 .length = SZ_16K,
109 .type = MT_DEVICE,
110 }, {
111 .virtual = (unsigned long)VA_VIC1,
112 .pfn = __phys_to_pfn(S5PV210_PA_VIC1),
113 .length = SZ_16K,
114 .type = MT_DEVICE,
115 }, {
116 .virtual = (unsigned long)VA_VIC2,
117 .pfn = __phys_to_pfn(S5PV210_PA_VIC2),
118 .length = SZ_16K,
119 .type = MT_DEVICE,
120 }, {
121 .virtual = (unsigned long)VA_VIC3,
122 .pfn = __phys_to_pfn(S5PV210_PA_VIC3),
123 .length = SZ_16K,
124 .type = MT_DEVICE,
125 }, {
126 .virtual = (unsigned long)S3C_VA_UART,
127 .pfn = __phys_to_pfn(S3C_PA_UART),
128 .length = SZ_512K,
129 .type = MT_DEVICE,
130 }, {
131 .virtual = (unsigned long)S5P_VA_DMC0,
132 .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
133 .length = SZ_4K,
134 .type = MT_DEVICE,
135 }, {
136 .virtual = (unsigned long)S5P_VA_DMC1,
137 .pfn = __phys_to_pfn(S5PV210_PA_DMC1),
138 .length = SZ_4K,
139 .type = MT_DEVICE,
140 }, {
141 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
142 .pfn =__phys_to_pfn(S5PV210_PA_HSPHY),
143 .length = SZ_4K,
144 .type = MT_DEVICE,
145 }
146};
147
148void s5pv210_restart(enum reboot_mode mode, const char *cmd)
149{
150 __raw_writel(0x1, S5P_SWRESET);
151}
152
153static struct samsung_pwm_variant s5pv210_pwm_variant = {
154 .bits = 32,
155 .div_base = 0,
156 .has_tint_cstat = true,
157 .tclk_mask = (1 << 5),
158};
159
160void __init samsung_set_timer_source(unsigned int event, unsigned int source)
161{
162 s5pv210_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
163 s5pv210_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
164}
165
166void __init samsung_timer_init(void)
167{
168 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
169 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
170 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
171 };
172
173 samsung_pwm_clocksource_init(S3C_VA_TIMER,
174 timer_irqs, &s5pv210_pwm_variant);
175}
176
177/*
178 * s5pv210_map_io
179 *
180 * register the standard cpu IO areas
181 */
182
183void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
184{
185 /* initialize the io descriptors we need for initialization */
186 iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc));
187 if (mach_desc)
188 iotable_init(mach_desc, size);
189
190 /* detect cpu id and rev. */
191 s5p_init_cpu(S5P_VA_CHIPID);
192
193 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
194
195 samsung_pwm_set_platdata(&s5pv210_pwm_variant);
196}
197
198void __init s5pv210_map_io(void)
199{
200 /* initialise device information early */
201 s5pv210_default_sdhci0();
202 s5pv210_default_sdhci1();
203 s5pv210_default_sdhci2();
204 s5pv210_default_sdhci3();
205
206 s3c_adc_setname("samsung-adc-v3");
207
208 s3c_cfcon_setname("s5pv210-pata");
209
210 s3c_fimc_setname(0, "s5pv210-fimc");
211 s3c_fimc_setname(1, "s5pv210-fimc");
212 s3c_fimc_setname(2, "s5pv210-fimc");
213
214 /* the i2c devices are directly compatible with s3c2440 */
215 s3c_i2c0_setname("s3c2440-i2c");
216 s3c_i2c1_setname("s3c2440-i2c");
217 s3c_i2c2_setname("s3c2440-i2c");
218
219 s3c_fb_setname("s5pv210-fb");
220
221 /* Use s5pv210-keypad instead of samsung-keypad */
222 samsung_keypad_setname("s5pv210-keypad");
223
224 /* setup TV devices */
225 s5p_hdmi_setname("s5pv210-hdmi");
226
227 s3c64xx_spi_setname("s5pv210-spi");
228}
229
230void __init s5pv210_init_clocks(int xtal)
231{
232 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
233
234 s3c24xx_register_baseclocks(xtal);
235 s5p_register_clocks(xtal);
236 s5pv210_register_clocks();
237 s5pv210_setup_clocks();
238}
239
240void __init s5pv210_init_irq(void)
241{
242 u32 vic[4]; /* S5PV210 supports 4 VIC */
243
244 /* All the VICs are fully populated. */
245 vic[0] = ~0;
246 vic[1] = ~0;
247 vic[2] = ~0;
248 vic[3] = ~0;
249
250 s5p_init_irq(vic, ARRAY_SIZE(vic));
251}
252
253struct bus_type s5pv210_subsys = {
254 .name = "s5pv210-core",
255 .dev_name = "s5pv210-core",
256};
257
258static struct device s5pv210_dev = {
259 .bus = &s5pv210_subsys,
260};
261
262static int __init s5pv210_core_init(void)
263{
264 return subsys_system_register(&s5pv210_subsys, NULL);
265}
266core_initcall(s5pv210_core_init);
267
268int __init s5pv210_init(void)
269{
270 printk(KERN_INFO "S5PV210: Initializing architecture\n");
271 return device_register(&s5pv210_dev);
272}
273
274/* uart registration process */
275
276void __init s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no)
277{
278 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
279}
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index fe1beb54e548..2ad387c1ecf0 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -12,19 +12,12 @@
12#ifndef __ARCH_ARM_MACH_S5PV210_COMMON_H 12#ifndef __ARCH_ARM_MACH_S5PV210_COMMON_H
13#define __ARCH_ARM_MACH_S5PV210_COMMON_H 13#define __ARCH_ARM_MACH_S5PV210_COMMON_H
14 14
15#include <linux/reboot.h> 15#ifdef CONFIG_PM_SLEEP
16 16u32 exynos_get_eint_wake_mask(void);
17void s5pv210_init_io(struct map_desc *mach_desc, int size); 17void s5pv210_cpu_resume(void);
18void s5pv210_init_irq(void); 18void s5pv210_pm_init(void);
19 19#else
20void s5pv210_register_clocks(void); 20static inline void s5pv210_pm_init(void) {}
21void s5pv210_setup_clocks(void); 21#endif
22
23void s5pv210_restart(enum reboot_mode mode, const char *cmd);
24
25extern int s5pv210_init(void);
26extern void s5pv210_map_io(void);
27extern void s5pv210_init_clocks(int xtal);
28extern void s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29 22
30#endif /* __ARCH_ARM_MACH_S5PV210_COMMON_H */ 23#endif /* __ARCH_ARM_MACH_S5PV210_COMMON_H */
diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c
deleted file mode 100644
index 2d67361ef431..000000000000
--- a/arch/arm/mach-s5pv210/dev-audio.c
+++ /dev/null
@@ -1,246 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/dev-audio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co. Ltd
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
14
15#include <plat/gpio-cfg.h>
16#include <linux/platform_data/asoc-s3c.h>
17
18#include <mach/map.h>
19#include <mach/dma.h>
20#include <mach/irqs.h>
21
22#define S5PV210_AUDSS_INT_MEM (0xC0000000)
23
24static int s5pv210_cfg_i2s(struct platform_device *pdev)
25{
26 /* configure GPIO for i2s port */
27 switch (pdev->id) {
28 case 0:
29 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
30 break;
31 case 1:
32 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
33 break;
34 case 2:
35 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
36 break;
37 default:
38 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
39 return -EINVAL;
40 }
41
42 return 0;
43}
44
45static struct s3c_audio_pdata i2sv5_pdata = {
46 .cfg_gpio = s5pv210_cfg_i2s,
47 .type = {
48 .i2s = {
49 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
50 | QUIRK_NEED_RSTCLR,
51 .idma_addr = S5PV210_AUDSS_INT_MEM,
52 },
53 },
54};
55
56static struct resource s5pv210_iis0_resource[] = {
57 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0, SZ_256),
58 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
59 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
60 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
61};
62
63struct platform_device s5pv210_device_iis0 = {
64 .name = "samsung-i2s",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(s5pv210_iis0_resource),
67 .resource = s5pv210_iis0_resource,
68 .dev = {
69 .platform_data = &i2sv5_pdata,
70 },
71};
72
73static struct s3c_audio_pdata i2sv3_pdata = {
74 .cfg_gpio = s5pv210_cfg_i2s,
75};
76
77static struct resource s5pv210_iis1_resource[] = {
78 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1, SZ_256),
79 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
80 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
81};
82
83struct platform_device s5pv210_device_iis1 = {
84 .name = "samsung-i2s",
85 .id = 1,
86 .num_resources = ARRAY_SIZE(s5pv210_iis1_resource),
87 .resource = s5pv210_iis1_resource,
88 .dev = {
89 .platform_data = &i2sv3_pdata,
90 },
91};
92
93static struct resource s5pv210_iis2_resource[] = {
94 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2, SZ_256),
95 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
96 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
97};
98
99struct platform_device s5pv210_device_iis2 = {
100 .name = "samsung-i2s",
101 .id = 2,
102 .num_resources = ARRAY_SIZE(s5pv210_iis2_resource),
103 .resource = s5pv210_iis2_resource,
104 .dev = {
105 .platform_data = &i2sv3_pdata,
106 },
107};
108
109/* PCM Controller platform_devices */
110
111static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
112{
113 switch (pdev->id) {
114 case 0:
115 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
116 break;
117 case 1:
118 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
119 break;
120 case 2:
121 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
122 break;
123 default:
124 printk(KERN_DEBUG "Invalid PCM Controller number!");
125 return -EINVAL;
126 }
127
128 return 0;
129}
130
131static struct s3c_audio_pdata s3c_pcm_pdata = {
132 .cfg_gpio = s5pv210_pcm_cfg_gpio,
133};
134
135static struct resource s5pv210_pcm0_resource[] = {
136 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0, SZ_256),
137 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
138 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
139};
140
141struct platform_device s5pv210_device_pcm0 = {
142 .name = "samsung-pcm",
143 .id = 0,
144 .num_resources = ARRAY_SIZE(s5pv210_pcm0_resource),
145 .resource = s5pv210_pcm0_resource,
146 .dev = {
147 .platform_data = &s3c_pcm_pdata,
148 },
149};
150
151static struct resource s5pv210_pcm1_resource[] = {
152 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1, SZ_256),
153 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
154 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
155};
156
157struct platform_device s5pv210_device_pcm1 = {
158 .name = "samsung-pcm",
159 .id = 1,
160 .num_resources = ARRAY_SIZE(s5pv210_pcm1_resource),
161 .resource = s5pv210_pcm1_resource,
162 .dev = {
163 .platform_data = &s3c_pcm_pdata,
164 },
165};
166
167static struct resource s5pv210_pcm2_resource[] = {
168 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2, SZ_256),
169 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
170 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
171};
172
173struct platform_device s5pv210_device_pcm2 = {
174 .name = "samsung-pcm",
175 .id = 2,
176 .num_resources = ARRAY_SIZE(s5pv210_pcm2_resource),
177 .resource = s5pv210_pcm2_resource,
178 .dev = {
179 .platform_data = &s3c_pcm_pdata,
180 },
181};
182
183/* AC97 Controller platform devices */
184
185static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
186{
187 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
188}
189
190static struct resource s5pv210_ac97_resource[] = {
191 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97, SZ_256),
192 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
193 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
194 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
195 [4] = DEFINE_RES_IRQ(IRQ_AC97),
196};
197
198static struct s3c_audio_pdata s3c_ac97_pdata = {
199 .cfg_gpio = s5pv210_ac97_cfg_gpio,
200};
201
202static u64 s5pv210_ac97_dmamask = DMA_BIT_MASK(32);
203
204struct platform_device s5pv210_device_ac97 = {
205 .name = "samsung-ac97",
206 .id = -1,
207 .num_resources = ARRAY_SIZE(s5pv210_ac97_resource),
208 .resource = s5pv210_ac97_resource,
209 .dev = {
210 .platform_data = &s3c_ac97_pdata,
211 .dma_mask = &s5pv210_ac97_dmamask,
212 .coherent_dma_mask = DMA_BIT_MASK(32),
213 },
214};
215
216/* S/PDIF Controller platform_device */
217
218static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
219{
220 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
221
222 return 0;
223}
224
225static struct resource s5pv210_spdif_resource[] = {
226 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF, SZ_256),
227 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
228};
229
230static struct s3c_audio_pdata samsung_spdif_pdata = {
231 .cfg_gpio = s5pv210_spdif_cfg_gpio,
232};
233
234static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
235
236struct platform_device s5pv210_device_spdif = {
237 .name = "samsung-spdif",
238 .id = -1,
239 .num_resources = ARRAY_SIZE(s5pv210_spdif_resource),
240 .resource = s5pv210_spdif_resource,
241 .dev = {
242 .platform_data = &samsung_spdif_pdata,
243 .dma_mask = &s5pv210_spdif_dmamask,
244 .coherent_dma_mask = DMA_BIT_MASK(32),
245 },
246};
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c
deleted file mode 100644
index b8337e248b09..000000000000
--- a/arch/arm/mach-s5pv210/dma.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/dma.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/dma-mapping.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/pl330.h>
27
28#include <asm/irq.h>
29#include <plat/devs.h>
30#include <plat/irqs.h>
31
32#include <mach/map.h>
33#include <mach/irqs.h>
34#include <mach/dma.h>
35
36static u8 pdma0_peri[] = {
37 DMACH_UART0_RX,
38 DMACH_UART0_TX,
39 DMACH_UART1_RX,
40 DMACH_UART1_TX,
41 DMACH_UART2_RX,
42 DMACH_UART2_TX,
43 DMACH_UART3_RX,
44 DMACH_UART3_TX,
45 DMACH_MAX,
46 DMACH_I2S0_RX,
47 DMACH_I2S0_TX,
48 DMACH_I2S0S_TX,
49 DMACH_I2S1_RX,
50 DMACH_I2S1_TX,
51 DMACH_MAX,
52 DMACH_MAX,
53 DMACH_SPI0_RX,
54 DMACH_SPI0_TX,
55 DMACH_SPI1_RX,
56 DMACH_SPI1_TX,
57 DMACH_MAX,
58 DMACH_MAX,
59 DMACH_AC97_MICIN,
60 DMACH_AC97_PCMIN,
61 DMACH_AC97_PCMOUT,
62 DMACH_MAX,
63 DMACH_PWM,
64 DMACH_SPDIF,
65};
66
67static struct dma_pl330_platdata s5pv210_pdma0_pdata = {
68 .nr_valid_peri = ARRAY_SIZE(pdma0_peri),
69 .peri_id = pdma0_peri,
70};
71
72static AMBA_AHB_DEVICE(s5pv210_pdma0, "dma-pl330.0", 0x00041330,
73 S5PV210_PA_PDMA0, {IRQ_PDMA0}, &s5pv210_pdma0_pdata);
74
75static u8 pdma1_peri[] = {
76 DMACH_UART0_RX,
77 DMACH_UART0_TX,
78 DMACH_UART1_RX,
79 DMACH_UART1_TX,
80 DMACH_UART2_RX,
81 DMACH_UART2_TX,
82 DMACH_UART3_RX,
83 DMACH_UART3_TX,
84 DMACH_MAX,
85 DMACH_I2S0_RX,
86 DMACH_I2S0_TX,
87 DMACH_I2S0S_TX,
88 DMACH_I2S1_RX,
89 DMACH_I2S1_TX,
90 DMACH_I2S2_RX,
91 DMACH_I2S2_TX,
92 DMACH_SPI0_RX,
93 DMACH_SPI0_TX,
94 DMACH_SPI1_RX,
95 DMACH_SPI1_TX,
96 DMACH_MAX,
97 DMACH_MAX,
98 DMACH_PCM0_RX,
99 DMACH_PCM0_TX,
100 DMACH_PCM1_RX,
101 DMACH_PCM1_TX,
102 DMACH_MSM_REQ0,
103 DMACH_MSM_REQ1,
104 DMACH_MSM_REQ2,
105 DMACH_MSM_REQ3,
106 DMACH_PCM2_RX,
107 DMACH_PCM2_TX,
108};
109
110static struct dma_pl330_platdata s5pv210_pdma1_pdata = {
111 .nr_valid_peri = ARRAY_SIZE(pdma1_peri),
112 .peri_id = pdma1_peri,
113};
114
115static AMBA_AHB_DEVICE(s5pv210_pdma1, "dma-pl330.1", 0x00041330,
116 S5PV210_PA_PDMA1, {IRQ_PDMA1}, &s5pv210_pdma1_pdata);
117
118static int __init s5pv210_dma_init(void)
119{
120 dma_cap_set(DMA_SLAVE, s5pv210_pdma0_pdata.cap_mask);
121 dma_cap_set(DMA_CYCLIC, s5pv210_pdma0_pdata.cap_mask);
122 amba_device_register(&s5pv210_pdma0_device, &iomem_resource);
123
124 dma_cap_set(DMA_SLAVE, s5pv210_pdma1_pdata.cap_mask);
125 dma_cap_set(DMA_CYCLIC, s5pv210_pdma1_pdata.cap_mask);
126 amba_device_register(&s5pv210_pdma1_device, &iomem_resource);
127
128 return 0;
129}
130arch_initcall(s5pv210_dma_init);
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h
deleted file mode 100644
index 6c8b903c02e4..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/gpio.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/gpio.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - GPIO lib support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__
15
16/* Practically, GPIO banks up to MP03 are the configurable gpio banks */
17
18/* GPIO bank sizes */
19#define S5PV210_GPIO_A0_NR (8)
20#define S5PV210_GPIO_A1_NR (4)
21#define S5PV210_GPIO_B_NR (8)
22#define S5PV210_GPIO_C0_NR (5)
23#define S5PV210_GPIO_C1_NR (5)
24#define S5PV210_GPIO_D0_NR (4)
25#define S5PV210_GPIO_D1_NR (6)
26#define S5PV210_GPIO_E0_NR (8)
27#define S5PV210_GPIO_E1_NR (5)
28#define S5PV210_GPIO_F0_NR (8)
29#define S5PV210_GPIO_F1_NR (8)
30#define S5PV210_GPIO_F2_NR (8)
31#define S5PV210_GPIO_F3_NR (6)
32#define S5PV210_GPIO_G0_NR (7)
33#define S5PV210_GPIO_G1_NR (7)
34#define S5PV210_GPIO_G2_NR (7)
35#define S5PV210_GPIO_G3_NR (7)
36#define S5PV210_GPIO_H0_NR (8)
37#define S5PV210_GPIO_H1_NR (8)
38#define S5PV210_GPIO_H2_NR (8)
39#define S5PV210_GPIO_H3_NR (8)
40#define S5PV210_GPIO_I_NR (7)
41#define S5PV210_GPIO_J0_NR (8)
42#define S5PV210_GPIO_J1_NR (6)
43#define S5PV210_GPIO_J2_NR (8)
44#define S5PV210_GPIO_J3_NR (8)
45#define S5PV210_GPIO_J4_NR (5)
46
47#define S5PV210_GPIO_MP01_NR (8)
48#define S5PV210_GPIO_MP02_NR (4)
49#define S5PV210_GPIO_MP03_NR (8)
50#define S5PV210_GPIO_MP04_NR (8)
51#define S5PV210_GPIO_MP05_NR (8)
52
53/* GPIO bank numbers */
54
55/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
56 * space for debugging purposes so that any accidental
57 * change from one gpio bank to another can be caught.
58*/
59
60#define S5PV210_GPIO_NEXT(__gpio) \
61 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
62
63enum s5p_gpio_number {
64 S5PV210_GPIO_A0_START = 0,
65 S5PV210_GPIO_A1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_A0),
66 S5PV210_GPIO_B_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_A1),
67 S5PV210_GPIO_C0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_B),
68 S5PV210_GPIO_C1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_C0),
69 S5PV210_GPIO_D0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_C1),
70 S5PV210_GPIO_D1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_D0),
71 S5PV210_GPIO_E0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_D1),
72 S5PV210_GPIO_E1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_E0),
73 S5PV210_GPIO_F0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_E1),
74 S5PV210_GPIO_F1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F0),
75 S5PV210_GPIO_F2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F1),
76 S5PV210_GPIO_F3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F2),
77 S5PV210_GPIO_G0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F3),
78 S5PV210_GPIO_G1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G0),
79 S5PV210_GPIO_G2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G1),
80 S5PV210_GPIO_G3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G2),
81 S5PV210_GPIO_H0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G3),
82 S5PV210_GPIO_H1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H0),
83 S5PV210_GPIO_H2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H1),
84 S5PV210_GPIO_H3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H2),
85 S5PV210_GPIO_I_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H3),
86 S5PV210_GPIO_J0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_I),
87 S5PV210_GPIO_J1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J0),
88 S5PV210_GPIO_J2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J1),
89 S5PV210_GPIO_J3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J2),
90 S5PV210_GPIO_J4_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J3),
91 S5PV210_GPIO_MP01_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J4),
92 S5PV210_GPIO_MP02_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP01),
93 S5PV210_GPIO_MP03_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP02),
94 S5PV210_GPIO_MP04_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP03),
95 S5PV210_GPIO_MP05_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP04),
96};
97
98/* S5PV210 GPIO number definitions */
99#define S5PV210_GPA0(_nr) (S5PV210_GPIO_A0_START + (_nr))
100#define S5PV210_GPA1(_nr) (S5PV210_GPIO_A1_START + (_nr))
101#define S5PV210_GPB(_nr) (S5PV210_GPIO_B_START + (_nr))
102#define S5PV210_GPC0(_nr) (S5PV210_GPIO_C0_START + (_nr))
103#define S5PV210_GPC1(_nr) (S5PV210_GPIO_C1_START + (_nr))
104#define S5PV210_GPD0(_nr) (S5PV210_GPIO_D0_START + (_nr))
105#define S5PV210_GPD1(_nr) (S5PV210_GPIO_D1_START + (_nr))
106#define S5PV210_GPE0(_nr) (S5PV210_GPIO_E0_START + (_nr))
107#define S5PV210_GPE1(_nr) (S5PV210_GPIO_E1_START + (_nr))
108#define S5PV210_GPF0(_nr) (S5PV210_GPIO_F0_START + (_nr))
109#define S5PV210_GPF1(_nr) (S5PV210_GPIO_F1_START + (_nr))
110#define S5PV210_GPF2(_nr) (S5PV210_GPIO_F2_START + (_nr))
111#define S5PV210_GPF3(_nr) (S5PV210_GPIO_F3_START + (_nr))
112#define S5PV210_GPG0(_nr) (S5PV210_GPIO_G0_START + (_nr))
113#define S5PV210_GPG1(_nr) (S5PV210_GPIO_G1_START + (_nr))
114#define S5PV210_GPG2(_nr) (S5PV210_GPIO_G2_START + (_nr))
115#define S5PV210_GPG3(_nr) (S5PV210_GPIO_G3_START + (_nr))
116#define S5PV210_GPH0(_nr) (S5PV210_GPIO_H0_START + (_nr))
117#define S5PV210_GPH1(_nr) (S5PV210_GPIO_H1_START + (_nr))
118#define S5PV210_GPH2(_nr) (S5PV210_GPIO_H2_START + (_nr))
119#define S5PV210_GPH3(_nr) (S5PV210_GPIO_H3_START + (_nr))
120#define S5PV210_GPI(_nr) (S5PV210_GPIO_I_START + (_nr))
121#define S5PV210_GPJ0(_nr) (S5PV210_GPIO_J0_START + (_nr))
122#define S5PV210_GPJ1(_nr) (S5PV210_GPIO_J1_START + (_nr))
123#define S5PV210_GPJ2(_nr) (S5PV210_GPIO_J2_START + (_nr))
124#define S5PV210_GPJ3(_nr) (S5PV210_GPIO_J3_START + (_nr))
125#define S5PV210_GPJ4(_nr) (S5PV210_GPIO_J4_START + (_nr))
126#define S5PV210_MP01(_nr) (S5PV210_GPIO_MP01_START + (_nr))
127#define S5PV210_MP02(_nr) (S5PV210_GPIO_MP02_START + (_nr))
128#define S5PV210_MP03(_nr) (S5PV210_GPIO_MP03_START + (_nr))
129#define S5PV210_MP04(_nr) (S5PV210_GPIO_MP04_START + (_nr))
130#define S5PV210_MP05(_nr) (S5PV210_GPIO_MP05_START + (_nr))
131
132/* the end of the S5PV210 specific gpios */
133#define S5PV210_GPIO_END (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + 1)
134#define S3C_GPIO_END S5PV210_GPIO_END
135
136/* define the number of gpios we need to the one after the MP05() range */
137#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \
138 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
139
140#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/hardware.h b/arch/arm/mach-s5pv210/include/mach/hardware.h
deleted file mode 100644
index fada7a392d09..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/hardware.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/hardware.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - Hardware support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_HARDWARE_H
14#define __ASM_ARCH_HARDWARE_H __FILE__
15
16/* currently nothing here, placeholder */
17
18#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h
deleted file mode 100644
index 5e0de3a31f3d..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/irqs.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/irqs.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - IRQ definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_IRQS_H
14#define __ASM_ARCH_IRQS_H __FILE__
15
16#include <plat/irqs.h>
17
18/* VIC0: System, DMA, Timer */
19
20#define IRQ_EINT16_31 S5P_IRQ_VIC0(16)
21#define IRQ_BATF S5P_IRQ_VIC0(17)
22#define IRQ_MDMA S5P_IRQ_VIC0(18)
23#define IRQ_PDMA0 S5P_IRQ_VIC0(19)
24#define IRQ_PDMA1 S5P_IRQ_VIC0(20)
25#define IRQ_TIMER0_VIC S5P_IRQ_VIC0(21)
26#define IRQ_TIMER1_VIC S5P_IRQ_VIC0(22)
27#define IRQ_TIMER2_VIC S5P_IRQ_VIC0(23)
28#define IRQ_TIMER3_VIC S5P_IRQ_VIC0(24)
29#define IRQ_TIMER4_VIC S5P_IRQ_VIC0(25)
30#define IRQ_SYSTIMER S5P_IRQ_VIC0(26)
31#define IRQ_WDT S5P_IRQ_VIC0(27)
32#define IRQ_RTC_ALARM S5P_IRQ_VIC0(28)
33#define IRQ_RTC_TIC S5P_IRQ_VIC0(29)
34#define IRQ_GPIOINT S5P_IRQ_VIC0(30)
35#define IRQ_FIMC3 S5P_IRQ_VIC0(31)
36
37/* VIC1: ARM, Power, Memory, Connectivity, Storage */
38
39#define IRQ_PMU S5P_IRQ_VIC1(0)
40#define IRQ_CORTEX1 S5P_IRQ_VIC1(1)
41#define IRQ_CORTEX2 S5P_IRQ_VIC1(2)
42#define IRQ_CORTEX3 S5P_IRQ_VIC1(3)
43#define IRQ_CORTEX4 S5P_IRQ_VIC1(4)
44#define IRQ_IEMAPC S5P_IRQ_VIC1(5)
45#define IRQ_IEMIEC S5P_IRQ_VIC1(6)
46#define IRQ_ONENAND S5P_IRQ_VIC1(7)
47#define IRQ_NFC S5P_IRQ_VIC1(8)
48#define IRQ_CFCON S5P_IRQ_VIC1(9)
49#define IRQ_UART0 S5P_IRQ_VIC1(10)
50#define IRQ_UART1 S5P_IRQ_VIC1(11)
51#define IRQ_UART2 S5P_IRQ_VIC1(12)
52#define IRQ_UART3 S5P_IRQ_VIC1(13)
53#define IRQ_IIC S5P_IRQ_VIC1(14)
54#define IRQ_SPI0 S5P_IRQ_VIC1(15)
55#define IRQ_SPI1 S5P_IRQ_VIC1(16)
56#define IRQ_SPI2 S5P_IRQ_VIC1(17)
57#define IRQ_IRDA S5P_IRQ_VIC1(18)
58#define IRQ_IIC2 S5P_IRQ_VIC1(19)
59#define IRQ_IIC_HDMIPHY S5P_IRQ_VIC1(20)
60#define IRQ_HSIRX S5P_IRQ_VIC1(21)
61#define IRQ_HSITX S5P_IRQ_VIC1(22)
62#define IRQ_UHOST S5P_IRQ_VIC1(23)
63#define IRQ_OTG S5P_IRQ_VIC1(24)
64#define IRQ_MSM S5P_IRQ_VIC1(25)
65#define IRQ_HSMMC0 S5P_IRQ_VIC1(26)
66#define IRQ_HSMMC1 S5P_IRQ_VIC1(27)
67#define IRQ_HSMMC2 S5P_IRQ_VIC1(28)
68#define IRQ_MIPI_CSIS S5P_IRQ_VIC1(29)
69#define IRQ_MIPIDSI S5P_IRQ_VIC1(30)
70#define IRQ_ONENAND_AUDI S5P_IRQ_VIC1(31)
71
72/* VIC2: Multimedia, Audio, Security */
73
74#define IRQ_LCD0 S5P_IRQ_VIC2(0)
75#define IRQ_LCD1 S5P_IRQ_VIC2(1)
76#define IRQ_LCD2 S5P_IRQ_VIC2(2)
77#define IRQ_LCD3 S5P_IRQ_VIC2(3)
78#define IRQ_ROTATOR S5P_IRQ_VIC2(4)
79#define IRQ_FIMC0 S5P_IRQ_VIC2(5)
80#define IRQ_FIMC1 S5P_IRQ_VIC2(6)
81#define IRQ_FIMC2 S5P_IRQ_VIC2(7)
82#define IRQ_JPEG S5P_IRQ_VIC2(8)
83#define IRQ_2D S5P_IRQ_VIC2(9)
84#define IRQ_3D S5P_IRQ_VIC2(10)
85#define IRQ_MIXER S5P_IRQ_VIC2(11)
86#define IRQ_HDMI S5P_IRQ_VIC2(12)
87#define IRQ_IIC1 S5P_IRQ_VIC2(13)
88#define IRQ_MFC S5P_IRQ_VIC2(14)
89#define IRQ_SDO S5P_IRQ_VIC2(15)
90#define IRQ_I2S0 S5P_IRQ_VIC2(16)
91#define IRQ_I2S1 S5P_IRQ_VIC2(17)
92#define IRQ_I2S2 S5P_IRQ_VIC2(18)
93#define IRQ_AC97 S5P_IRQ_VIC2(19)
94#define IRQ_PCM0 S5P_IRQ_VIC2(20)
95#define IRQ_PCM1 S5P_IRQ_VIC2(21)
96#define IRQ_SPDIF S5P_IRQ_VIC2(22)
97#define IRQ_ADC S5P_IRQ_VIC2(23)
98#define IRQ_PENDN S5P_IRQ_VIC2(24)
99#define IRQ_TC IRQ_PENDN
100#define IRQ_KEYPAD S5P_IRQ_VIC2(25)
101#define IRQ_CG S5P_IRQ_VIC2(26)
102#define IRQ_SSS_INT S5P_IRQ_VIC2(27)
103#define IRQ_SSS_HASH S5P_IRQ_VIC2(28)
104#define IRQ_PCM2 S5P_IRQ_VIC2(29)
105#define IRQ_SDMIRQ S5P_IRQ_VIC2(30)
106#define IRQ_SDMFIQ S5P_IRQ_VIC2(31)
107
108/* VIC3: Etc */
109
110#define IRQ_IPC S5P_IRQ_VIC3(0)
111#define IRQ_HOSTIF S5P_IRQ_VIC3(1)
112#define IRQ_HSMMC3 S5P_IRQ_VIC3(2)
113#define IRQ_CEC S5P_IRQ_VIC3(3)
114#define IRQ_TSI S5P_IRQ_VIC3(4)
115#define IRQ_MDNIE0 S5P_IRQ_VIC3(5)
116#define IRQ_MDNIE1 S5P_IRQ_VIC3(6)
117#define IRQ_MDNIE2 S5P_IRQ_VIC3(7)
118#define IRQ_MDNIE3 S5P_IRQ_VIC3(8)
119#define IRQ_VIC_END S5P_IRQ_VIC3(31)
120
121#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
122#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
123
124/* GPIO interrupt */
125#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
126#define S5P_GPIOINT_GROUP_MAXNR 22
127
128/* Set the default NR_IRQS */
129#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)
130
131/* Compatibility */
132#define IRQ_LCD_FIFO IRQ_LCD0
133#define IRQ_LCD_VSYNC IRQ_LCD1
134#define IRQ_LCD_SYSTEM IRQ_LCD2
135#define IRQ_MIPI_CSIS0 IRQ_MIPI_CSIS
136
137#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
deleted file mode 100644
index 763929aca52d..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ /dev/null
@@ -1,158 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/map.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - Memory map definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_MAP_H
14#define __ASM_ARCH_MAP_H __FILE__
15
16#include <plat/map-base.h>
17#include <plat/map-s5p.h>
18
19#define S5PV210_PA_SDRAM 0x20000000
20
21#define S5PV210_PA_SROM_BANK5 0xA8000000
22
23#define S5PC110_PA_ONENAND 0xB0000000
24#define S5PC110_PA_ONENAND_DMA 0xB0600000
25
26#define S5PV210_PA_CHIPID 0xE0000000
27
28#define S5PV210_PA_SYSCON 0xE0100000
29
30#define S5PV210_PA_GPIO 0xE0200000
31
32#define S5PV210_PA_SPDIF 0xE1100000
33
34#define S5PV210_PA_SPI0 0xE1300000
35#define S5PV210_PA_SPI1 0xE1400000
36
37#define S5PV210_PA_KEYPAD 0xE1600000
38
39#define S5PV210_PA_ADC 0xE1700000
40
41#define S5PV210_PA_IIC0 0xE1800000
42#define S5PV210_PA_IIC1 0xFAB00000
43#define S5PV210_PA_IIC2 0xE1A00000
44
45#define S5PV210_PA_AC97 0xE2200000
46
47#define S5PV210_PA_PCM0 0xE2300000
48#define S5PV210_PA_PCM1 0xE1200000
49#define S5PV210_PA_PCM2 0xE2B00000
50
51#define S5PV210_PA_TIMER 0xE2500000
52#define S5PV210_PA_SYSTIMER 0xE2600000
53#define S5PV210_PA_WATCHDOG 0xE2700000
54#define S5PV210_PA_RTC 0xE2800000
55
56#define S5PV210_PA_UART 0xE2900000
57
58#define S5PV210_PA_SROMC 0xE8000000
59
60#define S5PV210_PA_CFCON 0xE8200000
61
62#define S5PV210_PA_MFC 0xF1700000
63
64#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000))
65
66#define S5PV210_PA_HSOTG 0xEC000000
67#define S5PV210_PA_HSPHY 0xEC100000
68
69#define S5PV210_PA_IIS0 0xEEE30000
70#define S5PV210_PA_IIS1 0xE2100000
71#define S5PV210_PA_IIS2 0xE2A00000
72
73#define S5PV210_PA_DMC0 0xF0000000
74#define S5PV210_PA_DMC1 0xF1400000
75
76#define S5PV210_PA_VIC0 0xF2000000
77#define S5PV210_PA_VIC1 0xF2100000
78#define S5PV210_PA_VIC2 0xF2200000
79#define S5PV210_PA_VIC3 0xF2300000
80
81#define S5PV210_PA_FB 0xF8000000
82
83#define S5PV210_PA_MDMA 0xFA200000
84#define S5PV210_PA_PDMA0 0xE0900000
85#define S5PV210_PA_PDMA1 0xE0A00000
86
87#define S5PV210_PA_MIPI_CSIS 0xFA600000
88
89#define S5PV210_PA_FIMC0 0xFB200000
90#define S5PV210_PA_FIMC1 0xFB300000
91#define S5PV210_PA_FIMC2 0xFB400000
92
93#define S5PV210_PA_JPEG 0xFB600000
94
95#define S5PV210_PA_SDO 0xF9000000
96#define S5PV210_PA_VP 0xF9100000
97#define S5PV210_PA_MIXER 0xF9200000
98#define S5PV210_PA_HDMI 0xFA100000
99#define S5PV210_PA_IIC_HDMIPHY 0xFA900000
100
101/* Compatibiltiy Defines */
102
103#define S3C_PA_FB S5PV210_PA_FB
104#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0)
105#define S3C_PA_HSMMC1 S5PV210_PA_HSMMC(1)
106#define S3C_PA_HSMMC2 S5PV210_PA_HSMMC(2)
107#define S3C_PA_HSMMC3 S5PV210_PA_HSMMC(3)
108#define S3C_PA_IIC S5PV210_PA_IIC0
109#define S3C_PA_IIC1 S5PV210_PA_IIC1
110#define S3C_PA_IIC2 S5PV210_PA_IIC2
111#define S3C_PA_RTC S5PV210_PA_RTC
112#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG
113#define S3C_PA_WDT S5PV210_PA_WATCHDOG
114#define S3C_PA_SPI0 S5PV210_PA_SPI0
115#define S3C_PA_SPI1 S5PV210_PA_SPI1
116
117#define S5P_PA_CHIPID S5PV210_PA_CHIPID
118#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
119#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
120#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
121#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS
122#define S5P_PA_MFC S5PV210_PA_MFC
123#define S5P_PA_IIC_HDMIPHY S5PV210_PA_IIC_HDMIPHY
124
125#define S5P_PA_SDO S5PV210_PA_SDO
126#define S5P_PA_VP S5PV210_PA_VP
127#define S5P_PA_MIXER S5PV210_PA_MIXER
128#define S5P_PA_HDMI S5PV210_PA_HDMI
129
130#define S5P_PA_ONENAND S5PC110_PA_ONENAND
131#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA
132#define S5P_PA_SDRAM S5PV210_PA_SDRAM
133#define S5P_PA_SROMC S5PV210_PA_SROMC
134#define S5P_PA_SYSCON S5PV210_PA_SYSCON
135#define S5P_PA_TIMER S5PV210_PA_TIMER
136
137#define S5P_PA_JPEG S5PV210_PA_JPEG
138
139#define SAMSUNG_PA_ADC S5PV210_PA_ADC
140#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON
141#define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD
142#define SAMSUNG_PA_TIMER S5PV210_PA_TIMER
143
144/* UART */
145
146#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
147
148#define S3C_PA_UART S5PV210_PA_UART
149
150#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
151#define S5P_PA_UART0 S5P_PA_UART(0)
152#define S5P_PA_UART1 S5P_PA_UART(1)
153#define S5P_PA_UART2 S5P_PA_UART(2)
154#define S5P_PA_UART3 S5P_PA_UART(3)
155
156#define S5P_SZ_UART SZ_256
157
158#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/memory.h b/arch/arm/mach-s5pv210/include/mach/memory.h
deleted file mode 100644
index 2d3cfa221d5f..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/memory.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/memory.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - Memory definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PLAT_PHYS_OFFSET UL(0x20000000)
17
18/*
19 * Sparsemem support
20 * Physical memory can be located from 0x20000000 to 0x7fffffff,
21 * so MAX_PHYSMEM_BITS is 31.
22 */
23
24#define MAX_PHYSMEM_BITS 31
25#define SECTION_SIZE_BITS 28
26
27#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/pm-core.h b/arch/arm/mach-s5pv210/include/mach/pm-core.h
deleted file mode 100644
index eba8aea63ed8..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/pm-core.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/pm-core.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Based on arch/arm/mach-s3c2410/include/mach/pm-core.h,
7 * Copyright 2008 Simtec Electronics
8 * Ben Dooks <ben@simtec.co.uk>
9 * http://armlinux.simtec.co.uk/
10 *
11 * S5PV210 - PM core support for arch/arm/plat-s5p/pm.c
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16*/
17
18static inline void s3c_pm_debug_init_uart(void)
19{
20 /* nothing here yet */
21}
22
23static inline void s3c_pm_arch_prepare_irqs(void)
24{
25 __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK);
26 __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK);
27}
28
29static inline void s3c_pm_arch_stop_clocks(void)
30{
31 /* nothing here yet */
32}
33
34static inline void s3c_pm_arch_show_resume_irqs(void)
35{
36 /* nothing here yet */
37}
38
39static inline void s3c_pm_arch_update_uart(void __iomem *regs,
40 struct pm_uart_save *save)
41{
42 /* nothing here yet */
43}
44
45static inline void s3c_pm_restored_gpios(void) { }
46static inline void samsung_pm_saved_gpios(void) { }
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
index e345584d4c34..b14ffcd7f6cc 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
@@ -13,7 +13,7 @@
13#ifndef __ASM_ARCH_REGS_CLOCK_H 13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__ 14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15 15
16#include <mach/map.h> 16#include <plat/map-base.h>
17 17
18#define S5P_CLKREG(x) (S3C_VA_SYS + (x)) 18#define S5P_CLKREG(x) (S3C_VA_SYS + (x))
19 19
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-gpio.h b/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
deleted file mode 100644
index de0c89976078..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV210 - GPIO (including EINT) register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_GPIO_H
14#define __ASM_ARCH_REGS_GPIO_H __FILE__
15
16#include <mach/map.h>
17
18#define S5PV210_EINT30CON (S5P_VA_GPIO + 0xE00)
19#define S5P_EINT_CON(x) (S5PV210_EINT30CON + ((x) * 0x4))
20
21#define S5PV210_EINT30FLTCON0 (S5P_VA_GPIO + 0xE80)
22#define S5P_EINT_FLTCON(x) (S5PV210_EINT30FLTCON0 + ((x) * 0x4))
23
24#define S5PV210_EINT30MASK (S5P_VA_GPIO + 0xF00)
25#define S5P_EINT_MASK(x) (S5PV210_EINT30MASK + ((x) * 0x4))
26
27#define S5PV210_EINT30PEND (S5P_VA_GPIO + 0xF40)
28#define S5P_EINT_PEND(x) (S5PV210_EINT30PEND + ((x) * 0x4))
29
30#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
31
32#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
33
34#define EINT_MODE S3C_GPIO_SFN(0xf)
35
36#define EINT_GPIO_0(x) S5PV210_GPH0(x)
37#define EINT_GPIO_1(x) S5PV210_GPH1(x)
38#define EINT_GPIO_2(x) S5PV210_GPH2(x)
39#define EINT_GPIO_3(x) S5PV210_GPH3(x)
40
41#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-irq.h b/arch/arm/mach-s5pv210/include/mach/regs-irq.h
deleted file mode 100644
index d8bc1e6c7aaa..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/regs-irq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <mach/map.h>
17
18#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
deleted file mode 100644
index cc37edacda26..000000000000
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ /dev/null
@@ -1,687 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/mach-aquila.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/serial_core.h>
15#include <linux/serial_s3c.h>
16#include <linux/fb.h>
17#include <linux/i2c.h>
18#include <linux/i2c-gpio.h>
19#include <linux/mfd/max8998.h>
20#include <linux/mfd/wm8994/pdata.h>
21#include <linux/regulator/fixed.h>
22#include <linux/gpio_keys.h>
23#include <linux/input.h>
24#include <linux/gpio.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/setup.h>
29#include <asm/mach-types.h>
30
31#include <video/samsung_fimd.h>
32#include <mach/map.h>
33#include <mach/regs-clock.h>
34
35#include <plat/gpio-cfg.h>
36#include <plat/devs.h>
37#include <plat/cpu.h>
38#include <plat/fb.h>
39#include <plat/fimc-core.h>
40#include <plat/sdhci.h>
41#include <plat/samsung-time.h>
42
43#include "common.h"
44
45/* Following are default values for UCON, ULCON and UFCON UART registers */
46#define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
47 S3C2410_UCON_RXILEVEL | \
48 S3C2410_UCON_TXIRQMODE | \
49 S3C2410_UCON_RXIRQMODE | \
50 S3C2410_UCON_RXFIFO_TOI | \
51 S3C2443_UCON_RXERR_IRQEN)
52
53#define AQUILA_ULCON_DEFAULT S3C2410_LCON_CS8
54
55#define AQUILA_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
56
57static struct s3c2410_uartcfg aquila_uartcfgs[] __initdata = {
58 [0] = {
59 .hwport = 0,
60 .flags = 0,
61 .ucon = AQUILA_UCON_DEFAULT,
62 .ulcon = AQUILA_ULCON_DEFAULT,
63 /*
64 * Actually UART0 can support 256 bytes fifo, but aquila board
65 * supports 128 bytes fifo because of initial chip bug
66 */
67 .ufcon = AQUILA_UFCON_DEFAULT |
68 S5PV210_UFCON_TXTRIG128 | S5PV210_UFCON_RXTRIG128,
69 },
70 [1] = {
71 .hwport = 1,
72 .flags = 0,
73 .ucon = AQUILA_UCON_DEFAULT,
74 .ulcon = AQUILA_ULCON_DEFAULT,
75 .ufcon = AQUILA_UFCON_DEFAULT |
76 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
77 },
78 [2] = {
79 .hwport = 2,
80 .flags = 0,
81 .ucon = AQUILA_UCON_DEFAULT,
82 .ulcon = AQUILA_ULCON_DEFAULT,
83 .ufcon = AQUILA_UFCON_DEFAULT |
84 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
85 },
86 [3] = {
87 .hwport = 3,
88 .flags = 0,
89 .ucon = AQUILA_UCON_DEFAULT,
90 .ulcon = AQUILA_ULCON_DEFAULT,
91 .ufcon = AQUILA_UFCON_DEFAULT |
92 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
93 },
94};
95
96/* Frame Buffer */
97static struct s3c_fb_pd_win aquila_fb_win0 = {
98 .max_bpp = 32,
99 .default_bpp = 16,
100 .xres = 480,
101 .yres = 800,
102};
103
104static struct s3c_fb_pd_win aquila_fb_win1 = {
105 .max_bpp = 32,
106 .default_bpp = 16,
107 .xres = 480,
108 .yres = 800,
109};
110
111static struct fb_videomode aquila_lcd_timing = {
112 .left_margin = 16,
113 .right_margin = 16,
114 .upper_margin = 3,
115 .lower_margin = 28,
116 .hsync_len = 2,
117 .vsync_len = 2,
118 .xres = 480,
119 .yres = 800,
120};
121
122static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
123 .win[0] = &aquila_fb_win0,
124 .win[1] = &aquila_fb_win1,
125 .vtiming = &aquila_lcd_timing,
126 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
127 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
128 VIDCON1_INV_VCLK | VIDCON1_INV_VDEN,
129 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
130};
131
132/* MAX8998 regulators */
133#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
134
135static struct regulator_init_data aquila_ldo2_data = {
136 .constraints = {
137 .name = "VALIVE_1.1V",
138 .min_uV = 1100000,
139 .max_uV = 1100000,
140 .apply_uV = 1,
141 .always_on = 1,
142 .state_mem = {
143 .enabled = 1,
144 },
145 },
146};
147
148static struct regulator_init_data aquila_ldo3_data = {
149 .constraints = {
150 .name = "VUSB+MIPI_1.1V",
151 .min_uV = 1100000,
152 .max_uV = 1100000,
153 .apply_uV = 1,
154 .always_on = 1,
155 },
156};
157
158static struct regulator_init_data aquila_ldo4_data = {
159 .constraints = {
160 .name = "VDAC_3.3V",
161 .min_uV = 3300000,
162 .max_uV = 3300000,
163 .apply_uV = 1,
164 },
165};
166
167static struct regulator_init_data aquila_ldo5_data = {
168 .constraints = {
169 .name = "VTF_2.8V",
170 .min_uV = 2800000,
171 .max_uV = 2800000,
172 .apply_uV = 1,
173 },
174};
175
176static struct regulator_init_data aquila_ldo6_data = {
177 .constraints = {
178 .name = "VCC_3.3V",
179 .min_uV = 3300000,
180 .max_uV = 3300000,
181 .apply_uV = 1,
182 },
183};
184
185static struct regulator_init_data aquila_ldo7_data = {
186 .constraints = {
187 .name = "VCC_3.0V",
188 .min_uV = 3000000,
189 .max_uV = 3000000,
190 .apply_uV = 1,
191 .boot_on = 1,
192 .always_on = 1,
193 },
194};
195
196static struct regulator_init_data aquila_ldo8_data = {
197 .constraints = {
198 .name = "VUSB+VADC_3.3V",
199 .min_uV = 3300000,
200 .max_uV = 3300000,
201 .apply_uV = 1,
202 .always_on = 1,
203 },
204};
205
206static struct regulator_init_data aquila_ldo9_data = {
207 .constraints = {
208 .name = "VCC+VCAM_2.8V",
209 .min_uV = 2800000,
210 .max_uV = 2800000,
211 .apply_uV = 1,
212 .always_on = 1,
213 },
214};
215
216static struct regulator_init_data aquila_ldo10_data = {
217 .constraints = {
218 .name = "VPLL_1.1V",
219 .min_uV = 1100000,
220 .max_uV = 1100000,
221 .apply_uV = 1,
222 .boot_on = 1,
223 },
224};
225
226static struct regulator_init_data aquila_ldo11_data = {
227 .constraints = {
228 .name = "CAM_IO_2.8V",
229 .min_uV = 2800000,
230 .max_uV = 2800000,
231 .apply_uV = 1,
232 .always_on = 1,
233 },
234};
235
236static struct regulator_init_data aquila_ldo12_data = {
237 .constraints = {
238 .name = "CAM_ISP_1.2V",
239 .min_uV = 1200000,
240 .max_uV = 1200000,
241 .apply_uV = 1,
242 .always_on = 1,
243 },
244};
245
246static struct regulator_init_data aquila_ldo13_data = {
247 .constraints = {
248 .name = "CAM_A_2.8V",
249 .min_uV = 2800000,
250 .max_uV = 2800000,
251 .apply_uV = 1,
252 .always_on = 1,
253 },
254};
255
256static struct regulator_init_data aquila_ldo14_data = {
257 .constraints = {
258 .name = "CAM_CIF_1.8V",
259 .min_uV = 1800000,
260 .max_uV = 1800000,
261 .apply_uV = 1,
262 .always_on = 1,
263 },
264};
265
266static struct regulator_init_data aquila_ldo15_data = {
267 .constraints = {
268 .name = "CAM_AF_3.3V",
269 .min_uV = 3300000,
270 .max_uV = 3300000,
271 .apply_uV = 1,
272 .always_on = 1,
273 },
274};
275
276static struct regulator_init_data aquila_ldo16_data = {
277 .constraints = {
278 .name = "VMIPI_1.8V",
279 .min_uV = 1800000,
280 .max_uV = 1800000,
281 .apply_uV = 1,
282 .always_on = 1,
283 },
284};
285
286static struct regulator_init_data aquila_ldo17_data = {
287 .constraints = {
288 .name = "CAM_8M_1.8V",
289 .min_uV = 1800000,
290 .max_uV = 1800000,
291 .apply_uV = 1,
292 .always_on = 1,
293 },
294};
295
296/* BUCK */
297static struct regulator_consumer_supply buck1_consumer =
298 REGULATOR_SUPPLY("vddarm", NULL);
299
300static struct regulator_consumer_supply buck2_consumer =
301 REGULATOR_SUPPLY("vddint", NULL);
302
303static struct regulator_init_data aquila_buck1_data = {
304 .constraints = {
305 .name = "VARM_1.2V",
306 .min_uV = 1200000,
307 .max_uV = 1200000,
308 .apply_uV = 1,
309 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
310 REGULATOR_CHANGE_STATUS,
311 },
312 .num_consumer_supplies = 1,
313 .consumer_supplies = &buck1_consumer,
314};
315
316static struct regulator_init_data aquila_buck2_data = {
317 .constraints = {
318 .name = "VINT_1.2V",
319 .min_uV = 1200000,
320 .max_uV = 1200000,
321 .apply_uV = 1,
322 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
323 REGULATOR_CHANGE_STATUS,
324 },
325 .num_consumer_supplies = 1,
326 .consumer_supplies = &buck2_consumer,
327};
328
329static struct regulator_init_data aquila_buck3_data = {
330 .constraints = {
331 .name = "VCC_1.8V",
332 .min_uV = 1800000,
333 .max_uV = 1800000,
334 .apply_uV = 1,
335 .state_mem = {
336 .enabled = 1,
337 },
338 },
339};
340
341static struct regulator_init_data aquila_buck4_data = {
342 .constraints = {
343 .name = "CAM_CORE_1.2V",
344 .min_uV = 1200000,
345 .max_uV = 1200000,
346 .apply_uV = 1,
347 .always_on = 1,
348 },
349};
350
351static struct max8998_regulator_data aquila_regulators[] = {
352 { MAX8998_LDO2, &aquila_ldo2_data },
353 { MAX8998_LDO3, &aquila_ldo3_data },
354 { MAX8998_LDO4, &aquila_ldo4_data },
355 { MAX8998_LDO5, &aquila_ldo5_data },
356 { MAX8998_LDO6, &aquila_ldo6_data },
357 { MAX8998_LDO7, &aquila_ldo7_data },
358 { MAX8998_LDO8, &aquila_ldo8_data },
359 { MAX8998_LDO9, &aquila_ldo9_data },
360 { MAX8998_LDO10, &aquila_ldo10_data },
361 { MAX8998_LDO11, &aquila_ldo11_data },
362 { MAX8998_LDO12, &aquila_ldo12_data },
363 { MAX8998_LDO13, &aquila_ldo13_data },
364 { MAX8998_LDO14, &aquila_ldo14_data },
365 { MAX8998_LDO15, &aquila_ldo15_data },
366 { MAX8998_LDO16, &aquila_ldo16_data },
367 { MAX8998_LDO17, &aquila_ldo17_data },
368 { MAX8998_BUCK1, &aquila_buck1_data },
369 { MAX8998_BUCK2, &aquila_buck2_data },
370 { MAX8998_BUCK3, &aquila_buck3_data },
371 { MAX8998_BUCK4, &aquila_buck4_data },
372};
373
374static struct max8998_platform_data aquila_max8998_pdata = {
375 .num_regulators = ARRAY_SIZE(aquila_regulators),
376 .regulators = aquila_regulators,
377 .buck1_set1 = S5PV210_GPH0(3),
378 .buck1_set2 = S5PV210_GPH0(4),
379 .buck2_set3 = S5PV210_GPH0(5),
380 .buck1_voltage = { 1200000, 1200000, 1200000, 1200000 },
381 .buck2_voltage = { 1200000, 1200000 },
382};
383#endif
384
385static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
386 REGULATOR_SUPPLY("DBVDD", "5-001a"),
387 REGULATOR_SUPPLY("AVDD2", "5-001a"),
388 REGULATOR_SUPPLY("CPVDD", "5-001a"),
389};
390
391static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
392 REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
393 REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
394};
395
396static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
397 .constraints = {
398 .always_on = 1,
399 },
400 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
401 .consumer_supplies = wm8994_fixed_voltage0_supplies,
402};
403
404static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
405 .constraints = {
406 .always_on = 1,
407 },
408 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
409 .consumer_supplies = wm8994_fixed_voltage1_supplies,
410};
411
412static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
413 .supply_name = "VCC_1.8V_PDA",
414 .microvolts = 1800000,
415 .gpio = -EINVAL,
416 .init_data = &wm8994_fixed_voltage0_init_data,
417};
418
419static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
420 .supply_name = "V_BAT",
421 .microvolts = 3700000,
422 .gpio = -EINVAL,
423 .init_data = &wm8994_fixed_voltage1_init_data,
424};
425
426static struct platform_device wm8994_fixed_voltage0 = {
427 .name = "reg-fixed-voltage",
428 .id = 0,
429 .dev = {
430 .platform_data = &wm8994_fixed_voltage0_config,
431 },
432};
433
434static struct platform_device wm8994_fixed_voltage1 = {
435 .name = "reg-fixed-voltage",
436 .id = 1,
437 .dev = {
438 .platform_data = &wm8994_fixed_voltage1_config,
439 },
440};
441
442static struct regulator_consumer_supply wm8994_avdd1_supply =
443 REGULATOR_SUPPLY("AVDD1", "5-001a");
444
445static struct regulator_consumer_supply wm8994_dcvdd_supply =
446 REGULATOR_SUPPLY("DCVDD", "5-001a");
447
448static struct regulator_init_data wm8994_ldo1_data = {
449 .constraints = {
450 .name = "AVDD1_3.0V",
451 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
452 },
453 .num_consumer_supplies = 1,
454 .consumer_supplies = &wm8994_avdd1_supply,
455};
456
457static struct regulator_init_data wm8994_ldo2_data = {
458 .constraints = {
459 .name = "DCVDD_1.0V",
460 },
461 .num_consumer_supplies = 1,
462 .consumer_supplies = &wm8994_dcvdd_supply,
463};
464
465static struct wm8994_pdata wm8994_platform_data = {
466 /* configure gpio1 function: 0x0001(Logic level input/output) */
467 .gpio_defaults[0] = 0x0001,
468 /* configure gpio3/4/5/7 function for AIF2 voice */
469 .gpio_defaults[2] = 0x8100,
470 .gpio_defaults[3] = 0x8100,
471 .gpio_defaults[4] = 0x8100,
472 .gpio_defaults[6] = 0x0100,
473 /* configure gpio8/9/10/11 function for AIF3 BT */
474 .gpio_defaults[7] = 0x8100,
475 .gpio_defaults[8] = 0x0100,
476 .gpio_defaults[9] = 0x0100,
477 .gpio_defaults[10] = 0x0100,
478 .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */
479 .ldo[1] = { 0, &wm8994_ldo2_data },
480};
481
482/* GPIO I2C PMIC */
483#define AP_I2C_GPIO_PMIC_BUS_4 4
484static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = {
485 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
486 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
487};
488
489static struct platform_device aquila_i2c_gpio_pmic = {
490 .name = "i2c-gpio",
491 .id = AP_I2C_GPIO_PMIC_BUS_4,
492 .dev = {
493 .platform_data = &aquila_i2c_gpio_pmic_data,
494 },
495};
496
497static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
498#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
499 {
500 /* 0xCC when SRAD = 0 */
501 I2C_BOARD_INFO("max8998", 0xCC >> 1),
502 .platform_data = &aquila_max8998_pdata,
503 },
504#endif
505};
506
507/* GPIO I2C AP 1.8V */
508#define AP_I2C_GPIO_BUS_5 5
509static struct i2c_gpio_platform_data aquila_i2c_gpio5_data = {
510 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
511 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
512};
513
514static struct platform_device aquila_i2c_gpio5 = {
515 .name = "i2c-gpio",
516 .id = AP_I2C_GPIO_BUS_5,
517 .dev = {
518 .platform_data = &aquila_i2c_gpio5_data,
519 },
520};
521
522static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
523 {
524 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
525 I2C_BOARD_INFO("wm8994", 0x1a),
526 .platform_data = &wm8994_platform_data,
527 },
528};
529
530/* PMIC Power button */
531static struct gpio_keys_button aquila_gpio_keys_table[] = {
532 {
533 .code = KEY_POWER,
534 .gpio = S5PV210_GPH2(6),
535 .desc = "gpio-keys: KEY_POWER",
536 .type = EV_KEY,
537 .active_low = 1,
538 .wakeup = 1,
539 .debounce_interval = 1,
540 },
541};
542
543static struct gpio_keys_platform_data aquila_gpio_keys_data = {
544 .buttons = aquila_gpio_keys_table,
545 .nbuttons = ARRAY_SIZE(aquila_gpio_keys_table),
546};
547
548static struct platform_device aquila_device_gpiokeys = {
549 .name = "gpio-keys",
550 .dev = {
551 .platform_data = &aquila_gpio_keys_data,
552 },
553};
554
555static void __init aquila_pmic_init(void)
556{
557 /* AP_PMIC_IRQ: EINT7 */
558 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
559 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
560
561 /* nPower: EINT22 */
562 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
563 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
564}
565
566/* MoviNAND */
567static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
568 .max_width = 4,
569 .cd_type = S3C_SDHCI_CD_PERMANENT,
570};
571
572/* Wireless LAN */
573static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
574 .max_width = 4,
575 .cd_type = S3C_SDHCI_CD_EXTERNAL,
576 /* ext_cd_{init,cleanup} callbacks will be added later */
577};
578
579/* External Flash */
580#define AQUILA_EXT_FLASH_EN S5PV210_MP05(4)
581#define AQUILA_EXT_FLASH_CD S5PV210_GPH3(4)
582static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
583 .max_width = 4,
584 .cd_type = S3C_SDHCI_CD_GPIO,
585 .ext_cd_gpio = AQUILA_EXT_FLASH_CD,
586 .ext_cd_gpio_invert = 1,
587};
588
589static void aquila_setup_sdhci(void)
590{
591 gpio_request_one(AQUILA_EXT_FLASH_EN, GPIOF_OUT_INIT_HIGH, "FLASH_EN");
592
593 s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
594 s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
595 s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
596};
597
598/* Audio device */
599static struct platform_device aquila_device_audio = {
600 .name = "smdk-audio",
601 .id = -1,
602};
603
604static struct platform_device *aquila_devices[] __initdata = {
605 &aquila_i2c_gpio_pmic,
606 &aquila_i2c_gpio5,
607 &aquila_device_gpiokeys,
608 &aquila_device_audio,
609 &s3c_device_fb,
610 &s5p_device_onenand,
611 &s3c_device_hsmmc0,
612 &s3c_device_hsmmc1,
613 &s3c_device_hsmmc2,
614 &s5p_device_fimc0,
615 &s5p_device_fimc1,
616 &s5p_device_fimc2,
617 &s5p_device_fimc_md,
618 &s5pv210_device_iis0,
619 &wm8994_fixed_voltage0,
620 &wm8994_fixed_voltage1,
621};
622
623static void __init aquila_sound_init(void)
624{
625 unsigned int gpio;
626
627 /* CODEC_XTAL_EN
628 *
629 * The Aquila board have a oscillator which provide main clock
630 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
631 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
632 * */
633 gpio = S5PV210_GPH3(2); /* XEINT_26 */
634 gpio_request(gpio, "CODEC_XTAL_EN");
635 s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
636 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
637
638 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
639 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
640 * because it needs 24MHz clock to operate WM8994 codec.
641 */
642 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
643}
644
645static void __init aquila_map_io(void)
646{
647 s5pv210_init_io(NULL, 0);
648 s3c24xx_init_clocks(24000000);
649 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
650 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
651}
652
653static void __init aquila_machine_init(void)
654{
655 /* PMIC */
656 aquila_pmic_init();
657 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
658 ARRAY_SIZE(i2c_gpio_pmic_devs));
659 /* SDHCI */
660 aquila_setup_sdhci();
661
662 s3c_fimc_setname(0, "s5p-fimc");
663 s3c_fimc_setname(1, "s5p-fimc");
664 s3c_fimc_setname(2, "s5p-fimc");
665
666 /* SOUND */
667 aquila_sound_init();
668 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
669 ARRAY_SIZE(i2c_gpio5_devs));
670
671 /* FB */
672 s3c_fb_set_platdata(&aquila_lcd_pdata);
673
674 platform_add_devices(aquila_devices, ARRAY_SIZE(aquila_devices));
675}
676
677MACHINE_START(AQUILA, "Aquila")
678 /* Maintainers:
679 Marek Szyprowski <m.szyprowski@samsung.com>
680 Kyungmin Park <kyungmin.park@samsung.com> */
681 .atag_offset = 0x100,
682 .init_irq = s5pv210_init_irq,
683 .map_io = aquila_map_io,
684 .init_machine = aquila_machine_init,
685 .init_time = samsung_timer_init,
686 .restart = s5pv210_restart,
687MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
deleted file mode 100644
index c1ce921c4088..000000000000
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ /dev/null
@@ -1,916 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/mach-goni.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/serial_core.h>
15#include <linux/serial_s3c.h>
16#include <linux/fb.h>
17#include <linux/i2c.h>
18#include <linux/i2c-gpio.h>
19#include <linux/i2c/atmel_mxt_ts.h>
20#include <linux/mfd/max8998.h>
21#include <linux/mfd/wm8994/pdata.h>
22#include <linux/regulator/fixed.h>
23#include <linux/spi/spi.h>
24#include <linux/spi/spi_gpio.h>
25#include <linux/lcd.h>
26#include <linux/gpio_keys.h>
27#include <linux/input.h>
28#include <linux/gpio.h>
29#include <linux/mmc/host.h>
30#include <linux/interrupt.h>
31#include <linux/platform_data/s3c-hsotg.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/setup.h>
36#include <asm/mach-types.h>
37
38#include <video/samsung_fimd.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41
42#include <plat/gpio-cfg.h>
43#include <plat/devs.h>
44#include <plat/cpu.h>
45#include <plat/fb.h>
46#include <linux/platform_data/i2c-s3c2410.h>
47#include <plat/keypad.h>
48#include <plat/sdhci.h>
49#include <plat/clock.h>
50#include <plat/samsung-time.h>
51#include <plat/mfc.h>
52
53#include "common.h"
54
55/* Following are default values for UCON, ULCON and UFCON UART registers */
56#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
57 S3C2410_UCON_RXILEVEL | \
58 S3C2410_UCON_TXIRQMODE | \
59 S3C2410_UCON_RXIRQMODE | \
60 S3C2410_UCON_RXFIFO_TOI | \
61 S3C2443_UCON_RXERR_IRQEN)
62
63#define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
64
65#define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
66
67static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
68 [0] = {
69 .hwport = 0,
70 .flags = 0,
71 .ucon = GONI_UCON_DEFAULT,
72 .ulcon = GONI_ULCON_DEFAULT,
73 .ufcon = GONI_UFCON_DEFAULT |
74 S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
75 },
76 [1] = {
77 .hwport = 1,
78 .flags = 0,
79 .ucon = GONI_UCON_DEFAULT,
80 .ulcon = GONI_ULCON_DEFAULT,
81 .ufcon = GONI_UFCON_DEFAULT |
82 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
83 },
84 [2] = {
85 .hwport = 2,
86 .flags = 0,
87 .ucon = GONI_UCON_DEFAULT,
88 .ulcon = GONI_ULCON_DEFAULT,
89 .ufcon = GONI_UFCON_DEFAULT |
90 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
91 },
92 [3] = {
93 .hwport = 3,
94 .flags = 0,
95 .ucon = GONI_UCON_DEFAULT,
96 .ulcon = GONI_ULCON_DEFAULT,
97 .ufcon = GONI_UFCON_DEFAULT |
98 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
99 },
100};
101
102/* Frame Buffer */
103static struct s3c_fb_pd_win goni_fb_win0 = {
104 .max_bpp = 32,
105 .default_bpp = 16,
106 .xres = 480,
107 .yres = 800,
108 .virtual_x = 480,
109 .virtual_y = 2 * 800,
110};
111
112static struct fb_videomode goni_lcd_timing = {
113 .left_margin = 16,
114 .right_margin = 16,
115 .upper_margin = 2,
116 .lower_margin = 28,
117 .hsync_len = 2,
118 .vsync_len = 1,
119 .xres = 480,
120 .yres = 800,
121 .refresh = 55,
122};
123
124static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
125 .win[0] = &goni_fb_win0,
126 .vtiming = &goni_lcd_timing,
127 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
128 VIDCON0_CLKSEL_LCD,
129 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
130 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
131 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
132};
133
134static int lcd_power_on(struct lcd_device *ld, int enable)
135{
136 return 1;
137}
138
139static int reset_lcd(struct lcd_device *ld)
140{
141 static unsigned int first = 1;
142 int reset_gpio = -1;
143
144 reset_gpio = S5PV210_MP05(5);
145
146 if (first) {
147 gpio_request(reset_gpio, "MLCD_RST");
148 first = 0;
149 }
150
151 gpio_direction_output(reset_gpio, 1);
152 return 1;
153}
154
155static struct lcd_platform_data goni_lcd_platform_data = {
156 .reset = reset_lcd,
157 .power_on = lcd_power_on,
158 .lcd_enabled = 0,
159 .reset_delay = 120, /* 120ms */
160 .power_on_delay = 25, /* 25ms */
161 .power_off_delay = 200, /* 200ms */
162};
163
164#define LCD_BUS_NUM 3
165static struct spi_board_info spi_board_info[] __initdata = {
166 {
167 .modalias = "s6e63m0",
168 .platform_data = &goni_lcd_platform_data,
169 .max_speed_hz = 1200000,
170 .bus_num = LCD_BUS_NUM,
171 .chip_select = 0,
172 .mode = SPI_MODE_3,
173 .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
174 },
175};
176
177static struct spi_gpio_platform_data lcd_spi_gpio_data = {
178 .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
179 .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
180 .miso = SPI_GPIO_NO_MISO,
181 .num_chipselect = 1,
182};
183
184static struct platform_device goni_spi_gpio = {
185 .name = "spi_gpio",
186 .id = LCD_BUS_NUM,
187 .dev = {
188 .parent = &s3c_device_fb.dev,
189 .platform_data = &lcd_spi_gpio_data,
190 },
191};
192
193/* KEYPAD */
194static uint32_t keymap[] __initdata = {
195 /* KEY(row, col, keycode) */
196 KEY(0, 1, KEY_MENU), /* Send */
197 KEY(0, 2, KEY_BACK), /* End */
198 KEY(1, 1, KEY_CONFIG), /* Half shot */
199 KEY(1, 2, KEY_VOLUMEUP),
200 KEY(2, 1, KEY_CAMERA), /* Full shot */
201 KEY(2, 2, KEY_VOLUMEDOWN),
202};
203
204static struct matrix_keymap_data keymap_data __initdata = {
205 .keymap = keymap,
206 .keymap_size = ARRAY_SIZE(keymap),
207};
208
209static struct samsung_keypad_platdata keypad_data __initdata = {
210 .keymap_data = &keymap_data,
211 .rows = 3,
212 .cols = 3,
213};
214
215/* Radio */
216static struct i2c_board_info i2c1_devs[] __initdata = {
217 {
218 I2C_BOARD_INFO("si470x", 0x10),
219 },
220};
221
222static void __init goni_radio_init(void)
223{
224 int gpio;
225
226 gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
227 gpio_request(gpio, "FM_INT");
228 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
229 i2c1_devs[0].irq = gpio_to_irq(gpio);
230
231 gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
232 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "FM_RST");
233}
234
235/* TSP */
236static struct mxt_platform_data qt602240_platform_data = {
237 .irqflags = IRQF_TRIGGER_FALLING,
238};
239
240static struct s3c2410_platform_i2c i2c2_data __initdata = {
241 .flags = 0,
242 .bus_num = 2,
243 .slave_addr = 0x10,
244 .frequency = 400 * 1000,
245 .sda_delay = 100,
246};
247
248static struct i2c_board_info i2c2_devs[] __initdata = {
249 {
250 I2C_BOARD_INFO("qt602240_ts", 0x4a),
251 .platform_data = &qt602240_platform_data,
252 },
253};
254
255static void __init goni_tsp_init(void)
256{
257 int gpio;
258
259 gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */
260 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
261 gpio_export(gpio, 0);
262
263 gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */
264 gpio_request(gpio, "TSP_INT");
265
266 s5p_register_gpio_interrupt(gpio);
267 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
268 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
269 i2c2_devs[0].irq = gpio_to_irq(gpio);
270}
271
272/* USB OTG */
273static struct s3c_hsotg_plat goni_hsotg_pdata;
274
275/* MAX8998 regulators */
276#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
277
278static struct regulator_consumer_supply goni_ldo3_consumers[] = {
279 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
280};
281
282static struct regulator_consumer_supply goni_ldo5_consumers[] = {
283 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
284};
285
286static struct regulator_consumer_supply goni_ldo8_consumers[] = {
287 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
288 REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
289};
290
291static struct regulator_consumer_supply goni_ldo11_consumers[] = {
292 REGULATOR_SUPPLY("vddio", "0-0030"), /* "CAM_IO_2.8V" */
293};
294
295static struct regulator_consumer_supply goni_ldo13_consumers[] = {
296 REGULATOR_SUPPLY("vdda", "0-0030"), /* "CAM_A_2.8V" */
297};
298
299static struct regulator_consumer_supply goni_ldo14_consumers[] = {
300 REGULATOR_SUPPLY("vdd_core", "0-0030"), /* "CAM_CIF_1.8V" */
301};
302
303static struct regulator_init_data goni_ldo2_data = {
304 .constraints = {
305 .name = "VALIVE_1.1V",
306 .min_uV = 1100000,
307 .max_uV = 1100000,
308 .apply_uV = 1,
309 .always_on = 1,
310 .state_mem = {
311 .enabled = 1,
312 },
313 },
314};
315
316static struct regulator_init_data goni_ldo3_data = {
317 .constraints = {
318 .name = "VUSB+MIPI_1.1V",
319 .min_uV = 1100000,
320 .max_uV = 1100000,
321 .apply_uV = 1,
322 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
323 },
324 .num_consumer_supplies = ARRAY_SIZE(goni_ldo3_consumers),
325 .consumer_supplies = goni_ldo3_consumers,
326};
327
328static struct regulator_init_data goni_ldo4_data = {
329 .constraints = {
330 .name = "VDAC_3.3V",
331 .min_uV = 3300000,
332 .max_uV = 3300000,
333 .apply_uV = 1,
334 },
335};
336
337static struct regulator_init_data goni_ldo5_data = {
338 .constraints = {
339 .name = "VTF_2.8V",
340 .min_uV = 2800000,
341 .max_uV = 2800000,
342 .apply_uV = 1,
343 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
344 },
345 .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers),
346 .consumer_supplies = goni_ldo5_consumers,
347};
348
349static struct regulator_init_data goni_ldo6_data = {
350 .constraints = {
351 .name = "VCC_3.3V",
352 .min_uV = 3300000,
353 .max_uV = 3300000,
354 .apply_uV = 1,
355 },
356};
357
358static struct regulator_init_data goni_ldo7_data = {
359 .constraints = {
360 .name = "VLCD_1.8V",
361 .min_uV = 1800000,
362 .max_uV = 1800000,
363 .apply_uV = 1,
364 .always_on = 1,
365 },
366};
367
368static struct regulator_init_data goni_ldo8_data = {
369 .constraints = {
370 .name = "VUSB+VADC_3.3V",
371 .min_uV = 3300000,
372 .max_uV = 3300000,
373 .apply_uV = 1,
374 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
375 },
376 .num_consumer_supplies = ARRAY_SIZE(goni_ldo8_consumers),
377 .consumer_supplies = goni_ldo8_consumers,
378};
379
380static struct regulator_init_data goni_ldo9_data = {
381 .constraints = {
382 .name = "VCC+VCAM_2.8V",
383 .min_uV = 2800000,
384 .max_uV = 2800000,
385 .apply_uV = 1,
386 },
387};
388
389static struct regulator_init_data goni_ldo10_data = {
390 .constraints = {
391 .name = "VPLL_1.1V",
392 .min_uV = 1100000,
393 .max_uV = 1100000,
394 .apply_uV = 1,
395 .boot_on = 1,
396 },
397};
398
399static struct regulator_init_data goni_ldo11_data = {
400 .constraints = {
401 .name = "CAM_IO_2.8V",
402 .min_uV = 2800000,
403 .max_uV = 2800000,
404 .apply_uV = 1,
405 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
406 },
407 .num_consumer_supplies = ARRAY_SIZE(goni_ldo11_consumers),
408 .consumer_supplies = goni_ldo11_consumers,
409};
410
411static struct regulator_init_data goni_ldo12_data = {
412 .constraints = {
413 .name = "CAM_ISP_1.2V",
414 .min_uV = 1200000,
415 .max_uV = 1200000,
416 .apply_uV = 1,
417 },
418};
419
420static struct regulator_init_data goni_ldo13_data = {
421 .constraints = {
422 .name = "CAM_A_2.8V",
423 .min_uV = 2800000,
424 .max_uV = 2800000,
425 .apply_uV = 1,
426 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
427 },
428 .num_consumer_supplies = ARRAY_SIZE(goni_ldo13_consumers),
429 .consumer_supplies = goni_ldo13_consumers,
430};
431
432static struct regulator_init_data goni_ldo14_data = {
433 .constraints = {
434 .name = "CAM_CIF_1.8V",
435 .min_uV = 1800000,
436 .max_uV = 1800000,
437 .apply_uV = 1,
438 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
439 },
440 .num_consumer_supplies = ARRAY_SIZE(goni_ldo14_consumers),
441 .consumer_supplies = goni_ldo14_consumers,
442};
443
444static struct regulator_init_data goni_ldo15_data = {
445 .constraints = {
446 .name = "CAM_AF_3.3V",
447 .min_uV = 3300000,
448 .max_uV = 3300000,
449 .apply_uV = 1,
450 },
451};
452
453static struct regulator_init_data goni_ldo16_data = {
454 .constraints = {
455 .name = "VMIPI_1.8V",
456 .min_uV = 1800000,
457 .max_uV = 1800000,
458 .apply_uV = 1,
459 },
460};
461
462static struct regulator_init_data goni_ldo17_data = {
463 .constraints = {
464 .name = "VCC_3.0V_LCD",
465 .min_uV = 3000000,
466 .max_uV = 3000000,
467 .apply_uV = 1,
468 .always_on = 1,
469 },
470};
471
472/* BUCK */
473static struct regulator_consumer_supply buck1_consumer =
474 REGULATOR_SUPPLY("vddarm", NULL);
475
476static struct regulator_consumer_supply buck2_consumer =
477 REGULATOR_SUPPLY("vddint", NULL);
478
479static struct regulator_consumer_supply buck3_consumer =
480 REGULATOR_SUPPLY("vdet", "s5p-sdo");
481
482
483static struct regulator_init_data goni_buck1_data = {
484 .constraints = {
485 .name = "VARM_1.2V",
486 .min_uV = 1200000,
487 .max_uV = 1200000,
488 .apply_uV = 1,
489 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
490 REGULATOR_CHANGE_STATUS,
491 },
492 .num_consumer_supplies = 1,
493 .consumer_supplies = &buck1_consumer,
494};
495
496static struct regulator_init_data goni_buck2_data = {
497 .constraints = {
498 .name = "VINT_1.2V",
499 .min_uV = 1200000,
500 .max_uV = 1200000,
501 .apply_uV = 1,
502 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
503 REGULATOR_CHANGE_STATUS,
504 },
505 .num_consumer_supplies = 1,
506 .consumer_supplies = &buck2_consumer,
507};
508
509static struct regulator_init_data goni_buck3_data = {
510 .constraints = {
511 .name = "VCC_1.8V",
512 .min_uV = 1800000,
513 .max_uV = 1800000,
514 .apply_uV = 1,
515 .state_mem = {
516 .enabled = 1,
517 },
518 },
519 .num_consumer_supplies = 1,
520 .consumer_supplies = &buck3_consumer,
521};
522
523static struct regulator_init_data goni_buck4_data = {
524 .constraints = {
525 .name = "CAM_CORE_1.2V",
526 .min_uV = 1200000,
527 .max_uV = 1200000,
528 .apply_uV = 1,
529 .always_on = 1,
530 },
531};
532
533static struct max8998_regulator_data goni_regulators[] = {
534 { MAX8998_LDO2, &goni_ldo2_data },
535 { MAX8998_LDO3, &goni_ldo3_data },
536 { MAX8998_LDO4, &goni_ldo4_data },
537 { MAX8998_LDO5, &goni_ldo5_data },
538 { MAX8998_LDO6, &goni_ldo6_data },
539 { MAX8998_LDO7, &goni_ldo7_data },
540 { MAX8998_LDO8, &goni_ldo8_data },
541 { MAX8998_LDO9, &goni_ldo9_data },
542 { MAX8998_LDO10, &goni_ldo10_data },
543 { MAX8998_LDO11, &goni_ldo11_data },
544 { MAX8998_LDO12, &goni_ldo12_data },
545 { MAX8998_LDO13, &goni_ldo13_data },
546 { MAX8998_LDO14, &goni_ldo14_data },
547 { MAX8998_LDO15, &goni_ldo15_data },
548 { MAX8998_LDO16, &goni_ldo16_data },
549 { MAX8998_LDO17, &goni_ldo17_data },
550 { MAX8998_BUCK1, &goni_buck1_data },
551 { MAX8998_BUCK2, &goni_buck2_data },
552 { MAX8998_BUCK3, &goni_buck3_data },
553 { MAX8998_BUCK4, &goni_buck4_data },
554};
555
556static struct max8998_platform_data goni_max8998_pdata = {
557 .num_regulators = ARRAY_SIZE(goni_regulators),
558 .regulators = goni_regulators,
559 .buck1_set1 = S5PV210_GPH0(3),
560 .buck1_set2 = S5PV210_GPH0(4),
561 .buck2_set3 = S5PV210_GPH0(5),
562 .buck1_voltage = { 1200000, 1200000, 1200000, 1200000 },
563 .buck2_voltage = { 1200000, 1200000 },
564};
565#endif
566
567static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
568 REGULATOR_SUPPLY("DBVDD", "5-001a"),
569 REGULATOR_SUPPLY("AVDD2", "5-001a"),
570 REGULATOR_SUPPLY("CPVDD", "5-001a"),
571};
572
573static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
574 REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
575 REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
576};
577
578static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
579 .constraints = {
580 .always_on = 1,
581 },
582 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
583 .consumer_supplies = wm8994_fixed_voltage0_supplies,
584};
585
586static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
587 .constraints = {
588 .always_on = 1,
589 },
590 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
591 .consumer_supplies = wm8994_fixed_voltage1_supplies,
592};
593
594static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
595 .supply_name = "VCC_1.8V_PDA",
596 .microvolts = 1800000,
597 .gpio = -EINVAL,
598 .init_data = &wm8994_fixed_voltage0_init_data,
599};
600
601static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
602 .supply_name = "V_BAT",
603 .microvolts = 3700000,
604 .gpio = -EINVAL,
605 .init_data = &wm8994_fixed_voltage1_init_data,
606};
607
608static struct platform_device wm8994_fixed_voltage0 = {
609 .name = "reg-fixed-voltage",
610 .id = 0,
611 .dev = {
612 .platform_data = &wm8994_fixed_voltage0_config,
613 },
614};
615
616static struct platform_device wm8994_fixed_voltage1 = {
617 .name = "reg-fixed-voltage",
618 .id = 1,
619 .dev = {
620 .platform_data = &wm8994_fixed_voltage1_config,
621 },
622};
623
624static struct regulator_consumer_supply wm8994_avdd1_supply =
625 REGULATOR_SUPPLY("AVDD1", "5-001a");
626
627static struct regulator_consumer_supply wm8994_dcvdd_supply =
628 REGULATOR_SUPPLY("DCVDD", "5-001a");
629
630static struct regulator_init_data wm8994_ldo1_data = {
631 .constraints = {
632 .name = "AVDD1_3.0V",
633 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
634 },
635 .num_consumer_supplies = 1,
636 .consumer_supplies = &wm8994_avdd1_supply,
637};
638
639static struct regulator_init_data wm8994_ldo2_data = {
640 .constraints = {
641 .name = "DCVDD_1.0V",
642 },
643 .num_consumer_supplies = 1,
644 .consumer_supplies = &wm8994_dcvdd_supply,
645};
646
647static struct wm8994_pdata wm8994_platform_data = {
648 /* configure gpio1 function: 0x0001(Logic level input/output) */
649 .gpio_defaults[0] = 0x0001,
650 /* configure gpio3/4/5/7 function for AIF2 voice */
651 .gpio_defaults[2] = 0x8100,
652 .gpio_defaults[3] = 0x8100,
653 .gpio_defaults[4] = 0x8100,
654 .gpio_defaults[6] = 0x0100,
655 /* configure gpio8/9/10/11 function for AIF3 BT */
656 .gpio_defaults[7] = 0x8100,
657 .gpio_defaults[8] = 0x0100,
658 .gpio_defaults[9] = 0x0100,
659 .gpio_defaults[10] = 0x0100,
660 .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */
661 .ldo[1] = { 0, &wm8994_ldo2_data },
662};
663
664/* GPIO I2C PMIC */
665#define AP_I2C_GPIO_PMIC_BUS_4 4
666static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
667 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
668 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
669};
670
671static struct platform_device goni_i2c_gpio_pmic = {
672 .name = "i2c-gpio",
673 .id = AP_I2C_GPIO_PMIC_BUS_4,
674 .dev = {
675 .platform_data = &goni_i2c_gpio_pmic_data,
676 },
677};
678
679static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
680#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
681 {
682 /* 0xCC when SRAD = 0 */
683 I2C_BOARD_INFO("max8998", 0xCC >> 1),
684 .platform_data = &goni_max8998_pdata,
685 },
686#endif
687};
688
689/* GPIO I2C AP 1.8V */
690#define AP_I2C_GPIO_BUS_5 5
691static struct i2c_gpio_platform_data goni_i2c_gpio5_data = {
692 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
693 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
694};
695
696static struct platform_device goni_i2c_gpio5 = {
697 .name = "i2c-gpio",
698 .id = AP_I2C_GPIO_BUS_5,
699 .dev = {
700 .platform_data = &goni_i2c_gpio5_data,
701 },
702};
703
704static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
705 {
706 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
707 I2C_BOARD_INFO("wm8994", 0x1a),
708 .platform_data = &wm8994_platform_data,
709 },
710};
711
712/* PMIC Power button */
713static struct gpio_keys_button goni_gpio_keys_table[] = {
714 {
715 .code = KEY_POWER,
716 .gpio = S5PV210_GPH2(6),
717 .desc = "gpio-keys: KEY_POWER",
718 .type = EV_KEY,
719 .active_low = 1,
720 .wakeup = 1,
721 .debounce_interval = 1,
722 },
723};
724
725static struct gpio_keys_platform_data goni_gpio_keys_data = {
726 .buttons = goni_gpio_keys_table,
727 .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
728};
729
730static struct platform_device goni_device_gpiokeys = {
731 .name = "gpio-keys",
732 .dev = {
733 .platform_data = &goni_gpio_keys_data,
734 },
735};
736
737static void __init goni_pmic_init(void)
738{
739 /* AP_PMIC_IRQ: EINT7 */
740 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
741 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
742
743 /* nPower: EINT22 */
744 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
745 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
746}
747
748/* MoviNAND */
749static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
750 .max_width = 4,
751 .cd_type = S3C_SDHCI_CD_PERMANENT,
752};
753
754/* Wireless LAN */
755static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
756 .max_width = 4,
757 .cd_type = S3C_SDHCI_CD_EXTERNAL,
758 /* ext_cd_{init,cleanup} callbacks will be added later */
759};
760
761/* External Flash */
762#define GONI_EXT_FLASH_EN S5PV210_MP05(4)
763#define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
764static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
765 .max_width = 4,
766 .cd_type = S3C_SDHCI_CD_GPIO,
767 .ext_cd_gpio = GONI_EXT_FLASH_CD,
768 .ext_cd_gpio_invert = 1,
769};
770
771static struct regulator_consumer_supply mmc2_supplies[] = {
772 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
773};
774
775static struct regulator_init_data mmc2_fixed_voltage_init_data = {
776 .constraints = {
777 .name = "V_TF_2.8V",
778 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
779 },
780 .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies),
781 .consumer_supplies = mmc2_supplies,
782};
783
784static struct fixed_voltage_config mmc2_fixed_voltage_config = {
785 .supply_name = "EXT_FLASH_EN",
786 .microvolts = 2800000,
787 .gpio = GONI_EXT_FLASH_EN,
788 .enable_high = true,
789 .init_data = &mmc2_fixed_voltage_init_data,
790};
791
792static struct platform_device mmc2_fixed_voltage = {
793 .name = "reg-fixed-voltage",
794 .id = 2,
795 .dev = {
796 .platform_data = &mmc2_fixed_voltage_config,
797 },
798};
799
800static void goni_setup_sdhci(void)
801{
802 s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
803 s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
804 s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
805};
806
807/* Audio device */
808static struct platform_device goni_device_audio = {
809 .name = "smdk-audio",
810 .id = -1,
811};
812
813static struct platform_device *goni_devices[] __initdata = {
814 &s3c_device_fb,
815 &s5p_device_onenand,
816 &goni_spi_gpio,
817 &goni_i2c_gpio_pmic,
818 &goni_i2c_gpio5,
819 &goni_device_audio,
820 &mmc2_fixed_voltage,
821 &goni_device_gpiokeys,
822 &s5p_device_mfc,
823 &s5p_device_mfc_l,
824 &s5p_device_mfc_r,
825 &s5p_device_mixer,
826 &s5p_device_sdo,
827 &s3c_device_i2c0,
828 &s3c_device_hsmmc0,
829 &s3c_device_hsmmc1,
830 &s3c_device_hsmmc2,
831 &s5pv210_device_iis0,
832 &s3c_device_usb_hsotg,
833 &samsung_device_keypad,
834 &s3c_device_i2c1,
835 &s3c_device_i2c2,
836 &wm8994_fixed_voltage0,
837 &wm8994_fixed_voltage1,
838};
839
840static void __init goni_sound_init(void)
841{
842 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
843 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
844 * because it needs 24MHz clock to operate WM8994 codec.
845 */
846 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
847}
848
849static void __init goni_map_io(void)
850{
851 s5pv210_init_io(NULL, 0);
852 s3c24xx_init_clocks(clk_xusbxti.rate);
853 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
854 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
855}
856
857static void __init goni_reserve(void)
858{
859 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
860}
861
862static void __init goni_machine_init(void)
863{
864 /* Radio: call before I2C 1 registeration */
865 goni_radio_init();
866
867 /* I2C0 */
868 s3c_i2c0_set_platdata(NULL);
869
870 /* I2C1 */
871 s3c_i2c1_set_platdata(NULL);
872 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
873
874 /* TSP: call before I2C 2 registeration */
875 goni_tsp_init();
876
877 /* I2C2 */
878 s3c_i2c2_set_platdata(&i2c2_data);
879 i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs));
880
881 /* PMIC */
882 goni_pmic_init();
883 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
884 ARRAY_SIZE(i2c_gpio_pmic_devs));
885 /* SDHCI */
886 goni_setup_sdhci();
887
888 /* SOUND */
889 goni_sound_init();
890 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
891 ARRAY_SIZE(i2c_gpio5_devs));
892
893 /* FB */
894 s3c_fb_set_platdata(&goni_lcd_pdata);
895
896 s3c_hsotg_set_platdata(&goni_hsotg_pdata);
897
898 /* SPI */
899 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
900
901 /* KEYPAD */
902 samsung_keypad_set_platdata(&keypad_data);
903
904 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
905}
906
907MACHINE_START(GONI, "GONI")
908 /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
909 .atag_offset = 0x100,
910 .init_irq = s5pv210_init_irq,
911 .map_io = goni_map_io,
912 .init_machine = goni_machine_init,
913 .init_time = samsung_timer_init,
914 .reserve = &goni_reserve,
915 .restart = s5pv210_restart,
916MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
deleted file mode 100644
index 448e1d2eeed6..000000000000
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ /dev/null
@@ -1,159 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/mach-smdkc110.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/serial_core.h>
15#include <linux/serial_s3c.h>
16#include <linux/i2c.h>
17#include <linux/device.h>
18
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/setup.h>
22#include <asm/mach-types.h>
23
24#include <mach/map.h>
25#include <mach/regs-clock.h>
26
27#include <plat/devs.h>
28#include <plat/cpu.h>
29#include <linux/platform_data/ata-samsung_cf.h>
30#include <linux/platform_data/i2c-s3c2410.h>
31#include <plat/pm.h>
32#include <plat/samsung-time.h>
33#include <plat/mfc.h>
34
35#include "common.h"
36
37/* Following are default values for UCON, ULCON and UFCON UART registers */
38#define SMDKC110_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
39 S3C2410_UCON_RXILEVEL | \
40 S3C2410_UCON_TXIRQMODE | \
41 S3C2410_UCON_RXIRQMODE | \
42 S3C2410_UCON_RXFIFO_TOI | \
43 S3C2443_UCON_RXERR_IRQEN)
44
45#define SMDKC110_ULCON_DEFAULT S3C2410_LCON_CS8
46
47#define SMDKC110_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
48 S5PV210_UFCON_TXTRIG4 | \
49 S5PV210_UFCON_RXTRIG4)
50
51static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
52 [0] = {
53 .hwport = 0,
54 .flags = 0,
55 .ucon = SMDKC110_UCON_DEFAULT,
56 .ulcon = SMDKC110_ULCON_DEFAULT,
57 .ufcon = SMDKC110_UFCON_DEFAULT,
58 },
59 [1] = {
60 .hwport = 1,
61 .flags = 0,
62 .ucon = SMDKC110_UCON_DEFAULT,
63 .ulcon = SMDKC110_ULCON_DEFAULT,
64 .ufcon = SMDKC110_UFCON_DEFAULT,
65 },
66 [2] = {
67 .hwport = 2,
68 .flags = 0,
69 .ucon = SMDKC110_UCON_DEFAULT,
70 .ulcon = SMDKC110_ULCON_DEFAULT,
71 .ufcon = SMDKC110_UFCON_DEFAULT,
72 },
73 [3] = {
74 .hwport = 3,
75 .flags = 0,
76 .ucon = SMDKC110_UCON_DEFAULT,
77 .ulcon = SMDKC110_ULCON_DEFAULT,
78 .ufcon = SMDKC110_UFCON_DEFAULT,
79 },
80};
81
82static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
83 .setup_gpio = s5pv210_ide_setup_gpio,
84};
85
86static struct platform_device *smdkc110_devices[] __initdata = {
87 &s5pv210_device_iis0,
88 &s5pv210_device_ac97,
89 &s5pv210_device_spdif,
90 &s3c_device_cfcon,
91 &s3c_device_i2c0,
92 &s3c_device_i2c1,
93 &s3c_device_i2c2,
94 &s3c_device_rtc,
95 &s3c_device_wdt,
96 &s5p_device_fimc0,
97 &s5p_device_fimc1,
98 &s5p_device_fimc2,
99 &s5p_device_fimc_md,
100 &s5p_device_mfc,
101 &s5p_device_mfc_l,
102 &s5p_device_mfc_r,
103};
104
105static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = {
106 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
107 { I2C_BOARD_INFO("wm8580", 0x1b), },
108};
109
110static struct i2c_board_info smdkc110_i2c_devs1[] __initdata = {
111 /* To Be Updated */
112};
113
114static struct i2c_board_info smdkc110_i2c_devs2[] __initdata = {
115 /* To Be Updated */
116};
117
118static void __init smdkc110_map_io(void)
119{
120 s5pv210_init_io(NULL, 0);
121 s3c24xx_init_clocks(24000000);
122 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
123 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
124}
125
126static void __init smdkc110_reserve(void)
127{
128 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
129}
130
131static void __init smdkc110_machine_init(void)
132{
133 s3c_pm_init();
134
135 s3c_i2c0_set_platdata(NULL);
136 s3c_i2c1_set_platdata(NULL);
137 s3c_i2c2_set_platdata(NULL);
138 i2c_register_board_info(0, smdkc110_i2c_devs0,
139 ARRAY_SIZE(smdkc110_i2c_devs0));
140 i2c_register_board_info(1, smdkc110_i2c_devs1,
141 ARRAY_SIZE(smdkc110_i2c_devs1));
142 i2c_register_board_info(2, smdkc110_i2c_devs2,
143 ARRAY_SIZE(smdkc110_i2c_devs2));
144
145 s3c_ide_set_platdata(&smdkc110_ide_pdata);
146
147 platform_add_devices(smdkc110_devices, ARRAY_SIZE(smdkc110_devices));
148}
149
150MACHINE_START(SMDKC110, "SMDKC110")
151 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
152 .atag_offset = 0x100,
153 .init_irq = s5pv210_init_irq,
154 .map_io = smdkc110_map_io,
155 .init_machine = smdkc110_machine_init,
156 .init_time = samsung_timer_init,
157 .restart = s5pv210_restart,
158 .reserve = &smdkc110_reserve,
159MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
deleted file mode 100644
index 2a6655fb63e7..000000000000
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ /dev/null
@@ -1,337 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/mach-smdkv210.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/serial_core.h>
16#include <linux/serial_s3c.h>
17#include <linux/device.h>
18#include <linux/dm9000.h>
19#include <linux/fb.h>
20#include <linux/gpio.h>
21#include <linux/delay.h>
22#include <linux/pwm_backlight.h>
23#include <linux/platform_data/s3c-hsotg.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/setup.h>
28#include <asm/mach-types.h>
29
30#include <video/platform_lcd.h>
31#include <video/samsung_fimd.h>
32
33#include <mach/map.h>
34#include <mach/regs-clock.h>
35
36#include <plat/regs-srom.h>
37#include <plat/gpio-cfg.h>
38#include <plat/devs.h>
39#include <plat/cpu.h>
40#include <plat/adc.h>
41#include <linux/platform_data/touchscreen-s3c2410.h>
42#include <linux/platform_data/ata-samsung_cf.h>
43#include <linux/platform_data/i2c-s3c2410.h>
44#include <plat/keypad.h>
45#include <plat/pm.h>
46#include <plat/fb.h>
47#include <plat/samsung-time.h>
48#include <plat/backlight.h>
49#include <plat/mfc.h>
50#include <plat/clock.h>
51
52#include "common.h"
53
54/* Following are default values for UCON, ULCON and UFCON UART registers */
55#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
56 S3C2410_UCON_RXILEVEL | \
57 S3C2410_UCON_TXIRQMODE | \
58 S3C2410_UCON_RXIRQMODE | \
59 S3C2410_UCON_RXFIFO_TOI | \
60 S3C2443_UCON_RXERR_IRQEN)
61
62#define SMDKV210_ULCON_DEFAULT S3C2410_LCON_CS8
63
64#define SMDKV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
65 S5PV210_UFCON_TXTRIG4 | \
66 S5PV210_UFCON_RXTRIG4)
67
68static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
69 [0] = {
70 .hwport = 0,
71 .flags = 0,
72 .ucon = SMDKV210_UCON_DEFAULT,
73 .ulcon = SMDKV210_ULCON_DEFAULT,
74 .ufcon = SMDKV210_UFCON_DEFAULT,
75 },
76 [1] = {
77 .hwport = 1,
78 .flags = 0,
79 .ucon = SMDKV210_UCON_DEFAULT,
80 .ulcon = SMDKV210_ULCON_DEFAULT,
81 .ufcon = SMDKV210_UFCON_DEFAULT,
82 },
83 [2] = {
84 .hwport = 2,
85 .flags = 0,
86 .ucon = SMDKV210_UCON_DEFAULT,
87 .ulcon = SMDKV210_ULCON_DEFAULT,
88 .ufcon = SMDKV210_UFCON_DEFAULT,
89 },
90 [3] = {
91 .hwport = 3,
92 .flags = 0,
93 .ucon = SMDKV210_UCON_DEFAULT,
94 .ulcon = SMDKV210_ULCON_DEFAULT,
95 .ufcon = SMDKV210_UFCON_DEFAULT,
96 },
97};
98
99static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
100 .setup_gpio = s5pv210_ide_setup_gpio,
101};
102
103static uint32_t smdkv210_keymap[] __initdata = {
104 /* KEY(row, col, keycode) */
105 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
106 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
107 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
108 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
109};
110
111static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
112 .keymap = smdkv210_keymap,
113 .keymap_size = ARRAY_SIZE(smdkv210_keymap),
114};
115
116static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
117 .keymap_data = &smdkv210_keymap_data,
118 .rows = 8,
119 .cols = 8,
120};
121
122static struct resource smdkv210_dm9000_resources[] = {
123 [0] = DEFINE_RES_MEM(S5PV210_PA_SROM_BANK5, 1),
124 [1] = DEFINE_RES_MEM(S5PV210_PA_SROM_BANK5 + 2, 1),
125 [2] = DEFINE_RES_NAMED(IRQ_EINT(9), 1, NULL, IORESOURCE_IRQ \
126 | IORESOURCE_IRQ_HIGHLEVEL),
127};
128
129static struct dm9000_plat_data smdkv210_dm9000_platdata = {
130 .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
131 .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 },
132};
133
134static struct platform_device smdkv210_dm9000 = {
135 .name = "dm9000",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(smdkv210_dm9000_resources),
138 .resource = smdkv210_dm9000_resources,
139 .dev = {
140 .platform_data = &smdkv210_dm9000_platdata,
141 },
142};
143
144static void smdkv210_lte480wv_set_power(struct plat_lcd_data *pd,
145 unsigned int power)
146{
147 if (power) {
148#if !defined(CONFIG_BACKLIGHT_PWM)
149 gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_HIGH, "GPD0");
150 gpio_free(S5PV210_GPD0(3));
151#endif
152
153 /* fire nRESET on power up */
154 gpio_request_one(S5PV210_GPH0(6), GPIOF_OUT_INIT_HIGH, "GPH0");
155
156 gpio_set_value(S5PV210_GPH0(6), 0);
157 mdelay(10);
158
159 gpio_set_value(S5PV210_GPH0(6), 1);
160 mdelay(10);
161
162 gpio_free(S5PV210_GPH0(6));
163 } else {
164#if !defined(CONFIG_BACKLIGHT_PWM)
165 gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_LOW, "GPD0");
166 gpio_free(S5PV210_GPD0(3));
167#endif
168 }
169}
170
171static struct plat_lcd_data smdkv210_lcd_lte480wv_data = {
172 .set_power = smdkv210_lte480wv_set_power,
173};
174
175static struct platform_device smdkv210_lcd_lte480wv = {
176 .name = "platform-lcd",
177 .dev.parent = &s3c_device_fb.dev,
178 .dev.platform_data = &smdkv210_lcd_lte480wv_data,
179};
180
181static struct s3c_fb_pd_win smdkv210_fb_win0 = {
182 .max_bpp = 32,
183 .default_bpp = 24,
184 .xres = 800,
185 .yres = 480,
186};
187
188static struct fb_videomode smdkv210_lcd_timing = {
189 .left_margin = 13,
190 .right_margin = 8,
191 .upper_margin = 7,
192 .lower_margin = 5,
193 .hsync_len = 3,
194 .vsync_len = 1,
195 .xres = 800,
196 .yres = 480,
197};
198
199static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
200 .win[0] = &smdkv210_fb_win0,
201 .vtiming = &smdkv210_lcd_timing,
202 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
203 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
204 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
205};
206
207/* USB OTG */
208static struct s3c_hsotg_plat smdkv210_hsotg_pdata;
209
210static struct platform_device *smdkv210_devices[] __initdata = {
211 &s3c_device_adc,
212 &s3c_device_cfcon,
213 &s3c_device_fb,
214 &s3c_device_hsmmc0,
215 &s3c_device_hsmmc1,
216 &s3c_device_hsmmc2,
217 &s3c_device_hsmmc3,
218 &s3c_device_i2c0,
219 &s3c_device_i2c1,
220 &s3c_device_i2c2,
221 &samsung_device_pwm,
222 &s3c_device_rtc,
223 &s3c_device_ts,
224 &s3c_device_usb_hsotg,
225 &s3c_device_wdt,
226 &s5p_device_fimc0,
227 &s5p_device_fimc1,
228 &s5p_device_fimc2,
229 &s5p_device_fimc_md,
230 &s5p_device_jpeg,
231 &s5p_device_mfc,
232 &s5p_device_mfc_l,
233 &s5p_device_mfc_r,
234 &s5pv210_device_ac97,
235 &s5pv210_device_iis0,
236 &s5pv210_device_spdif,
237 &samsung_asoc_idma,
238 &samsung_device_keypad,
239 &smdkv210_dm9000,
240 &smdkv210_lcd_lte480wv,
241};
242
243static void __init smdkv210_dm9000_init(void)
244{
245 unsigned int tmp;
246
247 gpio_request(S5PV210_MP01(5), "nCS5");
248 s3c_gpio_cfgpin(S5PV210_MP01(5), S3C_GPIO_SFN(2));
249 gpio_free(S5PV210_MP01(5));
250
251 tmp = (5 << S5P_SROM_BCX__TACC__SHIFT);
252 __raw_writel(tmp, S5P_SROM_BC5);
253
254 tmp = __raw_readl(S5P_SROM_BW);
255 tmp &= (S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS5__SHIFT);
256 tmp |= (1 << S5P_SROM_BW__NCS5__SHIFT);
257 __raw_writel(tmp, S5P_SROM_BW);
258}
259
260static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = {
261 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
262 { I2C_BOARD_INFO("wm8580", 0x1b), },
263};
264
265static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = {
266 /* To Be Updated */
267};
268
269static struct i2c_board_info smdkv210_i2c_devs2[] __initdata = {
270 /* To Be Updated */
271};
272
273/* LCD Backlight data */
274static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = {
275 .no = S5PV210_GPD0(3),
276 .func = S3C_GPIO_SFN(2),
277};
278
279static struct platform_pwm_backlight_data smdkv210_bl_data = {
280 .pwm_id = 3,
281 .pwm_period_ns = 1000,
282 .enable_gpio = -1,
283};
284
285static void __init smdkv210_map_io(void)
286{
287 s5pv210_init_io(NULL, 0);
288 s3c24xx_init_clocks(clk_xusbxti.rate);
289 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
290 samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
291}
292
293static void __init smdkv210_reserve(void)
294{
295 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
296}
297
298static void __init smdkv210_machine_init(void)
299{
300 s3c_pm_init();
301
302 smdkv210_dm9000_init();
303
304 samsung_keypad_set_platdata(&smdkv210_keypad_data);
305 s3c24xx_ts_set_platdata(NULL);
306
307 s3c_i2c0_set_platdata(NULL);
308 s3c_i2c1_set_platdata(NULL);
309 s3c_i2c2_set_platdata(NULL);
310 i2c_register_board_info(0, smdkv210_i2c_devs0,
311 ARRAY_SIZE(smdkv210_i2c_devs0));
312 i2c_register_board_info(1, smdkv210_i2c_devs1,
313 ARRAY_SIZE(smdkv210_i2c_devs1));
314 i2c_register_board_info(2, smdkv210_i2c_devs2,
315 ARRAY_SIZE(smdkv210_i2c_devs2));
316
317 s3c_ide_set_platdata(&smdkv210_ide_pdata);
318
319 s3c_fb_set_platdata(&smdkv210_lcd0_pdata);
320
321 s3c_hsotg_set_platdata(&smdkv210_hsotg_pdata);
322
323 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
324
325 samsung_bl_set(&smdkv210_bl_gpio_info, &smdkv210_bl_data);
326}
327
328MACHINE_START(SMDKV210, "SMDKV210")
329 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
330 .atag_offset = 0x100,
331 .init_irq = s5pv210_init_irq,
332 .map_io = smdkv210_map_io,
333 .init_machine = smdkv210_machine_init,
334 .init_time = samsung_timer_init,
335 .restart = s5pv210_restart,
336 .reserve = &smdkv210_reserve,
337MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
deleted file mode 100644
index 157805529f26..000000000000
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ /dev/null
@@ -1,135 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/mach-torbreck.c
2 *
3 * Copyright (c) 2010 aESOP Community
4 * http://www.aesop.or.kr/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/serial_core.h>
16#include <linux/serial_s3c.h>
17
18#include <asm/mach/arch.h>
19#include <asm/mach/map.h>
20#include <asm/setup.h>
21#include <asm/mach-types.h>
22
23#include <mach/map.h>
24#include <mach/regs-clock.h>
25
26#include <plat/devs.h>
27#include <plat/cpu.h>
28#include <linux/platform_data/i2c-s3c2410.h>
29#include <plat/samsung-time.h>
30
31#include "common.h"
32
33/* Following are default values for UCON, ULCON and UFCON UART registers */
34#define TORBRECK_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
35 S3C2410_UCON_RXILEVEL | \
36 S3C2410_UCON_TXIRQMODE | \
37 S3C2410_UCON_RXIRQMODE | \
38 S3C2410_UCON_RXFIFO_TOI | \
39 S3C2443_UCON_RXERR_IRQEN)
40
41#define TORBRECK_ULCON_DEFAULT S3C2410_LCON_CS8
42
43#define TORBRECK_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
44 S5PV210_UFCON_TXTRIG4 | \
45 S5PV210_UFCON_RXTRIG4)
46
47static struct s3c2410_uartcfg torbreck_uartcfgs[] __initdata = {
48 [0] = {
49 .hwport = 0,
50 .flags = 0,
51 .ucon = TORBRECK_UCON_DEFAULT,
52 .ulcon = TORBRECK_ULCON_DEFAULT,
53 .ufcon = TORBRECK_UFCON_DEFAULT,
54 },
55 [1] = {
56 .hwport = 1,
57 .flags = 0,
58 .ucon = TORBRECK_UCON_DEFAULT,
59 .ulcon = TORBRECK_ULCON_DEFAULT,
60 .ufcon = TORBRECK_UFCON_DEFAULT,
61 },
62 [2] = {
63 .hwport = 2,
64 .flags = 0,
65 .ucon = TORBRECK_UCON_DEFAULT,
66 .ulcon = TORBRECK_ULCON_DEFAULT,
67 .ufcon = TORBRECK_UFCON_DEFAULT,
68 },
69 [3] = {
70 .hwport = 3,
71 .flags = 0,
72 .ucon = TORBRECK_UCON_DEFAULT,
73 .ulcon = TORBRECK_ULCON_DEFAULT,
74 .ufcon = TORBRECK_UFCON_DEFAULT,
75 },
76};
77
78static struct platform_device *torbreck_devices[] __initdata = {
79 &s5pv210_device_iis0,
80 &s3c_device_cfcon,
81 &s3c_device_hsmmc0,
82 &s3c_device_hsmmc1,
83 &s3c_device_hsmmc2,
84 &s3c_device_hsmmc3,
85 &s3c_device_i2c0,
86 &s3c_device_i2c1,
87 &s3c_device_i2c2,
88 &s3c_device_rtc,
89 &s3c_device_wdt,
90};
91
92static struct i2c_board_info torbreck_i2c_devs0[] __initdata = {
93 /* To Be Updated */
94};
95
96static struct i2c_board_info torbreck_i2c_devs1[] __initdata = {
97 /* To Be Updated */
98};
99
100static struct i2c_board_info torbreck_i2c_devs2[] __initdata = {
101 /* To Be Updated */
102};
103
104static void __init torbreck_map_io(void)
105{
106 s5pv210_init_io(NULL, 0);
107 s3c24xx_init_clocks(24000000);
108 s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
109 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
110}
111
112static void __init torbreck_machine_init(void)
113{
114 s3c_i2c0_set_platdata(NULL);
115 s3c_i2c1_set_platdata(NULL);
116 s3c_i2c2_set_platdata(NULL);
117 i2c_register_board_info(0, torbreck_i2c_devs0,
118 ARRAY_SIZE(torbreck_i2c_devs0));
119 i2c_register_board_info(1, torbreck_i2c_devs1,
120 ARRAY_SIZE(torbreck_i2c_devs1));
121 i2c_register_board_info(2, torbreck_i2c_devs2,
122 ARRAY_SIZE(torbreck_i2c_devs2));
123
124 platform_add_devices(torbreck_devices, ARRAY_SIZE(torbreck_devices));
125}
126
127MACHINE_START(TORBRECK, "TORBRECK")
128 /* Maintainer: Hyunchul Ko <ghcstop@gmail.com> */
129 .atag_offset = 0x100,
130 .init_irq = s5pv210_init_irq,
131 .map_io = torbreck_map_io,
132 .init_machine = torbreck_machine_init,
133 .init_time = samsung_timer_init,
134 .restart = s5pv210_restart,
135MACHINE_END
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
index 3cf3f9c8ddd1..123163dd2ab0 100644
--- a/arch/arm/mach-s5pv210/pm.c
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s5pv210/pm.c 1/* linux/arch/arm/mach-s5pv210/pm.c
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010-2014 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 4 * http://www.samsung.com
5 * 5 *
6 * S5PV210 - Power Management support 6 * S5PV210 - Power Management support
@@ -19,65 +19,28 @@
19#include <linux/syscore_ops.h> 19#include <linux/syscore_ops.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <plat/cpu.h> 22#include <asm/cacheflush.h>
23#include <plat/pm.h> 23#include <asm/suspend.h>
24
25#include <plat/pm-common.h>
24 26
25#include <mach/regs-irq.h>
26#include <mach/regs-clock.h> 27#include <mach/regs-clock.h>
27 28
28static struct sleep_save s5pv210_core_save[] = { 29#include "common.h"
29 /* Clock source */
30 SAVE_ITEM(S5P_CLK_SRC0),
31 SAVE_ITEM(S5P_CLK_SRC1),
32 SAVE_ITEM(S5P_CLK_SRC2),
33 SAVE_ITEM(S5P_CLK_SRC3),
34 SAVE_ITEM(S5P_CLK_SRC4),
35 SAVE_ITEM(S5P_CLK_SRC5),
36 SAVE_ITEM(S5P_CLK_SRC6),
37
38 /* Clock source Mask */
39 SAVE_ITEM(S5P_CLK_SRC_MASK0),
40 SAVE_ITEM(S5P_CLK_SRC_MASK1),
41
42 /* Clock Divider */
43 SAVE_ITEM(S5P_CLK_DIV0),
44 SAVE_ITEM(S5P_CLK_DIV1),
45 SAVE_ITEM(S5P_CLK_DIV2),
46 SAVE_ITEM(S5P_CLK_DIV3),
47 SAVE_ITEM(S5P_CLK_DIV4),
48 SAVE_ITEM(S5P_CLK_DIV5),
49 SAVE_ITEM(S5P_CLK_DIV6),
50 SAVE_ITEM(S5P_CLK_DIV7),
51
52 /* Clock Main Gate */
53 SAVE_ITEM(S5P_CLKGATE_MAIN0),
54 SAVE_ITEM(S5P_CLKGATE_MAIN1),
55 SAVE_ITEM(S5P_CLKGATE_MAIN2),
56
57 /* Clock source Peri Gate */
58 SAVE_ITEM(S5P_CLKGATE_PERI0),
59 SAVE_ITEM(S5P_CLKGATE_PERI1),
60
61 /* Clock source SCLK Gate */
62 SAVE_ITEM(S5P_CLKGATE_SCLK0),
63 SAVE_ITEM(S5P_CLKGATE_SCLK1),
64
65 /* Clock IP Clock gate */
66 SAVE_ITEM(S5P_CLKGATE_IP0),
67 SAVE_ITEM(S5P_CLKGATE_IP1),
68 SAVE_ITEM(S5P_CLKGATE_IP2),
69 SAVE_ITEM(S5P_CLKGATE_IP3),
70 SAVE_ITEM(S5P_CLKGATE_IP4),
71
72 /* Clock Blcok and Bus gate */
73 SAVE_ITEM(S5P_CLKGATE_BLOCK),
74 SAVE_ITEM(S5P_CLKGATE_BUS0),
75 30
31static struct sleep_save s5pv210_core_save[] = {
76 /* Clock ETC */ 32 /* Clock ETC */
77 SAVE_ITEM(S5P_CLK_OUT),
78 SAVE_ITEM(S5P_MDNIE_SEL), 33 SAVE_ITEM(S5P_MDNIE_SEL),
79}; 34};
80 35
36/*
37 * VIC wake-up support (TODO)
38 */
39static u32 s5pv210_irqwake_intmask = 0xffffffff;
40
41/*
42 * Suspend helpers.
43 */
81static int s5pv210_cpu_suspend(unsigned long arg) 44static int s5pv210_cpu_suspend(unsigned long arg)
82{ 45{
83 unsigned long tmp; 46 unsigned long tmp;
@@ -102,8 +65,12 @@ static void s5pv210_pm_prepare(void)
102{ 65{
103 unsigned int tmp; 66 unsigned int tmp;
104 67
68 /* Set wake-up mask registers */
69 __raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
70 __raw_writel(s5pv210_irqwake_intmask, S5P_WAKEUP_MASK);
71
105 /* ensure at least INFORM0 has the resume address */ 72 /* ensure at least INFORM0 has the resume address */
106 __raw_writel(virt_to_phys(s3c_cpu_resume), S5P_INFORM0); 73 __raw_writel(virt_to_phys(s5pv210_cpu_resume), S5P_INFORM0);
107 74
108 tmp = __raw_readl(S5P_SLEEP_CFG); 75 tmp = __raw_readl(S5P_SLEEP_CFG);
109 tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN); 76 tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN);
@@ -123,26 +90,70 @@ static void s5pv210_pm_prepare(void)
123 s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); 90 s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
124} 91}
125 92
126static int s5pv210_pm_add(struct device *dev, struct subsys_interface *sif) 93/*
94 * Suspend operations.
95 */
96static int s5pv210_suspend_enter(suspend_state_t state)
127{ 97{
128 pm_cpu_prep = s5pv210_pm_prepare; 98 int ret;
129 pm_cpu_sleep = s5pv210_cpu_suspend; 99
100 s3c_pm_debug_init();
101
102 S3C_PMDBG("%s: suspending the system...\n", __func__);
103
104 S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
105 s5pv210_irqwake_intmask, exynos_get_eint_wake_mask());
106
107 if (s5pv210_irqwake_intmask == -1U
108 && exynos_get_eint_wake_mask() == -1U) {
109 pr_err("%s: No wake-up sources!\n", __func__);
110 pr_err("%s: Aborting sleep\n", __func__);
111 return -EINVAL;
112 }
113
114 s3c_pm_save_uarts();
115 s5pv210_pm_prepare();
116 flush_cache_all();
117 s3c_pm_check_store();
118
119 ret = cpu_suspend(0, s5pv210_cpu_suspend);
120 if (ret)
121 return ret;
122
123 s3c_pm_restore_uarts();
124
125 S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
126 __raw_readl(S5P_WAKEUP_STAT));
127
128 s3c_pm_check_restore();
129
130 S3C_PMDBG("%s: resuming the system...\n", __func__);
130 131
131 return 0; 132 return 0;
132} 133}
133 134
134static struct subsys_interface s5pv210_pm_interface = { 135static int s5pv210_suspend_prepare(void)
135 .name = "s5pv210_pm", 136{
136 .subsys = &s5pv210_subsys, 137 s3c_pm_check_prepare();
137 .add_dev = s5pv210_pm_add,
138};
139 138
140static __init int s5pv210_pm_drvinit(void) 139 return 0;
140}
141
142static void s5pv210_suspend_finish(void)
141{ 143{
142 return subsys_interface_register(&s5pv210_pm_interface); 144 s3c_pm_check_cleanup();
143} 145}
144arch_initcall(s5pv210_pm_drvinit);
145 146
147static const struct platform_suspend_ops s5pv210_suspend_ops = {
148 .enter = s5pv210_suspend_enter,
149 .prepare = s5pv210_suspend_prepare,
150 .finish = s5pv210_suspend_finish,
151 .valid = suspend_valid_only_mem,
152};
153
154/*
155 * Syscore operations used to delay restore of certain registers.
156 */
146static void s5pv210_pm_resume(void) 157static void s5pv210_pm_resume(void)
147{ 158{
148 u32 tmp; 159 u32 tmp;
@@ -159,9 +170,11 @@ static struct syscore_ops s5pv210_pm_syscore_ops = {
159 .resume = s5pv210_pm_resume, 170 .resume = s5pv210_pm_resume,
160}; 171};
161 172
162static __init int s5pv210_pm_syscore_init(void) 173/*
174 * Initialization entry point.
175 */
176void __init s5pv210_pm_init(void)
163{ 177{
164 register_syscore_ops(&s5pv210_pm_syscore_ops); 178 register_syscore_ops(&s5pv210_pm_syscore_ops);
165 return 0; 179 suspend_set_ops(&s5pv210_suspend_ops);
166} 180}
167arch_initcall(s5pv210_pm_syscore_init);
diff --git a/arch/arm/mach-s5pv210/s5pv210.c b/arch/arm/mach-s5pv210/s5pv210.c
new file mode 100644
index 000000000000..53feff33d129
--- /dev/null
+++ b/arch/arm/mach-s5pv210/s5pv210.c
@@ -0,0 +1,77 @@
1/*
2 * Samsung's S5PC110/S5PV210 flattened device tree enabled machine.
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
5 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
6 * Tomasz Figa <t.figa@samsung.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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/of_fdt.h>
14#include <linux/of_platform.h>
15
16#include <asm/mach/arch.h>
17#include <asm/mach/map.h>
18#include <asm/system_misc.h>
19
20#include <plat/map-base.h>
21#include <mach/regs-clock.h>
22
23#include "common.h"
24
25static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
26 int depth, void *data)
27{
28 struct map_desc iodesc;
29 const __be32 *reg;
30 int len;
31
32 if (!of_flat_dt_is_compatible(node, "samsung,s5pv210-clock"))
33 return 0;
34
35 reg = of_get_flat_dt_prop(node, "reg", &len);
36 if (reg == NULL || len != (sizeof(unsigned long) * 2))
37 return 0;
38
39 iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
40 iodesc.length = be32_to_cpu(reg[1]) - 1;
41 iodesc.virtual = (unsigned long)S3C_VA_SYS;
42 iodesc.type = MT_DEVICE;
43 iotable_init(&iodesc, 1);
44
45 return 1;
46}
47
48static void __init s5pv210_dt_map_io(void)
49{
50 debug_ll_io_init();
51
52 of_scan_flat_dt(s5pv210_fdt_map_sys, NULL);
53}
54
55static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
56{
57 __raw_writel(0x1, S5P_SWRESET);
58}
59
60static void __init s5pv210_dt_init_late(void)
61{
62 platform_device_register_simple("s5pv210-cpufreq", -1, NULL, 0);
63 s5pv210_pm_init();
64}
65
66static char const *s5pv210_dt_compat[] __initconst = {
67 "samsung,s5pc110",
68 "samsung,s5pv210",
69 NULL
70};
71
72DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
73 .dt_compat = s5pv210_dt_compat,
74 .map_io = s5pv210_dt_map_io,
75 .restart = s5pv210_dt_restart,
76 .init_late = s5pv210_dt_init_late,
77MACHINE_END
diff --git a/arch/arm/mach-s5pv210/setup-fb-24bpp.c b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
deleted file mode 100644
index 55103c8220b3..000000000000
--- a/arch/arm/mach-s5pv210/setup-fb-24bpp.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/* linux/arch/arm/plat-s5pv210/setup-fb-24bpp.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Base s5pv210 setup information for 24bpp LCD framebuffer
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/fb.h>
16#include <linux/gpio.h>
17
18#include <mach/map.h>
19#include <plat/fb.h>
20#include <mach/regs-clock.h>
21#include <plat/gpio-cfg.h>
22
23static void s5pv210_fb_cfg_gpios(unsigned int base, unsigned int nr)
24{
25 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));
26
27 for (; nr > 0; nr--, base++)
28 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
29}
30
31
32void s5pv210_fb_gpio_setup_24bpp(void)
33{
34 s5pv210_fb_cfg_gpios(S5PV210_GPF0(0), 8);
35 s5pv210_fb_cfg_gpios(S5PV210_GPF1(0), 8);
36 s5pv210_fb_cfg_gpios(S5PV210_GPF2(0), 8);
37 s5pv210_fb_cfg_gpios(S5PV210_GPF3(0), 4);
38
39 /* Set DISPLAY_CONTROL register for Display path selection.
40 *
41 * ouput | RGB | I80 | ITU
42 * -----------------------------------
43 * 00 | MIE | FIMD | FIMD
44 * 01 | MDNIE | MDNIE | FIMD
45 * 10 | FIMD | FIMD | FIMD
46 * 11 | FIMD | FIMD | FIMD
47 */
48 writel(0x2, S5P_MDNIE_SEL);
49}
diff --git a/arch/arm/mach-s5pv210/setup-fimc.c b/arch/arm/mach-s5pv210/setup-fimc.c
deleted file mode 100644
index 54cc5b11be0b..000000000000
--- a/arch/arm/mach-s5pv210/setup-fimc.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 *
4 * S5PV210 camera interface GPIO configuration.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13#include <plat/camport.h>
14
15int s5pv210_fimc_setup_gpio(enum s5p_camport_id id)
16{
17 u32 gpio8, gpio5;
18 int ret;
19
20 switch (id) {
21 case S5P_CAMPORT_A:
22 gpio8 = S5PV210_GPE0(0);
23 gpio5 = S5PV210_GPE1(0);
24 break;
25
26 case S5P_CAMPORT_B:
27 gpio8 = S5PV210_GPJ0(0);
28 gpio5 = S5PV210_GPJ1(0);
29 break;
30
31 default:
32 WARN(1, "Wrong camport id: %d\n", id);
33 return -EINVAL;
34 }
35
36 ret = s3c_gpio_cfgall_range(gpio8, 8, S3C_GPIO_SFN(2),
37 S3C_GPIO_PULL_UP);
38 if (ret)
39 return ret;
40
41 return s3c_gpio_cfgall_range(gpio5, 5, S3C_GPIO_SFN(2),
42 S3C_GPIO_PULL_UP);
43}
diff --git a/arch/arm/mach-s5pv210/setup-i2c0.c b/arch/arm/mach-s5pv210/setup-i2c0.c
deleted file mode 100644
index 4a15849766c0..000000000000
--- a/arch/arm/mach-s5pv210/setup-i2c0.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/setup-i2c0.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * I2C0 GPIO configuration.
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PV210_GPD1(0), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pv210/setup-i2c1.c b/arch/arm/mach-s5pv210/setup-i2c1.c
deleted file mode 100644
index 4777f6b97a92..000000000000
--- a/arch/arm/mach-s5pv210/setup-i2c1.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/setup-i2c1.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * I2C1 GPIO configuration.
7 *
8 * Based on plat-s3c64xx/setup-i2c1.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PV210_GPD1(2), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pv210/setup-i2c2.c b/arch/arm/mach-s5pv210/setup-i2c2.c
deleted file mode 100644
index bbce6c74b915..000000000000
--- a/arch/arm/mach-s5pv210/setup-i2c2.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/setup-i2c2.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * I2C2 GPIO configuration.
7 *
8 * Based on plat-s3c64xx/setup-i2c0.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/gpio.h>
18
19struct platform_device; /* don't need the contents */
20
21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h>
23
24void s3c_i2c2_cfg_gpio(struct platform_device *dev)
25{
26 s3c_gpio_cfgall_range(S5PV210_GPD1(4), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28}
diff --git a/arch/arm/mach-s5pv210/setup-ide.c b/arch/arm/mach-s5pv210/setup-ide.c
deleted file mode 100644
index ea123d546bd2..000000000000
--- a/arch/arm/mach-s5pv210/setup-ide.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/setup-ide.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV210 setup information for IDE
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/gpio.h>
15
16#include <plat/gpio-cfg.h>
17
18static void s5pv210_ide_cfg_gpios(unsigned int base, unsigned int nr)
19{
20 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(4));
21
22 for (; nr > 0; nr--, base++)
23 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
24}
25
26void s5pv210_ide_setup_gpio(void)
27{
28 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
29 s5pv210_ide_cfg_gpios(S5PV210_GPJ0(0), 8);
30
31 /* CF_Data[0 - 7] */
32 s5pv210_ide_cfg_gpios(S5PV210_GPJ2(0), 8);
33
34 /* CF_Data[8 - 15] */
35 s5pv210_ide_cfg_gpios(S5PV210_GPJ3(0), 8);
36
37 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
38 s5pv210_ide_cfg_gpios(S5PV210_GPJ4(0), 4);
39}
diff --git a/arch/arm/mach-s5pv210/setup-keypad.c b/arch/arm/mach-s5pv210/setup-keypad.c
deleted file mode 100644
index c56420a52f48..000000000000
--- a/arch/arm/mach-s5pv210/setup-keypad.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * linux/arch/arm/mach-s5pv210/setup-keypad.c
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#include <linux/gpio.h>
15#include <plat/gpio-cfg.h>
16
17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
18{
19 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
20 s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3));
21
22 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
23 s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3));
24}
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
deleted file mode 100644
index 0512ada00522..000000000000
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,103 +0,0 @@
1/* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/mmc/host.h>
20#include <linux/mmc/card.h>
21
22#include <plat/gpio-cfg.h>
23#include <plat/sdhci.h>
24
25void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
26{
27 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
28
29 /* Set all the necessary GPG0/GPG1 pins to special-function 2 */
30 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(0), 2, S3C_GPIO_SFN(2));
31
32 switch (width) {
33 case 8:
34 /* GPG1[3:6] special-function 3 */
35 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3));
36 case 4:
37 /* GPG0[3:6] special-function 2 */
38 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2));
39 default:
40 break;
41 }
42
43 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
44 s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
45 s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
46 }
47}
48
49void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
50{
51 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
52
53 /* Set all the necessary GPG1[0:1] pins to special-function 2 */
54 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(0), 2, S3C_GPIO_SFN(2));
55
56 /* Data pin GPG1[3:6] to special-function 2 */
57 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(2));
58
59 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
60 s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
61 s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
62 }
63}
64
65void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
66{
67 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
68
69 /* Set all the necessary GPG2[0:1] pins to special-function 2 */
70 s3c_gpio_cfgrange_nopull(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2));
71
72 switch (width) {
73 case 8:
74 /* Data pin GPG3[3:6] to special-function 3 */
75 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3));
76 case 4:
77 /* Data pin GPG2[3:6] to special-function 2 */
78 s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2));
79 default:
80 break;
81 }
82
83 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
84 s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
85 s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
86 }
87}
88
89void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
90{
91 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
92
93 /* Set all the necessary GPG3[0:1] pins to special-function 2 */
94 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(0), 2, S3C_GPIO_SFN(2));
95
96 /* Data pin GPG3[3:6] to special-function 2 */
97 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(2));
98
99 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
100 s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP);
101 s3c_gpio_cfgpin(S5PV210_GPG3(2), S3C_GPIO_SFN(2));
102 }
103}
diff --git a/arch/arm/mach-s5pv210/setup-spi.c b/arch/arm/mach-s5pv210/setup-spi.c
deleted file mode 100644
index 81aecc162f82..000000000000
--- a/arch/arm/mach-s5pv210/setup-spi.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h>
13
14#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void)
16{
17 s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2));
18 s3c_gpio_setpull(S5PV210_GPB(0), S3C_GPIO_PULL_UP);
19 s3c_gpio_cfgall_range(S5PV210_GPB(2), 2,
20 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
21 return 0;
22}
23#endif
24
25#ifdef CONFIG_S3C64XX_DEV_SPI1
26int s3c64xx_spi1_cfg_gpio(void)
27{
28 s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_UP);
30 s3c_gpio_cfgall_range(S5PV210_GPB(6), 2,
31 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
32 return 0;
33}
34#endif
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
deleted file mode 100644
index b2ee5333f89c..000000000000
--- a/arch/arm/mach-s5pv210/setup-usb-phy.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundationr
8 */
9
10#include <linux/clk.h>
11#include <linux/delay.h>
12#include <linux/err.h>
13#include <linux/io.h>
14#include <linux/platform_device.h>
15
16#include <mach/map.h>
17
18#include <plat/cpu.h>
19#include <plat/regs-usb-hsotg-phy.h>
20#include <plat/usb-phy.h>
21
22#define S5PV210_USB_PHY_CON (S3C_VA_SYS + 0xE80C)
23#define S5PV210_USB_PHY0_EN (1 << 0)
24#define S5PV210_USB_PHY1_EN (1 << 1)
25
26static int s5pv210_usb_otgphy_init(struct platform_device *pdev)
27{
28 struct clk *xusbxti;
29 u32 phyclk;
30
31 writel(readl(S5PV210_USB_PHY_CON) | S5PV210_USB_PHY0_EN,
32 S5PV210_USB_PHY_CON);
33
34 /* set clock frequency for PLL */
35 phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
36
37 xusbxti = clk_get(&pdev->dev, "xusbxti");
38 if (xusbxti && !IS_ERR(xusbxti)) {
39 switch (clk_get_rate(xusbxti)) {
40 case 12 * MHZ:
41 phyclk |= S3C_PHYCLK_CLKSEL_12M;
42 break;
43 case 24 * MHZ:
44 phyclk |= S3C_PHYCLK_CLKSEL_24M;
45 break;
46 default:
47 case 48 * MHZ:
48 /* default reference clock */
49 break;
50 }
51 clk_put(xusbxti);
52 }
53
54 /* TODO: select external clock/oscillator */
55 writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
56
57 /* set to normal OTG PHY */
58 writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
59 mdelay(1);
60
61 /* reset OTG PHY and Link */
62 writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
63 S3C_RSTCON);
64 udelay(20); /* at-least 10uS */
65 writel(0, S3C_RSTCON);
66
67 return 0;
68}
69
70static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
71{
72 writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
73 S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
74
75 writel(readl(S5PV210_USB_PHY_CON) & ~S5PV210_USB_PHY0_EN,
76 S5PV210_USB_PHY_CON);
77
78 return 0;
79}
80
81int s5p_usb_phy_init(struct platform_device *pdev, int type)
82{
83 if (type == USB_PHY_TYPE_DEVICE)
84 return s5pv210_usb_otgphy_init(pdev);
85
86 return -EINVAL;
87}
88
89int s5p_usb_phy_exit(struct platform_device *pdev, int type)
90{
91 if (type == USB_PHY_TYPE_DEVICE)
92 return s5pv210_usb_otgphy_exit(pdev);
93
94 return -EINVAL;
95}
diff --git a/arch/arm/plat-samsung/s5p-sleep.S b/arch/arm/mach-s5pv210/sleep.S
index 25c68ceb9e2b..7c43ddd33ba8 100644
--- a/arch/arm/plat-samsung/s5p-sleep.S
+++ b/arch/arm/mach-s5pv210/sleep.S
@@ -1,8 +1,8 @@
1/* 1/*
2 * Copyright (c) 2011 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 * Common S5P Sleep Code 5 * S5PV210 Sleep Code
6 * Based on S3C64XX sleep code by: 6 * Based on S3C64XX sleep code by:
7 * Ben Dooks, (c) 2008 Simtec Electronics 7 * Ben Dooks, (c) 2008 Simtec Electronics
8 * 8 *
@@ -10,16 +10,7 @@
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 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 14
24#include <linux/linkage.h> 15#include <linux/linkage.h>
25 16
@@ -40,6 +31,6 @@
40 * resume code entry for bootloader to call 31 * resume code entry for bootloader to call
41 */ 32 */
42 33
43ENTRY(s3c_cpu_resume) 34ENTRY(s5pv210_cpu_resume)
44 b cpu_resume 35 b cpu_resume
45ENDPROC(s3c_cpu_resume) 36ENDPROC(s5pv210_cpu_resume)
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index 12d376795abc..2054051eb797 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -10,11 +10,6 @@
10#include <asm/sizes.h> 10#include <asm/sizes.h>
11 11
12/* 12/*
13 * Physical DRAM offset is 0xc0000000 on the SA1100
14 */
15#define PLAT_PHYS_OFFSET UL(0xc0000000)
16
17/*
18 * Because of the wide memory address space between physical RAM banks on the 13 * Because of the wide memory address space between physical RAM banks on the
19 * SA1100, it's much convenient to use Linux's SparseMEM support to implement 14 * SA1100, it's much convenient to use Linux's SparseMEM support to implement
20 * our memory map representation. Assuming all memory nodes have equal access 15 * our memory map representation. Assuming all memory nodes have equal access
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 798073057e51..e15dff790dbb 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -12,6 +12,7 @@ menuconfig ARCH_SHMOBILE_MULTI
12 select NO_IOPORT_MAP 12 select NO_IOPORT_MAP
13 select PINCTRL 13 select PINCTRL
14 select ARCH_REQUIRE_GPIOLIB 14 select ARCH_REQUIRE_GPIOLIB
15 select ARCH_HAS_OPP
15 16
16if ARCH_SHMOBILE_MULTI 17if ARCH_SHMOBILE_MULTI
17 18
@@ -25,6 +26,11 @@ config ARCH_R7S72100
25 bool "RZ/A1H (R7S72100)" 26 bool "RZ/A1H (R7S72100)"
26 select SYS_SUPPORTS_SH_MTU2 27 select SYS_SUPPORTS_SH_MTU2
27 28
29config ARCH_R8A7779
30 bool "R-Car H1 (R8A77790)"
31 select RENESAS_INTC_IRQPIN
32 select SYS_SUPPORTS_SH_TMU
33
28config ARCH_R8A7790 34config ARCH_R8A7790
29 bool "R-Car H2 (R8A77900)" 35 bool "R-Car H2 (R8A77900)"
30 select RENESAS_IRQC 36 select RENESAS_IRQC
@@ -51,6 +57,11 @@ config MACH_LAGER
51 depends on ARCH_R8A7790 57 depends on ARCH_R8A7790
52 select MICREL_PHY if SH_ETH 58 select MICREL_PHY if SH_ETH
53 59
60config MACH_MARZEN
61 bool "MARZEN board"
62 depends on ARCH_R8A7779
63 select REGULATOR_FIXED_VOLTAGE if REGULATOR
64
54comment "Renesas ARM SoCs System Configuration" 65comment "Renesas ARM SoCs System Configuration"
55endif 66endif
56 67
@@ -85,7 +96,6 @@ config ARCH_R8A73A4
85 select CPU_V7 96 select CPU_V7
86 select SH_CLK_CPG 97 select SH_CLK_CPG
87 select RENESAS_IRQC 98 select RENESAS_IRQC
88 select ARCH_HAS_OPP
89 select SYS_SUPPORTS_SH_CMT 99 select SYS_SUPPORTS_SH_CMT
90 select SYS_SUPPORTS_SH_TMU 100 select SYS_SUPPORTS_SH_TMU
91 101
@@ -234,19 +244,6 @@ config MACH_MARZEN
234 select REGULATOR_FIXED_VOLTAGE if REGULATOR 244 select REGULATOR_FIXED_VOLTAGE if REGULATOR
235 select USE_OF 245 select USE_OF
236 246
237config MACH_MARZEN_REFERENCE
238 bool "MARZEN board - Reference Device Tree Implementation"
239 depends on ARCH_R8A7779
240 select ARCH_REQUIRE_GPIOLIB
241 select REGULATOR_FIXED_VOLTAGE if REGULATOR
242 select USE_OF
243 ---help---
244 Use reference implementation of Marzen board support
245 which makes use of device tree at the expense
246 of not supporting a number of devices.
247
248 This is intended to aid developers
249
250config MACH_LAGER 247config MACH_LAGER
251 bool "Lager board" 248 bool "Lager board"
252 depends on ARCH_R8A7790 249 depends on ARCH_R8A7790
@@ -263,7 +260,6 @@ config MACH_KOELSCH
263config MACH_KZM9G 260config MACH_KZM9G
264 bool "KZM-A9-GT board" 261 bool "KZM-A9-GT board"
265 depends on ARCH_SH73A0 262 depends on ARCH_SH73A0
266 select ARCH_HAS_OPP
267 select ARCH_REQUIRE_GPIOLIB 263 select ARCH_REQUIRE_GPIOLIB
268 select REGULATOR_FIXED_VOLTAGE if REGULATOR 264 select REGULATOR_FIXED_VOLTAGE if REGULATOR
269 select SND_SOC_AK4642 if SND_SIMPLE_CARD 265 select SND_SOC_AK4642 if SND_SIMPLE_CARD
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 38d5fe825e93..fe3878a1a69a 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -34,31 +34,39 @@ obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
34obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o 34obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
35endif 35endif
36 36
37# CPU reset vector handling objects
38cpu-y := platsmp.o headsmp.o
39cpu-$(CONFIG_ARCH_R8A7790) += platsmp-apmu.o
40cpu-$(CONFIG_ARCH_R8A7791) += platsmp-apmu.o
41
37# SMP objects 42# SMP objects
38smp-y := platsmp.o headsmp.o 43smp-y := $(cpu-y)
39smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o 44smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
40smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o 45smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
41smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o 46smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o
42smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o 47smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o
43smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o 48smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
44 49
45# IRQ objects
46obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
47
48# PM objects 50# PM objects
49obj-$(CONFIG_SUSPEND) += suspend.o 51obj-$(CONFIG_SUSPEND) += suspend.o
50obj-$(CONFIG_CPU_IDLE) += cpuidle.o 52obj-$(CONFIG_CPU_IDLE) += cpuidle.o
53obj-$(CONFIG_CPU_FREQ) += cpufreq.o
51obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o 54obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
52obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o 55obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
53obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o 56obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
54obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o 57obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
55obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o 58obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o $(cpu-y)
59obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o $(cpu-y)
60
61# IRQ objects
62obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
56 63
57# Board objects 64# Board objects
58ifdef CONFIG_ARCH_SHMOBILE_MULTI 65ifdef CONFIG_ARCH_SHMOBILE_MULTI
59obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o 66obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o
60obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o 67obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
61obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o 68obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
69obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
62else 70else
63obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o 71obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
64obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o 72obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
@@ -67,7 +75,6 @@ obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
67obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 75obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
68obj-$(CONFIG_MACH_GENMAI) += board-genmai.o 76obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
69obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 77obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
70obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
71obj-$(CONFIG_MACH_LAGER) += board-lager.o 78obj-$(CONFIG_MACH_LAGER) += board-lager.o
72obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 79obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
73obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o 80obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 918fccffa1b6..ebf97d4bcfd8 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -13,7 +13,6 @@ loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
13loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000 13loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
14loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000 14loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
15loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000 15loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
16loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
17 16
18__ZRELADDR := $(sort $(loadaddr-y)) 17__ZRELADDR := $(sort $(loadaddr-y))
19 zreladdr-y += $(__ZRELADDR) 18 zreladdr-y += $(__ZRELADDR)
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
index 3276afcf3cc9..2f7723e5fe91 100644
--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
+++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
@@ -24,11 +24,13 @@
24#include <linux/pinctrl/machine.h> 24#include <linux/pinctrl/machine.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sh_clk.h> 26#include <linux/sh_clk.h>
27#include <mach/common.h> 27
28#include <mach/r8a73a4.h>
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
31#include "common.h"
32#include "r8a73a4.h"
33
32static void __init ape6evm_add_standard_devices(void) 34static void __init ape6evm_add_standard_devices(void)
33{ 35{
34 36
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index fe071a9130b7..1585b8830b13 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -33,12 +33,14 @@
33#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
34#include <linux/sh_clk.h> 34#include <linux/sh_clk.h>
35#include <linux/smsc911x.h> 35#include <linux/smsc911x.h>
36#include <mach/common.h> 36
37#include <mach/irqs.h>
38#include <mach/r8a73a4.h>
39#include <asm/mach-types.h> 37#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
41 39
40#include "common.h"
41#include "irqs.h"
42#include "r8a73a4.h"
43
42/* LEDS */ 44/* LEDS */
43static struct gpio_led ape6evm_leds[] = { 45static struct gpio_led ape6evm_leds[] = {
44 { 46 {
@@ -248,29 +250,29 @@ static void __init ape6evm_add_standard_devices(void)
248 250
249 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 251 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
250 252
251 platform_device_register_resndata(&platform_bus, "smsc911x", -1, 253 platform_device_register_resndata(NULL, "smsc911x", -1,
252 lan9220_res, ARRAY_SIZE(lan9220_res), 254 lan9220_res, ARRAY_SIZE(lan9220_res),
253 &lan9220_data, sizeof(lan9220_data)); 255 &lan9220_data, sizeof(lan9220_data));
254 256
255 regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers, 257 regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers,
256 ARRAY_SIZE(vcc_mmc0_consumers), 2800000); 258 ARRAY_SIZE(vcc_mmc0_consumers), 2800000);
257 platform_device_register_resndata(&platform_bus, "sh_mmcif", 0, 259 platform_device_register_resndata(NULL, "sh_mmcif", 0,
258 mmcif0_resources, ARRAY_SIZE(mmcif0_resources), 260 mmcif0_resources, ARRAY_SIZE(mmcif0_resources),
259 &mmcif0_pdata, sizeof(mmcif0_pdata)); 261 &mmcif0_pdata, sizeof(mmcif0_pdata));
260 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2, 262 platform_device_register_data(NULL, "reg-fixed-voltage", 2,
261 &vcc_sdhi0_info, sizeof(vcc_sdhi0_info)); 263 &vcc_sdhi0_info, sizeof(vcc_sdhi0_info));
262 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, 264 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
263 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 265 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
264 &sdhi0_pdata, sizeof(sdhi0_pdata)); 266 &sdhi0_pdata, sizeof(sdhi0_pdata));
265 regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers, 267 regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers,
266 ARRAY_SIZE(vcc_sdhi1_consumers), 3300000); 268 ARRAY_SIZE(vcc_sdhi1_consumers), 3300000);
267 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, 269 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1,
268 sdhi1_resources, ARRAY_SIZE(sdhi1_resources), 270 sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
269 &sdhi1_pdata, sizeof(sdhi1_pdata)); 271 &sdhi1_pdata, sizeof(sdhi1_pdata));
270 platform_device_register_data(&platform_bus, "gpio-keys", -1, 272 platform_device_register_data(NULL, "gpio-keys", -1,
271 &ape6evm_keys_pdata, 273 &ape6evm_keys_pdata,
272 sizeof(ape6evm_keys_pdata)); 274 sizeof(ape6evm_keys_pdata));
273 platform_device_register_data(&platform_bus, "leds-gpio", -1, 275 platform_device_register_data(NULL, "leds-gpio", -1,
274 &ape6evm_leds_pdata, 276 &ape6evm_leds_pdata,
275 sizeof(ape6evm_leds_pdata)); 277 sizeof(ape6evm_leds_pdata));
276} 278}
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index f660fbb96e0b..84bc6cb6d5aa 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -24,11 +24,13 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <mach/common.h> 27
28#include <mach/r8a7740.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/hardware/cache-l2x0.h> 29#include <asm/hardware/cache-l2x0.h>
31 30
31#include "common.h"
32#include "r8a7740.h"
33
32/* 34/*
33 * CON1 Camera Module 35 * CON1 Camera Module
34 * CON2 Extension Bus 36 * CON2 Extension Bus
@@ -53,11 +55,11 @@
53 * CON22 Serial 55 * CON22 Serial
54 * CON23 LAN 56 * CON23 LAN
55 * CON24 USB3 57 * CON24 USB3
56 * LED1 Camera LED(Yellow) 58 * LED1 Camera LED (Yellow)
57 * LED2 Power LED (Green) 59 * LED2 Power LED (Green)
58 * ED3-LED6 User LED(Yellow) 60 * LED3-LED6 User LED (Yellow)
59 * LED7 LAN link LED(Green) 61 * LED7 LAN link LED (Green)
60 * LED8 LAN activity LED(Yellow) 62 * LED8 LAN activity LED (Yellow)
61 */ 63 */
62 64
63/* 65/*
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 30fcac73a540..6dbaad611a92 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -45,9 +45,7 @@
45#include <linux/mmc/sh_mobile_sdhi.h> 45#include <linux/mmc/sh_mobile_sdhi.h>
46#include <linux/i2c-gpio.h> 46#include <linux/i2c-gpio.h>
47#include <linux/reboot.h> 47#include <linux/reboot.h>
48#include <mach/common.h> 48
49#include <mach/irqs.h>
50#include <mach/r8a7740.h>
51#include <media/mt9t112.h> 49#include <media/mt9t112.h>
52#include <media/sh_mobile_ceu.h> 50#include <media/sh_mobile_ceu.h>
53#include <media/soc_camera.h> 51#include <media/soc_camera.h>
@@ -62,6 +60,10 @@
62#include <sound/sh_fsi.h> 60#include <sound/sh_fsi.h>
63#include <sound/simple_card.h> 61#include <sound/simple_card.h>
64 62
63#include "common.h"
64#include "irqs.h"
65#include "pm-rmobile.h"
66#include "r8a7740.h"
65#include "sh-gpio.h" 67#include "sh-gpio.h"
66 68
67/* 69/*
@@ -578,6 +580,40 @@ static struct platform_device hdmi_lcdc_device = {
578 }, 580 },
579}; 581};
580 582
583/* LEDS */
584static struct gpio_led gpio_leds[] = {
585 {
586 .name = "LED3",
587 .gpio = 102,
588 .default_state = LEDS_GPIO_DEFSTATE_ON,
589 }, {
590 .name = "LED4",
591 .gpio = 111,
592 .default_state = LEDS_GPIO_DEFSTATE_ON,
593 }, {
594 .name = "LED5",
595 .gpio = 110,
596 .default_state = LEDS_GPIO_DEFSTATE_ON,
597 }, {
598 .name = "LED6",
599 .gpio = 177,
600 .default_state = LEDS_GPIO_DEFSTATE_ON,
601 },
602};
603
604static struct gpio_led_platform_data leds_gpio_info = {
605 .leds = gpio_leds,
606 .num_leds = ARRAY_SIZE(gpio_leds),
607};
608
609static struct platform_device leds_gpio_device = {
610 .name = "leds-gpio",
611 .id = -1,
612 .dev = {
613 .platform_data = &leds_gpio_info,
614 },
615};
616
581/* GPIO KEY */ 617/* GPIO KEY */
582#define GPIO_KEY(c, g, d, ...) \ 618#define GPIO_KEY(c, g, d, ...) \
583 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ } 619 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
@@ -998,6 +1034,8 @@ static struct platform_device fsi_wm8978_device = {
998 .id = 0, 1034 .id = 0,
999 .dev = { 1035 .dev = {
1000 .platform_data = &fsi_wm8978_info, 1036 .platform_data = &fsi_wm8978_info,
1037 .coherent_dma_mask = DMA_BIT_MASK(32),
1038 .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
1001 }, 1039 },
1002}; 1040};
1003 1041
@@ -1021,6 +1059,8 @@ static struct platform_device fsi_hdmi_device = {
1021 .id = 1, 1059 .id = 1,
1022 .dev = { 1060 .dev = {
1023 .platform_data = &fsi2_hdmi_info, 1061 .platform_data = &fsi2_hdmi_info,
1062 .coherent_dma_mask = DMA_BIT_MASK(32),
1063 .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
1024 }, 1064 },
1025}; 1065};
1026 1066
@@ -1069,6 +1109,7 @@ static struct platform_device *eva_devices[] __initdata = {
1069 &lcdc0_device, 1109 &lcdc0_device,
1070 &pwm_device, 1110 &pwm_device,
1071 &pwm_backlight_device, 1111 &pwm_backlight_device,
1112 &leds_gpio_device,
1072 &gpio_keys_device, 1113 &gpio_keys_device,
1073 &sh_eth_device, 1114 &sh_eth_device,
1074 &vcc_sdhi0, 1115 &vcc_sdhi0,
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 027373f8de82..ba840cd333b9 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -19,10 +19,12 @@
19 */ 19 */
20 20
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <mach/common.h> 22
23#include <mach/r8a7778.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25 24
25#include "common.h"
26#include "r8a7778.h"
27
26/* 28/*
27 * see board-bock.c for checking detail of dip-switch 29 * see board-bock.c for checking detail of dip-switch
28 */ 30 */
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index f444be2f241e..8a83eb39d3f1 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -34,14 +34,16 @@
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb/renesas_usbhs.h> 36#include <linux/usb/renesas_usbhs.h>
37
37#include <media/soc_camera.h> 38#include <media/soc_camera.h>
38#include <mach/common.h>
39#include <mach/irqs.h>
40#include <mach/r8a7778.h>
41#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
42#include <sound/rcar_snd.h> 40#include <sound/rcar_snd.h>
43#include <sound/simple_card.h> 41#include <sound/simple_card.h>
44 42
43#include "common.h"
44#include "irqs.h"
45#include "r8a7778.h"
46
45#define FPGA 0x18200000 47#define FPGA 0x18200000
46#define IRQ0MR 0x30 48#define IRQ0MR 0x30
47#define COMCTLR 0x101c 49#define COMCTLR 0x101c
@@ -177,7 +179,7 @@ static struct renesas_usbhs_platform_info usbhs_info __initdata = {
177#define USB1_DEVICE "renesas_usbhs" 179#define USB1_DEVICE "renesas_usbhs"
178#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE() \ 180#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE() \
179 platform_device_register_resndata( \ 181 platform_device_register_resndata( \
180 &platform_bus, "renesas_usbhs", -1, \ 182 NULL, "renesas_usbhs", -1, \
181 usbhsf_resources, \ 183 usbhsf_resources, \
182 ARRAY_SIZE(usbhsf_resources), \ 184 ARRAY_SIZE(usbhsf_resources), \
183 &usbhs_info, sizeof(struct renesas_usbhs_platform_info)) 185 &usbhs_info, sizeof(struct renesas_usbhs_platform_info))
@@ -236,7 +238,6 @@ static struct sh_eth_plat_data ether_platform_data __initdata = {
236}; 238};
237 239
238static struct platform_device_info ether_info __initdata = { 240static struct platform_device_info ether_info __initdata = {
239 .parent = &platform_bus,
240 .name = "r8a777x-ether", 241 .name = "r8a777x-ether",
241 .id = -1, 242 .id = -1,
242 .res = ether_resources, 243 .res = ether_resources,
@@ -322,7 +323,6 @@ static struct resource vin##idx##_resources[] __initdata = { \
322}; \ 323}; \
323 \ 324 \
324static struct platform_device_info vin##idx##_info __initdata = { \ 325static struct platform_device_info vin##idx##_info __initdata = { \
325 .parent = &platform_bus, \
326 .name = "r8a7778-vin", \ 326 .name = "r8a7778-vin", \
327 .id = idx, \ 327 .id = idx, \
328 .res = vin##idx##_resources, \ 328 .res = vin##idx##_resources, \
@@ -621,10 +621,10 @@ static void __init bockw_init(void)
621 /* VIN1 has a pin conflict with Ether */ 621 /* VIN1 has a pin conflict with Ether */
622 if (!IS_ENABLED(CONFIG_SH_ETH)) 622 if (!IS_ENABLED(CONFIG_SH_ETH))
623 platform_device_register_full(&vin1_info); 623 platform_device_register_full(&vin1_info);
624 platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0, 624 platform_device_register_data(NULL, "soc-camera-pdrv", 0,
625 &iclink0_ml86v7667, 625 &iclink0_ml86v7667,
626 sizeof(iclink0_ml86v7667)); 626 sizeof(iclink0_ml86v7667));
627 platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1, 627 platform_device_register_data(NULL, "soc-camera-pdrv", 1,
628 &iclink1_ml86v7667, 628 &iclink1_ml86v7667,
629 sizeof(iclink1_ml86v7667)); 629 sizeof(iclink1_ml86v7667));
630 630
@@ -637,12 +637,12 @@ static void __init bockw_init(void)
637 r8a7778_pinmux_init(); 637 r8a7778_pinmux_init();
638 638
639 platform_device_register_resndata( 639 platform_device_register_resndata(
640 &platform_bus, "sh_mmcif", -1, 640 NULL, "sh_mmcif", -1,
641 mmc_resources, ARRAY_SIZE(mmc_resources), 641 mmc_resources, ARRAY_SIZE(mmc_resources),
642 &sh_mmcif_plat, sizeof(struct sh_mmcif_plat_data)); 642 &sh_mmcif_plat, sizeof(struct sh_mmcif_plat_data));
643 643
644 platform_device_register_resndata( 644 platform_device_register_resndata(
645 &platform_bus, "rcar_usb_phy", -1, 645 NULL, "rcar_usb_phy", -1,
646 usb_phy_resources, 646 usb_phy_resources,
647 ARRAY_SIZE(usb_phy_resources), 647 ARRAY_SIZE(usb_phy_resources),
648 &usb_phy_platform_data, 648 &usb_phy_platform_data,
@@ -668,7 +668,7 @@ static void __init bockw_init(void)
668 iowrite16(val, fpga + IRQ0MR); 668 iowrite16(val, fpga + IRQ0MR);
669 669
670 platform_device_register_resndata( 670 platform_device_register_resndata(
671 &platform_bus, "smsc911x", -1, 671 NULL, "smsc911x", -1,
672 smsc911x_resources, ARRAY_SIZE(smsc911x_resources), 672 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
673 &smsc911x_data, sizeof(smsc911x_data)); 673 &smsc911x_data, sizeof(smsc911x_data));
674 } 674 }
@@ -685,7 +685,7 @@ static void __init bockw_init(void)
685 iounmap(base); 685 iounmap(base);
686 686
687 platform_device_register_resndata( 687 platform_device_register_resndata(
688 &platform_bus, "sh_mobile_sdhi", 0, 688 NULL, "sh_mobile_sdhi", 0,
689 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 689 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
690 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); 690 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
691 } 691 }
@@ -700,7 +700,7 @@ static void __init bockw_init(void)
700 "ak4554-adc-dac", 1, NULL, 0); 700 "ak4554-adc-dac", 1, NULL, 0);
701 701
702 pdev = platform_device_register_resndata( 702 pdev = platform_device_register_resndata(
703 &platform_bus, "rcar_sound", -1, 703 NULL, "rcar_sound", -1,
704 rsnd_resources, ARRAY_SIZE(rsnd_resources), 704 rsnd_resources, ARRAY_SIZE(rsnd_resources),
705 &rsnd_info, sizeof(rsnd_info)); 705 &rsnd_info, sizeof(rsnd_info));
706 706
@@ -710,7 +710,6 @@ static void __init bockw_init(void)
710 710
711 for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) { 711 for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) {
712 struct platform_device_info cardinfo = { 712 struct platform_device_info cardinfo = {
713 .parent = &platform_bus,
714 .name = "asoc-simple-card", 713 .name = "asoc-simple-card",
715 .id = i, 714 .id = i,
716 .data = &rsnd_card_info[i], 715 .data = &rsnd_card_info[i],
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
index 2ff6ad6e608e..e5448f7b868a 100644
--- a/arch/arm/mach-shmobile/board-genmai-reference.c
+++ b/arch/arm/mach-shmobile/board-genmai-reference.c
@@ -20,12 +20,14 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <mach/clock.h> 23
24#include <mach/common.h>
25#include <mach/r7s72100.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
28 26
27#include "clock.h"
28#include "common.h"
29#include "r7s72100.h"
30
29/* 31/*
30 * This is a really crude hack to provide clkdev support to platform 32 * This is a really crude hack to provide clkdev support to platform
31 * devices until they get moved to DT. 33 * devices until they get moved to DT.
@@ -47,7 +49,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
47}; 49};
48 50
49DT_MACHINE_START(GENMAI_DT, "genmai") 51DT_MACHINE_START(GENMAI_DT, "genmai")
50 .init_early = r7s72100_init_early, 52 .init_early = shmobile_init_delay,
51 .init_machine = genmai_add_standard_devices, 53 .init_machine = genmai_add_standard_devices,
52 .dt_compat = genmai_boards_compat_dt, 54 .dt_compat = genmai_boards_compat_dt,
53MACHINE_END 55MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index c94201ee8596..7bf2d8057535 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -25,12 +25,14 @@
25#include <linux/sh_eth.h> 25#include <linux/sh_eth.h>
26#include <linux/spi/rspi.h> 26#include <linux/spi/rspi.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <mach/common.h> 28
29#include <mach/irqs.h>
30#include <mach/r7s72100.h>
31#include <asm/mach-types.h> 29#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
33 31
32#include "common.h"
33#include "irqs.h"
34#include "r7s72100.h"
35
34/* Ether */ 36/* Ether */
35static const struct sh_eth_plat_data ether_pdata __initconst = { 37static const struct sh_eth_plat_data ether_pdata __initconst = {
36 .phy = 0x00, /* PD60610 */ 38 .phy = 0x00, /* PD60610 */
@@ -46,7 +48,6 @@ static const struct resource ether_resources[] __initconst = {
46}; 48};
47 49
48static const struct platform_device_info ether_info __initconst = { 50static const struct platform_device_info ether_info __initconst = {
49 .parent = &platform_bus,
50 .name = "r7s72100-ether", 51 .name = "r7s72100-ether",
51 .id = -1, 52 .id = -1,
52 .res = ether_resources, 53 .res = ether_resources,
@@ -76,7 +77,7 @@ static const struct rspi_plat_data rspi_pdata __initconst = {
76}; 77};
77 78
78#define r7s72100_register_rspi(idx) \ 79#define r7s72100_register_rspi(idx) \
79 platform_device_register_resndata(&platform_bus, "rspi-rz", idx, \ 80 platform_device_register_resndata(NULL, "rspi-rz", idx, \
80 rspi##idx##_resources, \ 81 rspi##idx##_resources, \
81 ARRAY_SIZE(rspi##idx##_resources), \ 82 ARRAY_SIZE(rspi##idx##_resources), \
82 &rspi_pdata, sizeof(rspi_pdata)) 83 &rspi_pdata, sizeof(rspi_pdata))
@@ -118,7 +119,7 @@ R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
118R7S72100_SCIF(7, 0xe800a800, gic_iid(249)); 119R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
119 120
120#define r7s72100_register_scif(index) \ 121#define r7s72100_register_scif(index) \
121 platform_device_register_resndata(&platform_bus, "sh-sci", index, \ 122 platform_device_register_resndata(NULL, "sh-sci", index, \
122 scif##index##_resources, \ 123 scif##index##_resources, \
123 ARRAY_SIZE(scif##index##_resources), \ 124 ARRAY_SIZE(scif##index##_resources), \
124 &scif##index##_platform_data, \ 125 &scif##index##_platform_data, \
@@ -154,7 +155,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
154}; 155};
155 156
156DT_MACHINE_START(GENMAI_DT, "genmai") 157DT_MACHINE_START(GENMAI_DT, "genmai")
157 .init_early = r7s72100_init_early, 158 .init_early = shmobile_init_delay,
158 .init_machine = genmai_add_standard_devices, 159 .init_machine = genmai_add_standard_devices,
159 .dt_compat = genmai_boards_compat_dt, 160 .dt_compat = genmai_boards_compat_dt,
160MACHINE_END 161MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
index d322a162b4b0..3ff88c138896 100644
--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
@@ -23,13 +23,15 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/rcar-du.h> 25#include <linux/platform_data/rcar-du.h>
26#include <mach/clock.h> 26
27#include <mach/common.h>
28#include <mach/irqs.h>
29#include <mach/rcar-gen2.h>
30#include <mach/r8a7791.h>
31#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
32 28
29#include "clock.h"
30#include "common.h"
31#include "irqs.h"
32#include "r8a7791.h"
33#include "rcar-gen2.h"
34
33/* DU */ 35/* DU */
34static struct rcar_du_encoder_data koelsch_du_encoders[] = { 36static struct rcar_du_encoder_data koelsch_du_encoders[] = {
35 { 37 {
@@ -92,24 +94,9 @@ static const struct clk_name clk_names[] __initconst = {
92 { "lvds0", "lvds.0", "rcar-du-r8a7791" }, 94 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
93}; 95};
94 96
95/*
96 * This is a really crude hack to work around core platform clock issues
97 */
98static const struct clk_name clk_enables[] __initconst = {
99 { "ether", NULL, "ee700000.ethernet" },
100 { "i2c2", NULL, "e6530000.i2c" },
101 { "msiof0", NULL, "e6e20000.spi" },
102 { "qspi_mod", NULL, "e6b10000.spi" },
103 { "sdhi0", NULL, "ee100000.sd" },
104 { "sdhi1", NULL, "ee140000.sd" },
105 { "sdhi2", NULL, "ee160000.sd" },
106 { "thermal", NULL, "e61f0000.thermal" },
107};
108
109static void __init koelsch_add_standard_devices(void) 97static void __init koelsch_add_standard_devices(void)
110{ 98{
111 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); 99 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
112 shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
113 r8a7791_add_dt_devices(); 100 r8a7791_add_dt_devices();
114 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 101 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
115 102
@@ -128,5 +115,6 @@ DT_MACHINE_START(KOELSCH_DT, "koelsch")
128 .init_time = rcar_gen2_timer_init, 115 .init_time = rcar_gen2_timer_init,
129 .init_machine = koelsch_add_standard_devices, 116 .init_machine = koelsch_add_standard_devices,
130 .init_late = shmobile_init_late, 117 .init_late = shmobile_init_late,
118 .reserve = rcar_gen2_reserve,
131 .dt_compat = koelsch_boards_compat_dt, 119 .dt_compat = koelsch_boards_compat_dt,
132MACHINE_END 120MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index c6c68892caa3..b7d5bc7659cd 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -45,13 +45,15 @@
45#include <linux/spi/flash.h> 45#include <linux/spi/flash.h>
46#include <linux/spi/rspi.h> 46#include <linux/spi/rspi.h>
47#include <linux/spi/spi.h> 47#include <linux/spi/spi.h>
48#include <mach/common.h> 48
49#include <mach/irqs.h>
50#include <mach/r8a7791.h>
51#include <mach/rcar-gen2.h>
52#include <asm/mach-types.h> 49#include <asm/mach-types.h>
53#include <asm/mach/arch.h> 50#include <asm/mach/arch.h>
54 51
52#include "common.h"
53#include "irqs.h"
54#include "r8a7791.h"
55#include "rcar-gen2.h"
56
55/* DU */ 57/* DU */
56static struct rcar_du_encoder_data koelsch_du_encoders[] = { 58static struct rcar_du_encoder_data koelsch_du_encoders[] = {
57 { 59 {
@@ -118,7 +120,6 @@ static const struct resource ether_resources[] __initconst = {
118}; 120};
119 121
120static const struct platform_device_info ether_info __initconst = { 122static const struct platform_device_info ether_info __initconst = {
121 .parent = &platform_bus,
122 .name = "r8a7791-ether", 123 .name = "r8a7791-ether",
123 .id = -1, 124 .id = -1,
124 .res = ether_resources, 125 .res = ether_resources,
@@ -230,7 +231,6 @@ static const struct resource sata0_resources[] __initconst = {
230}; 231};
231 232
232static const struct platform_device_info sata0_info __initconst = { 233static const struct platform_device_info sata0_info __initconst = {
233 .parent = &platform_bus,
234 .name = "sata-r8a7791", 234 .name = "sata-r8a7791",
235 .id = 0, 235 .id = 0,
236 .res = sata0_resources, 236 .res = sata0_resources,
@@ -439,13 +439,13 @@ static void __init koelsch_add_standard_devices(void)
439 r8a7791_pinmux_init(); 439 r8a7791_pinmux_init();
440 r8a7791_add_standard_devices(); 440 r8a7791_add_standard_devices();
441 platform_device_register_full(&ether_info); 441 platform_device_register_full(&ether_info);
442 platform_device_register_data(&platform_bus, "leds-gpio", -1, 442 platform_device_register_data(NULL, "leds-gpio", -1,
443 &koelsch_leds_pdata, 443 &koelsch_leds_pdata,
444 sizeof(koelsch_leds_pdata)); 444 sizeof(koelsch_leds_pdata));
445 platform_device_register_data(&platform_bus, "gpio-keys", -1, 445 platform_device_register_data(NULL, "gpio-keys", -1,
446 &koelsch_keys_pdata, 446 &koelsch_keys_pdata,
447 sizeof(koelsch_keys_pdata)); 447 sizeof(koelsch_keys_pdata));
448 platform_device_register_resndata(&platform_bus, "qspi", 0, 448 platform_device_register_resndata(NULL, "qspi", 0,
449 qspi_resources, 449 qspi_resources,
450 ARRAY_SIZE(qspi_resources), 450 ARRAY_SIZE(qspi_resources),
451 &qspi_pdata, sizeof(qspi_pdata)); 451 &qspi_pdata, sizeof(qspi_pdata));
@@ -460,28 +460,28 @@ static void __init koelsch_add_standard_devices(void)
460 koelsch_add_i2c(4); 460 koelsch_add_i2c(4);
461 koelsch_add_i2c(5); 461 koelsch_add_i2c(5);
462 462
463 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 0, 463 platform_device_register_data(NULL, "reg-fixed-voltage", 0,
464 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config)); 464 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
465 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 1, 465 platform_device_register_data(NULL, "reg-fixed-voltage", 1,
466 &vcc_sdhi1_info, sizeof(struct fixed_voltage_config)); 466 &vcc_sdhi1_info, sizeof(struct fixed_voltage_config));
467 platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2, 467 platform_device_register_data(NULL, "reg-fixed-voltage", 2,
468 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config)); 468 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
469 platform_device_register_data(&platform_bus, "gpio-regulator", 0, 469 platform_device_register_data(NULL, "gpio-regulator", 0,
470 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config)); 470 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
471 platform_device_register_data(&platform_bus, "gpio-regulator", 1, 471 platform_device_register_data(NULL, "gpio-regulator", 1,
472 &vccq_sdhi1_info, sizeof(struct gpio_regulator_config)); 472 &vccq_sdhi1_info, sizeof(struct gpio_regulator_config));
473 platform_device_register_data(&platform_bus, "gpio-regulator", 2, 473 platform_device_register_data(NULL, "gpio-regulator", 2,
474 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config)); 474 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
475 475
476 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, 476 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
477 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 477 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
478 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); 478 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
479 479
480 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1, 480 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1,
481 sdhi1_resources, ARRAY_SIZE(sdhi1_resources), 481 sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
482 &sdhi1_info, sizeof(struct sh_mobile_sdhi_info)); 482 &sdhi1_info, sizeof(struct sh_mobile_sdhi_info));
483 483
484 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2, 484 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2,
485 sdhi2_resources, ARRAY_SIZE(sdhi2_resources), 485 sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
486 &sdhi2_info, sizeof(struct sh_mobile_sdhi_info)); 486 &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
487 487
@@ -526,5 +526,6 @@ DT_MACHINE_START(KOELSCH_DT, "koelsch")
526 .init_time = rcar_gen2_timer_init, 526 .init_time = rcar_gen2_timer_init,
527 .init_machine = koelsch_init, 527 .init_machine = koelsch_init,
528 .init_late = shmobile_init_late, 528 .init_late = shmobile_init_late,
529 .reserve = rcar_gen2_reserve,
529 .dt_compat = koelsch_boards_compat_dt, 530 .dt_compat = koelsch_boards_compat_dt,
530MACHINE_END 531MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index a735a1d80c28..5d2621f202d1 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -25,12 +25,14 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <mach/sh73a0.h> 28
29#include <mach/common.h>
30#include <asm/hardware/cache-l2x0.h> 29#include <asm/hardware/cache-l2x0.h>
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33 32
33#include "common.h"
34#include "sh73a0.h"
35
34static void __init kzm_init(void) 36static void __init kzm_init(void)
35{ 37{
36 sh73a0_add_standard_devices_dt(); 38 sh73a0_add_standard_devices_dt();
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index f94ec8ca42c1..f8bc7f8f86ad 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -41,16 +41,18 @@
41#include <linux/usb/r8a66597.h> 41#include <linux/usb/r8a66597.h>
42#include <linux/usb/renesas_usbhs.h> 42#include <linux/usb/renesas_usbhs.h>
43#include <linux/videodev2.h> 43#include <linux/videodev2.h>
44
44#include <sound/sh_fsi.h> 45#include <sound/sh_fsi.h>
45#include <sound/simple_card.h> 46#include <sound/simple_card.h>
46#include <mach/irqs.h>
47#include <mach/sh73a0.h>
48#include <mach/common.h>
49#include <asm/hardware/cache-l2x0.h> 47#include <asm/hardware/cache-l2x0.h>
50#include <asm/mach-types.h> 48#include <asm/mach-types.h>
51#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
52#include <video/sh_mobile_lcdc.h> 50#include <video/sh_mobile_lcdc.h>
53 51
52#include "common.h"
53#include "irqs.h"
54#include "sh73a0.h"
55
54/* 56/*
55 * external GPIO 57 * external GPIO
56 */ 58 */
@@ -603,6 +605,8 @@ static struct platform_device fsi_ak4648_device = {
603 .name = "asoc-simple-card", 605 .name = "asoc-simple-card",
604 .dev = { 606 .dev = {
605 .platform_data = &fsi2_ak4648_info, 607 .platform_data = &fsi2_ak4648_info,
608 .coherent_dma_mask = DMA_BIT_MASK(32),
609 .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
606 }, 610 },
607}; 611};
608 612
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 749832e3f33c..41c808e56005 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -22,13 +22,15 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/platform_data/rcar-du.h> 24#include <linux/platform_data/rcar-du.h>
25#include <mach/clock.h> 25
26#include <mach/common.h>
27#include <mach/irqs.h>
28#include <mach/rcar-gen2.h>
29#include <mach/r8a7790.h>
30#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
31 27
28#include "clock.h"
29#include "common.h"
30#include "irqs.h"
31#include "r8a7790.h"
32#include "rcar-gen2.h"
33
32/* DU */ 34/* DU */
33static struct rcar_du_encoder_data lager_du_encoders[] = { 35static struct rcar_du_encoder_data lager_du_encoders[] = {
34 { 36 {
@@ -98,23 +100,9 @@ static const struct clk_name clk_names[] __initconst = {
98 { "lvds1", "lvds.1", "rcar-du-r8a7790" }, 100 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
99}; 101};
100 102
101/*
102 * This is a really crude hack to work around core platform clock issues
103 */
104static const struct clk_name clk_enables[] __initconst = {
105 { "ether", NULL, "ee700000.ethernet" },
106 { "msiof1", NULL, "e6e10000.spi" },
107 { "mmcif1", NULL, "ee220000.mmc" },
108 { "qspi_mod", NULL, "e6b10000.spi" },
109 { "sdhi0", NULL, "ee100000.sd" },
110 { "sdhi2", NULL, "ee140000.sd" },
111 { "thermal", NULL, "e61f0000.thermal" },
112};
113
114static void __init lager_add_standard_devices(void) 103static void __init lager_add_standard_devices(void)
115{ 104{
116 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); 105 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
117 shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
118 r8a7790_add_dt_devices(); 106 r8a7790_add_dt_devices();
119 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 107 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
120 108
@@ -129,9 +117,10 @@ static const char *lager_boards_compat_dt[] __initdata = {
129 117
130DT_MACHINE_START(LAGER_DT, "lager") 118DT_MACHINE_START(LAGER_DT, "lager")
131 .smp = smp_ops(r8a7790_smp_ops), 119 .smp = smp_ops(r8a7790_smp_ops),
132 .init_early = r8a7790_init_early, 120 .init_early = shmobile_init_delay,
133 .init_time = rcar_gen2_timer_init, 121 .init_time = rcar_gen2_timer_init,
134 .init_machine = lager_add_standard_devices, 122 .init_machine = lager_add_standard_devices,
135 .init_late = shmobile_init_late, 123 .init_late = shmobile_init_late,
124 .reserve = rcar_gen2_reserve,
136 .dt_compat = lager_boards_compat_dt, 125 .dt_compat = lager_boards_compat_dt,
137MACHINE_END 126MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index f8b1e05463cc..e1d8215da0b0 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,6 +31,8 @@
31#include <linux/mmc/host.h> 31#include <linux/mmc/host.h>
32#include <linux/mmc/sh_mmcif.h> 32#include <linux/mmc/sh_mmcif.h>
33#include <linux/mmc/sh_mobile_sdhi.h> 33#include <linux/mmc/sh_mobile_sdhi.h>
34#include <linux/mtd/partitions.h>
35#include <linux/mtd/mtd.h>
34#include <linux/pinctrl/machine.h> 36#include <linux/pinctrl/machine.h>
35#include <linux/platform_data/camera-rcar.h> 37#include <linux/platform_data/camera-rcar.h>
36#include <linux/platform_data/gpio-rcar.h> 38#include <linux/platform_data/gpio-rcar.h>
@@ -43,22 +45,23 @@
43#include <linux/regulator/gpio-regulator.h> 45#include <linux/regulator/gpio-regulator.h>
44#include <linux/regulator/machine.h> 46#include <linux/regulator/machine.h>
45#include <linux/sh_eth.h> 47#include <linux/sh_eth.h>
48#include <linux/spi/flash.h>
49#include <linux/spi/rspi.h>
50#include <linux/spi/spi.h>
46#include <linux/usb/phy.h> 51#include <linux/usb/phy.h>
47#include <linux/usb/renesas_usbhs.h> 52#include <linux/usb/renesas_usbhs.h>
48#include <mach/common.h> 53
49#include <mach/irqs.h>
50#include <mach/r8a7790.h>
51#include <media/soc_camera.h> 54#include <media/soc_camera.h>
52#include <asm/mach-types.h> 55#include <asm/mach-types.h>
53#include <asm/mach/arch.h> 56#include <asm/mach/arch.h>
54#include <linux/mtd/partitions.h>
55#include <linux/mtd/mtd.h>
56#include <linux/spi/flash.h>
57#include <linux/spi/rspi.h>
58#include <linux/spi/spi.h>
59#include <sound/rcar_snd.h> 57#include <sound/rcar_snd.h>
60#include <sound/simple_card.h> 58#include <sound/simple_card.h>
61 59
60#include "common.h"
61#include "irqs.h"
62#include "r8a7790.h"
63#include "rcar-gen2.h"
64
62/* 65/*
63 * SSI-AK4643 66 * SSI-AK4643
64 * 67 *
@@ -277,7 +280,6 @@ static const struct resource ether_resources[] __initconst = {
277}; 280};
278 281
279static const struct platform_device_info ether_info __initconst = { 282static const struct platform_device_info ether_info __initconst = {
280 .parent = &platform_bus,
281 .name = "r8a7790-ether", 283 .name = "r8a7790-ether",
282 .id = -1, 284 .id = -1,
283 .res = ether_resources, 285 .res = ether_resources,
@@ -354,7 +356,6 @@ static void __init lager_add_vin_device(unsigned idx,
354 struct rcar_vin_platform_data *pdata) 356 struct rcar_vin_platform_data *pdata)
355{ 357{
356 struct platform_device_info vin_info = { 358 struct platform_device_info vin_info = {
357 .parent = &platform_bus,
358 .name = "r8a7790-vin", 359 .name = "r8a7790-vin",
359 .id = idx, 360 .id = idx,
360 .res = &vin_resources[idx * 2], 361 .res = &vin_resources[idx * 2],
@@ -391,7 +392,7 @@ LAGER_CAMERA(1, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
391 392
392static void __init lager_add_camera1_device(void) 393static void __init lager_add_camera1_device(void)
393{ 394{
394 platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1, 395 platform_device_register_data(NULL, "soc-camera-pdrv", 1,
395 &cam1_link, sizeof(cam1_link)); 396 &cam1_link, sizeof(cam1_link));
396 lager_add_vin_device(1, &vin1_pdata); 397 lager_add_vin_device(1, &vin1_pdata);
397} 398}
@@ -403,7 +404,6 @@ static const struct resource sata1_resources[] __initconst = {
403}; 404};
404 405
405static const struct platform_device_info sata1_info __initconst = { 406static const struct platform_device_info sata1_info __initconst = {
406 .parent = &platform_bus,
407 .name = "sata-r8a7790", 407 .name = "sata-r8a7790",
408 .id = 1, 408 .id = 1,
409 .res = sata1_resources, 409 .res = sata1_resources,
@@ -533,7 +533,7 @@ static struct usbhs_private usbhs_priv __initdata = {
533static void __init lager_register_usbhs(void) 533static void __init lager_register_usbhs(void)
534{ 534{
535 usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2"); 535 usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2");
536 platform_device_register_resndata(&platform_bus, 536 platform_device_register_resndata(NULL,
537 "renesas_usbhs", -1, 537 "renesas_usbhs", -1,
538 usbhs_resources, 538 usbhs_resources,
539 ARRAY_SIZE(usbhs_resources), 539 ARRAY_SIZE(usbhs_resources),
@@ -608,7 +608,6 @@ static struct asoc_simple_card_info rsnd_card_info = {
608static void __init lager_add_rsnd_device(void) 608static void __init lager_add_rsnd_device(void)
609{ 609{
610 struct platform_device_info cardinfo = { 610 struct platform_device_info cardinfo = {
611 .parent = &platform_bus,
612 .name = "asoc-simple-card", 611 .name = "asoc-simple-card",
613 .id = -1, 612 .id = -1,
614 .data = &rsnd_card_info, 613 .data = &rsnd_card_info,
@@ -620,7 +619,7 @@ static void __init lager_add_rsnd_device(void)
620 ARRAY_SIZE(i2c2_devices)); 619 ARRAY_SIZE(i2c2_devices));
621 620
622 platform_device_register_resndata( 621 platform_device_register_resndata(
623 &platform_bus, "rcar_sound", -1, 622 NULL, "rcar_sound", -1,
624 rsnd_resources, ARRAY_SIZE(rsnd_resources), 623 rsnd_resources, ARRAY_SIZE(rsnd_resources),
625 &rsnd_info, sizeof(rsnd_info)); 624 &rsnd_info, sizeof(rsnd_info));
626 625
@@ -663,7 +662,6 @@ static const struct resource pci1_resources[] __initconst = {
663}; 662};
664 663
665static const struct platform_device_info pci1_info __initconst = { 664static const struct platform_device_info pci1_info __initconst = {
666 .parent = &platform_bus,
667 .name = "pci-rcar-gen2", 665 .name = "pci-rcar-gen2",
668 .id = 1, 666 .id = 1,
669 .res = pci1_resources, 667 .res = pci1_resources,
@@ -684,7 +682,6 @@ static const struct resource pci2_resources[] __initconst = {
684}; 682};
685 683
686static const struct platform_device_info pci2_info __initconst = { 684static const struct platform_device_info pci2_info __initconst = {
687 .parent = &platform_bus,
688 .name = "pci-rcar-gen2", 685 .name = "pci-rcar-gen2",
689 .id = 2, 686 .id = 2,
690 .res = pci2_resources, 687 .res = pci2_resources,
@@ -795,16 +792,16 @@ static void __init lager_add_standard_devices(void)
795 r8a7790_pinmux_init(); 792 r8a7790_pinmux_init();
796 793
797 r8a7790_add_standard_devices(); 794 r8a7790_add_standard_devices();
798 platform_device_register_data(&platform_bus, "leds-gpio", -1, 795 platform_device_register_data(NULL, "leds-gpio", -1,
799 &lager_leds_pdata, 796 &lager_leds_pdata,
800 sizeof(lager_leds_pdata)); 797 sizeof(lager_leds_pdata));
801 platform_device_register_data(&platform_bus, "gpio-keys", -1, 798 platform_device_register_data(NULL, "gpio-keys", -1,
802 &lager_keys_pdata, 799 &lager_keys_pdata,
803 sizeof(lager_keys_pdata)); 800 sizeof(lager_keys_pdata));
804 regulator_register_always_on(fixed_regulator_idx++, 801 regulator_register_always_on(fixed_regulator_idx++,
805 "fixed-3.3V", fixed3v3_power_consumers, 802 "fixed-3.3V", fixed3v3_power_consumers,
806 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 803 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
807 platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, 804 platform_device_register_resndata(NULL, "sh_mmcif", 1,
808 mmcif1_resources, ARRAY_SIZE(mmcif1_resources), 805 mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
809 &mmcif1_pdata, sizeof(mmcif1_pdata)); 806 &mmcif1_pdata, sizeof(mmcif1_pdata));
810 807
@@ -812,27 +809,27 @@ static void __init lager_add_standard_devices(void)
812 809
813 lager_add_du_device(); 810 lager_add_du_device();
814 811
815 platform_device_register_resndata(&platform_bus, "qspi", 0, 812 platform_device_register_resndata(NULL, "qspi", 0,
816 qspi_resources, 813 qspi_resources,
817 ARRAY_SIZE(qspi_resources), 814 ARRAY_SIZE(qspi_resources),
818 &qspi_pdata, sizeof(qspi_pdata)); 815 &qspi_pdata, sizeof(qspi_pdata));
819 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); 816 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
820 817
821 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, 818 platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++,
822 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config)); 819 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
823 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, 820 platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++,
824 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config)); 821 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
825 822
826 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, 823 platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++,
827 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config)); 824 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
828 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, 825 platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++,
829 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config)); 826 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
830 827
831 lager_add_camera1_device(); 828 lager_add_camera1_device();
832 829
833 platform_device_register_full(&sata1_info); 830 platform_device_register_full(&sata1_info);
834 831
835 platform_device_register_resndata(&platform_bus, "usb_phy_rcar_gen2", 832 platform_device_register_resndata(NULL, "usb_phy_rcar_gen2",
836 -1, usbhs_phy_resources, 833 -1, usbhs_phy_resources,
837 ARRAY_SIZE(usbhs_phy_resources), 834 ARRAY_SIZE(usbhs_phy_resources),
838 &usbhs_phy_pdata, 835 &usbhs_phy_pdata,
@@ -843,10 +840,10 @@ static void __init lager_add_standard_devices(void)
843 840
844 lager_add_rsnd_device(); 841 lager_add_rsnd_device();
845 842
846 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0, 843 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
847 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 844 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
848 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); 845 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
849 platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2, 846 platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2,
850 sdhi2_resources, ARRAY_SIZE(sdhi2_resources), 847 sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
851 &sdhi2_info, sizeof(struct sh_mobile_sdhi_info)); 848 &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
852} 849}
@@ -886,9 +883,10 @@ static const char * const lager_boards_compat_dt[] __initconst = {
886 883
887DT_MACHINE_START(LAGER_DT, "lager") 884DT_MACHINE_START(LAGER_DT, "lager")
888 .smp = smp_ops(r8a7790_smp_ops), 885 .smp = smp_ops(r8a7790_smp_ops),
889 .init_early = r8a7790_init_early, 886 .init_early = shmobile_init_delay,
890 .init_time = rcar_gen2_timer_init, 887 .init_time = rcar_gen2_timer_init,
891 .init_machine = lager_init, 888 .init_machine = lager_init,
892 .init_late = shmobile_init_late, 889 .init_late = shmobile_init_late,
890 .reserve = rcar_gen2_reserve,
893 .dt_compat = lager_boards_compat_dt, 891 .dt_compat = lager_boards_compat_dt,
894MACHINE_END 892MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ff4d8e45cf7..79f448e93abb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -47,10 +47,11 @@
47#include <linux/regulator/fixed.h> 47#include <linux/regulator/fixed.h>
48#include <linux/regulator/machine.h> 48#include <linux/regulator/machine.h>
49#include <linux/smsc911x.h> 49#include <linux/smsc911x.h>
50#include <linux/sh_intc.h> 50#include <linux/sh_clk.h>
51#include <linux/tca6416_keypad.h> 51#include <linux/tca6416_keypad.h>
52#include <linux/usb/renesas_usbhs.h> 52#include <linux/usb/renesas_usbhs.h>
53#include <linux/dma-mapping.h> 53#include <linux/dma-mapping.h>
54
54#include <video/sh_mobile_hdmi.h> 55#include <video/sh_mobile_hdmi.h>
55#include <video/sh_mobile_lcdc.h> 56#include <video/sh_mobile_lcdc.h>
56#include <media/sh_mobile_ceu.h> 57#include <media/sh_mobile_ceu.h>
@@ -58,15 +59,14 @@
58#include <media/soc_camera_platform.h> 59#include <media/soc_camera_platform.h>
59#include <sound/sh_fsi.h> 60#include <sound/sh_fsi.h>
60#include <sound/simple_card.h> 61#include <sound/simple_card.h>
61
62#include <mach/common.h>
63#include <mach/irqs.h>
64#include <mach/sh7372.h>
65
66#include <asm/mach/arch.h> 62#include <asm/mach/arch.h>
67#include <asm/mach-types.h> 63#include <asm/mach-types.h>
68 64
65#include "common.h"
66#include "irqs.h"
67#include "pm-rmobile.h"
69#include "sh-gpio.h" 68#include "sh-gpio.h"
69#include "sh7372.h"
70 70
71/* 71/*
72 * Address Interface BusWidth note 72 * Address Interface BusWidth note
@@ -523,6 +523,8 @@ static struct platform_device fsi_hdmi_device = {
523 .id = 1, 523 .id = 1,
524 .dev = { 524 .dev = {
525 .platform_data = &fsi2_hdmi_info, 525 .platform_data = &fsi2_hdmi_info,
526 .coherent_dma_mask = DMA_BIT_MASK(32),
527 .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
526 }, 528 },
527}; 529};
528 530
@@ -919,6 +921,8 @@ static struct platform_device fsi_ak4643_device = {
919 .name = "asoc-simple-card", 921 .name = "asoc-simple-card",
920 .dev = { 922 .dev = {
921 .platform_data = &fsi2_ak4643_info, 923 .platform_data = &fsi2_ak4643_info,
924 .coherent_dma_mask = DMA_BIT_MASK(32),
925 .dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
922 }, 926 },
923}; 927};
924 928
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
index 2773936bf7dc..21b3e1ca2261 100644
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -19,19 +19,42 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#include <mach/r8a7779.h> 22#include <linux/clk/shmobile.h>
23#include <mach/common.h> 23#include <linux/clocksource.h>
24#include <mach/irqs.h> 24#include <linux/of_platform.h>
25
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
27 28
29#include "clock.h"
30#include "common.h"
31#include "irqs.h"
32#include "r8a7779.h"
33
34static void __init marzen_init_timer(void)
35{
36 r8a7779_clocks_init(r8a7779_read_mode_pins());
37 clocksource_of_init();
38}
39
40/*
41 * This is a really crude hack to provide clkdev support to platform
42 * devices until they get moved to DT.
43 */
44static const struct clk_name clk_names[] __initconst = {
45 { "tmu0", "fck", "sh-tmu.0" },
46};
47
28static void __init marzen_init(void) 48static void __init marzen_init(void)
29{ 49{
50 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
30 r8a7779_add_standard_devices_dt(); 51 r8a7779_add_standard_devices_dt();
52 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */ 53 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
32} 54}
33 55
34static const char *marzen_boards_compat_dt[] __initdata = { 56static const char *marzen_boards_compat_dt[] __initdata = {
57 "renesas,marzen",
35 "renesas,marzen-reference", 58 "renesas,marzen-reference",
36 NULL, 59 NULL,
37}; 60};
@@ -39,7 +62,8 @@ static const char *marzen_boards_compat_dt[] __initdata = {
39DT_MACHINE_START(MARZEN, "marzen") 62DT_MACHINE_START(MARZEN, "marzen")
40 .smp = smp_ops(r8a7779_smp_ops), 63 .smp = smp_ops(r8a7779_smp_ops),
41 .map_io = r8a7779_map_io, 64 .map_io = r8a7779_map_io,
42 .init_early = r8a7779_init_delay, 65 .init_early = shmobile_init_delay,
66 .init_time = marzen_init_timer,
43 .nr_irqs = NR_IRQS_LEGACY, 67 .nr_irqs = NR_IRQS_LEGACY,
44 .init_irq = r8a7779_init_irq_dt, 68 .init_irq = r8a7779_init_irq_dt,
45 .init_machine = marzen_init, 69 .init_machine = marzen_init,
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index d832a4477b4b..e5cf4201e769 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -41,14 +41,16 @@
41#include <linux/mmc/host.h> 41#include <linux/mmc/host.h>
42#include <linux/mmc/sh_mobile_sdhi.h> 42#include <linux/mmc/sh_mobile_sdhi.h>
43#include <linux/mfd/tmio.h> 43#include <linux/mfd/tmio.h>
44
44#include <media/soc_camera.h> 45#include <media/soc_camera.h>
45#include <mach/r8a7779.h>
46#include <mach/common.h>
47#include <mach/irqs.h>
48#include <asm/mach-types.h> 46#include <asm/mach-types.h>
49#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
50#include <asm/traps.h> 48#include <asm/traps.h>
51 49
50#include "common.h"
51#include "irqs.h"
52#include "r8a7779.h"
53
52/* Fixed 3.3V regulator to be used by SDHI0 */ 54/* Fixed 3.3V regulator to be used by SDHI0 */
53static struct regulator_consumer_supply fixed3v3_power_consumers[] = { 55static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
54 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 56 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
@@ -272,7 +274,6 @@ static struct resource vin##idx##_resources[] __initdata = { \
272}; \ 274}; \
273 \ 275 \
274static struct platform_device_info vin##idx##_info __initdata = { \ 276static struct platform_device_info vin##idx##_info __initdata = { \
275 .parent = &platform_bus, \
276 .name = "r8a7779-vin", \ 277 .name = "r8a7779-vin", \
277 .id = idx, \ 278 .id = idx, \
278 .res = vin##idx##_resources, \ 279 .res = vin##idx##_resources, \
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
index df187484de5d..3eb2ec401e0c 100644
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -19,8 +19,9 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/sh_clk.h> 20#include <linux/sh_clk.h>
21#include <linux/clkdev.h> 21#include <linux/clkdev.h>
22#include <mach/common.h> 22
23#include <mach/r7s72100.h> 23#include "common.h"
24#include "r7s72100.h"
24 25
25/* Frequency Control Registers */ 26/* Frequency Control Registers */
26#define FRQCR 0xfcfe0010 27#define FRQCR 0xfcfe0010
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index b5bc22c6a858..c2330ea1802c 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -22,8 +22,8 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25#include "common.h"
26#include <mach/common.h> 26#include "clock.h"
27 27
28#define CPG_BASE 0xe6150000 28#define CPG_BASE 0xe6150000
29#define CPG_LEN 0x270 29#define CPG_LEN 0x270
@@ -574,11 +574,17 @@ static struct clk_lookup lookups[] = {
574 574
575 /* MSTP */ 575 /* MSTP */
576 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 576 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
577 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
577 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 578 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
579 CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
578 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), 580 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
581 CLKDEV_DEV_ID("e6c20000.serial", &mstp_clks[MSTP206]),
579 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), 582 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]),
583 CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP207]),
580 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), 584 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
585 CLKDEV_DEV_ID("e6ce0000.serial", &mstp_clks[MSTP216]),
581 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), 586 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]),
587 CLKDEV_DEV_ID("e6cf0000.serial", &mstp_clks[MSTP217]),
582 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 588 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
583 CLKDEV_DEV_ID("e6700020.dma-controller", &mstp_clks[MSTP218]), 589 CLKDEV_DEV_ID("e6700020.dma-controller", &mstp_clks[MSTP218]),
584 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 590 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
@@ -598,6 +604,7 @@ static struct clk_lookup lookups[] = {
598 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]), 604 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
599 CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]), 605 CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]),
600 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.1", &mstp_clks[MSTP329]), 606 CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.1", &mstp_clks[MSTP329]),
607 CLKDEV_ICK_ID("fck", "e6130000.timer", &mstp_clks[MSTP329]),
601 CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]), 608 CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]),
602 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]), 609 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]),
603 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]), 610 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 50931e3c97c7..0794f0426e70 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -22,9 +22,10 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25
26#include <mach/common.h> 26#include "clock.h"
27#include <mach/r8a7740.h> 27#include "common.h"
28#include "r8a7740.h"
28 29
29/* 30/*
30 * | MDx | XTAL1/EXTAL1 | System | EXTALR | 31 * | MDx | XTAL1/EXTAL1 | System | EXTALR |
@@ -555,27 +556,27 @@ static struct clk_lookup lookups[] = {
555 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), 556 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
556 557
557 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), 558 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
558 CLKDEV_DEV_ID("e6c80000.sci", &mstp_clks[MSTP200]), 559 CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]),
559 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), 560 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
560 CLKDEV_DEV_ID("e6c70000.sci", &mstp_clks[MSTP201]), 561 CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]),
561 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), 562 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
562 CLKDEV_DEV_ID("e6c60000.sci", &mstp_clks[MSTP202]), 563 CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]),
563 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 564 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
564 CLKDEV_DEV_ID("e6c50000.sci", &mstp_clks[MSTP203]), 565 CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
565 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 566 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
566 CLKDEV_DEV_ID("e6c40000.sci", &mstp_clks[MSTP204]), 567 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
567 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), 568 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
568 CLKDEV_DEV_ID("e6c30000.sci", &mstp_clks[MSTP206]), 569 CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP206]),
569 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), 570 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
570 CLKDEV_DEV_ID("e6cb0000.sci", &mstp_clks[MSTP207]), 571 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]),
571 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), 572 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]),
572 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), 573 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]),
573 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), 574 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]),
574 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 575 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
575 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), 576 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
576 CLKDEV_DEV_ID("e6cd0000.sci", &mstp_clks[MSTP222]), 577 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]),
577 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 578 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
578 CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]), 579 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]),
579 580
580 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 581 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
581 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]), 582 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]),
@@ -598,8 +599,11 @@ static struct clk_lookup lookups[] = {
598 599
599 /* ICK */ 600 /* ICK */
600 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP111]), 601 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP111]),
602 CLKDEV_ICK_ID("fck", "fff90000.timer", &mstp_clks[MSTP111]),
601 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), 603 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]),
604 CLKDEV_ICK_ID("fck", "fff80000.timer", &mstp_clks[MSTP125]),
602 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), 605 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]),
606 CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]),
603 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), 607 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
604 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]), 608 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
605 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]), 609 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 13f8f3ab8840..67980a08a601 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -39,8 +39,8 @@
39#include <linux/io.h> 39#include <linux/io.h>
40#include <linux/sh_clk.h> 40#include <linux/sh_clk.h>
41#include <linux/clkdev.h> 41#include <linux/clkdev.h>
42#include <mach/clock.h> 42#include "clock.h"
43#include <mach/common.h> 43#include "common.h"
44 44
45#define MSTPCR0 IOMEM(0xffc80030) 45#define MSTPCR0 IOMEM(0xffc80030)
46#define MSTPCR1 IOMEM(0xffc80034) 46#define MSTPCR1 IOMEM(0xffc80034)
@@ -202,11 +202,17 @@ static struct clk_lookup lookups[] = {
202 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */ 202 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
203 CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */ 203 CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
204 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 204 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
205 CLKDEV_DEV_ID("ffe40000.serial", &mstp_clks[MSTP026]), /* SCIF0 */
205 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 206 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
207 CLKDEV_DEV_ID("ffe41000.serial", &mstp_clks[MSTP025]), /* SCIF1 */
206 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 208 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
209 CLKDEV_DEV_ID("ffe42000.serial", &mstp_clks[MSTP024]), /* SCIF2 */
207 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */ 210 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
211 CLKDEV_DEV_ID("ffe43000.serial", &mstp_clks[MSTP023]), /* SCIF3 */
208 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */ 212 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
213 CLKDEV_DEV_ID("ffe44000.serial", &mstp_clks[MSTP022]), /* SCIF4 */
209 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */ 214 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
215 CLKDEV_DEV_ID("ffe45000.serial", &mstp_clks[MSTP021]), /* SCIF5 */
210 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ 216 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
211 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */ 217 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
212 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ 218 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
@@ -238,7 +244,9 @@ static struct clk_lookup lookups[] = {
238 CLKDEV_ICK_ID("src.7", "rcar_sound", &mstp_clks[MSTP524]), 244 CLKDEV_ICK_ID("src.7", "rcar_sound", &mstp_clks[MSTP524]),
239 CLKDEV_ICK_ID("src.8", "rcar_sound", &mstp_clks[MSTP523]), 245 CLKDEV_ICK_ID("src.8", "rcar_sound", &mstp_clks[MSTP523]),
240 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]), 246 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]),
247 CLKDEV_ICK_ID("fck", "ffd80000.timer", &mstp_clks[MSTP016]),
241 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]), 248 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]),
249 CLKDEV_ICK_ID("fck", "ffd81000.timer", &mstp_clks[MSTP015]),
242}; 250};
243 251
244void __init r8a7778_clock_init(void) 252void __init r8a7778_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index a13298bd37a8..c51f9db3f66f 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -23,8 +23,11 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/clkdev.h> 25#include <linux/clkdev.h>
26#include <mach/clock.h> 26#include <linux/sh_timer.h>
27#include <mach/common.h> 27
28#include "clock.h"
29#include "common.h"
30#include "r8a7779.h"
28 31
29/* 32/*
30 * MD1 = 1 MD1 = 0 33 * MD1 = 1 MD1 = 0
@@ -52,9 +55,6 @@
52#define MSTPCR3 IOMEM(0xffc8003c) 55#define MSTPCR3 IOMEM(0xffc8003c)
53#define MSTPSR1 IOMEM(0xffc80044) 56#define MSTPSR1 IOMEM(0xffc80044)
54 57
55#define MODEMR 0xffcc0020
56
57
58/* ioremap() through clock mapping mandatory to avoid 58/* ioremap() through clock mapping mandatory to avoid
59 * collision with ARM coherent DMA virtual memory range. 59 * collision with ARM coherent DMA virtual memory range.
60 */ 60 */
@@ -207,14 +207,9 @@ static struct clk_lookup lookups[] = {
207 207
208void __init r8a7779_clock_init(void) 208void __init r8a7779_clock_init(void)
209{ 209{
210 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE); 210 u32 mode = r8a7779_read_mode_pins();
211 u32 mode;
212 int k, ret = 0; 211 int k, ret = 0;
213 212
214 BUG_ON(!modemr);
215 mode = ioread32(modemr);
216 iounmap(modemr);
217
218 if (mode & MD(1)) { 213 if (mode & MD(1)) {
219 plla_clk.rate = 1500000000; 214 plla_clk.rate = 1500000000;
220 215
@@ -268,3 +263,13 @@ void __init r8a7779_clock_init(void)
268 else 263 else
269 panic("failed to setup r8a7779 clocks\n"); 264 panic("failed to setup r8a7779 clocks\n");
270} 265}
266
267/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
268void __init __weak r8a7779_register_twd(void) { }
269
270void __init r8a7779_earlytimer_init(void)
271{
272 r8a7779_clock_init();
273 r8a7779_register_twd();
274 shmobile_earlytimer_init();
275}
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 296a057109e4..17435c1aa2fe 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -22,9 +22,11 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sh_clk.h> 23#include <linux/sh_clk.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <mach/clock.h> 25
26#include <mach/common.h> 26#include "clock.h"
27#include <mach/r8a7790.h> 27#include "common.h"
28#include "r8a7790.h"
29#include "rcar-gen2.h"
28 30
29/* 31/*
30 * MD EXTAL PLL0 PLL1 PLL3 32 * MD EXTAL PLL0 PLL1 PLL3
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index e2fdfcc14436..10e193d707f5 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -23,9 +23,9 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/clkdev.h> 25#include <linux/clkdev.h>
26#include <mach/clock.h> 26#include "clock.h"
27#include <mach/common.h> 27#include "common.h"
28#include <mach/rcar-gen2.h> 28#include "rcar-gen2.h"
29 29
30/* 30/*
31 * MD EXTAL PLL0 PLL1 PLL3 31 * MD EXTAL PLL0 PLL1 PLL3
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index d16d9ca7f79e..7071676145c4 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -21,8 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/sh_clk.h> 22#include <linux/sh_clk.h>
23#include <linux/clkdev.h> 23#include <linux/clkdev.h>
24#include <mach/clock.h> 24#include "clock.h"
25#include <mach/common.h> 25#include "common.h"
26 26
27/* SH7372 registers */ 27/* SH7372 registers */
28#define FRQCRA IOMEM(0xe6150000) 28#define FRQCRA IOMEM(0xe6150000)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 0d9cd1fe0212..d8c4048b9e33 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -22,8 +22,8 @@
22#include <linux/sh_clk.h> 22#include <linux/sh_clk.h>
23#include <linux/clkdev.h> 23#include <linux/clkdev.h>
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <mach/clock.h> 25#include "clock.h"
26#include <mach/common.h> 26#include "common.h"
27 27
28#define FRQCRA IOMEM(0xe6150000) 28#define FRQCRA IOMEM(0xe6150000)
29#define FRQCRB IOMEM(0xe6150004) 29#define FRQCRB IOMEM(0xe6150004)
@@ -638,16 +638,25 @@ static struct clk_lookup lookups[] = {
638 CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */ 638 CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */
639 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ 639 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
640 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ 640 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
641 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP219]), /* SCIFA7 */
641 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */ 642 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
642 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* MP-DMAC */ 643 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* MP-DMAC */
643 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 644 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
645 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */
644 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ 646 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
647 CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
645 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 648 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
649 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */
646 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ 650 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
651 CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]), /* SCIFA1 */
647 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */ 652 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
653 CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]), /* SCIFA2 */
648 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ 654 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
655 CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]), /* SCIFA3 */
649 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 656 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
657 CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]), /* SCIFA4 */
650 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 658 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
659 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP331]), /* SCIFA6 */
651 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ 660 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
652 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */ 661 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
653 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 662 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
@@ -681,6 +690,7 @@ static struct clk_lookup lookups[] = {
681 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), 690 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
682 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), 691 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
683 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), /* CMT1 */ 692 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), /* CMT1 */
693 CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]), /* CMT1 */
684 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */ 694 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */
685}; 695};
686 696
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index e7232a0373b9..806f94038cc4 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -25,7 +25,7 @@
25#ifdef CONFIG_COMMON_CLK 25#ifdef CONFIG_COMMON_CLK
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/clkdev.h> 27#include <linux/clkdev.h>
28#include <mach/clock.h> 28#include "clock.h"
29 29
30void __init shmobile_clk_workaround(const struct clk_name *clks, 30void __init shmobile_clk_workaround(const struct clk_name *clks,
31 int nr_clks, bool enable) 31 int nr_clks, bool enable)
@@ -49,8 +49,8 @@ void __init shmobile_clk_workaround(const struct clk_name *clks,
49#else /* CONFIG_COMMON_CLK */ 49#else /* CONFIG_COMMON_CLK */
50#include <linux/sh_clk.h> 50#include <linux/sh_clk.h>
51#include <linux/export.h> 51#include <linux/export.h>
52#include <mach/clock.h> 52#include "clock.h"
53#include <mach/common.h> 53#include "common.h"
54 54
55unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk) 55unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
56{ 56{
diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/clock.h
index 31b6417463e6..31b6417463e6 100644
--- a/arch/arm/mach-shmobile/include/mach/clock.h
+++ b/arch/arm/mach-shmobile/clock.h
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/common.h
index f7a360edcc35..98056081f0da 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -35,8 +35,10 @@ extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
35 35
36#ifdef CONFIG_SUSPEND 36#ifdef CONFIG_SUSPEND
37int shmobile_suspend_init(void); 37int shmobile_suspend_init(void);
38void shmobile_smp_apmu_suspend_init(void);
38#else 39#else
39static inline int shmobile_suspend_init(void) { return 0; } 40static inline int shmobile_suspend_init(void) { return 0; }
41static inline void shmobile_smp_apmu_suspend_init(void) { }
40#endif 42#endif
41 43
42#ifdef CONFIG_CPU_IDLE 44#ifdef CONFIG_CPU_IDLE
@@ -45,12 +47,19 @@ int shmobile_cpuidle_init(void);
45static inline int shmobile_cpuidle_init(void) { return 0; } 47static inline int shmobile_cpuidle_init(void) { return 0; }
46#endif 48#endif
47 49
50#ifdef CONFIG_CPU_FREQ
51int shmobile_cpufreq_init(void);
52#else
53static inline int shmobile_cpufreq_init(void) { return 0; }
54#endif
55
48extern void __iomem *shmobile_scu_base; 56extern void __iomem *shmobile_scu_base;
49 57
50static inline void __init shmobile_init_late(void) 58static inline void __init shmobile_init_late(void)
51{ 59{
52 shmobile_suspend_init(); 60 shmobile_suspend_init();
53 shmobile_cpuidle_init(); 61 shmobile_cpuidle_init();
62 shmobile_cpufreq_init();
54} 63}
55 64
56#endif /* __ARCH_MACH_COMMON_H */ 65#endif /* __ARCH_MACH_COMMON_H */
diff --git a/arch/arm/mach-shmobile/console.c b/arch/arm/mach-shmobile/console.c
index 9411a5bf4fd6..f2e79f2376e1 100644
--- a/arch/arm/mach-shmobile/console.c
+++ b/arch/arm/mach-shmobile/console.c
@@ -19,8 +19,8 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <mach/common.h>
23#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include "common.h"
24 24
25void __init shmobile_setup_console(void) 25void __init shmobile_setup_console(void)
26{ 26{
diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c
new file mode 100644
index 000000000000..8a24b2be46ae
--- /dev/null
+++ b/arch/arm/mach-shmobile/cpufreq.c
@@ -0,0 +1,17 @@
1/*
2 * CPUFreq support code for SH-Mobile ARM
3 *
4 * Copyright (C) 2014 Gaku Inami
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/platform_device.h>
12
13int __init shmobile_cpufreq_init(void)
14{
15 platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
16 return 0;
17}
diff --git a/arch/arm/mach-shmobile/include/mach/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
index 97c40bd9b94f..97c40bd9b94f 100644
--- a/arch/arm/mach-shmobile/include/mach/dma-register.h
+++ b/arch/arm/mach-shmobile/dma-register.h
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index e5be5c88644b..50c491567e11 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -10,14 +10,18 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#include <linux/linkage.h>
14#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/linkage.h>
15#include <linux/threads.h>
16#include <asm/assembler.h>
15#include <asm/memory.h> 17#include <asm/memory.h>
16 18
19#ifdef CONFIG_SMP
17ENTRY(shmobile_invalidate_start) 20ENTRY(shmobile_invalidate_start)
18 bl v7_invalidate_l1 21 bl v7_invalidate_l1
19 b secondary_startup 22 b secondary_startup
20ENDPROC(shmobile_invalidate_start) 23ENDPROC(shmobile_invalidate_start)
24#endif
21 25
22/* 26/*
23 * Reset vector for secondary CPUs. 27 * Reset vector for secondary CPUs.
@@ -68,14 +72,14 @@ shmobile_smp_boot_find_mpidr:
68 72
69shmobile_smp_boot_next: 73shmobile_smp_boot_next:
70 add r1, r1, #1 74 add r1, r1, #1
71 cmp r1, #CONFIG_NR_CPUS 75 cmp r1, #NR_CPUS
72 blo shmobile_smp_boot_find_mpidr 76 blo shmobile_smp_boot_find_mpidr
73 77
74 b shmobile_smp_sleep 78 b shmobile_smp_sleep
75 79
76shmobile_smp_boot_found: 80shmobile_smp_boot_found:
77 ldr r0, [r7, r1, lsl #2] 81 ldr r0, [r7, r1, lsl #2]
78 mov pc, r9 82 ret r9
79ENDPROC(shmobile_smp_boot) 83ENDPROC(shmobile_smp_boot)
80 84
81ENTRY(shmobile_smp_sleep) 85ENTRY(shmobile_smp_sleep)
@@ -85,10 +89,10 @@ ENDPROC(shmobile_smp_sleep)
85 89
86 .globl shmobile_smp_mpidr 90 .globl shmobile_smp_mpidr
87shmobile_smp_mpidr: 91shmobile_smp_mpidr:
881: .space CONFIG_NR_CPUS * 4 921: .space NR_CPUS * 4
89 .globl shmobile_smp_fn 93 .globl shmobile_smp_fn
90shmobile_smp_fn: 94shmobile_smp_fn:
912: .space CONFIG_NR_CPUS * 4 952: .space NR_CPUS * 4
92 .globl shmobile_smp_arg 96 .globl shmobile_smp_arg
93shmobile_smp_arg: 97shmobile_smp_arg:
943: .space CONFIG_NR_CPUS * 4 983: .space NR_CPUS * 4
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index d241bfd6926d..5aee83f079e2 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -1,24 +1,10 @@
1#ifndef __ASM_MACH_IRQS_H 1#ifndef __ASM_MACH_IRQS_H
2#define __ASM_MACH_IRQS_H 2#define __ASM_MACH_IRQS_H
3 3
4#include <linux/sh_intc.h> 4/* Stuck here until drivers/pinctl/sh-pfc gets rid of legacy code */
5
6/* GIC */
7#define gic_spi(nr) ((nr) + 32)
8#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
9
10/* INTCS */
11#define INTCS_VECT_BASE 0x3400
12#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
13#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
14 5
15/* External IRQ pins */ 6/* External IRQ pins */
16#define IRQPIN_BASE 2000 7#define IRQPIN_BASE 2000
17#define irq_pin(nr) ((nr) + IRQPIN_BASE) 8#define irq_pin(nr) ((nr) + IRQPIN_BASE)
18 9
19/* GPIO IRQ */
20#define _GPIO_IRQ_BASE 2500
21#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
22#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
23
24#endif /* __ASM_MACH_IRQS_H */ 10#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index a91caad7db7c..e2af00b1bd9d 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -22,11 +22,10 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/sh_intc.h>
26#include <mach/intc.h>
27#include <mach/irqs.h>
28#include <asm/mach-types.h> 25#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include "intc.h"
28#include "irqs.h"
30 29
31enum { 30enum {
32 UNUSED_INTCA = 0, 31 UNUSED_INTCA = 0,
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 19a26f4579b3..44457a94897b 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -22,15 +22,16 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/sh_intc.h>
26#include <linux/irqchip.h> 25#include <linux/irqchip.h>
27#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
28#include <mach/intc.h> 27
29#include <mach/irqs.h>
30#include <mach/sh73a0.h>
31#include <asm/mach-types.h> 28#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
33 30
31#include "intc.h"
32#include "irqs.h"
33#include "sh73a0.h"
34
34enum { 35enum {
35 UNUSED = 0, 36 UNUSED = 0,
36 37
diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/intc.h
index a5603c76cfe0..a5603c76cfe0 100644
--- a/arch/arm/mach-shmobile/include/mach/intc.h
+++ b/arch/arm/mach-shmobile/intc.h
diff --git a/arch/arm/mach-shmobile/irqs.h b/arch/arm/mach-shmobile/irqs.h
new file mode 100644
index 000000000000..4ff2d2aa94f0
--- /dev/null
+++ b/arch/arm/mach-shmobile/irqs.h
@@ -0,0 +1,21 @@
1#ifndef __SHMOBILE_IRQS_H
2#define __SHMOBILE_IRQS_H
3
4#include <linux/sh_intc.h>
5#include <mach/irqs.h>
6
7/* GIC */
8#define gic_spi(nr) ((nr) + 32)
9#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
10
11/* INTCS */
12#define INTCS_VECT_BASE 0x3400
13#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
14#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
15
16/* GPIO IRQ */
17#define _GPIO_IRQ_BASE 2500
18#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
19#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
20
21#endif /* __SHMOBILE_IRQS_H */
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 8cb641c00fdb..2c06810d3a70 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -7,27 +7,32 @@
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#include <linux/cpu_pm.h>
10#include <linux/delay.h> 11#include <linux/delay.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/io.h> 13#include <linux/io.h>
13#include <linux/ioport.h> 14#include <linux/ioport.h>
14#include <linux/of_address.h> 15#include <linux/of_address.h>
15#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/suspend.h>
18#include <linux/threads.h>
16#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
17#include <asm/cp15.h> 20#include <asm/cp15.h>
21#include <asm/proc-fns.h>
18#include <asm/smp_plat.h> 22#include <asm/smp_plat.h>
19#include <mach/common.h> 23#include <asm/suspend.h>
24#include "common.h"
20 25
21static struct { 26static struct {
22 void __iomem *iomem; 27 void __iomem *iomem;
23 int bit; 28 int bit;
24} apmu_cpus[CONFIG_NR_CPUS]; 29} apmu_cpus[NR_CPUS];
25 30
26#define WUPCR_OFFS 0x10 31#define WUPCR_OFFS 0x10
27#define PSTR_OFFS 0x40 32#define PSTR_OFFS 0x40
28#define CPUNCR_OFFS(n) (0x100 + (0x10 * (n))) 33#define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
29 34
30static int apmu_power_on(void __iomem *p, int bit) 35static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
31{ 36{
32 /* request power on */ 37 /* request power on */
33 writel_relaxed(BIT(bit), p + WUPCR_OFFS); 38 writel_relaxed(BIT(bit), p + WUPCR_OFFS);
@@ -46,7 +51,7 @@ static int apmu_power_off(void __iomem *p, int bit)
46 return 0; 51 return 0;
47} 52}
48 53
49static int apmu_power_off_poll(void __iomem *p, int bit) 54static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
50{ 55{
51 int k; 56 int k;
52 57
@@ -69,7 +74,7 @@ static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
69 74
70static void apmu_init_cpu(struct resource *res, int cpu, int bit) 75static void apmu_init_cpu(struct resource *res, int cpu, int bit)
71{ 76{
72 if (apmu_cpus[cpu].iomem) 77 if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
73 return; 78 return;
74 79
75 apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res)); 80 apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
@@ -133,6 +138,7 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus)
133 apmu_parse_cfg(apmu_init_cpu); 138 apmu_parse_cfg(apmu_init_cpu);
134} 139}
135 140
141#ifdef CONFIG_SMP
136int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) 142int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
137{ 143{
138 /* For this particular CPU register boot vector */ 144 /* For this particular CPU register boot vector */
@@ -140,8 +146,9 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
140 146
141 return apmu_wrap(cpu, apmu_power_on); 147 return apmu_wrap(cpu, apmu_power_on);
142} 148}
149#endif
143 150
144#ifdef CONFIG_HOTPLUG_CPU 151#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
145/* nicked from arch/arm/mach-exynos/hotplug.c */ 152/* nicked from arch/arm/mach-exynos/hotplug.c */
146static inline void cpu_enter_lowpower_a15(void) 153static inline void cpu_enter_lowpower_a15(void)
147{ 154{
@@ -172,16 +179,40 @@ static inline void cpu_enter_lowpower_a15(void)
172 dsb(); 179 dsb();
173} 180}
174 181
175void shmobile_smp_apmu_cpu_die(unsigned int cpu) 182void shmobile_smp_apmu_cpu_shutdown(unsigned int cpu)
176{ 183{
177 /* For this particular CPU deregister boot vector */
178 shmobile_smp_hook(cpu, 0, 0);
179 184
180 /* Select next sleep mode using the APMU */ 185 /* Select next sleep mode using the APMU */
181 apmu_wrap(cpu, apmu_power_off); 186 apmu_wrap(cpu, apmu_power_off);
182 187
183 /* Do ARM specific CPU shutdown */ 188 /* Do ARM specific CPU shutdown */
184 cpu_enter_lowpower_a15(); 189 cpu_enter_lowpower_a15();
190}
191
192static inline void cpu_leave_lowpower(void)
193{
194 unsigned int v;
195
196 asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
197 " orr %0, %0, %1\n"
198 " mcr p15, 0, %0, c1, c0, 0\n"
199 " mrc p15, 0, %0, c1, c0, 1\n"
200 " orr %0, %0, %2\n"
201 " mcr p15, 0, %0, c1, c0, 1\n"
202 : "=&r" (v)
203 : "Ir" (CR_C), "Ir" (0x40)
204 : "cc");
205}
206#endif
207
208#if defined(CONFIG_HOTPLUG_CPU)
209void shmobile_smp_apmu_cpu_die(unsigned int cpu)
210{
211 /* For this particular CPU deregister boot vector */
212 shmobile_smp_hook(cpu, 0, 0);
213
214 /* Shutdown CPU core */
215 shmobile_smp_apmu_cpu_shutdown(cpu);
185 216
186 /* jump to shared mach-shmobile sleep / reset code */ 217 /* jump to shared mach-shmobile sleep / reset code */
187 shmobile_smp_sleep(); 218 shmobile_smp_sleep();
@@ -192,3 +223,25 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
192 return apmu_wrap(cpu, apmu_power_off_poll); 223 return apmu_wrap(cpu, apmu_power_off_poll);
193} 224}
194#endif 225#endif
226
227#if defined(CONFIG_SUSPEND)
228static int shmobile_smp_apmu_do_suspend(unsigned long cpu)
229{
230 shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0);
231 shmobile_smp_apmu_cpu_shutdown(cpu);
232 cpu_do_idle(); /* WFI selects Core Standby */
233 return 1;
234}
235
236static int shmobile_smp_apmu_enter_suspend(suspend_state_t state)
237{
238 cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend);
239 cpu_leave_lowpower();
240 return 0;
241}
242
243void __init shmobile_smp_apmu_suspend_init(void)
244{
245 shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend;
246}
247#endif
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 673ad6e80869..64663110ab6c 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -15,7 +15,7 @@
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 16#include <asm/smp_plat.h>
17#include <asm/smp_scu.h> 17#include <asm/smp_scu.h>
18#include <mach/common.h> 18#include "common.h"
19 19
20static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb, 20static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
21 unsigned long action, void *hcpu) 21 unsigned long action, void *hcpu)
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 9ebc246b8d7d..3923e09e966d 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/smp_plat.h> 15#include <asm/smp_plat.h>
16#include <mach/common.h> 16#include "common.h"
17 17
18extern unsigned long shmobile_smp_fn[]; 18extern unsigned long shmobile_smp_fn[];
19extern unsigned long shmobile_smp_arg[]; 19extern unsigned long shmobile_smp_arg[];
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index 40b87aa1d448..a0d44d537fa0 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -10,8 +10,8 @@
10 */ 10 */
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <mach/pm-rmobile.h> 13#include "common.h"
14#include <mach/common.h> 14#include "pm-rmobile.h"
15 15
16#ifdef CONFIG_PM 16#ifdef CONFIG_PM
17static int r8a7740_pd_a4s_suspend(void) 17static int r8a7740_pd_a4s_suspend(void)
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index d6fe189b2df6..69f70b7f7fb2 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -13,20 +13,33 @@
13#include <linux/suspend.h> 13#include <linux/suspend.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/pm_clock.h> 15#include <linux/pm_clock.h>
16#include <linux/pm_domain.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/irq.h> 19#include <linux/irq.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/console.h> 21#include <linux/console.h>
22
21#include <asm/io.h> 23#include <asm/io.h>
22#include <mach/common.h> 24
23#include <mach/pm-rcar.h> 25#include "common.h"
24#include <mach/r8a7779.h> 26#include "pm-rcar.h"
27#include "r8a7779.h"
25 28
26/* SYSC */ 29/* SYSC */
27#define SYSCIER 0x0c 30#define SYSCIER 0x0c
28#define SYSCIMR 0x10 31#define SYSCIMR 0x10
29 32
33struct r8a7779_pm_domain {
34 struct generic_pm_domain genpd;
35 struct rcar_sysc_ch ch;
36};
37
38static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
39{
40 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
41}
42
30#if defined(CONFIG_PM) || defined(CONFIG_SMP) 43#if defined(CONFIG_PM) || defined(CONFIG_SMP)
31 44
32static void __init r8a7779_sysc_init(void) 45static void __init r8a7779_sysc_init(void)
diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
index fc82839e2c2a..80e8d95e54d3 100644
--- a/arch/arm/mach-shmobile/pm-r8a7790.c
+++ b/arch/arm/mach-shmobile/pm-r8a7790.c
@@ -11,9 +11,21 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/smp.h>
14#include <asm/io.h> 15#include <asm/io.h>
15#include <mach/pm-rcar.h> 16#include "common.h"
16#include <mach/r8a7790.h> 17#include "pm-rcar.h"
18#include "r8a7790.h"
19
20/* RST */
21#define RST 0xe6160000
22#define CA15BAR 0x0020
23#define CA7BAR 0x0030
24#define CA15RESCNT 0x0040
25#define CA7RESCNT 0x0044
26
27/* On-chip RAM */
28#define MERAM 0xe8080000
17 29
18/* SYSC */ 30/* SYSC */
19#define SYSCIER 0x0c 31#define SYSCIER 0x0c
@@ -38,8 +50,33 @@ static inline void r8a7790_sysc_init(void) {}
38 50
39void __init r8a7790_pm_init(void) 51void __init r8a7790_pm_init(void)
40{ 52{
53 void __iomem *p;
54 u32 bar;
41 static int once; 55 static int once;
42 56
43 if (!once++) 57 if (once++)
44 r8a7790_sysc_init(); 58 return;
59
60 /* MERAM for jump stub, because BAR requires 256KB aligned address */
61 p = ioremap_nocache(MERAM, shmobile_boot_size);
62 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
63 iounmap(p);
64
65 /* setup reset vectors */
66 p = ioremap_nocache(RST, 0x63);
67 bar = (MERAM >> 8) & 0xfffffc00;
68 writel_relaxed(bar, p + CA15BAR);
69 writel_relaxed(bar, p + CA7BAR);
70 writel_relaxed(bar | 0x10, p + CA15BAR);
71 writel_relaxed(bar | 0x10, p + CA7BAR);
72
73 /* de-assert reset for all CPUs */
74 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
75 p + CA15RESCNT);
76 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
77 p + CA7RESCNT);
78 iounmap(p);
79
80 r8a7790_sysc_init();
81 shmobile_smp_apmu_suspend_init();
45} 82}
diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
new file mode 100644
index 000000000000..25f107bb3657
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm-r8a7791.c
@@ -0,0 +1,73 @@
1/*
2 * r8a7791 Power management support
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2011 Magnus Damm
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/kernel.h>
14#include <linux/smp.h>
15#include <asm/io.h>
16#include "common.h"
17#include "pm-rcar.h"
18#include "r8a7791.h"
19
20#define RST 0xe6160000
21#define CA15BAR 0x0020
22#define CA15RESCNT 0x0040
23#define RAM 0xe6300000
24
25/* SYSC */
26#define SYSCIER 0x0c
27#define SYSCIMR 0x10
28
29#if defined(CONFIG_SMP)
30
31static void __init r8a7791_sysc_init(void)
32{
33 void __iomem *base = rcar_sysc_init(0xe6180000);
34
35 /* enable all interrupt sources, but do not use interrupt handler */
36 iowrite32(0x0131000e, base + SYSCIER);
37 iowrite32(0, base + SYSCIMR);
38}
39
40#else /* CONFIG_SMP */
41
42static inline void r8a7791_sysc_init(void) {}
43
44#endif /* CONFIG_SMP */
45
46void __init r8a7791_pm_init(void)
47{
48 void __iomem *p;
49 u32 bar;
50 static int once;
51
52 if (once++)
53 return;
54
55 /* RAM for jump stub, because BAR requires 256KB aligned address */
56 p = ioremap_nocache(RAM, shmobile_boot_size);
57 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
58 iounmap(p);
59
60 /* setup reset vectors */
61 p = ioremap_nocache(RST, 0x63);
62 bar = (RAM >> 8) & 0xfffffc00;
63 writel_relaxed(bar, p + CA15BAR);
64 writel_relaxed(bar | 0x10, p + CA15BAR);
65
66 /* enable clocks to all CPUs */
67 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
68 p + CA15RESCNT);
69 iounmap(p);
70
71 r8a7791_sysc_init();
72 shmobile_smp_apmu_suspend_init();
73}
diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
index 1f465a12d1b1..34b8a5674f85 100644
--- a/arch/arm/mach-shmobile/pm-rcar.c
+++ b/arch/arm/mach-shmobile/pm-rcar.c
@@ -13,7 +13,7 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <mach/pm-rcar.h> 16#include "pm-rcar.h"
17 17
18/* SYSC */ 18/* SYSC */
19#define SYSCSR 0x00 19#define SYSCSR 0x00
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
index ef3a1ef628f1..ef3a1ef628f1 100644
--- a/arch/arm/mach-shmobile/include/mach/pm-rcar.h
+++ b/arch/arm/mach-shmobile/pm-rcar.h
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index f710235aff2f..ebdd16e94a84 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -17,7 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/pm_clock.h> 18#include <linux/pm_clock.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <mach/pm-rmobile.h> 20#include "pm-rmobile.h"
21 21
22/* SYSC */ 22/* SYSC */
23#define SPDCR IOMEM(0xe6180008) 23#define SPDCR IOMEM(0xe6180008)
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 690553a06887..690553a06887 100644
--- a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 0de75fd394b9..7e5c2676c489 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -21,13 +21,15 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/bitrev.h> 22#include <linux/bitrev.h>
23#include <linux/console.h> 23#include <linux/console.h>
24
24#include <asm/cpuidle.h> 25#include <asm/cpuidle.h>
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
27#include <asm/suspend.h> 28#include <asm/suspend.h>
28#include <mach/common.h> 29
29#include <mach/sh7372.h> 30#include "common.h"
30#include <mach/pm-rmobile.h> 31#include "pm-rmobile.h"
32#include "sh7372.h"
31 33
32/* DBG */ 34/* DBG */
33#define DBGREG1 IOMEM(0xe6100020) 35#define DBGREG1 IOMEM(0xe6100020)
diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c
index 99086e98fbbc..a7e466817965 100644
--- a/arch/arm/mach-shmobile/pm-sh73a0.c
+++ b/arch/arm/mach-shmobile/pm-sh73a0.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <mach/common.h> 12#include "common.h"
13 13
14#ifdef CONFIG_SUSPEND 14#ifdef CONFIG_SUSPEND
15static int sh73a0_enter_suspend(suspend_state_t suspend_state) 15static int sh73a0_enter_suspend(suspend_state_t suspend_state)
diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/r7s72100.h
index 5f34b20ecd4a..efb723c88dd0 100644
--- a/arch/arm/mach-shmobile/include/mach/r7s72100.h
+++ b/arch/arm/mach-shmobile/r7s72100.h
@@ -3,6 +3,5 @@
3 3
4void r7s72100_add_dt_devices(void); 4void r7s72100_add_dt_devices(void);
5void r7s72100_clock_init(void); 5void r7s72100_clock_init(void);
6void r7s72100_init_early(void);
7 6
8#endif /* __ASM_R7S72100_H__ */ 7#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/r8a73a4.h
index ce8bdd1d8a8a..ce8bdd1d8a8a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a73a4.h
+++ b/arch/arm/mach-shmobile/r8a73a4.h
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
index 5e3c9ec06303..1d1a5fd78b6b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/r8a7740.h
@@ -19,8 +19,6 @@
19#ifndef __ASM_R8A7740_H__ 19#ifndef __ASM_R8A7740_H__
20#define __ASM_R8A7740_H__ 20#define __ASM_R8A7740_H__
21 21
22#include <mach/pm-rmobile.h>
23
24/* 22/*
25 * MD_CKx pin 23 * MD_CKx pin
26 */ 24 */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/r8a7778.h
index f4076a50e970..f4076a50e970 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/r8a7778.h
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
index 88eeceaf1088..5415c719dc19 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/r8a7779.h
@@ -2,8 +2,6 @@
2#define __ASM_R8A7779_H__ 2#define __ASM_R8A7779_H__
3 3
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5#include <linux/pm_domain.h>
6#include <mach/pm-rcar.h>
7 5
8/* HPB-DMA slave IDs */ 6/* HPB-DMA slave IDs */
9enum { 7enum {
@@ -12,17 +10,6 @@ enum {
12 HPBDMA_SLAVE_SDHI0_RX, 10 HPBDMA_SLAVE_SDHI0_RX,
13}; 11};
14 12
15struct r8a7779_pm_domain {
16 struct generic_pm_domain genpd;
17 struct rcar_sysc_ch ch;
18};
19
20static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
21{
22 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
23}
24
25extern void r8a7779_init_delay(void);
26extern void r8a7779_init_irq_extpin(int irlm); 13extern void r8a7779_init_irq_extpin(int irlm);
27extern void r8a7779_init_irq_extpin_dt(int irlm); 14extern void r8a7779_init_irq_extpin_dt(int irlm);
28extern void r8a7779_init_irq_dt(void); 15extern void r8a7779_init_irq_dt(void);
@@ -32,6 +19,7 @@ extern void r8a7779_add_early_devices(void);
32extern void r8a7779_add_standard_devices(void); 19extern void r8a7779_add_standard_devices(void);
33extern void r8a7779_add_standard_devices_dt(void); 20extern void r8a7779_add_standard_devices_dt(void);
34extern void r8a7779_init_late(void); 21extern void r8a7779_init_late(void);
22extern u32 r8a7779_read_mode_pins(void);
35extern void r8a7779_clock_init(void); 23extern void r8a7779_clock_init(void);
36extern void r8a7779_pinmux_init(void); 24extern void r8a7779_pinmux_init(void);
37extern void r8a7779_pm_init(void); 25extern void r8a7779_pm_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/r8a7790.h
index 0b95babe84ba..459827f1369b 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/r8a7790.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_R8A7790_H__ 1#ifndef __ASM_R8A7790_H__
2#define __ASM_R8A7790_H__ 2#define __ASM_R8A7790_H__
3 3
4#include <mach/rcar-gen2.h>
5
6/* DMA slave IDs */ 4/* DMA slave IDs */
7enum { 5enum {
8 RCAR_DMA_SLAVE_INVALID, 6 RCAR_DMA_SLAVE_INVALID,
@@ -33,7 +31,6 @@ void r8a7790_add_dt_devices(void);
33void r8a7790_clock_init(void); 31void r8a7790_clock_init(void);
34void r8a7790_pinmux_init(void); 32void r8a7790_pinmux_init(void);
35void r8a7790_pm_init(void); 33void r8a7790_pm_init(void);
36void r8a7790_init_early(void);
37extern struct smp_operations r8a7790_smp_ops; 34extern struct smp_operations r8a7790_smp_ops;
38 35
39#endif /* __ASM_R8A7790_H__ */ 36#endif /* __ASM_R8A7790_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/r8a7791.h
index 664274cc4b64..86eae7bceb6f 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ b/arch/arm/mach-shmobile/r8a7791.h
@@ -5,6 +5,7 @@ void r8a7791_add_standard_devices(void);
5void r8a7791_add_dt_devices(void); 5void r8a7791_add_dt_devices(void);
6void r8a7791_clock_init(void); 6void r8a7791_clock_init(void);
7void r8a7791_pinmux_init(void); 7void r8a7791_pinmux_init(void);
8void r8a7791_pm_init(void);
8extern struct smp_operations r8a7791_smp_ops; 9extern struct smp_operations r8a7791_smp_ops;
9 10
10#endif /* __ASM_R8A7791_H__ */ 11#endif /* __ASM_R8A7791_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
index 43f606eb2d82..ce53cb5f53a1 100644
--- a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
+++ b/arch/arm/mach-shmobile/rcar-gen2.h
@@ -4,5 +4,6 @@
4void rcar_gen2_timer_init(void); 4void rcar_gen2_timer_init(void);
5#define MD(nr) BIT(nr) 5#define MD(nr) BIT(nr)
6u32 rcar_gen2_read_mode_pins(void); 6u32 rcar_gen2_read_mode_pins(void);
7void rcar_gen2_reserve(void);
7 8
8#endif /* __ASM_RCAR_GEN2_H__ */ 9#endif /* __ASM_RCAR_GEN2_H__ */
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index d953ff6e78a2..b06a9e8f59a5 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -16,14 +16,13 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 18 */
19#include <linux/clk-provider.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/of_platform.h> 21#include <linux/mm.h>
23#include <mach/common.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include "common.h"
27 26
28static struct map_desc emev2_io_desc[] __initdata = { 27static struct map_desc emev2_io_desc[] __initdata = {
29#ifdef CONFIG_SMP 28#ifdef CONFIG_SMP
@@ -42,17 +41,6 @@ static void __init emev2_map_io(void)
42 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc)); 41 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
43} 42}
44 43
45static void __init emev2_init_delay(void)
46{
47 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
48}
49
50static void __init emev2_add_standard_devices_dt(void)
51{
52 of_clk_init(NULL);
53 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
54}
55
56static const char *emev2_boards_compat_dt[] __initconst = { 44static const char *emev2_boards_compat_dt[] __initconst = {
57 "renesas,emev2", 45 "renesas,emev2",
58 NULL, 46 NULL,
@@ -63,8 +51,7 @@ extern struct smp_operations emev2_smp_ops;
63DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)") 51DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
64 .smp = smp_ops(emev2_smp_ops), 52 .smp = smp_ops(emev2_smp_ops),
65 .map_io = emev2_map_io, 53 .map_io = emev2_map_io,
66 .init_early = emev2_init_delay, 54 .init_early = shmobile_init_delay,
67 .init_machine = emev2_add_standard_devices_dt,
68 .init_late = shmobile_init_late, 55 .init_late = shmobile_init_late,
69 .dt_compat = emev2_boards_compat_dt, 56 .dt_compat = emev2_boards_compat_dt,
70MACHINE_END 57MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 412e179429cd..f3b3b14ba972 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -22,18 +22,20 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/sh_timer.h> 24#include <linux/sh_timer.h>
25#include <mach/common.h> 25
26#include <mach/irqs.h>
27#include <mach/r7s72100.h>
28#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
29 27
28#include "common.h"
29#include "irqs.h"
30#include "r7s72100.h"
31
30static struct resource mtu2_resources[] __initdata = { 32static struct resource mtu2_resources[] __initdata = {
31 DEFINE_RES_MEM(0xfcff0000, 0x400), 33 DEFINE_RES_MEM(0xfcff0000, 0x400),
32 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"), 34 DEFINE_RES_IRQ_NAMED(gic_iid(139), "tgi0a"),
33}; 35};
34 36
35#define r7s72100_register_mtu2() \ 37#define r7s72100_register_mtu2() \
36 platform_device_register_resndata(&platform_bus, "sh-mtu2", \ 38 platform_device_register_resndata(NULL, "sh-mtu2", \
37 -1, mtu2_resources, \ 39 -1, mtu2_resources, \
38 ARRAY_SIZE(mtu2_resources), \ 40 ARRAY_SIZE(mtu2_resources), \
39 NULL, 0) 41 NULL, 0)
@@ -43,11 +45,6 @@ void __init r7s72100_add_dt_devices(void)
43 r7s72100_register_mtu2(); 45 r7s72100_register_mtu2();
44} 46}
45 47
46void __init r7s72100_init_early(void)
47{
48 shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
49}
50
51#ifdef CONFIG_USE_OF 48#ifdef CONFIG_USE_OF
52static const char *r7s72100_boards_compat_dt[] __initdata = { 49static const char *r7s72100_boards_compat_dt[] __initdata = {
53 "renesas,r7s72100", 50 "renesas,r7s72100",
@@ -55,7 +52,7 @@ static const char *r7s72100_boards_compat_dt[] __initdata = {
55}; 52};
56 53
57DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)") 54DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
58 .init_early = r7s72100_init_early, 55 .init_early = shmobile_init_delay,
59 .dt_compat = r7s72100_boards_compat_dt, 56 .dt_compat = r7s72100_boards_compat_dt,
60MACHINE_END 57MACHINE_END
61#endif /* CONFIG_USE_OF */ 58#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 9333770cfac2..6683072a9d98 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -24,12 +24,14 @@
24#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
25#include <linux/sh_dma.h> 25#include <linux/sh_dma.h>
26#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
27#include <mach/common.h> 27
28#include <mach/dma-register.h>
29#include <mach/irqs.h>
30#include <mach/r8a73a4.h>
31#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
32 29
30#include "common.h"
31#include "dma-register.h"
32#include "irqs.h"
33#include "r8a73a4.h"
34
33static const struct resource pfc_resources[] = { 35static const struct resource pfc_resources[] = {
34 DEFINE_RES_MEM(0xe6050000, 0x9000), 36 DEFINE_RES_MEM(0xe6050000, 0x9000),
35}; 37};
@@ -68,7 +70,7 @@ R8A73A4_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
68R8A73A4_SCIFB(5, 0xe6cf0000, gic_spi(151)); /* SCIFB3 */ 70R8A73A4_SCIFB(5, 0xe6cf0000, gic_spi(151)); /* SCIFB3 */
69 71
70#define r8a73a4_register_scif(index) \ 72#define r8a73a4_register_scif(index) \
71 platform_device_register_resndata(&platform_bus, "sh-sci", index, \ 73 platform_device_register_resndata(NULL, "sh-sci", index, \
72 scif##index##_resources, \ 74 scif##index##_resources, \
73 ARRAY_SIZE(scif##index##_resources), \ 75 ARRAY_SIZE(scif##index##_resources), \
74 &scif##index##_platform_data, \ 76 &scif##index##_platform_data, \
@@ -149,7 +151,7 @@ static const struct resource irqc1_resources[] = {
149}; 151};
150 152
151#define r8a73a4_register_irqc(idx) \ 153#define r8a73a4_register_irqc(idx) \
152 platform_device_register_resndata(&platform_bus, "renesas_irqc", \ 154 platform_device_register_resndata(NULL, "renesas_irqc", \
153 idx, irqc##idx##_resources, \ 155 idx, irqc##idx##_resources, \
154 ARRAY_SIZE(irqc##idx##_resources), \ 156 ARRAY_SIZE(irqc##idx##_resources), \
155 &irqc##idx##_data, \ 157 &irqc##idx##_data, \
@@ -179,7 +181,7 @@ static struct resource cmt1_resources[] = {
179}; 181};
180 182
181#define r8a7790_register_cmt(idx) \ 183#define r8a7790_register_cmt(idx) \
182 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \ 184 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \
183 idx, cmt##idx##_resources, \ 185 idx, cmt##idx##_resources, \
184 ARRAY_SIZE(cmt##idx##_resources), \ 186 ARRAY_SIZE(cmt##idx##_resources), \
185 &cmt##idx##_platform_data, \ 187 &cmt##idx##_platform_data, \
@@ -187,12 +189,6 @@ static struct resource cmt1_resources[] = {
187 189
188void __init r8a73a4_add_dt_devices(void) 190void __init r8a73a4_add_dt_devices(void)
189{ 191{
190 r8a73a4_register_scif(0);
191 r8a73a4_register_scif(1);
192 r8a73a4_register_scif(2);
193 r8a73a4_register_scif(3);
194 r8a73a4_register_scif(4);
195 r8a73a4_register_scif(5);
196 r8a7790_register_cmt(1); 192 r8a7790_register_cmt(1);
197} 193}
198 194
@@ -280,13 +276,19 @@ static struct resource dma_resources[] = {
280}; 276};
281 277
282#define r8a73a4_register_dmac() \ 278#define r8a73a4_register_dmac() \
283 platform_device_register_resndata(&platform_bus, "sh-dma-engine", 0, \ 279 platform_device_register_resndata(NULL, "sh-dma-engine", 0, \
284 dma_resources, ARRAY_SIZE(dma_resources), \ 280 dma_resources, ARRAY_SIZE(dma_resources), \
285 &dma_pdata, sizeof(dma_pdata)) 281 &dma_pdata, sizeof(dma_pdata))
286 282
287void __init r8a73a4_add_standard_devices(void) 283void __init r8a73a4_add_standard_devices(void)
288{ 284{
289 r8a73a4_add_dt_devices(); 285 r8a73a4_add_dt_devices();
286 r8a73a4_register_scif(0);
287 r8a73a4_register_scif(1);
288 r8a73a4_register_scif(2);
289 r8a73a4_register_scif(3);
290 r8a73a4_register_scif(4);
291 r8a73a4_register_scif(5);
290 r8a73a4_register_irqc(0); 292 r8a73a4_register_irqc(0);
291 r8a73a4_register_irqc(1); 293 r8a73a4_register_irqc(1);
292 r8a73a4_register_thermal(); 294 r8a73a4_register_thermal();
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 35dec233301e..3d5eacaba3e6 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -31,16 +31,18 @@
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/platform_data/sh_ipmmu.h> 33#include <linux/platform_data/sh_ipmmu.h>
34#include <mach/dma-register.h> 34
35#include <mach/r8a7740.h>
36#include <mach/pm-rmobile.h>
37#include <mach/common.h>
38#include <mach/irqs.h>
39#include <asm/mach-types.h> 35#include <asm/mach-types.h>
40#include <asm/mach/map.h> 36#include <asm/mach/map.h>
41#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
42#include <asm/mach/time.h> 38#include <asm/mach/time.h>
43 39
40#include "common.h"
41#include "dma-register.h"
42#include "irqs.h"
43#include "pm-rmobile.h"
44#include "r8a7740.h"
45
44static struct map_desc r8a7740_io_desc[] __initdata = { 46static struct map_desc r8a7740_io_desc[] __initdata = {
45 /* 47 /*
46 * for CPGA/INTC/PFC 48 * for CPGA/INTC/PFC
@@ -310,6 +312,10 @@ static struct platform_device ipmmu_device = {
310}; 312};
311 313
312static struct platform_device *r8a7740_devices_dt[] __initdata = { 314static struct platform_device *r8a7740_devices_dt[] __initdata = {
315 &cmt1_device,
316};
317
318static struct platform_device *r8a7740_early_devices[] __initdata = {
313 &scif0_device, 319 &scif0_device,
314 &scif1_device, 320 &scif1_device,
315 &scif2_device, 321 &scif2_device,
@@ -319,10 +325,6 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
319 &scif6_device, 325 &scif6_device,
320 &scif7_device, 326 &scif7_device,
321 &scif8_device, 327 &scif8_device,
322 &cmt1_device,
323};
324
325static struct platform_device *r8a7740_early_devices[] __initdata = {
326 &irqpin0_device, 328 &irqpin0_device,
327 &irqpin1_device, 329 &irqpin1_device,
328 &irqpin2_device, 330 &irqpin2_device,
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index d311ef903b39..f00a488dcf43 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -37,12 +37,14 @@
37#include <linux/usb/ehci_pdriver.h> 37#include <linux/usb/ehci_pdriver.h>
38#include <linux/usb/ohci_pdriver.h> 38#include <linux/usb/ohci_pdriver.h>
39#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
40#include <mach/irqs.h> 40
41#include <mach/r8a7778.h>
42#include <mach/common.h>
43#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
44#include <asm/hardware/cache-l2x0.h> 42#include <asm/hardware/cache-l2x0.h>
45 43
44#include "common.h"
45#include "irqs.h"
46#include "r8a7778.h"
47
46/* SCIF */ 48/* SCIF */
47#define R8A7778_SCIF(index, baseaddr, irq) \ 49#define R8A7778_SCIF(index, baseaddr, irq) \
48static struct plat_sci_port scif##index##_platform_data = { \ 50static struct plat_sci_port scif##index##_platform_data = { \
@@ -64,7 +66,7 @@ R8A7778_SCIF(4, 0xffe44000, gic_iid(0x6a));
64R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b)); 66R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b));
65 67
66#define r8a7778_register_scif(index) \ 68#define r8a7778_register_scif(index) \
67 platform_device_register_resndata(&platform_bus, "sh-sci", index, \ 69 platform_device_register_resndata(NULL, "sh-sci", index, \
68 scif##index##_resources, \ 70 scif##index##_resources, \
69 ARRAY_SIZE(scif##index##_resources), \ 71 ARRAY_SIZE(scif##index##_resources), \
70 &scif##index##_platform_data, \ 72 &scif##index##_platform_data, \
@@ -84,7 +86,7 @@ static struct resource sh_tmu0_resources[] = {
84 86
85#define r8a7778_register_tmu(idx) \ 87#define r8a7778_register_tmu(idx) \
86 platform_device_register_resndata( \ 88 platform_device_register_resndata( \
87 &platform_bus, "sh-tmu", idx, \ 89 NULL, "sh-tmu", idx, \
88 sh_tmu##idx##_resources, \ 90 sh_tmu##idx##_resources, \
89 ARRAY_SIZE(sh_tmu##idx##_resources), \ 91 ARRAY_SIZE(sh_tmu##idx##_resources), \
90 &sh_tmu##idx##_platform_data, \ 92 &sh_tmu##idx##_platform_data, \
@@ -173,7 +175,6 @@ static struct resource ohci_resources[] __initdata = {
173 175
174#define USB_PLATFORM_INFO(hci) \ 176#define USB_PLATFORM_INFO(hci) \
175static struct platform_device_info hci##_info __initdata = { \ 177static struct platform_device_info hci##_info __initdata = { \
176 .parent = &platform_bus, \
177 .name = #hci "-platform", \ 178 .name = #hci "-platform", \
178 .id = -1, \ 179 .id = -1, \
179 .res = hci##_resources, \ 180 .res = hci##_resources, \
@@ -212,7 +213,7 @@ R8A7778_GPIO(4);
212 213
213#define r8a7778_register_gpio(idx) \ 214#define r8a7778_register_gpio(idx) \
214 platform_device_register_resndata( \ 215 platform_device_register_resndata( \
215 &platform_bus, "gpio_rcar", idx, \ 216 NULL, "gpio_rcar", idx, \
216 r8a7778_gpio##idx##_resources, \ 217 r8a7778_gpio##idx##_resources, \
217 ARRAY_SIZE(r8a7778_gpio##idx##_resources), \ 218 ARRAY_SIZE(r8a7778_gpio##idx##_resources), \
218 &r8a7778_gpio##idx##_platform_data, \ 219 &r8a7778_gpio##idx##_platform_data, \
@@ -292,12 +293,6 @@ void __init r8a7778_add_dt_devices(void)
292 } 293 }
293#endif 294#endif
294 295
295 r8a7778_register_scif(0);
296 r8a7778_register_scif(1);
297 r8a7778_register_scif(2);
298 r8a7778_register_scif(3);
299 r8a7778_register_scif(4);
300 r8a7778_register_scif(5);
301 r8a7778_register_tmu(0); 296 r8a7778_register_tmu(0);
302} 297}
303 298
@@ -496,8 +491,8 @@ static struct resource hpb_dmae_resources[] __initdata = {
496 491
497static void __init r8a7778_register_hpb_dmae(void) 492static void __init r8a7778_register_hpb_dmae(void)
498{ 493{
499 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1, 494 platform_device_register_resndata(NULL, "hpb-dma-engine",
500 hpb_dmae_resources, 495 -1, hpb_dmae_resources,
501 ARRAY_SIZE(hpb_dmae_resources), 496 ARRAY_SIZE(hpb_dmae_resources),
502 &dma_platform_data, 497 &dma_platform_data,
503 sizeof(dma_platform_data)); 498 sizeof(dma_platform_data));
@@ -506,6 +501,12 @@ static void __init r8a7778_register_hpb_dmae(void)
506void __init r8a7778_add_standard_devices(void) 501void __init r8a7778_add_standard_devices(void)
507{ 502{
508 r8a7778_add_dt_devices(); 503 r8a7778_add_dt_devices();
504 r8a7778_register_scif(0);
505 r8a7778_register_scif(1);
506 r8a7778_register_scif(2);
507 r8a7778_register_scif(3);
508 r8a7778_register_scif(4);
509 r8a7778_register_scif(5);
509 r8a7778_register_i2c(0); 510 r8a7778_register_i2c(0);
510 r8a7778_register_i2c(1); 511 r8a7778_register_i2c(1);
511 r8a7778_register_i2c(2); 512 r8a7778_register_i2c(2);
@@ -565,7 +566,7 @@ void __init r8a7778_init_irq_extpin(int irlm)
565 r8a7778_init_irq_extpin_dt(irlm); 566 r8a7778_init_irq_extpin_dt(irlm);
566 if (irlm) 567 if (irlm)
567 platform_device_register_resndata( 568 platform_device_register_resndata(
568 &platform_bus, "renesas_intc_irqpin", -1, 569 NULL, "renesas_intc_irqpin", -1,
569 irqpin_resources, ARRAY_SIZE(irqpin_resources), 570 irqpin_resources, ARRAY_SIZE(irqpin_resources),
570 &irqpin_platform_data, sizeof(irqpin_platform_data)); 571 &irqpin_platform_data, sizeof(irqpin_platform_data));
571} 572}
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index aba4ed652d54..236c1befb9e3 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -40,15 +40,17 @@
40#include <linux/usb/ehci_pdriver.h> 40#include <linux/usb/ehci_pdriver.h>
41#include <linux/usb/ohci_pdriver.h> 41#include <linux/usb/ohci_pdriver.h>
42#include <linux/pm_runtime.h> 42#include <linux/pm_runtime.h>
43#include <mach/irqs.h> 43
44#include <mach/r8a7779.h>
45#include <mach/common.h>
46#include <asm/mach-types.h> 44#include <asm/mach-types.h>
47#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
48#include <asm/mach/time.h> 46#include <asm/mach/time.h>
49#include <asm/mach/map.h> 47#include <asm/mach/map.h>
50#include <asm/hardware/cache-l2x0.h> 48#include <asm/hardware/cache-l2x0.h>
51 49
50#include "common.h"
51#include "irqs.h"
52#include "r8a7779.h"
53
52static struct map_desc r8a7779_io_desc[] __initdata = { 54static struct map_desc r8a7779_io_desc[] __initdata = {
53 /* 2M entity map for 0xf0000000 (MPCORE) */ 55 /* 2M entity map for 0xf0000000 (MPCORE) */
54 { 56 {
@@ -123,7 +125,7 @@ void __init r8a7779_init_irq_extpin(int irlm)
123 r8a7779_init_irq_extpin_dt(irlm); 125 r8a7779_init_irq_extpin_dt(irlm);
124 if (irlm) 126 if (irlm)
125 platform_device_register_resndata( 127 platform_device_register_resndata(
126 &platform_bus, "renesas_intc_irqpin", -1, 128 NULL, "renesas_intc_irqpin", -1,
127 irqpin0_resources, ARRAY_SIZE(irqpin0_resources), 129 irqpin0_resources, ARRAY_SIZE(irqpin0_resources),
128 &irqpin0_platform_data, sizeof(irqpin0_platform_data)); 130 &irqpin0_platform_data, sizeof(irqpin0_platform_data));
129} 131}
@@ -632,24 +634,24 @@ static struct resource hpb_dmae_resources[] __initdata = {
632 634
633static void __init r8a7779_register_hpb_dmae(void) 635static void __init r8a7779_register_hpb_dmae(void)
634{ 636{
635 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1, 637 platform_device_register_resndata(NULL, "hpb-dma-engine",
636 hpb_dmae_resources, 638 -1, hpb_dmae_resources,
637 ARRAY_SIZE(hpb_dmae_resources), 639 ARRAY_SIZE(hpb_dmae_resources),
638 &dma_platform_data, 640 &dma_platform_data,
639 sizeof(dma_platform_data)); 641 sizeof(dma_platform_data));
640} 642}
641 643
642static struct platform_device *r8a7779_devices_dt[] __initdata = { 644static struct platform_device *r8a7779_devices_dt[] __initdata = {
645 &tmu0_device,
646};
647
648static struct platform_device *r8a7779_standard_devices[] __initdata = {
643 &scif0_device, 649 &scif0_device,
644 &scif1_device, 650 &scif1_device,
645 &scif2_device, 651 &scif2_device,
646 &scif3_device, 652 &scif3_device,
647 &scif4_device, 653 &scif4_device,
648 &scif5_device, 654 &scif5_device,
649 &tmu0_device,
650};
651
652static struct platform_device *r8a7779_standard_devices[] __initdata = {
653 &i2c0_device, 655 &i2c0_device,
654 &i2c1_device, 656 &i2c1_device,
655 &i2c2_device, 657 &i2c2_device,
@@ -674,16 +676,6 @@ void __init r8a7779_add_standard_devices(void)
674 r8a7779_register_hpb_dmae(); 676 r8a7779_register_hpb_dmae();
675} 677}
676 678
677/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
678void __init __weak r8a7779_register_twd(void) { }
679
680void __init r8a7779_earlytimer_init(void)
681{
682 r8a7779_clock_init();
683 r8a7779_register_twd();
684 shmobile_earlytimer_init();
685}
686
687void __init r8a7779_add_early_devices(void) 679void __init r8a7779_add_early_devices(void)
688{ 680{
689 early_platform_add_devices(r8a7779_devices_dt, 681 early_platform_add_devices(r8a7779_devices_dt,
@@ -747,19 +739,28 @@ void __init r8a7779_init_irq_dt(void)
747 __raw_writel(0x003fee3f, INT2SMSKCR4); 739 __raw_writel(0x003fee3f, INT2SMSKCR4);
748} 740}
749 741
750void __init r8a7779_init_delay(void) 742void __init r8a7779_add_standard_devices_dt(void)
751{ 743{
752 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */ 744 platform_add_devices(r8a7779_devices_dt,
745 ARRAY_SIZE(r8a7779_devices_dt));
753} 746}
754 747
755void __init r8a7779_add_standard_devices_dt(void) 748#define MODEMR 0xffcc0020
749
750u32 __init r8a7779_read_mode_pins(void)
756{ 751{
757 /* clocks are setup late during boot in the case of DT */ 752 static u32 mode;
758 r8a7779_clock_init(); 753 static bool mode_valid;
754
755 if (!mode_valid) {
756 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
757 BUG_ON(!modemr);
758 mode = ioread32(modemr);
759 iounmap(modemr);
760 mode_valid = true;
761 }
759 762
760 platform_add_devices(r8a7779_devices_dt, 763 return mode;
761 ARRAY_SIZE(r8a7779_devices_dt));
762 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
763} 764}
764 765
765static const char *r8a7779_compat_dt[] __initdata = { 766static const char *r8a7779_compat_dt[] __initdata = {
@@ -769,7 +770,7 @@ static const char *r8a7779_compat_dt[] __initdata = {
769 770
770DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") 771DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
771 .map_io = r8a7779_map_io, 772 .map_io = r8a7779_map_io,
772 .init_early = r8a7779_init_delay, 773 .init_early = shmobile_init_delay,
773 .nr_irqs = NR_IRQS_LEGACY, 774 .nr_irqs = NR_IRQS_LEGACY,
774 .init_irq = r8a7779_init_irq_dt, 775 .init_irq = r8a7779_init_irq_dt,
775 .init_machine = r8a7779_add_standard_devices_dt, 776 .init_machine = r8a7779_add_standard_devices_dt,
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 6bd08b127fa4..0c12b01bb9e3 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -26,12 +26,15 @@
26#include <linux/serial_sci.h> 26#include <linux/serial_sci.h>
27#include <linux/sh_dma.h> 27#include <linux/sh_dma.h>
28#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
29#include <mach/common.h> 29
30#include <mach/dma-register.h>
31#include <mach/irqs.h>
32#include <mach/r8a7790.h>
33#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
34 31
32#include "common.h"
33#include "dma-register.h"
34#include "irqs.h"
35#include "r8a7790.h"
36#include "rcar-gen2.h"
37
35/* Audio-DMAC */ 38/* Audio-DMAC */
36#define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \ 39#define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \
37{ \ 40{ \
@@ -113,7 +116,7 @@ static struct resource r8a7790_audio_dmac_resources[] = {
113 116
114#define r8a7790_register_audio_dmac(id) \ 117#define r8a7790_register_audio_dmac(id) \
115 platform_device_register_resndata( \ 118 platform_device_register_resndata( \
116 &platform_bus, "sh-dma-engine", id, \ 119 NULL, "sh-dma-engine", id, \
117 &r8a7790_audio_dmac_resources[id * 3], 3, \ 120 &r8a7790_audio_dmac_resources[id * 3], 3, \
118 &r8a7790_audio_dmac_platform_data, \ 121 &r8a7790_audio_dmac_platform_data, \
119 sizeof(r8a7790_audio_dmac_platform_data)) 122 sizeof(r8a7790_audio_dmac_platform_data))
@@ -149,7 +152,7 @@ R8A7790_GPIO(4);
149R8A7790_GPIO(5); 152R8A7790_GPIO(5);
150 153
151#define r8a7790_register_gpio(idx) \ 154#define r8a7790_register_gpio(idx) \
152 platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \ 155 platform_device_register_resndata(NULL, "gpio_rcar", idx, \
153 r8a7790_gpio##idx##_resources, \ 156 r8a7790_gpio##idx##_resources, \
154 ARRAY_SIZE(r8a7790_gpio##idx##_resources), \ 157 ARRAY_SIZE(r8a7790_gpio##idx##_resources), \
155 &r8a7790_gpio##idx##_platform_data, \ 158 &r8a7790_gpio##idx##_platform_data, \
@@ -227,7 +230,7 @@ R8A7790_HSCIF(8, 0xe62c0000, gic_spi(154)); /* HSCIF0 */
227R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */ 230R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */
228 231
229#define r8a7790_register_scif(index) \ 232#define r8a7790_register_scif(index) \
230 platform_device_register_resndata(&platform_bus, "sh-sci", index, \ 233 platform_device_register_resndata(NULL, "sh-sci", index, \
231 scif##index##_resources, \ 234 scif##index##_resources, \
232 ARRAY_SIZE(scif##index##_resources), \ 235 ARRAY_SIZE(scif##index##_resources), \
233 &scif##index##_platform_data, \ 236 &scif##index##_platform_data, \
@@ -246,7 +249,7 @@ static const struct resource irqc0_resources[] __initconst = {
246}; 249};
247 250
248#define r8a7790_register_irqc(idx) \ 251#define r8a7790_register_irqc(idx) \
249 platform_device_register_resndata(&platform_bus, "renesas_irqc", \ 252 platform_device_register_resndata(NULL, "renesas_irqc", \
250 idx, irqc##idx##_resources, \ 253 idx, irqc##idx##_resources, \
251 ARRAY_SIZE(irqc##idx##_resources), \ 254 ARRAY_SIZE(irqc##idx##_resources), \
252 &irqc##idx##_data, \ 255 &irqc##idx##_data, \
@@ -273,7 +276,7 @@ static struct resource cmt0_resources[] = {
273}; 276};
274 277
275#define r8a7790_register_cmt(idx) \ 278#define r8a7790_register_cmt(idx) \
276 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \ 279 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \
277 idx, cmt##idx##_resources, \ 280 idx, cmt##idx##_resources, \
278 ARRAY_SIZE(cmt##idx##_resources), \ 281 ARRAY_SIZE(cmt##idx##_resources), \
279 &cmt##idx##_platform_data, \ 282 &cmt##idx##_platform_data, \
@@ -307,13 +310,6 @@ void __init r8a7790_add_standard_devices(void)
307 r8a7790_register_audio_dmac(1); 310 r8a7790_register_audio_dmac(1);
308} 311}
309 312
310void __init r8a7790_init_early(void)
311{
312#ifndef CONFIG_ARM_ARCH_TIMER
313 shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
314#endif
315}
316
317#ifdef CONFIG_USE_OF 313#ifdef CONFIG_USE_OF
318 314
319static const char * const r8a7790_boards_compat_dt[] __initconst = { 315static const char * const r8a7790_boards_compat_dt[] __initconst = {
@@ -323,8 +319,10 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
323 319
324DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 320DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
325 .smp = smp_ops(r8a7790_smp_ops), 321 .smp = smp_ops(r8a7790_smp_ops),
326 .init_early = r8a7790_init_early, 322 .init_early = shmobile_init_delay,
327 .init_time = rcar_gen2_timer_init, 323 .init_time = rcar_gen2_timer_init,
324 .init_late = shmobile_init_late,
325 .reserve = rcar_gen2_reserve,
328 .dt_compat = r8a7790_boards_compat_dt, 326 .dt_compat = r8a7790_boards_compat_dt,
329MACHINE_END 327MACHINE_END
330#endif /* CONFIG_USE_OF */ 328#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index 04a96ddb3224..d47d8b16a43f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -26,12 +26,14 @@
26#include <linux/platform_data/irq-renesas-irqc.h> 26#include <linux/platform_data/irq-renesas-irqc.h>
27#include <linux/serial_sci.h> 27#include <linux/serial_sci.h>
28#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
29#include <mach/common.h> 29
30#include <mach/irqs.h>
31#include <mach/r8a7791.h>
32#include <mach/rcar-gen2.h>
33#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
34 31
32#include "common.h"
33#include "irqs.h"
34#include "r8a7791.h"
35#include "rcar-gen2.h"
36
35static const struct resource pfc_resources[] __initconst = { 37static const struct resource pfc_resources[] __initconst = {
36 DEFINE_RES_MEM(0xe6060000, 0x250), 38 DEFINE_RES_MEM(0xe6060000, 0x250),
37}; 39};
@@ -65,7 +67,7 @@ R8A7791_GPIO(6, 0xe6055400, 32);
65R8A7791_GPIO(7, 0xe6055800, 26); 67R8A7791_GPIO(7, 0xe6055800, 26);
66 68
67#define r8a7791_register_gpio(idx) \ 69#define r8a7791_register_gpio(idx) \
68 platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \ 70 platform_device_register_resndata(NULL, "gpio_rcar", idx, \
69 r8a7791_gpio##idx##_resources, \ 71 r8a7791_gpio##idx##_resources, \
70 ARRAY_SIZE(r8a7791_gpio##idx##_resources), \ 72 ARRAY_SIZE(r8a7791_gpio##idx##_resources), \
71 &r8a7791_gpio##idx##_platform_data, \ 73 &r8a7791_gpio##idx##_platform_data, \
@@ -122,7 +124,7 @@ R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
122R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */ 124R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
123 125
124#define r8a7791_register_scif(index) \ 126#define r8a7791_register_scif(index) \
125 platform_device_register_resndata(&platform_bus, "sh-sci", index, \ 127 platform_device_register_resndata(NULL, "sh-sci", index, \
126 scif##index##_resources, \ 128 scif##index##_resources, \
127 ARRAY_SIZE(scif##index##_resources), \ 129 ARRAY_SIZE(scif##index##_resources), \
128 &scif##index##_platform_data, \ 130 &scif##index##_platform_data, \
@@ -138,7 +140,7 @@ static struct resource cmt0_resources[] = {
138}; 140};
139 141
140#define r8a7791_register_cmt(idx) \ 142#define r8a7791_register_cmt(idx) \
141 platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \ 143 platform_device_register_resndata(NULL, "sh-cmt-48-gen2", \
142 idx, cmt##idx##_resources, \ 144 idx, cmt##idx##_resources, \
143 ARRAY_SIZE(cmt##idx##_resources), \ 145 ARRAY_SIZE(cmt##idx##_resources), \
144 &cmt##idx##_platform_data, \ 146 &cmt##idx##_platform_data, \
@@ -163,7 +165,7 @@ static struct resource irqc0_resources[] = {
163}; 165};
164 166
165#define r8a7791_register_irqc(idx) \ 167#define r8a7791_register_irqc(idx) \
166 platform_device_register_resndata(&platform_bus, "renesas_irqc", \ 168 platform_device_register_resndata(NULL, "renesas_irqc", \
167 idx, irqc##idx##_resources, \ 169 idx, irqc##idx##_resources, \
168 ARRAY_SIZE(irqc##idx##_resources), \ 170 ARRAY_SIZE(irqc##idx##_resources), \
169 &irqc##idx##_data, \ 171 &irqc##idx##_data, \
@@ -217,6 +219,8 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
217 .smp = smp_ops(r8a7791_smp_ops), 219 .smp = smp_ops(r8a7791_smp_ops),
218 .init_early = shmobile_init_delay, 220 .init_early = shmobile_init_delay,
219 .init_time = rcar_gen2_timer_init, 221 .init_time = rcar_gen2_timer_init,
222 .init_late = shmobile_init_late,
223 .reserve = rcar_gen2_reserve,
220 .dt_compat = r8a7791_boards_compat_dt, 224 .dt_compat = r8a7791_boards_compat_dt,
221MACHINE_END 225MACHINE_END
222#endif /* CONFIG_USE_OF */ 226#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 542c5a47173f..42d5b4308923 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -20,11 +20,14 @@
20 20
21#include <linux/clk/shmobile.h> 21#include <linux/clk/shmobile.h>
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/device.h>
24#include <linux/dma-contiguous.h>
23#include <linux/io.h> 25#include <linux/io.h>
24#include <linux/kernel.h> 26#include <linux/kernel.h>
25#include <mach/common.h> 27#include <linux/of_fdt.h>
26#include <mach/rcar-gen2.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include "common.h"
30#include "rcar-gen2.h"
28 31
29#define MODEMR 0xe6160060 32#define MODEMR 0xe6160060
30 33
@@ -110,3 +113,72 @@ void __init rcar_gen2_timer_init(void)
110#endif 113#endif
111 clocksource_of_init(); 114 clocksource_of_init();
112} 115}
116
117struct memory_reserve_config {
118 u64 reserved;
119 u64 base, size;
120};
121
122static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
123 int depth, void *data)
124{
125 const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
126 const __be32 *reg, *endp;
127 int l;
128 struct memory_reserve_config *mrc = data;
129 u64 lpae_start = 1ULL << 32;
130
131 /* We are scanning "memory" nodes only */
132 if (type == NULL || strcmp(type, "memory"))
133 return 0;
134
135 reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
136 if (reg == NULL)
137 reg = of_get_flat_dt_prop(node, "reg", &l);
138 if (reg == NULL)
139 return 0;
140
141 endp = reg + (l / sizeof(__be32));
142 while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
143 u64 base, size;
144
145 base = dt_mem_next_cell(dt_root_addr_cells, &reg);
146 size = dt_mem_next_cell(dt_root_size_cells, &reg);
147
148 if (base >= lpae_start)
149 continue;
150
151 if ((base + size) >= lpae_start)
152 size = lpae_start - base;
153
154 if (size < mrc->reserved)
155 continue;
156
157 if (base < mrc->base)
158 continue;
159
160 /* keep the area at top near the 32-bit legacy limit */
161 mrc->base = base + size - mrc->reserved;
162 mrc->size = mrc->reserved;
163 }
164
165 return 0;
166}
167
168struct cma *rcar_gen2_dma_contiguous;
169
170void __init rcar_gen2_reserve(void)
171{
172 struct memory_reserve_config mrc;
173
174 /* reserve 256 MiB at the top of the physical legacy 32-bit space */
175 memset(&mrc, 0, sizeof(mrc));
176 mrc.reserved = SZ_256M;
177
178 of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
179#ifdef CONFIG_DMA_CMA
180 if (mrc.size)
181 dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
182 &rcar_gen2_dma_contiguous, true);
183#endif
184}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2a8b9f2a2f54..9cdfcdfd38fc 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -29,20 +29,22 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
34#include <linux/pm_domain.h> 33#include <linux/pm_domain.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
36#include <linux/platform_data/sh_ipmmu.h> 35#include <linux/platform_data/sh_ipmmu.h>
37#include <mach/dma-register.h> 36
38#include <mach/irqs.h>
39#include <mach/sh7372.h>
40#include <mach/common.h>
41#include <asm/mach/map.h> 37#include <asm/mach/map.h>
42#include <asm/mach-types.h> 38#include <asm/mach-types.h>
43#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
44#include <asm/mach/time.h> 40#include <asm/mach/time.h>
45 41
42#include "common.h"
43#include "dma-register.h"
44#include "irqs.h"
45#include "pm-rmobile.h"
46#include "sh7372.h"
47
46static struct map_desc sh7372_io_desc[] __initdata = { 48static struct map_desc sh7372_io_desc[] __initdata = {
47 /* create a 1:1 entity map for 0xe6xxxxxx 49 /* create a 1:1 entity map for 0xe6xxxxxx
48 * used by CPGA, INTC and PFC. 50 * used by CPGA, INTC and PFC.
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index ad00724a2269..2c802ae9b241 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -29,19 +29,20 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/sh_dma.h> 31#include <linux/sh_dma.h>
32#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
34#include <linux/platform_data/sh_ipmmu.h> 33#include <linux/platform_data/sh_ipmmu.h>
35#include <linux/platform_data/irq-renesas-intc-irqpin.h> 34#include <linux/platform_data/irq-renesas-intc-irqpin.h>
36#include <mach/dma-register.h> 35
37#include <mach/irqs.h>
38#include <mach/sh73a0.h>
39#include <mach/common.h>
40#include <asm/mach-types.h> 36#include <asm/mach-types.h>
41#include <asm/mach/map.h> 37#include <asm/mach/map.h>
42#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
43#include <asm/mach/time.h> 39#include <asm/mach/time.h>
44 40
41#include "common.h"
42#include "dma-register.h"
43#include "irqs.h"
44#include "sh73a0.h"
45
45static struct map_desc sh73a0_io_desc[] __initdata = { 46static struct map_desc sh73a0_io_desc[] __initdata = {
46 /* create a 1:1 entity map for 0xe6xxxxxx 47 /* create a 1:1 entity map for 0xe6xxxxxx
47 * used by CPGA, INTC and PFC. 48 * used by CPGA, INTC and PFC.
@@ -696,6 +697,10 @@ static struct platform_device irqpin3_device = {
696}; 697};
697 698
698static struct platform_device *sh73a0_devices_dt[] __initdata = { 699static struct platform_device *sh73a0_devices_dt[] __initdata = {
700 &cmt1_device,
701};
702
703static struct platform_device *sh73a0_early_devices[] __initdata = {
699 &scif0_device, 704 &scif0_device,
700 &scif1_device, 705 &scif1_device,
701 &scif2_device, 706 &scif2_device,
@@ -705,10 +710,6 @@ static struct platform_device *sh73a0_devices_dt[] __initdata = {
705 &scif6_device, 710 &scif6_device,
706 &scif7_device, 711 &scif7_device,
707 &scif8_device, 712 &scif8_device,
708 &cmt1_device,
709};
710
711static struct platform_device *sh73a0_early_devices[] __initdata = {
712 &tmu0_device, 713 &tmu0_device,
713 &ipmmu_device, 714 &ipmmu_device,
714}; 715};
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/sh7372.h
index 854a9f0ca040..4ad960d5075b 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/sh7372.h
@@ -11,10 +11,6 @@
11#ifndef __ASM_SH7372_H__ 11#ifndef __ASM_SH7372_H__
12#define __ASM_SH7372_H__ 12#define __ASM_SH7372_H__
13 13
14#include <linux/sh_clk.h>
15#include <linux/pm_domain.h>
16#include <mach/pm-rmobile.h>
17
18/* DMA slave IDs */ 14/* DMA slave IDs */
19enum { 15enum {
20 SHDMA_SLAVE_INVALID, 16 SHDMA_SLAVE_INVALID,
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
index 359b582dc270..359b582dc270 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/sh73a0.h
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 2dfd748da7f3..6ff1df1df9a7 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -23,9 +23,9 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <mach/common.h>
27#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
28#include <asm/smp_scu.h> 27#include <asm/smp_scu.h>
28#include "common.h"
29 29
30#define EMEV2_SCU_BASE 0x1e000000 30#define EMEV2_SCU_BASE 0x1e000000
31#define EMEV2_SMU_BASE 0xe0110000 31#define EMEV2_SMU_BASE 0xe0110000
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index e7a3201473d0..3100e355c3fd 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -23,14 +23,16 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <mach/common.h> 26
27#include <mach/pm-rcar.h>
28#include <mach/r8a7779.h>
29#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
30#include <asm/smp_plat.h> 28#include <asm/smp_plat.h>
31#include <asm/smp_scu.h> 29#include <asm/smp_scu.h>
32#include <asm/smp_twd.h> 30#include <asm/smp_twd.h>
33 31
32#include "common.h"
33#include "pm-rcar.h"
34#include "r8a7779.h"
35
34#define AVECR IOMEM(0xfe700040) 36#define AVECR IOMEM(0xfe700040)
35#define R8A7779_SCU_BASE 0xf0000000 37#define R8A7779_SCU_BASE 0xf0000000
36 38
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
index 591052799e8f..2311694636e1 100644
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -17,17 +17,12 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20
20#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
21#include <mach/common.h>
22#include <mach/pm-rcar.h>
23#include <mach/r8a7790.h>
24 22
25#define RST 0xe6160000 23#include "common.h"
26#define CA15BAR 0x0020 24#include "pm-rcar.h"
27#define CA7BAR 0x0030 25#include "r8a7790.h"
28#define CA15RESCNT 0x0040
29#define CA7RESCNT 0x0044
30#define MERAM 0xe8080000
31 26
32static struct rcar_sysc_ch r8a7790_ca15_scu = { 27static struct rcar_sysc_ch r8a7790_ca15_scu = {
33 .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ 28 .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
@@ -41,32 +36,9 @@ static struct rcar_sysc_ch r8a7790_ca7_scu = {
41 36
42static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) 37static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
43{ 38{
44 void __iomem *p;
45 u32 bar;
46
47 /* let APMU code install data related to shmobile_boot_vector */ 39 /* let APMU code install data related to shmobile_boot_vector */
48 shmobile_smp_apmu_prepare_cpus(max_cpus); 40 shmobile_smp_apmu_prepare_cpus(max_cpus);
49 41
50 /* MERAM for jump stub, because BAR requires 256KB aligned address */
51 p = ioremap_nocache(MERAM, shmobile_boot_size);
52 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
53 iounmap(p);
54
55 /* setup reset vectors */
56 p = ioremap_nocache(RST, 0x63);
57 bar = (MERAM >> 8) & 0xfffffc00;
58 writel_relaxed(bar, p + CA15BAR);
59 writel_relaxed(bar, p + CA7BAR);
60 writel_relaxed(bar | 0x10, p + CA15BAR);
61 writel_relaxed(bar | 0x10, p + CA7BAR);
62
63 /* enable clocks to all CPUs */
64 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
65 p + CA15RESCNT);
66 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
67 p + CA7RESCNT);
68 iounmap(p);
69
70 /* turn on power to SCU */ 42 /* turn on power to SCU */
71 r8a7790_pm_init(); 43 r8a7790_pm_init();
72 rcar_sysc_power_up(&r8a7790_ca15_scu); 44 rcar_sysc_power_up(&r8a7790_ca15_scu);
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
index ec979529f30f..f743386166fb 100644
--- a/arch/arm/mach-shmobile/smp-r8a7791.c
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -17,39 +17,19 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20
20#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
21#include <mach/common.h>
22#include <mach/r8a7791.h>
23#include <mach/rcar-gen2.h>
24 22
25#define RST 0xe6160000 23#include "common.h"
26#define CA15BAR 0x0020 24#include "r8a7791.h"
27#define CA15RESCNT 0x0040 25#include "rcar-gen2.h"
28#define RAM 0xe6300000
29 26
30static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) 27static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
31{ 28{
32 void __iomem *p;
33 u32 bar;
34
35 /* let APMU code install data related to shmobile_boot_vector */ 29 /* let APMU code install data related to shmobile_boot_vector */
36 shmobile_smp_apmu_prepare_cpus(max_cpus); 30 shmobile_smp_apmu_prepare_cpus(max_cpus);
37 31
38 /* RAM for jump stub, because BAR requires 256KB aligned address */ 32 r8a7791_pm_init();
39 p = ioremap_nocache(RAM, shmobile_boot_size);
40 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
41 iounmap(p);
42
43 /* setup reset vectors */
44 p = ioremap_nocache(RST, 0x63);
45 bar = (RAM >> 8) & 0xfffffc00;
46 writel_relaxed(bar, p + CA15BAR);
47 writel_relaxed(bar | 0x10, p + CA15BAR);
48
49 /* enable clocks to all CPUs */
50 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
51 p + CA15RESCNT);
52 iounmap(p);
53} 33}
54 34
55static int r8a7791_smp_boot_secondary(unsigned int cpu, 35static int r8a7791_smp_boot_secondary(unsigned int cpu,
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 13ba36a6831f..22d8f87b23e9 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -22,11 +22,13 @@
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <mach/common.h> 25
26#include <mach/sh73a0.h>
27#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
28#include <asm/smp_twd.h> 27#include <asm/smp_twd.h>
29 28
29#include "common.h"
30#include "sh73a0.h"
31
30#define WUPCR IOMEM(0xe6151010) 32#define WUPCR IOMEM(0xe6151010)
31#define SRESCR IOMEM(0xe6151018) 33#define SRESCR IOMEM(0xe6151018)
32#define PSTR IOMEM(0xe6151040) 34#define PSTR IOMEM(0xe6151040)
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 68bc0b82226d..942efdc82a62 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -59,29 +59,37 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
59 59
60void __init shmobile_init_delay(void) 60void __init shmobile_init_delay(void)
61{ 61{
62 struct device_node *np, *parent; 62 struct device_node *np, *cpus;
63 u32 max_freq, freq; 63 bool is_a8_a9 = false;
64 64 bool is_a15 = false;
65 max_freq = 0; 65 u32 max_freq = 0;
66 66
67 parent = of_find_node_by_path("/cpus"); 67 cpus = of_find_node_by_path("/cpus");
68 if (parent) { 68 if (!cpus)
69 for_each_child_of_node(parent, np) { 69 return;
70 if (!of_property_read_u32(np, "clock-frequency", &freq)) 70
71 max_freq = max(max_freq, freq); 71 for_each_child_of_node(cpus, np) {
72 } 72 u32 freq;
73 of_node_put(parent); 73
74 } 74 if (!of_property_read_u32(np, "clock-frequency", &freq))
75 max_freq = max(max_freq, freq);
75 76
76 if (max_freq) { 77 if (of_device_is_compatible(np, "arm,cortex-a8") ||
77 if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) 78 of_device_is_compatible(np, "arm,cortex-a9"))
78 shmobile_setup_delay_hz(max_freq, 1, 3); 79 is_a8_a9 = true;
79 else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) 80 else if (of_device_is_compatible(np, "arm,cortex-a15"))
80 shmobile_setup_delay_hz(max_freq, 1, 3); 81 is_a15 = true;
81 else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
82 if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
83 shmobile_setup_delay_hz(max_freq, 2, 4);
84 } 82 }
83
84 of_node_put(cpus);
85
86 if (!max_freq)
87 return;
88
89 if (is_a8_a9)
90 shmobile_setup_delay_hz(max_freq, 1, 3);
91 else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
92 shmobile_setup_delay_hz(max_freq, 2, 4);
85} 93}
86 94
87static void __init shmobile_late_time_init(void) 95static void __init shmobile_late_time_init(void)
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index 90df2022276a..6fd4dc88160b 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -19,6 +19,8 @@ config ARCH_SPEAR13XX
19 select HAVE_ARM_SCU if SMP 19 select HAVE_ARM_SCU if SMP
20 select HAVE_ARM_TWD if SMP 20 select HAVE_ARM_TWD if SMP
21 select PINCTRL 21 select PINCTRL
22 select MFD_SYSCON
23 select MIGHT_HAVE_PCI
22 help 24 help
23 Supports for ARM's SPEAR13XX family 25 Supports for ARM's SPEAR13XX family
24 26
@@ -27,12 +29,14 @@ if ARCH_SPEAR13XX
27config MACH_SPEAR1310 29config MACH_SPEAR1310
28 bool "SPEAr1310 Machine support with Device Tree" 30 bool "SPEAr1310 Machine support with Device Tree"
29 select PINCTRL_SPEAR1310 31 select PINCTRL_SPEAR1310
32 select PHY_ST_SPEAR1310_MIPHY
30 help 33 help
31 Supports ST SPEAr1310 machine configured via the device-tree 34 Supports ST SPEAr1310 machine configured via the device-tree
32 35
33config MACH_SPEAR1340 36config MACH_SPEAR1340
34 bool "SPEAr1340 Machine support with Device Tree" 37 bool "SPEAr1340 Machine support with Device Tree"
35 select PINCTRL_SPEAR1340 38 select PINCTRL_SPEAR1340
39 select PHY_ST_SPEAR1340_MIPHY
36 help 40 help
37 Supports ST SPEAr1340 machine configured via the device-tree 41 Supports ST SPEAr1340 machine configured via the device-tree
38 42
diff --git a/arch/arm/mach-spear/include/mach/spear.h b/arch/arm/mach-spear/include/mach/spear.h
index 5cdc53d9b653..f2d6a0176575 100644
--- a/arch/arm/mach-spear/include/mach/spear.h
+++ b/arch/arm/mach-spear/include/mach/spear.h
@@ -52,10 +52,10 @@
52#ifdef CONFIG_ARCH_SPEAR13XX 52#ifdef CONFIG_ARCH_SPEAR13XX
53 53
54#define PERIP_GRP2_BASE UL(0xB3000000) 54#define PERIP_GRP2_BASE UL(0xB3000000)
55#define VA_PERIP_GRP2_BASE IOMEM(0xFE000000) 55#define VA_PERIP_GRP2_BASE IOMEM(0xF9000000)
56#define MCIF_SDHCI_BASE UL(0xB3000000) 56#define MCIF_SDHCI_BASE UL(0xB3000000)
57#define SYSRAM0_BASE UL(0xB3800000) 57#define SYSRAM0_BASE UL(0xB3800000)
58#define VA_SYSRAM0_BASE IOMEM(0xFE800000) 58#define VA_SYSRAM0_BASE IOMEM(0xF9800000)
59#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600) 59#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600)
60 60
61#define PERIP_GRP1_BASE UL(0xE0000000) 61#define PERIP_GRP1_BASE UL(0xE0000000)
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 824b12a56a42..d9ce4d8000f0 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -42,7 +42,7 @@ static const char * const spear1310_dt_board_compat[] = {
42 * PHYSICAL VIRTUAL 42 * PHYSICAL VIRTUAL
43 * 0xD8000000 0xFA000000 43 * 0xD8000000 0xFA000000
44 */ 44 */
45struct map_desc spear1310_io_desc[] __initdata = { 45static struct map_desc spear1310_io_desc[] __initdata = {
46 { 46 {
47 .virtual = VA_SPEAR1310_RAS_GRP1_BASE, 47 .virtual = VA_SPEAR1310_RAS_GRP1_BASE,
48 .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE), 48 .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE),
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 7b6bff7154e1..3f3c0f124bd3 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -13,136 +13,13 @@
13 13
14#define pr_fmt(fmt) "SPEAr1340: " fmt 14#define pr_fmt(fmt) "SPEAr1340: " fmt
15 15
16#include <linux/ahci_platform.h>
17#include <linux/amba/serial.h>
18#include <linux/delay.h>
19#include <linux/of_platform.h> 16#include <linux/of_platform.h>
20#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
21#include "generic.h" 18#include "generic.h"
22#include <mach/spear.h>
23
24/* FIXME: Move SATA PHY code into a standalone driver */
25
26/* Base addresses */
27#define SPEAR1340_SATA_BASE UL(0xB1000000)
28
29/* Power Management Registers */
30#define SPEAR1340_PCM_CFG (VA_MISC_BASE + 0x100)
31#define SPEAR1340_PCM_WKUP_CFG (VA_MISC_BASE + 0x104)
32#define SPEAR1340_SWITCH_CTR (VA_MISC_BASE + 0x108)
33
34#define SPEAR1340_PERIP1_SW_RST (VA_MISC_BASE + 0x318)
35#define SPEAR1340_PERIP2_SW_RST (VA_MISC_BASE + 0x31C)
36#define SPEAR1340_PERIP3_SW_RST (VA_MISC_BASE + 0x320)
37
38/* PCIE - SATA configuration registers */
39#define SPEAR1340_PCIE_SATA_CFG (VA_MISC_BASE + 0x424)
40 /* PCIE CFG MASks */
41 #define SPEAR1340_PCIE_CFG_DEVICE_PRESENT (1 << 11)
42 #define SPEAR1340_PCIE_CFG_POWERUP_RESET (1 << 10)
43 #define SPEAR1340_PCIE_CFG_CORE_CLK_EN (1 << 9)
44 #define SPEAR1340_PCIE_CFG_AUX_CLK_EN (1 << 8)
45 #define SPEAR1340_SATA_CFG_TX_CLK_EN (1 << 4)
46 #define SPEAR1340_SATA_CFG_RX_CLK_EN (1 << 3)
47 #define SPEAR1340_SATA_CFG_POWERUP_RESET (1 << 2)
48 #define SPEAR1340_SATA_CFG_PM_CLK_EN (1 << 1)
49 #define SPEAR1340_PCIE_SATA_SEL_PCIE (0)
50 #define SPEAR1340_PCIE_SATA_SEL_SATA (1)
51 #define SPEAR1340_SATA_PCIE_CFG_MASK 0xF1F
52 #define SPEAR1340_PCIE_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_PCIE | \
53 SPEAR1340_PCIE_CFG_AUX_CLK_EN | \
54 SPEAR1340_PCIE_CFG_CORE_CLK_EN | \
55 SPEAR1340_PCIE_CFG_POWERUP_RESET | \
56 SPEAR1340_PCIE_CFG_DEVICE_PRESENT)
57 #define SPEAR1340_SATA_CFG_VAL (SPEAR1340_PCIE_SATA_SEL_SATA | \
58 SPEAR1340_SATA_CFG_PM_CLK_EN | \
59 SPEAR1340_SATA_CFG_POWERUP_RESET | \
60 SPEAR1340_SATA_CFG_RX_CLK_EN | \
61 SPEAR1340_SATA_CFG_TX_CLK_EN)
62
63#define SPEAR1340_PCIE_MIPHY_CFG (VA_MISC_BASE + 0x428)
64 #define SPEAR1340_MIPHY_OSC_BYPASS_EXT (1 << 31)
65 #define SPEAR1340_MIPHY_CLK_REF_DIV2 (1 << 27)
66 #define SPEAR1340_MIPHY_CLK_REF_DIV4 (2 << 27)
67 #define SPEAR1340_MIPHY_CLK_REF_DIV8 (3 << 27)
68 #define SPEAR1340_MIPHY_PLL_RATIO_TOP(x) (x << 0)
69 #define SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA \
70 (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \
71 SPEAR1340_MIPHY_CLK_REF_DIV2 | \
72 SPEAR1340_MIPHY_PLL_RATIO_TOP(60))
73 #define SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK \
74 (SPEAR1340_MIPHY_PLL_RATIO_TOP(120))
75 #define SPEAR1340_PCIE_SATA_MIPHY_CFG_PCIE \
76 (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \
77 SPEAR1340_MIPHY_PLL_RATIO_TOP(25))
78
79/* SATA device registration */
80static int sata_miphy_init(struct device *dev, void __iomem *addr)
81{
82 writel(SPEAR1340_SATA_CFG_VAL, SPEAR1340_PCIE_SATA_CFG);
83 writel(SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK,
84 SPEAR1340_PCIE_MIPHY_CFG);
85 /* Switch on sata power domain */
86 writel((readl(SPEAR1340_PCM_CFG) | (0x800)), SPEAR1340_PCM_CFG);
87 msleep(20);
88 /* Disable PCIE SATA Controller reset */
89 writel((readl(SPEAR1340_PERIP1_SW_RST) & (~0x1000)),
90 SPEAR1340_PERIP1_SW_RST);
91 msleep(20);
92
93 return 0;
94}
95
96void sata_miphy_exit(struct device *dev)
97{
98 writel(0, SPEAR1340_PCIE_SATA_CFG);
99 writel(0, SPEAR1340_PCIE_MIPHY_CFG);
100
101 /* Enable PCIE SATA Controller reset */
102 writel((readl(SPEAR1340_PERIP1_SW_RST) | (0x1000)),
103 SPEAR1340_PERIP1_SW_RST);
104 msleep(20);
105 /* Switch off sata power domain */
106 writel((readl(SPEAR1340_PCM_CFG) & (~0x800)), SPEAR1340_PCM_CFG);
107 msleep(20);
108}
109
110int sata_suspend(struct device *dev)
111{
112 if (dev->power.power_state.event == PM_EVENT_FREEZE)
113 return 0;
114
115 sata_miphy_exit(dev);
116
117 return 0;
118}
119
120int sata_resume(struct device *dev)
121{
122 if (dev->power.power_state.event == PM_EVENT_THAW)
123 return 0;
124
125 return sata_miphy_init(dev, NULL);
126}
127
128static struct ahci_platform_data sata_pdata = {
129 .init = sata_miphy_init,
130 .exit = sata_miphy_exit,
131 .suspend = sata_suspend,
132 .resume = sata_resume,
133};
134
135/* Add SPEAr1340 auxdata to pass platform data */
136static struct of_dev_auxdata spear1340_auxdata_lookup[] __initdata = {
137 OF_DEV_AUXDATA("snps,spear-ahci", SPEAR1340_SATA_BASE, NULL,
138 &sata_pdata),
139 {}
140};
141 19
142static void __init spear1340_dt_init(void) 20static void __init spear1340_dt_init(void)
143{ 21{
144 of_platform_populate(NULL, of_default_bus_match_table, 22 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
145 spear1340_auxdata_lookup, NULL);
146 platform_device_register_simple("spear-cpufreq", -1, NULL, 0); 23 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
147} 24}
148 25
diff --git a/arch/arm/mach-spear/spear13xx.c b/arch/arm/mach-spear/spear13xx.c
index c9897ea38980..2e463a93468d 100644
--- a/arch/arm/mach-spear/spear13xx.c
+++ b/arch/arm/mach-spear/spear13xx.c
@@ -52,12 +52,12 @@ void __init spear13xx_l2x0_init(void)
52/* 52/*
53 * Following will create 16MB static virtual/physical mappings 53 * Following will create 16MB static virtual/physical mappings
54 * PHYSICAL VIRTUAL 54 * PHYSICAL VIRTUAL
55 * 0xB3000000 0xFE000000 55 * 0xB3000000 0xF9000000
56 * 0xE0000000 0xFD000000 56 * 0xE0000000 0xFD000000
57 * 0xEC000000 0xFC000000 57 * 0xEC000000 0xFC000000
58 * 0xED000000 0xFB000000 58 * 0xED000000 0xFB000000
59 */ 59 */
60struct map_desc spear13xx_io_desc[] __initdata = { 60static struct map_desc spear13xx_io_desc[] __initdata = {
61 { 61 {
62 .virtual = (unsigned long)VA_PERIP_GRP2_BASE, 62 .virtual = (unsigned long)VA_PERIP_GRP2_BASE,
63 .pfn = __phys_to_pfn(PERIP_GRP2_BASE), 63 .pfn = __phys_to_pfn(PERIP_GRP2_BASE),
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index fa2c33ffac04..d4b624f8dfcb 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -36,7 +36,7 @@ static void write_pen_release(int val)
36 36
37static DEFINE_SPINLOCK(boot_lock); 37static DEFINE_SPINLOCK(boot_lock);
38 38
39void sti_secondary_init(unsigned int cpu) 39static void sti_secondary_init(unsigned int cpu)
40{ 40{
41 trace_hardirqs_off(); 41 trace_hardirqs_off();
42 42
@@ -53,7 +53,7 @@ void sti_secondary_init(unsigned int cpu)
53 spin_unlock(&boot_lock); 53 spin_unlock(&boot_lock);
54} 54}
55 55
56int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) 56static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
57{ 57{
58 unsigned long timeout; 58 unsigned long timeout;
59 59
@@ -97,7 +97,7 @@ int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
97 return pen_release != -1 ? -ENOSYS : 0; 97 return pen_release != -1 ? -ENOSYS : 0;
98} 98}
99 99
100void __init sti_smp_prepare_cpus(unsigned int max_cpus) 100static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
101{ 101{
102 void __iomem *scu_base = NULL; 102 void __iomem *scu_base = NULL;
103 struct device_node *np = of_find_compatible_node( 103 struct device_node *np = of_find_compatible_node(
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 0fbd4f156bfa..1aaa1e15ef70 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -4,7 +4,6 @@ menuconfig ARCH_SUNXI
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
5 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
6 select PINCTRL 6 select PINCTRL
7 select PINCTRL_SUNXI
8 select SUN4I_TIMER 7 select SUN4I_TIMER
9 8
10if ARCH_SUNXI 9if ARCH_SUNXI
@@ -35,4 +34,12 @@ config MACH_SUN7I
35 select HAVE_ARM_ARCH_TIMER 34 select HAVE_ARM_ARCH_TIMER
36 select SUN5I_HSTIMER 35 select SUN5I_HSTIMER
37 36
37config MACH_SUN8I
38 bool "Allwinner A23 (sun8i) SoCs support"
39 default ARCH_SUNXI
40 select ARCH_HAS_RESET_CONTROLLER
41 select ARM_GIC
42 select MFD_SUN6I_PRCM
43 select RESET_CONTROLLER
44
38endif 45endif
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index b6085084e0ff..42d4753683ce 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -130,3 +130,12 @@ DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
130 .dt_compat = sun7i_board_dt_compat, 130 .dt_compat = sun7i_board_dt_compat,
131 .restart = sun4i_restart, 131 .restart = sun4i_restart,
132MACHINE_END 132MACHINE_END
133
134static const char * const sun8i_board_dt_compat[] = {
135 "allwinner,sun8i-a23",
136 NULL,
137};
138
139DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i (A23) Family")
140 .dt_compat = sun8i_board_dt_compat,
141MACHINE_END
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 6fbfbb77dcd9..e48a74458c25 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -2,24 +2,18 @@ asflags-y += -march=armv7-a
2 2
3obj-y += io.o 3obj-y += io.o
4obj-y += irq.o 4obj-y += irq.o
5obj-y += fuse.o
6obj-y += pmc.o
7obj-y += flowctrl.o 5obj-y += flowctrl.o
8obj-y += powergate.o
9obj-y += apbio.o
10obj-y += pm.o 6obj-y += pm.o
11obj-y += reset.o 7obj-y += reset.o
12obj-y += reset-handler.o 8obj-y += reset-handler.o
13obj-y += sleep.o 9obj-y += sleep.o
14obj-y += tegra.o 10obj-y += tegra.o
15obj-$(CONFIG_CPU_IDLE) += cpuidle.o 11obj-$(CONFIG_CPU_IDLE) += cpuidle.o
16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o
17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-tegra20.o 12obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-tegra20.o
18obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pm-tegra20.o 13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pm-tegra20.o
19ifeq ($(CONFIG_CPU_IDLE),y) 14ifeq ($(CONFIG_CPU_IDLE),y)
20obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += cpuidle-tegra20.o 15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += cpuidle-tegra20.o
21endif 16endif
22obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_speedo.o
23obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += sleep-tegra30.o 17obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += sleep-tegra30.o
24obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pm-tegra30.o 18obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pm-tegra30.o
25ifeq ($(CONFIG_CPU_IDLE),y) 19ifeq ($(CONFIG_CPU_IDLE),y)
@@ -28,7 +22,6 @@ endif
28obj-$(CONFIG_SMP) += platsmp.o headsmp.o 22obj-$(CONFIG_SMP) += platsmp.o headsmp.o
29obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 23obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
30 24
31obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o
32obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o 25obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o
33obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o 26obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o
34ifeq ($(CONFIG_CPU_IDLE),y) 27ifeq ($(CONFIG_CPU_IDLE),y)
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c
deleted file mode 100644
index bc471973cf04..000000000000
--- a/arch/arm/mach-tegra/apbio.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 * Copyright (C) 2010 NVIDIA Corporation.
3 * Copyright (C) 2010 Google, Inc.
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 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/of.h>
19#include <linux/dmaengine.h>
20#include <linux/dma-mapping.h>
21#include <linux/spinlock.h>
22#include <linux/completion.h>
23#include <linux/sched.h>
24#include <linux/mutex.h>
25
26#include "apbio.h"
27#include "iomap.h"
28
29#if defined(CONFIG_TEGRA20_APB_DMA)
30static DEFINE_MUTEX(tegra_apb_dma_lock);
31static u32 *tegra_apb_bb;
32static dma_addr_t tegra_apb_bb_phys;
33static DECLARE_COMPLETION(tegra_apb_wait);
34
35static u32 tegra_apb_readl_direct(unsigned long offset);
36static void tegra_apb_writel_direct(u32 value, unsigned long offset);
37
38static struct dma_chan *tegra_apb_dma_chan;
39static struct dma_slave_config dma_sconfig;
40
41static bool tegra_apb_dma_init(void)
42{
43 dma_cap_mask_t mask;
44
45 mutex_lock(&tegra_apb_dma_lock);
46
47 /* Check to see if we raced to setup */
48 if (tegra_apb_dma_chan)
49 goto skip_init;
50
51 dma_cap_zero(mask);
52 dma_cap_set(DMA_SLAVE, mask);
53 tegra_apb_dma_chan = dma_request_channel(mask, NULL, NULL);
54 if (!tegra_apb_dma_chan) {
55 /*
56 * This is common until the device is probed, so don't
57 * shout about it.
58 */
59 pr_debug("%s: can not allocate dma channel\n", __func__);
60 goto err_dma_alloc;
61 }
62
63 tegra_apb_bb = dma_alloc_coherent(NULL, sizeof(u32),
64 &tegra_apb_bb_phys, GFP_KERNEL);
65 if (!tegra_apb_bb) {
66 pr_err("%s: can not allocate bounce buffer\n", __func__);
67 goto err_buff_alloc;
68 }
69
70 dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
71 dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
72 dma_sconfig.src_maxburst = 1;
73 dma_sconfig.dst_maxburst = 1;
74
75skip_init:
76 mutex_unlock(&tegra_apb_dma_lock);
77 return true;
78
79err_buff_alloc:
80 dma_release_channel(tegra_apb_dma_chan);
81 tegra_apb_dma_chan = NULL;
82
83err_dma_alloc:
84 mutex_unlock(&tegra_apb_dma_lock);
85 return false;
86}
87
88static void apb_dma_complete(void *args)
89{
90 complete(&tegra_apb_wait);
91}
92
93static int do_dma_transfer(unsigned long apb_add,
94 enum dma_transfer_direction dir)
95{
96 struct dma_async_tx_descriptor *dma_desc;
97 int ret;
98
99 if (dir == DMA_DEV_TO_MEM)
100 dma_sconfig.src_addr = apb_add;
101 else
102 dma_sconfig.dst_addr = apb_add;
103
104 ret = dmaengine_slave_config(tegra_apb_dma_chan, &dma_sconfig);
105 if (ret)
106 return ret;
107
108 dma_desc = dmaengine_prep_slave_single(tegra_apb_dma_chan,
109 tegra_apb_bb_phys, sizeof(u32), dir,
110 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
111 if (!dma_desc)
112 return -EINVAL;
113
114 dma_desc->callback = apb_dma_complete;
115 dma_desc->callback_param = NULL;
116
117 reinit_completion(&tegra_apb_wait);
118
119 dmaengine_submit(dma_desc);
120 dma_async_issue_pending(tegra_apb_dma_chan);
121 ret = wait_for_completion_timeout(&tegra_apb_wait,
122 msecs_to_jiffies(50));
123
124 if (WARN(ret == 0, "apb read dma timed out")) {
125 dmaengine_terminate_all(tegra_apb_dma_chan);
126 return -EFAULT;
127 }
128 return 0;
129}
130
131static u32 tegra_apb_readl_using_dma(unsigned long offset)
132{
133 int ret;
134
135 if (!tegra_apb_dma_chan && !tegra_apb_dma_init())
136 return tegra_apb_readl_direct(offset);
137
138 mutex_lock(&tegra_apb_dma_lock);
139 ret = do_dma_transfer(offset, DMA_DEV_TO_MEM);
140 if (ret < 0) {
141 pr_err("error in reading offset 0x%08lx using dma\n", offset);
142 *(u32 *)tegra_apb_bb = 0;
143 }
144 mutex_unlock(&tegra_apb_dma_lock);
145 return *((u32 *)tegra_apb_bb);
146}
147
148static void tegra_apb_writel_using_dma(u32 value, unsigned long offset)
149{
150 int ret;
151
152 if (!tegra_apb_dma_chan && !tegra_apb_dma_init()) {
153 tegra_apb_writel_direct(value, offset);
154 return;
155 }
156
157 mutex_lock(&tegra_apb_dma_lock);
158 *((u32 *)tegra_apb_bb) = value;
159 ret = do_dma_transfer(offset, DMA_MEM_TO_DEV);
160 if (ret < 0)
161 pr_err("error in writing offset 0x%08lx using dma\n", offset);
162 mutex_unlock(&tegra_apb_dma_lock);
163}
164#else
165#define tegra_apb_readl_using_dma tegra_apb_readl_direct
166#define tegra_apb_writel_using_dma tegra_apb_writel_direct
167#endif
168
169typedef u32 (*apbio_read_fptr)(unsigned long offset);
170typedef void (*apbio_write_fptr)(u32 value, unsigned long offset);
171
172static apbio_read_fptr apbio_read;
173static apbio_write_fptr apbio_write;
174
175static u32 tegra_apb_readl_direct(unsigned long offset)
176{
177 return readl(IO_ADDRESS(offset));
178}
179
180static void tegra_apb_writel_direct(u32 value, unsigned long offset)
181{
182 writel(value, IO_ADDRESS(offset));
183}
184
185void tegra_apb_io_init(void)
186{
187 /* Need to use dma only when it is Tegra20 based platform */
188 if (of_machine_is_compatible("nvidia,tegra20") ||
189 !of_have_populated_dt()) {
190 apbio_read = tegra_apb_readl_using_dma;
191 apbio_write = tegra_apb_writel_using_dma;
192 } else {
193 apbio_read = tegra_apb_readl_direct;
194 apbio_write = tegra_apb_writel_direct;
195 }
196}
197
198u32 tegra_apb_readl(unsigned long offset)
199{
200 return apbio_read(offset);
201}
202
203void tegra_apb_writel(u32 value, unsigned long offset)
204{
205 apbio_write(value, offset);
206}
diff --git a/arch/arm/mach-tegra/apbio.h b/arch/arm/mach-tegra/apbio.h
deleted file mode 100644
index f05d71c303c7..000000000000
--- a/arch/arm/mach-tegra/apbio.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2010 NVIDIA Corporation.
3 * Copyright (C) 2010 Google, Inc.
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 */
15
16#ifndef __MACH_TEGRA_APBIO_H
17#define __MACH_TEGRA_APBIO_H
18
19void tegra_apb_io_init(void);
20u32 tegra_apb_readl(unsigned long offset);
21void tegra_apb_writel(u32 value, unsigned long offset);
22#endif
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 9c6029ba526f..fbe74c6806f3 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -17,9 +17,10 @@
17 * 17 *
18 */ 18 */
19 19
20#include <linux/gpio/machine.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/gpio/driver.h>
22#include <linux/rfkill-gpio.h> 22#include <linux/rfkill-gpio.h>
23
23#include "board.h" 24#include "board.h"
24 25
25static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { 26static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index bcf5dbf69d58..da90c89296b9 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -28,13 +28,6 @@
28void __init tegra_map_common_io(void); 28void __init tegra_map_common_io(void);
29void __init tegra_init_irq(void); 29void __init tegra_init_irq(void);
30 30
31int __init tegra_powergate_init(void);
32#if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS)
33int __init tegra_powergate_debugfs_init(void);
34#else
35static inline int tegra_powergate_debugfs_init(void) { return 0; }
36#endif
37
38void __init tegra_paz00_wifikill_init(void); 31void __init tegra_paz00_wifikill_init(void);
39 32
40#endif 33#endif
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
index b5fb7c110c64..e3ebdce3e71f 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra114.c
@@ -14,16 +14,16 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <asm/firmware.h>
18#include <linux/module.h> 18#include <linux/clockchips.h>
19#include <linux/cpuidle.h> 19#include <linux/cpuidle.h>
20#include <linux/cpu_pm.h> 20#include <linux/cpu_pm.h>
21#include <linux/clockchips.h> 21#include <linux/kernel.h>
22#include <asm/firmware.h> 22#include <linux/module.h>
23 23
24#include <asm/cpuidle.h> 24#include <asm/cpuidle.h>
25#include <asm/suspend.h>
26#include <asm/smp_plat.h> 25#include <asm/smp_plat.h>
26#include <asm/suspend.h>
27 27
28#include "pm.h" 28#include "pm.h"
29#include "sleep.h" 29#include "sleep.h"
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index b82dcaee2ef4..b30bf5cba65b 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -19,23 +19,23 @@
19 * more details. 19 * more details.
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/clk/tegra.h>
23#include <linux/module.h> 23#include <linux/clockchips.h>
24#include <linux/cpuidle.h> 24#include <linux/cpuidle.h>
25#include <linux/cpu_pm.h> 25#include <linux/cpu_pm.h>
26#include <linux/clockchips.h> 26#include <linux/kernel.h>
27#include <linux/clk/tegra.h> 27#include <linux/module.h>
28 28
29#include <asm/cpuidle.h> 29#include <asm/cpuidle.h>
30#include <asm/proc-fns.h> 30#include <asm/proc-fns.h>
31#include <asm/suspend.h>
32#include <asm/smp_plat.h> 31#include <asm/smp_plat.h>
32#include <asm/suspend.h>
33 33
34#include "pm.h" 34#include "flowctrl.h"
35#include "sleep.h"
36#include "iomap.h" 35#include "iomap.h"
37#include "irq.h" 36#include "irq.h"
38#include "flowctrl.h" 37#include "pm.h"
38#include "sleep.h"
39 39
40#ifdef CONFIG_PM_SLEEP 40#ifdef CONFIG_PM_SLEEP
41static bool abort_flag; 41static bool abort_flag;
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
index ed2a2a7bae4d..35561274f6cf 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -19,17 +19,17 @@
19 * more details. 19 * more details.
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/clk/tegra.h>
23#include <linux/module.h> 23#include <linux/clockchips.h>
24#include <linux/cpuidle.h> 24#include <linux/cpuidle.h>
25#include <linux/cpu_pm.h> 25#include <linux/cpu_pm.h>
26#include <linux/clockchips.h> 26#include <linux/kernel.h>
27#include <linux/clk/tegra.h> 27#include <linux/module.h>
28 28
29#include <asm/cpuidle.h> 29#include <asm/cpuidle.h>
30#include <asm/proc-fns.h> 30#include <asm/proc-fns.h>
31#include <asm/suspend.h>
32#include <asm/smp_plat.h> 31#include <asm/smp_plat.h>
32#include <asm/suspend.h>
33 33
34#include "pm.h" 34#include "pm.h"
35#include "sleep.h" 35#include "sleep.h"
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
index 7bc5d8d667fe..316563141add 100644
--- a/arch/arm/mach-tegra/cpuidle.c
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -24,12 +24,13 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include "fuse.h" 27#include <soc/tegra/fuse.h>
28
28#include "cpuidle.h" 29#include "cpuidle.h"
29 30
30void __init tegra_cpuidle_init(void) 31void __init tegra_cpuidle_init(void)
31{ 32{
32 switch (tegra_chip_id) { 33 switch (tegra_get_chip_id()) {
33 case TEGRA20: 34 case TEGRA20:
34 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 35 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
35 tegra20_cpuidle_init(); 36 tegra20_cpuidle_init();
@@ -49,7 +50,7 @@ void __init tegra_cpuidle_init(void)
49 50
50void tegra_cpuidle_pcie_irqs_in_use(void) 51void tegra_cpuidle_pcie_irqs_in_use(void)
51{ 52{
52 switch (tegra_chip_id) { 53 switch (tegra_get_chip_id()) {
53 case TEGRA20: 54 case TEGRA20:
54 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 55 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
55 tegra20_cpuidle_pcie_irqs_in_use(); 56 tegra20_cpuidle_pcie_irqs_in_use();
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index ce8ab8abf061..ec55d1de1b55 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -18,14 +18,15 @@
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */ 19 */
20 20
21#include <linux/cpumask.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/cpumask.h> 24#include <linux/kernel.h>
25
26#include <soc/tegra/fuse.h>
25 27
26#include "flowctrl.h" 28#include "flowctrl.h"
27#include "iomap.h" 29#include "iomap.h"
28#include "fuse.h"
29 30
30static u8 flowctrl_offset_halt_cpu[] = { 31static u8 flowctrl_offset_halt_cpu[] = {
31 FLOW_CTRL_HALT_CPU0_EVENTS, 32 FLOW_CTRL_HALT_CPU0_EVENTS,
@@ -76,7 +77,7 @@ void flowctrl_cpu_suspend_enter(unsigned int cpuid)
76 int i; 77 int i;
77 78
78 reg = flowctrl_read_cpu_csr(cpuid); 79 reg = flowctrl_read_cpu_csr(cpuid);
79 switch (tegra_chip_id) { 80 switch (tegra_get_chip_id()) {
80 case TEGRA20: 81 case TEGRA20:
81 /* clear wfe bitmap */ 82 /* clear wfe bitmap */
82 reg &= ~TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP; 83 reg &= ~TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP;
@@ -117,7 +118,7 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)
117 118
118 /* Disable powergating via flow controller for CPU0 */ 119 /* Disable powergating via flow controller for CPU0 */
119 reg = flowctrl_read_cpu_csr(cpuid); 120 reg = flowctrl_read_cpu_csr(cpuid);
120 switch (tegra_chip_id) { 121 switch (tegra_get_chip_id()) {
121 case TEGRA20: 122 case TEGRA20:
122 /* clear wfe bitmap */ 123 /* clear wfe bitmap */
123 reg &= ~TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP; 124 reg &= ~TEGRA20_FLOW_CTRL_CSR_WFE_BITMAP;
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
deleted file mode 100644
index c9ac23b385be..000000000000
--- a/arch/arm/mach-tegra/fuse.c
+++ /dev/null
@@ -1,252 +0,0 @@
1/*
2 * arch/arm/mach-tegra/fuse.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
6 *
7 * Author:
8 * Colin Cross <ccross@android.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#include <linux/kernel.h>
22#include <linux/io.h>
23#include <linux/export.h>
24#include <linux/random.h>
25#include <linux/clk.h>
26#include <linux/tegra-soc.h>
27
28#include "fuse.h"
29#include "iomap.h"
30#include "apbio.h"
31
32/* Tegra20 only */
33#define FUSE_UID_LOW 0x108
34#define FUSE_UID_HIGH 0x10c
35
36/* Tegra30 and later */
37#define FUSE_VENDOR_CODE 0x200
38#define FUSE_FAB_CODE 0x204
39#define FUSE_LOT_CODE_0 0x208
40#define FUSE_LOT_CODE_1 0x20c
41#define FUSE_WAFER_ID 0x210
42#define FUSE_X_COORDINATE 0x214
43#define FUSE_Y_COORDINATE 0x218
44
45#define FUSE_SKU_INFO 0x110
46
47#define TEGRA20_FUSE_SPARE_BIT 0x200
48#define TEGRA30_FUSE_SPARE_BIT 0x244
49
50int tegra_sku_id;
51int tegra_cpu_process_id;
52int tegra_core_process_id;
53int tegra_chip_id;
54int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */
55int tegra_soc_speedo_id;
56enum tegra_revision tegra_revision;
57
58static struct clk *fuse_clk;
59static int tegra_fuse_spare_bit;
60static void (*tegra_init_speedo_data)(void);
61
62/* The BCT to use at boot is specified by board straps that can be read
63 * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
64 */
65int tegra_bct_strapping;
66
67#define STRAP_OPT 0x008
68#define GMI_AD0 (1 << 4)
69#define GMI_AD1 (1 << 5)
70#define RAM_ID_MASK (GMI_AD0 | GMI_AD1)
71#define RAM_CODE_SHIFT 4
72
73static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
74 [TEGRA_REVISION_UNKNOWN] = "unknown",
75 [TEGRA_REVISION_A01] = "A01",
76 [TEGRA_REVISION_A02] = "A02",
77 [TEGRA_REVISION_A03] = "A03",
78 [TEGRA_REVISION_A03p] = "A03 prime",
79 [TEGRA_REVISION_A04] = "A04",
80};
81
82static void tegra_fuse_enable_clk(void)
83{
84 if (IS_ERR(fuse_clk))
85 fuse_clk = clk_get_sys(NULL, "fuse");
86 if (IS_ERR(fuse_clk))
87 return;
88 clk_prepare_enable(fuse_clk);
89}
90
91static void tegra_fuse_disable_clk(void)
92{
93 if (IS_ERR(fuse_clk))
94 return;
95 clk_disable_unprepare(fuse_clk);
96}
97
98u32 tegra_fuse_readl(unsigned long offset)
99{
100 return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
101}
102
103bool tegra_spare_fuse(int bit)
104{
105 bool ret;
106
107 tegra_fuse_enable_clk();
108
109 ret = tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
110
111 tegra_fuse_disable_clk();
112
113 return ret;
114}
115
116static enum tegra_revision tegra_get_revision(u32 id)
117{
118 u32 minor_rev = (id >> 16) & 0xf;
119
120 switch (minor_rev) {
121 case 1:
122 return TEGRA_REVISION_A01;
123 case 2:
124 return TEGRA_REVISION_A02;
125 case 3:
126 if (tegra_chip_id == TEGRA20 &&
127 (tegra_spare_fuse(18) || tegra_spare_fuse(19)))
128 return TEGRA_REVISION_A03p;
129 else
130 return TEGRA_REVISION_A03;
131 case 4:
132 return TEGRA_REVISION_A04;
133 default:
134 return TEGRA_REVISION_UNKNOWN;
135 }
136}
137
138static void tegra_get_process_id(void)
139{
140 u32 reg;
141
142 tegra_fuse_enable_clk();
143
144 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
145 tegra_cpu_process_id = (reg >> 6) & 3;
146 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
147 tegra_core_process_id = (reg >> 12) & 3;
148
149 tegra_fuse_disable_clk();
150}
151
152u32 tegra_read_chipid(void)
153{
154 return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
155}
156
157static void __init tegra20_fuse_init_randomness(void)
158{
159 u32 randomness[2];
160
161 randomness[0] = tegra_fuse_readl(FUSE_UID_LOW);
162 randomness[1] = tegra_fuse_readl(FUSE_UID_HIGH);
163
164 add_device_randomness(randomness, sizeof(randomness));
165}
166
167/* Applies to Tegra30 or later */
168static void __init tegra30_fuse_init_randomness(void)
169{
170 u32 randomness[7];
171
172 randomness[0] = tegra_fuse_readl(FUSE_VENDOR_CODE);
173 randomness[1] = tegra_fuse_readl(FUSE_FAB_CODE);
174 randomness[2] = tegra_fuse_readl(FUSE_LOT_CODE_0);
175 randomness[3] = tegra_fuse_readl(FUSE_LOT_CODE_1);
176 randomness[4] = tegra_fuse_readl(FUSE_WAFER_ID);
177 randomness[5] = tegra_fuse_readl(FUSE_X_COORDINATE);
178 randomness[6] = tegra_fuse_readl(FUSE_Y_COORDINATE);
179
180 add_device_randomness(randomness, sizeof(randomness));
181}
182
183void __init tegra_init_fuse(void)
184{
185 u32 id;
186 u32 randomness[5];
187
188 u32 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
189 reg |= 1 << 28;
190 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
191
192 /*
193 * Enable FUSE clock. This needs to be hardcoded because the clock
194 * subsystem is not active during early boot.
195 */
196 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
197 reg |= 1 << 7;
198 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
199 fuse_clk = ERR_PTR(-EINVAL);
200
201 reg = tegra_fuse_readl(FUSE_SKU_INFO);
202 randomness[0] = reg;
203 tegra_sku_id = reg & 0xFF;
204
205 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
206 randomness[1] = reg;
207 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
208
209 id = tegra_read_chipid();
210 randomness[2] = id;
211 tegra_chip_id = (id >> 8) & 0xff;
212
213 switch (tegra_chip_id) {
214 case TEGRA20:
215 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT;
216 tegra_init_speedo_data = &tegra20_init_speedo_data;
217 break;
218 case TEGRA30:
219 tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT;
220 tegra_init_speedo_data = &tegra30_init_speedo_data;
221 break;
222 case TEGRA114:
223 tegra_init_speedo_data = &tegra114_init_speedo_data;
224 break;
225 default:
226 pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id);
227 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT;
228 tegra_init_speedo_data = &tegra_get_process_id;
229 }
230
231 tegra_revision = tegra_get_revision(id);
232 tegra_init_speedo_data();
233 randomness[3] = (tegra_cpu_process_id << 16) | tegra_core_process_id;
234 randomness[4] = (tegra_cpu_speedo_id << 16) | tegra_soc_speedo_id;
235
236 add_device_randomness(randomness, sizeof(randomness));
237 switch (tegra_chip_id) {
238 case TEGRA20:
239 tegra20_fuse_init_randomness();
240 break;
241 case TEGRA30:
242 case TEGRA114:
243 default:
244 tegra30_fuse_init_randomness();
245 break;
246 }
247
248 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
249 tegra_revision_name[tegra_revision],
250 tegra_sku_id, tegra_cpu_process_id,
251 tegra_core_process_id);
252}
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
deleted file mode 100644
index c01d04785d67..000000000000
--- a/arch/arm/mach-tegra/fuse.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
4 *
5 * Author:
6 * Colin Cross <ccross@android.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __MACH_TEGRA_FUSE_H
20#define __MACH_TEGRA_FUSE_H
21
22#define SKU_ID_T20 8
23#define SKU_ID_T25SE 20
24#define SKU_ID_AP25 23
25#define SKU_ID_T25 24
26#define SKU_ID_AP25E 27
27#define SKU_ID_T25E 28
28
29#define TEGRA20 0x20
30#define TEGRA30 0x30
31#define TEGRA114 0x35
32#define TEGRA124 0x40
33
34#ifndef __ASSEMBLY__
35enum tegra_revision {
36 TEGRA_REVISION_UNKNOWN = 0,
37 TEGRA_REVISION_A01,
38 TEGRA_REVISION_A02,
39 TEGRA_REVISION_A03,
40 TEGRA_REVISION_A03p,
41 TEGRA_REVISION_A04,
42 TEGRA_REVISION_MAX,
43};
44
45extern int tegra_sku_id;
46extern int tegra_cpu_process_id;
47extern int tegra_core_process_id;
48extern int tegra_chip_id;
49extern int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */
50extern int tegra_soc_speedo_id;
51extern enum tegra_revision tegra_revision;
52
53extern int tegra_bct_strapping;
54
55unsigned long long tegra_chip_uid(void);
56void tegra_init_fuse(void);
57bool tegra_spare_fuse(int bit);
58u32 tegra_fuse_readl(unsigned long offset);
59
60#ifdef CONFIG_ARCH_TEGRA_2x_SOC
61void tegra20_init_speedo_data(void);
62#else
63static inline void tegra20_init_speedo_data(void) {}
64#endif
65
66#ifdef CONFIG_ARCH_TEGRA_3x_SOC
67void tegra30_init_speedo_data(void);
68#else
69static inline void tegra30_init_speedo_data(void) {}
70#endif
71
72#ifdef CONFIG_ARCH_TEGRA_114_SOC
73void tegra114_init_speedo_data(void);
74#else
75static inline void tegra114_init_speedo_data(void) {}
76#endif
77#endif /* __ASSEMBLY__ */
78
79#endif
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index ff26af26bd0c..6fc71f1534b0 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -7,13 +7,16 @@
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
11#include <linux/clk/tegra.h>
10#include <linux/kernel.h> 12#include <linux/kernel.h>
11#include <linux/smp.h> 13#include <linux/smp.h>
12#include <linux/clk/tegra.h> 14
15#include <soc/tegra/common.h>
16#include <soc/tegra/fuse.h>
13 17
14#include <asm/smp_plat.h> 18#include <asm/smp_plat.h>
15 19
16#include "fuse.h"
17#include "sleep.h" 20#include "sleep.h"
18 21
19static void (*tegra_hotplug_shutdown)(void); 22static void (*tegra_hotplug_shutdown)(void);
@@ -36,6 +39,11 @@ int tegra_cpu_kill(unsigned cpu)
36 */ 39 */
37void __ref tegra_cpu_die(unsigned int cpu) 40void __ref tegra_cpu_die(unsigned int cpu)
38{ 41{
42 if (!tegra_hotplug_shutdown) {
43 WARN(1, "hotplug is not yet initialized\n");
44 return;
45 }
46
39 /* Clean L1 data cache */ 47 /* Clean L1 data cache */
40 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS); 48 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
41 49
@@ -46,17 +54,23 @@ void __ref tegra_cpu_die(unsigned int cpu)
46 BUG(); 54 BUG();
47} 55}
48 56
49void __init tegra_hotplug_init(void) 57static int __init tegra_hotplug_init(void)
50{ 58{
51 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) 59 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
52 return; 60 return 0;
53 61
54 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) 62 if (!soc_is_tegra())
63 return 0;
64
65 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
55 tegra_hotplug_shutdown = tegra20_hotplug_shutdown; 66 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
56 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) 67 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 68 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
58 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) 69 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
59 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 70 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
60 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124) 71 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
61 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 72 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
73
74 return 0;
62} 75}
76pure_initcall(tegra_hotplug_init);
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index bb9c9c29d181..352de159d2c5 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -18,14 +18,14 @@
18 * 18 *
19 */ 19 */
20 20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/init.h> 21#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26 26
27#include <asm/page.h>
28#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/page.h>
29 29
30#include "board.h" 30#include "board.h"
31#include "iomap.h" 31#include "iomap.h"
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 1a74d562dca1..da7be13aecce 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -17,14 +17,14 @@
17 * 17 *
18 */ 18 */
19 19
20#include <linux/kernel.h>
21#include <linux/cpu_pm.h> 20#include <linux/cpu_pm.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/io.h> 22#include <linux/io.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/irqchip/arm-gic.h> 23#include <linux/irqchip/arm-gic.h>
24#include <linux/irq.h>
25#include <linux/kernel.h>
26#include <linux/of_address.h>
27#include <linux/of.h>
28#include <linux/syscore_ops.h> 28#include <linux/syscore_ops.h>
29 29
30#include "board.h" 30#include "board.h"
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 929d1046e2b4..b45086666648 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -11,27 +11,28 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/init.h> 14
15#include <linux/errno.h> 15#include <linux/clk/tegra.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/errno.h>
19#include <linux/init.h>
20#include <linux/io.h>
18#include <linux/jiffies.h> 21#include <linux/jiffies.h>
19#include <linux/smp.h> 22#include <linux/smp.h>
20#include <linux/io.h> 23
21#include <linux/clk/tegra.h> 24#include <soc/tegra/fuse.h>
25#include <soc/tegra/pmc.h>
22 26
23#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
24#include <asm/mach-types.h> 28#include <asm/mach-types.h>
25#include <asm/smp_scu.h>
26#include <asm/smp_plat.h> 29#include <asm/smp_plat.h>
27 30#include <asm/smp_scu.h>
28#include "fuse.h"
29#include "flowctrl.h"
30#include "reset.h"
31#include "pmc.h"
32 31
33#include "common.h" 32#include "common.h"
33#include "flowctrl.h"
34#include "iomap.h" 34#include "iomap.h"
35#include "reset.h"
35 36
36static cpumask_t tegra_cpu_init_mask; 37static cpumask_t tegra_cpu_init_mask;
37 38
@@ -170,13 +171,13 @@ static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle)
170static int tegra_boot_secondary(unsigned int cpu, 171static int tegra_boot_secondary(unsigned int cpu,
171 struct task_struct *idle) 172 struct task_struct *idle)
172{ 173{
173 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) 174 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
174 return tegra20_boot_secondary(cpu, idle); 175 return tegra20_boot_secondary(cpu, idle);
175 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) 176 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
176 return tegra30_boot_secondary(cpu, idle); 177 return tegra30_boot_secondary(cpu, idle);
177 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) 178 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
178 return tegra114_boot_secondary(cpu, idle); 179 return tegra114_boot_secondary(cpu, idle);
179 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124) 180 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
180 return tegra114_boot_secondary(cpu, idle); 181 return tegra114_boot_secondary(cpu, idle);
181 182
182 return -EINVAL; 183 return -EINVAL;
diff --git a/arch/arm/mach-tegra/pm-tegra20.c b/arch/arm/mach-tegra/pm-tegra20.c
index d65e1d786400..39ac2b723f2e 100644
--- a/arch/arm/mach-tegra/pm-tegra20.c
+++ b/arch/arm/mach-tegra/pm-tegra20.c
@@ -13,6 +13,7 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17 18
18#include "pm.h" 19#include "pm.h"
diff --git a/arch/arm/mach-tegra/pm-tegra30.c b/arch/arm/mach-tegra/pm-tegra30.c
index 8fa326d6ff1a..46cc19de9916 100644
--- a/arch/arm/mach-tegra/pm-tegra30.c
+++ b/arch/arm/mach-tegra/pm-tegra30.c
@@ -13,6 +13,7 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17 18
18#include "pm.h" 19#include "pm.h"
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index f55b05a29b55..b0f48a3946fa 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -16,30 +16,32 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19#include <linux/kernel.h> 19#include <linux/clk/tegra.h>
20#include <linux/spinlock.h>
21#include <linux/io.h>
22#include <linux/cpumask.h> 20#include <linux/cpumask.h>
23#include <linux/delay.h>
24#include <linux/cpu_pm.h> 21#include <linux/cpu_pm.h>
25#include <linux/suspend.h> 22#include <linux/delay.h>
26#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/io.h>
25#include <linux/kernel.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/clk/tegra.h> 27#include <linux/spinlock.h>
28#include <linux/suspend.h>
29
30#include <soc/tegra/fuse.h>
31#include <soc/tegra/pm.h>
32#include <soc/tegra/pmc.h>
29 33
30#include <asm/smp_plat.h>
31#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
32#include <asm/suspend.h>
33#include <asm/idmap.h> 35#include <asm/idmap.h>
34#include <asm/proc-fns.h> 36#include <asm/proc-fns.h>
37#include <asm/smp_plat.h>
38#include <asm/suspend.h>
35#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
36 40
37#include "iomap.h"
38#include "reset.h"
39#include "flowctrl.h" 41#include "flowctrl.h"
40#include "fuse.h" 42#include "iomap.h"
41#include "pm.h" 43#include "pm.h"
42#include "pmc.h" 44#include "reset.h"
43#include "sleep.h" 45#include "sleep.h"
44 46
45#ifdef CONFIG_PM_SLEEP 47#ifdef CONFIG_PM_SLEEP
@@ -53,7 +55,7 @@ static int (*tegra_sleep_func)(unsigned long v2p);
53 55
54static void tegra_tear_down_cpu_init(void) 56static void tegra_tear_down_cpu_init(void)
55{ 57{
56 switch (tegra_chip_id) { 58 switch (tegra_get_chip_id()) {
57 case TEGRA20: 59 case TEGRA20:
58 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 60 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
59 tegra_tear_down_cpu = tegra20_tear_down_cpu; 61 tegra_tear_down_cpu = tegra20_tear_down_cpu;
@@ -143,7 +145,7 @@ bool tegra_set_cpu_in_lp2(void)
143 145
144 if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask)) 146 if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask))
145 last_cpu = true; 147 last_cpu = true;
146 else if (tegra_chip_id == TEGRA20 && phy_cpu_id == 1) 148 else if (tegra_get_chip_id() == TEGRA20 && phy_cpu_id == 1)
147 tegra20_cpu_set_resettable_soon(); 149 tegra20_cpu_set_resettable_soon();
148 150
149 spin_unlock(&tegra_lp2_lock); 151 spin_unlock(&tegra_lp2_lock);
@@ -166,9 +168,29 @@ static int tegra_sleep_cpu(unsigned long v2p)
166 return 0; 168 return 0;
167} 169}
168 170
171static void tegra_pm_set(enum tegra_suspend_mode mode)
172{
173 u32 value;
174
175 switch (tegra_get_chip_id()) {
176 case TEGRA20:
177 case TEGRA30:
178 break;
179 default:
180 /* Turn off CRAIL */
181 value = flowctrl_read_cpu_csr(0);
182 value &= ~FLOW_CTRL_CSR_ENABLE_EXT_MASK;
183 value |= FLOW_CTRL_CSR_ENABLE_EXT_CRAIL;
184 flowctrl_write_cpu_csr(0, value);
185 break;
186 }
187
188 tegra_pmc_enter_suspend_mode(mode);
189}
190
169void tegra_idle_lp2_last(void) 191void tegra_idle_lp2_last(void)
170{ 192{
171 tegra_pmc_pm_set(TEGRA_SUSPEND_LP2); 193 tegra_pm_set(TEGRA_SUSPEND_LP2);
172 194
173 cpu_cluster_pm_enter(); 195 cpu_cluster_pm_enter();
174 suspend_cpu_complex(); 196 suspend_cpu_complex();
@@ -212,7 +234,7 @@ static int tegra_sleep_core(unsigned long v2p)
212 */ 234 */
213static bool tegra_lp1_iram_hook(void) 235static bool tegra_lp1_iram_hook(void)
214{ 236{
215 switch (tegra_chip_id) { 237 switch (tegra_get_chip_id()) {
216 case TEGRA20: 238 case TEGRA20:
217 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 239 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
218 tegra20_lp1_iram_hook(); 240 tegra20_lp1_iram_hook();
@@ -242,7 +264,7 @@ static bool tegra_lp1_iram_hook(void)
242 264
243static bool tegra_sleep_core_init(void) 265static bool tegra_sleep_core_init(void)
244{ 266{
245 switch (tegra_chip_id) { 267 switch (tegra_get_chip_id()) {
246 case TEGRA20: 268 case TEGRA20:
247 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) 269 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
248 tegra20_sleep_core_init(); 270 tegra20_sleep_core_init();
@@ -267,8 +289,6 @@ static bool tegra_sleep_core_init(void)
267 289
268static void tegra_suspend_enter_lp1(void) 290static void tegra_suspend_enter_lp1(void)
269{ 291{
270 tegra_pmc_suspend();
271
272 /* copy the reset vector & SDRAM shutdown code into IRAM */ 292 /* copy the reset vector & SDRAM shutdown code into IRAM */
273 memcpy(iram_save_addr, IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA), 293 memcpy(iram_save_addr, IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA),
274 iram_save_size); 294 iram_save_size);
@@ -280,8 +300,6 @@ static void tegra_suspend_enter_lp1(void)
280 300
281static void tegra_suspend_exit_lp1(void) 301static void tegra_suspend_exit_lp1(void)
282{ 302{
283 tegra_pmc_resume();
284
285 /* restore IRAM */ 303 /* restore IRAM */
286 memcpy(IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA), iram_save_addr, 304 memcpy(IO_ADDRESS(TEGRA_IRAM_LPx_RESUME_AREA), iram_save_addr,
287 iram_save_size); 305 iram_save_size);
@@ -306,7 +324,7 @@ static int tegra_suspend_enter(suspend_state_t state)
306 324
307 pr_info("Entering suspend state %s\n", lp_state[mode]); 325 pr_info("Entering suspend state %s\n", lp_state[mode]);
308 326
309 tegra_pmc_pm_set(mode); 327 tegra_pm_set(mode);
310 328
311 local_fiq_disable(); 329 local_fiq_disable();
312 330
@@ -354,7 +372,6 @@ void __init tegra_init_suspend(void)
354 return; 372 return;
355 373
356 tegra_tear_down_cpu_init(); 374 tegra_tear_down_cpu_init();
357 tegra_pmc_suspend_init();
358 375
359 if (mode >= TEGRA_SUSPEND_LP1) { 376 if (mode >= TEGRA_SUSPEND_LP1) {
360 if (!tegra_lp1_iram_hook() || !tegra_sleep_core_init()) { 377 if (!tegra_lp1_iram_hook() || !tegra_sleep_core_init()) {
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
index f4a89698e5b0..83bc87583446 100644
--- a/arch/arm/mach-tegra/pm.h
+++ b/arch/arm/mach-tegra/pm.h
@@ -21,12 +21,11 @@
21#ifndef _MACH_TEGRA_PM_H_ 21#ifndef _MACH_TEGRA_PM_H_
22#define _MACH_TEGRA_PM_H_ 22#define _MACH_TEGRA_PM_H_
23 23
24#include "pmc.h"
25
26struct tegra_lp1_iram { 24struct tegra_lp1_iram {
27 void *start_addr; 25 void *start_addr;
28 void *end_addr; 26 void *end_addr;
29}; 27};
28
30extern struct tegra_lp1_iram tegra_lp1_iram; 29extern struct tegra_lp1_iram tegra_lp1_iram;
31extern void (*tegra_sleep_core_finish)(unsigned long v2p); 30extern void (*tegra_sleep_core_finish)(unsigned long v2p);
32 31
@@ -42,15 +41,8 @@ void tegra_idle_lp2_last(void);
42extern void (*tegra_tear_down_cpu)(void); 41extern void (*tegra_tear_down_cpu)(void);
43 42
44#ifdef CONFIG_PM_SLEEP 43#ifdef CONFIG_PM_SLEEP
45enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
46 enum tegra_suspend_mode mode);
47void tegra_init_suspend(void); 44void tegra_init_suspend(void);
48#else 45#else
49static inline enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
50 enum tegra_suspend_mode mode)
51{
52 return TEGRA_SUSPEND_NONE;
53}
54static inline void tegra_init_suspend(void) {} 46static inline void tegra_init_suspend(void) {}
55#endif 47#endif
56 48
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
deleted file mode 100644
index 7c7123e7557b..000000000000
--- a/arch/arm/mach-tegra/pmc.c
+++ /dev/null
@@ -1,413 +0,0 @@
1/*
2 * Copyright (C) 2012,2013 NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/tegra-powergate.h>
24
25#include "flowctrl.h"
26#include "fuse.h"
27#include "pm.h"
28#include "pmc.h"
29#include "sleep.h"
30
31#define TEGRA_POWER_SYSCLK_POLARITY (1 << 10) /* sys clk polarity */
32#define TEGRA_POWER_SYSCLK_OE (1 << 11) /* system clock enable */
33#define TEGRA_POWER_EFFECT_LP0 (1 << 14) /* LP0 when CPU pwr gated */
34#define TEGRA_POWER_CPU_PWRREQ_POLARITY (1 << 15) /* CPU pwr req polarity */
35#define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */
36
37#define PMC_CTRL 0x0
38#define PMC_CTRL_INTR_LOW (1 << 17)
39#define PMC_PWRGATE_TOGGLE 0x30
40#define PMC_PWRGATE_TOGGLE_START (1 << 8)
41#define PMC_REMOVE_CLAMPING 0x34
42#define PMC_PWRGATE_STATUS 0x38
43
44#define PMC_SCRATCH0 0x50
45#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
46#define PMC_SCRATCH0_MODE_BOOTLOADER (1 << 30)
47#define PMC_SCRATCH0_MODE_RCM (1 << 1)
48#define PMC_SCRATCH0_MODE_MASK (PMC_SCRATCH0_MODE_RECOVERY | \
49 PMC_SCRATCH0_MODE_BOOTLOADER | \
50 PMC_SCRATCH0_MODE_RCM)
51
52#define PMC_CPUPWRGOOD_TIMER 0xc8
53#define PMC_CPUPWROFF_TIMER 0xcc
54
55static u8 tegra_cpu_domains[] = {
56 0xFF, /* not available for CPU0 */
57 TEGRA_POWERGATE_CPU1,
58 TEGRA_POWERGATE_CPU2,
59 TEGRA_POWERGATE_CPU3,
60};
61static DEFINE_SPINLOCK(tegra_powergate_lock);
62
63static void __iomem *tegra_pmc_base;
64static bool tegra_pmc_invert_interrupt;
65static struct clk *tegra_pclk;
66
67struct pmc_pm_data {
68 u32 cpu_good_time; /* CPU power good time in uS */
69 u32 cpu_off_time; /* CPU power off time in uS */
70 u32 core_osc_time; /* Core power good osc time in uS */
71 u32 core_pmu_time; /* Core power good pmu time in uS */
72 u32 core_off_time; /* Core power off time in uS */
73 bool corereq_high; /* Core power request active-high */
74 bool sysclkreq_high; /* System clock request active-high */
75 bool combined_req; /* Combined pwr req for CPU & Core */
76 bool cpu_pwr_good_en; /* CPU power good signal is enabled */
77 u32 lp0_vec_phy_addr; /* The phy addr of LP0 warm boot code */
78 u32 lp0_vec_size; /* The size of LP0 warm boot code */
79 enum tegra_suspend_mode suspend_mode;
80};
81static struct pmc_pm_data pmc_pm_data;
82
83static inline u32 tegra_pmc_readl(u32 reg)
84{
85 return readl(tegra_pmc_base + reg);
86}
87
88static inline void tegra_pmc_writel(u32 val, u32 reg)
89{
90 writel(val, tegra_pmc_base + reg);
91}
92
93static int tegra_pmc_get_cpu_powerdomain_id(int cpuid)
94{
95 if (cpuid <= 0 || cpuid >= num_possible_cpus())
96 return -EINVAL;
97 return tegra_cpu_domains[cpuid];
98}
99
100static bool tegra_pmc_powergate_is_powered(int id)
101{
102 return (tegra_pmc_readl(PMC_PWRGATE_STATUS) >> id) & 1;
103}
104
105static int tegra_pmc_powergate_set(int id, bool new_state)
106{
107 bool old_state;
108 unsigned long flags;
109
110 spin_lock_irqsave(&tegra_powergate_lock, flags);
111
112 old_state = tegra_pmc_powergate_is_powered(id);
113 WARN_ON(old_state == new_state);
114
115 tegra_pmc_writel(PMC_PWRGATE_TOGGLE_START | id, PMC_PWRGATE_TOGGLE);
116
117 spin_unlock_irqrestore(&tegra_powergate_lock, flags);
118
119 return 0;
120}
121
122static int tegra_pmc_powergate_remove_clamping(int id)
123{
124 u32 mask;
125
126 /*
127 * Tegra has a bug where PCIE and VDE clamping masks are
128 * swapped relatively to the partition ids.
129 */
130 if (id == TEGRA_POWERGATE_VDEC)
131 mask = (1 << TEGRA_POWERGATE_PCIE);
132 else if (id == TEGRA_POWERGATE_PCIE)
133 mask = (1 << TEGRA_POWERGATE_VDEC);
134 else
135 mask = (1 << id);
136
137 tegra_pmc_writel(mask, PMC_REMOVE_CLAMPING);
138
139 return 0;
140}
141
142bool tegra_pmc_cpu_is_powered(int cpuid)
143{
144 int id;
145
146 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
147 if (id < 0)
148 return false;
149 return tegra_pmc_powergate_is_powered(id);
150}
151
152int tegra_pmc_cpu_power_on(int cpuid)
153{
154 int id;
155
156 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
157 if (id < 0)
158 return id;
159 return tegra_pmc_powergate_set(id, true);
160}
161
162int tegra_pmc_cpu_remove_clamping(int cpuid)
163{
164 int id;
165
166 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
167 if (id < 0)
168 return id;
169 return tegra_pmc_powergate_remove_clamping(id);
170}
171
172void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
173{
174 u32 val;
175
176 val = tegra_pmc_readl(PMC_SCRATCH0);
177 val &= ~PMC_SCRATCH0_MODE_MASK;
178
179 if (cmd) {
180 if (strcmp(cmd, "recovery") == 0)
181 val |= PMC_SCRATCH0_MODE_RECOVERY;
182
183 if (strcmp(cmd, "bootloader") == 0)
184 val |= PMC_SCRATCH0_MODE_BOOTLOADER;
185
186 if (strcmp(cmd, "forced-recovery") == 0)
187 val |= PMC_SCRATCH0_MODE_RCM;
188 }
189
190 tegra_pmc_writel(val, PMC_SCRATCH0);
191
192 val = tegra_pmc_readl(0);
193 val |= 0x10;
194 tegra_pmc_writel(val, 0);
195}
196
197#ifdef CONFIG_PM_SLEEP
198static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate)
199{
200 unsigned long long ticks;
201 unsigned long long pclk;
202 static unsigned long tegra_last_pclk;
203
204 if (WARN_ON_ONCE(rate <= 0))
205 pclk = 100000000;
206 else
207 pclk = rate;
208
209 if ((rate != tegra_last_pclk)) {
210 ticks = (us_on * pclk) + 999999ull;
211 do_div(ticks, 1000000);
212 tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWRGOOD_TIMER);
213
214 ticks = (us_off * pclk) + 999999ull;
215 do_div(ticks, 1000000);
216 tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWROFF_TIMER);
217 wmb();
218 }
219 tegra_last_pclk = pclk;
220}
221
222enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
223{
224 return pmc_pm_data.suspend_mode;
225}
226
227void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
228{
229 if (mode < TEGRA_SUSPEND_NONE || mode >= TEGRA_MAX_SUSPEND_MODE)
230 return;
231
232 pmc_pm_data.suspend_mode = mode;
233}
234
235void tegra_pmc_suspend(void)
236{
237 tegra_pmc_writel(virt_to_phys(tegra_resume), PMC_SCRATCH41);
238}
239
240void tegra_pmc_resume(void)
241{
242 tegra_pmc_writel(0x0, PMC_SCRATCH41);
243}
244
245void tegra_pmc_pm_set(enum tegra_suspend_mode mode)
246{
247 u32 reg, csr_reg;
248 unsigned long rate = 0;
249
250 reg = tegra_pmc_readl(PMC_CTRL);
251 reg |= TEGRA_POWER_CPU_PWRREQ_OE;
252 reg &= ~TEGRA_POWER_EFFECT_LP0;
253
254 switch (tegra_chip_id) {
255 case TEGRA20:
256 case TEGRA30:
257 break;
258 default:
259 /* Turn off CRAIL */
260 csr_reg = flowctrl_read_cpu_csr(0);
261 csr_reg &= ~FLOW_CTRL_CSR_ENABLE_EXT_MASK;
262 csr_reg |= FLOW_CTRL_CSR_ENABLE_EXT_CRAIL;
263 flowctrl_write_cpu_csr(0, csr_reg);
264 break;
265 }
266
267 switch (mode) {
268 case TEGRA_SUSPEND_LP1:
269 rate = 32768;
270 break;
271 case TEGRA_SUSPEND_LP2:
272 rate = clk_get_rate(tegra_pclk);
273 break;
274 default:
275 break;
276 }
277
278 set_power_timers(pmc_pm_data.cpu_good_time, pmc_pm_data.cpu_off_time,
279 rate);
280
281 tegra_pmc_writel(reg, PMC_CTRL);
282}
283
284void tegra_pmc_suspend_init(void)
285{
286 u32 reg;
287
288 /* Always enable CPU power request */
289 reg = tegra_pmc_readl(PMC_CTRL);
290 reg |= TEGRA_POWER_CPU_PWRREQ_OE;
291 tegra_pmc_writel(reg, PMC_CTRL);
292
293 reg = tegra_pmc_readl(PMC_CTRL);
294
295 if (!pmc_pm_data.sysclkreq_high)
296 reg |= TEGRA_POWER_SYSCLK_POLARITY;
297 else
298 reg &= ~TEGRA_POWER_SYSCLK_POLARITY;
299
300 /* configure the output polarity while the request is tristated */
301 tegra_pmc_writel(reg, PMC_CTRL);
302
303 /* now enable the request */
304 reg |= TEGRA_POWER_SYSCLK_OE;
305 tegra_pmc_writel(reg, PMC_CTRL);
306}
307#endif
308
309static const struct of_device_id matches[] __initconst = {
310 { .compatible = "nvidia,tegra124-pmc" },
311 { .compatible = "nvidia,tegra114-pmc" },
312 { .compatible = "nvidia,tegra30-pmc" },
313 { .compatible = "nvidia,tegra20-pmc" },
314 { }
315};
316
317void __init tegra_pmc_init_irq(void)
318{
319 struct device_node *np;
320 u32 val;
321
322 np = of_find_matching_node(NULL, matches);
323 BUG_ON(!np);
324
325 tegra_pmc_base = of_iomap(np, 0);
326
327 tegra_pmc_invert_interrupt = of_property_read_bool(np,
328 "nvidia,invert-interrupt");
329
330 val = tegra_pmc_readl(PMC_CTRL);
331 if (tegra_pmc_invert_interrupt)
332 val |= PMC_CTRL_INTR_LOW;
333 else
334 val &= ~PMC_CTRL_INTR_LOW;
335 tegra_pmc_writel(val, PMC_CTRL);
336}
337
338void __init tegra_pmc_init(void)
339{
340 struct device_node *np;
341 u32 prop;
342 enum tegra_suspend_mode suspend_mode;
343 u32 core_good_time[2] = {0, 0};
344 u32 lp0_vec[2] = {0, 0};
345
346 np = of_find_matching_node(NULL, matches);
347 BUG_ON(!np);
348
349 tegra_pclk = of_clk_get_by_name(np, "pclk");
350 WARN_ON(IS_ERR(tegra_pclk));
351
352 /* Grabbing the power management configurations */
353 if (of_property_read_u32(np, "nvidia,suspend-mode", &prop)) {
354 suspend_mode = TEGRA_SUSPEND_NONE;
355 } else {
356 switch (prop) {
357 case 0:
358 suspend_mode = TEGRA_SUSPEND_LP0;
359 break;
360 case 1:
361 suspend_mode = TEGRA_SUSPEND_LP1;
362 break;
363 case 2:
364 suspend_mode = TEGRA_SUSPEND_LP2;
365 break;
366 default:
367 suspend_mode = TEGRA_SUSPEND_NONE;
368 break;
369 }
370 }
371 suspend_mode = tegra_pm_validate_suspend_mode(suspend_mode);
372
373 if (of_property_read_u32(np, "nvidia,cpu-pwr-good-time", &prop))
374 suspend_mode = TEGRA_SUSPEND_NONE;
375 pmc_pm_data.cpu_good_time = prop;
376
377 if (of_property_read_u32(np, "nvidia,cpu-pwr-off-time", &prop))
378 suspend_mode = TEGRA_SUSPEND_NONE;
379 pmc_pm_data.cpu_off_time = prop;
380
381 if (of_property_read_u32_array(np, "nvidia,core-pwr-good-time",
382 core_good_time, ARRAY_SIZE(core_good_time)))
383 suspend_mode = TEGRA_SUSPEND_NONE;
384 pmc_pm_data.core_osc_time = core_good_time[0];
385 pmc_pm_data.core_pmu_time = core_good_time[1];
386
387 if (of_property_read_u32(np, "nvidia,core-pwr-off-time",
388 &prop))
389 suspend_mode = TEGRA_SUSPEND_NONE;
390 pmc_pm_data.core_off_time = prop;
391
392 pmc_pm_data.corereq_high = of_property_read_bool(np,
393 "nvidia,core-power-req-active-high");
394
395 pmc_pm_data.sysclkreq_high = of_property_read_bool(np,
396 "nvidia,sys-clock-req-active-high");
397
398 pmc_pm_data.combined_req = of_property_read_bool(np,
399 "nvidia,combined-power-req");
400
401 pmc_pm_data.cpu_pwr_good_en = of_property_read_bool(np,
402 "nvidia,cpu-pwr-good-en");
403
404 if (of_property_read_u32_array(np, "nvidia,lp0-vec", lp0_vec,
405 ARRAY_SIZE(lp0_vec)))
406 if (suspend_mode == TEGRA_SUSPEND_LP0)
407 suspend_mode = TEGRA_SUSPEND_LP1;
408
409 pmc_pm_data.lp0_vec_phy_addr = lp0_vec[0];
410 pmc_pm_data.lp0_vec_size = lp0_vec[1];
411
412 pmc_pm_data.suspend_mode = suspend_mode;
413}
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
deleted file mode 100644
index 59e19c344298..000000000000
--- a/arch/arm/mach-tegra/pmc.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#ifndef __MACH_TEGRA_PMC_H
19#define __MACH_TEGRA_PMC_H
20
21#include <linux/reboot.h>
22
23enum tegra_suspend_mode {
24 TEGRA_SUSPEND_NONE = 0,
25 TEGRA_SUSPEND_LP2, /* CPU voltage off */
26 TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
27 TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
28 TEGRA_MAX_SUSPEND_MODE,
29};
30
31#ifdef CONFIG_PM_SLEEP
32enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
33void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
34void tegra_pmc_suspend(void);
35void tegra_pmc_resume(void);
36void tegra_pmc_pm_set(enum tegra_suspend_mode mode);
37void tegra_pmc_suspend_init(void);
38#endif
39
40bool tegra_pmc_cpu_is_powered(int cpuid);
41int tegra_pmc_cpu_power_on(int cpuid);
42int tegra_pmc_cpu_remove_clamping(int cpuid);
43
44void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
45
46void tegra_pmc_init_irq(void);
47void tegra_pmc_init(void);
48
49#endif
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
deleted file mode 100644
index 4cefc5cd6bed..000000000000
--- a/arch/arm/mach-tegra/powergate.c
+++ /dev/null
@@ -1,515 +0,0 @@
1/*
2 * drivers/powergate/tegra-powergate.c
3 *
4 * Copyright (c) 2010 Google, Inc
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/clk.h>
22#include <linux/debugfs.h>
23#include <linux/delay.h>
24#include <linux/err.h>
25#include <linux/export.h>
26#include <linux/init.h>
27#include <linux/io.h>
28#include <linux/reset.h>
29#include <linux/seq_file.h>
30#include <linux/spinlock.h>
31#include <linux/clk/tegra.h>
32#include <linux/tegra-powergate.h>
33
34#include "fuse.h"
35#include "iomap.h"
36
37#define DPD_SAMPLE 0x020
38#define DPD_SAMPLE_ENABLE (1 << 0)
39#define DPD_SAMPLE_DISABLE (0 << 0)
40
41#define PWRGATE_TOGGLE 0x30
42#define PWRGATE_TOGGLE_START (1 << 8)
43
44#define REMOVE_CLAMPING 0x34
45
46#define PWRGATE_STATUS 0x38
47
48#define IO_DPD_REQ 0x1b8
49#define IO_DPD_REQ_CODE_IDLE (0 << 30)
50#define IO_DPD_REQ_CODE_OFF (1 << 30)
51#define IO_DPD_REQ_CODE_ON (2 << 30)
52#define IO_DPD_REQ_CODE_MASK (3 << 30)
53
54#define IO_DPD_STATUS 0x1bc
55#define IO_DPD2_REQ 0x1c0
56#define IO_DPD2_STATUS 0x1c4
57#define SEL_DPD_TIM 0x1c8
58
59#define GPU_RG_CNTRL 0x2d4
60
61static int tegra_num_powerdomains;
62static int tegra_num_cpu_domains;
63static const u8 *tegra_cpu_domains;
64
65static const u8 tegra30_cpu_domains[] = {
66 TEGRA_POWERGATE_CPU,
67 TEGRA_POWERGATE_CPU1,
68 TEGRA_POWERGATE_CPU2,
69 TEGRA_POWERGATE_CPU3,
70};
71
72static const u8 tegra114_cpu_domains[] = {
73 TEGRA_POWERGATE_CPU0,
74 TEGRA_POWERGATE_CPU1,
75 TEGRA_POWERGATE_CPU2,
76 TEGRA_POWERGATE_CPU3,
77};
78
79static const u8 tegra124_cpu_domains[] = {
80 TEGRA_POWERGATE_CPU0,
81 TEGRA_POWERGATE_CPU1,
82 TEGRA_POWERGATE_CPU2,
83 TEGRA_POWERGATE_CPU3,
84};
85
86static DEFINE_SPINLOCK(tegra_powergate_lock);
87
88static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
89
90static u32 pmc_read(unsigned long reg)
91{
92 return readl(pmc + reg);
93}
94
95static void pmc_write(u32 val, unsigned long reg)
96{
97 writel(val, pmc + reg);
98}
99
100static int tegra_powergate_set(int id, bool new_state)
101{
102 bool status;
103 unsigned long flags;
104
105 spin_lock_irqsave(&tegra_powergate_lock, flags);
106
107 status = pmc_read(PWRGATE_STATUS) & (1 << id);
108
109 if (status == new_state) {
110 spin_unlock_irqrestore(&tegra_powergate_lock, flags);
111 return 0;
112 }
113
114 pmc_write(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE);
115
116 spin_unlock_irqrestore(&tegra_powergate_lock, flags);
117
118 return 0;
119}
120
121int tegra_powergate_power_on(int id)
122{
123 if (id < 0 || id >= tegra_num_powerdomains)
124 return -EINVAL;
125
126 return tegra_powergate_set(id, true);
127}
128
129int tegra_powergate_power_off(int id)
130{
131 if (id < 0 || id >= tegra_num_powerdomains)
132 return -EINVAL;
133
134 return tegra_powergate_set(id, false);
135}
136EXPORT_SYMBOL(tegra_powergate_power_off);
137
138int tegra_powergate_is_powered(int id)
139{
140 u32 status;
141
142 if (id < 0 || id >= tegra_num_powerdomains)
143 return -EINVAL;
144
145 status = pmc_read(PWRGATE_STATUS) & (1 << id);
146 return !!status;
147}
148
149int tegra_powergate_remove_clamping(int id)
150{
151 u32 mask;
152
153 if (id < 0 || id >= tegra_num_powerdomains)
154 return -EINVAL;
155
156 /*
157 * The Tegra124 GPU has a separate register (with different semantics)
158 * to remove clamps.
159 */
160 if (tegra_chip_id == TEGRA124) {
161 if (id == TEGRA_POWERGATE_3D) {
162 pmc_write(0, GPU_RG_CNTRL);
163 return 0;
164 }
165 }
166
167 /*
168 * Tegra 2 has a bug where PCIE and VDE clamping masks are
169 * swapped relatively to the partition ids
170 */
171 if (id == TEGRA_POWERGATE_VDEC)
172 mask = (1 << TEGRA_POWERGATE_PCIE);
173 else if (id == TEGRA_POWERGATE_PCIE)
174 mask = (1 << TEGRA_POWERGATE_VDEC);
175 else
176 mask = (1 << id);
177
178 pmc_write(mask, REMOVE_CLAMPING);
179
180 return 0;
181}
182EXPORT_SYMBOL(tegra_powergate_remove_clamping);
183
184/* Must be called with clk disabled, and returns with clk enabled */
185int tegra_powergate_sequence_power_up(int id, struct clk *clk,
186 struct reset_control *rst)
187{
188 int ret;
189
190 reset_control_assert(rst);
191
192 ret = tegra_powergate_power_on(id);
193 if (ret)
194 goto err_power;
195
196 ret = clk_prepare_enable(clk);
197 if (ret)
198 goto err_clk;
199
200 udelay(10);
201
202 ret = tegra_powergate_remove_clamping(id);
203 if (ret)
204 goto err_clamp;
205
206 udelay(10);
207 reset_control_deassert(rst);
208
209 return 0;
210
211err_clamp:
212 clk_disable_unprepare(clk);
213err_clk:
214 tegra_powergate_power_off(id);
215err_power:
216 return ret;
217}
218EXPORT_SYMBOL(tegra_powergate_sequence_power_up);
219
220int tegra_cpu_powergate_id(int cpuid)
221{
222 if (cpuid > 0 && cpuid < tegra_num_cpu_domains)
223 return tegra_cpu_domains[cpuid];
224
225 return -EINVAL;
226}
227
228int __init tegra_powergate_init(void)
229{
230 switch (tegra_chip_id) {
231 case TEGRA20:
232 tegra_num_powerdomains = 7;
233 break;
234 case TEGRA30:
235 tegra_num_powerdomains = 14;
236 tegra_num_cpu_domains = 4;
237 tegra_cpu_domains = tegra30_cpu_domains;
238 break;
239 case TEGRA114:
240 tegra_num_powerdomains = 23;
241 tegra_num_cpu_domains = 4;
242 tegra_cpu_domains = tegra114_cpu_domains;
243 break;
244 case TEGRA124:
245 tegra_num_powerdomains = 25;
246 tegra_num_cpu_domains = 4;
247 tegra_cpu_domains = tegra124_cpu_domains;
248 break;
249 default:
250 /* Unknown Tegra variant. Disable powergating */
251 tegra_num_powerdomains = 0;
252 break;
253 }
254
255 return 0;
256}
257
258#ifdef CONFIG_DEBUG_FS
259
260static const char * const *powergate_name;
261
262static const char * const powergate_name_t20[] = {
263 [TEGRA_POWERGATE_CPU] = "cpu",
264 [TEGRA_POWERGATE_3D] = "3d",
265 [TEGRA_POWERGATE_VENC] = "venc",
266 [TEGRA_POWERGATE_VDEC] = "vdec",
267 [TEGRA_POWERGATE_PCIE] = "pcie",
268 [TEGRA_POWERGATE_L2] = "l2",
269 [TEGRA_POWERGATE_MPE] = "mpe",
270};
271
272static const char * const powergate_name_t30[] = {
273 [TEGRA_POWERGATE_CPU] = "cpu0",
274 [TEGRA_POWERGATE_3D] = "3d0",
275 [TEGRA_POWERGATE_VENC] = "venc",
276 [TEGRA_POWERGATE_VDEC] = "vdec",
277 [TEGRA_POWERGATE_PCIE] = "pcie",
278 [TEGRA_POWERGATE_L2] = "l2",
279 [TEGRA_POWERGATE_MPE] = "mpe",
280 [TEGRA_POWERGATE_HEG] = "heg",
281 [TEGRA_POWERGATE_SATA] = "sata",
282 [TEGRA_POWERGATE_CPU1] = "cpu1",
283 [TEGRA_POWERGATE_CPU2] = "cpu2",
284 [TEGRA_POWERGATE_CPU3] = "cpu3",
285 [TEGRA_POWERGATE_CELP] = "celp",
286 [TEGRA_POWERGATE_3D1] = "3d1",
287};
288
289static const char * const powergate_name_t114[] = {
290 [TEGRA_POWERGATE_CPU] = "crail",
291 [TEGRA_POWERGATE_3D] = "3d",
292 [TEGRA_POWERGATE_VENC] = "venc",
293 [TEGRA_POWERGATE_VDEC] = "vdec",
294 [TEGRA_POWERGATE_MPE] = "mpe",
295 [TEGRA_POWERGATE_HEG] = "heg",
296 [TEGRA_POWERGATE_CPU1] = "cpu1",
297 [TEGRA_POWERGATE_CPU2] = "cpu2",
298 [TEGRA_POWERGATE_CPU3] = "cpu3",
299 [TEGRA_POWERGATE_CELP] = "celp",
300 [TEGRA_POWERGATE_CPU0] = "cpu0",
301 [TEGRA_POWERGATE_C0NC] = "c0nc",
302 [TEGRA_POWERGATE_C1NC] = "c1nc",
303 [TEGRA_POWERGATE_DIS] = "dis",
304 [TEGRA_POWERGATE_DISB] = "disb",
305 [TEGRA_POWERGATE_XUSBA] = "xusba",
306 [TEGRA_POWERGATE_XUSBB] = "xusbb",
307 [TEGRA_POWERGATE_XUSBC] = "xusbc",
308};
309
310static const char * const powergate_name_t124[] = {
311 [TEGRA_POWERGATE_CPU] = "crail",
312 [TEGRA_POWERGATE_3D] = "3d",
313 [TEGRA_POWERGATE_VENC] = "venc",
314 [TEGRA_POWERGATE_PCIE] = "pcie",
315 [TEGRA_POWERGATE_VDEC] = "vdec",
316 [TEGRA_POWERGATE_L2] = "l2",
317 [TEGRA_POWERGATE_MPE] = "mpe",
318 [TEGRA_POWERGATE_HEG] = "heg",
319 [TEGRA_POWERGATE_SATA] = "sata",
320 [TEGRA_POWERGATE_CPU1] = "cpu1",
321 [TEGRA_POWERGATE_CPU2] = "cpu2",
322 [TEGRA_POWERGATE_CPU3] = "cpu3",
323 [TEGRA_POWERGATE_CELP] = "celp",
324 [TEGRA_POWERGATE_CPU0] = "cpu0",
325 [TEGRA_POWERGATE_C0NC] = "c0nc",
326 [TEGRA_POWERGATE_C1NC] = "c1nc",
327 [TEGRA_POWERGATE_SOR] = "sor",
328 [TEGRA_POWERGATE_DIS] = "dis",
329 [TEGRA_POWERGATE_DISB] = "disb",
330 [TEGRA_POWERGATE_XUSBA] = "xusba",
331 [TEGRA_POWERGATE_XUSBB] = "xusbb",
332 [TEGRA_POWERGATE_XUSBC] = "xusbc",
333 [TEGRA_POWERGATE_VIC] = "vic",
334 [TEGRA_POWERGATE_IRAM] = "iram",
335};
336
337static int powergate_show(struct seq_file *s, void *data)
338{
339 int i;
340
341 seq_printf(s, " powergate powered\n");
342 seq_printf(s, "------------------\n");
343
344 for (i = 0; i < tegra_num_powerdomains; i++) {
345 if (!powergate_name[i])
346 continue;
347
348 seq_printf(s, " %9s %7s\n", powergate_name[i],
349 tegra_powergate_is_powered(i) ? "yes" : "no");
350 }
351
352 return 0;
353}
354
355static int powergate_open(struct inode *inode, struct file *file)
356{
357 return single_open(file, powergate_show, inode->i_private);
358}
359
360static const struct file_operations powergate_fops = {
361 .open = powergate_open,
362 .read = seq_read,
363 .llseek = seq_lseek,
364 .release = single_release,
365};
366
367int __init tegra_powergate_debugfs_init(void)
368{
369 struct dentry *d;
370
371 switch (tegra_chip_id) {
372 case TEGRA20:
373 powergate_name = powergate_name_t20;
374 break;
375 case TEGRA30:
376 powergate_name = powergate_name_t30;
377 break;
378 case TEGRA114:
379 powergate_name = powergate_name_t114;
380 break;
381 case TEGRA124:
382 powergate_name = powergate_name_t124;
383 break;
384 }
385
386 if (powergate_name) {
387 d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL,
388 &powergate_fops);
389 if (!d)
390 return -ENOMEM;
391 }
392
393 return 0;
394}
395
396#endif
397
398static int tegra_io_rail_prepare(int id, unsigned long *request,
399 unsigned long *status, unsigned int *bit)
400{
401 unsigned long rate, value;
402 struct clk *clk;
403
404 *bit = id % 32;
405
406 /*
407 * There are two sets of 30 bits to select IO rails, but bits 30 and
408 * 31 are control bits rather than IO rail selection bits.
409 */
410 if (id > 63 || *bit == 30 || *bit == 31)
411 return -EINVAL;
412
413 if (id < 32) {
414 *status = IO_DPD_STATUS;
415 *request = IO_DPD_REQ;
416 } else {
417 *status = IO_DPD2_STATUS;
418 *request = IO_DPD2_REQ;
419 }
420
421 clk = clk_get_sys(NULL, "pclk");
422 if (IS_ERR(clk))
423 return PTR_ERR(clk);
424
425 rate = clk_get_rate(clk);
426 clk_put(clk);
427
428 pmc_write(DPD_SAMPLE_ENABLE, DPD_SAMPLE);
429
430 /* must be at least 200 ns, in APB (PCLK) clock cycles */
431 value = DIV_ROUND_UP(1000000000, rate);
432 value = DIV_ROUND_UP(200, value);
433 pmc_write(value, SEL_DPD_TIM);
434
435 return 0;
436}
437
438static int tegra_io_rail_poll(unsigned long offset, unsigned long mask,
439 unsigned long val, unsigned long timeout)
440{
441 unsigned long value;
442
443 timeout = jiffies + msecs_to_jiffies(timeout);
444
445 while (time_after(timeout, jiffies)) {
446 value = pmc_read(offset);
447 if ((value & mask) == val)
448 return 0;
449
450 usleep_range(250, 1000);
451 }
452
453 return -ETIMEDOUT;
454}
455
456static void tegra_io_rail_unprepare(void)
457{
458 pmc_write(DPD_SAMPLE_DISABLE, DPD_SAMPLE);
459}
460
461int tegra_io_rail_power_on(int id)
462{
463 unsigned long request, status, value;
464 unsigned int bit, mask;
465 int err;
466
467 err = tegra_io_rail_prepare(id, &request, &status, &bit);
468 if (err < 0)
469 return err;
470
471 mask = 1 << bit;
472
473 value = pmc_read(request);
474 value |= mask;
475 value &= ~IO_DPD_REQ_CODE_MASK;
476 value |= IO_DPD_REQ_CODE_OFF;
477 pmc_write(value, request);
478
479 err = tegra_io_rail_poll(status, mask, 0, 250);
480 if (err < 0)
481 return err;
482
483 tegra_io_rail_unprepare();
484
485 return 0;
486}
487EXPORT_SYMBOL(tegra_io_rail_power_on);
488
489int tegra_io_rail_power_off(int id)
490{
491 unsigned long request, status, value;
492 unsigned int bit, mask;
493 int err;
494
495 err = tegra_io_rail_prepare(id, &request, &status, &bit);
496 if (err < 0)
497 return err;
498
499 mask = 1 << bit;
500
501 value = pmc_read(request);
502 value |= mask;
503 value &= ~IO_DPD_REQ_CODE_MASK;
504 value |= IO_DPD_REQ_CODE_ON;
505 pmc_write(value, request);
506
507 err = tegra_io_rail_poll(status, mask, mask, 250);
508 if (err < 0)
509 return err;
510
511 tegra_io_rail_unprepare();
512
513 return 0;
514}
515EXPORT_SYMBOL(tegra_io_rail_power_off);
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index 578d4d1ad648..7b2baab0f0bd 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -14,14 +14,15 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include <linux/linkage.h>
18#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/linkage.h>
19
20#include <soc/tegra/fuse.h>
19 21
20#include <asm/cache.h>
21#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/cache.h>
22 24
23#include "flowctrl.h" 25#include "flowctrl.h"
24#include "fuse.h"
25#include "iomap.h" 26#include "iomap.h"
26#include "reset.h" 27#include "reset.h"
27#include "sleep.h" 28#include "sleep.h"
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 146fe8e0ae7c..894c5c472184 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -14,20 +14,21 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/bitops.h>
18#include <linux/cpumask.h>
17#include <linux/init.h> 19#include <linux/init.h>
18#include <linux/io.h> 20#include <linux/io.h>
19#include <linux/cpumask.h> 21
20#include <linux/bitops.h> 22#include <soc/tegra/fuse.h>
21 23
22#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
23#include <asm/hardware/cache-l2x0.h>
24#include <asm/firmware.h> 25#include <asm/firmware.h>
26#include <asm/hardware/cache-l2x0.h>
25 27
26#include "iomap.h" 28#include "iomap.h"
27#include "irammap.h" 29#include "irammap.h"
28#include "reset.h" 30#include "reset.h"
29#include "sleep.h" 31#include "sleep.h"
30#include "fuse.h"
31 32
32#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \ 33#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \
33 TEGRA_IRAM_RESET_HANDLER_OFFSET) 34 TEGRA_IRAM_RESET_HANDLER_OFFSET)
@@ -53,12 +54,10 @@ static void __init tegra_cpu_reset_handler_set(const u32 reset_address)
53 * Prevent further modifications to the physical reset vector. 54 * Prevent further modifications to the physical reset vector.
54 * NOTE: Has no effect on chips prior to Tegra30. 55 * NOTE: Has no effect on chips prior to Tegra30.
55 */ 56 */
56 if (tegra_chip_id != TEGRA20) { 57 reg = readl(sb_ctrl);
57 reg = readl(sb_ctrl); 58 reg |= 2;
58 reg |= 2; 59 writel(reg, sb_ctrl);
59 writel(reg, sb_ctrl); 60 wmb();
60 wmb();
61 }
62} 61}
63 62
64static void __init tegra_cpu_reset_handler_enable(void) 63static void __init tegra_cpu_reset_handler_enable(void)
diff --git a/arch/arm/mach-tegra/sleep-tegra20.S b/arch/arm/mach-tegra/sleep-tegra20.S
index aaaf3abd2688..be4bc5f853f5 100644
--- a/arch/arm/mach-tegra/sleep-tegra20.S
+++ b/arch/arm/mach-tegra/sleep-tegra20.S
@@ -78,7 +78,7 @@ ENTRY(tegra20_hotplug_shutdown)
78 /* Put this CPU down */ 78 /* Put this CPU down */
79 cpu_id r0 79 cpu_id r0
80 bl tegra20_cpu_shutdown 80 bl tegra20_cpu_shutdown
81 mov pc, lr @ should never get here 81 ret lr @ should never get here
82ENDPROC(tegra20_hotplug_shutdown) 82ENDPROC(tegra20_hotplug_shutdown)
83 83
84/* 84/*
@@ -96,7 +96,7 @@ ENDPROC(tegra20_hotplug_shutdown)
96 */ 96 */
97ENTRY(tegra20_cpu_shutdown) 97ENTRY(tegra20_cpu_shutdown)
98 cmp r0, #0 98 cmp r0, #0
99 moveq pc, lr @ must not be called for CPU 0 99 reteq lr @ must not be called for CPU 0
100 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41 100 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41
101 mov r12, #CPU_RESETTABLE 101 mov r12, #CPU_RESETTABLE
102 str r12, [r1] 102 str r12, [r1]
@@ -117,7 +117,7 @@ ENTRY(tegra20_cpu_shutdown)
117 cpu_id r3 117 cpu_id r3
118 cmp r3, r0 118 cmp r3, r0
119 beq . 119 beq .
120 mov pc, lr 120 ret lr
121ENDPROC(tegra20_cpu_shutdown) 121ENDPROC(tegra20_cpu_shutdown)
122#endif 122#endif
123 123
@@ -164,7 +164,7 @@ ENTRY(tegra_pen_lock)
164 cmpeq r12, r0 @ !turn == cpu? 164 cmpeq r12, r0 @ !turn == cpu?
165 beq 1b @ while !turn == cpu && flag[!cpu] == 1 165 beq 1b @ while !turn == cpu && flag[!cpu] == 1
166 166
167 mov pc, lr @ locked 167 ret lr @ locked
168ENDPROC(tegra_pen_lock) 168ENDPROC(tegra_pen_lock)
169 169
170ENTRY(tegra_pen_unlock) 170ENTRY(tegra_pen_unlock)
@@ -176,7 +176,7 @@ ENTRY(tegra_pen_unlock)
176 addne r2, r3, #PMC_SCRATCH39 176 addne r2, r3, #PMC_SCRATCH39
177 mov r12, #0 177 mov r12, #0
178 str r12, [r2] 178 str r12, [r2]
179 mov pc, lr 179 ret lr
180ENDPROC(tegra_pen_unlock) 180ENDPROC(tegra_pen_unlock)
181 181
182/* 182/*
@@ -189,7 +189,7 @@ ENTRY(tegra20_cpu_clear_resettable)
189 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41 189 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41
190 mov r12, #CPU_NOT_RESETTABLE 190 mov r12, #CPU_NOT_RESETTABLE
191 str r12, [r1] 191 str r12, [r1]
192 mov pc, lr 192 ret lr
193ENDPROC(tegra20_cpu_clear_resettable) 193ENDPROC(tegra20_cpu_clear_resettable)
194 194
195/* 195/*
@@ -202,7 +202,7 @@ ENTRY(tegra20_cpu_set_resettable_soon)
202 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41 202 mov32 r1, TEGRA_PMC_VIRT + PMC_SCRATCH41
203 mov r12, #CPU_RESETTABLE_SOON 203 mov r12, #CPU_RESETTABLE_SOON
204 str r12, [r1] 204 str r12, [r1]
205 mov pc, lr 205 ret lr
206ENDPROC(tegra20_cpu_set_resettable_soon) 206ENDPROC(tegra20_cpu_set_resettable_soon)
207 207
208/* 208/*
@@ -217,7 +217,7 @@ ENTRY(tegra20_cpu_is_resettable_soon)
217 cmp r12, #CPU_RESETTABLE_SOON 217 cmp r12, #CPU_RESETTABLE_SOON
218 moveq r0, #1 218 moveq r0, #1
219 movne r0, #0 219 movne r0, #0
220 mov pc, lr 220 ret lr
221ENDPROC(tegra20_cpu_is_resettable_soon) 221ENDPROC(tegra20_cpu_is_resettable_soon)
222 222
223/* 223/*
@@ -239,7 +239,7 @@ ENTRY(tegra20_sleep_core_finish)
239 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA 239 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA
240 add r0, r0, r1 240 add r0, r0, r1
241 241
242 mov pc, r3 242 ret r3
243ENDPROC(tegra20_sleep_core_finish) 243ENDPROC(tegra20_sleep_core_finish)
244 244
245/* 245/*
@@ -402,7 +402,7 @@ exit_selfrefresh_loop:
402 402
403 mov32 r0, TEGRA_PMC_BASE 403 mov32 r0, TEGRA_PMC_BASE
404 ldr r0, [r0, #PMC_SCRATCH41] 404 ldr r0, [r0, #PMC_SCRATCH41]
405 mov pc, r0 @ jump to tegra_resume 405 ret r0 @ jump to tegra_resume
406ENDPROC(tegra20_lp1_reset) 406ENDPROC(tegra20_lp1_reset)
407 407
408/* 408/*
@@ -455,7 +455,7 @@ tegra20_switch_cpu_to_clk32k:
455 mov r0, #0 /* brust policy = 32KHz */ 455 mov r0, #0 /* brust policy = 32KHz */
456 str r0, [r5, #CLK_RESET_SCLK_BURST] 456 str r0, [r5, #CLK_RESET_SCLK_BURST]
457 457
458 mov pc, lr 458 ret lr
459 459
460/* 460/*
461 * tegra20_enter_sleep 461 * tegra20_enter_sleep
@@ -535,7 +535,7 @@ padsave_done:
535 adr r2, tegra20_sclk_save 535 adr r2, tegra20_sclk_save
536 str r0, [r2] 536 str r0, [r2]
537 dsb 537 dsb
538 mov pc, lr 538 ret lr
539 539
540tegra20_sdram_pad_address: 540tegra20_sdram_pad_address:
541 .word TEGRA_APB_MISC_BASE + APB_MISC_XM2CFGCPADCTRL 541 .word TEGRA_APB_MISC_BASE + APB_MISC_XM2CFGCPADCTRL
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index b16d4a57fa59..5d8d13aeab93 100644
--- a/arch/arm/mach-tegra/sleep-tegra30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -16,14 +16,15 @@
16 16
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18 18
19#include <asm/assembler.h> 19#include <soc/tegra/fuse.h>
20
20#include <asm/asm-offsets.h> 21#include <asm/asm-offsets.h>
22#include <asm/assembler.h>
21#include <asm/cache.h> 23#include <asm/cache.h>
22 24
25#include "flowctrl.h"
23#include "irammap.h" 26#include "irammap.h"
24#include "fuse.h"
25#include "sleep.h" 27#include "sleep.h"
26#include "flowctrl.h"
27 28
28#define EMC_CFG 0xc 29#define EMC_CFG 0xc
29#define EMC_ADR_CFG 0x10 30#define EMC_ADR_CFG 0x10
@@ -142,7 +143,7 @@ ENTRY(tegra30_hotplug_shutdown)
142 /* Powergate this CPU */ 143 /* Powergate this CPU */
143 mov r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN 144 mov r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN
144 bl tegra30_cpu_shutdown 145 bl tegra30_cpu_shutdown
145 mov pc, lr @ should never get here 146 ret lr @ should never get here
146ENDPROC(tegra30_hotplug_shutdown) 147ENDPROC(tegra30_hotplug_shutdown)
147 148
148/* 149/*
@@ -161,7 +162,7 @@ ENTRY(tegra30_cpu_shutdown)
161 bne _no_cpu0_chk @ It's not Tegra30 162 bne _no_cpu0_chk @ It's not Tegra30
162 163
163 cmp r3, #0 164 cmp r3, #0
164 moveq pc, lr @ Must never be called for CPU 0 165 reteq lr @ Must never be called for CPU 0
165_no_cpu0_chk: 166_no_cpu0_chk:
166 167
167 ldr r12, =TEGRA_FLOW_CTRL_VIRT 168 ldr r12, =TEGRA_FLOW_CTRL_VIRT
@@ -266,7 +267,7 @@ ENTRY(tegra30_sleep_core_finish)
266 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA 267 mov32 r1, TEGRA_IRAM_LPx_RESUME_AREA
267 add r0, r0, r1 268 add r0, r0, r1
268 269
269 mov pc, r3 270 ret r3
270ENDPROC(tegra30_sleep_core_finish) 271ENDPROC(tegra30_sleep_core_finish)
271 272
272/* 273/*
@@ -285,7 +286,7 @@ ENTRY(tegra30_sleep_cpu_secondary_finish)
285 mov r0, #0 @ power mode flags (!hotplug) 286 mov r0, #0 @ power mode flags (!hotplug)
286 bl tegra30_cpu_shutdown 287 bl tegra30_cpu_shutdown
287 mov r0, #1 @ never return here 288 mov r0, #1 @ never return here
288 mov pc, r7 289 ret r7
289ENDPROC(tegra30_sleep_cpu_secondary_finish) 290ENDPROC(tegra30_sleep_cpu_secondary_finish)
290 291
291/* 292/*
@@ -529,7 +530,7 @@ __no_dual_emc_chanl:
529 530
530 mov32 r0, TEGRA_PMC_BASE 531 mov32 r0, TEGRA_PMC_BASE
531 ldr r0, [r0, #PMC_SCRATCH41] 532 ldr r0, [r0, #PMC_SCRATCH41]
532 mov pc, r0 @ jump to tegra_resume 533 ret r0 @ jump to tegra_resume
533ENDPROC(tegra30_lp1_reset) 534ENDPROC(tegra30_lp1_reset)
534 535
535 .align L1_CACHE_SHIFT 536 .align L1_CACHE_SHIFT
@@ -659,7 +660,7 @@ _no_pll_in_iddq:
659 mov r0, #0 /* brust policy = 32KHz */ 660 mov r0, #0 /* brust policy = 32KHz */
660 str r0, [r5, #CLK_RESET_SCLK_BURST] 661 str r0, [r5, #CLK_RESET_SCLK_BURST]
661 662
662 mov pc, lr 663 ret lr
663 664
664/* 665/*
665 * tegra30_enter_sleep 666 * tegra30_enter_sleep
@@ -819,7 +820,7 @@ pmc_io_dpd_skip:
819 820
820 dsb 821 dsb
821 822
822 mov pc, lr 823 ret lr
823 824
824 .ltorg 825 .ltorg
825/* dummy symbol for end of IRAM */ 826/* dummy symbol for end of IRAM */
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S
index 8d06213fbc47..f024a5109e8e 100644
--- a/arch/arm/mach-tegra/sleep.S
+++ b/arch/arm/mach-tegra/sleep.S
@@ -87,7 +87,7 @@ ENTRY(tegra_init_l2_for_a15)
87 mcrne p15, 0x1, r0, c9, c0, 2 87 mcrne p15, 0x1, r0, c9, c0, 2
88_exit_init_l2_a15: 88_exit_init_l2_a15:
89 89
90 mov pc, lr 90 ret lr
91ENDPROC(tegra_init_l2_for_a15) 91ENDPROC(tegra_init_l2_for_a15)
92 92
93/* 93/*
@@ -111,7 +111,7 @@ ENTRY(tegra_sleep_cpu_finish)
111 add r3, r3, r0 111 add r3, r3, r0
112 mov r0, r1 112 mov r0, r1
113 113
114 mov pc, r3 114 ret r3
115ENDPROC(tegra_sleep_cpu_finish) 115ENDPROC(tegra_sleep_cpu_finish)
116 116
117/* 117/*
@@ -139,7 +139,7 @@ ENTRY(tegra_shut_off_mmu)
139 moveq r3, #0 139 moveq r3, #0
140 streq r3, [r2, #L2X0_CTRL] 140 streq r3, [r2, #L2X0_CTRL]
141#endif 141#endif
142 mov pc, r0 142 ret r0
143ENDPROC(tegra_shut_off_mmu) 143ENDPROC(tegra_shut_off_mmu)
144 .popsection 144 .popsection
145 145
@@ -156,6 +156,6 @@ ENTRY(tegra_switch_cpu_to_pllp)
156 str r0, [r5, #CLK_RESET_CCLK_BURST] 156 str r0, [r5, #CLK_RESET_CCLK_BURST]
157 mov r0, #0 157 mov r0, #0
158 str r0, [r5, #CLK_RESET_CCLK_DIVIDER] 158 str r0, [r5, #CLK_RESET_CCLK_DIVIDER]
159 mov pc, lr 159 ret lr
160ENDPROC(tegra_switch_cpu_to_pllp) 160ENDPROC(tegra_switch_cpu_to_pllp)
161#endif 161#endif
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index 339fe42cd6fb..92d46ec1361a 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -130,9 +130,6 @@ void tegra_disable_clean_inv_dcache(u32 flag);
130#ifdef CONFIG_HOTPLUG_CPU 130#ifdef CONFIG_HOTPLUG_CPU
131void tegra20_hotplug_shutdown(void); 131void tegra20_hotplug_shutdown(void);
132void tegra30_hotplug_shutdown(void); 132void tegra30_hotplug_shutdown(void);
133void tegra_hotplug_init(void);
134#else
135static inline void tegra_hotplug_init(void) {}
136#endif 133#endif
137 134
138void tegra20_cpu_shutdown(int cpu); 135void tegra20_cpu_shutdown(int cpu);
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 15ac9fcc96b1..5ef5173dec83 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -16,40 +16,40 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/serial_8250.h>
23#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/clk/tegra.h>
24#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/irqchip.h>
25#include <linux/irqdomain.h> 25#include <linux/irqdomain.h>
26#include <linux/of.h> 26#include <linux/kernel.h>
27#include <linux/of_address.h> 27#include <linux/of_address.h>
28#include <linux/of_fdt.h> 28#include <linux/of_fdt.h>
29#include <linux/of.h>
29#include <linux/of_platform.h> 30#include <linux/of_platform.h>
30#include <linux/pda_power.h> 31#include <linux/pda_power.h>
31#include <linux/io.h> 32#include <linux/platform_device.h>
33#include <linux/serial_8250.h>
32#include <linux/slab.h> 34#include <linux/slab.h>
33#include <linux/sys_soc.h> 35#include <linux/sys_soc.h>
34#include <linux/usb/tegra_usb_phy.h> 36#include <linux/usb/tegra_usb_phy.h>
35#include <linux/clk/tegra.h> 37
36#include <linux/irqchip.h> 38#include <soc/tegra/fuse.h>
39#include <soc/tegra/pmc.h>
37 40
38#include <asm/hardware/cache-l2x0.h> 41#include <asm/hardware/cache-l2x0.h>
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
41#include <asm/mach/time.h> 43#include <asm/mach/time.h>
44#include <asm/mach-types.h>
42#include <asm/setup.h> 45#include <asm/setup.h>
43#include <asm/trusted_foundations.h> 46#include <asm/trusted_foundations.h>
44 47
45#include "apbio.h"
46#include "board.h" 48#include "board.h"
47#include "common.h" 49#include "common.h"
48#include "cpuidle.h" 50#include "cpuidle.h"
49#include "fuse.h"
50#include "iomap.h" 51#include "iomap.h"
51#include "irq.h" 52#include "irq.h"
52#include "pmc.h"
53#include "pm.h" 53#include "pm.h"
54#include "reset.h" 54#include "reset.h"
55#include "sleep.h" 55#include "sleep.h"
@@ -73,16 +73,11 @@ u32 tegra_uart_config[3] = {
73static void __init tegra_init_early(void) 73static void __init tegra_init_early(void)
74{ 74{
75 of_register_trusted_foundations(); 75 of_register_trusted_foundations();
76 tegra_apb_io_init();
77 tegra_init_fuse();
78 tegra_cpu_reset_handler_init(); 76 tegra_cpu_reset_handler_init();
79 tegra_powergate_init();
80 tegra_hotplug_init();
81} 77}
82 78
83static void __init tegra_dt_init_irq(void) 79static void __init tegra_dt_init_irq(void)
84{ 80{
85 tegra_pmc_init_irq();
86 tegra_init_irq(); 81 tegra_init_irq();
87 irqchip_init(); 82 irqchip_init();
88 tegra_legacy_irq_syscore_init(); 83 tegra_legacy_irq_syscore_init();
@@ -94,8 +89,6 @@ static void __init tegra_dt_init(void)
94 struct soc_device *soc_dev; 89 struct soc_device *soc_dev;
95 struct device *parent = NULL; 90 struct device *parent = NULL;
96 91
97 tegra_pmc_init();
98
99 tegra_clocks_apply_init_table(); 92 tegra_clocks_apply_init_table();
100 93
101 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 94 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
@@ -103,8 +96,9 @@ static void __init tegra_dt_init(void)
103 goto out; 96 goto out;
104 97
105 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra"); 98 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
106 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_revision); 99 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
107 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%d", tegra_chip_id); 100 tegra_sku_info.revision);
101 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
108 102
109 soc_dev = soc_device_register(soc_dev_attr); 103 soc_dev = soc_device_register(soc_dev_attr);
110 if (IS_ERR(soc_dev)) { 104 if (IS_ERR(soc_dev)) {
@@ -144,7 +138,6 @@ static void __init tegra_dt_init_late(void)
144 138
145 tegra_init_suspend(); 139 tegra_init_suspend();
146 tegra_cpuidle_init(); 140 tegra_cpuidle_init();
147 tegra_powergate_debugfs_init();
148 141
149 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) { 142 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
150 if (of_machine_is_compatible(board_init_funcs[i].machine)) { 143 if (of_machine_is_compatible(board_init_funcs[i].machine)) {
diff --git a/arch/arm/mach-tegra/tegra114_speedo.c b/arch/arm/mach-tegra/tegra114_speedo.c
deleted file mode 100644
index 5218d4853cd3..000000000000
--- a/arch/arm/mach-tegra/tegra114_speedo.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CORE_PROCESS_CORNERS_NUM 2
23#define CPU_PROCESS_CORNERS_NUM 2
24
25enum {
26 THRESHOLD_INDEX_0,
27 THRESHOLD_INDEX_1,
28 THRESHOLD_INDEX_COUNT,
29};
30
31static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = {
32 {1123, UINT_MAX},
33 {0, UINT_MAX},
34};
35
36static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = {
37 {1695, UINT_MAX},
38 {0, UINT_MAX},
39};
40
41static void rev_sku_to_speedo_ids(int rev, int sku, int *threshold)
42{
43 u32 tmp;
44
45 switch (sku) {
46 case 0x00:
47 case 0x10:
48 case 0x05:
49 case 0x06:
50 tegra_cpu_speedo_id = 1;
51 tegra_soc_speedo_id = 0;
52 *threshold = THRESHOLD_INDEX_0;
53 break;
54
55 case 0x03:
56 case 0x04:
57 tegra_cpu_speedo_id = 2;
58 tegra_soc_speedo_id = 1;
59 *threshold = THRESHOLD_INDEX_1;
60 break;
61
62 default:
63 pr_err("Tegra114 Unknown SKU %d\n", sku);
64 tegra_cpu_speedo_id = 0;
65 tegra_soc_speedo_id = 0;
66 *threshold = THRESHOLD_INDEX_0;
67 break;
68 }
69
70 if (rev == TEGRA_REVISION_A01) {
71 tmp = tegra_fuse_readl(0x270) << 1;
72 tmp |= tegra_fuse_readl(0x26c);
73 if (!tmp)
74 tegra_cpu_speedo_id = 0;
75 }
76}
77
78void tegra114_init_speedo_data(void)
79{
80 u32 cpu_speedo_val;
81 u32 core_speedo_val;
82 int threshold;
83 int i;
84
85 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
86 THRESHOLD_INDEX_COUNT);
87 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
88 THRESHOLD_INDEX_COUNT);
89
90 rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id, &threshold);
91
92 cpu_speedo_val = tegra_fuse_readl(0x12c) + 1024;
93 core_speedo_val = tegra_fuse_readl(0x134);
94
95 for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++)
96 if (cpu_speedo_val < cpu_process_speedos[threshold][i])
97 break;
98 tegra_cpu_process_id = i;
99
100 for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++)
101 if (core_speedo_val < core_process_speedos[threshold][i])
102 break;
103 tegra_core_process_id = i;
104}
diff --git a/arch/arm/mach-tegra/tegra20_speedo.c b/arch/arm/mach-tegra/tegra20_speedo.c
deleted file mode 100644
index fa6eb570623f..000000000000
--- a/arch/arm/mach-tegra/tegra20_speedo.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CPU_SPEEDO_LSBIT 20
23#define CPU_SPEEDO_MSBIT 29
24#define CPU_SPEEDO_REDUND_LSBIT 30
25#define CPU_SPEEDO_REDUND_MSBIT 39
26#define CPU_SPEEDO_REDUND_OFFS (CPU_SPEEDO_REDUND_MSBIT - CPU_SPEEDO_MSBIT)
27
28#define CORE_SPEEDO_LSBIT 40
29#define CORE_SPEEDO_MSBIT 47
30#define CORE_SPEEDO_REDUND_LSBIT 48
31#define CORE_SPEEDO_REDUND_MSBIT 55
32#define CORE_SPEEDO_REDUND_OFFS (CORE_SPEEDO_REDUND_MSBIT - CORE_SPEEDO_MSBIT)
33
34#define SPEEDO_MULT 4
35
36#define PROCESS_CORNERS_NUM 4
37
38#define SPEEDO_ID_SELECT_0(rev) ((rev) <= 2)
39#define SPEEDO_ID_SELECT_1(sku) \
40 (((sku) != 20) && ((sku) != 23) && ((sku) != 24) && \
41 ((sku) != 27) && ((sku) != 28))
42
43enum {
44 SPEEDO_ID_0,
45 SPEEDO_ID_1,
46 SPEEDO_ID_2,
47 SPEEDO_ID_COUNT,
48};
49
50static const u32 cpu_process_speedos[][PROCESS_CORNERS_NUM] = {
51 {315, 366, 420, UINT_MAX},
52 {303, 368, 419, UINT_MAX},
53 {316, 331, 383, UINT_MAX},
54};
55
56static const u32 core_process_speedos[][PROCESS_CORNERS_NUM] = {
57 {165, 195, 224, UINT_MAX},
58 {165, 195, 224, UINT_MAX},
59 {165, 195, 224, UINT_MAX},
60};
61
62void tegra20_init_speedo_data(void)
63{
64 u32 reg;
65 u32 val;
66 int i;
67
68 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) != SPEEDO_ID_COUNT);
69 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) != SPEEDO_ID_COUNT);
70
71 if (SPEEDO_ID_SELECT_0(tegra_revision))
72 tegra_soc_speedo_id = SPEEDO_ID_0;
73 else if (SPEEDO_ID_SELECT_1(tegra_sku_id))
74 tegra_soc_speedo_id = SPEEDO_ID_1;
75 else
76 tegra_soc_speedo_id = SPEEDO_ID_2;
77
78 val = 0;
79 for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) {
80 reg = tegra_spare_fuse(i) |
81 tegra_spare_fuse(i + CPU_SPEEDO_REDUND_OFFS);
82 val = (val << 1) | (reg & 0x1);
83 }
84 val = val * SPEEDO_MULT;
85 pr_debug("%s CPU speedo value %u\n", __func__, val);
86
87 for (i = 0; i < (PROCESS_CORNERS_NUM - 1); i++) {
88 if (val <= cpu_process_speedos[tegra_soc_speedo_id][i])
89 break;
90 }
91 tegra_cpu_process_id = i;
92
93 val = 0;
94 for (i = CORE_SPEEDO_MSBIT; i >= CORE_SPEEDO_LSBIT; i--) {
95 reg = tegra_spare_fuse(i) |
96 tegra_spare_fuse(i + CORE_SPEEDO_REDUND_OFFS);
97 val = (val << 1) | (reg & 0x1);
98 }
99 val = val * SPEEDO_MULT;
100 pr_debug("%s Core speedo value %u\n", __func__, val);
101
102 for (i = 0; i < (PROCESS_CORNERS_NUM - 1); i++) {
103 if (val <= core_process_speedos[tegra_soc_speedo_id][i])
104 break;
105 }
106 tegra_core_process_id = i;
107
108 pr_info("Tegra20 Soc Speedo ID %d", tegra_soc_speedo_id);
109}
diff --git a/arch/arm/mach-tegra/tegra30_speedo.c b/arch/arm/mach-tegra/tegra30_speedo.c
deleted file mode 100644
index 125cb16424a6..000000000000
--- a/arch/arm/mach-tegra/tegra30_speedo.c
+++ /dev/null
@@ -1,292 +0,0 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CORE_PROCESS_CORNERS_NUM 1
23#define CPU_PROCESS_CORNERS_NUM 6
24
25#define FUSE_SPEEDO_CALIB_0 0x114
26#define FUSE_PACKAGE_INFO 0X1FC
27#define FUSE_TEST_PROG_VER 0X128
28
29#define G_SPEEDO_BIT_MINUS1 58
30#define G_SPEEDO_BIT_MINUS1_R 59
31#define G_SPEEDO_BIT_MINUS2 60
32#define G_SPEEDO_BIT_MINUS2_R 61
33#define LP_SPEEDO_BIT_MINUS1 62
34#define LP_SPEEDO_BIT_MINUS1_R 63
35#define LP_SPEEDO_BIT_MINUS2 64
36#define LP_SPEEDO_BIT_MINUS2_R 65
37
38enum {
39 THRESHOLD_INDEX_0,
40 THRESHOLD_INDEX_1,
41 THRESHOLD_INDEX_2,
42 THRESHOLD_INDEX_3,
43 THRESHOLD_INDEX_4,
44 THRESHOLD_INDEX_5,
45 THRESHOLD_INDEX_6,
46 THRESHOLD_INDEX_7,
47 THRESHOLD_INDEX_8,
48 THRESHOLD_INDEX_9,
49 THRESHOLD_INDEX_10,
50 THRESHOLD_INDEX_11,
51 THRESHOLD_INDEX_COUNT,
52};
53
54static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = {
55 {180},
56 {170},
57 {195},
58 {180},
59 {168},
60 {192},
61 {180},
62 {170},
63 {195},
64 {180},
65 {180},
66 {180},
67};
68
69static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = {
70 {306, 338, 360, 376, UINT_MAX},
71 {295, 336, 358, 375, UINT_MAX},
72 {325, 325, 358, 375, UINT_MAX},
73 {325, 325, 358, 375, UINT_MAX},
74 {292, 324, 348, 364, UINT_MAX},
75 {324, 324, 348, 364, UINT_MAX},
76 {324, 324, 348, 364, UINT_MAX},
77 {295, 336, 358, 375, UINT_MAX},
78 {358, 358, 358, 358, 397, UINT_MAX},
79 {364, 364, 364, 364, 397, UINT_MAX},
80 {295, 336, 358, 375, 391, UINT_MAX},
81 {295, 336, 358, 375, 391, UINT_MAX},
82};
83
84static int threshold_index;
85static int package_id;
86
87static void fuse_speedo_calib(u32 *speedo_g, u32 *speedo_lp)
88{
89 u32 reg;
90 int ate_ver;
91 int bit_minus1;
92 int bit_minus2;
93
94 reg = tegra_fuse_readl(FUSE_SPEEDO_CALIB_0);
95
96 *speedo_lp = (reg & 0xFFFF) * 4;
97 *speedo_g = ((reg >> 16) & 0xFFFF) * 4;
98
99 ate_ver = tegra_fuse_readl(FUSE_TEST_PROG_VER);
100 pr_info("%s: ATE prog ver %d.%d\n", __func__, ate_ver/10, ate_ver%10);
101
102 if (ate_ver >= 26) {
103 bit_minus1 = tegra_spare_fuse(LP_SPEEDO_BIT_MINUS1);
104 bit_minus1 |= tegra_spare_fuse(LP_SPEEDO_BIT_MINUS1_R);
105 bit_minus2 = tegra_spare_fuse(LP_SPEEDO_BIT_MINUS2);
106 bit_minus2 |= tegra_spare_fuse(LP_SPEEDO_BIT_MINUS2_R);
107 *speedo_lp |= (bit_minus1 << 1) | bit_minus2;
108
109 bit_minus1 = tegra_spare_fuse(G_SPEEDO_BIT_MINUS1);
110 bit_minus1 |= tegra_spare_fuse(G_SPEEDO_BIT_MINUS1_R);
111 bit_minus2 = tegra_spare_fuse(G_SPEEDO_BIT_MINUS2);
112 bit_minus2 |= tegra_spare_fuse(G_SPEEDO_BIT_MINUS2_R);
113 *speedo_g |= (bit_minus1 << 1) | bit_minus2;
114 } else {
115 *speedo_lp |= 0x3;
116 *speedo_g |= 0x3;
117 }
118}
119
120static void rev_sku_to_speedo_ids(int rev, int sku)
121{
122 switch (rev) {
123 case TEGRA_REVISION_A01:
124 tegra_cpu_speedo_id = 0;
125 tegra_soc_speedo_id = 0;
126 threshold_index = THRESHOLD_INDEX_0;
127 break;
128 case TEGRA_REVISION_A02:
129 case TEGRA_REVISION_A03:
130 switch (sku) {
131 case 0x87:
132 case 0x82:
133 tegra_cpu_speedo_id = 1;
134 tegra_soc_speedo_id = 1;
135 threshold_index = THRESHOLD_INDEX_1;
136 break;
137 case 0x81:
138 switch (package_id) {
139 case 1:
140 tegra_cpu_speedo_id = 2;
141 tegra_soc_speedo_id = 2;
142 threshold_index = THRESHOLD_INDEX_2;
143 break;
144 case 2:
145 tegra_cpu_speedo_id = 4;
146 tegra_soc_speedo_id = 1;
147 threshold_index = THRESHOLD_INDEX_7;
148 break;
149 default:
150 pr_err("Tegra30: Unknown pkg %d\n", package_id);
151 BUG();
152 break;
153 }
154 break;
155 case 0x80:
156 switch (package_id) {
157 case 1:
158 tegra_cpu_speedo_id = 5;
159 tegra_soc_speedo_id = 2;
160 threshold_index = THRESHOLD_INDEX_8;
161 break;
162 case 2:
163 tegra_cpu_speedo_id = 6;
164 tegra_soc_speedo_id = 2;
165 threshold_index = THRESHOLD_INDEX_9;
166 break;
167 default:
168 pr_err("Tegra30: Unknown pkg %d\n", package_id);
169 BUG();
170 break;
171 }
172 break;
173 case 0x83:
174 switch (package_id) {
175 case 1:
176 tegra_cpu_speedo_id = 7;
177 tegra_soc_speedo_id = 1;
178 threshold_index = THRESHOLD_INDEX_10;
179 break;
180 case 2:
181 tegra_cpu_speedo_id = 3;
182 tegra_soc_speedo_id = 2;
183 threshold_index = THRESHOLD_INDEX_3;
184 break;
185 default:
186 pr_err("Tegra30: Unknown pkg %d\n", package_id);
187 BUG();
188 break;
189 }
190 break;
191 case 0x8F:
192 tegra_cpu_speedo_id = 8;
193 tegra_soc_speedo_id = 1;
194 threshold_index = THRESHOLD_INDEX_11;
195 break;
196 case 0x08:
197 tegra_cpu_speedo_id = 1;
198 tegra_soc_speedo_id = 1;
199 threshold_index = THRESHOLD_INDEX_4;
200 break;
201 case 0x02:
202 tegra_cpu_speedo_id = 2;
203 tegra_soc_speedo_id = 2;
204 threshold_index = THRESHOLD_INDEX_5;
205 break;
206 case 0x04:
207 tegra_cpu_speedo_id = 3;
208 tegra_soc_speedo_id = 2;
209 threshold_index = THRESHOLD_INDEX_6;
210 break;
211 case 0:
212 switch (package_id) {
213 case 1:
214 tegra_cpu_speedo_id = 2;
215 tegra_soc_speedo_id = 2;
216 threshold_index = THRESHOLD_INDEX_2;
217 break;
218 case 2:
219 tegra_cpu_speedo_id = 3;
220 tegra_soc_speedo_id = 2;
221 threshold_index = THRESHOLD_INDEX_3;
222 break;
223 default:
224 pr_err("Tegra30: Unknown pkg %d\n", package_id);
225 BUG();
226 break;
227 }
228 break;
229 default:
230 pr_warn("Tegra30: Unknown SKU %d\n", sku);
231 tegra_cpu_speedo_id = 0;
232 tegra_soc_speedo_id = 0;
233 threshold_index = THRESHOLD_INDEX_0;
234 break;
235 }
236 break;
237 default:
238 pr_warn("Tegra30: Unknown chip rev %d\n", rev);
239 tegra_cpu_speedo_id = 0;
240 tegra_soc_speedo_id = 0;
241 threshold_index = THRESHOLD_INDEX_0;
242 break;
243 }
244}
245
246void tegra30_init_speedo_data(void)
247{
248 u32 cpu_speedo_val;
249 u32 core_speedo_val;
250 int i;
251
252 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
253 THRESHOLD_INDEX_COUNT);
254 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
255 THRESHOLD_INDEX_COUNT);
256
257 package_id = tegra_fuse_readl(FUSE_PACKAGE_INFO) & 0x0F;
258
259 rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id);
260 fuse_speedo_calib(&cpu_speedo_val, &core_speedo_val);
261 pr_debug("%s CPU speedo value %u\n", __func__, cpu_speedo_val);
262 pr_debug("%s Core speedo value %u\n", __func__, core_speedo_val);
263
264 for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++) {
265 if (cpu_speedo_val < cpu_process_speedos[threshold_index][i])
266 break;
267 }
268 tegra_cpu_process_id = i - 1;
269
270 if (tegra_cpu_process_id == -1) {
271 pr_warn("Tegra30: CPU speedo value %3d out of range",
272 cpu_speedo_val);
273 tegra_cpu_process_id = 0;
274 tegra_cpu_speedo_id = 1;
275 }
276
277 for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++) {
278 if (core_speedo_val < core_process_speedos[threshold_index][i])
279 break;
280 }
281 tegra_core_process_id = i - 1;
282
283 if (tegra_core_process_id == -1) {
284 pr_warn("Tegra30: CORE speedo value %3d out of range",
285 core_speedo_val);
286 tegra_core_process_id = 0;
287 tegra_soc_speedo_id = 1;
288 }
289
290 pr_info("Tegra30: CPU Speedo ID %d, Soc Speedo ID %d",
291 tegra_cpu_speedo_id, tegra_soc_speedo_id);
292}
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index a4e139aa2441..32d744e91ec2 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -796,7 +796,7 @@ static struct ab8500_regulator_reg_init ab8505_reg_init[] = {
796 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00), 796 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00),
797}; 797};
798 798
799struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = { 799static struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = {
800 /* supplies to the display/camera */ 800 /* supplies to the display/camera */
801 [AB8505_LDO_AUX1] = { 801 [AB8505_LDO_AUX1] = {
802 .constraints = { 802 .constraints = {
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index 842ebedbdd1c..e97ee556f92f 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -7,17 +7,15 @@
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/of.h> 8#include <linux/of.h>
9 9
10#include <asm/cacheflush.h>
11#include <asm/hardware/cache-l2x0.h> 10#include <asm/hardware/cache-l2x0.h>
12 11
13#include "db8500-regs.h" 12#include "db8500-regs.h"
14#include "id.h" 13#include "id.h"
15 14
16static void __iomem *l2x0_base;
17
18static int __init ux500_l2x0_unlock(void) 15static int __init ux500_l2x0_unlock(void)
19{ 16{
20 int i; 17 int i;
18 void __iomem *l2x0_base = __io_address(U8500_L2CC_BASE);
21 19
22 /* 20 /*
23 * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 21 * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions
@@ -45,23 +43,15 @@ static void ux500_l2c310_write_sec(unsigned long val, unsigned reg)
45 43
46static int __init ux500_l2x0_init(void) 44static int __init ux500_l2x0_init(void)
47{ 45{
48 if (cpu_is_u8500_family() || cpu_is_ux540_family()) 46 /* Multiplatform guard */
49 l2x0_base = __io_address(U8500_L2CC_BASE); 47 if (!((cpu_is_u8500_family() || cpu_is_ux540_family())))
50 else
51 /* Non-Ux500 platform */
52 return -ENODEV; 48 return -ENODEV;
53 49
54 /* Unlock before init */ 50 /* Unlock before init */
55 ux500_l2x0_unlock(); 51 ux500_l2x0_unlock();
56
57 outer_cache.write_sec = ux500_l2c310_write_sec; 52 outer_cache.write_sec = ux500_l2c310_write_sec;
58 53 l2x0_of_init(0, ~0);
59 if (of_have_populated_dt())
60 l2x0_of_init(0, ~0);
61 else
62 l2x0_init(l2x0_base, 0, ~0);
63 54
64 return 0; 55 return 0;
65} 56}
66
67early_initcall(ux500_l2x0_init); 57early_initcall(ux500_l2x0_init);
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index fa308f07fae5..6f63954c8bde 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -33,11 +33,11 @@
33#include "db8500-regs.h" 33#include "db8500-regs.h"
34#include "id.h" 34#include "id.h"
35 35
36struct ab8500_platform_data ab8500_platdata = { 36static struct ab8500_platform_data ab8500_platdata = {
37 .regulator = &ab8500_regulator_plat_data, 37 .regulator = &ab8500_regulator_plat_data,
38}; 38};
39 39
40struct prcmu_pdata db8500_prcmu_pdata = { 40static struct prcmu_pdata db8500_prcmu_pdata = {
41 .ab_platdata = &ab8500_platdata, 41 .ab_platdata = &ab8500_platdata,
42 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 42 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
43 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 43 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
@@ -82,7 +82,7 @@ static struct map_desc u9540_io_desc[] __initdata = {
82 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K), 82 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K),
83}; 83};
84 84
85void __init u8500_map_io(void) 85static void __init u8500_map_io(void)
86{ 86{
87 /* 87 /*
88 * Map the UARTs early so that the DEBUG_LL stuff continues to work. 88 * Map the UARTs early so that the DEBUG_LL stuff continues to work.
@@ -119,7 +119,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
119 return ret; 119 return ret;
120} 120}
121 121
122struct arm_pmu_platdata db8500_pmu_platdata = { 122static struct arm_pmu_platdata db8500_pmu_platdata = {
123 .handle_irq = db8500_pmu_handler, 123 .handle_irq = db8500_pmu_handler,
124}; 124};
125 125
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index db16b5a04ad5..dbb2970ee7da 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -125,7 +125,7 @@ static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr,
125 soc_dev_attr->revision = ux500_get_revision(); 125 soc_dev_attr->revision = ux500_get_revision();
126} 126}
127 127
128struct device_attribute ux500_soc_attr = 128static const struct device_attribute ux500_soc_attr =
129 __ATTR(process, S_IRUGO, ux500_get_process, NULL); 129 __ATTR(process, S_IRUGO, ux500_get_process, NULL);
130 130
131struct device * __init ux500_soc_device_init(const char *soc_id) 131struct device * __init ux500_soc_device_init(const char *soc_id)
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 87efda0aa348..ff28d8ad1ed7 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -16,7 +16,7 @@
16#include "db8500-regs.h" 16#include "db8500-regs.h"
17#include "id.h" 17#include "id.h"
18 18
19const static struct of_device_id prcmu_timer_of_match[] __initconst = { 19static const struct of_device_id prcmu_timer_of_match[] __initconst = {
20 { .compatible = "stericsson,db8500-prcmu-timer-4", }, 20 { .compatible = "stericsson,db8500-prcmu-timer-4", },
21 { }, 21 { },
22}; 22};
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index be83ba25f81b..08fb8c89f414 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -28,6 +28,7 @@
28#include <linux/of_platform.h> 28#include <linux/of_platform.h>
29#include <linux/amba/bus.h> 29#include <linux/amba/bus.h>
30#include <linux/amba/clcd.h> 30#include <linux/amba/clcd.h>
31#include <linux/platform_data/video-clcd-versatile.h>
31#include <linux/amba/pl061.h> 32#include <linux/amba/pl061.h>
32#include <linux/amba/mmci.h> 33#include <linux/amba/mmci.h>
33#include <linux/amba/pl022.h> 34#include <linux/amba/pl022.h>
@@ -53,7 +54,6 @@
53#include <mach/platform.h> 54#include <mach/platform.h>
54#include <asm/hardware/timer-sp.h> 55#include <asm/hardware/timer-sp.h>
55 56
56#include <plat/clcd.h>
57#include <plat/sched_clock.h> 57#include <plat/sched_clock.h>
58 58
59#include "core.h" 59#include "core.h"
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
index 3621b000a0f6..9f9bc61ca64b 100644
--- a/arch/arm/mach-versatile/versatile_dt.c
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -44,7 +44,6 @@ static const char *versatile_dt_match[] __initconst = {
44DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)") 44DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
45 .map_io = versatile_map_io, 45 .map_io = versatile_map_io,
46 .init_early = versatile_init_early, 46 .init_early = versatile_init_early,
47 .init_irq = versatile_init_irq,
48 .init_machine = versatile_dt_init, 47 .init_machine = versatile_dt_init,
49 .dt_compat = versatile_dt_match, 48 .dt_compat = versatile_dt_match,
50 .restart = versatile_restart, 49 .restart = versatile_restart,
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index d8b9330f896a..b2cfba16c4e8 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -13,7 +13,6 @@ menuconfig ARCH_VEXPRESS
13 select ICST 13 select ICST
14 select NO_IOPORT_MAP 14 select NO_IOPORT_MAP
15 select PLAT_VERSATILE 15 select PLAT_VERSATILE
16 select PLAT_VERSATILE_CLCD
17 select POWER_RESET 16 select POWER_RESET
18 select POWER_RESET_VEXPRESS 17 select POWER_RESET_VEXPRESS
19 select POWER_SUPPLY 18 select POWER_SUPPLY
@@ -64,7 +63,6 @@ config ARCH_VEXPRESS_DCSCB
64 63
65config ARCH_VEXPRESS_SPC 64config ARCH_VEXPRESS_SPC
66 bool "Versatile Express Serial Power Controller (SPC)" 65 bool "Versatile Express Serial Power Controller (SPC)"
67 select ARCH_HAS_OPP
68 select PM_OPP 66 select PM_OPP
69 help 67 help
70 The TC2 (A15x2 A7x3) versatile express core tile integrates a logic 68 The TC2 (A15x2 A7x3) versatile express core tile integrates a logic
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 86150d7a2e7d..27bea049380a 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -8,6 +8,7 @@
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/amba/bus.h> 9#include <linux/amba/bus.h>
10#include <linux/amba/clcd.h> 10#include <linux/amba/clcd.h>
11#include <linux/platform_data/video-clcd-versatile.h>
11#include <linux/clkdev.h> 12#include <linux/clkdev.h>
12#include <linux/vexpress.h> 13#include <linux/vexpress.h>
13#include <linux/irqchip/arm-gic.h> 14#include <linux/irqchip/arm-gic.h>
@@ -29,8 +30,6 @@
29#include <mach/motherboard.h> 30#include <mach/motherboard.h>
30#include <mach/irqs.h> 31#include <mach/irqs.h>
31 32
32#include <plat/clcd.h>
33
34static struct map_desc ct_ca9x4_io_desc[] __initdata = { 33static struct map_desc ct_ca9x4_io_desc[] __initdata = {
35 { 34 {
36 .virtual = V2T_PERIPH, 35 .virtual = V2T_PERIPH,
diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c
index b743a0ae02ce..2fb78b4648cb 100644
--- a/arch/arm/mach-vexpress/tc2_pm.c
+++ b/arch/arm/mach-vexpress/tc2_pm.c
@@ -152,7 +152,7 @@ static void tc2_pm_down(u64 residency)
152 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) { 152 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
153 arch_spin_unlock(&tc2_pm_lock); 153 arch_spin_unlock(&tc2_pm_lock);
154 154
155 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A15) { 155 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A15) {
156 /* 156 /*
157 * On the Cortex-A15 we need to disable 157 * On the Cortex-A15 we need to disable
158 * L2 prefetching before flushing the cache. 158 * L2 prefetching before flushing the cache.
@@ -323,6 +323,21 @@ static void __naked tc2_pm_power_up_setup(unsigned int affinity_level)
323" b cci_enable_port_for_self "); 323" b cci_enable_port_for_self ");
324} 324}
325 325
326static void __init tc2_cache_off(void)
327{
328 pr_info("TC2: disabling cache during MCPM loopback test\n");
329 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A15) {
330 /* disable L2 prefetching on the Cortex-A15 */
331 asm volatile(
332 "mcr p15, 1, %0, c15, c0, 3 \n\t"
333 "isb \n\t"
334 "dsb "
335 : : "r" (0x400) );
336 }
337 v7_exit_coherency_flush(all);
338 cci_disable_port_by_cpu(read_cpuid_mpidr());
339}
340
326static int __init tc2_pm_init(void) 341static int __init tc2_pm_init(void)
327{ 342{
328 int ret, irq; 343 int ret, irq;
@@ -370,6 +385,8 @@ static int __init tc2_pm_init(void)
370 ret = mcpm_platform_register(&tc2_pm_power_ops); 385 ret = mcpm_platform_register(&tc2_pm_power_ops);
371 if (!ret) { 386 if (!ret) {
372 mcpm_sync_init(tc2_pm_power_up_setup); 387 mcpm_sync_init(tc2_pm_power_up_setup);
388 /* test if we can (re)enable the CCI on our own */
389 BUG_ON(mcpm_loopback(tc2_cache_off) != 0);
373 pr_info("TC2 power management initialized\n"); 390 pr_info("TC2 power management initialized\n");
374 } 391 }
375 return ret; 392 return ret;
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 4a73464cb11b..2da7be31e7e2 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -44,7 +44,7 @@
44 44
45static void __iomem *pmc_base; 45static void __iomem *pmc_base;
46 46
47void vt8500_restart(enum reboot_mode mode, const char *cmd) 47static void vt8500_restart(enum reboot_mode mode, const char *cmd)
48{ 48{
49 if (pmc_base) 49 if (pmc_base)
50 writel(1, pmc_base + VT8500_PMSR_REG); 50 writel(1, pmc_base + VT8500_PMSR_REG);
@@ -60,7 +60,7 @@ static struct map_desc vt8500_io_desc[] __initdata = {
60 }, 60 },
61}; 61};
62 62
63void __init vt8500_map_io(void) 63static void __init vt8500_map_io(void)
64{ 64{
65 iotable_init(vt8500_io_desc, ARRAY_SIZE(vt8500_io_desc)); 65 iotable_init(vt8500_io_desc, ARRAY_SIZE(vt8500_io_desc));
66} 66}
@@ -72,7 +72,7 @@ static void vt8500_power_off(void)
72 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); 72 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
73} 73}
74 74
75void __init vt8500_init(void) 75static void __init vt8500_init(void)
76{ 76{
77 struct device_node *np; 77 struct device_node *np;
78#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505) 78#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505)
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index b1eabaad50a5..213230ee57d1 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -178,7 +178,8 @@ static int __init nuc900_set_cpufreq(char *str)
178 if (!*str) 178 if (!*str)
179 return 0; 179 return 0;
180 180
181 strict_strtoul(str, 0, &cpufreq); 181 if (kstrtoul(str, 0, &cpufreq))
182 return 0;
182 183
183 nuc900_clock_source(NULL, "ext"); 184 nuc900_clock_source(NULL, "ext");
184 185
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 0c164f81e72d..aaa5162c1509 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_ZYNQ 1config ARCH_ZYNQ
2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
3 select ARCH_HAS_OPP
4 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
5 select ARM_AMBA 4 select ARM_AMBA
6 select ARM_GIC 5 select ARM_GIC
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index c348eaee7ee2..ae69809a9e47 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -669,7 +669,7 @@ config ARM_VIRT_EXT
669 details. 669 details.
670 670
671config SWP_EMULATE 671config SWP_EMULATE
672 bool "Emulate SWP/SWPB instructions" 672 bool "Emulate SWP/SWPB instructions" if !SMP
673 depends on CPU_V7 673 depends on CPU_V7
674 default y if SMP 674 default y if SMP
675 select HAVE_PROC_CPU if PROC_FS 675 select HAVE_PROC_CPU if PROC_FS
@@ -854,7 +854,7 @@ config OUTER_CACHE_SYNC
854 854
855config CACHE_FEROCEON_L2 855config CACHE_FEROCEON_L2
856 bool "Enable the Feroceon L2 cache controller" 856 bool "Enable the Feroceon L2 cache controller"
857 depends on ARCH_KIRKWOOD || ARCH_MV78XX0 || ARCH_MVEBU 857 depends on ARCH_MV78XX0 || ARCH_MVEBU
858 default y 858 default y
859 select OUTER_CACHE 859 select OUTER_CACHE
860 help 860 help
@@ -907,8 +907,8 @@ config PL310_ERRATA_588369
907 They are architecturally defined to behave as the execution of a 907 They are architecturally defined to behave as the execution of a
908 clean operation followed immediately by an invalidate operation, 908 clean operation followed immediately by an invalidate operation,
909 both performing to the same memory location. This functionality 909 both performing to the same memory location. This functionality
910 is not correctly implemented in PL310 as clean lines are not 910 is not correctly implemented in PL310 prior to r2p0 (fixed in r2p0)
911 invalidated as a result of these operations. 911 as clean lines are not invalidated as a result of these operations.
912 912
913config PL310_ERRATA_727915 913config PL310_ERRATA_727915
914 bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" 914 bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption"
@@ -918,7 +918,8 @@ config PL310_ERRATA_727915
918 PL310 can handle normal accesses while it is in progress. Under very 918 PL310 can handle normal accesses while it is in progress. Under very
919 rare circumstances, due to this erratum, write data can be lost when 919 rare circumstances, due to this erratum, write data can be lost when
920 PL310 treats a cacheable write transaction during a Clean & 920 PL310 treats a cacheable write transaction during a Clean &
921 Invalidate by Way operation. 921 Invalidate by Way operation. Revisions prior to r3p1 are affected by
922 this errata (fixed in r3p1).
922 923
923config PL310_ERRATA_753970 924config PL310_ERRATA_753970
924 bool "PL310 errata: cache sync operation may be faulty" 925 bool "PL310 errata: cache sync operation may be faulty"
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index b8cb1a2688a0..0c1ab49e5f7b 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -76,6 +76,7 @@
76 76
77static unsigned long ai_user; 77static unsigned long ai_user;
78static unsigned long ai_sys; 78static unsigned long ai_sys;
79static void *ai_sys_last_pc;
79static unsigned long ai_skipped; 80static unsigned long ai_skipped;
80static unsigned long ai_half; 81static unsigned long ai_half;
81static unsigned long ai_word; 82static unsigned long ai_word;
@@ -130,7 +131,7 @@ static const char *usermode_action[] = {
130static int alignment_proc_show(struct seq_file *m, void *v) 131static int alignment_proc_show(struct seq_file *m, void *v)
131{ 132{
132 seq_printf(m, "User:\t\t%lu\n", ai_user); 133 seq_printf(m, "User:\t\t%lu\n", ai_user);
133 seq_printf(m, "System:\t\t%lu\n", ai_sys); 134 seq_printf(m, "System:\t\t%lu (%pF)\n", ai_sys, ai_sys_last_pc);
134 seq_printf(m, "Skipped:\t%lu\n", ai_skipped); 135 seq_printf(m, "Skipped:\t%lu\n", ai_skipped);
135 seq_printf(m, "Half:\t\t%lu\n", ai_half); 136 seq_printf(m, "Half:\t\t%lu\n", ai_half);
136 seq_printf(m, "Word:\t\t%lu\n", ai_word); 137 seq_printf(m, "Word:\t\t%lu\n", ai_word);
@@ -794,6 +795,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
794 goto user; 795 goto user;
795 796
796 ai_sys += 1; 797 ai_sys += 1;
798 ai_sys_last_pc = (void *)instruction_pointer(regs);
797 799
798 fixup: 800 fixup:
799 801
diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S
index e505befe51b5..2f0c58836ae7 100644
--- a/arch/arm/mm/cache-fa.S
+++ b/arch/arm/mm/cache-fa.S
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <asm/assembler.h>
18#include <asm/memory.h> 19#include <asm/memory.h>
19#include <asm/page.h> 20#include <asm/page.h>
20 21
@@ -45,7 +46,7 @@
45ENTRY(fa_flush_icache_all) 46ENTRY(fa_flush_icache_all)
46 mov r0, #0 47 mov r0, #0
47 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 48 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
48 mov pc, lr 49 ret lr
49ENDPROC(fa_flush_icache_all) 50ENDPROC(fa_flush_icache_all)
50 51
51/* 52/*
@@ -71,7 +72,7 @@ __flush_whole_cache:
71 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB 72 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB
72 mcrne p15, 0, ip, c7, c10, 4 @ drain write buffer 73 mcrne p15, 0, ip, c7, c10, 4 @ drain write buffer
73 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush 74 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
74 mov pc, lr 75 ret lr
75 76
76/* 77/*
77 * flush_user_cache_range(start, end, flags) 78 * flush_user_cache_range(start, end, flags)
@@ -99,7 +100,7 @@ ENTRY(fa_flush_user_cache_range)
99 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB 100 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB
100 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier 101 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier
101 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush 102 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
102 mov pc, lr 103 ret lr
103 104
104/* 105/*
105 * coherent_kern_range(start, end) 106 * coherent_kern_range(start, end)
@@ -135,7 +136,7 @@ ENTRY(fa_coherent_user_range)
135 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB 136 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
136 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 137 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
137 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush 138 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush
138 mov pc, lr 139 ret lr
139 140
140/* 141/*
141 * flush_kern_dcache_area(void *addr, size_t size) 142 * flush_kern_dcache_area(void *addr, size_t size)
@@ -155,7 +156,7 @@ ENTRY(fa_flush_kern_dcache_area)
155 mov r0, #0 156 mov r0, #0
156 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 157 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
157 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 158 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
158 mov pc, lr 159 ret lr
159 160
160/* 161/*
161 * dma_inv_range(start, end) 162 * dma_inv_range(start, end)
@@ -181,7 +182,7 @@ fa_dma_inv_range:
181 blo 1b 182 blo 1b
182 mov r0, #0 183 mov r0, #0
183 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 184 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
184 mov pc, lr 185 ret lr
185 186
186/* 187/*
187 * dma_clean_range(start, end) 188 * dma_clean_range(start, end)
@@ -199,7 +200,7 @@ fa_dma_clean_range:
199 blo 1b 200 blo 1b
200 mov r0, #0 201 mov r0, #0
201 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 202 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
202 mov pc, lr 203 ret lr
203 204
204/* 205/*
205 * dma_flush_range(start,end) 206 * dma_flush_range(start,end)
@@ -214,7 +215,7 @@ ENTRY(fa_dma_flush_range)
214 blo 1b 215 blo 1b
215 mov r0, #0 216 mov r0, #0
216 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 217 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
217 mov pc, lr 218 ret lr
218 219
219/* 220/*
220 * dma_map_area(start, size, dir) 221 * dma_map_area(start, size, dir)
@@ -237,7 +238,7 @@ ENDPROC(fa_dma_map_area)
237 * - dir - DMA direction 238 * - dir - DMA direction
238 */ 239 */
239ENTRY(fa_dma_unmap_area) 240ENTRY(fa_dma_unmap_area)
240 mov pc, lr 241 ret lr
241ENDPROC(fa_dma_unmap_area) 242ENDPROC(fa_dma_unmap_area)
242 243
243 .globl fa_flush_kern_cache_louis 244 .globl fa_flush_kern_cache_louis
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 7c3fb41a462e..5f2c988a06ac 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -665,7 +665,7 @@ static int l2c310_cpu_enable_flz(struct notifier_block *nb, unsigned long act, v
665static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock) 665static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock)
666{ 666{
667 unsigned rev = readl_relaxed(base + L2X0_CACHE_ID) & L2X0_CACHE_ID_RTL_MASK; 667 unsigned rev = readl_relaxed(base + L2X0_CACHE_ID) & L2X0_CACHE_ID_RTL_MASK;
668 bool cortex_a9 = read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9; 668 bool cortex_a9 = read_cpuid_part() == ARM_CPU_PART_CORTEX_A9;
669 669
670 if (rev >= L310_CACHE_ID_RTL_R2P0) { 670 if (rev >= L310_CACHE_ID_RTL_R2P0) {
671 if (cortex_a9) { 671 if (cortex_a9) {
diff --git a/arch/arm/mm/cache-nop.S b/arch/arm/mm/cache-nop.S
index 8e12ddca0031..f1cc9861031f 100644
--- a/arch/arm/mm/cache-nop.S
+++ b/arch/arm/mm/cache-nop.S
@@ -5,11 +5,12 @@
5 */ 5 */
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <asm/assembler.h>
8 9
9#include "proc-macros.S" 10#include "proc-macros.S"
10 11
11ENTRY(nop_flush_icache_all) 12ENTRY(nop_flush_icache_all)
12 mov pc, lr 13 ret lr
13ENDPROC(nop_flush_icache_all) 14ENDPROC(nop_flush_icache_all)
14 15
15 .globl nop_flush_kern_cache_all 16 .globl nop_flush_kern_cache_all
@@ -29,7 +30,7 @@ ENDPROC(nop_flush_icache_all)
29 30
30ENTRY(nop_coherent_user_range) 31ENTRY(nop_coherent_user_range)
31 mov r0, 0 32 mov r0, 0
32 mov pc, lr 33 ret lr
33ENDPROC(nop_coherent_user_range) 34ENDPROC(nop_coherent_user_range)
34 35
35 .globl nop_flush_kern_dcache_area 36 .globl nop_flush_kern_dcache_area
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index a7ba68f59f0c..91e3adf155cb 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/assembler.h>
12#include <asm/page.h> 13#include <asm/page.h>
13#include "proc-macros.S" 14#include "proc-macros.S"
14 15
@@ -18,7 +19,7 @@
18 * Unconditionally clean and invalidate the entire icache. 19 * Unconditionally clean and invalidate the entire icache.
19 */ 20 */
20ENTRY(v4_flush_icache_all) 21ENTRY(v4_flush_icache_all)
21 mov pc, lr 22 ret lr
22ENDPROC(v4_flush_icache_all) 23ENDPROC(v4_flush_icache_all)
23 24
24/* 25/*
@@ -40,7 +41,7 @@ ENTRY(v4_flush_kern_cache_all)
40#ifdef CONFIG_CPU_CP15 41#ifdef CONFIG_CPU_CP15
41 mov r0, #0 42 mov r0, #0
42 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache 43 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
43 mov pc, lr 44 ret lr
44#else 45#else
45 /* FALLTHROUGH */ 46 /* FALLTHROUGH */
46#endif 47#endif
@@ -59,7 +60,7 @@ ENTRY(v4_flush_user_cache_range)
59#ifdef CONFIG_CPU_CP15 60#ifdef CONFIG_CPU_CP15
60 mov ip, #0 61 mov ip, #0
61 mcr p15, 0, ip, c7, c7, 0 @ flush ID cache 62 mcr p15, 0, ip, c7, c7, 0 @ flush ID cache
62 mov pc, lr 63 ret lr
63#else 64#else
64 /* FALLTHROUGH */ 65 /* FALLTHROUGH */
65#endif 66#endif
@@ -89,7 +90,7 @@ ENTRY(v4_coherent_kern_range)
89 */ 90 */
90ENTRY(v4_coherent_user_range) 91ENTRY(v4_coherent_user_range)
91 mov r0, #0 92 mov r0, #0
92 mov pc, lr 93 ret lr
93 94
94/* 95/*
95 * flush_kern_dcache_area(void *addr, size_t size) 96 * flush_kern_dcache_area(void *addr, size_t size)
@@ -116,7 +117,7 @@ ENTRY(v4_dma_flush_range)
116 mov r0, #0 117 mov r0, #0
117 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache 118 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
118#endif 119#endif
119 mov pc, lr 120 ret lr
120 121
121/* 122/*
122 * dma_unmap_area(start, size, dir) 123 * dma_unmap_area(start, size, dir)
@@ -136,7 +137,7 @@ ENTRY(v4_dma_unmap_area)
136 * - dir - DMA direction 137 * - dir - DMA direction
137 */ 138 */
138ENTRY(v4_dma_map_area) 139ENTRY(v4_dma_map_area)
139 mov pc, lr 140 ret lr
140ENDPROC(v4_dma_unmap_area) 141ENDPROC(v4_dma_unmap_area)
141ENDPROC(v4_dma_map_area) 142ENDPROC(v4_dma_map_area)
142 143
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index cd4945321407..2522f8c8fbb1 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <asm/assembler.h>
12#include <asm/memory.h> 13#include <asm/memory.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include "proc-macros.S" 15#include "proc-macros.S"
@@ -58,7 +59,7 @@ flush_base:
58ENTRY(v4wb_flush_icache_all) 59ENTRY(v4wb_flush_icache_all)
59 mov r0, #0 60 mov r0, #0
60 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 61 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
61 mov pc, lr 62 ret lr
62ENDPROC(v4wb_flush_icache_all) 63ENDPROC(v4wb_flush_icache_all)
63 64
64/* 65/*
@@ -94,7 +95,7 @@ __flush_whole_cache:
94 blo 1b 95 blo 1b
95#endif 96#endif
96 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer 97 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer
97 mov pc, lr 98 ret lr
98 99
99/* 100/*
100 * flush_user_cache_range(start, end, flags) 101 * flush_user_cache_range(start, end, flags)
@@ -122,7 +123,7 @@ ENTRY(v4wb_flush_user_cache_range)
122 blo 1b 123 blo 1b
123 tst r2, #VM_EXEC 124 tst r2, #VM_EXEC
124 mcrne p15, 0, ip, c7, c10, 4 @ drain write buffer 125 mcrne p15, 0, ip, c7, c10, 4 @ drain write buffer
125 mov pc, lr 126 ret lr
126 127
127/* 128/*
128 * flush_kern_dcache_area(void *addr, size_t size) 129 * flush_kern_dcache_area(void *addr, size_t size)
@@ -170,7 +171,7 @@ ENTRY(v4wb_coherent_user_range)
170 mov r0, #0 171 mov r0, #0
171 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 172 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
172 mcr p15, 0, r0, c7, c10, 4 @ drain WB 173 mcr p15, 0, r0, c7, c10, 4 @ drain WB
173 mov pc, lr 174 ret lr
174 175
175 176
176/* 177/*
@@ -195,7 +196,7 @@ v4wb_dma_inv_range:
195 cmp r0, r1 196 cmp r0, r1
196 blo 1b 197 blo 1b
197 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 198 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
198 mov pc, lr 199 ret lr
199 200
200/* 201/*
201 * dma_clean_range(start, end) 202 * dma_clean_range(start, end)
@@ -212,7 +213,7 @@ v4wb_dma_clean_range:
212 cmp r0, r1 213 cmp r0, r1
213 blo 1b 214 blo 1b
214 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 215 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
215 mov pc, lr 216 ret lr
216 217
217/* 218/*
218 * dma_flush_range(start, end) 219 * dma_flush_range(start, end)
@@ -248,7 +249,7 @@ ENDPROC(v4wb_dma_map_area)
248 * - dir - DMA direction 249 * - dir - DMA direction
249 */ 250 */
250ENTRY(v4wb_dma_unmap_area) 251ENTRY(v4wb_dma_unmap_area)
251 mov pc, lr 252 ret lr
252ENDPROC(v4wb_dma_unmap_area) 253ENDPROC(v4wb_dma_unmap_area)
253 254
254 .globl v4wb_flush_kern_cache_louis 255 .globl v4wb_flush_kern_cache_louis
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 11e5e5838bc5..a0982ce49007 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <asm/assembler.h>
16#include <asm/page.h> 17#include <asm/page.h>
17#include "proc-macros.S" 18#include "proc-macros.S"
18 19
@@ -48,7 +49,7 @@
48ENTRY(v4wt_flush_icache_all) 49ENTRY(v4wt_flush_icache_all)
49 mov r0, #0 50 mov r0, #0
50 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 51 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
51 mov pc, lr 52 ret lr
52ENDPROC(v4wt_flush_icache_all) 53ENDPROC(v4wt_flush_icache_all)
53 54
54/* 55/*
@@ -71,7 +72,7 @@ __flush_whole_cache:
71 tst r2, #VM_EXEC 72 tst r2, #VM_EXEC
72 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 73 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
73 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 74 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
74 mov pc, lr 75 ret lr
75 76
76/* 77/*
77 * flush_user_cache_range(start, end, flags) 78 * flush_user_cache_range(start, end, flags)
@@ -94,7 +95,7 @@ ENTRY(v4wt_flush_user_cache_range)
94 add r0, r0, #CACHE_DLINESIZE 95 add r0, r0, #CACHE_DLINESIZE
95 cmp r0, r1 96 cmp r0, r1
96 blo 1b 97 blo 1b
97 mov pc, lr 98 ret lr
98 99
99/* 100/*
100 * coherent_kern_range(start, end) 101 * coherent_kern_range(start, end)
@@ -126,7 +127,7 @@ ENTRY(v4wt_coherent_user_range)
126 cmp r0, r1 127 cmp r0, r1
127 blo 1b 128 blo 1b
128 mov r0, #0 129 mov r0, #0
129 mov pc, lr 130 ret lr
130 131
131/* 132/*
132 * flush_kern_dcache_area(void *addr, size_t size) 133 * flush_kern_dcache_area(void *addr, size_t size)
@@ -160,7 +161,7 @@ v4wt_dma_inv_range:
160 add r0, r0, #CACHE_DLINESIZE 161 add r0, r0, #CACHE_DLINESIZE
161 cmp r0, r1 162 cmp r0, r1
162 blo 1b 163 blo 1b
163 mov pc, lr 164 ret lr
164 165
165/* 166/*
166 * dma_flush_range(start, end) 167 * dma_flush_range(start, end)
@@ -192,7 +193,7 @@ ENTRY(v4wt_dma_unmap_area)
192 * - dir - DMA direction 193 * - dir - DMA direction
193 */ 194 */
194ENTRY(v4wt_dma_map_area) 195ENTRY(v4wt_dma_map_area)
195 mov pc, lr 196 ret lr
196ENDPROC(v4wt_dma_unmap_area) 197ENDPROC(v4wt_dma_unmap_area)
197ENDPROC(v4wt_dma_map_area) 198ENDPROC(v4wt_dma_map_area)
198 199
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index d8fd4d4bd3d4..24659952c278 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -51,7 +51,7 @@ ENTRY(v6_flush_icache_all)
51#else 51#else
52 mcr p15, 0, r0, c7, c5, 0 @ invalidate I-cache 52 mcr p15, 0, r0, c7, c5, 0 @ invalidate I-cache
53#endif 53#endif
54 mov pc, lr 54 ret lr
55ENDPROC(v6_flush_icache_all) 55ENDPROC(v6_flush_icache_all)
56 56
57/* 57/*
@@ -73,7 +73,7 @@ ENTRY(v6_flush_kern_cache_all)
73#else 73#else
74 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate 74 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate
75#endif 75#endif
76 mov pc, lr 76 ret lr
77 77
78/* 78/*
79 * v6_flush_cache_all() 79 * v6_flush_cache_all()
@@ -98,7 +98,7 @@ ENTRY(v6_flush_user_cache_all)
98 * - we have a VIPT cache. 98 * - we have a VIPT cache.
99 */ 99 */
100ENTRY(v6_flush_user_cache_range) 100ENTRY(v6_flush_user_cache_range)
101 mov pc, lr 101 ret lr
102 102
103/* 103/*
104 * v6_coherent_kern_range(start,end) 104 * v6_coherent_kern_range(start,end)
@@ -150,7 +150,7 @@ ENTRY(v6_coherent_user_range)
150#else 150#else
151 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB 151 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
152#endif 152#endif
153 mov pc, lr 153 ret lr
154 154
155/* 155/*
156 * Fault handling for the cache operation above. If the virtual address in r0 156 * Fault handling for the cache operation above. If the virtual address in r0
@@ -158,7 +158,7 @@ ENTRY(v6_coherent_user_range)
158 */ 158 */
1599001: 1599001:
160 mov r0, #-EFAULT 160 mov r0, #-EFAULT
161 mov pc, lr 161 ret lr
162 UNWIND(.fnend ) 162 UNWIND(.fnend )
163ENDPROC(v6_coherent_user_range) 163ENDPROC(v6_coherent_user_range)
164ENDPROC(v6_coherent_kern_range) 164ENDPROC(v6_coherent_kern_range)
@@ -188,7 +188,7 @@ ENTRY(v6_flush_kern_dcache_area)
188 mov r0, #0 188 mov r0, #0
189 mcr p15, 0, r0, c7, c10, 4 189 mcr p15, 0, r0, c7, c10, 4
190#endif 190#endif
191 mov pc, lr 191 ret lr
192 192
193 193
194/* 194/*
@@ -239,7 +239,7 @@ v6_dma_inv_range:
239 blo 1b 239 blo 1b
240 mov r0, #0 240 mov r0, #0
241 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 241 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
242 mov pc, lr 242 ret lr
243 243
244/* 244/*
245 * v6_dma_clean_range(start,end) 245 * v6_dma_clean_range(start,end)
@@ -262,7 +262,7 @@ v6_dma_clean_range:
262 blo 1b 262 blo 1b
263 mov r0, #0 263 mov r0, #0
264 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 264 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
265 mov pc, lr 265 ret lr
266 266
267/* 267/*
268 * v6_dma_flush_range(start,end) 268 * v6_dma_flush_range(start,end)
@@ -290,7 +290,7 @@ ENTRY(v6_dma_flush_range)
290 blo 1b 290 blo 1b
291 mov r0, #0 291 mov r0, #0
292 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 292 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
293 mov pc, lr 293 ret lr
294 294
295/* 295/*
296 * dma_map_area(start, size, dir) 296 * dma_map_area(start, size, dir)
@@ -323,7 +323,7 @@ ENTRY(v6_dma_unmap_area)
323 teq r2, #DMA_TO_DEVICE 323 teq r2, #DMA_TO_DEVICE
324 bne v6_dma_inv_range 324 bne v6_dma_inv_range
325#endif 325#endif
326 mov pc, lr 326 ret lr
327ENDPROC(v6_dma_unmap_area) 327ENDPROC(v6_dma_unmap_area)
328 328
329 .globl v6_flush_kern_cache_louis 329 .globl v6_flush_kern_cache_louis
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 615c99e38ba1..b966656d2c2d 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -61,7 +61,7 @@ ENTRY(v7_invalidate_l1)
61 bgt 1b 61 bgt 1b
62 dsb st 62 dsb st
63 isb 63 isb
64 mov pc, lr 64 ret lr
65ENDPROC(v7_invalidate_l1) 65ENDPROC(v7_invalidate_l1)
66 66
67/* 67/*
@@ -76,7 +76,7 @@ ENTRY(v7_flush_icache_all)
76 mov r0, #0 76 mov r0, #0
77 ALT_SMP(mcr p15, 0, r0, c7, c1, 0) @ invalidate I-cache inner shareable 77 ALT_SMP(mcr p15, 0, r0, c7, c1, 0) @ invalidate I-cache inner shareable
78 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate 78 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate
79 mov pc, lr 79 ret lr
80ENDPROC(v7_flush_icache_all) 80ENDPROC(v7_flush_icache_all)
81 81
82 /* 82 /*
@@ -94,7 +94,7 @@ ENTRY(v7_flush_dcache_louis)
94 ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr 94 ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr
95#ifdef CONFIG_ARM_ERRATA_643719 95#ifdef CONFIG_ARM_ERRATA_643719
96 ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register 96 ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register
97 ALT_UP(moveq pc, lr) @ LoUU is zero, so nothing to do 97 ALT_UP(reteq lr) @ LoUU is zero, so nothing to do
98 ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p? 98 ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p?
99 biceq r2, r2, #0x0000000f @ clear minor revision number 99 biceq r2, r2, #0x0000000f @ clear minor revision number
100 teqeq r2, r1 @ test for errata affected core and if so... 100 teqeq r2, r1 @ test for errata affected core and if so...
@@ -102,7 +102,7 @@ ENTRY(v7_flush_dcache_louis)
102#endif 102#endif
103 ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 103 ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2
104 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 104 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2
105 moveq pc, lr @ return if level == 0 105 reteq lr @ return if level == 0
106 mov r10, #0 @ r10 (starting level) = 0 106 mov r10, #0 @ r10 (starting level) = 0
107 b flush_levels @ start flushing cache levels 107 b flush_levels @ start flushing cache levels
108ENDPROC(v7_flush_dcache_louis) 108ENDPROC(v7_flush_dcache_louis)
@@ -168,7 +168,7 @@ finished:
168 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 168 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
169 dsb st 169 dsb st
170 isb 170 isb
171 mov pc, lr 171 ret lr
172ENDPROC(v7_flush_dcache_all) 172ENDPROC(v7_flush_dcache_all)
173 173
174/* 174/*
@@ -191,7 +191,7 @@ ENTRY(v7_flush_kern_cache_all)
191 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate 191 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate
192 ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} ) 192 ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} )
193 THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} ) 193 THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} )
194 mov pc, lr 194 ret lr
195ENDPROC(v7_flush_kern_cache_all) 195ENDPROC(v7_flush_kern_cache_all)
196 196
197 /* 197 /*
@@ -209,7 +209,7 @@ ENTRY(v7_flush_kern_cache_louis)
209 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate 209 ALT_UP(mcr p15, 0, r0, c7, c5, 0) @ I+BTB cache invalidate
210 ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} ) 210 ARM( ldmfd sp!, {r4-r5, r7, r9-r11, lr} )
211 THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} ) 211 THUMB( ldmfd sp!, {r4-r7, r9-r11, lr} )
212 mov pc, lr 212 ret lr
213ENDPROC(v7_flush_kern_cache_louis) 213ENDPROC(v7_flush_kern_cache_louis)
214 214
215/* 215/*
@@ -235,7 +235,7 @@ ENTRY(v7_flush_user_cache_all)
235 * - we have a VIPT cache. 235 * - we have a VIPT cache.
236 */ 236 */
237ENTRY(v7_flush_user_cache_range) 237ENTRY(v7_flush_user_cache_range)
238 mov pc, lr 238 ret lr
239ENDPROC(v7_flush_user_cache_all) 239ENDPROC(v7_flush_user_cache_all)
240ENDPROC(v7_flush_user_cache_range) 240ENDPROC(v7_flush_user_cache_range)
241 241
@@ -296,7 +296,7 @@ ENTRY(v7_coherent_user_range)
296 ALT_UP(mcr p15, 0, r0, c7, c5, 6) @ invalidate BTB 296 ALT_UP(mcr p15, 0, r0, c7, c5, 6) @ invalidate BTB
297 dsb ishst 297 dsb ishst
298 isb 298 isb
299 mov pc, lr 299 ret lr
300 300
301/* 301/*
302 * Fault handling for the cache operation above. If the virtual address in r0 302 * Fault handling for the cache operation above. If the virtual address in r0
@@ -307,7 +307,7 @@ ENTRY(v7_coherent_user_range)
307 dsb 307 dsb
308#endif 308#endif
309 mov r0, #-EFAULT 309 mov r0, #-EFAULT
310 mov pc, lr 310 ret lr
311 UNWIND(.fnend ) 311 UNWIND(.fnend )
312ENDPROC(v7_coherent_kern_range) 312ENDPROC(v7_coherent_kern_range)
313ENDPROC(v7_coherent_user_range) 313ENDPROC(v7_coherent_user_range)
@@ -336,7 +336,7 @@ ENTRY(v7_flush_kern_dcache_area)
336 cmp r0, r1 336 cmp r0, r1
337 blo 1b 337 blo 1b
338 dsb st 338 dsb st
339 mov pc, lr 339 ret lr
340ENDPROC(v7_flush_kern_dcache_area) 340ENDPROC(v7_flush_kern_dcache_area)
341 341
342/* 342/*
@@ -369,7 +369,7 @@ v7_dma_inv_range:
369 cmp r0, r1 369 cmp r0, r1
370 blo 1b 370 blo 1b
371 dsb st 371 dsb st
372 mov pc, lr 372 ret lr
373ENDPROC(v7_dma_inv_range) 373ENDPROC(v7_dma_inv_range)
374 374
375/* 375/*
@@ -391,7 +391,7 @@ v7_dma_clean_range:
391 cmp r0, r1 391 cmp r0, r1
392 blo 1b 392 blo 1b
393 dsb st 393 dsb st
394 mov pc, lr 394 ret lr
395ENDPROC(v7_dma_clean_range) 395ENDPROC(v7_dma_clean_range)
396 396
397/* 397/*
@@ -413,7 +413,7 @@ ENTRY(v7_dma_flush_range)
413 cmp r0, r1 413 cmp r0, r1
414 blo 1b 414 blo 1b
415 dsb st 415 dsb st
416 mov pc, lr 416 ret lr
417ENDPROC(v7_dma_flush_range) 417ENDPROC(v7_dma_flush_range)
418 418
419/* 419/*
@@ -439,7 +439,7 @@ ENTRY(v7_dma_unmap_area)
439 add r1, r1, r0 439 add r1, r1, r0
440 teq r2, #DMA_TO_DEVICE 440 teq r2, #DMA_TO_DEVICE
441 bne v7_dma_inv_range 441 bne v7_dma_inv_range
442 mov pc, lr 442 ret lr
443ENDPROC(v7_dma_unmap_area) 443ENDPROC(v7_dma_unmap_area)
444 444
445 __INITDATA 445 __INITDATA
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 1f88db06b133..7a996aaa061e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -26,6 +26,7 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
28#include <linux/sizes.h> 28#include <linux/sizes.h>
29#include <linux/cma.h>
29 30
30#include <asm/memory.h> 31#include <asm/memory.h>
31#include <asm/highmem.h> 32#include <asm/highmem.h>
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index c508f41a43bc..59424937e52b 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -126,8 +126,8 @@ static const struct prot_bits section_bits[] = {
126 .val = PMD_SECT_USER, 126 .val = PMD_SECT_USER,
127 .set = "USR", 127 .set = "USR",
128 }, { 128 }, {
129 .mask = PMD_SECT_RDONLY, 129 .mask = L_PMD_SECT_RDONLY,
130 .val = PMD_SECT_RDONLY, 130 .val = L_PMD_SECT_RDONLY,
131 .set = "ro", 131 .set = "ro",
132 .clear = "RW", 132 .clear = "RW",
133#elif __LINUX_ARM_ARCH__ >= 6 133#elif __LINUX_ARM_ARCH__ >= 6
diff --git a/arch/arm/mm/l2c-l2x0-resume.S b/arch/arm/mm/l2c-l2x0-resume.S
index 99b05f21a59a..fda415e4ca8f 100644
--- a/arch/arm/mm/l2c-l2x0-resume.S
+++ b/arch/arm/mm/l2c-l2x0-resume.S
@@ -6,6 +6,7 @@
6 * This code can only be used to if you are running in the secure world. 6 * This code can only be used to if you are running in the secure world.
7 */ 7 */
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9#include <asm/assembler.h>
9#include <asm/hardware/cache-l2x0.h> 10#include <asm/hardware/cache-l2x0.h>
10 11
11 .text 12 .text
@@ -27,7 +28,7 @@ ENTRY(l2c310_early_resume)
27 28
28 @ Check that the address has been initialised 29 @ Check that the address has been initialised
29 teq r1, #0 30 teq r1, #0
30 moveq pc, lr 31 reteq lr
31 32
32 @ The prefetch and power control registers are revision dependent 33 @ The prefetch and power control registers are revision dependent
33 @ and can be written whether or not the L2 cache is enabled 34 @ and can be written whether or not the L2 cache is enabled
@@ -41,7 +42,7 @@ ENTRY(l2c310_early_resume)
41 @ Don't setup the L2 cache if it is already enabled 42 @ Don't setup the L2 cache if it is already enabled
42 ldr r0, [r1, #L2X0_CTRL] 43 ldr r0, [r1, #L2X0_CTRL]
43 tst r0, #L2X0_CTRL_EN 44 tst r0, #L2X0_CTRL_EN
44 movne pc, lr 45 retne lr
45 46
46 str r3, [r1, #L310_TAG_LATENCY_CTRL] 47 str r3, [r1, #L310_TAG_LATENCY_CTRL]
47 str r4, [r1, #L310_DATA_LATENCY_CTRL] 48 str r4, [r1, #L310_DATA_LATENCY_CTRL]
@@ -51,7 +52,7 @@ ENTRY(l2c310_early_resume)
51 str r2, [r1, #L2X0_AUX_CTRL] 52 str r2, [r1, #L2X0_AUX_CTRL]
52 mov r9, #L2X0_CTRL_EN 53 mov r9, #L2X0_CTRL_EN
53 str r9, [r1, #L2X0_CTRL] 54 str r9, [r1, #L2X0_CTRL]
54 mov pc, lr 55 ret lr
55ENDPROC(l2c310_early_resume) 56ENDPROC(l2c310_early_resume)
56 57
57 .align 58 .align
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 6e3ba8d112a2..8348ed6b2efe 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1434,23 +1434,64 @@ void __init early_paging_init(const struct machine_desc *mdesc,
1434 dsb(ishst); 1434 dsb(ishst);
1435 isb(); 1435 isb();
1436 1436
1437 /* remap level 1 table */ 1437 /*
1438 * FIXME: This code is not architecturally compliant: we modify
1439 * the mappings in-place, indeed while they are in use by this
1440 * very same code. This may lead to unpredictable behaviour of
1441 * the CPU.
1442 *
1443 * Even modifying the mappings in a separate page table does
1444 * not resolve this.
1445 *
1446 * The architecture strongly recommends that when a mapping is
1447 * changed, that it is changed by first going via an invalid
1448 * mapping and back to the new mapping. This is to ensure that
1449 * no TLB conflicts (caused by the TLB having more than one TLB
1450 * entry match a translation) can occur. However, doing that
1451 * here will result in unmapping the code we are running.
1452 */
1453 pr_warn("WARNING: unsafe modification of in-place page tables - tainting kernel\n");
1454 add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
1455
1456 /*
1457 * Remap level 1 table. This changes the physical addresses
1458 * used to refer to the level 2 page tables to the high
1459 * physical address alias, leaving everything else the same.
1460 */
1438 for (i = 0; i < PTRS_PER_PGD; pud0++, i++) { 1461 for (i = 0; i < PTRS_PER_PGD; pud0++, i++) {
1439 set_pud(pud0, 1462 set_pud(pud0,
1440 __pud(__pa(pmd0) | PMD_TYPE_TABLE | L_PGD_SWAPPER)); 1463 __pud(__pa(pmd0) | PMD_TYPE_TABLE | L_PGD_SWAPPER));
1441 pmd0 += PTRS_PER_PMD; 1464 pmd0 += PTRS_PER_PMD;
1442 } 1465 }
1443 1466
1444 /* remap pmds for kernel mapping */ 1467 /*
1468 * Remap the level 2 table, pointing the mappings at the high
1469 * physical address alias of these pages.
1470 */
1445 phys = __pa(map_start); 1471 phys = __pa(map_start);
1446 do { 1472 do {
1447 *pmdk++ = __pmd(phys | pmdprot); 1473 *pmdk++ = __pmd(phys | pmdprot);
1448 phys += PMD_SIZE; 1474 phys += PMD_SIZE;
1449 } while (phys < map_end); 1475 } while (phys < map_end);
1450 1476
1477 /*
1478 * Ensure that the above updates are flushed out of the cache.
1479 * This is not strictly correct; on a system where the caches
1480 * are coherent with each other, but the MMU page table walks
1481 * may not be coherent, flush_cache_all() may be a no-op, and
1482 * this will fail.
1483 */
1451 flush_cache_all(); 1484 flush_cache_all();
1485
1486 /*
1487 * Re-write the TTBR values to point them at the high physical
1488 * alias of the page tables. We expect __va() will work on
1489 * cpu_get_pgd(), which returns the value of TTBR0.
1490 */
1452 cpu_switch_mm(pgd0, &init_mm); 1491 cpu_switch_mm(pgd0, &init_mm);
1453 cpu_set_ttbr(1, __pa(pgd0) + TTBR1_OFFSET); 1492 cpu_set_ttbr(1, __pa(pgd0) + TTBR1_OFFSET);
1493
1494 /* Finally flush any stale TLB values. */
1454 local_flush_bp_all(); 1495 local_flush_bp_all();
1455 local_flush_tlb_all(); 1496 local_flush_tlb_all();
1456} 1497}
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index d1a2d05971e0..86ee5d47ce3c 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -73,7 +73,7 @@
73 * cpu_arm1020_proc_init() 73 * cpu_arm1020_proc_init()
74 */ 74 */
75ENTRY(cpu_arm1020_proc_init) 75ENTRY(cpu_arm1020_proc_init)
76 mov pc, lr 76 ret lr
77 77
78/* 78/*
79 * cpu_arm1020_proc_fin() 79 * cpu_arm1020_proc_fin()
@@ -83,7 +83,7 @@ ENTRY(cpu_arm1020_proc_fin)
83 bic r0, r0, #0x1000 @ ...i............ 83 bic r0, r0, #0x1000 @ ...i............
84 bic r0, r0, #0x000e @ ............wca. 84 bic r0, r0, #0x000e @ ............wca.
85 mcr p15, 0, r0, c1, c0, 0 @ disable caches 85 mcr p15, 0, r0, c1, c0, 0 @ disable caches
86 mov pc, lr 86 ret lr
87 87
88/* 88/*
89 * cpu_arm1020_reset(loc) 89 * cpu_arm1020_reset(loc)
@@ -107,7 +107,7 @@ ENTRY(cpu_arm1020_reset)
107 bic ip, ip, #0x000f @ ............wcam 107 bic ip, ip, #0x000f @ ............wcam
108 bic ip, ip, #0x1100 @ ...i...s........ 108 bic ip, ip, #0x1100 @ ...i...s........
109 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 109 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
110 mov pc, r0 110 ret r0
111ENDPROC(cpu_arm1020_reset) 111ENDPROC(cpu_arm1020_reset)
112 .popsection 112 .popsection
113 113
@@ -117,7 +117,7 @@ ENDPROC(cpu_arm1020_reset)
117 .align 5 117 .align 5
118ENTRY(cpu_arm1020_do_idle) 118ENTRY(cpu_arm1020_do_idle)
119 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 119 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
120 mov pc, lr 120 ret lr
121 121
122/* ================================= CACHE ================================ */ 122/* ================================= CACHE ================================ */
123 123
@@ -133,7 +133,7 @@ ENTRY(arm1020_flush_icache_all)
133 mov r0, #0 133 mov r0, #0
134 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 134 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
135#endif 135#endif
136 mov pc, lr 136 ret lr
137ENDPROC(arm1020_flush_icache_all) 137ENDPROC(arm1020_flush_icache_all)
138 138
139/* 139/*
@@ -169,7 +169,7 @@ __flush_whole_cache:
169 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 169 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
170#endif 170#endif
171 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 171 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
172 mov pc, lr 172 ret lr
173 173
174/* 174/*
175 * flush_user_cache_range(start, end, flags) 175 * flush_user_cache_range(start, end, flags)
@@ -200,7 +200,7 @@ ENTRY(arm1020_flush_user_cache_range)
200 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 200 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
201#endif 201#endif
202 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 202 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
203 mov pc, lr 203 ret lr
204 204
205/* 205/*
206 * coherent_kern_range(start, end) 206 * coherent_kern_range(start, end)
@@ -242,7 +242,7 @@ ENTRY(arm1020_coherent_user_range)
242 blo 1b 242 blo 1b
243 mcr p15, 0, ip, c7, c10, 4 @ drain WB 243 mcr p15, 0, ip, c7, c10, 4 @ drain WB
244 mov r0, #0 244 mov r0, #0
245 mov pc, lr 245 ret lr
246 246
247/* 247/*
248 * flush_kern_dcache_area(void *addr, size_t size) 248 * flush_kern_dcache_area(void *addr, size_t size)
@@ -264,7 +264,7 @@ ENTRY(arm1020_flush_kern_dcache_area)
264 blo 1b 264 blo 1b
265#endif 265#endif
266 mcr p15, 0, ip, c7, c10, 4 @ drain WB 266 mcr p15, 0, ip, c7, c10, 4 @ drain WB
267 mov pc, lr 267 ret lr
268 268
269/* 269/*
270 * dma_inv_range(start, end) 270 * dma_inv_range(start, end)
@@ -297,7 +297,7 @@ arm1020_dma_inv_range:
297 blo 1b 297 blo 1b
298#endif 298#endif
299 mcr p15, 0, ip, c7, c10, 4 @ drain WB 299 mcr p15, 0, ip, c7, c10, 4 @ drain WB
300 mov pc, lr 300 ret lr
301 301
302/* 302/*
303 * dma_clean_range(start, end) 303 * dma_clean_range(start, end)
@@ -320,7 +320,7 @@ arm1020_dma_clean_range:
320 blo 1b 320 blo 1b
321#endif 321#endif
322 mcr p15, 0, ip, c7, c10, 4 @ drain WB 322 mcr p15, 0, ip, c7, c10, 4 @ drain WB
323 mov pc, lr 323 ret lr
324 324
325/* 325/*
326 * dma_flush_range(start, end) 326 * dma_flush_range(start, end)
@@ -342,7 +342,7 @@ ENTRY(arm1020_dma_flush_range)
342 blo 1b 342 blo 1b
343#endif 343#endif
344 mcr p15, 0, ip, c7, c10, 4 @ drain WB 344 mcr p15, 0, ip, c7, c10, 4 @ drain WB
345 mov pc, lr 345 ret lr
346 346
347/* 347/*
348 * dma_map_area(start, size, dir) 348 * dma_map_area(start, size, dir)
@@ -365,7 +365,7 @@ ENDPROC(arm1020_dma_map_area)
365 * - dir - DMA direction 365 * - dir - DMA direction
366 */ 366 */
367ENTRY(arm1020_dma_unmap_area) 367ENTRY(arm1020_dma_unmap_area)
368 mov pc, lr 368 ret lr
369ENDPROC(arm1020_dma_unmap_area) 369ENDPROC(arm1020_dma_unmap_area)
370 370
371 .globl arm1020_flush_kern_cache_louis 371 .globl arm1020_flush_kern_cache_louis
@@ -384,7 +384,7 @@ ENTRY(cpu_arm1020_dcache_clean_area)
384 subs r1, r1, #CACHE_DLINESIZE 384 subs r1, r1, #CACHE_DLINESIZE
385 bhi 1b 385 bhi 1b
386#endif 386#endif
387 mov pc, lr 387 ret lr
388 388
389/* =============================== PageTable ============================== */ 389/* =============================== PageTable ============================== */
390 390
@@ -423,7 +423,7 @@ ENTRY(cpu_arm1020_switch_mm)
423 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 423 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
424 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 424 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
425#endif /* CONFIG_MMU */ 425#endif /* CONFIG_MMU */
426 mov pc, lr 426 ret lr
427 427
428/* 428/*
429 * cpu_arm1020_set_pte(ptep, pte) 429 * cpu_arm1020_set_pte(ptep, pte)
@@ -441,7 +441,7 @@ ENTRY(cpu_arm1020_set_pte_ext)
441#endif 441#endif
442 mcr p15, 0, r0, c7, c10, 4 @ drain WB 442 mcr p15, 0, r0, c7, c10, 4 @ drain WB
443#endif /* CONFIG_MMU */ 443#endif /* CONFIG_MMU */
444 mov pc, lr 444 ret lr
445 445
446 .type __arm1020_setup, #function 446 .type __arm1020_setup, #function
447__arm1020_setup: 447__arm1020_setup:
@@ -460,7 +460,7 @@ __arm1020_setup:
460#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 460#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
461 orr r0, r0, #0x4000 @ .R.. .... .... .... 461 orr r0, r0, #0x4000 @ .R.. .... .... ....
462#endif 462#endif
463 mov pc, lr 463 ret lr
464 .size __arm1020_setup, . - __arm1020_setup 464 .size __arm1020_setup, . - __arm1020_setup
465 465
466 /* 466 /*
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index 9d89405c3d03..a6331d78601f 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -73,7 +73,7 @@
73 * cpu_arm1020e_proc_init() 73 * cpu_arm1020e_proc_init()
74 */ 74 */
75ENTRY(cpu_arm1020e_proc_init) 75ENTRY(cpu_arm1020e_proc_init)
76 mov pc, lr 76 ret lr
77 77
78/* 78/*
79 * cpu_arm1020e_proc_fin() 79 * cpu_arm1020e_proc_fin()
@@ -83,7 +83,7 @@ ENTRY(cpu_arm1020e_proc_fin)
83 bic r0, r0, #0x1000 @ ...i............ 83 bic r0, r0, #0x1000 @ ...i............
84 bic r0, r0, #0x000e @ ............wca. 84 bic r0, r0, #0x000e @ ............wca.
85 mcr p15, 0, r0, c1, c0, 0 @ disable caches 85 mcr p15, 0, r0, c1, c0, 0 @ disable caches
86 mov pc, lr 86 ret lr
87 87
88/* 88/*
89 * cpu_arm1020e_reset(loc) 89 * cpu_arm1020e_reset(loc)
@@ -107,7 +107,7 @@ ENTRY(cpu_arm1020e_reset)
107 bic ip, ip, #0x000f @ ............wcam 107 bic ip, ip, #0x000f @ ............wcam
108 bic ip, ip, #0x1100 @ ...i...s........ 108 bic ip, ip, #0x1100 @ ...i...s........
109 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 109 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
110 mov pc, r0 110 ret r0
111ENDPROC(cpu_arm1020e_reset) 111ENDPROC(cpu_arm1020e_reset)
112 .popsection 112 .popsection
113 113
@@ -117,7 +117,7 @@ ENDPROC(cpu_arm1020e_reset)
117 .align 5 117 .align 5
118ENTRY(cpu_arm1020e_do_idle) 118ENTRY(cpu_arm1020e_do_idle)
119 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 119 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
120 mov pc, lr 120 ret lr
121 121
122/* ================================= CACHE ================================ */ 122/* ================================= CACHE ================================ */
123 123
@@ -133,7 +133,7 @@ ENTRY(arm1020e_flush_icache_all)
133 mov r0, #0 133 mov r0, #0
134 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 134 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
135#endif 135#endif
136 mov pc, lr 136 ret lr
137ENDPROC(arm1020e_flush_icache_all) 137ENDPROC(arm1020e_flush_icache_all)
138 138
139/* 139/*
@@ -168,7 +168,7 @@ __flush_whole_cache:
168 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 168 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
169#endif 169#endif
170 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 170 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
171 mov pc, lr 171 ret lr
172 172
173/* 173/*
174 * flush_user_cache_range(start, end, flags) 174 * flush_user_cache_range(start, end, flags)
@@ -197,7 +197,7 @@ ENTRY(arm1020e_flush_user_cache_range)
197 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 197 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
198#endif 198#endif
199 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 199 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
200 mov pc, lr 200 ret lr
201 201
202/* 202/*
203 * coherent_kern_range(start, end) 203 * coherent_kern_range(start, end)
@@ -236,7 +236,7 @@ ENTRY(arm1020e_coherent_user_range)
236 blo 1b 236 blo 1b
237 mcr p15, 0, ip, c7, c10, 4 @ drain WB 237 mcr p15, 0, ip, c7, c10, 4 @ drain WB
238 mov r0, #0 238 mov r0, #0
239 mov pc, lr 239 ret lr
240 240
241/* 241/*
242 * flush_kern_dcache_area(void *addr, size_t size) 242 * flush_kern_dcache_area(void *addr, size_t size)
@@ -257,7 +257,7 @@ ENTRY(arm1020e_flush_kern_dcache_area)
257 blo 1b 257 blo 1b
258#endif 258#endif
259 mcr p15, 0, ip, c7, c10, 4 @ drain WB 259 mcr p15, 0, ip, c7, c10, 4 @ drain WB
260 mov pc, lr 260 ret lr
261 261
262/* 262/*
263 * dma_inv_range(start, end) 263 * dma_inv_range(start, end)
@@ -286,7 +286,7 @@ arm1020e_dma_inv_range:
286 blo 1b 286 blo 1b
287#endif 287#endif
288 mcr p15, 0, ip, c7, c10, 4 @ drain WB 288 mcr p15, 0, ip, c7, c10, 4 @ drain WB
289 mov pc, lr 289 ret lr
290 290
291/* 291/*
292 * dma_clean_range(start, end) 292 * dma_clean_range(start, end)
@@ -308,7 +308,7 @@ arm1020e_dma_clean_range:
308 blo 1b 308 blo 1b
309#endif 309#endif
310 mcr p15, 0, ip, c7, c10, 4 @ drain WB 310 mcr p15, 0, ip, c7, c10, 4 @ drain WB
311 mov pc, lr 311 ret lr
312 312
313/* 313/*
314 * dma_flush_range(start, end) 314 * dma_flush_range(start, end)
@@ -328,7 +328,7 @@ ENTRY(arm1020e_dma_flush_range)
328 blo 1b 328 blo 1b
329#endif 329#endif
330 mcr p15, 0, ip, c7, c10, 4 @ drain WB 330 mcr p15, 0, ip, c7, c10, 4 @ drain WB
331 mov pc, lr 331 ret lr
332 332
333/* 333/*
334 * dma_map_area(start, size, dir) 334 * dma_map_area(start, size, dir)
@@ -351,7 +351,7 @@ ENDPROC(arm1020e_dma_map_area)
351 * - dir - DMA direction 351 * - dir - DMA direction
352 */ 352 */
353ENTRY(arm1020e_dma_unmap_area) 353ENTRY(arm1020e_dma_unmap_area)
354 mov pc, lr 354 ret lr
355ENDPROC(arm1020e_dma_unmap_area) 355ENDPROC(arm1020e_dma_unmap_area)
356 356
357 .globl arm1020e_flush_kern_cache_louis 357 .globl arm1020e_flush_kern_cache_louis
@@ -369,7 +369,7 @@ ENTRY(cpu_arm1020e_dcache_clean_area)
369 subs r1, r1, #CACHE_DLINESIZE 369 subs r1, r1, #CACHE_DLINESIZE
370 bhi 1b 370 bhi 1b
371#endif 371#endif
372 mov pc, lr 372 ret lr
373 373
374/* =============================== PageTable ============================== */ 374/* =============================== PageTable ============================== */
375 375
@@ -407,7 +407,7 @@ ENTRY(cpu_arm1020e_switch_mm)
407 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 407 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
408 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 408 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
409#endif 409#endif
410 mov pc, lr 410 ret lr
411 411
412/* 412/*
413 * cpu_arm1020e_set_pte(ptep, pte) 413 * cpu_arm1020e_set_pte(ptep, pte)
@@ -423,7 +423,7 @@ ENTRY(cpu_arm1020e_set_pte_ext)
423 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 423 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
424#endif 424#endif
425#endif /* CONFIG_MMU */ 425#endif /* CONFIG_MMU */
426 mov pc, lr 426 ret lr
427 427
428 .type __arm1020e_setup, #function 428 .type __arm1020e_setup, #function
429__arm1020e_setup: 429__arm1020e_setup:
@@ -441,7 +441,7 @@ __arm1020e_setup:
441#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 441#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
442 orr r0, r0, #0x4000 @ .R.. .... .... .... 442 orr r0, r0, #0x4000 @ .R.. .... .... ....
443#endif 443#endif
444 mov pc, lr 444 ret lr
445 .size __arm1020e_setup, . - __arm1020e_setup 445 .size __arm1020e_setup, . - __arm1020e_setup
446 446
447 /* 447 /*
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 6f01a0ae3b30..a126b7a59928 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -62,7 +62,7 @@
62 * cpu_arm1022_proc_init() 62 * cpu_arm1022_proc_init()
63 */ 63 */
64ENTRY(cpu_arm1022_proc_init) 64ENTRY(cpu_arm1022_proc_init)
65 mov pc, lr 65 ret lr
66 66
67/* 67/*
68 * cpu_arm1022_proc_fin() 68 * cpu_arm1022_proc_fin()
@@ -72,7 +72,7 @@ ENTRY(cpu_arm1022_proc_fin)
72 bic r0, r0, #0x1000 @ ...i............ 72 bic r0, r0, #0x1000 @ ...i............
73 bic r0, r0, #0x000e @ ............wca. 73 bic r0, r0, #0x000e @ ............wca.
74 mcr p15, 0, r0, c1, c0, 0 @ disable caches 74 mcr p15, 0, r0, c1, c0, 0 @ disable caches
75 mov pc, lr 75 ret lr
76 76
77/* 77/*
78 * cpu_arm1022_reset(loc) 78 * cpu_arm1022_reset(loc)
@@ -96,7 +96,7 @@ ENTRY(cpu_arm1022_reset)
96 bic ip, ip, #0x000f @ ............wcam 96 bic ip, ip, #0x000f @ ............wcam
97 bic ip, ip, #0x1100 @ ...i...s........ 97 bic ip, ip, #0x1100 @ ...i...s........
98 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 98 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
99 mov pc, r0 99 ret r0
100ENDPROC(cpu_arm1022_reset) 100ENDPROC(cpu_arm1022_reset)
101 .popsection 101 .popsection
102 102
@@ -106,7 +106,7 @@ ENDPROC(cpu_arm1022_reset)
106 .align 5 106 .align 5
107ENTRY(cpu_arm1022_do_idle) 107ENTRY(cpu_arm1022_do_idle)
108 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 108 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
109 mov pc, lr 109 ret lr
110 110
111/* ================================= CACHE ================================ */ 111/* ================================= CACHE ================================ */
112 112
@@ -122,7 +122,7 @@ ENTRY(arm1022_flush_icache_all)
122 mov r0, #0 122 mov r0, #0
123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
124#endif 124#endif
125 mov pc, lr 125 ret lr
126ENDPROC(arm1022_flush_icache_all) 126ENDPROC(arm1022_flush_icache_all)
127 127
128/* 128/*
@@ -156,7 +156,7 @@ __flush_whole_cache:
156 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 156 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
157#endif 157#endif
158 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 158 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
159 mov pc, lr 159 ret lr
160 160
161/* 161/*
162 * flush_user_cache_range(start, end, flags) 162 * flush_user_cache_range(start, end, flags)
@@ -185,7 +185,7 @@ ENTRY(arm1022_flush_user_cache_range)
185 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 185 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
186#endif 186#endif
187 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 187 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
188 mov pc, lr 188 ret lr
189 189
190/* 190/*
191 * coherent_kern_range(start, end) 191 * coherent_kern_range(start, end)
@@ -225,7 +225,7 @@ ENTRY(arm1022_coherent_user_range)
225 blo 1b 225 blo 1b
226 mcr p15, 0, ip, c7, c10, 4 @ drain WB 226 mcr p15, 0, ip, c7, c10, 4 @ drain WB
227 mov r0, #0 227 mov r0, #0
228 mov pc, lr 228 ret lr
229 229
230/* 230/*
231 * flush_kern_dcache_area(void *addr, size_t size) 231 * flush_kern_dcache_area(void *addr, size_t size)
@@ -246,7 +246,7 @@ ENTRY(arm1022_flush_kern_dcache_area)
246 blo 1b 246 blo 1b
247#endif 247#endif
248 mcr p15, 0, ip, c7, c10, 4 @ drain WB 248 mcr p15, 0, ip, c7, c10, 4 @ drain WB
249 mov pc, lr 249 ret lr
250 250
251/* 251/*
252 * dma_inv_range(start, end) 252 * dma_inv_range(start, end)
@@ -275,7 +275,7 @@ arm1022_dma_inv_range:
275 blo 1b 275 blo 1b
276#endif 276#endif
277 mcr p15, 0, ip, c7, c10, 4 @ drain WB 277 mcr p15, 0, ip, c7, c10, 4 @ drain WB
278 mov pc, lr 278 ret lr
279 279
280/* 280/*
281 * dma_clean_range(start, end) 281 * dma_clean_range(start, end)
@@ -297,7 +297,7 @@ arm1022_dma_clean_range:
297 blo 1b 297 blo 1b
298#endif 298#endif
299 mcr p15, 0, ip, c7, c10, 4 @ drain WB 299 mcr p15, 0, ip, c7, c10, 4 @ drain WB
300 mov pc, lr 300 ret lr
301 301
302/* 302/*
303 * dma_flush_range(start, end) 303 * dma_flush_range(start, end)
@@ -317,7 +317,7 @@ ENTRY(arm1022_dma_flush_range)
317 blo 1b 317 blo 1b
318#endif 318#endif
319 mcr p15, 0, ip, c7, c10, 4 @ drain WB 319 mcr p15, 0, ip, c7, c10, 4 @ drain WB
320 mov pc, lr 320 ret lr
321 321
322/* 322/*
323 * dma_map_area(start, size, dir) 323 * dma_map_area(start, size, dir)
@@ -340,7 +340,7 @@ ENDPROC(arm1022_dma_map_area)
340 * - dir - DMA direction 340 * - dir - DMA direction
341 */ 341 */
342ENTRY(arm1022_dma_unmap_area) 342ENTRY(arm1022_dma_unmap_area)
343 mov pc, lr 343 ret lr
344ENDPROC(arm1022_dma_unmap_area) 344ENDPROC(arm1022_dma_unmap_area)
345 345
346 .globl arm1022_flush_kern_cache_louis 346 .globl arm1022_flush_kern_cache_louis
@@ -358,7 +358,7 @@ ENTRY(cpu_arm1022_dcache_clean_area)
358 subs r1, r1, #CACHE_DLINESIZE 358 subs r1, r1, #CACHE_DLINESIZE
359 bhi 1b 359 bhi 1b
360#endif 360#endif
361 mov pc, lr 361 ret lr
362 362
363/* =============================== PageTable ============================== */ 363/* =============================== PageTable ============================== */
364 364
@@ -389,7 +389,7 @@ ENTRY(cpu_arm1022_switch_mm)
389 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 389 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
390 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 390 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
391#endif 391#endif
392 mov pc, lr 392 ret lr
393 393
394/* 394/*
395 * cpu_arm1022_set_pte_ext(ptep, pte, ext) 395 * cpu_arm1022_set_pte_ext(ptep, pte, ext)
@@ -405,7 +405,7 @@ ENTRY(cpu_arm1022_set_pte_ext)
405 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 405 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
406#endif 406#endif
407#endif /* CONFIG_MMU */ 407#endif /* CONFIG_MMU */
408 mov pc, lr 408 ret lr
409 409
410 .type __arm1022_setup, #function 410 .type __arm1022_setup, #function
411__arm1022_setup: 411__arm1022_setup:
@@ -423,7 +423,7 @@ __arm1022_setup:
423#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 423#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
424 orr r0, r0, #0x4000 @ .R.............. 424 orr r0, r0, #0x4000 @ .R..............
425#endif 425#endif
426 mov pc, lr 426 ret lr
427 .size __arm1022_setup, . - __arm1022_setup 427 .size __arm1022_setup, . - __arm1022_setup
428 428
429 /* 429 /*
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 4799a24b43e6..fc294067e977 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -62,7 +62,7 @@
62 * cpu_arm1026_proc_init() 62 * cpu_arm1026_proc_init()
63 */ 63 */
64ENTRY(cpu_arm1026_proc_init) 64ENTRY(cpu_arm1026_proc_init)
65 mov pc, lr 65 ret lr
66 66
67/* 67/*
68 * cpu_arm1026_proc_fin() 68 * cpu_arm1026_proc_fin()
@@ -72,7 +72,7 @@ ENTRY(cpu_arm1026_proc_fin)
72 bic r0, r0, #0x1000 @ ...i............ 72 bic r0, r0, #0x1000 @ ...i............
73 bic r0, r0, #0x000e @ ............wca. 73 bic r0, r0, #0x000e @ ............wca.
74 mcr p15, 0, r0, c1, c0, 0 @ disable caches 74 mcr p15, 0, r0, c1, c0, 0 @ disable caches
75 mov pc, lr 75 ret lr
76 76
77/* 77/*
78 * cpu_arm1026_reset(loc) 78 * cpu_arm1026_reset(loc)
@@ -96,7 +96,7 @@ ENTRY(cpu_arm1026_reset)
96 bic ip, ip, #0x000f @ ............wcam 96 bic ip, ip, #0x000f @ ............wcam
97 bic ip, ip, #0x1100 @ ...i...s........ 97 bic ip, ip, #0x1100 @ ...i...s........
98 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 98 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
99 mov pc, r0 99 ret r0
100ENDPROC(cpu_arm1026_reset) 100ENDPROC(cpu_arm1026_reset)
101 .popsection 101 .popsection
102 102
@@ -106,7 +106,7 @@ ENDPROC(cpu_arm1026_reset)
106 .align 5 106 .align 5
107ENTRY(cpu_arm1026_do_idle) 107ENTRY(cpu_arm1026_do_idle)
108 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 108 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
109 mov pc, lr 109 ret lr
110 110
111/* ================================= CACHE ================================ */ 111/* ================================= CACHE ================================ */
112 112
@@ -122,7 +122,7 @@ ENTRY(arm1026_flush_icache_all)
122 mov r0, #0 122 mov r0, #0
123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
124#endif 124#endif
125 mov pc, lr 125 ret lr
126ENDPROC(arm1026_flush_icache_all) 126ENDPROC(arm1026_flush_icache_all)
127 127
128/* 128/*
@@ -151,7 +151,7 @@ __flush_whole_cache:
151 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 151 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
152#endif 152#endif
153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
154 mov pc, lr 154 ret lr
155 155
156/* 156/*
157 * flush_user_cache_range(start, end, flags) 157 * flush_user_cache_range(start, end, flags)
@@ -180,7 +180,7 @@ ENTRY(arm1026_flush_user_cache_range)
180 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 180 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
181#endif 181#endif
182 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 182 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
183 mov pc, lr 183 ret lr
184 184
185/* 185/*
186 * coherent_kern_range(start, end) 186 * coherent_kern_range(start, end)
@@ -219,7 +219,7 @@ ENTRY(arm1026_coherent_user_range)
219 blo 1b 219 blo 1b
220 mcr p15, 0, ip, c7, c10, 4 @ drain WB 220 mcr p15, 0, ip, c7, c10, 4 @ drain WB
221 mov r0, #0 221 mov r0, #0
222 mov pc, lr 222 ret lr
223 223
224/* 224/*
225 * flush_kern_dcache_area(void *addr, size_t size) 225 * flush_kern_dcache_area(void *addr, size_t size)
@@ -240,7 +240,7 @@ ENTRY(arm1026_flush_kern_dcache_area)
240 blo 1b 240 blo 1b
241#endif 241#endif
242 mcr p15, 0, ip, c7, c10, 4 @ drain WB 242 mcr p15, 0, ip, c7, c10, 4 @ drain WB
243 mov pc, lr 243 ret lr
244 244
245/* 245/*
246 * dma_inv_range(start, end) 246 * dma_inv_range(start, end)
@@ -269,7 +269,7 @@ arm1026_dma_inv_range:
269 blo 1b 269 blo 1b
270#endif 270#endif
271 mcr p15, 0, ip, c7, c10, 4 @ drain WB 271 mcr p15, 0, ip, c7, c10, 4 @ drain WB
272 mov pc, lr 272 ret lr
273 273
274/* 274/*
275 * dma_clean_range(start, end) 275 * dma_clean_range(start, end)
@@ -291,7 +291,7 @@ arm1026_dma_clean_range:
291 blo 1b 291 blo 1b
292#endif 292#endif
293 mcr p15, 0, ip, c7, c10, 4 @ drain WB 293 mcr p15, 0, ip, c7, c10, 4 @ drain WB
294 mov pc, lr 294 ret lr
295 295
296/* 296/*
297 * dma_flush_range(start, end) 297 * dma_flush_range(start, end)
@@ -311,7 +311,7 @@ ENTRY(arm1026_dma_flush_range)
311 blo 1b 311 blo 1b
312#endif 312#endif
313 mcr p15, 0, ip, c7, c10, 4 @ drain WB 313 mcr p15, 0, ip, c7, c10, 4 @ drain WB
314 mov pc, lr 314 ret lr
315 315
316/* 316/*
317 * dma_map_area(start, size, dir) 317 * dma_map_area(start, size, dir)
@@ -334,7 +334,7 @@ ENDPROC(arm1026_dma_map_area)
334 * - dir - DMA direction 334 * - dir - DMA direction
335 */ 335 */
336ENTRY(arm1026_dma_unmap_area) 336ENTRY(arm1026_dma_unmap_area)
337 mov pc, lr 337 ret lr
338ENDPROC(arm1026_dma_unmap_area) 338ENDPROC(arm1026_dma_unmap_area)
339 339
340 .globl arm1026_flush_kern_cache_louis 340 .globl arm1026_flush_kern_cache_louis
@@ -352,7 +352,7 @@ ENTRY(cpu_arm1026_dcache_clean_area)
352 subs r1, r1, #CACHE_DLINESIZE 352 subs r1, r1, #CACHE_DLINESIZE
353 bhi 1b 353 bhi 1b
354#endif 354#endif
355 mov pc, lr 355 ret lr
356 356
357/* =============================== PageTable ============================== */ 357/* =============================== PageTable ============================== */
358 358
@@ -378,7 +378,7 @@ ENTRY(cpu_arm1026_switch_mm)
378 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 378 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
379 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 379 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
380#endif 380#endif
381 mov pc, lr 381 ret lr
382 382
383/* 383/*
384 * cpu_arm1026_set_pte_ext(ptep, pte, ext) 384 * cpu_arm1026_set_pte_ext(ptep, pte, ext)
@@ -394,7 +394,7 @@ ENTRY(cpu_arm1026_set_pte_ext)
394 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 394 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
395#endif 395#endif
396#endif /* CONFIG_MMU */ 396#endif /* CONFIG_MMU */
397 mov pc, lr 397 ret lr
398 398
399 .type __arm1026_setup, #function 399 .type __arm1026_setup, #function
400__arm1026_setup: 400__arm1026_setup:
@@ -417,7 +417,7 @@ __arm1026_setup:
417#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 417#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
418 orr r0, r0, #0x4000 @ .R.. .... .... .... 418 orr r0, r0, #0x4000 @ .R.. .... .... ....
419#endif 419#endif
420 mov pc, lr 420 ret lr
421 .size __arm1026_setup, . - __arm1026_setup 421 .size __arm1026_setup, . - __arm1026_setup
422 422
423 /* 423 /*
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index d42c37f9f5bc..2baa66b3ac9b 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -51,14 +51,14 @@
51 */ 51 */
52ENTRY(cpu_arm720_dcache_clean_area) 52ENTRY(cpu_arm720_dcache_clean_area)
53ENTRY(cpu_arm720_proc_init) 53ENTRY(cpu_arm720_proc_init)
54 mov pc, lr 54 ret lr
55 55
56ENTRY(cpu_arm720_proc_fin) 56ENTRY(cpu_arm720_proc_fin)
57 mrc p15, 0, r0, c1, c0, 0 57 mrc p15, 0, r0, c1, c0, 0
58 bic r0, r0, #0x1000 @ ...i............ 58 bic r0, r0, #0x1000 @ ...i............
59 bic r0, r0, #0x000e @ ............wca. 59 bic r0, r0, #0x000e @ ............wca.
60 mcr p15, 0, r0, c1, c0, 0 @ disable caches 60 mcr p15, 0, r0, c1, c0, 0 @ disable caches
61 mov pc, lr 61 ret lr
62 62
63/* 63/*
64 * Function: arm720_proc_do_idle(void) 64 * Function: arm720_proc_do_idle(void)
@@ -66,7 +66,7 @@ ENTRY(cpu_arm720_proc_fin)
66 * Purpose : put the processor in proper idle mode 66 * Purpose : put the processor in proper idle mode
67 */ 67 */
68ENTRY(cpu_arm720_do_idle) 68ENTRY(cpu_arm720_do_idle)
69 mov pc, lr 69 ret lr
70 70
71/* 71/*
72 * Function: arm720_switch_mm(unsigned long pgd_phys) 72 * Function: arm720_switch_mm(unsigned long pgd_phys)
@@ -81,7 +81,7 @@ ENTRY(cpu_arm720_switch_mm)
81 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 81 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
82 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) 82 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
83#endif 83#endif
84 mov pc, lr 84 ret lr
85 85
86/* 86/*
87 * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext) 87 * Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
@@ -94,7 +94,7 @@ ENTRY(cpu_arm720_set_pte_ext)
94#ifdef CONFIG_MMU 94#ifdef CONFIG_MMU
95 armv3_set_pte_ext wc_disable=0 95 armv3_set_pte_ext wc_disable=0
96#endif 96#endif
97 mov pc, lr 97 ret lr
98 98
99/* 99/*
100 * Function: arm720_reset 100 * Function: arm720_reset
@@ -112,7 +112,7 @@ ENTRY(cpu_arm720_reset)
112 bic ip, ip, #0x000f @ ............wcam 112 bic ip, ip, #0x000f @ ............wcam
113 bic ip, ip, #0x2100 @ ..v....s........ 113 bic ip, ip, #0x2100 @ ..v....s........
114 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 114 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
115 mov pc, r0 115 ret r0
116ENDPROC(cpu_arm720_reset) 116ENDPROC(cpu_arm720_reset)
117 .popsection 117 .popsection
118 118
@@ -128,7 +128,7 @@ __arm710_setup:
128 bic r0, r0, r5 128 bic r0, r0, r5
129 ldr r5, arm710_cr1_set 129 ldr r5, arm710_cr1_set
130 orr r0, r0, r5 130 orr r0, r0, r5
131 mov pc, lr @ __ret (head.S) 131 ret lr @ __ret (head.S)
132 .size __arm710_setup, . - __arm710_setup 132 .size __arm710_setup, . - __arm710_setup
133 133
134 /* 134 /*
@@ -156,7 +156,7 @@ __arm720_setup:
156 mrc p15, 0, r0, c1, c0 @ get control register 156 mrc p15, 0, r0, c1, c0 @ get control register
157 bic r0, r0, r5 157 bic r0, r0, r5
158 orr r0, r0, r6 158 orr r0, r0, r6
159 mov pc, lr @ __ret (head.S) 159 ret lr @ __ret (head.S)
160 .size __arm720_setup, . - __arm720_setup 160 .size __arm720_setup, . - __arm720_setup
161 161
162 /* 162 /*
diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S
index 9b0ae90cbf17..ac1ea6b3bce4 100644
--- a/arch/arm/mm/proc-arm740.S
+++ b/arch/arm/mm/proc-arm740.S
@@ -32,7 +32,7 @@ ENTRY(cpu_arm740_proc_init)
32ENTRY(cpu_arm740_do_idle) 32ENTRY(cpu_arm740_do_idle)
33ENTRY(cpu_arm740_dcache_clean_area) 33ENTRY(cpu_arm740_dcache_clean_area)
34ENTRY(cpu_arm740_switch_mm) 34ENTRY(cpu_arm740_switch_mm)
35 mov pc, lr 35 ret lr
36 36
37/* 37/*
38 * cpu_arm740_proc_fin() 38 * cpu_arm740_proc_fin()
@@ -42,7 +42,7 @@ ENTRY(cpu_arm740_proc_fin)
42 bic r0, r0, #0x3f000000 @ bank/f/lock/s 42 bic r0, r0, #0x3f000000 @ bank/f/lock/s
43 bic r0, r0, #0x0000000c @ w-buffer/cache 43 bic r0, r0, #0x0000000c @ w-buffer/cache
44 mcr p15, 0, r0, c1, c0, 0 @ disable caches 44 mcr p15, 0, r0, c1, c0, 0 @ disable caches
45 mov pc, lr 45 ret lr
46 46
47/* 47/*
48 * cpu_arm740_reset(loc) 48 * cpu_arm740_reset(loc)
@@ -56,7 +56,7 @@ ENTRY(cpu_arm740_reset)
56 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register 56 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
57 bic ip, ip, #0x0000000c @ ............wc.. 57 bic ip, ip, #0x0000000c @ ............wc..
58 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 58 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
59 mov pc, r0 59 ret r0
60ENDPROC(cpu_arm740_reset) 60ENDPROC(cpu_arm740_reset)
61 .popsection 61 .popsection
62 62
@@ -115,7 +115,7 @@ __arm740_setup:
115 @ need some benchmark 115 @ need some benchmark
116 orr r0, r0, #0x0000000d @ MPU/Cache/WB 116 orr r0, r0, #0x0000000d @ MPU/Cache/WB
117 117
118 mov pc, lr 118 ret lr
119 119
120 .size __arm740_setup, . - __arm740_setup 120 .size __arm740_setup, . - __arm740_setup
121 121
diff --git a/arch/arm/mm/proc-arm7tdmi.S b/arch/arm/mm/proc-arm7tdmi.S
index f6cc3f63ce39..bf6ba4bc30ff 100644
--- a/arch/arm/mm/proc-arm7tdmi.S
+++ b/arch/arm/mm/proc-arm7tdmi.S
@@ -32,13 +32,13 @@ ENTRY(cpu_arm7tdmi_proc_init)
32ENTRY(cpu_arm7tdmi_do_idle) 32ENTRY(cpu_arm7tdmi_do_idle)
33ENTRY(cpu_arm7tdmi_dcache_clean_area) 33ENTRY(cpu_arm7tdmi_dcache_clean_area)
34ENTRY(cpu_arm7tdmi_switch_mm) 34ENTRY(cpu_arm7tdmi_switch_mm)
35 mov pc, lr 35 ret lr
36 36
37/* 37/*
38 * cpu_arm7tdmi_proc_fin() 38 * cpu_arm7tdmi_proc_fin()
39 */ 39 */
40ENTRY(cpu_arm7tdmi_proc_fin) 40ENTRY(cpu_arm7tdmi_proc_fin)
41 mov pc, lr 41 ret lr
42 42
43/* 43/*
44 * Function: cpu_arm7tdmi_reset(loc) 44 * Function: cpu_arm7tdmi_reset(loc)
@@ -47,13 +47,13 @@ ENTRY(cpu_arm7tdmi_proc_fin)
47 */ 47 */
48 .pushsection .idmap.text, "ax" 48 .pushsection .idmap.text, "ax"
49ENTRY(cpu_arm7tdmi_reset) 49ENTRY(cpu_arm7tdmi_reset)
50 mov pc, r0 50 ret r0
51ENDPROC(cpu_arm7tdmi_reset) 51ENDPROC(cpu_arm7tdmi_reset)
52 .popsection 52 .popsection
53 53
54 .type __arm7tdmi_setup, #function 54 .type __arm7tdmi_setup, #function
55__arm7tdmi_setup: 55__arm7tdmi_setup:
56 mov pc, lr 56 ret lr
57 .size __arm7tdmi_setup, . - __arm7tdmi_setup 57 .size __arm7tdmi_setup, . - __arm7tdmi_setup
58 58
59 __INITDATA 59 __INITDATA
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 549557df6d57..22bf8dde4f84 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -63,7 +63,7 @@
63 * cpu_arm920_proc_init() 63 * cpu_arm920_proc_init()
64 */ 64 */
65ENTRY(cpu_arm920_proc_init) 65ENTRY(cpu_arm920_proc_init)
66 mov pc, lr 66 ret lr
67 67
68/* 68/*
69 * cpu_arm920_proc_fin() 69 * cpu_arm920_proc_fin()
@@ -73,7 +73,7 @@ ENTRY(cpu_arm920_proc_fin)
73 bic r0, r0, #0x1000 @ ...i............ 73 bic r0, r0, #0x1000 @ ...i............
74 bic r0, r0, #0x000e @ ............wca. 74 bic r0, r0, #0x000e @ ............wca.
75 mcr p15, 0, r0, c1, c0, 0 @ disable caches 75 mcr p15, 0, r0, c1, c0, 0 @ disable caches
76 mov pc, lr 76 ret lr
77 77
78/* 78/*
79 * cpu_arm920_reset(loc) 79 * cpu_arm920_reset(loc)
@@ -97,7 +97,7 @@ ENTRY(cpu_arm920_reset)
97 bic ip, ip, #0x000f @ ............wcam 97 bic ip, ip, #0x000f @ ............wcam
98 bic ip, ip, #0x1100 @ ...i...s........ 98 bic ip, ip, #0x1100 @ ...i...s........
99 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 99 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
100 mov pc, r0 100 ret r0
101ENDPROC(cpu_arm920_reset) 101ENDPROC(cpu_arm920_reset)
102 .popsection 102 .popsection
103 103
@@ -107,7 +107,7 @@ ENDPROC(cpu_arm920_reset)
107 .align 5 107 .align 5
108ENTRY(cpu_arm920_do_idle) 108ENTRY(cpu_arm920_do_idle)
109 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 109 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
110 mov pc, lr 110 ret lr
111 111
112 112
113#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 113#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
@@ -120,7 +120,7 @@ ENTRY(cpu_arm920_do_idle)
120ENTRY(arm920_flush_icache_all) 120ENTRY(arm920_flush_icache_all)
121 mov r0, #0 121 mov r0, #0
122 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 122 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
123 mov pc, lr 123 ret lr
124ENDPROC(arm920_flush_icache_all) 124ENDPROC(arm920_flush_icache_all)
125 125
126/* 126/*
@@ -151,7 +151,7 @@ __flush_whole_cache:
151 tst r2, #VM_EXEC 151 tst r2, #VM_EXEC
152 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 152 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
154 mov pc, lr 154 ret lr
155 155
156/* 156/*
157 * flush_user_cache_range(start, end, flags) 157 * flush_user_cache_range(start, end, flags)
@@ -177,7 +177,7 @@ ENTRY(arm920_flush_user_cache_range)
177 blo 1b 177 blo 1b
178 tst r2, #VM_EXEC 178 tst r2, #VM_EXEC
179 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 179 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
180 mov pc, lr 180 ret lr
181 181
182/* 182/*
183 * coherent_kern_range(start, end) 183 * coherent_kern_range(start, end)
@@ -211,7 +211,7 @@ ENTRY(arm920_coherent_user_range)
211 blo 1b 211 blo 1b
212 mcr p15, 0, r0, c7, c10, 4 @ drain WB 212 mcr p15, 0, r0, c7, c10, 4 @ drain WB
213 mov r0, #0 213 mov r0, #0
214 mov pc, lr 214 ret lr
215 215
216/* 216/*
217 * flush_kern_dcache_area(void *addr, size_t size) 217 * flush_kern_dcache_area(void *addr, size_t size)
@@ -231,7 +231,7 @@ ENTRY(arm920_flush_kern_dcache_area)
231 mov r0, #0 231 mov r0, #0
232 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 232 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
233 mcr p15, 0, r0, c7, c10, 4 @ drain WB 233 mcr p15, 0, r0, c7, c10, 4 @ drain WB
234 mov pc, lr 234 ret lr
235 235
236/* 236/*
237 * dma_inv_range(start, end) 237 * dma_inv_range(start, end)
@@ -257,7 +257,7 @@ arm920_dma_inv_range:
257 cmp r0, r1 257 cmp r0, r1
258 blo 1b 258 blo 1b
259 mcr p15, 0, r0, c7, c10, 4 @ drain WB 259 mcr p15, 0, r0, c7, c10, 4 @ drain WB
260 mov pc, lr 260 ret lr
261 261
262/* 262/*
263 * dma_clean_range(start, end) 263 * dma_clean_range(start, end)
@@ -276,7 +276,7 @@ arm920_dma_clean_range:
276 cmp r0, r1 276 cmp r0, r1
277 blo 1b 277 blo 1b
278 mcr p15, 0, r0, c7, c10, 4 @ drain WB 278 mcr p15, 0, r0, c7, c10, 4 @ drain WB
279 mov pc, lr 279 ret lr
280 280
281/* 281/*
282 * dma_flush_range(start, end) 282 * dma_flush_range(start, end)
@@ -293,7 +293,7 @@ ENTRY(arm920_dma_flush_range)
293 cmp r0, r1 293 cmp r0, r1
294 blo 1b 294 blo 1b
295 mcr p15, 0, r0, c7, c10, 4 @ drain WB 295 mcr p15, 0, r0, c7, c10, 4 @ drain WB
296 mov pc, lr 296 ret lr
297 297
298/* 298/*
299 * dma_map_area(start, size, dir) 299 * dma_map_area(start, size, dir)
@@ -316,7 +316,7 @@ ENDPROC(arm920_dma_map_area)
316 * - dir - DMA direction 316 * - dir - DMA direction
317 */ 317 */
318ENTRY(arm920_dma_unmap_area) 318ENTRY(arm920_dma_unmap_area)
319 mov pc, lr 319 ret lr
320ENDPROC(arm920_dma_unmap_area) 320ENDPROC(arm920_dma_unmap_area)
321 321
322 .globl arm920_flush_kern_cache_louis 322 .globl arm920_flush_kern_cache_louis
@@ -332,7 +332,7 @@ ENTRY(cpu_arm920_dcache_clean_area)
332 add r0, r0, #CACHE_DLINESIZE 332 add r0, r0, #CACHE_DLINESIZE
333 subs r1, r1, #CACHE_DLINESIZE 333 subs r1, r1, #CACHE_DLINESIZE
334 bhi 1b 334 bhi 1b
335 mov pc, lr 335 ret lr
336 336
337/* =============================== PageTable ============================== */ 337/* =============================== PageTable ============================== */
338 338
@@ -367,7 +367,7 @@ ENTRY(cpu_arm920_switch_mm)
367 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 367 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
368 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 368 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
369#endif 369#endif
370 mov pc, lr 370 ret lr
371 371
372/* 372/*
373 * cpu_arm920_set_pte(ptep, pte, ext) 373 * cpu_arm920_set_pte(ptep, pte, ext)
@@ -382,7 +382,7 @@ ENTRY(cpu_arm920_set_pte_ext)
382 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 382 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
383 mcr p15, 0, r0, c7, c10, 4 @ drain WB 383 mcr p15, 0, r0, c7, c10, 4 @ drain WB
384#endif 384#endif
385 mov pc, lr 385 ret lr
386 386
387/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 387/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
388.globl cpu_arm920_suspend_size 388.globl cpu_arm920_suspend_size
@@ -423,7 +423,7 @@ __arm920_setup:
423 mrc p15, 0, r0, c1, c0 @ get control register v4 423 mrc p15, 0, r0, c1, c0 @ get control register v4
424 bic r0, r0, r5 424 bic r0, r0, r5
425 orr r0, r0, r6 425 orr r0, r0, r6
426 mov pc, lr 426 ret lr
427 .size __arm920_setup, . - __arm920_setup 427 .size __arm920_setup, . - __arm920_setup
428 428
429 /* 429 /*
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index 2a758b06c6f6..0c6d5ac5a6d4 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -65,7 +65,7 @@
65 * cpu_arm922_proc_init() 65 * cpu_arm922_proc_init()
66 */ 66 */
67ENTRY(cpu_arm922_proc_init) 67ENTRY(cpu_arm922_proc_init)
68 mov pc, lr 68 ret lr
69 69
70/* 70/*
71 * cpu_arm922_proc_fin() 71 * cpu_arm922_proc_fin()
@@ -75,7 +75,7 @@ ENTRY(cpu_arm922_proc_fin)
75 bic r0, r0, #0x1000 @ ...i............ 75 bic r0, r0, #0x1000 @ ...i............
76 bic r0, r0, #0x000e @ ............wca. 76 bic r0, r0, #0x000e @ ............wca.
77 mcr p15, 0, r0, c1, c0, 0 @ disable caches 77 mcr p15, 0, r0, c1, c0, 0 @ disable caches
78 mov pc, lr 78 ret lr
79 79
80/* 80/*
81 * cpu_arm922_reset(loc) 81 * cpu_arm922_reset(loc)
@@ -99,7 +99,7 @@ ENTRY(cpu_arm922_reset)
99 bic ip, ip, #0x000f @ ............wcam 99 bic ip, ip, #0x000f @ ............wcam
100 bic ip, ip, #0x1100 @ ...i...s........ 100 bic ip, ip, #0x1100 @ ...i...s........
101 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 101 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
102 mov pc, r0 102 ret r0
103ENDPROC(cpu_arm922_reset) 103ENDPROC(cpu_arm922_reset)
104 .popsection 104 .popsection
105 105
@@ -109,7 +109,7 @@ ENDPROC(cpu_arm922_reset)
109 .align 5 109 .align 5
110ENTRY(cpu_arm922_do_idle) 110ENTRY(cpu_arm922_do_idle)
111 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 111 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
112 mov pc, lr 112 ret lr
113 113
114 114
115#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 115#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
@@ -122,7 +122,7 @@ ENTRY(cpu_arm922_do_idle)
122ENTRY(arm922_flush_icache_all) 122ENTRY(arm922_flush_icache_all)
123 mov r0, #0 123 mov r0, #0
124 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 124 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
125 mov pc, lr 125 ret lr
126ENDPROC(arm922_flush_icache_all) 126ENDPROC(arm922_flush_icache_all)
127 127
128/* 128/*
@@ -153,7 +153,7 @@ __flush_whole_cache:
153 tst r2, #VM_EXEC 153 tst r2, #VM_EXEC
154 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 154 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
155 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 155 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
156 mov pc, lr 156 ret lr
157 157
158/* 158/*
159 * flush_user_cache_range(start, end, flags) 159 * flush_user_cache_range(start, end, flags)
@@ -179,7 +179,7 @@ ENTRY(arm922_flush_user_cache_range)
179 blo 1b 179 blo 1b
180 tst r2, #VM_EXEC 180 tst r2, #VM_EXEC
181 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 181 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
182 mov pc, lr 182 ret lr
183 183
184/* 184/*
185 * coherent_kern_range(start, end) 185 * coherent_kern_range(start, end)
@@ -213,7 +213,7 @@ ENTRY(arm922_coherent_user_range)
213 blo 1b 213 blo 1b
214 mcr p15, 0, r0, c7, c10, 4 @ drain WB 214 mcr p15, 0, r0, c7, c10, 4 @ drain WB
215 mov r0, #0 215 mov r0, #0
216 mov pc, lr 216 ret lr
217 217
218/* 218/*
219 * flush_kern_dcache_area(void *addr, size_t size) 219 * flush_kern_dcache_area(void *addr, size_t size)
@@ -233,7 +233,7 @@ ENTRY(arm922_flush_kern_dcache_area)
233 mov r0, #0 233 mov r0, #0
234 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 234 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
235 mcr p15, 0, r0, c7, c10, 4 @ drain WB 235 mcr p15, 0, r0, c7, c10, 4 @ drain WB
236 mov pc, lr 236 ret lr
237 237
238/* 238/*
239 * dma_inv_range(start, end) 239 * dma_inv_range(start, end)
@@ -259,7 +259,7 @@ arm922_dma_inv_range:
259 cmp r0, r1 259 cmp r0, r1
260 blo 1b 260 blo 1b
261 mcr p15, 0, r0, c7, c10, 4 @ drain WB 261 mcr p15, 0, r0, c7, c10, 4 @ drain WB
262 mov pc, lr 262 ret lr
263 263
264/* 264/*
265 * dma_clean_range(start, end) 265 * dma_clean_range(start, end)
@@ -278,7 +278,7 @@ arm922_dma_clean_range:
278 cmp r0, r1 278 cmp r0, r1
279 blo 1b 279 blo 1b
280 mcr p15, 0, r0, c7, c10, 4 @ drain WB 280 mcr p15, 0, r0, c7, c10, 4 @ drain WB
281 mov pc, lr 281 ret lr
282 282
283/* 283/*
284 * dma_flush_range(start, end) 284 * dma_flush_range(start, end)
@@ -295,7 +295,7 @@ ENTRY(arm922_dma_flush_range)
295 cmp r0, r1 295 cmp r0, r1
296 blo 1b 296 blo 1b
297 mcr p15, 0, r0, c7, c10, 4 @ drain WB 297 mcr p15, 0, r0, c7, c10, 4 @ drain WB
298 mov pc, lr 298 ret lr
299 299
300/* 300/*
301 * dma_map_area(start, size, dir) 301 * dma_map_area(start, size, dir)
@@ -318,7 +318,7 @@ ENDPROC(arm922_dma_map_area)
318 * - dir - DMA direction 318 * - dir - DMA direction
319 */ 319 */
320ENTRY(arm922_dma_unmap_area) 320ENTRY(arm922_dma_unmap_area)
321 mov pc, lr 321 ret lr
322ENDPROC(arm922_dma_unmap_area) 322ENDPROC(arm922_dma_unmap_area)
323 323
324 .globl arm922_flush_kern_cache_louis 324 .globl arm922_flush_kern_cache_louis
@@ -336,7 +336,7 @@ ENTRY(cpu_arm922_dcache_clean_area)
336 subs r1, r1, #CACHE_DLINESIZE 336 subs r1, r1, #CACHE_DLINESIZE
337 bhi 1b 337 bhi 1b
338#endif 338#endif
339 mov pc, lr 339 ret lr
340 340
341/* =============================== PageTable ============================== */ 341/* =============================== PageTable ============================== */
342 342
@@ -371,7 +371,7 @@ ENTRY(cpu_arm922_switch_mm)
371 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 371 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
372 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 372 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
373#endif 373#endif
374 mov pc, lr 374 ret lr
375 375
376/* 376/*
377 * cpu_arm922_set_pte_ext(ptep, pte, ext) 377 * cpu_arm922_set_pte_ext(ptep, pte, ext)
@@ -386,7 +386,7 @@ ENTRY(cpu_arm922_set_pte_ext)
386 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 386 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
387 mcr p15, 0, r0, c7, c10, 4 @ drain WB 387 mcr p15, 0, r0, c7, c10, 4 @ drain WB
388#endif /* CONFIG_MMU */ 388#endif /* CONFIG_MMU */
389 mov pc, lr 389 ret lr
390 390
391 .type __arm922_setup, #function 391 .type __arm922_setup, #function
392__arm922_setup: 392__arm922_setup:
@@ -401,7 +401,7 @@ __arm922_setup:
401 mrc p15, 0, r0, c1, c0 @ get control register v4 401 mrc p15, 0, r0, c1, c0 @ get control register v4
402 bic r0, r0, r5 402 bic r0, r0, r5
403 orr r0, r0, r6 403 orr r0, r0, r6
404 mov pc, lr 404 ret lr
405 .size __arm922_setup, . - __arm922_setup 405 .size __arm922_setup, . - __arm922_setup
406 406
407 /* 407 /*
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index ba0d58e1a2a2..c32d073282ea 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -86,7 +86,7 @@
86 * cpu_arm925_proc_init() 86 * cpu_arm925_proc_init()
87 */ 87 */
88ENTRY(cpu_arm925_proc_init) 88ENTRY(cpu_arm925_proc_init)
89 mov pc, lr 89 ret lr
90 90
91/* 91/*
92 * cpu_arm925_proc_fin() 92 * cpu_arm925_proc_fin()
@@ -96,7 +96,7 @@ ENTRY(cpu_arm925_proc_fin)
96 bic r0, r0, #0x1000 @ ...i............ 96 bic r0, r0, #0x1000 @ ...i............
97 bic r0, r0, #0x000e @ ............wca. 97 bic r0, r0, #0x000e @ ............wca.
98 mcr p15, 0, r0, c1, c0, 0 @ disable caches 98 mcr p15, 0, r0, c1, c0, 0 @ disable caches
99 mov pc, lr 99 ret lr
100 100
101/* 101/*
102 * cpu_arm925_reset(loc) 102 * cpu_arm925_reset(loc)
@@ -129,7 +129,7 @@ ENDPROC(cpu_arm925_reset)
129 bic ip, ip, #0x000f @ ............wcam 129 bic ip, ip, #0x000f @ ............wcam
130 bic ip, ip, #0x1100 @ ...i...s........ 130 bic ip, ip, #0x1100 @ ...i...s........
131 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 131 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
132 mov pc, r0 132 ret r0
133 133
134/* 134/*
135 * cpu_arm925_do_idle() 135 * cpu_arm925_do_idle()
@@ -145,7 +145,7 @@ ENTRY(cpu_arm925_do_idle)
145 mcr p15, 0, r2, c1, c0, 0 @ Disable I cache 145 mcr p15, 0, r2, c1, c0, 0 @ Disable I cache
146 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 146 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
147 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable 147 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable
148 mov pc, lr 148 ret lr
149 149
150/* 150/*
151 * flush_icache_all() 151 * flush_icache_all()
@@ -155,7 +155,7 @@ ENTRY(cpu_arm925_do_idle)
155ENTRY(arm925_flush_icache_all) 155ENTRY(arm925_flush_icache_all)
156 mov r0, #0 156 mov r0, #0
157 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 157 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
158 mov pc, lr 158 ret lr
159ENDPROC(arm925_flush_icache_all) 159ENDPROC(arm925_flush_icache_all)
160 160
161/* 161/*
@@ -188,7 +188,7 @@ __flush_whole_cache:
188 tst r2, #VM_EXEC 188 tst r2, #VM_EXEC
189 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 189 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
191 mov pc, lr 191 ret lr
192 192
193/* 193/*
194 * flush_user_cache_range(start, end, flags) 194 * flush_user_cache_range(start, end, flags)
@@ -225,7 +225,7 @@ ENTRY(arm925_flush_user_cache_range)
225 blo 1b 225 blo 1b
226 tst r2, #VM_EXEC 226 tst r2, #VM_EXEC
227 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 227 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
228 mov pc, lr 228 ret lr
229 229
230/* 230/*
231 * coherent_kern_range(start, end) 231 * coherent_kern_range(start, end)
@@ -259,7 +259,7 @@ ENTRY(arm925_coherent_user_range)
259 blo 1b 259 blo 1b
260 mcr p15, 0, r0, c7, c10, 4 @ drain WB 260 mcr p15, 0, r0, c7, c10, 4 @ drain WB
261 mov r0, #0 261 mov r0, #0
262 mov pc, lr 262 ret lr
263 263
264/* 264/*
265 * flush_kern_dcache_area(void *addr, size_t size) 265 * flush_kern_dcache_area(void *addr, size_t size)
@@ -279,7 +279,7 @@ ENTRY(arm925_flush_kern_dcache_area)
279 mov r0, #0 279 mov r0, #0
280 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 280 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
281 mcr p15, 0, r0, c7, c10, 4 @ drain WB 281 mcr p15, 0, r0, c7, c10, 4 @ drain WB
282 mov pc, lr 282 ret lr
283 283
284/* 284/*
285 * dma_inv_range(start, end) 285 * dma_inv_range(start, end)
@@ -307,7 +307,7 @@ arm925_dma_inv_range:
307 cmp r0, r1 307 cmp r0, r1
308 blo 1b 308 blo 1b
309 mcr p15, 0, r0, c7, c10, 4 @ drain WB 309 mcr p15, 0, r0, c7, c10, 4 @ drain WB
310 mov pc, lr 310 ret lr
311 311
312/* 312/*
313 * dma_clean_range(start, end) 313 * dma_clean_range(start, end)
@@ -328,7 +328,7 @@ arm925_dma_clean_range:
328 blo 1b 328 blo 1b
329#endif 329#endif
330 mcr p15, 0, r0, c7, c10, 4 @ drain WB 330 mcr p15, 0, r0, c7, c10, 4 @ drain WB
331 mov pc, lr 331 ret lr
332 332
333/* 333/*
334 * dma_flush_range(start, end) 334 * dma_flush_range(start, end)
@@ -350,7 +350,7 @@ ENTRY(arm925_dma_flush_range)
350 cmp r0, r1 350 cmp r0, r1
351 blo 1b 351 blo 1b
352 mcr p15, 0, r0, c7, c10, 4 @ drain WB 352 mcr p15, 0, r0, c7, c10, 4 @ drain WB
353 mov pc, lr 353 ret lr
354 354
355/* 355/*
356 * dma_map_area(start, size, dir) 356 * dma_map_area(start, size, dir)
@@ -373,7 +373,7 @@ ENDPROC(arm925_dma_map_area)
373 * - dir - DMA direction 373 * - dir - DMA direction
374 */ 374 */
375ENTRY(arm925_dma_unmap_area) 375ENTRY(arm925_dma_unmap_area)
376 mov pc, lr 376 ret lr
377ENDPROC(arm925_dma_unmap_area) 377ENDPROC(arm925_dma_unmap_area)
378 378
379 .globl arm925_flush_kern_cache_louis 379 .globl arm925_flush_kern_cache_louis
@@ -390,7 +390,7 @@ ENTRY(cpu_arm925_dcache_clean_area)
390 bhi 1b 390 bhi 1b
391#endif 391#endif
392 mcr p15, 0, r0, c7, c10, 4 @ drain WB 392 mcr p15, 0, r0, c7, c10, 4 @ drain WB
393 mov pc, lr 393 ret lr
394 394
395/* =============================== PageTable ============================== */ 395/* =============================== PageTable ============================== */
396 396
@@ -419,7 +419,7 @@ ENTRY(cpu_arm925_switch_mm)
419 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 419 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
420 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 420 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
421#endif 421#endif
422 mov pc, lr 422 ret lr
423 423
424/* 424/*
425 * cpu_arm925_set_pte_ext(ptep, pte, ext) 425 * cpu_arm925_set_pte_ext(ptep, pte, ext)
@@ -436,7 +436,7 @@ ENTRY(cpu_arm925_set_pte_ext)
436#endif 436#endif
437 mcr p15, 0, r0, c7, c10, 4 @ drain WB 437 mcr p15, 0, r0, c7, c10, 4 @ drain WB
438#endif /* CONFIG_MMU */ 438#endif /* CONFIG_MMU */
439 mov pc, lr 439 ret lr
440 440
441 .type __arm925_setup, #function 441 .type __arm925_setup, #function
442__arm925_setup: 442__arm925_setup:
@@ -469,7 +469,7 @@ __arm925_setup:
469#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 469#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
470 orr r0, r0, #0x4000 @ .1.. .... .... .... 470 orr r0, r0, #0x4000 @ .1.. .... .... ....
471#endif 471#endif
472 mov pc, lr 472 ret lr
473 .size __arm925_setup, . - __arm925_setup 473 .size __arm925_setup, . - __arm925_setup
474 474
475 /* 475 /*
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 0f098f407c9f..252b2503038d 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -55,7 +55,7 @@
55 * cpu_arm926_proc_init() 55 * cpu_arm926_proc_init()
56 */ 56 */
57ENTRY(cpu_arm926_proc_init) 57ENTRY(cpu_arm926_proc_init)
58 mov pc, lr 58 ret lr
59 59
60/* 60/*
61 * cpu_arm926_proc_fin() 61 * cpu_arm926_proc_fin()
@@ -65,7 +65,7 @@ ENTRY(cpu_arm926_proc_fin)
65 bic r0, r0, #0x1000 @ ...i............ 65 bic r0, r0, #0x1000 @ ...i............
66 bic r0, r0, #0x000e @ ............wca. 66 bic r0, r0, #0x000e @ ............wca.
67 mcr p15, 0, r0, c1, c0, 0 @ disable caches 67 mcr p15, 0, r0, c1, c0, 0 @ disable caches
68 mov pc, lr 68 ret lr
69 69
70/* 70/*
71 * cpu_arm926_reset(loc) 71 * cpu_arm926_reset(loc)
@@ -89,7 +89,7 @@ ENTRY(cpu_arm926_reset)
89 bic ip, ip, #0x000f @ ............wcam 89 bic ip, ip, #0x000f @ ............wcam
90 bic ip, ip, #0x1100 @ ...i...s........ 90 bic ip, ip, #0x1100 @ ...i...s........
91 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 91 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
92 mov pc, r0 92 ret r0
93ENDPROC(cpu_arm926_reset) 93ENDPROC(cpu_arm926_reset)
94 .popsection 94 .popsection
95 95
@@ -111,7 +111,7 @@ ENTRY(cpu_arm926_do_idle)
111 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 111 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
112 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable 112 mcr p15, 0, r1, c1, c0, 0 @ Restore ICache enable
113 msr cpsr_c, r3 @ Restore FIQ state 113 msr cpsr_c, r3 @ Restore FIQ state
114 mov pc, lr 114 ret lr
115 115
116/* 116/*
117 * flush_icache_all() 117 * flush_icache_all()
@@ -121,7 +121,7 @@ ENTRY(cpu_arm926_do_idle)
121ENTRY(arm926_flush_icache_all) 121ENTRY(arm926_flush_icache_all)
122 mov r0, #0 122 mov r0, #0
123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 123 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
124 mov pc, lr 124 ret lr
125ENDPROC(arm926_flush_icache_all) 125ENDPROC(arm926_flush_icache_all)
126 126
127/* 127/*
@@ -151,7 +151,7 @@ __flush_whole_cache:
151 tst r2, #VM_EXEC 151 tst r2, #VM_EXEC
152 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 152 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 153 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
154 mov pc, lr 154 ret lr
155 155
156/* 156/*
157 * flush_user_cache_range(start, end, flags) 157 * flush_user_cache_range(start, end, flags)
@@ -188,7 +188,7 @@ ENTRY(arm926_flush_user_cache_range)
188 blo 1b 188 blo 1b
189 tst r2, #VM_EXEC 189 tst r2, #VM_EXEC
190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
191 mov pc, lr 191 ret lr
192 192
193/* 193/*
194 * coherent_kern_range(start, end) 194 * coherent_kern_range(start, end)
@@ -222,7 +222,7 @@ ENTRY(arm926_coherent_user_range)
222 blo 1b 222 blo 1b
223 mcr p15, 0, r0, c7, c10, 4 @ drain WB 223 mcr p15, 0, r0, c7, c10, 4 @ drain WB
224 mov r0, #0 224 mov r0, #0
225 mov pc, lr 225 ret lr
226 226
227/* 227/*
228 * flush_kern_dcache_area(void *addr, size_t size) 228 * flush_kern_dcache_area(void *addr, size_t size)
@@ -242,7 +242,7 @@ ENTRY(arm926_flush_kern_dcache_area)
242 mov r0, #0 242 mov r0, #0
243 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 243 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
244 mcr p15, 0, r0, c7, c10, 4 @ drain WB 244 mcr p15, 0, r0, c7, c10, 4 @ drain WB
245 mov pc, lr 245 ret lr
246 246
247/* 247/*
248 * dma_inv_range(start, end) 248 * dma_inv_range(start, end)
@@ -270,7 +270,7 @@ arm926_dma_inv_range:
270 cmp r0, r1 270 cmp r0, r1
271 blo 1b 271 blo 1b
272 mcr p15, 0, r0, c7, c10, 4 @ drain WB 272 mcr p15, 0, r0, c7, c10, 4 @ drain WB
273 mov pc, lr 273 ret lr
274 274
275/* 275/*
276 * dma_clean_range(start, end) 276 * dma_clean_range(start, end)
@@ -291,7 +291,7 @@ arm926_dma_clean_range:
291 blo 1b 291 blo 1b
292#endif 292#endif
293 mcr p15, 0, r0, c7, c10, 4 @ drain WB 293 mcr p15, 0, r0, c7, c10, 4 @ drain WB
294 mov pc, lr 294 ret lr
295 295
296/* 296/*
297 * dma_flush_range(start, end) 297 * dma_flush_range(start, end)
@@ -313,7 +313,7 @@ ENTRY(arm926_dma_flush_range)
313 cmp r0, r1 313 cmp r0, r1
314 blo 1b 314 blo 1b
315 mcr p15, 0, r0, c7, c10, 4 @ drain WB 315 mcr p15, 0, r0, c7, c10, 4 @ drain WB
316 mov pc, lr 316 ret lr
317 317
318/* 318/*
319 * dma_map_area(start, size, dir) 319 * dma_map_area(start, size, dir)
@@ -336,7 +336,7 @@ ENDPROC(arm926_dma_map_area)
336 * - dir - DMA direction 336 * - dir - DMA direction
337 */ 337 */
338ENTRY(arm926_dma_unmap_area) 338ENTRY(arm926_dma_unmap_area)
339 mov pc, lr 339 ret lr
340ENDPROC(arm926_dma_unmap_area) 340ENDPROC(arm926_dma_unmap_area)
341 341
342 .globl arm926_flush_kern_cache_louis 342 .globl arm926_flush_kern_cache_louis
@@ -353,7 +353,7 @@ ENTRY(cpu_arm926_dcache_clean_area)
353 bhi 1b 353 bhi 1b
354#endif 354#endif
355 mcr p15, 0, r0, c7, c10, 4 @ drain WB 355 mcr p15, 0, r0, c7, c10, 4 @ drain WB
356 mov pc, lr 356 ret lr
357 357
358/* =============================== PageTable ============================== */ 358/* =============================== PageTable ============================== */
359 359
@@ -380,7 +380,7 @@ ENTRY(cpu_arm926_switch_mm)
380 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 380 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
381 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 381 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
382#endif 382#endif
383 mov pc, lr 383 ret lr
384 384
385/* 385/*
386 * cpu_arm926_set_pte_ext(ptep, pte, ext) 386 * cpu_arm926_set_pte_ext(ptep, pte, ext)
@@ -397,7 +397,7 @@ ENTRY(cpu_arm926_set_pte_ext)
397#endif 397#endif
398 mcr p15, 0, r0, c7, c10, 4 @ drain WB 398 mcr p15, 0, r0, c7, c10, 4 @ drain WB
399#endif 399#endif
400 mov pc, lr 400 ret lr
401 401
402/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 402/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
403.globl cpu_arm926_suspend_size 403.globl cpu_arm926_suspend_size
@@ -448,7 +448,7 @@ __arm926_setup:
448#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 448#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
449 orr r0, r0, #0x4000 @ .1.. .... .... .... 449 orr r0, r0, #0x4000 @ .1.. .... .... ....
450#endif 450#endif
451 mov pc, lr 451 ret lr
452 .size __arm926_setup, . - __arm926_setup 452 .size __arm926_setup, . - __arm926_setup
453 453
454 /* 454 /*
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 1c39a704ff6e..e5212d489377 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -31,7 +31,7 @@
31 */ 31 */
32ENTRY(cpu_arm940_proc_init) 32ENTRY(cpu_arm940_proc_init)
33ENTRY(cpu_arm940_switch_mm) 33ENTRY(cpu_arm940_switch_mm)
34 mov pc, lr 34 ret lr
35 35
36/* 36/*
37 * cpu_arm940_proc_fin() 37 * cpu_arm940_proc_fin()
@@ -41,7 +41,7 @@ ENTRY(cpu_arm940_proc_fin)
41 bic r0, r0, #0x00001000 @ i-cache 41 bic r0, r0, #0x00001000 @ i-cache
42 bic r0, r0, #0x00000004 @ d-cache 42 bic r0, r0, #0x00000004 @ d-cache
43 mcr p15, 0, r0, c1, c0, 0 @ disable caches 43 mcr p15, 0, r0, c1, c0, 0 @ disable caches
44 mov pc, lr 44 ret lr
45 45
46/* 46/*
47 * cpu_arm940_reset(loc) 47 * cpu_arm940_reset(loc)
@@ -58,7 +58,7 @@ ENTRY(cpu_arm940_reset)
58 bic ip, ip, #0x00000005 @ .............c.p 58 bic ip, ip, #0x00000005 @ .............c.p
59 bic ip, ip, #0x00001000 @ i-cache 59 bic ip, ip, #0x00001000 @ i-cache
60 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 60 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
61 mov pc, r0 61 ret r0
62ENDPROC(cpu_arm940_reset) 62ENDPROC(cpu_arm940_reset)
63 .popsection 63 .popsection
64 64
@@ -68,7 +68,7 @@ ENDPROC(cpu_arm940_reset)
68 .align 5 68 .align 5
69ENTRY(cpu_arm940_do_idle) 69ENTRY(cpu_arm940_do_idle)
70 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 70 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
71 mov pc, lr 71 ret lr
72 72
73/* 73/*
74 * flush_icache_all() 74 * flush_icache_all()
@@ -78,7 +78,7 @@ ENTRY(cpu_arm940_do_idle)
78ENTRY(arm940_flush_icache_all) 78ENTRY(arm940_flush_icache_all)
79 mov r0, #0 79 mov r0, #0
80 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 80 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
81 mov pc, lr 81 ret lr
82ENDPROC(arm940_flush_icache_all) 82ENDPROC(arm940_flush_icache_all)
83 83
84/* 84/*
@@ -122,7 +122,7 @@ ENTRY(arm940_flush_user_cache_range)
122 tst r2, #VM_EXEC 122 tst r2, #VM_EXEC
123 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 123 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
124 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 124 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
125 mov pc, lr 125 ret lr
126 126
127/* 127/*
128 * coherent_kern_range(start, end) 128 * coherent_kern_range(start, end)
@@ -170,7 +170,7 @@ ENTRY(arm940_flush_kern_dcache_area)
170 bcs 1b @ segments 7 to 0 170 bcs 1b @ segments 7 to 0
171 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 171 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
172 mcr p15, 0, r0, c7, c10, 4 @ drain WB 172 mcr p15, 0, r0, c7, c10, 4 @ drain WB
173 mov pc, lr 173 ret lr
174 174
175/* 175/*
176 * dma_inv_range(start, end) 176 * dma_inv_range(start, end)
@@ -191,7 +191,7 @@ arm940_dma_inv_range:
191 subs r1, r1, #1 << 4 191 subs r1, r1, #1 << 4
192 bcs 1b @ segments 7 to 0 192 bcs 1b @ segments 7 to 0
193 mcr p15, 0, ip, c7, c10, 4 @ drain WB 193 mcr p15, 0, ip, c7, c10, 4 @ drain WB
194 mov pc, lr 194 ret lr
195 195
196/* 196/*
197 * dma_clean_range(start, end) 197 * dma_clean_range(start, end)
@@ -215,7 +215,7 @@ ENTRY(cpu_arm940_dcache_clean_area)
215 bcs 1b @ segments 7 to 0 215 bcs 1b @ segments 7 to 0
216#endif 216#endif
217 mcr p15, 0, ip, c7, c10, 4 @ drain WB 217 mcr p15, 0, ip, c7, c10, 4 @ drain WB
218 mov pc, lr 218 ret lr
219 219
220/* 220/*
221 * dma_flush_range(start, end) 221 * dma_flush_range(start, end)
@@ -241,7 +241,7 @@ ENTRY(arm940_dma_flush_range)
241 subs r1, r1, #1 << 4 241 subs r1, r1, #1 << 4
242 bcs 1b @ segments 7 to 0 242 bcs 1b @ segments 7 to 0
243 mcr p15, 0, ip, c7, c10, 4 @ drain WB 243 mcr p15, 0, ip, c7, c10, 4 @ drain WB
244 mov pc, lr 244 ret lr
245 245
246/* 246/*
247 * dma_map_area(start, size, dir) 247 * dma_map_area(start, size, dir)
@@ -264,7 +264,7 @@ ENDPROC(arm940_dma_map_area)
264 * - dir - DMA direction 264 * - dir - DMA direction
265 */ 265 */
266ENTRY(arm940_dma_unmap_area) 266ENTRY(arm940_dma_unmap_area)
267 mov pc, lr 267 ret lr
268ENDPROC(arm940_dma_unmap_area) 268ENDPROC(arm940_dma_unmap_area)
269 269
270 .globl arm940_flush_kern_cache_louis 270 .globl arm940_flush_kern_cache_louis
@@ -337,7 +337,7 @@ __arm940_setup:
337 orr r0, r0, #0x00001000 @ I-cache 337 orr r0, r0, #0x00001000 @ I-cache
338 orr r0, r0, #0x00000005 @ MPU/D-cache 338 orr r0, r0, #0x00000005 @ MPU/D-cache
339 339
340 mov pc, lr 340 ret lr
341 341
342 .size __arm940_setup, . - __arm940_setup 342 .size __arm940_setup, . - __arm940_setup
343 343
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index 0289cd905e73..b3dd9b2d0b8e 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -38,7 +38,7 @@
38 */ 38 */
39ENTRY(cpu_arm946_proc_init) 39ENTRY(cpu_arm946_proc_init)
40ENTRY(cpu_arm946_switch_mm) 40ENTRY(cpu_arm946_switch_mm)
41 mov pc, lr 41 ret lr
42 42
43/* 43/*
44 * cpu_arm946_proc_fin() 44 * cpu_arm946_proc_fin()
@@ -48,7 +48,7 @@ ENTRY(cpu_arm946_proc_fin)
48 bic r0, r0, #0x00001000 @ i-cache 48 bic r0, r0, #0x00001000 @ i-cache
49 bic r0, r0, #0x00000004 @ d-cache 49 bic r0, r0, #0x00000004 @ d-cache
50 mcr p15, 0, r0, c1, c0, 0 @ disable caches 50 mcr p15, 0, r0, c1, c0, 0 @ disable caches
51 mov pc, lr 51 ret lr
52 52
53/* 53/*
54 * cpu_arm946_reset(loc) 54 * cpu_arm946_reset(loc)
@@ -65,7 +65,7 @@ ENTRY(cpu_arm946_reset)
65 bic ip, ip, #0x00000005 @ .............c.p 65 bic ip, ip, #0x00000005 @ .............c.p
66 bic ip, ip, #0x00001000 @ i-cache 66 bic ip, ip, #0x00001000 @ i-cache
67 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 67 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
68 mov pc, r0 68 ret r0
69ENDPROC(cpu_arm946_reset) 69ENDPROC(cpu_arm946_reset)
70 .popsection 70 .popsection
71 71
@@ -75,7 +75,7 @@ ENDPROC(cpu_arm946_reset)
75 .align 5 75 .align 5
76ENTRY(cpu_arm946_do_idle) 76ENTRY(cpu_arm946_do_idle)
77 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 77 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
78 mov pc, lr 78 ret lr
79 79
80/* 80/*
81 * flush_icache_all() 81 * flush_icache_all()
@@ -85,7 +85,7 @@ ENTRY(cpu_arm946_do_idle)
85ENTRY(arm946_flush_icache_all) 85ENTRY(arm946_flush_icache_all)
86 mov r0, #0 86 mov r0, #0
87 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 87 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
88 mov pc, lr 88 ret lr
89ENDPROC(arm946_flush_icache_all) 89ENDPROC(arm946_flush_icache_all)
90 90
91/* 91/*
@@ -117,7 +117,7 @@ __flush_whole_cache:
117 tst r2, #VM_EXEC 117 tst r2, #VM_EXEC
118 mcrne p15, 0, ip, c7, c5, 0 @ flush I cache 118 mcrne p15, 0, ip, c7, c5, 0 @ flush I cache
119 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 119 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
120 mov pc, lr 120 ret lr
121 121
122/* 122/*
123 * flush_user_cache_range(start, end, flags) 123 * flush_user_cache_range(start, end, flags)
@@ -156,7 +156,7 @@ ENTRY(arm946_flush_user_cache_range)
156 blo 1b 156 blo 1b
157 tst r2, #VM_EXEC 157 tst r2, #VM_EXEC
158 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 158 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
159 mov pc, lr 159 ret lr
160 160
161/* 161/*
162 * coherent_kern_range(start, end) 162 * coherent_kern_range(start, end)
@@ -191,7 +191,7 @@ ENTRY(arm946_coherent_user_range)
191 blo 1b 191 blo 1b
192 mcr p15, 0, r0, c7, c10, 4 @ drain WB 192 mcr p15, 0, r0, c7, c10, 4 @ drain WB
193 mov r0, #0 193 mov r0, #0
194 mov pc, lr 194 ret lr
195 195
196/* 196/*
197 * flush_kern_dcache_area(void *addr, size_t size) 197 * flush_kern_dcache_area(void *addr, size_t size)
@@ -212,7 +212,7 @@ ENTRY(arm946_flush_kern_dcache_area)
212 mov r0, #0 212 mov r0, #0
213 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 213 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
214 mcr p15, 0, r0, c7, c10, 4 @ drain WB 214 mcr p15, 0, r0, c7, c10, 4 @ drain WB
215 mov pc, lr 215 ret lr
216 216
217/* 217/*
218 * dma_inv_range(start, end) 218 * dma_inv_range(start, end)
@@ -239,7 +239,7 @@ arm946_dma_inv_range:
239 cmp r0, r1 239 cmp r0, r1
240 blo 1b 240 blo 1b
241 mcr p15, 0, r0, c7, c10, 4 @ drain WB 241 mcr p15, 0, r0, c7, c10, 4 @ drain WB
242 mov pc, lr 242 ret lr
243 243
244/* 244/*
245 * dma_clean_range(start, end) 245 * dma_clean_range(start, end)
@@ -260,7 +260,7 @@ arm946_dma_clean_range:
260 blo 1b 260 blo 1b
261#endif 261#endif
262 mcr p15, 0, r0, c7, c10, 4 @ drain WB 262 mcr p15, 0, r0, c7, c10, 4 @ drain WB
263 mov pc, lr 263 ret lr
264 264
265/* 265/*
266 * dma_flush_range(start, end) 266 * dma_flush_range(start, end)
@@ -284,7 +284,7 @@ ENTRY(arm946_dma_flush_range)
284 cmp r0, r1 284 cmp r0, r1
285 blo 1b 285 blo 1b
286 mcr p15, 0, r0, c7, c10, 4 @ drain WB 286 mcr p15, 0, r0, c7, c10, 4 @ drain WB
287 mov pc, lr 287 ret lr
288 288
289/* 289/*
290 * dma_map_area(start, size, dir) 290 * dma_map_area(start, size, dir)
@@ -307,7 +307,7 @@ ENDPROC(arm946_dma_map_area)
307 * - dir - DMA direction 307 * - dir - DMA direction
308 */ 308 */
309ENTRY(arm946_dma_unmap_area) 309ENTRY(arm946_dma_unmap_area)
310 mov pc, lr 310 ret lr
311ENDPROC(arm946_dma_unmap_area) 311ENDPROC(arm946_dma_unmap_area)
312 312
313 .globl arm946_flush_kern_cache_louis 313 .globl arm946_flush_kern_cache_louis
@@ -324,7 +324,7 @@ ENTRY(cpu_arm946_dcache_clean_area)
324 bhi 1b 324 bhi 1b
325#endif 325#endif
326 mcr p15, 0, r0, c7, c10, 4 @ drain WB 326 mcr p15, 0, r0, c7, c10, 4 @ drain WB
327 mov pc, lr 327 ret lr
328 328
329 .type __arm946_setup, #function 329 .type __arm946_setup, #function
330__arm946_setup: 330__arm946_setup:
@@ -392,7 +392,7 @@ __arm946_setup:
392#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN 392#ifdef CONFIG_CPU_CACHE_ROUND_ROBIN
393 orr r0, r0, #0x00004000 @ .1.. .... .... .... 393 orr r0, r0, #0x00004000 @ .1.. .... .... ....
394#endif 394#endif
395 mov pc, lr 395 ret lr
396 396
397 .size __arm946_setup, . - __arm946_setup 397 .size __arm946_setup, . - __arm946_setup
398 398
diff --git a/arch/arm/mm/proc-arm9tdmi.S b/arch/arm/mm/proc-arm9tdmi.S
index f51197ba754a..8227322bbb8f 100644
--- a/arch/arm/mm/proc-arm9tdmi.S
+++ b/arch/arm/mm/proc-arm9tdmi.S
@@ -32,13 +32,13 @@ ENTRY(cpu_arm9tdmi_proc_init)
32ENTRY(cpu_arm9tdmi_do_idle) 32ENTRY(cpu_arm9tdmi_do_idle)
33ENTRY(cpu_arm9tdmi_dcache_clean_area) 33ENTRY(cpu_arm9tdmi_dcache_clean_area)
34ENTRY(cpu_arm9tdmi_switch_mm) 34ENTRY(cpu_arm9tdmi_switch_mm)
35 mov pc, lr 35 ret lr
36 36
37/* 37/*
38 * cpu_arm9tdmi_proc_fin() 38 * cpu_arm9tdmi_proc_fin()
39 */ 39 */
40ENTRY(cpu_arm9tdmi_proc_fin) 40ENTRY(cpu_arm9tdmi_proc_fin)
41 mov pc, lr 41 ret lr
42 42
43/* 43/*
44 * Function: cpu_arm9tdmi_reset(loc) 44 * Function: cpu_arm9tdmi_reset(loc)
@@ -47,13 +47,13 @@ ENTRY(cpu_arm9tdmi_proc_fin)
47 */ 47 */
48 .pushsection .idmap.text, "ax" 48 .pushsection .idmap.text, "ax"
49ENTRY(cpu_arm9tdmi_reset) 49ENTRY(cpu_arm9tdmi_reset)
50 mov pc, r0 50 ret r0
51ENDPROC(cpu_arm9tdmi_reset) 51ENDPROC(cpu_arm9tdmi_reset)
52 .popsection 52 .popsection
53 53
54 .type __arm9tdmi_setup, #function 54 .type __arm9tdmi_setup, #function
55__arm9tdmi_setup: 55__arm9tdmi_setup:
56 mov pc, lr 56 ret lr
57 .size __arm9tdmi_setup, . - __arm9tdmi_setup 57 .size __arm9tdmi_setup, . - __arm9tdmi_setup
58 58
59 __INITDATA 59 __INITDATA
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index 2dfc0f1d3bfd..c494886892ba 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -32,7 +32,7 @@
32 * cpu_fa526_proc_init() 32 * cpu_fa526_proc_init()
33 */ 33 */
34ENTRY(cpu_fa526_proc_init) 34ENTRY(cpu_fa526_proc_init)
35 mov pc, lr 35 ret lr
36 36
37/* 37/*
38 * cpu_fa526_proc_fin() 38 * cpu_fa526_proc_fin()
@@ -44,7 +44,7 @@ ENTRY(cpu_fa526_proc_fin)
44 mcr p15, 0, r0, c1, c0, 0 @ disable caches 44 mcr p15, 0, r0, c1, c0, 0 @ disable caches
45 nop 45 nop
46 nop 46 nop
47 mov pc, lr 47 ret lr
48 48
49/* 49/*
50 * cpu_fa526_reset(loc) 50 * cpu_fa526_reset(loc)
@@ -72,7 +72,7 @@ ENTRY(cpu_fa526_reset)
72 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 72 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
73 nop 73 nop
74 nop 74 nop
75 mov pc, r0 75 ret r0
76ENDPROC(cpu_fa526_reset) 76ENDPROC(cpu_fa526_reset)
77 .popsection 77 .popsection
78 78
@@ -81,7 +81,7 @@ ENDPROC(cpu_fa526_reset)
81 */ 81 */
82 .align 4 82 .align 4
83ENTRY(cpu_fa526_do_idle) 83ENTRY(cpu_fa526_do_idle)
84 mov pc, lr 84 ret lr
85 85
86 86
87ENTRY(cpu_fa526_dcache_clean_area) 87ENTRY(cpu_fa526_dcache_clean_area)
@@ -90,7 +90,7 @@ ENTRY(cpu_fa526_dcache_clean_area)
90 subs r1, r1, #CACHE_DLINESIZE 90 subs r1, r1, #CACHE_DLINESIZE
91 bhi 1b 91 bhi 1b
92 mcr p15, 0, r0, c7, c10, 4 @ drain WB 92 mcr p15, 0, r0, c7, c10, 4 @ drain WB
93 mov pc, lr 93 ret lr
94 94
95/* =============================== PageTable ============================== */ 95/* =============================== PageTable ============================== */
96 96
@@ -117,7 +117,7 @@ ENTRY(cpu_fa526_switch_mm)
117 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 117 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
118 mcr p15, 0, ip, c8, c7, 0 @ invalidate UTLB 118 mcr p15, 0, ip, c8, c7, 0 @ invalidate UTLB
119#endif 119#endif
120 mov pc, lr 120 ret lr
121 121
122/* 122/*
123 * cpu_fa526_set_pte_ext(ptep, pte, ext) 123 * cpu_fa526_set_pte_ext(ptep, pte, ext)
@@ -133,7 +133,7 @@ ENTRY(cpu_fa526_set_pte_ext)
133 mov r0, #0 133 mov r0, #0
134 mcr p15, 0, r0, c7, c10, 4 @ drain WB 134 mcr p15, 0, r0, c7, c10, 4 @ drain WB
135#endif 135#endif
136 mov pc, lr 136 ret lr
137 137
138 .type __fa526_setup, #function 138 .type __fa526_setup, #function
139__fa526_setup: 139__fa526_setup:
@@ -162,7 +162,7 @@ __fa526_setup:
162 bic r0, r0, r5 162 bic r0, r0, r5
163 ldr r5, fa526_cr1_set 163 ldr r5, fa526_cr1_set
164 orr r0, r0, r5 164 orr r0, r0, r5
165 mov pc, lr 165 ret lr
166 .size __fa526_setup, . - __fa526_setup 166 .size __fa526_setup, . - __fa526_setup
167 167
168 /* 168 /*
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index db79b62c92fb..03a1b75f2e16 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -69,7 +69,7 @@ ENTRY(cpu_feroceon_proc_init)
69 movne r2, r2, lsr #2 @ turned into # of sets 69 movne r2, r2, lsr #2 @ turned into # of sets
70 sub r2, r2, #(1 << 5) 70 sub r2, r2, #(1 << 5)
71 stmia r1, {r2, r3} 71 stmia r1, {r2, r3}
72 mov pc, lr 72 ret lr
73 73
74/* 74/*
75 * cpu_feroceon_proc_fin() 75 * cpu_feroceon_proc_fin()
@@ -86,7 +86,7 @@ ENTRY(cpu_feroceon_proc_fin)
86 bic r0, r0, #0x1000 @ ...i............ 86 bic r0, r0, #0x1000 @ ...i............
87 bic r0, r0, #0x000e @ ............wca. 87 bic r0, r0, #0x000e @ ............wca.
88 mcr p15, 0, r0, c1, c0, 0 @ disable caches 88 mcr p15, 0, r0, c1, c0, 0 @ disable caches
89 mov pc, lr 89 ret lr
90 90
91/* 91/*
92 * cpu_feroceon_reset(loc) 92 * cpu_feroceon_reset(loc)
@@ -110,7 +110,7 @@ ENTRY(cpu_feroceon_reset)
110 bic ip, ip, #0x000f @ ............wcam 110 bic ip, ip, #0x000f @ ............wcam
111 bic ip, ip, #0x1100 @ ...i...s........ 111 bic ip, ip, #0x1100 @ ...i...s........
112 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 112 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
113 mov pc, r0 113 ret r0
114ENDPROC(cpu_feroceon_reset) 114ENDPROC(cpu_feroceon_reset)
115 .popsection 115 .popsection
116 116
@@ -124,7 +124,7 @@ ENTRY(cpu_feroceon_do_idle)
124 mov r0, #0 124 mov r0, #0
125 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer 125 mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer
126 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt 126 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
127 mov pc, lr 127 ret lr
128 128
129/* 129/*
130 * flush_icache_all() 130 * flush_icache_all()
@@ -134,7 +134,7 @@ ENTRY(cpu_feroceon_do_idle)
134ENTRY(feroceon_flush_icache_all) 134ENTRY(feroceon_flush_icache_all)
135 mov r0, #0 135 mov r0, #0
136 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 136 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
137 mov pc, lr 137 ret lr
138ENDPROC(feroceon_flush_icache_all) 138ENDPROC(feroceon_flush_icache_all)
139 139
140/* 140/*
@@ -169,7 +169,7 @@ __flush_whole_cache:
169 mov ip, #0 169 mov ip, #0
170 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 170 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
171 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 171 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
172 mov pc, lr 172 ret lr
173 173
174/* 174/*
175 * flush_user_cache_range(start, end, flags) 175 * flush_user_cache_range(start, end, flags)
@@ -198,7 +198,7 @@ ENTRY(feroceon_flush_user_cache_range)
198 tst r2, #VM_EXEC 198 tst r2, #VM_EXEC
199 mov ip, #0 199 mov ip, #0
200 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 200 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
201 mov pc, lr 201 ret lr
202 202
203/* 203/*
204 * coherent_kern_range(start, end) 204 * coherent_kern_range(start, end)
@@ -233,7 +233,7 @@ ENTRY(feroceon_coherent_user_range)
233 blo 1b 233 blo 1b
234 mcr p15, 0, r0, c7, c10, 4 @ drain WB 234 mcr p15, 0, r0, c7, c10, 4 @ drain WB
235 mov r0, #0 235 mov r0, #0
236 mov pc, lr 236 ret lr
237 237
238/* 238/*
239 * flush_kern_dcache_area(void *addr, size_t size) 239 * flush_kern_dcache_area(void *addr, size_t size)
@@ -254,7 +254,7 @@ ENTRY(feroceon_flush_kern_dcache_area)
254 mov r0, #0 254 mov r0, #0
255 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 255 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
256 mcr p15, 0, r0, c7, c10, 4 @ drain WB 256 mcr p15, 0, r0, c7, c10, 4 @ drain WB
257 mov pc, lr 257 ret lr
258 258
259 .align 5 259 .align 5
260ENTRY(feroceon_range_flush_kern_dcache_area) 260ENTRY(feroceon_range_flush_kern_dcache_area)
@@ -268,7 +268,7 @@ ENTRY(feroceon_range_flush_kern_dcache_area)
268 mov r0, #0 268 mov r0, #0
269 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 269 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
270 mcr p15, 0, r0, c7, c10, 4 @ drain WB 270 mcr p15, 0, r0, c7, c10, 4 @ drain WB
271 mov pc, lr 271 ret lr
272 272
273/* 273/*
274 * dma_inv_range(start, end) 274 * dma_inv_range(start, end)
@@ -295,7 +295,7 @@ feroceon_dma_inv_range:
295 cmp r0, r1 295 cmp r0, r1
296 blo 1b 296 blo 1b
297 mcr p15, 0, r0, c7, c10, 4 @ drain WB 297 mcr p15, 0, r0, c7, c10, 4 @ drain WB
298 mov pc, lr 298 ret lr
299 299
300 .align 5 300 .align 5
301feroceon_range_dma_inv_range: 301feroceon_range_dma_inv_range:
@@ -311,7 +311,7 @@ feroceon_range_dma_inv_range:
311 mcr p15, 5, r0, c15, c14, 0 @ D inv range start 311 mcr p15, 5, r0, c15, c14, 0 @ D inv range start
312 mcr p15, 5, r1, c15, c14, 1 @ D inv range top 312 mcr p15, 5, r1, c15, c14, 1 @ D inv range top
313 msr cpsr_c, r2 @ restore interrupts 313 msr cpsr_c, r2 @ restore interrupts
314 mov pc, lr 314 ret lr
315 315
316/* 316/*
317 * dma_clean_range(start, end) 317 * dma_clean_range(start, end)
@@ -331,7 +331,7 @@ feroceon_dma_clean_range:
331 cmp r0, r1 331 cmp r0, r1
332 blo 1b 332 blo 1b
333 mcr p15, 0, r0, c7, c10, 4 @ drain WB 333 mcr p15, 0, r0, c7, c10, 4 @ drain WB
334 mov pc, lr 334 ret lr
335 335
336 .align 5 336 .align 5
337feroceon_range_dma_clean_range: 337feroceon_range_dma_clean_range:
@@ -344,7 +344,7 @@ feroceon_range_dma_clean_range:
344 mcr p15, 5, r1, c15, c13, 1 @ D clean range top 344 mcr p15, 5, r1, c15, c13, 1 @ D clean range top
345 msr cpsr_c, r2 @ restore interrupts 345 msr cpsr_c, r2 @ restore interrupts
346 mcr p15, 0, r0, c7, c10, 4 @ drain WB 346 mcr p15, 0, r0, c7, c10, 4 @ drain WB
347 mov pc, lr 347 ret lr
348 348
349/* 349/*
350 * dma_flush_range(start, end) 350 * dma_flush_range(start, end)
@@ -362,7 +362,7 @@ ENTRY(feroceon_dma_flush_range)
362 cmp r0, r1 362 cmp r0, r1
363 blo 1b 363 blo 1b
364 mcr p15, 0, r0, c7, c10, 4 @ drain WB 364 mcr p15, 0, r0, c7, c10, 4 @ drain WB
365 mov pc, lr 365 ret lr
366 366
367 .align 5 367 .align 5
368ENTRY(feroceon_range_dma_flush_range) 368ENTRY(feroceon_range_dma_flush_range)
@@ -375,7 +375,7 @@ ENTRY(feroceon_range_dma_flush_range)
375 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top 375 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top
376 msr cpsr_c, r2 @ restore interrupts 376 msr cpsr_c, r2 @ restore interrupts
377 mcr p15, 0, r0, c7, c10, 4 @ drain WB 377 mcr p15, 0, r0, c7, c10, 4 @ drain WB
378 mov pc, lr 378 ret lr
379 379
380/* 380/*
381 * dma_map_area(start, size, dir) 381 * dma_map_area(start, size, dir)
@@ -412,7 +412,7 @@ ENDPROC(feroceon_range_dma_map_area)
412 * - dir - DMA direction 412 * - dir - DMA direction
413 */ 413 */
414ENTRY(feroceon_dma_unmap_area) 414ENTRY(feroceon_dma_unmap_area)
415 mov pc, lr 415 ret lr
416ENDPROC(feroceon_dma_unmap_area) 416ENDPROC(feroceon_dma_unmap_area)
417 417
418 .globl feroceon_flush_kern_cache_louis 418 .globl feroceon_flush_kern_cache_louis
@@ -461,7 +461,7 @@ ENTRY(cpu_feroceon_dcache_clean_area)
461 bhi 1b 461 bhi 1b
462#endif 462#endif
463 mcr p15, 0, r0, c7, c10, 4 @ drain WB 463 mcr p15, 0, r0, c7, c10, 4 @ drain WB
464 mov pc, lr 464 ret lr
465 465
466/* =============================== PageTable ============================== */ 466/* =============================== PageTable ============================== */
467 467
@@ -490,9 +490,9 @@ ENTRY(cpu_feroceon_switch_mm)
490 490
491 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 491 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
492 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 492 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
493 mov pc, r2 493 ret r2
494#else 494#else
495 mov pc, lr 495 ret lr
496#endif 496#endif
497 497
498/* 498/*
@@ -512,7 +512,7 @@ ENTRY(cpu_feroceon_set_pte_ext)
512#endif 512#endif
513 mcr p15, 0, r0, c7, c10, 4 @ drain WB 513 mcr p15, 0, r0, c7, c10, 4 @ drain WB
514#endif 514#endif
515 mov pc, lr 515 ret lr
516 516
517/* Suspend/resume support: taken from arch/arm/mm/proc-arm926.S */ 517/* Suspend/resume support: taken from arch/arm/mm/proc-arm926.S */
518.globl cpu_feroceon_suspend_size 518.globl cpu_feroceon_suspend_size
@@ -554,7 +554,7 @@ __feroceon_setup:
554 mrc p15, 0, r0, c1, c0 @ get control register v4 554 mrc p15, 0, r0, c1, c0 @ get control register v4
555 bic r0, r0, r5 555 bic r0, r0, r5
556 orr r0, r0, r6 556 orr r0, r0, r6
557 mov pc, lr 557 ret lr
558 .size __feroceon_setup, . - __feroceon_setup 558 .size __feroceon_setup, . - __feroceon_setup
559 559
560 /* 560 /*
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index 40acba595731..53d393455f13 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -45,7 +45,7 @@
45 * cpu_mohawk_proc_init() 45 * cpu_mohawk_proc_init()
46 */ 46 */
47ENTRY(cpu_mohawk_proc_init) 47ENTRY(cpu_mohawk_proc_init)
48 mov pc, lr 48 ret lr
49 49
50/* 50/*
51 * cpu_mohawk_proc_fin() 51 * cpu_mohawk_proc_fin()
@@ -55,7 +55,7 @@ ENTRY(cpu_mohawk_proc_fin)
55 bic r0, r0, #0x1800 @ ...iz........... 55 bic r0, r0, #0x1800 @ ...iz...........
56 bic r0, r0, #0x0006 @ .............ca. 56 bic r0, r0, #0x0006 @ .............ca.
57 mcr p15, 0, r0, c1, c0, 0 @ disable caches 57 mcr p15, 0, r0, c1, c0, 0 @ disable caches
58 mov pc, lr 58 ret lr
59 59
60/* 60/*
61 * cpu_mohawk_reset(loc) 61 * cpu_mohawk_reset(loc)
@@ -79,7 +79,7 @@ ENTRY(cpu_mohawk_reset)
79 bic ip, ip, #0x0007 @ .............cam 79 bic ip, ip, #0x0007 @ .............cam
80 bic ip, ip, #0x1100 @ ...i...s........ 80 bic ip, ip, #0x1100 @ ...i...s........
81 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 81 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
82 mov pc, r0 82 ret r0
83ENDPROC(cpu_mohawk_reset) 83ENDPROC(cpu_mohawk_reset)
84 .popsection 84 .popsection
85 85
@@ -93,7 +93,7 @@ ENTRY(cpu_mohawk_do_idle)
93 mov r0, #0 93 mov r0, #0
94 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 94 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
95 mcr p15, 0, r0, c7, c0, 4 @ wait for interrupt 95 mcr p15, 0, r0, c7, c0, 4 @ wait for interrupt
96 mov pc, lr 96 ret lr
97 97
98/* 98/*
99 * flush_icache_all() 99 * flush_icache_all()
@@ -103,7 +103,7 @@ ENTRY(cpu_mohawk_do_idle)
103ENTRY(mohawk_flush_icache_all) 103ENTRY(mohawk_flush_icache_all)
104 mov r0, #0 104 mov r0, #0
105 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 105 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
106 mov pc, lr 106 ret lr
107ENDPROC(mohawk_flush_icache_all) 107ENDPROC(mohawk_flush_icache_all)
108 108
109/* 109/*
@@ -128,7 +128,7 @@ __flush_whole_cache:
128 tst r2, #VM_EXEC 128 tst r2, #VM_EXEC
129 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 129 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
130 mcrne p15, 0, ip, c7, c10, 0 @ drain write buffer 130 mcrne p15, 0, ip, c7, c10, 0 @ drain write buffer
131 mov pc, lr 131 ret lr
132 132
133/* 133/*
134 * flush_user_cache_range(start, end, flags) 134 * flush_user_cache_range(start, end, flags)
@@ -158,7 +158,7 @@ ENTRY(mohawk_flush_user_cache_range)
158 blo 1b 158 blo 1b
159 tst r2, #VM_EXEC 159 tst r2, #VM_EXEC
160 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 160 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
161 mov pc, lr 161 ret lr
162 162
163/* 163/*
164 * coherent_kern_range(start, end) 164 * coherent_kern_range(start, end)
@@ -194,7 +194,7 @@ ENTRY(mohawk_coherent_user_range)
194 blo 1b 194 blo 1b
195 mcr p15, 0, r0, c7, c10, 4 @ drain WB 195 mcr p15, 0, r0, c7, c10, 4 @ drain WB
196 mov r0, #0 196 mov r0, #0
197 mov pc, lr 197 ret lr
198 198
199/* 199/*
200 * flush_kern_dcache_area(void *addr, size_t size) 200 * flush_kern_dcache_area(void *addr, size_t size)
@@ -214,7 +214,7 @@ ENTRY(mohawk_flush_kern_dcache_area)
214 mov r0, #0 214 mov r0, #0
215 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 215 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
216 mcr p15, 0, r0, c7, c10, 4 @ drain WB 216 mcr p15, 0, r0, c7, c10, 4 @ drain WB
217 mov pc, lr 217 ret lr
218 218
219/* 219/*
220 * dma_inv_range(start, end) 220 * dma_inv_range(start, end)
@@ -240,7 +240,7 @@ mohawk_dma_inv_range:
240 cmp r0, r1 240 cmp r0, r1
241 blo 1b 241 blo 1b
242 mcr p15, 0, r0, c7, c10, 4 @ drain WB 242 mcr p15, 0, r0, c7, c10, 4 @ drain WB
243 mov pc, lr 243 ret lr
244 244
245/* 245/*
246 * dma_clean_range(start, end) 246 * dma_clean_range(start, end)
@@ -259,7 +259,7 @@ mohawk_dma_clean_range:
259 cmp r0, r1 259 cmp r0, r1
260 blo 1b 260 blo 1b
261 mcr p15, 0, r0, c7, c10, 4 @ drain WB 261 mcr p15, 0, r0, c7, c10, 4 @ drain WB
262 mov pc, lr 262 ret lr
263 263
264/* 264/*
265 * dma_flush_range(start, end) 265 * dma_flush_range(start, end)
@@ -277,7 +277,7 @@ ENTRY(mohawk_dma_flush_range)
277 cmp r0, r1 277 cmp r0, r1
278 blo 1b 278 blo 1b
279 mcr p15, 0, r0, c7, c10, 4 @ drain WB 279 mcr p15, 0, r0, c7, c10, 4 @ drain WB
280 mov pc, lr 280 ret lr
281 281
282/* 282/*
283 * dma_map_area(start, size, dir) 283 * dma_map_area(start, size, dir)
@@ -300,7 +300,7 @@ ENDPROC(mohawk_dma_map_area)
300 * - dir - DMA direction 300 * - dir - DMA direction
301 */ 301 */
302ENTRY(mohawk_dma_unmap_area) 302ENTRY(mohawk_dma_unmap_area)
303 mov pc, lr 303 ret lr
304ENDPROC(mohawk_dma_unmap_area) 304ENDPROC(mohawk_dma_unmap_area)
305 305
306 .globl mohawk_flush_kern_cache_louis 306 .globl mohawk_flush_kern_cache_louis
@@ -315,7 +315,7 @@ ENTRY(cpu_mohawk_dcache_clean_area)
315 subs r1, r1, #CACHE_DLINESIZE 315 subs r1, r1, #CACHE_DLINESIZE
316 bhi 1b 316 bhi 1b
317 mcr p15, 0, r0, c7, c10, 4 @ drain WB 317 mcr p15, 0, r0, c7, c10, 4 @ drain WB
318 mov pc, lr 318 ret lr
319 319
320/* 320/*
321 * cpu_mohawk_switch_mm(pgd) 321 * cpu_mohawk_switch_mm(pgd)
@@ -333,7 +333,7 @@ ENTRY(cpu_mohawk_switch_mm)
333 orr r0, r0, #0x18 @ cache the page table in L2 333 orr r0, r0, #0x18 @ cache the page table in L2
334 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 334 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
335 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 335 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
336 mov pc, lr 336 ret lr
337 337
338/* 338/*
339 * cpu_mohawk_set_pte_ext(ptep, pte, ext) 339 * cpu_mohawk_set_pte_ext(ptep, pte, ext)
@@ -346,7 +346,7 @@ ENTRY(cpu_mohawk_set_pte_ext)
346 mov r0, r0 346 mov r0, r0
347 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 347 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
348 mcr p15, 0, r0, c7, c10, 4 @ drain WB 348 mcr p15, 0, r0, c7, c10, 4 @ drain WB
349 mov pc, lr 349 ret lr
350 350
351.globl cpu_mohawk_suspend_size 351.globl cpu_mohawk_suspend_size
352.equ cpu_mohawk_suspend_size, 4 * 6 352.equ cpu_mohawk_suspend_size, 4 * 6
@@ -400,7 +400,7 @@ __mohawk_setup:
400 mrc p15, 0, r0, c1, c0 @ get control register 400 mrc p15, 0, r0, c1, c0 @ get control register
401 bic r0, r0, r5 401 bic r0, r0, r5
402 orr r0, r0, r6 402 orr r0, r0, r6
403 mov pc, lr 403 ret lr
404 404
405 .size __mohawk_setup, . - __mohawk_setup 405 .size __mohawk_setup, . - __mohawk_setup
406 406
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index c45319c8f1d9..8008a0461cf5 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -38,7 +38,7 @@
38ENTRY(cpu_sa110_proc_init) 38ENTRY(cpu_sa110_proc_init)
39 mov r0, #0 39 mov r0, #0
40 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching 40 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
41 mov pc, lr 41 ret lr
42 42
43/* 43/*
44 * cpu_sa110_proc_fin() 44 * cpu_sa110_proc_fin()
@@ -50,7 +50,7 @@ ENTRY(cpu_sa110_proc_fin)
50 bic r0, r0, #0x1000 @ ...i............ 50 bic r0, r0, #0x1000 @ ...i............
51 bic r0, r0, #0x000e @ ............wca. 51 bic r0, r0, #0x000e @ ............wca.
52 mcr p15, 0, r0, c1, c0, 0 @ disable caches 52 mcr p15, 0, r0, c1, c0, 0 @ disable caches
53 mov pc, lr 53 ret lr
54 54
55/* 55/*
56 * cpu_sa110_reset(loc) 56 * cpu_sa110_reset(loc)
@@ -74,7 +74,7 @@ ENTRY(cpu_sa110_reset)
74 bic ip, ip, #0x000f @ ............wcam 74 bic ip, ip, #0x000f @ ............wcam
75 bic ip, ip, #0x1100 @ ...i...s........ 75 bic ip, ip, #0x1100 @ ...i...s........
76 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 76 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
77 mov pc, r0 77 ret r0
78ENDPROC(cpu_sa110_reset) 78ENDPROC(cpu_sa110_reset)
79 .popsection 79 .popsection
80 80
@@ -103,7 +103,7 @@ ENTRY(cpu_sa110_do_idle)
103 mov r0, r0 @ safety 103 mov r0, r0 @ safety
104 mov r0, r0 @ safety 104 mov r0, r0 @ safety
105 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching 105 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
106 mov pc, lr 106 ret lr
107 107
108/* ================================= CACHE ================================ */ 108/* ================================= CACHE ================================ */
109 109
@@ -121,7 +121,7 @@ ENTRY(cpu_sa110_dcache_clean_area)
121 add r0, r0, #DCACHELINESIZE 121 add r0, r0, #DCACHELINESIZE
122 subs r1, r1, #DCACHELINESIZE 122 subs r1, r1, #DCACHELINESIZE
123 bhi 1b 123 bhi 1b
124 mov pc, lr 124 ret lr
125 125
126/* =============================== PageTable ============================== */ 126/* =============================== PageTable ============================== */
127 127
@@ -141,7 +141,7 @@ ENTRY(cpu_sa110_switch_mm)
141 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 141 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
142 ldr pc, [sp], #4 142 ldr pc, [sp], #4
143#else 143#else
144 mov pc, lr 144 ret lr
145#endif 145#endif
146 146
147/* 147/*
@@ -157,7 +157,7 @@ ENTRY(cpu_sa110_set_pte_ext)
157 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 157 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
158 mcr p15, 0, r0, c7, c10, 4 @ drain WB 158 mcr p15, 0, r0, c7, c10, 4 @ drain WB
159#endif 159#endif
160 mov pc, lr 160 ret lr
161 161
162 .type __sa110_setup, #function 162 .type __sa110_setup, #function
163__sa110_setup: 163__sa110_setup:
@@ -173,7 +173,7 @@ __sa110_setup:
173 mrc p15, 0, r0, c1, c0 @ get control register v4 173 mrc p15, 0, r0, c1, c0 @ get control register v4
174 bic r0, r0, r5 174 bic r0, r0, r5
175 orr r0, r0, r6 175 orr r0, r0, r6
176 mov pc, lr 176 ret lr
177 .size __sa110_setup, . - __sa110_setup 177 .size __sa110_setup, . - __sa110_setup
178 178
179 /* 179 /*
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 09d241ae2dbe..89f97ac648a9 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -43,7 +43,7 @@ ENTRY(cpu_sa1100_proc_init)
43 mov r0, #0 43 mov r0, #0
44 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching 44 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
45 mcr p15, 0, r0, c9, c0, 5 @ Allow read-buffer operations from userland 45 mcr p15, 0, r0, c9, c0, 5 @ Allow read-buffer operations from userland
46 mov pc, lr 46 ret lr
47 47
48/* 48/*
49 * cpu_sa1100_proc_fin() 49 * cpu_sa1100_proc_fin()
@@ -58,7 +58,7 @@ ENTRY(cpu_sa1100_proc_fin)
58 bic r0, r0, #0x1000 @ ...i............ 58 bic r0, r0, #0x1000 @ ...i............
59 bic r0, r0, #0x000e @ ............wca. 59 bic r0, r0, #0x000e @ ............wca.
60 mcr p15, 0, r0, c1, c0, 0 @ disable caches 60 mcr p15, 0, r0, c1, c0, 0 @ disable caches
61 mov pc, lr 61 ret lr
62 62
63/* 63/*
64 * cpu_sa1100_reset(loc) 64 * cpu_sa1100_reset(loc)
@@ -82,7 +82,7 @@ ENTRY(cpu_sa1100_reset)
82 bic ip, ip, #0x000f @ ............wcam 82 bic ip, ip, #0x000f @ ............wcam
83 bic ip, ip, #0x1100 @ ...i...s........ 83 bic ip, ip, #0x1100 @ ...i...s........
84 mcr p15, 0, ip, c1, c0, 0 @ ctrl register 84 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
85 mov pc, r0 85 ret r0
86ENDPROC(cpu_sa1100_reset) 86ENDPROC(cpu_sa1100_reset)
87 .popsection 87 .popsection
88 88
@@ -113,7 +113,7 @@ ENTRY(cpu_sa1100_do_idle)
113 mcr p15, 0, r0, c15, c8, 2 @ wait for interrupt 113 mcr p15, 0, r0, c15, c8, 2 @ wait for interrupt
114 mov r0, r0 @ safety 114 mov r0, r0 @ safety
115 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching 115 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
116 mov pc, lr 116 ret lr
117 117
118/* ================================= CACHE ================================ */ 118/* ================================= CACHE ================================ */
119 119
@@ -131,7 +131,7 @@ ENTRY(cpu_sa1100_dcache_clean_area)
131 add r0, r0, #DCACHELINESIZE 131 add r0, r0, #DCACHELINESIZE
132 subs r1, r1, #DCACHELINESIZE 132 subs r1, r1, #DCACHELINESIZE
133 bhi 1b 133 bhi 1b
134 mov pc, lr 134 ret lr
135 135
136/* =============================== PageTable ============================== */ 136/* =============================== PageTable ============================== */
137 137
@@ -152,7 +152,7 @@ ENTRY(cpu_sa1100_switch_mm)
152 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 152 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
153 ldr pc, [sp], #4 153 ldr pc, [sp], #4
154#else 154#else
155 mov pc, lr 155 ret lr
156#endif 156#endif
157 157
158/* 158/*
@@ -168,7 +168,7 @@ ENTRY(cpu_sa1100_set_pte_ext)
168 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 168 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
169 mcr p15, 0, r0, c7, c10, 4 @ drain WB 169 mcr p15, 0, r0, c7, c10, 4 @ drain WB
170#endif 170#endif
171 mov pc, lr 171 ret lr
172 172
173.globl cpu_sa1100_suspend_size 173.globl cpu_sa1100_suspend_size
174.equ cpu_sa1100_suspend_size, 4 * 3 174.equ cpu_sa1100_suspend_size, 4 * 3
@@ -211,7 +211,7 @@ __sa1100_setup:
211 mrc p15, 0, r0, c1, c0 @ get control register v4 211 mrc p15, 0, r0, c1, c0 @ get control register v4
212 bic r0, r0, r5 212 bic r0, r0, r5
213 orr r0, r0, r6 213 orr r0, r0, r6
214 mov pc, lr 214 ret lr
215 .size __sa1100_setup, . - __sa1100_setup 215 .size __sa1100_setup, . - __sa1100_setup
216 216
217 /* 217 /*
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 32b3558321c4..d0390f4b3f18 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -36,14 +36,14 @@
36#define PMD_FLAGS_SMP PMD_SECT_WBWA|PMD_SECT_S 36#define PMD_FLAGS_SMP PMD_SECT_WBWA|PMD_SECT_S
37 37
38ENTRY(cpu_v6_proc_init) 38ENTRY(cpu_v6_proc_init)
39 mov pc, lr 39 ret lr
40 40
41ENTRY(cpu_v6_proc_fin) 41ENTRY(cpu_v6_proc_fin)
42 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 42 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
43 bic r0, r0, #0x1000 @ ...i............ 43 bic r0, r0, #0x1000 @ ...i............
44 bic r0, r0, #0x0006 @ .............ca. 44 bic r0, r0, #0x0006 @ .............ca.
45 mcr p15, 0, r0, c1, c0, 0 @ disable caches 45 mcr p15, 0, r0, c1, c0, 0 @ disable caches
46 mov pc, lr 46 ret lr
47 47
48/* 48/*
49 * cpu_v6_reset(loc) 49 * cpu_v6_reset(loc)
@@ -62,7 +62,7 @@ ENTRY(cpu_v6_reset)
62 mcr p15, 0, r1, c1, c0, 0 @ disable MMU 62 mcr p15, 0, r1, c1, c0, 0 @ disable MMU
63 mov r1, #0 63 mov r1, #0
64 mcr p15, 0, r1, c7, c5, 4 @ ISB 64 mcr p15, 0, r1, c7, c5, 4 @ ISB
65 mov pc, r0 65 ret r0
66ENDPROC(cpu_v6_reset) 66ENDPROC(cpu_v6_reset)
67 .popsection 67 .popsection
68 68
@@ -77,14 +77,14 @@ ENTRY(cpu_v6_do_idle)
77 mov r1, #0 77 mov r1, #0
78 mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode 78 mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
79 mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt 79 mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt
80 mov pc, lr 80 ret lr
81 81
82ENTRY(cpu_v6_dcache_clean_area) 82ENTRY(cpu_v6_dcache_clean_area)
831: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 831: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
84 add r0, r0, #D_CACHE_LINE_SIZE 84 add r0, r0, #D_CACHE_LINE_SIZE
85 subs r1, r1, #D_CACHE_LINE_SIZE 85 subs r1, r1, #D_CACHE_LINE_SIZE
86 bhi 1b 86 bhi 1b
87 mov pc, lr 87 ret lr
88 88
89/* 89/*
90 * cpu_v6_switch_mm(pgd_phys, tsk) 90 * cpu_v6_switch_mm(pgd_phys, tsk)
@@ -113,7 +113,7 @@ ENTRY(cpu_v6_switch_mm)
113#endif 113#endif
114 mcr p15, 0, r1, c13, c0, 1 @ set context ID 114 mcr p15, 0, r1, c13, c0, 1 @ set context ID
115#endif 115#endif
116 mov pc, lr 116 ret lr
117 117
118/* 118/*
119 * cpu_v6_set_pte_ext(ptep, pte, ext) 119 * cpu_v6_set_pte_ext(ptep, pte, ext)
@@ -131,7 +131,7 @@ ENTRY(cpu_v6_set_pte_ext)
131#ifdef CONFIG_MMU 131#ifdef CONFIG_MMU
132 armv6_set_pte_ext cpu_v6 132 armv6_set_pte_ext cpu_v6
133#endif 133#endif
134 mov pc, lr 134 ret lr
135 135
136/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ 136/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */
137.globl cpu_v6_suspend_size 137.globl cpu_v6_suspend_size
@@ -241,7 +241,7 @@ __v6_setup:
241 mcreq p15, 0, r5, c1, c0, 1 @ write aux control reg 241 mcreq p15, 0, r5, c1, c0, 1 @ write aux control reg
242 orreq r0, r0, #(1 << 21) @ low interrupt latency configuration 242 orreq r0, r0, #(1 << 21) @ low interrupt latency configuration
243#endif 243#endif
244 mov pc, lr @ return to head.S:__ret 244 ret lr @ return to head.S:__ret
245 245
246 /* 246 /*
247 * V X F I D LR 247 * V X F I D LR
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 1f52915f2b28..ed448d8a596b 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -59,7 +59,7 @@ ENTRY(cpu_v7_switch_mm)
59 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 59 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
60 isb 60 isb
61#endif 61#endif
62 mov pc, lr 62 bx lr
63ENDPROC(cpu_v7_switch_mm) 63ENDPROC(cpu_v7_switch_mm)
64 64
65/* 65/*
@@ -106,7 +106,7 @@ ENTRY(cpu_v7_set_pte_ext)
106 ALT_SMP(W(nop)) 106 ALT_SMP(W(nop))
107 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte 107 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
108#endif 108#endif
109 mov pc, lr 109 bx lr
110ENDPROC(cpu_v7_set_pte_ext) 110ENDPROC(cpu_v7_set_pte_ext)
111 111
112 /* 112 /*
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 22e3ad63500c..1a24e9232ec8 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -19,6 +19,7 @@
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22#include <asm/assembler.h>
22 23
23#define TTB_IRGN_NC (0 << 8) 24#define TTB_IRGN_NC (0 << 8)
24#define TTB_IRGN_WBWA (1 << 8) 25#define TTB_IRGN_WBWA (1 << 8)
@@ -61,7 +62,7 @@ ENTRY(cpu_v7_switch_mm)
61 mcrr p15, 0, rpgdl, rpgdh, c2 @ set TTB 0 62 mcrr p15, 0, rpgdl, rpgdh, c2 @ set TTB 0
62 isb 63 isb
63#endif 64#endif
64 mov pc, lr 65 ret lr
65ENDPROC(cpu_v7_switch_mm) 66ENDPROC(cpu_v7_switch_mm)
66 67
67#ifdef __ARMEB__ 68#ifdef __ARMEB__
@@ -86,13 +87,18 @@ ENTRY(cpu_v7_set_pte_ext)
86 tst rh, #1 << (57 - 32) @ L_PTE_NONE 87 tst rh, #1 << (57 - 32) @ L_PTE_NONE
87 bicne rl, #L_PTE_VALID 88 bicne rl, #L_PTE_VALID
88 bne 1f 89 bne 1f
89 tst rh, #1 << (55 - 32) @ L_PTE_DIRTY 90
90 orreq rl, #L_PTE_RDONLY 91 eor ip, rh, #1 << (55 - 32) @ toggle L_PTE_DIRTY in temp reg to
92 @ test for !L_PTE_DIRTY || L_PTE_RDONLY
93 tst ip, #1 << (55 - 32) | 1 << (58 - 32)
94 orrne rl, #PTE_AP2
95 biceq rl, #PTE_AP2
96
911: strd r2, r3, [r0] 971: strd r2, r3, [r0]
92 ALT_SMP(W(nop)) 98 ALT_SMP(W(nop))
93 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte 99 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
94#endif 100#endif
95 mov pc, lr 101 ret lr
96ENDPROC(cpu_v7_set_pte_ext) 102ENDPROC(cpu_v7_set_pte_ext)
97 103
98 /* 104 /*
@@ -140,12 +146,11 @@ ENDPROC(cpu_v7_set_pte_ext)
140 mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits 146 mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
141 mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits 147 mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits
142 addls \ttbr1, \ttbr1, #TTBR1_OFFSET 148 addls \ttbr1, \ttbr1, #TTBR1_OFFSET
143 mcrr p15, 1, \ttbr1, \zero, c2 @ load TTBR1 149 adcls \tmp, \tmp, #0
150 mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1
144 mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits 151 mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
145 mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits 152 mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits
146 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0 153 mcrr p15, 0, \ttbr0, \tmp, c2 @ load TTBR0
147 mcrr p15, 1, \ttbr1, \zero, c2 @ load TTBR1
148 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0
149 .endm 154 .endm
150 155
151 /* 156 /*
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 3db2c2f04a30..b5d67db20897 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -26,7 +26,7 @@
26#endif 26#endif
27 27
28ENTRY(cpu_v7_proc_init) 28ENTRY(cpu_v7_proc_init)
29 mov pc, lr 29 ret lr
30ENDPROC(cpu_v7_proc_init) 30ENDPROC(cpu_v7_proc_init)
31 31
32ENTRY(cpu_v7_proc_fin) 32ENTRY(cpu_v7_proc_fin)
@@ -34,7 +34,7 @@ ENTRY(cpu_v7_proc_fin)
34 bic r0, r0, #0x1000 @ ...i............ 34 bic r0, r0, #0x1000 @ ...i............
35 bic r0, r0, #0x0006 @ .............ca. 35 bic r0, r0, #0x0006 @ .............ca.
36 mcr p15, 0, r0, c1, c0, 0 @ disable caches 36 mcr p15, 0, r0, c1, c0, 0 @ disable caches
37 mov pc, lr 37 ret lr
38ENDPROC(cpu_v7_proc_fin) 38ENDPROC(cpu_v7_proc_fin)
39 39
40/* 40/*
@@ -71,20 +71,20 @@ ENDPROC(cpu_v7_reset)
71ENTRY(cpu_v7_do_idle) 71ENTRY(cpu_v7_do_idle)
72 dsb @ WFI may enter a low-power mode 72 dsb @ WFI may enter a low-power mode
73 wfi 73 wfi
74 mov pc, lr 74 ret lr
75ENDPROC(cpu_v7_do_idle) 75ENDPROC(cpu_v7_do_idle)
76 76
77ENTRY(cpu_v7_dcache_clean_area) 77ENTRY(cpu_v7_dcache_clean_area)
78 ALT_SMP(W(nop)) @ MP extensions imply L1 PTW 78 ALT_SMP(W(nop)) @ MP extensions imply L1 PTW
79 ALT_UP_B(1f) 79 ALT_UP_B(1f)
80 mov pc, lr 80 ret lr
811: dcache_line_size r2, r3 811: dcache_line_size r2, r3
822: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 822: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
83 add r0, r0, r2 83 add r0, r0, r2
84 subs r1, r1, r2 84 subs r1, r1, r2
85 bhi 2b 85 bhi 2b
86 dsb ishst 86 dsb ishst
87 mov pc, lr 87 ret lr
88ENDPROC(cpu_v7_dcache_clean_area) 88ENDPROC(cpu_v7_dcache_clean_area)
89 89
90 string cpu_v7_name, "ARMv7 Processor" 90 string cpu_v7_name, "ARMv7 Processor"
@@ -152,6 +152,40 @@ ENTRY(cpu_v7_do_resume)
152ENDPROC(cpu_v7_do_resume) 152ENDPROC(cpu_v7_do_resume)
153#endif 153#endif
154 154
155/*
156 * Cortex-A9 processor functions
157 */
158 globl_equ cpu_ca9mp_proc_init, cpu_v7_proc_init
159 globl_equ cpu_ca9mp_proc_fin, cpu_v7_proc_fin
160 globl_equ cpu_ca9mp_reset, cpu_v7_reset
161 globl_equ cpu_ca9mp_do_idle, cpu_v7_do_idle
162 globl_equ cpu_ca9mp_dcache_clean_area, cpu_v7_dcache_clean_area
163 globl_equ cpu_ca9mp_switch_mm, cpu_v7_switch_mm
164 globl_equ cpu_ca9mp_set_pte_ext, cpu_v7_set_pte_ext
165.globl cpu_ca9mp_suspend_size
166.equ cpu_ca9mp_suspend_size, cpu_v7_suspend_size + 4 * 2
167#ifdef CONFIG_ARM_CPU_SUSPEND
168ENTRY(cpu_ca9mp_do_suspend)
169 stmfd sp!, {r4 - r5}
170 mrc p15, 0, r4, c15, c0, 1 @ Diagnostic register
171 mrc p15, 0, r5, c15, c0, 0 @ Power register
172 stmia r0!, {r4 - r5}
173 ldmfd sp!, {r4 - r5}
174 b cpu_v7_do_suspend
175ENDPROC(cpu_ca9mp_do_suspend)
176
177ENTRY(cpu_ca9mp_do_resume)
178 ldmia r0!, {r4 - r5}
179 mrc p15, 0, r10, c15, c0, 1 @ Read Diagnostic register
180 teq r4, r10 @ Already restored?
181 mcrne p15, 0, r4, c15, c0, 1 @ No, so restore it
182 mrc p15, 0, r10, c15, c0, 0 @ Read Power register
183 teq r5, r10 @ Already restored?
184 mcrne p15, 0, r5, c15, c0, 0 @ No, so restore it
185 b cpu_v7_do_resume
186ENDPROC(cpu_ca9mp_do_resume)
187#endif
188
155#ifdef CONFIG_CPU_PJ4B 189#ifdef CONFIG_CPU_PJ4B
156 globl_equ cpu_pj4b_switch_mm, cpu_v7_switch_mm 190 globl_equ cpu_pj4b_switch_mm, cpu_v7_switch_mm
157 globl_equ cpu_pj4b_set_pte_ext, cpu_v7_set_pte_ext 191 globl_equ cpu_pj4b_set_pte_ext, cpu_v7_set_pte_ext
@@ -163,7 +197,7 @@ ENTRY(cpu_pj4b_do_idle)
163 dsb @ WFI may enter a low-power mode 197 dsb @ WFI may enter a low-power mode
164 wfi 198 wfi
165 dsb @barrier 199 dsb @barrier
166 mov pc, lr 200 ret lr
167ENDPROC(cpu_pj4b_do_idle) 201ENDPROC(cpu_pj4b_do_idle)
168#else 202#else
169 globl_equ cpu_pj4b_do_idle, cpu_v7_do_idle 203 globl_equ cpu_pj4b_do_idle, cpu_v7_do_idle
@@ -184,16 +218,16 @@ ENDPROC(cpu_pj4b_do_suspend)
184 218
185ENTRY(cpu_pj4b_do_resume) 219ENTRY(cpu_pj4b_do_resume)
186 ldmia r0!, {r6 - r10} 220 ldmia r0!, {r6 - r10}
187 mcr p15, 1, r6, c15, c1, 0 @ save CP15 - extra features 221 mcr p15, 1, r6, c15, c1, 0 @ restore CP15 - extra features
188 mcr p15, 1, r7, c15, c2, 0 @ save CP15 - Aux Func Modes Ctrl 0 222 mcr p15, 1, r7, c15, c2, 0 @ restore CP15 - Aux Func Modes Ctrl 0
189 mcr p15, 1, r8, c15, c1, 2 @ save CP15 - Aux Debug Modes Ctrl 2 223 mcr p15, 1, r8, c15, c1, 2 @ restore CP15 - Aux Debug Modes Ctrl 2
190 mcr p15, 1, r9, c15, c1, 1 @ save CP15 - Aux Debug Modes Ctrl 1 224 mcr p15, 1, r9, c15, c1, 1 @ restore CP15 - Aux Debug Modes Ctrl 1
191 mcr p15, 0, r10, c9, c14, 0 @ save CP15 - PMC 225 mcr p15, 0, r10, c9, c14, 0 @ restore CP15 - PMC
192 b cpu_v7_do_resume 226 b cpu_v7_do_resume
193ENDPROC(cpu_pj4b_do_resume) 227ENDPROC(cpu_pj4b_do_resume)
194#endif 228#endif
195.globl cpu_pj4b_suspend_size 229.globl cpu_pj4b_suspend_size
196.equ cpu_pj4b_suspend_size, 4 * 14 230.equ cpu_pj4b_suspend_size, cpu_v7_suspend_size + 4 * 5
197 231
198#endif 232#endif
199 233
@@ -216,6 +250,7 @@ __v7_cr7mp_setup:
216__v7_ca7mp_setup: 250__v7_ca7mp_setup:
217__v7_ca12mp_setup: 251__v7_ca12mp_setup:
218__v7_ca15mp_setup: 252__v7_ca15mp_setup:
253__v7_b15mp_setup:
219__v7_ca17mp_setup: 254__v7_ca17mp_setup:
220 mov r10, #0 255 mov r10, #0
2211: 2561:
@@ -407,7 +442,7 @@ __v7_setup:
407 bic r0, r0, r5 @ clear bits them 442 bic r0, r0, r5 @ clear bits them
408 orr r0, r0, r6 @ set them 443 orr r0, r0, r6 @ set them
409 THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions 444 THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions
410 mov pc, lr @ return to head.S:__ret 445 ret lr @ return to head.S:__ret
411ENDPROC(__v7_setup) 446ENDPROC(__v7_setup)
412 447
413 .align 2 448 .align 2
@@ -418,6 +453,7 @@ __v7_setup_stack:
418 453
419 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S) 454 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
420 define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 455 define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1
456 define_processor_functions ca9mp, dabort=v7_early_abort, pabort=v7_pabort, suspend=1
421#ifdef CONFIG_CPU_PJ4B 457#ifdef CONFIG_CPU_PJ4B
422 define_processor_functions pj4b, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 458 define_processor_functions pj4b, dabort=v7_early_abort, pabort=v7_pabort, suspend=1
423#endif 459#endif
@@ -470,7 +506,7 @@ __v7_ca5mp_proc_info:
470__v7_ca9mp_proc_info: 506__v7_ca9mp_proc_info:
471 .long 0x410fc090 507 .long 0x410fc090
472 .long 0xff0ffff0 508 .long 0xff0ffff0
473 __v7_proc __v7_ca9mp_setup 509 __v7_proc __v7_ca9mp_setup, proc_fns = ca9mp_processor_functions
474 .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info 510 .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info
475 511
476#endif /* CONFIG_ARM_LPAE */ 512#endif /* CONFIG_ARM_LPAE */
@@ -528,6 +564,16 @@ __v7_ca15mp_proc_info:
528 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info 564 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
529 565
530 /* 566 /*
567 * Broadcom Corporation Brahma-B15 processor.
568 */
569 .type __v7_b15mp_proc_info, #object
570__v7_b15mp_proc_info:
571 .long 0x420f00f0
572 .long 0xff0ffff0
573 __v7_proc __v7_b15mp_setup, hwcaps = HWCAP_IDIV
574 .size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info
575
576 /*
531 * ARM Ltd. Cortex A17 processor. 577 * ARM Ltd. Cortex A17 processor.
532 */ 578 */
533 .type __v7_ca17mp_proc_info, #object 579 .type __v7_ca17mp_proc_info, #object
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
index 1ca37c72f12f..d1e68b553d3b 100644
--- a/arch/arm/mm/proc-v7m.S
+++ b/arch/arm/mm/proc-v7m.S
@@ -16,11 +16,11 @@
16#include "proc-macros.S" 16#include "proc-macros.S"
17 17
18ENTRY(cpu_v7m_proc_init) 18ENTRY(cpu_v7m_proc_init)
19 mov pc, lr 19 ret lr
20ENDPROC(cpu_v7m_proc_init) 20ENDPROC(cpu_v7m_proc_init)
21 21
22ENTRY(cpu_v7m_proc_fin) 22ENTRY(cpu_v7m_proc_fin)
23 mov pc, lr 23 ret lr
24ENDPROC(cpu_v7m_proc_fin) 24ENDPROC(cpu_v7m_proc_fin)
25 25
26/* 26/*
@@ -34,7 +34,7 @@ ENDPROC(cpu_v7m_proc_fin)
34 */ 34 */
35 .align 5 35 .align 5
36ENTRY(cpu_v7m_reset) 36ENTRY(cpu_v7m_reset)
37 mov pc, r0 37 ret r0
38ENDPROC(cpu_v7m_reset) 38ENDPROC(cpu_v7m_reset)
39 39
40/* 40/*
@@ -46,18 +46,18 @@ ENDPROC(cpu_v7m_reset)
46 */ 46 */
47ENTRY(cpu_v7m_do_idle) 47ENTRY(cpu_v7m_do_idle)
48 wfi 48 wfi
49 mov pc, lr 49 ret lr
50ENDPROC(cpu_v7m_do_idle) 50ENDPROC(cpu_v7m_do_idle)
51 51
52ENTRY(cpu_v7m_dcache_clean_area) 52ENTRY(cpu_v7m_dcache_clean_area)
53 mov pc, lr 53 ret lr
54ENDPROC(cpu_v7m_dcache_clean_area) 54ENDPROC(cpu_v7m_dcache_clean_area)
55 55
56/* 56/*
57 * There is no MMU, so here is nothing to do. 57 * There is no MMU, so here is nothing to do.
58 */ 58 */
59ENTRY(cpu_v7m_switch_mm) 59ENTRY(cpu_v7m_switch_mm)
60 mov pc, lr 60 ret lr
61ENDPROC(cpu_v7m_switch_mm) 61ENDPROC(cpu_v7m_switch_mm)
62 62
63.globl cpu_v7m_suspend_size 63.globl cpu_v7m_suspend_size
@@ -65,11 +65,11 @@ ENDPROC(cpu_v7m_switch_mm)
65 65
66#ifdef CONFIG_ARM_CPU_SUSPEND 66#ifdef CONFIG_ARM_CPU_SUSPEND
67ENTRY(cpu_v7m_do_suspend) 67ENTRY(cpu_v7m_do_suspend)
68 mov pc, lr 68 ret lr
69ENDPROC(cpu_v7m_do_suspend) 69ENDPROC(cpu_v7m_do_suspend)
70 70
71ENTRY(cpu_v7m_do_resume) 71ENTRY(cpu_v7m_do_resume)
72 mov pc, lr 72 ret lr
73ENDPROC(cpu_v7m_do_resume) 73ENDPROC(cpu_v7m_do_resume)
74#endif 74#endif
75 75
@@ -120,7 +120,7 @@ __v7m_setup:
120 ldr r12, [r0, V7M_SCB_CCR] @ system control register 120 ldr r12, [r0, V7M_SCB_CCR] @ system control register
121 orr r12, #V7M_SCB_CCR_STKALIGN 121 orr r12, #V7M_SCB_CCR_STKALIGN
122 str r12, [r0, V7M_SCB_CCR] 122 str r12, [r0, V7M_SCB_CCR]
123 mov pc, lr 123 ret lr
124ENDPROC(__v7m_setup) 124ENDPROC(__v7m_setup)
125 125
126 .align 2 126 .align 2
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index dc1645890042..f8acdfece036 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -83,7 +83,7 @@
83 * Nothing too exciting at the moment 83 * Nothing too exciting at the moment
84 */ 84 */
85ENTRY(cpu_xsc3_proc_init) 85ENTRY(cpu_xsc3_proc_init)
86 mov pc, lr 86 ret lr
87 87
88/* 88/*
89 * cpu_xsc3_proc_fin() 89 * cpu_xsc3_proc_fin()
@@ -93,7 +93,7 @@ ENTRY(cpu_xsc3_proc_fin)
93 bic r0, r0, #0x1800 @ ...IZ........... 93 bic r0, r0, #0x1800 @ ...IZ...........
94 bic r0, r0, #0x0006 @ .............CA. 94 bic r0, r0, #0x0006 @ .............CA.
95 mcr p15, 0, r0, c1, c0, 0 @ disable caches 95 mcr p15, 0, r0, c1, c0, 0 @ disable caches
96 mov pc, lr 96 ret lr
97 97
98/* 98/*
99 * cpu_xsc3_reset(loc) 99 * cpu_xsc3_reset(loc)
@@ -119,7 +119,7 @@ ENTRY(cpu_xsc3_reset)
119 @ CAUTION: MMU turned off from this point. We count on the pipeline 119 @ CAUTION: MMU turned off from this point. We count on the pipeline
120 @ already containing those two last instructions to survive. 120 @ already containing those two last instructions to survive.
121 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs 121 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
122 mov pc, r0 122 ret r0
123ENDPROC(cpu_xsc3_reset) 123ENDPROC(cpu_xsc3_reset)
124 .popsection 124 .popsection
125 125
@@ -138,7 +138,7 @@ ENDPROC(cpu_xsc3_reset)
138ENTRY(cpu_xsc3_do_idle) 138ENTRY(cpu_xsc3_do_idle)
139 mov r0, #1 139 mov r0, #1
140 mcr p14, 0, r0, c7, c0, 0 @ go to idle 140 mcr p14, 0, r0, c7, c0, 0 @ go to idle
141 mov pc, lr 141 ret lr
142 142
143/* ================================= CACHE ================================ */ 143/* ================================= CACHE ================================ */
144 144
@@ -150,7 +150,7 @@ ENTRY(cpu_xsc3_do_idle)
150ENTRY(xsc3_flush_icache_all) 150ENTRY(xsc3_flush_icache_all)
151 mov r0, #0 151 mov r0, #0
152 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 152 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
153 mov pc, lr 153 ret lr
154ENDPROC(xsc3_flush_icache_all) 154ENDPROC(xsc3_flush_icache_all)
155 155
156/* 156/*
@@ -176,7 +176,7 @@ __flush_whole_cache:
176 mcrne p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB 176 mcrne p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB
177 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier 177 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier
178 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush 178 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
179 mov pc, lr 179 ret lr
180 180
181/* 181/*
182 * flush_user_cache_range(start, end, vm_flags) 182 * flush_user_cache_range(start, end, vm_flags)
@@ -205,7 +205,7 @@ ENTRY(xsc3_flush_user_cache_range)
205 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB 205 mcrne p15, 0, ip, c7, c5, 6 @ invalidate BTB
206 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier 206 mcrne p15, 0, ip, c7, c10, 4 @ data write barrier
207 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush 207 mcrne p15, 0, ip, c7, c5, 4 @ prefetch flush
208 mov pc, lr 208 ret lr
209 209
210/* 210/*
211 * coherent_kern_range(start, end) 211 * coherent_kern_range(start, end)
@@ -232,7 +232,7 @@ ENTRY(xsc3_coherent_user_range)
232 mcr p15, 0, r0, c7, c5, 0 @ invalidate L1 I cache and BTB 232 mcr p15, 0, r0, c7, c5, 0 @ invalidate L1 I cache and BTB
233 mcr p15, 0, r0, c7, c10, 4 @ data write barrier 233 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
234 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush 234 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush
235 mov pc, lr 235 ret lr
236 236
237/* 237/*
238 * flush_kern_dcache_area(void *addr, size_t size) 238 * flush_kern_dcache_area(void *addr, size_t size)
@@ -253,7 +253,7 @@ ENTRY(xsc3_flush_kern_dcache_area)
253 mcr p15, 0, r0, c7, c5, 0 @ invalidate L1 I cache and BTB 253 mcr p15, 0, r0, c7, c5, 0 @ invalidate L1 I cache and BTB
254 mcr p15, 0, r0, c7, c10, 4 @ data write barrier 254 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
255 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush 255 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush
256 mov pc, lr 256 ret lr
257 257
258/* 258/*
259 * dma_inv_range(start, end) 259 * dma_inv_range(start, end)
@@ -277,7 +277,7 @@ xsc3_dma_inv_range:
277 cmp r0, r1 277 cmp r0, r1
278 blo 1b 278 blo 1b
279 mcr p15, 0, r0, c7, c10, 4 @ data write barrier 279 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
280 mov pc, lr 280 ret lr
281 281
282/* 282/*
283 * dma_clean_range(start, end) 283 * dma_clean_range(start, end)
@@ -294,7 +294,7 @@ xsc3_dma_clean_range:
294 cmp r0, r1 294 cmp r0, r1
295 blo 1b 295 blo 1b
296 mcr p15, 0, r0, c7, c10, 4 @ data write barrier 296 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
297 mov pc, lr 297 ret lr
298 298
299/* 299/*
300 * dma_flush_range(start, end) 300 * dma_flush_range(start, end)
@@ -311,7 +311,7 @@ ENTRY(xsc3_dma_flush_range)
311 cmp r0, r1 311 cmp r0, r1
312 blo 1b 312 blo 1b
313 mcr p15, 0, r0, c7, c10, 4 @ data write barrier 313 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
314 mov pc, lr 314 ret lr
315 315
316/* 316/*
317 * dma_map_area(start, size, dir) 317 * dma_map_area(start, size, dir)
@@ -334,7 +334,7 @@ ENDPROC(xsc3_dma_map_area)
334 * - dir - DMA direction 334 * - dir - DMA direction
335 */ 335 */
336ENTRY(xsc3_dma_unmap_area) 336ENTRY(xsc3_dma_unmap_area)
337 mov pc, lr 337 ret lr
338ENDPROC(xsc3_dma_unmap_area) 338ENDPROC(xsc3_dma_unmap_area)
339 339
340 .globl xsc3_flush_kern_cache_louis 340 .globl xsc3_flush_kern_cache_louis
@@ -348,7 +348,7 @@ ENTRY(cpu_xsc3_dcache_clean_area)
348 add r0, r0, #CACHELINESIZE 348 add r0, r0, #CACHELINESIZE
349 subs r1, r1, #CACHELINESIZE 349 subs r1, r1, #CACHELINESIZE
350 bhi 1b 350 bhi 1b
351 mov pc, lr 351 ret lr
352 352
353/* =============================== PageTable ============================== */ 353/* =============================== PageTable ============================== */
354 354
@@ -406,7 +406,7 @@ ENTRY(cpu_xsc3_set_pte_ext)
406 orr r2, r2, ip 406 orr r2, r2, ip
407 407
408 xscale_set_pte_ext_epilogue 408 xscale_set_pte_ext_epilogue
409 mov pc, lr 409 ret lr
410 410
411 .ltorg 411 .ltorg
412 .align 412 .align
@@ -478,7 +478,7 @@ __xsc3_setup:
478 bic r0, r0, r5 @ ..V. ..R. .... ..A. 478 bic r0, r0, r5 @ ..V. ..R. .... ..A.
479 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu) 479 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu)
480 @ ...I Z..S .... .... (uc) 480 @ ...I Z..S .... .... (uc)
481 mov pc, lr 481 ret lr
482 482
483 .size __xsc3_setup, . - __xsc3_setup 483 .size __xsc3_setup, . - __xsc3_setup
484 484
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index d19b1cfcad91..23259f104c66 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -118,7 +118,7 @@ ENTRY(cpu_xscale_proc_init)
118 mrc p15, 0, r1, c1, c0, 1 118 mrc p15, 0, r1, c1, c0, 1
119 bic r1, r1, #1 119 bic r1, r1, #1
120 mcr p15, 0, r1, c1, c0, 1 120 mcr p15, 0, r1, c1, c0, 1
121 mov pc, lr 121 ret lr
122 122
123/* 123/*
124 * cpu_xscale_proc_fin() 124 * cpu_xscale_proc_fin()
@@ -128,7 +128,7 @@ ENTRY(cpu_xscale_proc_fin)
128 bic r0, r0, #0x1800 @ ...IZ........... 128 bic r0, r0, #0x1800 @ ...IZ...........
129 bic r0, r0, #0x0006 @ .............CA. 129 bic r0, r0, #0x0006 @ .............CA.
130 mcr p15, 0, r0, c1, c0, 0 @ disable caches 130 mcr p15, 0, r0, c1, c0, 0 @ disable caches
131 mov pc, lr 131 ret lr
132 132
133/* 133/*
134 * cpu_xscale_reset(loc) 134 * cpu_xscale_reset(loc)
@@ -160,7 +160,7 @@ ENTRY(cpu_xscale_reset)
160 @ CAUTION: MMU turned off from this point. We count on the pipeline 160 @ CAUTION: MMU turned off from this point. We count on the pipeline
161 @ already containing those two last instructions to survive. 161 @ already containing those two last instructions to survive.
162 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 162 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
163 mov pc, r0 163 ret r0
164ENDPROC(cpu_xscale_reset) 164ENDPROC(cpu_xscale_reset)
165 .popsection 165 .popsection
166 166
@@ -179,7 +179,7 @@ ENDPROC(cpu_xscale_reset)
179ENTRY(cpu_xscale_do_idle) 179ENTRY(cpu_xscale_do_idle)
180 mov r0, #1 180 mov r0, #1
181 mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE 181 mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
182 mov pc, lr 182 ret lr
183 183
184/* ================================= CACHE ================================ */ 184/* ================================= CACHE ================================ */
185 185
@@ -191,7 +191,7 @@ ENTRY(cpu_xscale_do_idle)
191ENTRY(xscale_flush_icache_all) 191ENTRY(xscale_flush_icache_all)
192 mov r0, #0 192 mov r0, #0
193 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 193 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
194 mov pc, lr 194 ret lr
195ENDPROC(xscale_flush_icache_all) 195ENDPROC(xscale_flush_icache_all)
196 196
197/* 197/*
@@ -216,7 +216,7 @@ __flush_whole_cache:
216 tst r2, #VM_EXEC 216 tst r2, #VM_EXEC
217 mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB 217 mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
218 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer 218 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
219 mov pc, lr 219 ret lr
220 220
221/* 221/*
222 * flush_user_cache_range(start, end, vm_flags) 222 * flush_user_cache_range(start, end, vm_flags)
@@ -245,7 +245,7 @@ ENTRY(xscale_flush_user_cache_range)
245 tst r2, #VM_EXEC 245 tst r2, #VM_EXEC
246 mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB 246 mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
247 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer 247 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write (& Fill) Buffer
248 mov pc, lr 248 ret lr
249 249
250/* 250/*
251 * coherent_kern_range(start, end) 251 * coherent_kern_range(start, end)
@@ -269,7 +269,7 @@ ENTRY(xscale_coherent_kern_range)
269 mov r0, #0 269 mov r0, #0
270 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB 270 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
271 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 271 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
272 mov pc, lr 272 ret lr
273 273
274/* 274/*
275 * coherent_user_range(start, end) 275 * coherent_user_range(start, end)
@@ -291,7 +291,7 @@ ENTRY(xscale_coherent_user_range)
291 mov r0, #0 291 mov r0, #0
292 mcr p15, 0, r0, c7, c5, 6 @ Invalidate BTB 292 mcr p15, 0, r0, c7, c5, 6 @ Invalidate BTB
293 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 293 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
294 mov pc, lr 294 ret lr
295 295
296/* 296/*
297 * flush_kern_dcache_area(void *addr, size_t size) 297 * flush_kern_dcache_area(void *addr, size_t size)
@@ -312,7 +312,7 @@ ENTRY(xscale_flush_kern_dcache_area)
312 mov r0, #0 312 mov r0, #0
313 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB 313 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
314 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 314 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
315 mov pc, lr 315 ret lr
316 316
317/* 317/*
318 * dma_inv_range(start, end) 318 * dma_inv_range(start, end)
@@ -336,7 +336,7 @@ xscale_dma_inv_range:
336 cmp r0, r1 336 cmp r0, r1
337 blo 1b 337 blo 1b
338 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 338 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
339 mov pc, lr 339 ret lr
340 340
341/* 341/*
342 * dma_clean_range(start, end) 342 * dma_clean_range(start, end)
@@ -353,7 +353,7 @@ xscale_dma_clean_range:
353 cmp r0, r1 353 cmp r0, r1
354 blo 1b 354 blo 1b
355 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 355 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
356 mov pc, lr 356 ret lr
357 357
358/* 358/*
359 * dma_flush_range(start, end) 359 * dma_flush_range(start, end)
@@ -371,7 +371,7 @@ ENTRY(xscale_dma_flush_range)
371 cmp r0, r1 371 cmp r0, r1
372 blo 1b 372 blo 1b
373 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer 373 mcr p15, 0, r0, c7, c10, 4 @ Drain Write (& Fill) Buffer
374 mov pc, lr 374 ret lr
375 375
376/* 376/*
377 * dma_map_area(start, size, dir) 377 * dma_map_area(start, size, dir)
@@ -407,7 +407,7 @@ ENDPROC(xscale_80200_A0_A1_dma_map_area)
407 * - dir - DMA direction 407 * - dir - DMA direction
408 */ 408 */
409ENTRY(xscale_dma_unmap_area) 409ENTRY(xscale_dma_unmap_area)
410 mov pc, lr 410 ret lr
411ENDPROC(xscale_dma_unmap_area) 411ENDPROC(xscale_dma_unmap_area)
412 412
413 .globl xscale_flush_kern_cache_louis 413 .globl xscale_flush_kern_cache_louis
@@ -458,7 +458,7 @@ ENTRY(cpu_xscale_dcache_clean_area)
458 add r0, r0, #CACHELINESIZE 458 add r0, r0, #CACHELINESIZE
459 subs r1, r1, #CACHELINESIZE 459 subs r1, r1, #CACHELINESIZE
460 bhi 1b 460 bhi 1b
461 mov pc, lr 461 ret lr
462 462
463/* =============================== PageTable ============================== */ 463/* =============================== PageTable ============================== */
464 464
@@ -521,7 +521,7 @@ ENTRY(cpu_xscale_set_pte_ext)
521 orr r2, r2, ip 521 orr r2, r2, ip
522 522
523 xscale_set_pte_ext_epilogue 523 xscale_set_pte_ext_epilogue
524 mov pc, lr 524 ret lr
525 525
526 .ltorg 526 .ltorg
527 .align 527 .align
@@ -572,7 +572,7 @@ __xscale_setup:
572 mrc p15, 0, r0, c1, c0, 0 @ get control register 572 mrc p15, 0, r0, c1, c0, 0 @ get control register
573 bic r0, r0, r5 573 bic r0, r0, r5
574 orr r0, r0, r6 574 orr r0, r0, r6
575 mov pc, lr 575 ret lr
576 .size __xscale_setup, . - __xscale_setup 576 .size __xscale_setup, . - __xscale_setup
577 577
578 /* 578 /*
diff --git a/arch/arm/mm/tlb-fa.S b/arch/arm/mm/tlb-fa.S
index d3ddcf9a76ca..d2d9ecbe0aac 100644
--- a/arch/arm/mm/tlb-fa.S
+++ b/arch/arm/mm/tlb-fa.S
@@ -18,6 +18,7 @@
18 */ 18 */
19#include <linux/linkage.h> 19#include <linux/linkage.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <asm/assembler.h>
21#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
22#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
23#include "proc-macros.S" 24#include "proc-macros.S"
@@ -37,7 +38,7 @@ ENTRY(fa_flush_user_tlb_range)
37 vma_vm_mm ip, r2 38 vma_vm_mm ip, r2
38 act_mm r3 @ get current->active_mm 39 act_mm r3 @ get current->active_mm
39 eors r3, ip, r3 @ == mm ? 40 eors r3, ip, r3 @ == mm ?
40 movne pc, lr @ no, we dont do anything 41 retne lr @ no, we dont do anything
41 mov r3, #0 42 mov r3, #0
42 mcr p15, 0, r3, c7, c10, 4 @ drain WB 43 mcr p15, 0, r3, c7, c10, 4 @ drain WB
43 bic r0, r0, #0x0ff 44 bic r0, r0, #0x0ff
@@ -47,7 +48,7 @@ ENTRY(fa_flush_user_tlb_range)
47 cmp r0, r1 48 cmp r0, r1
48 blo 1b 49 blo 1b
49 mcr p15, 0, r3, c7, c10, 4 @ data write barrier 50 mcr p15, 0, r3, c7, c10, 4 @ data write barrier
50 mov pc, lr 51 ret lr
51 52
52 53
53ENTRY(fa_flush_kern_tlb_range) 54ENTRY(fa_flush_kern_tlb_range)
@@ -61,7 +62,7 @@ ENTRY(fa_flush_kern_tlb_range)
61 blo 1b 62 blo 1b
62 mcr p15, 0, r3, c7, c10, 4 @ data write barrier 63 mcr p15, 0, r3, c7, c10, 4 @ data write barrier
63 mcr p15, 0, r3, c7, c5, 4 @ prefetch flush (isb) 64 mcr p15, 0, r3, c7, c5, 4 @ prefetch flush (isb)
64 mov pc, lr 65 ret lr
65 66
66 __INITDATA 67 __INITDATA
67 68
diff --git a/arch/arm/mm/tlb-v4.S b/arch/arm/mm/tlb-v4.S
index 17a025ade573..a2b5dca42048 100644
--- a/arch/arm/mm/tlb-v4.S
+++ b/arch/arm/mm/tlb-v4.S
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/assembler.h>
17#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
19#include "proc-macros.S" 20#include "proc-macros.S"
@@ -33,7 +34,7 @@ ENTRY(v4_flush_user_tlb_range)
33 vma_vm_mm ip, r2 34 vma_vm_mm ip, r2
34 act_mm r3 @ get current->active_mm 35 act_mm r3 @ get current->active_mm
35 eors r3, ip, r3 @ == mm ? 36 eors r3, ip, r3 @ == mm ?
36 movne pc, lr @ no, we dont do anything 37 retne lr @ no, we dont do anything
37.v4_flush_kern_tlb_range: 38.v4_flush_kern_tlb_range:
38 bic r0, r0, #0x0ff 39 bic r0, r0, #0x0ff
39 bic r0, r0, #0xf00 40 bic r0, r0, #0xf00
@@ -41,7 +42,7 @@ ENTRY(v4_flush_user_tlb_range)
41 add r0, r0, #PAGE_SZ 42 add r0, r0, #PAGE_SZ
42 cmp r0, r1 43 cmp r0, r1
43 blo 1b 44 blo 1b
44 mov pc, lr 45 ret lr
45 46
46/* 47/*
47 * v4_flush_kern_tlb_range(start, end) 48 * v4_flush_kern_tlb_range(start, end)
diff --git a/arch/arm/mm/tlb-v4wb.S b/arch/arm/mm/tlb-v4wb.S
index c04598fa4d4a..5a093b458dbc 100644
--- a/arch/arm/mm/tlb-v4wb.S
+++ b/arch/arm/mm/tlb-v4wb.S
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/assembler.h>
17#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
19#include "proc-macros.S" 20#include "proc-macros.S"
@@ -33,7 +34,7 @@ ENTRY(v4wb_flush_user_tlb_range)
33 vma_vm_mm ip, r2 34 vma_vm_mm ip, r2
34 act_mm r3 @ get current->active_mm 35 act_mm r3 @ get current->active_mm
35 eors r3, ip, r3 @ == mm ? 36 eors r3, ip, r3 @ == mm ?
36 movne pc, lr @ no, we dont do anything 37 retne lr @ no, we dont do anything
37 vma_vm_flags r2, r2 38 vma_vm_flags r2, r2
38 mcr p15, 0, r3, c7, c10, 4 @ drain WB 39 mcr p15, 0, r3, c7, c10, 4 @ drain WB
39 tst r2, #VM_EXEC 40 tst r2, #VM_EXEC
@@ -44,7 +45,7 @@ ENTRY(v4wb_flush_user_tlb_range)
44 add r0, r0, #PAGE_SZ 45 add r0, r0, #PAGE_SZ
45 cmp r0, r1 46 cmp r0, r1
46 blo 1b 47 blo 1b
47 mov pc, lr 48 ret lr
48 49
49/* 50/*
50 * v4_flush_kern_tlb_range(start, end) 51 * v4_flush_kern_tlb_range(start, end)
@@ -65,7 +66,7 @@ ENTRY(v4wb_flush_kern_tlb_range)
65 add r0, r0, #PAGE_SZ 66 add r0, r0, #PAGE_SZ
66 cmp r0, r1 67 cmp r0, r1
67 blo 1b 68 blo 1b
68 mov pc, lr 69 ret lr
69 70
70 __INITDATA 71 __INITDATA
71 72
diff --git a/arch/arm/mm/tlb-v4wbi.S b/arch/arm/mm/tlb-v4wbi.S
index 1f6062b6c1c1..058861548f68 100644
--- a/arch/arm/mm/tlb-v4wbi.S
+++ b/arch/arm/mm/tlb-v4wbi.S
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <asm/assembler.h>
17#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
18#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
19#include "proc-macros.S" 20#include "proc-macros.S"
@@ -32,7 +33,7 @@ ENTRY(v4wbi_flush_user_tlb_range)
32 vma_vm_mm ip, r2 33 vma_vm_mm ip, r2
33 act_mm r3 @ get current->active_mm 34 act_mm r3 @ get current->active_mm
34 eors r3, ip, r3 @ == mm ? 35 eors r3, ip, r3 @ == mm ?
35 movne pc, lr @ no, we dont do anything 36 retne lr @ no, we dont do anything
36 mov r3, #0 37 mov r3, #0
37 mcr p15, 0, r3, c7, c10, 4 @ drain WB 38 mcr p15, 0, r3, c7, c10, 4 @ drain WB
38 vma_vm_flags r2, r2 39 vma_vm_flags r2, r2
@@ -44,7 +45,7 @@ ENTRY(v4wbi_flush_user_tlb_range)
44 add r0, r0, #PAGE_SZ 45 add r0, r0, #PAGE_SZ
45 cmp r0, r1 46 cmp r0, r1
46 blo 1b 47 blo 1b
47 mov pc, lr 48 ret lr
48 49
49ENTRY(v4wbi_flush_kern_tlb_range) 50ENTRY(v4wbi_flush_kern_tlb_range)
50 mov r3, #0 51 mov r3, #0
@@ -56,7 +57,7 @@ ENTRY(v4wbi_flush_kern_tlb_range)
56 add r0, r0, #PAGE_SZ 57 add r0, r0, #PAGE_SZ
57 cmp r0, r1 58 cmp r0, r1
58 blo 1b 59 blo 1b
59 mov pc, lr 60 ret lr
60 61
61 __INITDATA 62 __INITDATA
62 63
diff --git a/arch/arm/mm/tlb-v6.S b/arch/arm/mm/tlb-v6.S
index eca07f550a0b..6f689be638bd 100644
--- a/arch/arm/mm/tlb-v6.S
+++ b/arch/arm/mm/tlb-v6.S
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/asm-offsets.h> 15#include <asm/asm-offsets.h>
16#include <asm/assembler.h>
16#include <asm/page.h> 17#include <asm/page.h>
17#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
18#include "proc-macros.S" 19#include "proc-macros.S"
@@ -55,7 +56,7 @@ ENTRY(v6wbi_flush_user_tlb_range)
55 cmp r0, r1 56 cmp r0, r1
56 blo 1b 57 blo 1b
57 mcr p15, 0, ip, c7, c10, 4 @ data synchronization barrier 58 mcr p15, 0, ip, c7, c10, 4 @ data synchronization barrier
58 mov pc, lr 59 ret lr
59 60
60/* 61/*
61 * v6wbi_flush_kern_tlb_range(start,end) 62 * v6wbi_flush_kern_tlb_range(start,end)
@@ -84,7 +85,7 @@ ENTRY(v6wbi_flush_kern_tlb_range)
84 blo 1b 85 blo 1b
85 mcr p15, 0, r2, c7, c10, 4 @ data synchronization barrier 86 mcr p15, 0, r2, c7, c10, 4 @ data synchronization barrier
86 mcr p15, 0, r2, c7, c5, 4 @ prefetch flush (isb) 87 mcr p15, 0, r2, c7, c5, 4 @ prefetch flush (isb)
87 mov pc, lr 88 ret lr
88 89
89 __INIT 90 __INIT
90 91
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S
index 355308767bae..e5101a3bc57c 100644
--- a/arch/arm/mm/tlb-v7.S
+++ b/arch/arm/mm/tlb-v7.S
@@ -57,7 +57,7 @@ ENTRY(v7wbi_flush_user_tlb_range)
57 cmp r0, r1 57 cmp r0, r1
58 blo 1b 58 blo 1b
59 dsb ish 59 dsb ish
60 mov pc, lr 60 ret lr
61ENDPROC(v7wbi_flush_user_tlb_range) 61ENDPROC(v7wbi_flush_user_tlb_range)
62 62
63/* 63/*
@@ -86,7 +86,7 @@ ENTRY(v7wbi_flush_kern_tlb_range)
86 blo 1b 86 blo 1b
87 dsb ish 87 dsb ish
88 isb 88 isb
89 mov pc, lr 89 ret lr
90ENDPROC(v7wbi_flush_kern_tlb_range) 90ENDPROC(v7wbi_flush_kern_tlb_range)
91 91
92 __INIT 92 __INIT
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index fb5503ce016f..a37b989a2f91 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -56,7 +56,7 @@
56#define FLAG_NEED_X_RESET (1 << 0) 56#define FLAG_NEED_X_RESET (1 << 0)
57 57
58struct jit_ctx { 58struct jit_ctx {
59 const struct sk_filter *skf; 59 const struct bpf_prog *skf;
60 unsigned idx; 60 unsigned idx;
61 unsigned prologue_bytes; 61 unsigned prologue_bytes;
62 int ret0_fp_idx; 62 int ret0_fp_idx;
@@ -465,7 +465,7 @@ static inline void update_on_xread(struct jit_ctx *ctx)
465static int build_body(struct jit_ctx *ctx) 465static int build_body(struct jit_ctx *ctx)
466{ 466{
467 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; 467 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w};
468 const struct sk_filter *prog = ctx->skf; 468 const struct bpf_prog *prog = ctx->skf;
469 const struct sock_filter *inst; 469 const struct sock_filter *inst;
470 unsigned i, load_order, off, condt; 470 unsigned i, load_order, off, condt;
471 int imm12; 471 int imm12;
@@ -857,7 +857,7 @@ b_epilogue:
857} 857}
858 858
859 859
860void bpf_jit_compile(struct sk_filter *fp) 860void bpf_jit_compile(struct bpf_prog *fp)
861{ 861{
862 struct jit_ctx ctx; 862 struct jit_ctx ctx;
863 unsigned tmp_idx; 863 unsigned tmp_idx;
@@ -926,7 +926,7 @@ out:
926 return; 926 return;
927} 927}
928 928
929void bpf_jit_free(struct sk_filter *fp) 929void bpf_jit_free(struct bpf_prog *fp)
930{ 930{
931 if (fp->jited) 931 if (fp->jited)
932 module_free(NULL, fp->bpf_func); 932 module_free(NULL, fp->bpf_func);
diff --git a/arch/arm/nwfpe/entry.S b/arch/arm/nwfpe/entry.S
index d18dde95b8aa..5d65be1f1e8a 100644
--- a/arch/arm/nwfpe/entry.S
+++ b/arch/arm/nwfpe/entry.S
@@ -19,7 +19,7 @@
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 21*/
22 22#include <asm/assembler.h>
23#include <asm/opcodes.h> 23#include <asm/opcodes.h>
24 24
25/* This is the kernel's entry point into the floating point emulator. 25/* This is the kernel's entry point into the floating point emulator.
@@ -92,7 +92,7 @@ emulate:
92 mov r0, r6 @ prepare for EmulateAll() 92 mov r0, r6 @ prepare for EmulateAll()
93 bl EmulateAll @ emulate the instruction 93 bl EmulateAll @ emulate the instruction
94 cmp r0, #0 @ was emulation successful 94 cmp r0, #0 @ was emulation successful
95 moveq pc, r4 @ no, return failure 95 reteq r4 @ no, return failure
96 96
97next: 97next:
98.Lx1: ldrt r6, [r5], #4 @ get the next instruction and 98.Lx1: ldrt r6, [r5], #4 @ get the next instruction and
@@ -102,7 +102,7 @@ next:
102 teq r2, #0x0C000000 102 teq r2, #0x0C000000
103 teqne r2, #0x0D000000 103 teqne r2, #0x0D000000
104 teqne r2, #0x0E000000 104 teqne r2, #0x0E000000
105 movne pc, r9 @ return ok if not a fp insn 105 retne r9 @ return ok if not a fp insn
106 106
107 str r5, [sp, #S_PC] @ update PC copy in regs 107 str r5, [sp, #S_PC] @ update PC copy in regs
108 108
@@ -115,7 +115,7 @@ next:
115 @ plain LDR instruction. Weird, but it seems harmless. 115 @ plain LDR instruction. Weird, but it seems harmless.
116 .pushsection .fixup,"ax" 116 .pushsection .fixup,"ax"
117 .align 2 117 .align 2
118.Lfix: mov pc, r9 @ let the user eat segfaults 118.Lfix: ret r9 @ let the user eat segfaults
119 .popsection 119 .popsection
120 120
121 .pushsection __ex_table,"a" 121 .pushsection __ex_table,"a"
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 99c63d4b6af8..cc649a1e46da 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -33,12 +33,14 @@ static struct op_perf_name {
33 char *perf_name; 33 char *perf_name;
34 char *op_name; 34 char *op_name;
35} op_perf_name_map[] = { 35} op_perf_name_map[] = {
36 { "xscale1", "arm/xscale1" }, 36 { "armv5_xscale1", "arm/xscale1" },
37 { "xscale1", "arm/xscale2" }, 37 { "armv5_xscale2", "arm/xscale2" },
38 { "v6", "arm/armv6" }, 38 { "armv6_1136", "arm/armv6" },
39 { "v6mpcore", "arm/mpcore" }, 39 { "armv6_1156", "arm/armv6" },
40 { "ARMv7 Cortex-A8", "arm/armv7" }, 40 { "armv6_1176", "arm/armv6" },
41 { "ARMv7 Cortex-A9", "arm/armv7-ca9" }, 41 { "armv6_11mpcore", "arm/mpcore" },
42 { "armv7_cortex_a8", "arm/armv7" },
43 { "armv7_cortex_a9", "arm/armv7-ca9" },
42}; 44};
43 45
44char *op_name_from_perf_id(void) 46char *op_name_from_perf_id(void)
@@ -107,10 +109,7 @@ static void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
107 109
108 if (!user_mode(regs)) { 110 if (!user_mode(regs)) {
109 struct stackframe frame; 111 struct stackframe frame;
110 frame.fp = regs->ARM_fp; 112 arm_get_current_stackframe(regs, &frame);
111 frame.sp = regs->ARM_sp;
112 frame.lr = regs->ARM_lr;
113 frame.pc = regs->ARM_pc;
114 walk_stackframe(&frame, report_trace, &depth); 113 walk_stackframe(&frame, report_trace, &depth);
115 return; 114 return;
116 } 115 }
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index b5608b1f9fbd..c2baa8ede543 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -698,6 +698,8 @@ int omap_request_dma(int dev_id, const char *dev_name,
698 unsigned long flags; 698 unsigned long flags;
699 struct omap_dma_lch *chan; 699 struct omap_dma_lch *chan;
700 700
701 WARN(strcmp(dev_name, "DMA engine"), "Using deprecated platform DMA API - please update to DMA engine");
702
701 spin_lock_irqsave(&dma_chan_lock, flags); 703 spin_lock_irqsave(&dma_chan_lock, flags);
702 for (ch = 0; ch < dma_chan_count; ch++) { 704 for (ch = 0; ch < dma_chan_count; ch++) {
703 if (free_ch == -1 && dma_chan[ch].dev_id == -1) { 705 if (free_ch == -1 && dma_chan[ch].dev_id == -1) {
@@ -2100,7 +2102,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
2100 omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, 2102 omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE,
2101 DMA_DEFAULT_FIFO_DEPTH, 0); 2103 DMA_DEFAULT_FIFO_DEPTH, 0);
2102 2104
2103 if (dma_omap2plus()) { 2105 if (dma_omap2plus() && !(d->dev_caps & DMA_ENGINE_HANDLE_IRQ)) {
2104 strcpy(irq_name, "0"); 2106 strcpy(irq_name, "0");
2105 dma_irq = platform_get_irq_byname(pdev, irq_name); 2107 dma_irq = platform_get_irq_byname(pdev, irq_name);
2106 if (dma_irq < 0) { 2108 if (dma_irq < 0) {
@@ -2145,7 +2147,8 @@ static int omap_system_dma_remove(struct platform_device *pdev)
2145 char irq_name[4]; 2147 char irq_name[4];
2146 strcpy(irq_name, "0"); 2148 strcpy(irq_name, "0");
2147 dma_irq = platform_get_irq_byname(pdev, irq_name); 2149 dma_irq = platform_get_irq_byname(pdev, irq_name);
2148 remove_irq(dma_irq, &omap24xx_dma_irq); 2150 if (dma_irq >= 0)
2151 remove_irq(dma_irq, &omap24xx_dma_irq);
2149 } else { 2152 } else {
2150 int irq_rel = 0; 2153 int irq_rel = 0;
2151 for ( ; irq_rel < dma_chan_count; irq_rel++) { 2154 for ( ; irq_rel < dma_chan_count; irq_rel++) {
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 301b892d97d9..c87aefbf3a13 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -6,30 +6,16 @@
6 6
7config PLAT_SAMSUNG 7config PLAT_SAMSUNG
8 bool 8 bool
9 depends on PLAT_S3C24XX || ARCH_S3C64XX || PLAT_S5P || ARCH_EXYNOS 9 depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_EXYNOS || ARCH_S5PV210
10 default y 10 default y
11 select GENERIC_IRQ_CHIP 11 select GENERIC_IRQ_CHIP
12 select NO_IOPORT_MAP 12 select NO_IOPORT_MAP
13 help 13 help
14 Base platform code for all Samsung SoC based systems 14 Base platform code for all Samsung SoC based systems
15 15
16config PLAT_S5P
17 bool
18 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
19 default y
20 select ARCH_REQUIRE_GPIOLIB
21 select ARM_VIC
22 select NO_IOPORT_MAP
23 select PLAT_SAMSUNG
24 select S3C_GPIO_TRACK
25 select S5P_GPIO_DRVSTR
26 select SAMSUNG_CLKSRC if !COMMON_CLK
27 help
28 Base platform code for Samsung's S5P series SoC.
29
30config SAMSUNG_PM 16config SAMSUNG_PM
31 bool 17 bool
32 depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || S5P_PM) 18 depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX)
33 default y 19 default y
34 help 20 help
35 Base platform power management code for samsung code 21 Base platform power management code for samsung code
@@ -65,65 +51,6 @@ config SAMSUNG_ATAGS
65 51
66if SAMSUNG_ATAGS 52if SAMSUNG_ATAGS
67 53
68# clock options
69
70config SAMSUNG_CLOCK
71 bool
72 default y if !COMMON_CLK
73
74config SAMSUNG_CLKSRC
75 bool
76 help
77 Select the clock code for the clksrc implementation
78 used by newer systems such as the S3C64XX.
79
80config S5P_CLOCK
81 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
82 help
83 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs
84
85# options for IRQ support
86
87config S5P_IRQ
88 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
89 help
90 Support common interrupt part for ARCH_S5P SoCs
91
92config S5P_EXT_INT
93 bool
94 help
95 Use the external interrupts (other than GPIO interrupts.)
96 Note: Do not choose this for S5P6440 and S5P6450.
97
98config S5P_GPIO_INT
99 bool
100 help
101 Common code for the GPIO interrupts (other than external interrupts.)
102
103# options for gpio configuration support
104
105config S5P_GPIO_DRVSTR
106 bool
107 help
108 Internal configuration to get and set correct GPIO driver strength
109 helper
110
111config SAMSUNG_GPIO_EXTRA
112 int "Number of additional GPIO pins"
113 default 128 if SAMSUNG_GPIO_EXTRA128
114 default 64 if SAMSUNG_GPIO_EXTRA64
115 default 0
116 help
117 Use additional GPIO space in addition to the GPIO's the SOC
118 provides. This allows expanding the GPIO space for use with
119 GPIO expanders.
120
121config SAMSUNG_GPIO_EXTRA64
122 bool
123
124config SAMSUNG_GPIO_EXTRA128
125 bool
126
127config S3C_GPIO_SPACE 54config S3C_GPIO_SPACE
128 int "Space between gpio banks" 55 int "Space between gpio banks"
129 default 0 56 default 0
@@ -139,12 +66,6 @@ config S3C_GPIO_TRACK
139 Internal configuration option to enable the s3c specific gpio 66 Internal configuration option to enable the s3c specific gpio
140 chip tracking if the platform requires it. 67 chip tracking if the platform requires it.
141 68
142# uart options
143
144config S5P_DEV_UART
145 def_bool y
146 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
147
148# ADC driver 69# ADC driver
149 70
150config S3C_ADC 71config S3C_ADC
@@ -302,66 +223,6 @@ config SAMSUNG_DEV_BACKLIGHT
302 help 223 help
303 Compile in platform device definition LCD backlight with PWM Timer 224 Compile in platform device definition LCD backlight with PWM Timer
304 225
305config S5P_DEV_CSIS0
306 bool
307 help
308 Compile in platform device definitions for MIPI-CSIS channel 0
309
310config S5P_DEV_CSIS1
311 bool
312 help
313 Compile in platform device definitions for MIPI-CSIS channel 1
314
315config S5P_DEV_FIMC0
316 bool
317 help
318 Compile in platform device definitions for FIMC controller 0
319
320config S5P_DEV_FIMC1
321 bool
322 help
323 Compile in platform device definitions for FIMC controller 1
324
325config S5P_DEV_FIMC2
326 bool
327 help
328 Compile in platform device definitions for FIMC controller 2
329
330config S5P_DEV_FIMC3
331 bool
332 help
333 Compile in platform device definitions for FIMC controller 3
334
335config S5P_DEV_FIMD0
336 bool
337 help
338 Compile in platform device definitions for FIMD controller 0
339
340config S5P_DEV_G2D
341 bool
342 help
343 Compile in platform device definitions for G2D device
344
345config S5P_DEV_I2C_HDMIPHY
346 bool
347 help
348 Compile in platform device definitions for I2C HDMIPHY controller
349
350config S5P_DEV_JPEG
351 bool
352 help
353 Compile in platform device definitions for JPEG codec
354
355config S5P_DEV_ONENAND
356 bool
357 help
358 Compile in platform device definition for OneNAND controller
359
360config S5P_DEV_TV
361 bool
362 help
363 Compile in platform device definition for TV interface
364
365config S3C24XX_PWM 226config S3C24XX_PWM
366 bool "PWM device support" 227 bool "PWM device support"
367 select PWM 228 select PWM
@@ -382,12 +243,6 @@ config S3C_DMA
382 help 243 help
383 Internal configuration for S3C DMA core 244 Internal configuration for S3C DMA core
384 245
385config S5P_IRQ_PM
386 bool
387 default y if S5P_PM
388 help
389 Legacy IRQ power management for S5P platforms
390
391config SAMSUNG_PM_GPIO 246config SAMSUNG_PM_GPIO
392 bool 247 bool
393 default y if GPIO_SAMSUNG && PM 248 default y if GPIO_SAMSUNG && PM
@@ -397,7 +252,7 @@ config SAMSUNG_PM_GPIO
397 252
398config SAMSUNG_DMADEV 253config SAMSUNG_DMADEV
399 bool "Use legacy Samsung DMA abstraction" 254 bool "Use legacy Samsung DMA abstraction"
400 depends on CPU_S5PV210 || CPU_S5PC100 || ARCH_S5P64X0 || ARCH_S3C64XX 255 depends on CPU_S5PV210 || ARCH_S3C64XX
401 select DMADEVICES 256 select DMADEVICES
402 default y 257 default y
403 help 258 help
@@ -470,18 +325,6 @@ config SAMSUNG_WDT_RESET
470 Compile support for system restart by triggering watchdog reset. 325 Compile support for system restart by triggering watchdog reset.
471 Used on SoCs that do not provide dedicated reset control. 326 Used on SoCs that do not provide dedicated reset control.
472 327
473config S5P_PM
474 bool
475 help
476 Common code for power management support on S5P and newer SoCs
477 Note: Do not select this for S5P6440 and S5P6450.
478
479config S5P_SLEEP
480 bool
481 help
482 Internal config node to apply common S5P sleep management code.
483 Can be selected by S5P and newer SoCs with similar sleep procedure.
484
485config DEBUG_S3C_UART 328config DEBUG_S3C_UART
486 depends on PLAT_SAMSUNG 329 depends on PLAT_SAMSUNG
487 int 330 int
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 5e5beaa9ae15..5fe175017f07 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -5,7 +5,6 @@
5# Licensed under GPLv2 5# Licensed under GPLv2
6 6
7ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include 7ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
8ccflags-$(CONFIG_ARCH_EXYNOS) += -I$(srctree)/arch/arm/mach-exynos/include
9 8
10obj-y := 9obj-y :=
11obj-m := 10obj-m :=
@@ -16,15 +15,6 @@ obj- :=
16 15
17obj-y += init.o cpu.o 16obj-y += init.o cpu.o
18 17
19obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o
20
21obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o
22obj-$(CONFIG_S5P_CLOCK) += s5p-clock.o
23
24obj-$(CONFIG_S5P_IRQ) += s5p-irq.o
25obj-$(CONFIG_S5P_EXT_INT) += s5p-irq-eint.o
26obj-$(CONFIG_S5P_GPIO_INT) += s5p-irq-gpioint.o
27
28# ADC 18# ADC
29 19
30obj-$(CONFIG_S3C_ADC) += adc.o 20obj-$(CONFIG_S3C_ADC) += adc.o
@@ -36,7 +26,6 @@ obj-$(CONFIG_SAMSUNG_ATAGS) += platformdata.o
36obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o 26obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o
37obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o 27obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o
38obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o 28obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
39obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o
40 29
41obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o 30obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
42 31
@@ -58,7 +47,3 @@ obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o
58 47
59obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o 48obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
60obj-$(CONFIG_SAMSUNG_WDT_RESET) += watchdog-reset.o 49obj-$(CONFIG_SAMSUNG_WDT_RESET) += watchdog-reset.o
61
62obj-$(CONFIG_S5P_PM) += s5p-pm.o
63obj-$(CONFIG_S5P_IRQ_PM) += s5p-irq-pm.o
64obj-$(CONFIG_S5P_SLEEP) += s5p-sleep.o
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 79690f2f6d3f..468352633101 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -43,7 +43,7 @@ enum s3c_cpu_type {
43 TYPE_ADCV1, /* S3C24XX */ 43 TYPE_ADCV1, /* S3C24XX */
44 TYPE_ADCV11, /* S3C2443 */ 44 TYPE_ADCV11, /* S3C2443 */
45 TYPE_ADCV12, /* S3C2416, S3C2450 */ 45 TYPE_ADCV12, /* S3C2416, S3C2450 */
46 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ 46 TYPE_ADCV2, /* S3C64XX */
47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ 47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
48}; 48};
49 49
diff --git a/arch/arm/plat-samsung/clock-clksrc.c b/arch/arm/plat-samsung/clock-clksrc.c
deleted file mode 100644
index 786a4107a157..000000000000
--- a/arch/arm/plat-samsung/clock-clksrc.c
+++ /dev/null
@@ -1,212 +0,0 @@
1/* linux/arch/arm/plat-samsung/clock-clksrc.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/device.h>
20#include <linux/io.h>
21
22#include <plat/clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/cpu-freq.h>
25
26static inline struct clksrc_clk *to_clksrc(struct clk *clk)
27{
28 return container_of(clk, struct clksrc_clk, clk);
29}
30
31static inline u32 bit_mask(u32 shift, u32 nr_bits)
32{
33 u32 mask = 0xffffffff >> (32 - nr_bits);
34
35 return mask << shift;
36}
37
38static unsigned long s3c_getrate_clksrc(struct clk *clk)
39{
40 struct clksrc_clk *sclk = to_clksrc(clk);
41 unsigned long rate = clk_get_rate(clk->parent);
42 u32 clkdiv = __raw_readl(sclk->reg_div.reg);
43 u32 mask = bit_mask(sclk->reg_div.shift, sclk->reg_div.size);
44
45 clkdiv &= mask;
46 clkdiv >>= sclk->reg_div.shift;
47 clkdiv++;
48
49 rate /= clkdiv;
50 return rate;
51}
52
53static int s3c_setrate_clksrc(struct clk *clk, unsigned long rate)
54{
55 struct clksrc_clk *sclk = to_clksrc(clk);
56 void __iomem *reg = sclk->reg_div.reg;
57 unsigned int div;
58 u32 mask = bit_mask(sclk->reg_div.shift, sclk->reg_div.size);
59 u32 val;
60
61 rate = clk_round_rate(clk, rate);
62 div = clk_get_rate(clk->parent) / rate;
63 if (div > (1 << sclk->reg_div.size))
64 return -EINVAL;
65
66 val = __raw_readl(reg);
67 val &= ~mask;
68 val |= (div - 1) << sclk->reg_div.shift;
69 __raw_writel(val, reg);
70
71 return 0;
72}
73
74static int s3c_setparent_clksrc(struct clk *clk, struct clk *parent)
75{
76 struct clksrc_clk *sclk = to_clksrc(clk);
77 struct clksrc_sources *srcs = sclk->sources;
78 u32 clksrc = __raw_readl(sclk->reg_src.reg);
79 u32 mask = bit_mask(sclk->reg_src.shift, sclk->reg_src.size);
80 int src_nr = -1;
81 int ptr;
82
83 for (ptr = 0; ptr < srcs->nr_sources; ptr++)
84 if (srcs->sources[ptr] == parent) {
85 src_nr = ptr;
86 break;
87 }
88
89 if (src_nr >= 0) {
90 clk->parent = parent;
91
92 clksrc &= ~mask;
93 clksrc |= src_nr << sclk->reg_src.shift;
94
95 __raw_writel(clksrc, sclk->reg_src.reg);
96 return 0;
97 }
98
99 return -EINVAL;
100}
101
102static unsigned long s3c_roundrate_clksrc(struct clk *clk,
103 unsigned long rate)
104{
105 struct clksrc_clk *sclk = to_clksrc(clk);
106 unsigned long parent_rate = clk_get_rate(clk->parent);
107 int max_div = 1 << sclk->reg_div.size;
108 int div;
109
110 if (rate >= parent_rate)
111 rate = parent_rate;
112 else {
113 div = parent_rate / rate;
114 if (parent_rate % rate)
115 div++;
116
117 if (div == 0)
118 div = 1;
119 if (div > max_div)
120 div = max_div;
121
122 rate = parent_rate / div;
123 }
124
125 return rate;
126}
127
128/* Clock initialisation code */
129
130void __init_or_cpufreq s3c_set_clksrc(struct clksrc_clk *clk, bool announce)
131{
132 struct clksrc_sources *srcs = clk->sources;
133 u32 mask = bit_mask(clk->reg_src.shift, clk->reg_src.size);
134 u32 clksrc;
135
136 if (!clk->reg_src.reg) {
137 if (!clk->clk.parent)
138 printk(KERN_ERR "%s: no parent clock specified\n",
139 clk->clk.name);
140 return;
141 }
142
143 clksrc = __raw_readl(clk->reg_src.reg);
144 clksrc &= mask;
145 clksrc >>= clk->reg_src.shift;
146
147 if (clksrc > srcs->nr_sources || !srcs->sources[clksrc]) {
148 printk(KERN_ERR "%s: bad source %d\n",
149 clk->clk.name, clksrc);
150 return;
151 }
152
153 clk->clk.parent = srcs->sources[clksrc];
154
155 if (announce)
156 printk(KERN_INFO "%s: source is %s (%d), rate is %ld\n",
157 clk->clk.name, clk->clk.parent->name, clksrc,
158 clk_get_rate(&clk->clk));
159}
160
161static struct clk_ops clksrc_ops = {
162 .set_parent = s3c_setparent_clksrc,
163 .get_rate = s3c_getrate_clksrc,
164 .set_rate = s3c_setrate_clksrc,
165 .round_rate = s3c_roundrate_clksrc,
166};
167
168static struct clk_ops clksrc_ops_nodiv = {
169 .set_parent = s3c_setparent_clksrc,
170};
171
172static struct clk_ops clksrc_ops_nosrc = {
173 .get_rate = s3c_getrate_clksrc,
174 .set_rate = s3c_setrate_clksrc,
175 .round_rate = s3c_roundrate_clksrc,
176};
177
178void __init s3c_register_clksrc(struct clksrc_clk *clksrc, int size)
179{
180 int ret;
181
182 for (; size > 0; size--, clksrc++) {
183 if (!clksrc->reg_div.reg && !clksrc->reg_src.reg)
184 printk(KERN_ERR "%s: clock %s has no registers set\n",
185 __func__, clksrc->clk.name);
186
187 /* fill in the default functions */
188
189 if (!clksrc->clk.ops) {
190 if (!clksrc->reg_div.reg)
191 clksrc->clk.ops = &clksrc_ops_nodiv;
192 else if (!clksrc->reg_src.reg)
193 clksrc->clk.ops = &clksrc_ops_nosrc;
194 else
195 clksrc->clk.ops = &clksrc_ops;
196 }
197
198 /* setup the clocksource, but do not announce it
199 * as it may be re-set by the setup routines
200 * called after the rest of the clocks have been
201 * registered
202 */
203 s3c_set_clksrc(clksrc, false);
204
205 ret = s3c24xx_register_clock(&clksrc->clk);
206
207 if (ret < 0) {
208 printk(KERN_ERR "%s: failed to register %s (%d)\n",
209 __func__, clksrc->clk.name, ret);
210 }
211 }
212}
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
deleted file mode 100644
index d103ac1a52af..000000000000
--- a/arch/arm/plat-samsung/clock.c
+++ /dev/null
@@ -1,539 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/clock.c
2 *
3 * Copyright 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX Core clock control support
7 *
8 * Based on, and code from linux/arch/arm/mach-versatile/clock.c
9 **
10 ** Copyright (C) 2004 ARM Limited.
11 ** Written by Deep Blue Solutions Limited.
12 *
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 as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/
28
29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/list.h>
33#include <linux/errno.h>
34#include <linux/err.h>
35#include <linux/platform_device.h>
36#include <linux/device.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/clk.h>
40#include <linux/spinlock.h>
41#include <linux/io.h>
42#if defined(CONFIG_DEBUG_FS)
43#include <linux/debugfs.h>
44#endif
45
46#include <asm/irq.h>
47
48#include <plat/cpu-freq.h>
49
50#include <plat/clock.h>
51#include <plat/cpu.h>
52
53#include <linux/serial_core.h>
54#include <linux/serial_s3c.h> /* for s3c24xx_uart_devs */
55
56/* clock information */
57
58static LIST_HEAD(clocks);
59
60/* We originally used an mutex here, but some contexts (see resume)
61 * are calling functions such as clk_set_parent() with IRQs disabled
62 * causing an BUG to be triggered.
63 */
64DEFINE_SPINLOCK(clocks_lock);
65
66/* Global watchdog clock used by arch_wtd_reset() callback */
67struct clk *s3c2410_wdtclk;
68static int __init s3c_wdt_reset_init(void)
69{
70 s3c2410_wdtclk = clk_get(NULL, "watchdog");
71 if (IS_ERR(s3c2410_wdtclk))
72 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
73 return 0;
74}
75arch_initcall(s3c_wdt_reset_init);
76
77/* enable and disable calls for use with the clk struct */
78
79static int clk_null_enable(struct clk *clk, int enable)
80{
81 return 0;
82}
83
84int clk_enable(struct clk *clk)
85{
86 unsigned long flags;
87
88 if (IS_ERR(clk) || clk == NULL)
89 return -EINVAL;
90
91 clk_enable(clk->parent);
92
93 spin_lock_irqsave(&clocks_lock, flags);
94
95 if ((clk->usage++) == 0)
96 (clk->enable)(clk, 1);
97
98 spin_unlock_irqrestore(&clocks_lock, flags);
99 return 0;
100}
101
102void clk_disable(struct clk *clk)
103{
104 unsigned long flags;
105
106 if (IS_ERR(clk) || clk == NULL)
107 return;
108
109 spin_lock_irqsave(&clocks_lock, flags);
110
111 if ((--clk->usage) == 0)
112 (clk->enable)(clk, 0);
113
114 spin_unlock_irqrestore(&clocks_lock, flags);
115 clk_disable(clk->parent);
116}
117
118
119unsigned long clk_get_rate(struct clk *clk)
120{
121 if (IS_ERR_OR_NULL(clk))
122 return 0;
123
124 if (clk->rate != 0)
125 return clk->rate;
126
127 if (clk->ops != NULL && clk->ops->get_rate != NULL)
128 return (clk->ops->get_rate)(clk);
129
130 if (clk->parent != NULL)
131 return clk_get_rate(clk->parent);
132
133 return clk->rate;
134}
135
136long clk_round_rate(struct clk *clk, unsigned long rate)
137{
138 if (!IS_ERR_OR_NULL(clk) && clk->ops && clk->ops->round_rate)
139 return (clk->ops->round_rate)(clk, rate);
140
141 return rate;
142}
143
144int clk_set_rate(struct clk *clk, unsigned long rate)
145{
146 unsigned long flags;
147 int ret;
148
149 if (IS_ERR_OR_NULL(clk))
150 return -EINVAL;
151
152 /* We do not default just do a clk->rate = rate as
153 * the clock may have been made this way by choice.
154 */
155
156 WARN_ON(clk->ops == NULL);
157 WARN_ON(clk->ops && clk->ops->set_rate == NULL);
158
159 if (clk->ops == NULL || clk->ops->set_rate == NULL)
160 return -EINVAL;
161
162 spin_lock_irqsave(&clocks_lock, flags);
163 ret = (clk->ops->set_rate)(clk, rate);
164 spin_unlock_irqrestore(&clocks_lock, flags);
165
166 return ret;
167}
168
169struct clk *clk_get_parent(struct clk *clk)
170{
171 return clk->parent;
172}
173
174int clk_set_parent(struct clk *clk, struct clk *parent)
175{
176 unsigned long flags;
177 int ret = 0;
178
179 if (IS_ERR_OR_NULL(clk) || IS_ERR_OR_NULL(parent))
180 return -EINVAL;
181
182 spin_lock_irqsave(&clocks_lock, flags);
183
184 if (clk->ops && clk->ops->set_parent)
185 ret = (clk->ops->set_parent)(clk, parent);
186
187 spin_unlock_irqrestore(&clocks_lock, flags);
188
189 return ret;
190}
191
192EXPORT_SYMBOL(clk_enable);
193EXPORT_SYMBOL(clk_disable);
194EXPORT_SYMBOL(clk_get_rate);
195EXPORT_SYMBOL(clk_round_rate);
196EXPORT_SYMBOL(clk_set_rate);
197EXPORT_SYMBOL(clk_get_parent);
198EXPORT_SYMBOL(clk_set_parent);
199
200/* base clocks */
201
202int clk_default_setrate(struct clk *clk, unsigned long rate)
203{
204 clk->rate = rate;
205 return 0;
206}
207
208struct clk_ops clk_ops_def_setrate = {
209 .set_rate = clk_default_setrate,
210};
211
212struct clk clk_xtal = {
213 .name = "xtal",
214 .rate = 0,
215 .parent = NULL,
216 .ctrlbit = 0,
217};
218
219struct clk clk_ext = {
220 .name = "ext",
221};
222
223struct clk clk_epll = {
224 .name = "epll",
225};
226
227struct clk clk_mpll = {
228 .name = "mpll",
229 .ops = &clk_ops_def_setrate,
230};
231
232struct clk clk_upll = {
233 .name = "upll",
234 .parent = NULL,
235 .ctrlbit = 0,
236};
237
238struct clk clk_f = {
239 .name = "fclk",
240 .rate = 0,
241 .parent = &clk_mpll,
242 .ctrlbit = 0,
243};
244
245struct clk clk_h = {
246 .name = "hclk",
247 .rate = 0,
248 .parent = NULL,
249 .ctrlbit = 0,
250 .ops = &clk_ops_def_setrate,
251};
252
253struct clk clk_p = {
254 .name = "pclk",
255 .rate = 0,
256 .parent = NULL,
257 .ctrlbit = 0,
258 .ops = &clk_ops_def_setrate,
259};
260
261struct clk clk_usb_bus = {
262 .name = "usb-bus",
263 .rate = 0,
264 .parent = &clk_upll,
265};
266
267
268struct clk s3c24xx_uclk = {
269 .name = "uclk",
270};
271
272/* initialise the clock system */
273
274/**
275 * s3c24xx_register_clock() - register a clock
276 * @clk: The clock to register
277 *
278 * Add the specified clock to the list of clocks known by the system.
279 */
280int s3c24xx_register_clock(struct clk *clk)
281{
282 if (clk->enable == NULL)
283 clk->enable = clk_null_enable;
284
285 /* fill up the clk_lookup structure and register it*/
286 clk->lookup.dev_id = clk->devname;
287 clk->lookup.con_id = clk->name;
288 clk->lookup.clk = clk;
289 clkdev_add(&clk->lookup);
290
291 return 0;
292}
293
294/**
295 * s3c24xx_register_clocks() - register an array of clock pointers
296 * @clks: Pointer to an array of struct clk pointers
297 * @nr_clks: The number of clocks in the @clks array.
298 *
299 * Call s3c24xx_register_clock() for all the clock pointers contained
300 * in the @clks list. Returns the number of failures.
301 */
302int s3c24xx_register_clocks(struct clk **clks, int nr_clks)
303{
304 int fails = 0;
305
306 for (; nr_clks > 0; nr_clks--, clks++) {
307 if (s3c24xx_register_clock(*clks) < 0) {
308 struct clk *clk = *clks;
309 printk(KERN_ERR "%s: failed to register %p: %s\n",
310 __func__, clk, clk->name);
311 fails++;
312 }
313 }
314
315 return fails;
316}
317
318/**
319 * s3c_register_clocks() - register an array of clocks
320 * @clkp: Pointer to the first clock in the array.
321 * @nr_clks: Number of clocks to register.
322 *
323 * Call s3c24xx_register_clock() on the @clkp array given, printing an
324 * error if it fails to register the clock (unlikely).
325 */
326void __init s3c_register_clocks(struct clk *clkp, int nr_clks)
327{
328 int ret;
329
330 for (; nr_clks > 0; nr_clks--, clkp++) {
331 ret = s3c24xx_register_clock(clkp);
332
333 if (ret < 0) {
334 printk(KERN_ERR "Failed to register clock %s (%d)\n",
335 clkp->name, ret);
336 }
337 }
338}
339
340/**
341 * s3c_disable_clocks() - disable an array of clocks
342 * @clkp: Pointer to the first clock in the array.
343 * @nr_clks: Number of clocks to register.
344 *
345 * for internal use only at initialisation time. disable the clocks in the
346 * @clkp array.
347 */
348
349void __init s3c_disable_clocks(struct clk *clkp, int nr_clks)
350{
351 for (; nr_clks > 0; nr_clks--, clkp++)
352 (clkp->enable)(clkp, 0);
353}
354
355/* initialise all the clocks */
356
357int __init s3c24xx_register_baseclocks(unsigned long xtal)
358{
359 printk(KERN_INFO "S3C24XX Clocks, Copyright 2004 Simtec Electronics\n");
360
361 clk_xtal.rate = xtal;
362
363 /* register our clocks */
364
365 if (s3c24xx_register_clock(&clk_xtal) < 0)
366 printk(KERN_ERR "failed to register master xtal\n");
367
368 if (s3c24xx_register_clock(&clk_mpll) < 0)
369 printk(KERN_ERR "failed to register mpll clock\n");
370
371 if (s3c24xx_register_clock(&clk_upll) < 0)
372 printk(KERN_ERR "failed to register upll clock\n");
373
374 if (s3c24xx_register_clock(&clk_f) < 0)
375 printk(KERN_ERR "failed to register cpu fclk\n");
376
377 if (s3c24xx_register_clock(&clk_h) < 0)
378 printk(KERN_ERR "failed to register cpu hclk\n");
379
380 if (s3c24xx_register_clock(&clk_p) < 0)
381 printk(KERN_ERR "failed to register cpu pclk\n");
382
383 return 0;
384}
385
386#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
387/* debugfs support to trace clock tree hierarchy and attributes */
388
389static struct dentry *clk_debugfs_root;
390
391static void clock_tree_show_one(struct seq_file *s, struct clk *c, int level)
392{
393 struct clk *child;
394 const char *state;
395 char buf[255] = { 0 };
396 int n = 0;
397
398 if (c->name)
399 n = snprintf(buf, sizeof(buf) - 1, "%s", c->name);
400
401 if (c->devname)
402 n += snprintf(buf + n, sizeof(buf) - 1 - n, ":%s", c->devname);
403
404 state = (c->usage > 0) ? "on" : "off";
405
406 seq_printf(s, "%*s%-*s %-6s %-3d %-10lu\n",
407 level * 3 + 1, "",
408 50 - level * 3, buf,
409 state, c->usage, clk_get_rate(c));
410
411 list_for_each_entry(child, &clocks, list) {
412 if (child->parent != c)
413 continue;
414
415 clock_tree_show_one(s, child, level + 1);
416 }
417}
418
419static int clock_tree_show(struct seq_file *s, void *data)
420{
421 struct clk *c;
422 unsigned long flags;
423
424 seq_printf(s, " clock state ref rate\n");
425 seq_printf(s, "----------------------------------------------------\n");
426
427 spin_lock_irqsave(&clocks_lock, flags);
428
429 list_for_each_entry(c, &clocks, list)
430 if (c->parent == NULL)
431 clock_tree_show_one(s, c, 0);
432
433 spin_unlock_irqrestore(&clocks_lock, flags);
434 return 0;
435}
436
437static int clock_tree_open(struct inode *inode, struct file *file)
438{
439 return single_open(file, clock_tree_show, inode->i_private);
440}
441
442static const struct file_operations clock_tree_fops = {
443 .open = clock_tree_open,
444 .read = seq_read,
445 .llseek = seq_lseek,
446 .release = single_release,
447};
448
449static int clock_rate_show(void *data, u64 *val)
450{
451 struct clk *c = data;
452 *val = clk_get_rate(c);
453 return 0;
454}
455DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_rate_show, NULL, "%llu\n");
456
457static int clk_debugfs_register_one(struct clk *c)
458{
459 int err;
460 struct dentry *d;
461 struct clk *pa = c->parent;
462 char s[255];
463 char *p = s;
464
465 p += sprintf(p, "%s", c->devname);
466
467 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
468 if (!d)
469 return -ENOMEM;
470
471 c->dent = d;
472
473 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usage);
474 if (!d) {
475 err = -ENOMEM;
476 goto err_out;
477 }
478
479 d = debugfs_create_file("rate", S_IRUGO, c->dent, c, &clock_rate_fops);
480 if (!d) {
481 err = -ENOMEM;
482 goto err_out;
483 }
484 return 0;
485
486err_out:
487 debugfs_remove_recursive(c->dent);
488 return err;
489}
490
491static int clk_debugfs_register(struct clk *c)
492{
493 int err;
494 struct clk *pa = c->parent;
495
496 if (pa && !pa->dent) {
497 err = clk_debugfs_register(pa);
498 if (err)
499 return err;
500 }
501
502 if (!c->dent) {
503 err = clk_debugfs_register_one(c);
504 if (err)
505 return err;
506 }
507 return 0;
508}
509
510static int __init clk_debugfs_init(void)
511{
512 struct clk *c;
513 struct dentry *d;
514 int err = -ENOMEM;
515
516 d = debugfs_create_dir("clock", NULL);
517 if (!d)
518 return -ENOMEM;
519 clk_debugfs_root = d;
520
521 d = debugfs_create_file("clock_tree", S_IRUGO, clk_debugfs_root, NULL,
522 &clock_tree_fops);
523 if (!d)
524 goto err_out;
525
526 list_for_each_entry(c, &clocks, list) {
527 err = clk_debugfs_register(c);
528 if (err)
529 goto err_out;
530 }
531 return 0;
532
533err_out:
534 debugfs_remove_recursive(clk_debugfs_root);
535 return err;
536}
537late_initcall(clk_debugfs_init);
538
539#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c
index 364963a0a344..360618ee39e5 100644
--- a/arch/arm/plat-samsung/cpu.c
+++ b/arch/arm/plat-samsung/cpu.c
@@ -15,8 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18 18#include <plat/map-base.h>
19#include <mach/map.h>
20#include <plat/cpu.h> 19#include <plat/cpu.h>
21 20
22unsigned long samsung_cpu_id; 21unsigned long samsung_cpu_id;
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index ead4f1c94058..83c7d154bde0 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -53,7 +53,6 @@
53#include <linux/platform_data/ata-samsung_cf.h> 53#include <linux/platform_data/ata-samsung_cf.h>
54#include <plat/fb.h> 54#include <plat/fb.h>
55#include <plat/fb-s3c2410.h> 55#include <plat/fb-s3c2410.h>
56#include <plat/hdmi.h>
57#include <linux/platform_data/hwmon-s3c.h> 56#include <linux/platform_data/hwmon-s3c.h>
58#include <linux/platform_data/i2c-s3c2410.h> 57#include <linux/platform_data/i2c-s3c2410.h>
59#include <plat/keypad.h> 58#include <plat/keypad.h>
@@ -145,23 +144,6 @@ struct platform_device s3c_device_camif = {
145}; 144};
146#endif /* CONFIG_CPU_S3C2440 */ 145#endif /* CONFIG_CPU_S3C2440 */
147 146
148/* ASOC DMA */
149
150#ifdef CONFIG_PLAT_S5P
151static struct resource samsung_asoc_idma_resource = DEFINE_RES_IRQ(IRQ_I2S0);
152
153struct platform_device samsung_asoc_idma = {
154 .name = "samsung-idma",
155 .id = -1,
156 .num_resources = 1,
157 .resource = &samsung_asoc_idma_resource,
158 .dev = {
159 .dma_mask = &samsung_device_dma_mask,
160 .coherent_dma_mask = DMA_BIT_MASK(32),
161 }
162};
163#endif
164
165/* FB */ 147/* FB */
166 148
167#ifdef CONFIG_S3C_DEV_FB 149#ifdef CONFIG_S3C_DEV_FB
@@ -190,151 +172,6 @@ void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
190} 172}
191#endif /* CONFIG_S3C_DEV_FB */ 173#endif /* CONFIG_S3C_DEV_FB */
192 174
193/* FIMC */
194
195#ifdef CONFIG_S5P_DEV_FIMC0
196static struct resource s5p_fimc0_resource[] = {
197 [0] = DEFINE_RES_MEM(S5P_PA_FIMC0, SZ_4K),
198 [1] = DEFINE_RES_IRQ(IRQ_FIMC0),
199};
200
201struct platform_device s5p_device_fimc0 = {
202 .name = "s5p-fimc",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(s5p_fimc0_resource),
205 .resource = s5p_fimc0_resource,
206 .dev = {
207 .dma_mask = &samsung_device_dma_mask,
208 .coherent_dma_mask = DMA_BIT_MASK(32),
209 },
210};
211
212struct platform_device s5p_device_fimc_md = {
213 .name = "s5p-fimc-md",
214 .id = -1,
215};
216#endif /* CONFIG_S5P_DEV_FIMC0 */
217
218#ifdef CONFIG_S5P_DEV_FIMC1
219static struct resource s5p_fimc1_resource[] = {
220 [0] = DEFINE_RES_MEM(S5P_PA_FIMC1, SZ_4K),
221 [1] = DEFINE_RES_IRQ(IRQ_FIMC1),
222};
223
224struct platform_device s5p_device_fimc1 = {
225 .name = "s5p-fimc",
226 .id = 1,
227 .num_resources = ARRAY_SIZE(s5p_fimc1_resource),
228 .resource = s5p_fimc1_resource,
229 .dev = {
230 .dma_mask = &samsung_device_dma_mask,
231 .coherent_dma_mask = DMA_BIT_MASK(32),
232 },
233};
234#endif /* CONFIG_S5P_DEV_FIMC1 */
235
236#ifdef CONFIG_S5P_DEV_FIMC2
237static struct resource s5p_fimc2_resource[] = {
238 [0] = DEFINE_RES_MEM(S5P_PA_FIMC2, SZ_4K),
239 [1] = DEFINE_RES_IRQ(IRQ_FIMC2),
240};
241
242struct platform_device s5p_device_fimc2 = {
243 .name = "s5p-fimc",
244 .id = 2,
245 .num_resources = ARRAY_SIZE(s5p_fimc2_resource),
246 .resource = s5p_fimc2_resource,
247 .dev = {
248 .dma_mask = &samsung_device_dma_mask,
249 .coherent_dma_mask = DMA_BIT_MASK(32),
250 },
251};
252#endif /* CONFIG_S5P_DEV_FIMC2 */
253
254#ifdef CONFIG_S5P_DEV_FIMC3
255static struct resource s5p_fimc3_resource[] = {
256 [0] = DEFINE_RES_MEM(S5P_PA_FIMC3, SZ_4K),
257 [1] = DEFINE_RES_IRQ(IRQ_FIMC3),
258};
259
260struct platform_device s5p_device_fimc3 = {
261 .name = "s5p-fimc",
262 .id = 3,
263 .num_resources = ARRAY_SIZE(s5p_fimc3_resource),
264 .resource = s5p_fimc3_resource,
265 .dev = {
266 .dma_mask = &samsung_device_dma_mask,
267 .coherent_dma_mask = DMA_BIT_MASK(32),
268 },
269};
270#endif /* CONFIG_S5P_DEV_FIMC3 */
271
272/* G2D */
273
274#ifdef CONFIG_S5P_DEV_G2D
275static struct resource s5p_g2d_resource[] = {
276 [0] = DEFINE_RES_MEM(S5P_PA_G2D, SZ_4K),
277 [1] = DEFINE_RES_IRQ(IRQ_2D),
278};
279
280struct platform_device s5p_device_g2d = {
281 .name = "s5p-g2d",
282 .id = 0,
283 .num_resources = ARRAY_SIZE(s5p_g2d_resource),
284 .resource = s5p_g2d_resource,
285 .dev = {
286 .dma_mask = &samsung_device_dma_mask,
287 .coherent_dma_mask = DMA_BIT_MASK(32),
288 },
289};
290#endif /* CONFIG_S5P_DEV_G2D */
291
292#ifdef CONFIG_S5P_DEV_JPEG
293static struct resource s5p_jpeg_resource[] = {
294 [0] = DEFINE_RES_MEM(S5P_PA_JPEG, SZ_4K),
295 [1] = DEFINE_RES_IRQ(IRQ_JPEG),
296};
297
298struct platform_device s5p_device_jpeg = {
299 .name = "s5p-jpeg",
300 .id = 0,
301 .num_resources = ARRAY_SIZE(s5p_jpeg_resource),
302 .resource = s5p_jpeg_resource,
303 .dev = {
304 .dma_mask = &samsung_device_dma_mask,
305 .coherent_dma_mask = DMA_BIT_MASK(32),
306 },
307};
308#endif /* CONFIG_S5P_DEV_JPEG */
309
310/* FIMD0 */
311
312#ifdef CONFIG_S5P_DEV_FIMD0
313static struct resource s5p_fimd0_resource[] = {
314 [0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K),
315 [1] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_VSYNC, "vsync"),
316 [2] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_FIFO, "fifo"),
317 [3] = DEFINE_RES_IRQ_NAMED(IRQ_FIMD0_SYSTEM, "lcd_sys"),
318};
319
320struct platform_device s5p_device_fimd0 = {
321 .name = "s5p-fb",
322 .id = 0,
323 .num_resources = ARRAY_SIZE(s5p_fimd0_resource),
324 .resource = s5p_fimd0_resource,
325 .dev = {
326 .dma_mask = &samsung_device_dma_mask,
327 .coherent_dma_mask = DMA_BIT_MASK(32),
328 },
329};
330
331void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd)
332{
333 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
334 &s5p_device_fimd0);
335}
336#endif /* CONFIG_S5P_DEV_FIMD0 */
337
338/* HWMON */ 175/* HWMON */
339 176
340#ifdef CONFIG_S3C_DEV_HWMON 177#ifdef CONFIG_S3C_DEV_HWMON
@@ -722,60 +559,6 @@ void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
722} 559}
723#endif /* CONFIG_S3C_DEV_I2C7 */ 560#endif /* CONFIG_S3C_DEV_I2C7 */
724 561
725/* I2C HDMIPHY */
726
727#ifdef CONFIG_S5P_DEV_I2C_HDMIPHY
728static struct resource s5p_i2c_resource[] = {
729 [0] = DEFINE_RES_MEM(S5P_PA_IIC_HDMIPHY, SZ_4K),
730 [1] = DEFINE_RES_IRQ(IRQ_IIC_HDMIPHY),
731};
732
733struct platform_device s5p_device_i2c_hdmiphy = {
734 .name = "s3c2440-hdmiphy-i2c",
735 .id = -1,
736 .num_resources = ARRAY_SIZE(s5p_i2c_resource),
737 .resource = s5p_i2c_resource,
738};
739
740void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd)
741{
742 struct s3c2410_platform_i2c *npd;
743
744 if (!pd) {
745 pd = &default_i2c_data;
746
747 if (soc_is_s5pv210())
748 pd->bus_num = 3;
749 else
750 pd->bus_num = 0;
751 }
752
753 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
754 &s5p_device_i2c_hdmiphy);
755}
756
757static struct s5p_hdmi_platform_data s5p_hdmi_def_platdata;
758
759void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,
760 struct i2c_board_info *mhl_info, int mhl_bus)
761{
762 struct s5p_hdmi_platform_data *pd = &s5p_hdmi_def_platdata;
763
764 if (soc_is_s5pv210())
765 pd->hdmiphy_bus = 3;
766 else
767 pd->hdmiphy_bus = 0;
768
769 pd->hdmiphy_info = hdmiphy_info;
770 pd->mhl_info = mhl_info;
771 pd->mhl_bus = mhl_bus;
772
773 s3c_set_platdata(pd, sizeof(struct s5p_hdmi_platform_data),
774 &s5p_device_hdmi);
775}
776
777#endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */
778
779/* I2S */ 562/* I2S */
780 563
781#ifdef CONFIG_PLAT_S3C24XX 564#ifdef CONFIG_PLAT_S3C24XX
@@ -879,36 +662,6 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
879} 662}
880#endif /* CONFIG_PLAT_S3C24XX */ 663#endif /* CONFIG_PLAT_S3C24XX */
881 664
882/* MIPI CSIS */
883
884#ifdef CONFIG_S5P_DEV_CSIS0
885static struct resource s5p_mipi_csis0_resource[] = {
886 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_16K),
887 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0),
888};
889
890struct platform_device s5p_device_mipi_csis0 = {
891 .name = "s5p-mipi-csis",
892 .id = 0,
893 .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource),
894 .resource = s5p_mipi_csis0_resource,
895};
896#endif /* CONFIG_S5P_DEV_CSIS0 */
897
898#ifdef CONFIG_S5P_DEV_CSIS1
899static struct resource s5p_mipi_csis1_resource[] = {
900 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_16K),
901 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1),
902};
903
904struct platform_device s5p_device_mipi_csis1 = {
905 .name = "s5p-mipi-csis",
906 .id = 1,
907 .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource),
908 .resource = s5p_mipi_csis1_resource,
909};
910#endif
911
912/* NAND */ 665/* NAND */
913 666
914#ifdef CONFIG_S3C_DEV_NAND 667#ifdef CONFIG_S3C_DEV_NAND
@@ -1052,43 +805,6 @@ void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
1052} 805}
1053#endif /* CONFIG_S3C64XX_DEV_ONENAND1 */ 806#endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
1054 807
1055#ifdef CONFIG_S5P_DEV_ONENAND
1056static struct resource s5p_onenand_resources[] = {
1057 [0] = DEFINE_RES_MEM(S5P_PA_ONENAND, SZ_128K),
1058 [1] = DEFINE_RES_MEM(S5P_PA_ONENAND_DMA, SZ_8K),
1059 [2] = DEFINE_RES_IRQ(IRQ_ONENAND_AUDI),
1060};
1061
1062struct platform_device s5p_device_onenand = {
1063 .name = "s5pc110-onenand",
1064 .id = -1,
1065 .num_resources = ARRAY_SIZE(s5p_onenand_resources),
1066 .resource = s5p_onenand_resources,
1067};
1068#endif /* CONFIG_S5P_DEV_ONENAND */
1069
1070/* PMU */
1071
1072#if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS)
1073static struct resource s5p_pmu_resource[] = {
1074 DEFINE_RES_IRQ(IRQ_PMU)
1075};
1076
1077static struct platform_device s5p_device_pmu = {
1078 .name = "arm-pmu",
1079 .id = -1,
1080 .num_resources = ARRAY_SIZE(s5p_pmu_resource),
1081 .resource = s5p_pmu_resource,
1082};
1083
1084static int __init s5p_pmu_init(void)
1085{
1086 platform_device_register(&s5p_device_pmu);
1087 return 0;
1088}
1089arch_initcall(s5p_pmu_init);
1090#endif /* CONFIG_PLAT_S5P */
1091
1092/* PWM Timer */ 808/* PWM Timer */
1093 809
1094#ifdef CONFIG_SAMSUNG_DEV_PWM 810#ifdef CONFIG_SAMSUNG_DEV_PWM
@@ -1251,52 +967,6 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
1251} 967}
1252#endif /* CONFIG_SAMSUNG_DEV_TS */ 968#endif /* CONFIG_SAMSUNG_DEV_TS */
1253 969
1254/* TV */
1255
1256#ifdef CONFIG_S5P_DEV_TV
1257
1258static struct resource s5p_hdmi_resources[] = {
1259 [0] = DEFINE_RES_MEM(S5P_PA_HDMI, SZ_1M),
1260 [1] = DEFINE_RES_IRQ(IRQ_HDMI),
1261};
1262
1263struct platform_device s5p_device_hdmi = {
1264 .name = "s5p-hdmi",
1265 .id = -1,
1266 .num_resources = ARRAY_SIZE(s5p_hdmi_resources),
1267 .resource = s5p_hdmi_resources,
1268};
1269
1270static struct resource s5p_sdo_resources[] = {
1271 [0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K),
1272 [1] = DEFINE_RES_IRQ(IRQ_SDO),
1273};
1274
1275struct platform_device s5p_device_sdo = {
1276 .name = "s5p-sdo",
1277 .id = -1,
1278 .num_resources = ARRAY_SIZE(s5p_sdo_resources),
1279 .resource = s5p_sdo_resources,
1280};
1281
1282static struct resource s5p_mixer_resources[] = {
1283 [0] = DEFINE_RES_MEM_NAMED(S5P_PA_MIXER, SZ_64K, "mxr"),
1284 [1] = DEFINE_RES_MEM_NAMED(S5P_PA_VP, SZ_64K, "vp"),
1285 [2] = DEFINE_RES_IRQ_NAMED(IRQ_MIXER, "irq"),
1286};
1287
1288struct platform_device s5p_device_mixer = {
1289 .name = "s5p-mixer",
1290 .id = -1,
1291 .num_resources = ARRAY_SIZE(s5p_mixer_resources),
1292 .resource = s5p_mixer_resources,
1293 .dev = {
1294 .dma_mask = &samsung_device_dma_mask,
1295 .coherent_dma_mask = DMA_BIT_MASK(32),
1296 }
1297};
1298#endif /* CONFIG_S5P_DEV_TV */
1299
1300/* USB */ 970/* USB */
1301 971
1302#ifdef CONFIG_S3C_DEV_USB_HOST 972#ifdef CONFIG_S3C_DEV_USB_HOST
diff --git a/arch/arm/plat-samsung/include/plat/camport.h b/arch/arm/plat-samsung/include/plat/camport.h
deleted file mode 100644
index a5708bf84b3a..000000000000
--- a/arch/arm/plat-samsung/include/plat/camport.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 *
4 * S5P series camera interface helper functions
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 __PLAT_SAMSUNG_CAMPORT_H_
12#define __PLAT_SAMSUNG_CAMPORT_H_ __FILE__
13
14enum s5p_camport_id {
15 S5P_CAMPORT_A,
16 S5P_CAMPORT_B,
17};
18
19/*
20 * The helper functions to configure GPIO for the camera parallel bus.
21 * The camera port can be multiplexed with any FIMC entity, even multiple
22 * FIMC entities are allowed to be attached to a single port simultaneously.
23 * These functions are to be used in the board setup code.
24 */
25int s5pv210_fimc_setup_gpio(enum s5p_camport_id id);
26int exynos4_fimc_setup_gpio(enum s5p_camport_id id);
27
28#endif /* __PLAT_SAMSUNG_CAMPORT_H */
diff --git a/arch/arm/plat-samsung/include/plat/clock-clksrc.h b/arch/arm/plat-samsung/include/plat/clock-clksrc.h
deleted file mode 100644
index 50a8ca7c3760..000000000000
--- a/arch/arm/plat-samsung/include/plat/clock-clksrc.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/clock-clksrc.h
2 *
3 * Parts taken from arch/arm/plat-s3c64xx/clock.c
4 * Copyright 2008 Openmoko, Inc.
5 * Copyright 2008 Simtec Electronics
6 * Ben Dooks <ben@simtec.co.uk>
7 * http://armlinux.simtec.co.uk/
8 *
9 * Copyright 2009 Ben Dooks <ben-linux@fluff.org>
10 * Copyright 2009 Harald Welte
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 version 2 as
14 * published by the Free Software Foundation.
15*/
16
17/**
18 * struct clksrc_sources - list of sources for a given clock
19 * @sources: array of pointers to clocks
20 * @nr_sources: The size of @sources
21 */
22struct clksrc_sources {
23 unsigned int nr_sources;
24 struct clk **sources;
25};
26
27/**
28 * struct clksrc_reg - register definition for clock control bits
29 * @reg: pointer to the register in virtual memory.
30 * @shift: the shift in bits to where the bitfield is.
31 * @size: the size in bits of the bitfield.
32 *
33 * This specifies the size and position of the bits we are interested
34 * in within the register specified by @reg.
35 */
36struct clksrc_reg {
37 void __iomem *reg;
38 unsigned short shift;
39 unsigned short size;
40};
41
42/**
43 * struct clksrc_clk - class of clock for newer style samsung devices.
44 * @clk: the standard clock representation
45 * @sources: the sources for this clock
46 * @reg_src: the register definition for selecting the clock's source
47 * @reg_div: the register definition for the clock's output divisor
48 *
49 * This clock implements the features required by the newer SoCs where
50 * the standard clock block provides an input mux and a post-mux divisor
51 * to provide the periperhal's clock.
52 *
53 * The array of @sources provides the mapping of mux position to the
54 * clock, and @reg_src shows the code where to modify to change the mux
55 * position. The @reg_div defines how to change the divider settings on
56 * the output.
57 */
58struct clksrc_clk {
59 struct clk clk;
60 struct clksrc_sources *sources;
61
62 struct clksrc_reg reg_src;
63 struct clksrc_reg reg_div;
64};
65
66/**
67 * s3c_set_clksrc() - setup the clock from the register settings
68 * @clk: The clock to setup.
69 * @announce: true to announce the setting to printk().
70 *
71 * Setup the clock from the current register settings, for when the
72 * kernel boots or if it is resuming from a possibly unknown state.
73 */
74extern void s3c_set_clksrc(struct clksrc_clk *clk, bool announce);
75
76/**
77 * s3c_register_clksrc() register clocks from an array of clksrc clocks
78 * @srcs: The array of clocks to register
79 * @size: The size of the @srcs array.
80 *
81 * Initialise and register the array of clocks described by @srcs.
82 */
83extern void s3c_register_clksrc(struct clksrc_clk *srcs, int size);
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
deleted file mode 100644
index 63239f409807..000000000000
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ /dev/null
@@ -1,152 +0,0 @@
1/* linux/arch/arm/plat-s3c/include/plat/clock.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Written by Ben Dooks, <ben@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_PLAT_CLOCK_H
13#define __ASM_PLAT_CLOCK_H __FILE__
14
15#include <linux/spinlock.h>
16#include <linux/clkdev.h>
17
18struct clk;
19
20/**
21 * struct clk_ops - standard clock operations
22 * @set_rate: set the clock rate, see clk_set_rate().
23 * @get_rate: get the clock rate, see clk_get_rate().
24 * @round_rate: round a given clock rate, see clk_round_rate().
25 * @set_parent: set the clock's parent, see clk_set_parent().
26 *
27 * Group the common clock implementations together so that we
28 * don't have to keep setting the same fields again. We leave
29 * enable in struct clk.
30 *
31 * Adding an extra layer of indirection into the process should
32 * not be a problem as it is unlikely these operations are going
33 * to need to be called quickly.
34 */
35struct clk_ops {
36 int (*set_rate)(struct clk *c, unsigned long rate);
37 unsigned long (*get_rate)(struct clk *c);
38 unsigned long (*round_rate)(struct clk *c, unsigned long rate);
39 int (*set_parent)(struct clk *c, struct clk *parent);
40};
41
42struct clk {
43 struct list_head list;
44 struct module *owner;
45 struct clk *parent;
46 const char *name;
47 const char *devname;
48 int id;
49 int usage;
50 unsigned long rate;
51 unsigned long ctrlbit;
52
53 struct clk_ops *ops;
54 int (*enable)(struct clk *, int enable);
55 struct clk_lookup lookup;
56#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
57 struct dentry *dent; /* For visible tree hierarchy */
58#endif
59};
60
61/* other clocks which may be registered by board support */
62
63extern struct clk s3c24xx_dclk0;
64extern struct clk s3c24xx_dclk1;
65extern struct clk s3c24xx_clkout0;
66extern struct clk s3c24xx_clkout1;
67extern struct clk s3c24xx_uclk;
68
69extern struct clk clk_usb_bus;
70
71/* core clock support */
72
73extern struct clk clk_f;
74extern struct clk clk_h;
75extern struct clk clk_p;
76extern struct clk clk_mpll;
77extern struct clk clk_upll;
78extern struct clk clk_epll;
79extern struct clk clk_xtal;
80extern struct clk clk_ext;
81
82/* S3C2443/S3C2416 specific clocks */
83extern struct clksrc_clk clk_epllref;
84extern struct clksrc_clk clk_esysclk;
85
86/* S3C24XX UART clocks */
87extern struct clk s3c24xx_clk_uart0;
88extern struct clk s3c24xx_clk_uart1;
89extern struct clk s3c24xx_clk_uart2;
90
91/* S3C64XX specific clocks */
92extern struct clk clk_h2;
93extern struct clk clk_27m;
94extern struct clk clk_48m;
95extern struct clk clk_xusbxti;
96
97extern int clk_default_setrate(struct clk *clk, unsigned long rate);
98extern struct clk_ops clk_ops_def_setrate;
99
100/* exports for arch/arm/mach-s3c2410
101 *
102 * Please DO NOT use these outside of arch/arm/mach-s3c2410
103*/
104
105extern spinlock_t clocks_lock;
106
107extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
108
109extern int s3c24xx_register_clock(struct clk *clk);
110extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
111
112extern void s3c_register_clocks(struct clk *clk, int nr_clks);
113extern void s3c_disable_clocks(struct clk *clkp, int nr_clks);
114
115extern int s3c24xx_register_baseclocks(unsigned long xtal);
116
117extern void s5p_register_clocks(unsigned long xtal_freq);
118
119extern void s3c24xx_setup_clocks(unsigned long fclk,
120 unsigned long hclk,
121 unsigned long pclk);
122
123extern void s3c2410_setup_clocks(void);
124extern void s3c2412_setup_clocks(void);
125extern void s3c244x_setup_clocks(void);
126
127/* S3C2410 specific clock functions */
128
129extern int s3c2410_baseclk_add(void);
130
131/* S3C2443/S3C2416 specific clock functions */
132
133typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
134
135extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
136extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
137 unsigned int *divs, int nr_divs,
138 int divmask);
139
140extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
141extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
142extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable);
143
144/* S3C64XX specific functions and clocks */
145
146extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
147
148/* Global watchdog clock used by arch_wtd_reset() callback */
149
150extern struct clk *s3c2410_wdtclk;
151
152#endif /* __ASM_PLAT_CLOCK_H */
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 72d4178ad23b..317c52303288 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -140,7 +140,6 @@ struct s3c_cpufreq_config {
140 * any frequency changes. This is really only need by devices like the 140 * any frequency changes. This is really only need by devices like the
141 * S3C2410 where there is no or limited divider between the PLL and the 141 * S3C2410 where there is no or limited divider between the PLL and the
142 * ARMCLK. 142 * ARMCLK.
143 * @resume_clocks: Update the clocks on resume.
144 * @get_iotiming: Get the current IO timing data, mainly for use at start. 143 * @get_iotiming: Get the current IO timing data, mainly for use at start.
145 * @set_iotiming: Update the IO timings from the cached copies calculated 144 * @set_iotiming: Update the IO timings from the cached copies calculated
146 * from the @calc_iotiming entry when changing the frequency. 145 * from the @calc_iotiming entry when changing the frequency.
@@ -169,8 +168,6 @@ struct s3c_cpufreq_info {
169 168
170 /* driver routines */ 169 /* driver routines */
171 170
172 void (*resume_clocks)(void);
173
174 int (*get_iotiming)(struct s3c_cpufreq_config *cfg, 171 int (*get_iotiming)(struct s3c_cpufreq_config *cfg,
175 struct s3c_iotimings *timings); 172 struct s3c_iotimings *timings);
176 173
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 5a237db9f9eb..61d14f3a0426 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -33,13 +33,6 @@ extern unsigned long samsung_cpu_id;
33#define S3C6410_CPU_ID 0x36410000 33#define S3C6410_CPU_ID 0x36410000
34#define S3C64XX_CPU_MASK 0xFFFFF000 34#define S3C64XX_CPU_MASK 0xFFFFF000
35 35
36#define S5P6440_CPU_ID 0x56440000
37#define S5P6450_CPU_ID 0x36450000
38#define S5P64XX_CPU_MASK 0xFFFFF000
39
40#define S5PC100_CPU_ID 0x43100000
41#define S5PC100_CPU_MASK 0xFFFFF000
42
43#define S5PV210_CPU_ID 0x43110000 36#define S5PV210_CPU_ID 0x43110000
44#define S5PV210_CPU_MASK 0xFFFFF000 37#define S5PV210_CPU_MASK 0xFFFFF000
45 38
@@ -54,10 +47,6 @@ IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
54IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) 47IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
55IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 48IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
56IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 49IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
57IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
58IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
59IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
60IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
61 50
62#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 51#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
63 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 52 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
@@ -86,30 +75,6 @@ IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
86# define soc_is_s3c64xx() 0 75# define soc_is_s3c64xx() 0
87#endif 76#endif
88 77
89#if defined(CONFIG_CPU_S5P6440)
90# define soc_is_s5p6440() is_samsung_s5p6440()
91#else
92# define soc_is_s5p6440() 0
93#endif
94
95#if defined(CONFIG_CPU_S5P6450)
96# define soc_is_s5p6450() is_samsung_s5p6450()
97#else
98# define soc_is_s5p6450() 0
99#endif
100
101#if defined(CONFIG_CPU_S5PC100)
102# define soc_is_s5pc100() is_samsung_s5pc100()
103#else
104# define soc_is_s5pc100() 0
105#endif
106
107#if defined(CONFIG_CPU_S5PV210)
108# define soc_is_s5pv210() is_samsung_s5pv210()
109#else
110# define soc_is_s5pv210() 0
111#endif
112
113#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 78#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
114 79
115#ifndef KHZ 80#ifndef KHZ
@@ -145,12 +110,9 @@ extern void s3c_init_cpu(unsigned long idcode,
145 110
146/* core initialisation functions */ 111/* core initialisation functions */
147 112
148extern void s5p_init_irq(u32 *vic, u32 num_vic);
149
150extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); 113extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
151 114
152extern void s3c64xx_init_cpu(void); 115extern void s3c64xx_init_cpu(void);
153extern void s5p_init_cpu(void __iomem *cpuid_addr);
154 116
155extern unsigned int samsung_rev(void); 117extern unsigned int samsung_rev(void);
156 118
@@ -177,9 +139,5 @@ extern struct bus_type s3c2440_subsys;
177extern struct bus_type s3c2442_subsys; 139extern struct bus_type s3c2442_subsys;
178extern struct bus_type s3c2443_subsys; 140extern struct bus_type s3c2443_subsys;
179extern struct bus_type s3c6410_subsys; 141extern struct bus_type s3c6410_subsys;
180extern struct bus_type s5p64x0_subsys;
181extern struct bus_type s5pv210_subsys;
182
183extern void (*s5pc1xx_idle)(void);
184 142
185#endif 143#endif
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index eece188ed188..e23fed311e5f 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -25,9 +25,6 @@ struct s3c24xx_uart_resources {
25 25
26extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; 26extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
27extern struct s3c24xx_uart_resources s3c64xx_uart_resources[]; 27extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
28extern struct s3c24xx_uart_resources s5p_uart_resources[];
29extern struct s3c24xx_uart_resources exynos4_uart_resources[];
30extern struct s3c24xx_uart_resources exynos5_uart_resources[];
31 28
32extern struct platform_device *s3c24xx_uart_devs[]; 29extern struct platform_device *s3c24xx_uart_devs[];
33extern struct platform_device *s3c24xx_uart_src[]; 30extern struct platform_device *s3c24xx_uart_src[];
@@ -75,62 +72,6 @@ extern struct platform_device s3c_device_usb_hsotg;
75extern struct platform_device s3c_device_usb_hsudc; 72extern struct platform_device s3c_device_usb_hsudc;
76extern struct platform_device s3c_device_wdt; 73extern struct platform_device s3c_device_wdt;
77 74
78extern struct platform_device s5p_device_fimc0;
79extern struct platform_device s5p_device_fimc1;
80extern struct platform_device s5p_device_fimc2;
81extern struct platform_device s5p_device_fimc3;
82extern struct platform_device s5p_device_fimc_md;
83extern struct platform_device s5p_device_jpeg;
84extern struct platform_device s5p_device_g2d;
85extern struct platform_device s5p_device_fimd0;
86extern struct platform_device s5p_device_hdmi;
87extern struct platform_device s5p_device_i2c_hdmiphy;
88extern struct platform_device s5p_device_mfc;
89extern struct platform_device s5p_device_mfc_l;
90extern struct platform_device s5p_device_mfc_r;
91extern struct platform_device s5p_device_mipi_csis0;
92extern struct platform_device s5p_device_mipi_csis1;
93extern struct platform_device s5p_device_mixer;
94extern struct platform_device s5p_device_onenand;
95extern struct platform_device s5p_device_sdo;
96
97extern struct platform_device s5p6440_device_iis;
98extern struct platform_device s5p6440_device_pcm;
99
100extern struct platform_device s5p6450_device_iis0;
101extern struct platform_device s5p6450_device_iis1;
102extern struct platform_device s5p6450_device_iis2;
103extern struct platform_device s5p6450_device_pcm0;
104
105
106extern struct platform_device s5pc100_device_ac97;
107extern struct platform_device s5pc100_device_iis0;
108extern struct platform_device s5pc100_device_iis1;
109extern struct platform_device s5pc100_device_iis2;
110extern struct platform_device s5pc100_device_pcm0;
111extern struct platform_device s5pc100_device_pcm1;
112extern struct platform_device s5pc100_device_spdif;
113
114extern struct platform_device s5pv210_device_ac97;
115extern struct platform_device s5pv210_device_iis0;
116extern struct platform_device s5pv210_device_iis1;
117extern struct platform_device s5pv210_device_iis2;
118extern struct platform_device s5pv210_device_pcm0;
119extern struct platform_device s5pv210_device_pcm1;
120extern struct platform_device s5pv210_device_pcm2;
121extern struct platform_device s5pv210_device_spdif;
122
123extern struct platform_device exynos4_device_ac97;
124extern struct platform_device exynos4_device_ahci;
125extern struct platform_device exynos4_device_i2s0;
126extern struct platform_device exynos4_device_i2s1;
127extern struct platform_device exynos4_device_i2s2;
128extern struct platform_device exynos4_device_ohci;
129extern struct platform_device exynos4_device_pcm0;
130extern struct platform_device exynos4_device_pcm1;
131extern struct platform_device exynos4_device_pcm2;
132extern struct platform_device exynos4_device_spdif;
133
134extern struct platform_device samsung_asoc_idma; 75extern struct platform_device samsung_asoc_idma;
135extern struct platform_device samsung_device_keypad; 76extern struct platform_device samsung_device_keypad;
136extern struct platform_device samsung_device_pwm; 77extern struct platform_device samsung_device_pwm;
diff --git a/arch/arm/plat-samsung/include/plat/fb-core.h b/arch/arm/plat-samsung/include/plat/fb-core.h
index 6abcbf139cee..bca383efcf6d 100644
--- a/arch/arm/plat-samsung/include/plat/fb-core.h
+++ b/arch/arm/plat-samsung/include/plat/fb-core.h
@@ -26,19 +26,4 @@ static inline void s3c_fb_setname(char *name)
26#endif 26#endif
27} 27}
28 28
29/* Re-define device name depending on support. */
30static inline void s5p_fb_setname(int id, char *name)
31{
32 switch (id) {
33#ifdef CONFIG_S5P_DEV_FIMD0
34 case 0:
35 s5p_device_fimd0.name = name;
36 break;
37#endif
38 default:
39 printk(KERN_ERR "%s: invalid device id(%d)\n", __func__, id);
40 break;
41 }
42}
43
44#endif /* __ASM_PLAT_FB_CORE_H */ 29#endif /* __ASM_PLAT_FB_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index 9ae507270785..b89f8f208515 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -26,46 +26,10 @@
26extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd); 26extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
27 27
28/** 28/**
29 * s5p_fimd0_set_platdata() - Setup the FB device with platform data.
30 * @pd: The platform data to set. The data is copied from the passed structure
31 * so the machine data can mark the data __initdata so that any unused
32 * machines will end up dumping their data at runtime.
33 */
34extern void s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd);
35
36/**
37 * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD 29 * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
38 * 30 *
39 * Initialise the GPIO for an 24bpp LCD display on the RGB interface. 31 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
40 */ 32 */
41extern void s3c64xx_fb_gpio_setup_24bpp(void); 33extern void s3c64xx_fb_gpio_setup_24bpp(void);
42 34
43/**
44 * s5pc100_fb_gpio_setup_24bpp() - S5PC100 setup function for 24bpp LCD
45 *
46 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
47 */
48extern void s5pc100_fb_gpio_setup_24bpp(void);
49
50/**
51 * s5pv210_fb_gpio_setup_24bpp() - S5PV210/S5PC110 setup function for 24bpp LCD
52 *
53 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
54 */
55extern void s5pv210_fb_gpio_setup_24bpp(void);
56
57/**
58 * exynos4_fimd0_gpio_setup_24bpp() - Exynos4 setup function for 24bpp LCD0
59 *
60 * Initialise the GPIO for an 24bpp LCD display on the RGB interface 0.
61 */
62extern void exynos4_fimd0_gpio_setup_24bpp(void);
63
64/**
65 * s5p64x0_fb_gpio_setup_24bpp() - S5P6440/S5P6450 setup function for 24bpp LCD
66 *
67 * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
68 */
69extern void s5p64x0_fb_gpio_setup_24bpp(void);
70
71#endif /* __PLAT_S3C_FB_H */ 35#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-samsung/include/plat/fimc-core.h b/arch/arm/plat-samsung/include/plat/fimc-core.h
deleted file mode 100644
index 1d6cb2b8b094..000000000000
--- a/arch/arm/plat-samsung/include/plat/fimc-core.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * arch/arm/plat-samsung/include/plat/fimc-core.h
3 *
4 * Copyright 2010 Samsung Electronics Co., Ltd.
5 * Sylwester Nawrocki <s.nawrocki@samsung.com>
6 *
7 * Samsung camera interface driver core functions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_PLAT_FIMC_CORE_H
15#define __ASM_PLAT_FIMC_CORE_H __FILE__
16
17/*
18 * These functions are only for use with the core support code, such as
19 * the CPU-specific initialization code.
20 */
21
22/* Re-define device name to differentiate the subsystem in various SoCs. */
23static inline void s3c_fimc_setname(int id, char *name)
24{
25 switch (id) {
26#ifdef CONFIG_S5P_DEV_FIMC0
27 case 0:
28 s5p_device_fimc0.name = name;
29 break;
30#endif
31#ifdef CONFIG_S5P_DEV_FIMC1
32 case 1:
33 s5p_device_fimc1.name = name;
34 break;
35#endif
36#ifdef CONFIG_S5P_DEV_FIMC2
37 case 2:
38 s5p_device_fimc2.name = name;
39 break;
40#endif
41#ifdef CONFIG_S5P_DEV_FIMC3
42 case 3:
43 s5p_device_fimc3.name = name;
44 break;
45#endif
46 default:
47 break;
48 }
49}
50
51#endif /* __ASM_PLAT_FIMC_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 08740eed050c..b5294eff18b5 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28 28
29typedef unsigned int __bitwise__ samsung_gpio_pull_t; 29typedef unsigned int __bitwise__ samsung_gpio_pull_t;
30typedef unsigned int __bitwise__ s5p_gpio_drvstr_t;
31 30
32/* forward declaration if gpio-core.h hasn't been included */ 31/* forward declaration if gpio-core.h hasn't been included */
33struct samsung_gpio_chip; 32struct samsung_gpio_chip;
@@ -180,67 +179,4 @@ static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
180 return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE); 179 return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
181} 180}
182 181
183/* Define values for the drvstr available for each gpio pin.
184 *
185 * These values control the value of the output signal driver strength,
186 * configurable on most pins on the S5P series.
187 */
188#define S5P_GPIO_DRVSTR_LV1 ((__force s5p_gpio_drvstr_t)0x0)
189#define S5P_GPIO_DRVSTR_LV2 ((__force s5p_gpio_drvstr_t)0x2)
190#define S5P_GPIO_DRVSTR_LV3 ((__force s5p_gpio_drvstr_t)0x1)
191#define S5P_GPIO_DRVSTR_LV4 ((__force s5p_gpio_drvstr_t)0x3)
192
193/**
194 * s5c_gpio_get_drvstr() - get the driver streght value of a gpio pin
195 * @pin: The pin number to get the settings for
196 *
197 * Read the driver streght value for the specified pin.
198*/
199extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin);
200
201/**
202 * s3c_gpio_set_drvstr() - set the driver streght value of a gpio pin
203 * @pin: The pin number to configure the driver streght value
204 * @drvstr: The new value of the driver strength
205 *
206 * This function sets the driver strength value for the specified pin.
207 * It will return 0 if successful, or a negative error code if the pin
208 * cannot support the requested setting.
209*/
210extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr);
211
212/**
213 * s5p_register_gpio_interrupt() - register interrupt support for a gpio group
214 * @pin: The pin number from the group to be registered
215 *
216 * This function registers gpio interrupt support for the group that the
217 * specified pin belongs to.
218 *
219 * The total number of gpio pins is quite large ob s5p series. Registering
220 * irq support for all of them would be a resource waste. Because of that the
221 * interrupt support for standard gpio pins is registered dynamically.
222 *
223 * It will return the irq number of the interrupt that has been registered
224 * or -ENOMEM if no more gpio interrupts can be registered. It is allowed
225 * to call this function more than once for the same gpio group (the group
226 * will be registered only once).
227 */
228extern int s5p_register_gpio_interrupt(int pin);
229
230/** s5p_register_gpioint_bank() - add gpio bank for further gpio interrupt
231 * registration (see s5p_register_gpio_interrupt function)
232 * @chain_irq: chained irq number for the gpio int handler for this bank
233 * @start: start gpio group number of this bank
234 * @nr_groups: number of gpio groups handled by this bank
235 *
236 * This functions registers initial information about gpio banks that
237 * can be later used by the s5p_register_gpio_interrupt() function to
238 * enable support for gpio interrupt for particular gpio group.
239 */
240#ifdef CONFIG_S5P_GPIO_INT
241extern int s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups);
242#else
243#define s5p_register_gpioint_bank(chain_irq, start, nr_groups) do { } while (0)
244#endif
245
246#endif /* __PLAT_GPIO_CFG_H */ 182#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index cf5aae5b0975..6ce11bfdc37e 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -14,6 +14,9 @@
14#ifndef __PLAT_SAMSUNG_GPIO_CORE_H 14#ifndef __PLAT_SAMSUNG_GPIO_CORE_H
15#define __PLAT_SAMSUNG_GPIO_CORE_H 15#define __PLAT_SAMSUNG_GPIO_CORE_H
16 16
17/* Bring in machine-local definitions, especially S3C_GPIO_END */
18#include <mach/gpio-samsung.h>
19
17#define GPIOCON_OFF (0x00) 20#define GPIOCON_OFF (0x00)
18#define GPIODAT_OFF (0x04) 21#define GPIODAT_OFF (0x04)
19 22
diff --git a/arch/arm/plat-samsung/include/plat/hdmi.h b/arch/arm/plat-samsung/include/plat/hdmi.h
deleted file mode 100644
index 331d046ac2c5..000000000000
--- a/arch/arm/plat-samsung/include/plat/hdmi.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
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 __PLAT_SAMSUNG_HDMI_H
11#define __PLAT_SAMSUNG_HDMI_H __FILE__
12
13extern void s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info,
14 struct i2c_board_info *mhl_info, int mhl_bus);
15
16#endif /* __PLAT_SAMSUNG_HDMI_H */
diff --git a/arch/arm/plat-samsung/include/plat/irqs.h b/arch/arm/plat-samsung/include/plat/irqs.h
deleted file mode 100644
index 039001c0ef05..000000000000
--- a/arch/arm/plat-samsung/include/plat/irqs.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/irqs.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P Common IRQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __PLAT_SAMSUNG_IRQS_H
14#define __PLAT_SAMSUNG_IRQS_H __FILE__
15
16/* we keep the first set of CPU IRQs out of the range of
17 * the ISA space, so that the PC104 has them to itself
18 * and we don't end up having to do horrible things to the
19 * standard ISA drivers....
20 *
21 * note, since we're using the VICs, our start must be a
22 * mulitple of 32 to allow the common code to work
23 */
24
25#define S5P_IRQ_OFFSET (32)
26
27#define S5P_IRQ(x) ((x) + S5P_IRQ_OFFSET)
28
29#define S5P_VIC0_BASE S5P_IRQ(0)
30#define S5P_VIC1_BASE S5P_IRQ(32)
31#define S5P_VIC2_BASE S5P_IRQ(64)
32#define S5P_VIC3_BASE S5P_IRQ(96)
33
34#define VIC_BASE(x) (S5P_VIC0_BASE + ((x)*32))
35
36#define IRQ_VIC0_BASE S5P_VIC0_BASE
37#define IRQ_VIC1_BASE S5P_VIC1_BASE
38#define IRQ_VIC2_BASE S5P_VIC2_BASE
39
40/* VIC based IRQs */
41
42#define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x))
43#define S5P_IRQ_VIC1(x) (S5P_VIC1_BASE + (x))
44#define S5P_IRQ_VIC2(x) (S5P_VIC2_BASE + (x))
45#define S5P_IRQ_VIC3(x) (S5P_VIC3_BASE + (x))
46
47#define IRQ_EINT(x) ((x) < 16 ? ((x) + S5P_EINT_BASE1) \
48 : ((x) - 16 + S5P_EINT_BASE2))
49
50#define EINT_OFFSET(irq) ((irq) < S5P_EINT_BASE2 ? \
51 ((irq) - S5P_EINT_BASE1) : \
52 ((irq) + 16 - S5P_EINT_BASE2))
53
54#define IRQ_EINT_BIT(x) EINT_OFFSET(x)
55
56/* Typically only a few gpio chips require gpio interrupt support.
57 To avoid memory waste irq descriptors are allocated only for
58 S5P_GPIOINT_GROUP_COUNT chips, each with total number of
59 S5P_GPIOINT_GROUP_SIZE pins/irqs. Each GPIOINT group can be assiged
60 to any gpio chip with the s5p_register_gpio_interrupt() function */
61#define S5P_GPIOINT_GROUP_COUNT 4
62#define S5P_GPIOINT_GROUP_SIZE 8
63#define S5P_GPIOINT_COUNT (S5P_GPIOINT_GROUP_COUNT * S5P_GPIOINT_GROUP_SIZE)
64
65/* IRQ types common for all s5p platforms */
66#define S5P_IRQ_TYPE_LEVEL_LOW (0x00)
67#define S5P_IRQ_TYPE_LEVEL_HIGH (0x01)
68#define S5P_IRQ_TYPE_EDGE_FALLING (0x02)
69#define S5P_IRQ_TYPE_EDGE_RISING (0x03)
70#define S5P_IRQ_TYPE_EDGE_BOTH (0x04)
71
72#endif /* __PLAT_SAMSUNG_IRQS_H */
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h
index c18678610bc0..f5b9d3ff9cd4 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -15,7 +15,6 @@
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_PMU S3C_ADDR(0x02180000)
19#define S5P_VA_GPIO S3C_ADDR(0x02200000) 18#define S5P_VA_GPIO S3C_ADDR(0x02200000)
20#define S5P_VA_GPIO1 S5P_VA_GPIO 19#define S5P_VA_GPIO1 S5P_VA_GPIO
21#define S5P_VA_GPIO2 S3C_ADDR(0x02240000) 20#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
diff --git a/arch/arm/plat-samsung/include/plat/mfc.h b/arch/arm/plat-samsung/include/plat/mfc.h
deleted file mode 100644
index 033654e91e22..000000000000
--- a/arch/arm/plat-samsung/include/plat/mfc.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
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 __PLAT_SAMSUNG_MFC_H
11#define __PLAT_SAMSUNG_MFC_H __FILE__
12
13struct s5p_mfc_dt_meminfo {
14 unsigned long loff;
15 unsigned long lsize;
16 unsigned long roff;
17 unsigned long rsize;
18 char *compatible;
19};
20
21/**
22 * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver
23 * @rbase: base address for MFC 'right' memory interface
24 * @rsize: size of the memory reserved for MFC 'right' interface
25 * @lbase: base address for MFC 'left' memory interface
26 * @lsize: size of the memory reserved for MFC 'left' interface
27 *
28 * This function reserves system memory for both MFC device memory
29 * interfaces and registers it to respective struct device entries as
30 * coherent memory.
31 */
32void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
33 phys_addr_t lbase, unsigned int lsize);
34
35#endif /* __PLAT_SAMSUNG_MFC_H */
diff --git a/arch/arm/plat-samsung/include/plat/pll.h b/arch/arm/plat-samsung/include/plat/pll.h
deleted file mode 100644
index 357af7c1c664..000000000000
--- a/arch/arm/plat-samsung/include/plat/pll.h
+++ /dev/null
@@ -1,323 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/pll.h
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * Ben Dooks <ben@simtec.co.uk>
9 * http://armlinux.simtec.co.uk/
10 *
11 * Samsung PLL codes
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16*/
17
18#include <asm/div64.h>
19
20#define S3C24XX_PLL_MDIV_MASK (0xFF)
21#define S3C24XX_PLL_PDIV_MASK (0x1F)
22#define S3C24XX_PLL_SDIV_MASK (0x3)
23#define S3C24XX_PLL_MDIV_SHIFT (12)
24#define S3C24XX_PLL_PDIV_SHIFT (4)
25#define S3C24XX_PLL_SDIV_SHIFT (0)
26
27static inline unsigned int s3c24xx_get_pll(unsigned int pllval,
28 unsigned int baseclk)
29{
30 unsigned int mdiv, pdiv, sdiv;
31 uint64_t fvco;
32
33 mdiv = (pllval >> S3C24XX_PLL_MDIV_SHIFT) & S3C24XX_PLL_MDIV_MASK;
34 pdiv = (pllval >> S3C24XX_PLL_PDIV_SHIFT) & S3C24XX_PLL_PDIV_MASK;
35 sdiv = (pllval >> S3C24XX_PLL_SDIV_SHIFT) & S3C24XX_PLL_SDIV_MASK;
36
37 fvco = (uint64_t)baseclk * (mdiv + 8);
38 do_div(fvco, (pdiv + 2) << sdiv);
39
40 return (unsigned int)fvco;
41}
42
43#define S3C2416_PLL_MDIV_MASK (0x3FF)
44#define S3C2416_PLL_PDIV_MASK (0x3F)
45#define S3C2416_PLL_SDIV_MASK (0x7)
46#define S3C2416_PLL_MDIV_SHIFT (14)
47#define S3C2416_PLL_PDIV_SHIFT (5)
48#define S3C2416_PLL_SDIV_SHIFT (0)
49
50static inline unsigned int s3c2416_get_pll(unsigned int pllval,
51 unsigned int baseclk)
52{
53 unsigned int mdiv, pdiv, sdiv;
54 uint64_t fvco;
55
56 mdiv = (pllval >> S3C2416_PLL_MDIV_SHIFT) & S3C2416_PLL_MDIV_MASK;
57 pdiv = (pllval >> S3C2416_PLL_PDIV_SHIFT) & S3C2416_PLL_PDIV_MASK;
58 sdiv = (pllval >> S3C2416_PLL_SDIV_SHIFT) & S3C2416_PLL_SDIV_MASK;
59
60 fvco = (uint64_t)baseclk * mdiv;
61 do_div(fvco, (pdiv << sdiv));
62
63 return (unsigned int)fvco;
64}
65
66#define S3C6400_PLL_MDIV_MASK (0x3FF)
67#define S3C6400_PLL_PDIV_MASK (0x3F)
68#define S3C6400_PLL_SDIV_MASK (0x7)
69#define S3C6400_PLL_MDIV_SHIFT (16)
70#define S3C6400_PLL_PDIV_SHIFT (8)
71#define S3C6400_PLL_SDIV_SHIFT (0)
72
73static inline unsigned long s3c6400_get_pll(unsigned long baseclk,
74 u32 pllcon)
75{
76 u32 mdiv, pdiv, sdiv;
77 u64 fvco = baseclk;
78
79 mdiv = (pllcon >> S3C6400_PLL_MDIV_SHIFT) & S3C6400_PLL_MDIV_MASK;
80 pdiv = (pllcon >> S3C6400_PLL_PDIV_SHIFT) & S3C6400_PLL_PDIV_MASK;
81 sdiv = (pllcon >> S3C6400_PLL_SDIV_SHIFT) & S3C6400_PLL_SDIV_MASK;
82
83 fvco *= mdiv;
84 do_div(fvco, (pdiv << sdiv));
85
86 return (unsigned long)fvco;
87}
88
89#define PLL6553X_MDIV_MASK (0x7F)
90#define PLL6553X_PDIV_MASK (0x1F)
91#define PLL6553X_SDIV_MASK (0x3)
92#define PLL6553X_KDIV_MASK (0xFFFF)
93#define PLL6553X_MDIV_SHIFT (16)
94#define PLL6553X_PDIV_SHIFT (8)
95#define PLL6553X_SDIV_SHIFT (0)
96
97static inline unsigned long s3c_get_pll6553x(unsigned long baseclk,
98 u32 pll_con0, u32 pll_con1)
99{
100 unsigned long result;
101 u32 mdiv, pdiv, sdiv, kdiv;
102 u64 tmp;
103
104 mdiv = (pll_con0 >> PLL6553X_MDIV_SHIFT) & PLL6553X_MDIV_MASK;
105 pdiv = (pll_con0 >> PLL6553X_PDIV_SHIFT) & PLL6553X_PDIV_MASK;
106 sdiv = (pll_con0 >> PLL6553X_SDIV_SHIFT) & PLL6553X_SDIV_MASK;
107 kdiv = pll_con1 & PLL6553X_KDIV_MASK;
108
109 /*
110 * We need to multiple baseclk by mdiv (the integer part) and kdiv
111 * which is in 2^16ths, so shift mdiv up (does not overflow) and
112 * add kdiv before multiplying. The use of tmp is to avoid any
113 * overflows before shifting bac down into result when multipling
114 * by the mdiv and kdiv pair.
115 */
116
117 tmp = baseclk;
118 tmp *= (mdiv << 16) + kdiv;
119 do_div(tmp, (pdiv << sdiv));
120 result = tmp >> 16;
121
122 return result;
123}
124
125#define PLL35XX_MDIV_MASK (0x3FF)
126#define PLL35XX_PDIV_MASK (0x3F)
127#define PLL35XX_SDIV_MASK (0x7)
128#define PLL35XX_MDIV_SHIFT (16)
129#define PLL35XX_PDIV_SHIFT (8)
130#define PLL35XX_SDIV_SHIFT (0)
131
132static inline unsigned long s5p_get_pll35xx(unsigned long baseclk, u32 pll_con)
133{
134 u32 mdiv, pdiv, sdiv;
135 u64 fvco = baseclk;
136
137 mdiv = (pll_con >> PLL35XX_MDIV_SHIFT) & PLL35XX_MDIV_MASK;
138 pdiv = (pll_con >> PLL35XX_PDIV_SHIFT) & PLL35XX_PDIV_MASK;
139 sdiv = (pll_con >> PLL35XX_SDIV_SHIFT) & PLL35XX_SDIV_MASK;
140
141 fvco *= mdiv;
142 do_div(fvco, (pdiv << sdiv));
143
144 return (unsigned long)fvco;
145}
146
147#define PLL36XX_KDIV_MASK (0xFFFF)
148#define PLL36XX_MDIV_MASK (0x1FF)
149#define PLL36XX_PDIV_MASK (0x3F)
150#define PLL36XX_SDIV_MASK (0x7)
151#define PLL36XX_MDIV_SHIFT (16)
152#define PLL36XX_PDIV_SHIFT (8)
153#define PLL36XX_SDIV_SHIFT (0)
154
155static inline unsigned long s5p_get_pll36xx(unsigned long baseclk,
156 u32 pll_con0, u32 pll_con1)
157{
158 unsigned long result;
159 u32 mdiv, pdiv, sdiv, kdiv;
160 u64 tmp;
161
162 mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK;
163 pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK;
164 sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK;
165 kdiv = pll_con1 & PLL36XX_KDIV_MASK;
166
167 tmp = baseclk;
168
169 tmp *= (mdiv << 16) + kdiv;
170 do_div(tmp, (pdiv << sdiv));
171 result = tmp >> 16;
172
173 return result;
174}
175
176#define PLL45XX_MDIV_MASK (0x3FF)
177#define PLL45XX_PDIV_MASK (0x3F)
178#define PLL45XX_SDIV_MASK (0x7)
179#define PLL45XX_MDIV_SHIFT (16)
180#define PLL45XX_PDIV_SHIFT (8)
181#define PLL45XX_SDIV_SHIFT (0)
182
183enum pll45xx_type_t {
184 pll_4500,
185 pll_4502,
186 pll_4508
187};
188
189static inline unsigned long s5p_get_pll45xx(unsigned long baseclk, u32 pll_con,
190 enum pll45xx_type_t pll_type)
191{
192 u32 mdiv, pdiv, sdiv;
193 u64 fvco = baseclk;
194
195 mdiv = (pll_con >> PLL45XX_MDIV_SHIFT) & PLL45XX_MDIV_MASK;
196 pdiv = (pll_con >> PLL45XX_PDIV_SHIFT) & PLL45XX_PDIV_MASK;
197 sdiv = (pll_con >> PLL45XX_SDIV_SHIFT) & PLL45XX_SDIV_MASK;
198
199 if (pll_type == pll_4508)
200 sdiv = sdiv - 1;
201
202 fvco *= mdiv;
203 do_div(fvco, (pdiv << sdiv));
204
205 return (unsigned long)fvco;
206}
207
208/* CON0 bit-fields */
209#define PLL46XX_MDIV_MASK (0x1FF)
210#define PLL46XX_PDIV_MASK (0x3F)
211#define PLL46XX_SDIV_MASK (0x7)
212#define PLL46XX_LOCKED_SHIFT (29)
213#define PLL46XX_MDIV_SHIFT (16)
214#define PLL46XX_PDIV_SHIFT (8)
215#define PLL46XX_SDIV_SHIFT (0)
216
217/* CON1 bit-fields */
218#define PLL46XX_MRR_MASK (0x1F)
219#define PLL46XX_MFR_MASK (0x3F)
220#define PLL46XX_KDIV_MASK (0xFFFF)
221#define PLL4650C_KDIV_MASK (0xFFF)
222#define PLL46XX_MRR_SHIFT (24)
223#define PLL46XX_MFR_SHIFT (16)
224#define PLL46XX_KDIV_SHIFT (0)
225
226enum pll46xx_type_t {
227 pll_4600,
228 pll_4650,
229 pll_4650c,
230};
231
232static inline unsigned long s5p_get_pll46xx(unsigned long baseclk,
233 u32 pll_con0, u32 pll_con1,
234 enum pll46xx_type_t pll_type)
235{
236 unsigned long result;
237 u32 mdiv, pdiv, sdiv, kdiv;
238 u64 tmp;
239
240 mdiv = (pll_con0 >> PLL46XX_MDIV_SHIFT) & PLL46XX_MDIV_MASK;
241 pdiv = (pll_con0 >> PLL46XX_PDIV_SHIFT) & PLL46XX_PDIV_MASK;
242 sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK;
243 kdiv = pll_con1 & PLL46XX_KDIV_MASK;
244
245 if (pll_type == pll_4650c)
246 kdiv = pll_con1 & PLL4650C_KDIV_MASK;
247 else
248 kdiv = pll_con1 & PLL46XX_KDIV_MASK;
249
250 tmp = baseclk;
251
252 if (pll_type == pll_4600) {
253 tmp *= (mdiv << 16) + kdiv;
254 do_div(tmp, (pdiv << sdiv));
255 result = tmp >> 16;
256 } else {
257 tmp *= (mdiv << 10) + kdiv;
258 do_div(tmp, (pdiv << sdiv));
259 result = tmp >> 10;
260 }
261
262 return result;
263}
264
265#define PLL90XX_MDIV_MASK (0xFF)
266#define PLL90XX_PDIV_MASK (0x3F)
267#define PLL90XX_SDIV_MASK (0x7)
268#define PLL90XX_KDIV_MASK (0xffff)
269#define PLL90XX_LOCKED_SHIFT (29)
270#define PLL90XX_MDIV_SHIFT (16)
271#define PLL90XX_PDIV_SHIFT (8)
272#define PLL90XX_SDIV_SHIFT (0)
273#define PLL90XX_KDIV_SHIFT (0)
274
275static inline unsigned long s5p_get_pll90xx(unsigned long baseclk,
276 u32 pll_con, u32 pll_conk)
277{
278 unsigned long result;
279 u32 mdiv, pdiv, sdiv, kdiv;
280 u64 tmp;
281
282 mdiv = (pll_con >> PLL90XX_MDIV_SHIFT) & PLL90XX_MDIV_MASK;
283 pdiv = (pll_con >> PLL90XX_PDIV_SHIFT) & PLL90XX_PDIV_MASK;
284 sdiv = (pll_con >> PLL90XX_SDIV_SHIFT) & PLL90XX_SDIV_MASK;
285 kdiv = pll_conk & PLL90XX_KDIV_MASK;
286
287 /*
288 * We need to multiple baseclk by mdiv (the integer part) and kdiv
289 * which is in 2^16ths, so shift mdiv up (does not overflow) and
290 * add kdiv before multiplying. The use of tmp is to avoid any
291 * overflows before shifting bac down into result when multipling
292 * by the mdiv and kdiv pair.
293 */
294
295 tmp = baseclk;
296 tmp *= (mdiv << 16) + kdiv;
297 do_div(tmp, (pdiv << sdiv));
298 result = tmp >> 16;
299
300 return result;
301}
302
303#define PLL65XX_MDIV_MASK (0x3FF)
304#define PLL65XX_PDIV_MASK (0x3F)
305#define PLL65XX_SDIV_MASK (0x7)
306#define PLL65XX_MDIV_SHIFT (16)
307#define PLL65XX_PDIV_SHIFT (8)
308#define PLL65XX_SDIV_SHIFT (0)
309
310static inline unsigned long s5p_get_pll65xx(unsigned long baseclk, u32 pll_con)
311{
312 u32 mdiv, pdiv, sdiv;
313 u64 fvco = baseclk;
314
315 mdiv = (pll_con >> PLL65XX_MDIV_SHIFT) & PLL65XX_MDIV_MASK;
316 pdiv = (pll_con >> PLL65XX_PDIV_SHIFT) & PLL65XX_PDIV_MASK;
317 sdiv = (pll_con >> PLL65XX_SDIV_SHIFT) & PLL65XX_SDIV_MASK;
318
319 fvco *= mdiv;
320 do_div(fvco, (pdiv << sdiv));
321
322 return (unsigned long)fvco;
323}
diff --git a/arch/arm/plat-samsung/include/plat/s5p-clock.h b/arch/arm/plat-samsung/include/plat/s5p-clock.h
deleted file mode 100644
index 8364b4bea8b8..000000000000
--- a/arch/arm/plat-samsung/include/plat/s5p-clock.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s5p-clock.h
2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Header file for s5p clock support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_S5P_CLOCK_H
14#define __ASM_PLAT_S5P_CLOCK_H __FILE__
15
16#include <linux/clk.h>
17
18#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
19
20#define clk_fin_apll clk_ext_xtal_mux
21#define clk_fin_bpll clk_ext_xtal_mux
22#define clk_fin_cpll clk_ext_xtal_mux
23#define clk_fin_mpll clk_ext_xtal_mux
24#define clk_fin_epll clk_ext_xtal_mux
25#define clk_fin_dpll clk_ext_xtal_mux
26#define clk_fin_vpll clk_ext_xtal_mux
27#define clk_fin_hpll clk_ext_xtal_mux
28
29extern struct clk clk_ext_xtal_mux;
30extern struct clk clk_xusbxti;
31extern struct clk clk_48m;
32extern struct clk s5p_clk_27m;
33extern struct clk clk_fout_apll;
34extern struct clk clk_fout_bpll;
35extern struct clk clk_fout_bpll_div2;
36extern struct clk clk_fout_cpll;
37extern struct clk clk_fout_mpll;
38extern struct clk clk_fout_mpll_div2;
39extern struct clk clk_fout_epll;
40extern struct clk clk_fout_dpll;
41extern struct clk clk_fout_vpll;
42extern struct clk clk_arm;
43extern struct clk clk_vpll;
44
45extern struct clksrc_sources clk_src_apll;
46extern struct clksrc_sources clk_src_bpll;
47extern struct clksrc_sources clk_src_bpll_fout;
48extern struct clksrc_sources clk_src_cpll;
49extern struct clksrc_sources clk_src_mpll;
50extern struct clksrc_sources clk_src_mpll_fout;
51extern struct clksrc_sources clk_src_epll;
52extern struct clksrc_sources clk_src_dpll;
53
54extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
55
56/* Common EPLL operations for S5P platform */
57extern int s5p_epll_enable(struct clk *clk, int enable);
58extern unsigned long s5p_epll_get_rate(struct clk *clk);
59
60/* SPDIF clk operations common for S5PC100/V210/C110 and Exynos4 */
61extern int s5p_spdif_set_rate(struct clk *clk, unsigned long rate);
62extern unsigned long s5p_spdif_get_rate(struct clk *clk);
63
64extern struct clk_ops s5p_sclk_spdif_ops;
65#endif /* __ASM_PLAT_S5P_CLOCK_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index bf650218b40e..2787553c3ae2 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -56,22 +56,7 @@ extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
57extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 57extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
59extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
60extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
61extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
62extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 59extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
63extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
64extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
65extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
66extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
67extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
68extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
69extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
70extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
71extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
72extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
73extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
74extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
75 60
76/* S3C2416 SDHCI setup */ 61/* S3C2416 SDHCI setup */
77 62
@@ -151,115 +136,6 @@ static inline void s3c6400_default_sdhci2(void) { }
151 136
152#endif /* CONFIG_S3C64XX_SETUP_SDHCI */ 137#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
153 138
154/* S5P64X0 SDHCI setup */
155
156#ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
157static inline void s5p64x0_default_sdhci0(void)
158{
159#ifdef CONFIG_S3C_DEV_HSMMC
160 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
161#endif
162}
163
164static inline void s5p64x0_default_sdhci1(void)
165{
166#ifdef CONFIG_S3C_DEV_HSMMC1
167 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
168#endif
169}
170
171static inline void s5p6440_default_sdhci2(void)
172{
173#ifdef CONFIG_S3C_DEV_HSMMC2
174 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
175#endif
176}
177
178static inline void s5p6450_default_sdhci2(void)
179{
180#ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
182#endif
183}
184
185#else
186static inline void s5p64x0_default_sdhci0(void) { }
187static inline void s5p64x0_default_sdhci1(void) { }
188static inline void s5p6440_default_sdhci2(void) { }
189static inline void s5p6450_default_sdhci2(void) { }
190
191#endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
192
193/* S5PC100 SDHCI setup */
194
195#ifdef CONFIG_S5PC100_SETUP_SDHCI
196static inline void s5pc100_default_sdhci0(void)
197{
198#ifdef CONFIG_S3C_DEV_HSMMC
199 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
200#endif
201}
202
203static inline void s5pc100_default_sdhci1(void)
204{
205#ifdef CONFIG_S3C_DEV_HSMMC1
206 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
207#endif
208}
209
210static inline void s5pc100_default_sdhci2(void)
211{
212#ifdef CONFIG_S3C_DEV_HSMMC2
213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214#endif
215}
216
217#else
218static inline void s5pc100_default_sdhci0(void) { }
219static inline void s5pc100_default_sdhci1(void) { }
220static inline void s5pc100_default_sdhci2(void) { }
221
222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
224/* S5PV210 SDHCI setup */
225
226#ifdef CONFIG_S5PV210_SETUP_SDHCI
227static inline void s5pv210_default_sdhci0(void)
228{
229#ifdef CONFIG_S3C_DEV_HSMMC
230 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
231#endif
232}
233
234static inline void s5pv210_default_sdhci1(void)
235{
236#ifdef CONFIG_S3C_DEV_HSMMC1
237 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
238#endif
239}
240
241static inline void s5pv210_default_sdhci2(void)
242{
243#ifdef CONFIG_S3C_DEV_HSMMC2
244 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
245#endif
246}
247
248static inline void s5pv210_default_sdhci3(void)
249{
250#ifdef CONFIG_S3C_DEV_HSMMC3
251 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
252#endif
253}
254
255#else
256static inline void s5pv210_default_sdhci0(void) { }
257static inline void s5pv210_default_sdhci1(void) { }
258static inline void s5pv210_default_sdhci2(void) { }
259static inline void s5pv210_default_sdhci3(void) { }
260
261#endif /* CONFIG_S5PV210_SETUP_SDHCI */
262
263static inline void s3c_sdhci_setname(int id, char *name) 139static inline void s3c_sdhci_setname(int id, char *name)
264{ 140{
265 switch (id) { 141 switch (id) {
diff --git a/arch/arm/plat-samsung/include/plat/tv-core.h b/arch/arm/plat-samsung/include/plat/tv-core.h
deleted file mode 100644
index 3bc34f3ce28f..000000000000
--- a/arch/arm/plat-samsung/include/plat/tv-core.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * arch/arm/plat-samsung/include/plat/tv.h
3 *
4 * Copyright 2011 Samsung Electronics Co., Ltd.
5 * Tomasz Stanislawski <t.stanislaws@samsung.com>
6 *
7 * Samsung TV driver core functions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __SAMSUNG_PLAT_TV_H
15#define __SAMSUNG_PLAT_TV_H __FILE__
16
17/*
18 * These functions are only for use with the core support code, such as
19 * the CPU-specific initialization code.
20 */
21
22/* Re-define device name to differentiate the subsystem in various SoCs. */
23static inline void s5p_hdmi_setname(char *name)
24{
25#ifdef CONFIG_S5P_DEV_TV
26 s5p_device_hdmi.name = name;
27#endif
28}
29
30static inline void s5p_mixer_setname(char *name)
31{
32#ifdef CONFIG_S5P_DEV_TV
33 s5p_device_mixer.name = name;
34#endif
35}
36
37static inline void s5p_sdo_setname(char *name)
38{
39#ifdef CONFIG_S5P_DEV_TV
40 s5p_device_sdo.name = name;
41#endif
42}
43
44#endif /* __SAMSUNG_PLAT_TV_H */
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index a1f925f3121f..11fbbc26e49f 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -30,7 +30,6 @@
30 30
31#include <plat/cpu.h> 31#include <plat/cpu.h>
32#include <plat/devs.h> 32#include <plat/devs.h>
33#include <plat/clock.h>
34 33
35static struct cpu_table *cpu; 34static struct cpu_table *cpu;
36 35
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index da268813901b..f9a09262f2fa 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -19,9 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
23#include <mach/gpio-samsung.h> 22#include <mach/gpio-samsung.h>
24#endif
25 23
26#include <plat/gpio-core.h> 24#include <plat/gpio-core.h>
27#include <plat/pm.h> 25#include <plat/pm.h>
@@ -196,7 +194,7 @@ struct samsung_gpio_pm samsung_gpio_pm_2bit = {
196 .resume = samsung_gpio_pm_2bit_resume, 194 .resume = samsung_gpio_pm_2bit_resume,
197}; 195};
198 196
199#if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P) 197#if defined(CONFIG_ARCH_S3C64XX)
200static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip) 198static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip)
201{ 199{
202 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); 200 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
@@ -306,7 +304,7 @@ struct samsung_gpio_pm samsung_gpio_pm_4bit = {
306 .save = samsung_gpio_pm_4bit_save, 304 .save = samsung_gpio_pm_4bit_save,
307 .resume = samsung_gpio_pm_4bit_resume, 305 .resume = samsung_gpio_pm_4bit_resume,
308}; 306};
309#endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */ 307#endif /* CONFIG_ARCH_S3C64XX */
310 308
311/** 309/**
312 * samsung_pm_save_gpio() - save gpio chip data for suspend 310 * samsung_pm_save_gpio() - save gpio chip data for suspend
diff --git a/arch/arm/plat-samsung/s5p-clock.c b/arch/arm/plat-samsung/s5p-clock.c
deleted file mode 100644
index 48a159911037..000000000000
--- a/arch/arm/plat-samsung/s5p-clock.c
+++ /dev/null
@@ -1,294 +0,0 @@
1/*
2 * Copyright 2009 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/
4 *
5 * S5P - Common clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/device.h>
20#include <linux/io.h>
21#include <asm/div64.h>
22
23#include <mach/regs-clock.h>
24
25#include <plat/clock.h>
26#include <plat/clock-clksrc.h>
27#include <plat/s5p-clock.h>
28
29/* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
30 * clk_ext_xtal_mux.
31*/
32struct clk clk_ext_xtal_mux = {
33 .name = "ext_xtal",
34 .id = -1,
35};
36
37struct clk clk_xusbxti = {
38 .name = "xusbxti",
39 .id = -1,
40 .rate = 24000000,
41};
42
43struct clk s5p_clk_27m = {
44 .name = "clk_27m",
45 .id = -1,
46 .rate = 27000000,
47};
48
49/* 48MHz USB Phy clock output */
50struct clk clk_48m = {
51 .name = "clk_48m",
52 .id = -1,
53 .rate = 48000000,
54};
55
56/* APLL clock output
57 * No need .ctrlbit, this is always on
58*/
59struct clk clk_fout_apll = {
60 .name = "fout_apll",
61 .id = -1,
62};
63
64/* BPLL clock output */
65
66struct clk clk_fout_bpll = {
67 .name = "fout_bpll",
68 .id = -1,
69};
70
71struct clk clk_fout_bpll_div2 = {
72 .name = "fout_bpll_div2",
73 .id = -1,
74};
75
76/* CPLL clock output */
77
78struct clk clk_fout_cpll = {
79 .name = "fout_cpll",
80 .id = -1,
81};
82
83/* MPLL clock output
84 * No need .ctrlbit, this is always on
85*/
86struct clk clk_fout_mpll = {
87 .name = "fout_mpll",
88 .id = -1,
89};
90
91struct clk clk_fout_mpll_div2 = {
92 .name = "fout_mpll_div2",
93 .id = -1,
94};
95
96/* EPLL clock output */
97struct clk clk_fout_epll = {
98 .name = "fout_epll",
99 .id = -1,
100 .ctrlbit = (1 << 31),
101};
102
103/* DPLL clock output */
104struct clk clk_fout_dpll = {
105 .name = "fout_dpll",
106 .id = -1,
107 .ctrlbit = (1 << 31),
108};
109
110/* VPLL clock output */
111struct clk clk_fout_vpll = {
112 .name = "fout_vpll",
113 .id = -1,
114 .ctrlbit = (1 << 31),
115};
116
117/* Possible clock sources for APLL Mux */
118static struct clk *clk_src_apll_list[] = {
119 [0] = &clk_fin_apll,
120 [1] = &clk_fout_apll,
121};
122
123struct clksrc_sources clk_src_apll = {
124 .sources = clk_src_apll_list,
125 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
126};
127
128/* Possible clock sources for BPLL Mux */
129static struct clk *clk_src_bpll_list[] = {
130 [0] = &clk_fin_bpll,
131 [1] = &clk_fout_bpll,
132};
133
134struct clksrc_sources clk_src_bpll = {
135 .sources = clk_src_bpll_list,
136 .nr_sources = ARRAY_SIZE(clk_src_bpll_list),
137};
138
139static struct clk *clk_src_bpll_fout_list[] = {
140 [0] = &clk_fout_bpll_div2,
141 [1] = &clk_fout_bpll,
142};
143
144struct clksrc_sources clk_src_bpll_fout = {
145 .sources = clk_src_bpll_fout_list,
146 .nr_sources = ARRAY_SIZE(clk_src_bpll_fout_list),
147};
148
149/* Possible clock sources for CPLL Mux */
150static struct clk *clk_src_cpll_list[] = {
151 [0] = &clk_fin_cpll,
152 [1] = &clk_fout_cpll,
153};
154
155struct clksrc_sources clk_src_cpll = {
156 .sources = clk_src_cpll_list,
157 .nr_sources = ARRAY_SIZE(clk_src_cpll_list),
158};
159
160/* Possible clock sources for MPLL Mux */
161static struct clk *clk_src_mpll_list[] = {
162 [0] = &clk_fin_mpll,
163 [1] = &clk_fout_mpll,
164};
165
166struct clksrc_sources clk_src_mpll = {
167 .sources = clk_src_mpll_list,
168 .nr_sources = ARRAY_SIZE(clk_src_mpll_list),
169};
170
171static struct clk *clk_src_mpll_fout_list[] = {
172 [0] = &clk_fout_mpll_div2,
173 [1] = &clk_fout_mpll,
174};
175
176struct clksrc_sources clk_src_mpll_fout = {
177 .sources = clk_src_mpll_fout_list,
178 .nr_sources = ARRAY_SIZE(clk_src_mpll_fout_list),
179};
180
181/* Possible clock sources for EPLL Mux */
182static struct clk *clk_src_epll_list[] = {
183 [0] = &clk_fin_epll,
184 [1] = &clk_fout_epll,
185};
186
187struct clksrc_sources clk_src_epll = {
188 .sources = clk_src_epll_list,
189 .nr_sources = ARRAY_SIZE(clk_src_epll_list),
190};
191
192/* Possible clock sources for DPLL Mux */
193static struct clk *clk_src_dpll_list[] = {
194 [0] = &clk_fin_dpll,
195 [1] = &clk_fout_dpll,
196};
197
198struct clksrc_sources clk_src_dpll = {
199 .sources = clk_src_dpll_list,
200 .nr_sources = ARRAY_SIZE(clk_src_dpll_list),
201};
202
203struct clk clk_vpll = {
204 .name = "vpll",
205 .id = -1,
206};
207
208int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable)
209{
210 unsigned int ctrlbit = clk->ctrlbit;
211 u32 con;
212
213 con = __raw_readl(reg);
214 con = enable ? (con | ctrlbit) : (con & ~ctrlbit);
215 __raw_writel(con, reg);
216 return 0;
217}
218
219int s5p_epll_enable(struct clk *clk, int enable)
220{
221 unsigned int ctrlbit = clk->ctrlbit;
222 unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit;
223
224 if (enable)
225 __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON);
226 else
227 __raw_writel(epll_con, S5P_EPLL_CON);
228
229 return 0;
230}
231
232unsigned long s5p_epll_get_rate(struct clk *clk)
233{
234 return clk->rate;
235}
236
237int s5p_spdif_set_rate(struct clk *clk, unsigned long rate)
238{
239 struct clk *pclk;
240 int ret;
241
242 pclk = clk_get_parent(clk);
243 if (IS_ERR(pclk))
244 return -EINVAL;
245
246 ret = pclk->ops->set_rate(pclk, rate);
247 clk_put(pclk);
248
249 return ret;
250}
251
252unsigned long s5p_spdif_get_rate(struct clk *clk)
253{
254 struct clk *pclk;
255 int rate;
256
257 pclk = clk_get_parent(clk);
258 if (IS_ERR(pclk))
259 return -EINVAL;
260
261 rate = pclk->ops->get_rate(pclk);
262 clk_put(pclk);
263
264 return rate;
265}
266
267struct clk_ops s5p_sclk_spdif_ops = {
268 .set_rate = s5p_spdif_set_rate,
269 .get_rate = s5p_spdif_get_rate,
270};
271
272static struct clk *s5p_clks[] __initdata = {
273 &clk_ext_xtal_mux,
274 &clk_48m,
275 &s5p_clk_27m,
276 &clk_fout_apll,
277 &clk_fout_mpll,
278 &clk_fout_epll,
279 &clk_fout_dpll,
280 &clk_fout_vpll,
281 &clk_vpll,
282 &clk_xusbxti,
283};
284
285void __init s5p_register_clocks(unsigned long xtal_freq)
286{
287 int ret;
288
289 clk_ext_xtal_mux.rate = xtal_freq;
290
291 ret = s3c24xx_register_clocks(s5p_clks, ARRAY_SIZE(s5p_clks));
292 if (ret > 0)
293 printk(KERN_ERR "Failed to register s5p clocks\n");
294}
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index 469b86260fe3..0b04b6b0fa30 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -17,56 +17,16 @@
17#include <linux/of_fdt.h> 17#include <linux/of_fdt.h>
18#include <linux/of.h> 18#include <linux/of.h>
19 19
20#include <plat/mfc.h>
21
22#ifdef CONFIG_SAMSUNG_ATAGS
23#include <mach/map.h>
24#include <mach/irqs.h>
25#include <plat/devs.h>
26
27static struct resource s5p_mfc_resource[] = {
28 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
29 [1] = DEFINE_RES_IRQ(IRQ_MFC),
30};
31
32struct platform_device s5p_device_mfc = {
33 .name = "s5p-mfc",
34 .id = -1,
35 .num_resources = ARRAY_SIZE(s5p_mfc_resource),
36 .resource = s5p_mfc_resource,
37};
38
39/*
40 * MFC hardware has 2 memory interfaces which are modelled as two separate
41 * platform devices to let dma-mapping distinguish between them.
42 *
43 * MFC parent device (s5p_device_mfc) must be registered before memory
44 * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
45 */
46
47struct platform_device s5p_device_mfc_l = {
48 .name = "s5p-mfc-l",
49 .id = -1,
50 .dev = {
51 .parent = &s5p_device_mfc.dev,
52 .dma_mask = &s5p_device_mfc_l.dev.coherent_dma_mask,
53 .coherent_dma_mask = DMA_BIT_MASK(32),
54 },
55};
56
57struct platform_device s5p_device_mfc_r = {
58 .name = "s5p-mfc-r",
59 .id = -1,
60 .dev = {
61 .parent = &s5p_device_mfc.dev,
62 .dma_mask = &s5p_device_mfc_r.dev.coherent_dma_mask,
63 .coherent_dma_mask = DMA_BIT_MASK(32),
64 },
65};
66#else
67static struct platform_device s5p_device_mfc_l; 20static struct platform_device s5p_device_mfc_l;
68static struct platform_device s5p_device_mfc_r; 21static struct platform_device s5p_device_mfc_r;
69#endif 22
23struct s5p_mfc_dt_meminfo {
24 unsigned long loff;
25 unsigned long lsize;
26 unsigned long roff;
27 unsigned long rsize;
28 char *compatible;
29};
70 30
71struct s5p_mfc_reserved_mem { 31struct s5p_mfc_reserved_mem {
72 phys_addr_t base; 32 phys_addr_t base;
@@ -77,7 +37,7 @@ struct s5p_mfc_reserved_mem {
77static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata; 37static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
78 38
79 39
80void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, 40static void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
81 phys_addr_t lbase, unsigned int lsize) 41 phys_addr_t lbase, unsigned int lsize)
82{ 42{
83 int i; 43 int i;
@@ -100,28 +60,6 @@ void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
100 } 60 }
101} 61}
102 62
103#ifdef CONFIG_SAMSUNG_ATAGS
104static int __init s5p_mfc_memory_init(void)
105{
106 int i;
107
108 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
109 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
110 if (!area->base)
111 continue;
112
113 if (dma_declare_coherent_memory(area->dev, area->base,
114 area->base, area->size,
115 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0)
116 printk(KERN_ERR "Failed to declare coherent memory for MFC device (%ld bytes at 0x%08lx)\n",
117 area->size, (unsigned long) area->base);
118 }
119 return 0;
120}
121device_initcall(s5p_mfc_memory_init);
122#endif
123
124#ifdef CONFIG_OF
125int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname, 63int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
126 int depth, void *data) 64 int depth, void *data)
127{ 65{
@@ -154,4 +92,3 @@ int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
154 92
155 return 1; 93 return 1;
156} 94}
157#endif
diff --git a/arch/arm/plat-samsung/s5p-dev-uart.c b/arch/arm/plat-samsung/s5p-dev-uart.c
deleted file mode 100644
index 8c4487af98c8..000000000000
--- a/arch/arm/plat-samsung/s5p-dev-uart.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (c) 2009,2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/
4 *
5 * Base S5P UART resource and device definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/ioport.h>
17#include <linux/platform_device.h>
18
19#include <asm/mach/arch.h>
20#include <asm/mach/irq.h>
21#include <mach/map.h>
22
23#include <plat/devs.h>
24
25 /* Serial port registrations */
26
27static struct resource s5p_uart0_resource[] = {
28 [0] = DEFINE_RES_MEM(S5P_PA_UART0, S5P_SZ_UART),
29 [1] = DEFINE_RES_IRQ(IRQ_UART0),
30};
31
32static struct resource s5p_uart1_resource[] = {
33 [0] = DEFINE_RES_MEM(S5P_PA_UART1, S5P_SZ_UART),
34 [1] = DEFINE_RES_IRQ(IRQ_UART1),
35};
36
37static struct resource s5p_uart2_resource[] = {
38 [0] = DEFINE_RES_MEM(S5P_PA_UART2, S5P_SZ_UART),
39 [1] = DEFINE_RES_IRQ(IRQ_UART2),
40};
41
42static struct resource s5p_uart3_resource[] = {
43#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
44 [0] = DEFINE_RES_MEM(S5P_PA_UART3, S5P_SZ_UART),
45 [1] = DEFINE_RES_IRQ(IRQ_UART3),
46#endif
47};
48
49static struct resource s5p_uart4_resource[] = {
50#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
51 [0] = DEFINE_RES_MEM(S5P_PA_UART4, S5P_SZ_UART),
52 [1] = DEFINE_RES_IRQ(IRQ_UART4),
53#endif
54};
55
56static struct resource s5p_uart5_resource[] = {
57#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
58 [0] = DEFINE_RES_MEM(S5P_PA_UART5, S5P_SZ_UART),
59 [1] = DEFINE_RES_IRQ(IRQ_UART5),
60#endif
61};
62
63struct s3c24xx_uart_resources s5p_uart_resources[] __initdata = {
64 [0] = {
65 .resources = s5p_uart0_resource,
66 .nr_resources = ARRAY_SIZE(s5p_uart0_resource),
67 },
68 [1] = {
69 .resources = s5p_uart1_resource,
70 .nr_resources = ARRAY_SIZE(s5p_uart1_resource),
71 },
72 [2] = {
73 .resources = s5p_uart2_resource,
74 .nr_resources = ARRAY_SIZE(s5p_uart2_resource),
75 },
76 [3] = {
77 .resources = s5p_uart3_resource,
78 .nr_resources = ARRAY_SIZE(s5p_uart3_resource),
79 },
80 [4] = {
81 .resources = s5p_uart4_resource,
82 .nr_resources = ARRAY_SIZE(s5p_uart4_resource),
83 },
84 [5] = {
85 .resources = s5p_uart5_resource,
86 .nr_resources = ARRAY_SIZE(s5p_uart5_resource),
87 },
88};
diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c b/arch/arm/plat-samsung/s5p-irq-eint.c
deleted file mode 100644
index ebee4dc11a94..000000000000
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * S5P - IRQ EINT support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <linux/device.h>
17#include <linux/gpio.h>
18#include <linux/irqchip/arm-vic.h>
19#include <linux/of.h>
20
21#include <plat/regs-irqtype.h>
22
23#include <mach/map.h>
24#include <plat/cpu.h>
25#include <plat/pm.h>
26
27#include <plat/gpio-cfg.h>
28#include <mach/regs-gpio.h>
29
30static inline void s5p_irq_eint_mask(struct irq_data *data)
31{
32 u32 mask;
33
34 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
35 mask |= eint_irq_to_bit(data->irq);
36 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
37}
38
39static void s5p_irq_eint_unmask(struct irq_data *data)
40{
41 u32 mask;
42
43 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
44 mask &= ~(eint_irq_to_bit(data->irq));
45 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
46}
47
48static inline void s5p_irq_eint_ack(struct irq_data *data)
49{
50 __raw_writel(eint_irq_to_bit(data->irq),
51 S5P_EINT_PEND(EINT_REG_NR(data->irq)));
52}
53
54static void s5p_irq_eint_maskack(struct irq_data *data)
55{
56 /* compiler should in-line these */
57 s5p_irq_eint_mask(data);
58 s5p_irq_eint_ack(data);
59}
60
61static int s5p_irq_eint_set_type(struct irq_data *data, unsigned int type)
62{
63 int offs = EINT_OFFSET(data->irq);
64 int shift;
65 u32 ctrl, mask;
66 u32 newvalue = 0;
67
68 switch (type) {
69 case IRQ_TYPE_EDGE_RISING:
70 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
71 break;
72
73 case IRQ_TYPE_EDGE_FALLING:
74 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
75 break;
76
77 case IRQ_TYPE_EDGE_BOTH:
78 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
79 break;
80
81 case IRQ_TYPE_LEVEL_LOW:
82 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
83 break;
84
85 case IRQ_TYPE_LEVEL_HIGH:
86 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
87 break;
88
89 default:
90 printk(KERN_ERR "No such irq type %d", type);
91 return -EINVAL;
92 }
93
94 shift = (offs & 0x7) * 4;
95 mask = 0x7 << shift;
96
97 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq)));
98 ctrl &= ~mask;
99 ctrl |= newvalue << shift;
100 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq)));
101
102 if ((0 <= offs) && (offs < 8))
103 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE);
104
105 else if ((8 <= offs) && (offs < 16))
106 s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE);
107
108 else if ((16 <= offs) && (offs < 24))
109 s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE);
110
111 else if ((24 <= offs) && (offs < 32))
112 s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE);
113
114 else
115 printk(KERN_ERR "No such irq number %d", offs);
116
117 return 0;
118}
119
120static struct irq_chip s5p_irq_eint = {
121 .name = "s5p-eint",
122 .irq_mask = s5p_irq_eint_mask,
123 .irq_unmask = s5p_irq_eint_unmask,
124 .irq_mask_ack = s5p_irq_eint_maskack,
125 .irq_ack = s5p_irq_eint_ack,
126 .irq_set_type = s5p_irq_eint_set_type,
127#ifdef CONFIG_PM
128 .irq_set_wake = s3c_irqext_wake,
129#endif
130};
131
132/* s5p_irq_demux_eint
133 *
134 * This function demuxes the IRQ from the group0 external interrupts,
135 * from EINTs 16 to 31. It is designed to be inlined into the specific
136 * handler s5p_irq_demux_eintX_Y.
137 *
138 * Each EINT pend/mask registers handle eight of them.
139 */
140static inline void s5p_irq_demux_eint(unsigned int start)
141{
142 u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start)));
143 u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start)));
144 unsigned int irq;
145
146 status &= ~mask;
147 status &= 0xff;
148
149 while (status) {
150 irq = fls(status) - 1;
151 generic_handle_irq(irq + start);
152 status &= ~(1 << irq);
153 }
154}
155
156static void s5p_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
157{
158 s5p_irq_demux_eint(IRQ_EINT(16));
159 s5p_irq_demux_eint(IRQ_EINT(24));
160}
161
162static inline void s5p_irq_vic_eint_mask(struct irq_data *data)
163{
164 void __iomem *base = irq_data_get_irq_chip_data(data);
165
166 s5p_irq_eint_mask(data);
167 writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE_CLEAR);
168}
169
170static void s5p_irq_vic_eint_unmask(struct irq_data *data)
171{
172 void __iomem *base = irq_data_get_irq_chip_data(data);
173
174 s5p_irq_eint_unmask(data);
175 writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE);
176}
177
178static inline void s5p_irq_vic_eint_ack(struct irq_data *data)
179{
180 __raw_writel(eint_irq_to_bit(data->irq),
181 S5P_EINT_PEND(EINT_REG_NR(data->irq)));
182}
183
184static void s5p_irq_vic_eint_maskack(struct irq_data *data)
185{
186 s5p_irq_vic_eint_mask(data);
187 s5p_irq_vic_eint_ack(data);
188}
189
190static struct irq_chip s5p_irq_vic_eint = {
191 .name = "s5p_vic_eint",
192 .irq_mask = s5p_irq_vic_eint_mask,
193 .irq_unmask = s5p_irq_vic_eint_unmask,
194 .irq_mask_ack = s5p_irq_vic_eint_maskack,
195 .irq_ack = s5p_irq_vic_eint_ack,
196 .irq_set_type = s5p_irq_eint_set_type,
197#ifdef CONFIG_PM
198 .irq_set_wake = s3c_irqext_wake,
199#endif
200};
201
202static int __init s5p_init_irq_eint(void)
203{
204 int irq;
205
206 if (of_have_populated_dt())
207 return -ENODEV;
208
209 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
210 irq_set_chip(irq, &s5p_irq_vic_eint);
211
212 for (irq = IRQ_EINT(16); irq <= IRQ_EINT(31); irq++) {
213 irq_set_chip_and_handler(irq, &s5p_irq_eint, handle_level_irq);
214 set_irq_flags(irq, IRQF_VALID);
215 }
216
217 irq_set_chained_handler(IRQ_EINT16_31, s5p_irq_demux_eint16_31);
218 return 0;
219}
220
221arch_initcall(s5p_init_irq_eint);
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c
deleted file mode 100644
index fafdb059043a..000000000000
--- a/arch/arm/plat-samsung/s5p-irq-gpioint.c
+++ /dev/null
@@ -1,218 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * Author: Kyungmin Park <kyungmin.park@samsung.com>
4 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
5 * Author: Marek Szyprowski <m.szyprowski@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/irqchip/chained_irq.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20#include <linux/slab.h>
21
22#include <mach/map.h>
23#include <plat/gpio-core.h>
24#include <plat/gpio-cfg.h>
25
26#define GPIO_BASE(chip) ((void __iomem *)((unsigned long)((chip)->base) & 0xFFFFF000u))
27
28#define CON_OFFSET 0x700
29#define MASK_OFFSET 0x900
30#define PEND_OFFSET 0xA00
31#define REG_OFFSET(x) ((x) << 2)
32
33struct s5p_gpioint_bank {
34 struct list_head list;
35 int start;
36 int nr_groups;
37 int irq;
38 struct samsung_gpio_chip **chips;
39 void (*handler)(unsigned int, struct irq_desc *);
40};
41
42static LIST_HEAD(banks);
43
44static int s5p_gpioint_set_type(struct irq_data *d, unsigned int type)
45{
46 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
47 struct irq_chip_type *ct = gc->chip_types;
48 unsigned int shift = (d->irq - gc->irq_base) << 2;
49
50 switch (type) {
51 case IRQ_TYPE_EDGE_RISING:
52 type = S5P_IRQ_TYPE_EDGE_RISING;
53 break;
54 case IRQ_TYPE_EDGE_FALLING:
55 type = S5P_IRQ_TYPE_EDGE_FALLING;
56 break;
57 case IRQ_TYPE_EDGE_BOTH:
58 type = S5P_IRQ_TYPE_EDGE_BOTH;
59 break;
60 case IRQ_TYPE_LEVEL_HIGH:
61 type = S5P_IRQ_TYPE_LEVEL_HIGH;
62 break;
63 case IRQ_TYPE_LEVEL_LOW:
64 type = S5P_IRQ_TYPE_LEVEL_LOW;
65 break;
66 case IRQ_TYPE_NONE:
67 default:
68 printk(KERN_WARNING "No irq type\n");
69 return -EINVAL;
70 }
71
72 gc->type_cache &= ~(0x7 << shift);
73 gc->type_cache |= type << shift;
74 writel(gc->type_cache, gc->reg_base + ct->regs.type);
75 return 0;
76}
77
78static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
79{
80 struct s5p_gpioint_bank *bank = irq_get_handler_data(irq);
81 int group, pend_offset, mask_offset;
82 unsigned int pend, mask;
83
84 struct irq_chip *chip = irq_get_chip(irq);
85 chained_irq_enter(chip, desc);
86
87 for (group = 0; group < bank->nr_groups; group++) {
88 struct samsung_gpio_chip *chip = bank->chips[group];
89 if (!chip)
90 continue;
91
92 pend_offset = REG_OFFSET(group);
93 pend = __raw_readl(GPIO_BASE(chip) + PEND_OFFSET + pend_offset);
94 if (!pend)
95 continue;
96
97 mask_offset = REG_OFFSET(group);
98 mask = __raw_readl(GPIO_BASE(chip) + MASK_OFFSET + mask_offset);
99 pend &= ~mask;
100
101 while (pend) {
102 int offset = fls(pend) - 1;
103 int real_irq = chip->irq_base + offset;
104 generic_handle_irq(real_irq);
105 pend &= ~BIT(offset);
106 }
107 }
108 chained_irq_exit(chip, desc);
109}
110
111static __init int s5p_gpioint_add(struct samsung_gpio_chip *chip)
112{
113 static int used_gpioint_groups = 0;
114 int group = chip->group;
115 struct s5p_gpioint_bank *b, *bank = NULL;
116 struct irq_chip_generic *gc;
117 struct irq_chip_type *ct;
118
119 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT)
120 return -ENOMEM;
121
122 list_for_each_entry(b, &banks, list) {
123 if (group >= b->start && group < b->start + b->nr_groups) {
124 bank = b;
125 break;
126 }
127 }
128 if (!bank)
129 return -EINVAL;
130
131 if (!bank->handler) {
132 bank->chips = kzalloc(sizeof(struct samsung_gpio_chip *) *
133 bank->nr_groups, GFP_KERNEL);
134 if (!bank->chips)
135 return -ENOMEM;
136
137 irq_set_chained_handler(bank->irq, s5p_gpioint_handler);
138 irq_set_handler_data(bank->irq, bank);
139 bank->handler = s5p_gpioint_handler;
140 printk(KERN_INFO "Registered chained gpio int handler for interrupt %d.\n",
141 bank->irq);
142 }
143
144 /*
145 * chained GPIO irq has been successfully registered, allocate new gpio
146 * int group and assign irq nubmers
147 */
148 chip->irq_base = S5P_GPIOINT_BASE +
149 used_gpioint_groups * S5P_GPIOINT_GROUP_SIZE;
150 used_gpioint_groups++;
151
152 bank->chips[group - bank->start] = chip;
153
154 gc = irq_alloc_generic_chip("s5p_gpioint", 1, chip->irq_base,
155 GPIO_BASE(chip),
156 handle_level_irq);
157 if (!gc)
158 return -ENOMEM;
159 ct = gc->chip_types;
160 ct->chip.irq_ack = irq_gc_ack_set_bit;
161 ct->chip.irq_mask = irq_gc_mask_set_bit;
162 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
163 ct->chip.irq_set_type = s5p_gpioint_set_type,
164 ct->regs.ack = PEND_OFFSET + REG_OFFSET(group - bank->start);
165 ct->regs.mask = MASK_OFFSET + REG_OFFSET(group - bank->start);
166 ct->regs.type = CON_OFFSET + REG_OFFSET(group - bank->start);
167 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio),
168 IRQ_GC_INIT_MASK_CACHE,
169 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
170 return 0;
171}
172
173int __init s5p_register_gpio_interrupt(int pin)
174{
175 struct samsung_gpio_chip *my_chip = samsung_gpiolib_getchip(pin);
176 int offset, group;
177 int ret;
178
179 if (!my_chip)
180 return -EINVAL;
181
182 offset = pin - my_chip->chip.base;
183 group = my_chip->group;
184
185 /* check if the group has been already registered */
186 if (my_chip->irq_base)
187 goto success;
188
189 /* register gpio group */
190 ret = s5p_gpioint_add(my_chip);
191 if (ret == 0) {
192 my_chip->chip.to_irq = samsung_gpiolib_to_irq;
193 printk(KERN_INFO "Registered interrupt support for gpio group %d.\n",
194 group);
195 goto success;
196 }
197 return ret;
198success:
199 my_chip->bitmap_gpio_int |= BIT(offset);
200
201 return my_chip->irq_base + offset;
202}
203
204int __init s5p_register_gpioint_bank(int chain_irq, int start, int nr_groups)
205{
206 struct s5p_gpioint_bank *bank;
207
208 bank = kzalloc(sizeof(*bank), GFP_KERNEL);
209 if (!bank)
210 return -ENOMEM;
211
212 bank->start = start;
213 bank->nr_groups = nr_groups;
214 bank->irq = chain_irq;
215
216 list_add_tail(&bank->list, &banks);
217 return 0;
218}
diff --git a/arch/arm/plat-samsung/s5p-irq-pm.c b/arch/arm/plat-samsung/s5p-irq-pm.c
deleted file mode 100644
index 52b16943617e..000000000000
--- a/arch/arm/plat-samsung/s5p-irq-pm.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Based on arch/arm/plat-s3c24xx/irq-pm.c,
6 * Copyright (c) 2003,2004 Simtec Electronics
7 * Ben Dooks <ben@simtec.co.uk>
8 * http://armlinux.simtec.co.uk/
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/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18
19#include <plat/cpu.h>
20#include <plat/irqs.h>
21#include <plat/pm.h>
22#include <mach/map.h>
23
24#include <mach/regs-gpio.h>
25#include <mach/regs-irq.h>
26
27/* state for IRQs over sleep */
28
29/* default is to allow for EINT0..EINT31, and IRQ_RTC_TIC, IRQ_RTC_ALARM,
30 * as wakeup sources
31 *
32 * set bit to 1 in allow bitfield to enable the wakeup settings on it
33*/
34
35unsigned long s3c_irqwake_intallow = 0x00000006L;
36unsigned long s3c_irqwake_eintallow = 0xffffffffL;
37
38int s3c_irq_wake(struct irq_data *data, unsigned int state)
39{
40 unsigned long irqbit;
41 unsigned int irq_rtc_tic, irq_rtc_alarm;
42
43 irq_rtc_tic = IRQ_RTC_TIC;
44 irq_rtc_alarm = IRQ_RTC_ALARM;
45
46 if (data->irq == irq_rtc_tic || data->irq == irq_rtc_alarm) {
47 irqbit = 1 << (data->irq + 1 - irq_rtc_alarm);
48
49 if (!state)
50 s3c_irqwake_intmask |= irqbit;
51 else
52 s3c_irqwake_intmask &= ~irqbit;
53 } else {
54 return -ENOENT;
55 }
56
57 return 0;
58}
59
60static struct sleep_save eint_save[] = {
61 SAVE_ITEM(S5P_EINT_CON(0)),
62 SAVE_ITEM(S5P_EINT_CON(1)),
63 SAVE_ITEM(S5P_EINT_CON(2)),
64 SAVE_ITEM(S5P_EINT_CON(3)),
65
66 SAVE_ITEM(S5P_EINT_FLTCON(0)),
67 SAVE_ITEM(S5P_EINT_FLTCON(1)),
68 SAVE_ITEM(S5P_EINT_FLTCON(2)),
69 SAVE_ITEM(S5P_EINT_FLTCON(3)),
70 SAVE_ITEM(S5P_EINT_FLTCON(4)),
71 SAVE_ITEM(S5P_EINT_FLTCON(5)),
72 SAVE_ITEM(S5P_EINT_FLTCON(6)),
73 SAVE_ITEM(S5P_EINT_FLTCON(7)),
74
75 SAVE_ITEM(S5P_EINT_MASK(0)),
76 SAVE_ITEM(S5P_EINT_MASK(1)),
77 SAVE_ITEM(S5P_EINT_MASK(2)),
78 SAVE_ITEM(S5P_EINT_MASK(3)),
79};
80
81int s3c24xx_irq_suspend(void)
82{
83 s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
84
85 return 0;
86}
87
88void s3c24xx_irq_resume(void)
89{
90 s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
91}
92
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
deleted file mode 100644
index ddfaca9c79d8..000000000000
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/
4 *
5 * S5P - Interrupt handling
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/interrupt.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <linux/irqchip/arm-vic.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20#include <plat/cpu.h>
21
22void __init s5p_init_irq(u32 *vic, u32 num_vic)
23{
24#ifdef CONFIG_ARM_VIC
25 int irq;
26
27 /* initialize the VICs */
28 for (irq = 0; irq < num_vic; irq++)
29 vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
30#endif
31}
diff --git a/arch/arm/plat-samsung/s5p-pm.c b/arch/arm/plat-samsung/s5p-pm.c
deleted file mode 100644
index 0747468f0936..000000000000
--- a/arch/arm/plat-samsung/s5p-pm.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * S5P Power Manager (Suspend-To-RAM) support
6 *
7 * Based on arch/arm/plat-s3c24xx/pm.c
8 * Copyright (c) 2004,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/suspend.h>
17#include <plat/pm.h>
18
19#define PFX "s5p pm: "
20
21/* s3c_pm_configure_extint
22 *
23 * configure all external interrupt pins
24*/
25
26void s3c_pm_configure_extint(void)
27{
28 /* nothing here yet */
29}
30
31void s3c_pm_restore_core(void)
32{
33 /* nothing here yet */
34}
35
36void s3c_pm_save_core(void)
37{
38 /* nothing here yet */
39}
40
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index fce41e93b6a4..a301ca2c7d00 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -3,9 +3,6 @@ if PLAT_VERSATILE
3config PLAT_VERSATILE_CLOCK 3config PLAT_VERSATILE_CLOCK
4 bool 4 bool
5 5
6config PLAT_VERSATILE_CLCD
7 bool
8
9config PLAT_VERSATILE_SCHED_CLOCK 6config PLAT_VERSATILE_SCHED_CLOCK
10 def_bool y 7 def_bool y
11 8
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 2e0c472958ae..03c4900ac3f4 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -1,6 +1,5 @@
1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include 1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
2 2
3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o 3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o
4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
5obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o 4obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
6obj-$(CONFIG_SMP) += headsmp.o platsmp.o 5obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/plat-versatile/clcd.c b/arch/arm/plat-versatile/clcd.c
deleted file mode 100644
index 6628cc27efc5..000000000000
--- a/arch/arm/plat-versatile/clcd.c
+++ /dev/null
@@ -1,182 +0,0 @@
1#include <linux/device.h>
2#include <linux/dma-mapping.h>
3#include <linux/amba/bus.h>
4#include <linux/amba/clcd.h>
5#include <plat/clcd.h>
6
7static struct clcd_panel vga = {
8 .mode = {
9 .name = "VGA",
10 .refresh = 60,
11 .xres = 640,
12 .yres = 480,
13 .pixclock = 39721,
14 .left_margin = 40,
15 .right_margin = 24,
16 .upper_margin = 32,
17 .lower_margin = 11,
18 .hsync_len = 96,
19 .vsync_len = 2,
20 .sync = 0,
21 .vmode = FB_VMODE_NONINTERLACED,
22 },
23 .width = -1,
24 .height = -1,
25 .tim2 = TIM2_BCD | TIM2_IPC,
26 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
27 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
28 .bpp = 16,
29};
30
31static struct clcd_panel xvga = {
32 .mode = {
33 .name = "XVGA",
34 .refresh = 60,
35 .xres = 1024,
36 .yres = 768,
37 .pixclock = 15748,
38 .left_margin = 152,
39 .right_margin = 48,
40 .upper_margin = 23,
41 .lower_margin = 3,
42 .hsync_len = 104,
43 .vsync_len = 4,
44 .sync = 0,
45 .vmode = FB_VMODE_NONINTERLACED,
46 },
47 .width = -1,
48 .height = -1,
49 .tim2 = TIM2_BCD | TIM2_IPC,
50 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
51 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
52 .bpp = 16,
53};
54
55/* Sanyo TM38QV67A02A - 3.8 inch QVGA (320x240) Color TFT */
56static struct clcd_panel sanyo_tm38qv67a02a = {
57 .mode = {
58 .name = "Sanyo TM38QV67A02A",
59 .refresh = 116,
60 .xres = 320,
61 .yres = 240,
62 .pixclock = 100000,
63 .left_margin = 6,
64 .right_margin = 6,
65 .upper_margin = 5,
66 .lower_margin = 5,
67 .hsync_len = 6,
68 .vsync_len = 6,
69 .sync = 0,
70 .vmode = FB_VMODE_NONINTERLACED,
71 },
72 .width = -1,
73 .height = -1,
74 .tim2 = TIM2_BCD,
75 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
76 .caps = CLCD_CAP_5551,
77 .bpp = 16,
78};
79
80static struct clcd_panel sanyo_2_5_in = {
81 .mode = {
82 .name = "Sanyo QVGA Portrait",
83 .refresh = 116,
84 .xres = 240,
85 .yres = 320,
86 .pixclock = 100000,
87 .left_margin = 20,
88 .right_margin = 10,
89 .upper_margin = 2,
90 .lower_margin = 2,
91 .hsync_len = 10,
92 .vsync_len = 2,
93 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
94 .vmode = FB_VMODE_NONINTERLACED,
95 },
96 .width = -1,
97 .height = -1,
98 .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC,
99 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
100 .caps = CLCD_CAP_5551,
101 .bpp = 16,
102};
103
104/* Epson L2F50113T00 - 2.2 inch 176x220 Color TFT */
105static struct clcd_panel epson_l2f50113t00 = {
106 .mode = {
107 .name = "Epson L2F50113T00",
108 .refresh = 390,
109 .xres = 176,
110 .yres = 220,
111 .pixclock = 62500,
112 .left_margin = 3,
113 .right_margin = 2,
114 .upper_margin = 1,
115 .lower_margin = 0,
116 .hsync_len = 3,
117 .vsync_len = 2,
118 .sync = 0,
119 .vmode = FB_VMODE_NONINTERLACED,
120 },
121 .width = -1,
122 .height = -1,
123 .tim2 = TIM2_BCD | TIM2_IPC,
124 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
125 .caps = CLCD_CAP_5551,
126 .bpp = 16,
127};
128
129static struct clcd_panel *panels[] = {
130 &vga,
131 &xvga,
132 &sanyo_tm38qv67a02a,
133 &sanyo_2_5_in,
134 &epson_l2f50113t00,
135};
136
137struct clcd_panel *versatile_clcd_get_panel(const char *name)
138{
139 int i;
140
141 for (i = 0; i < ARRAY_SIZE(panels); i++)
142 if (strcmp(panels[i]->mode.name, name) == 0)
143 break;
144
145 if (i < ARRAY_SIZE(panels))
146 return panels[i];
147
148 pr_err("CLCD: couldn't get parameters for panel %s\n", name);
149
150 return NULL;
151}
152
153int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
154{
155 dma_addr_t dma;
156
157 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
158 &dma, GFP_KERNEL);
159 if (!fb->fb.screen_base) {
160 pr_err("CLCD: unable to map framebuffer\n");
161 return -ENOMEM;
162 }
163
164 fb->fb.fix.smem_start = dma;
165 fb->fb.fix.smem_len = framesize;
166
167 return 0;
168}
169
170int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vma)
171{
172 return dma_mmap_writecombine(&fb->dev->dev, vma,
173 fb->fb.screen_base,
174 fb->fb.fix.smem_start,
175 fb->fb.fix.smem_len);
176}
177
178void versatile_clcd_remove_dma(struct clcd_fb *fb)
179{
180 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
181 fb->fb.screen_base, fb->fb.fix.smem_start);
182}
diff --git a/arch/arm/plat-versatile/include/plat/clcd.h b/arch/arm/plat-versatile/include/plat/clcd.h
deleted file mode 100644
index 6bb6a1d2019b..000000000000
--- a/arch/arm/plat-versatile/include/plat/clcd.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4struct clcd_panel *versatile_clcd_get_panel(const char *);
5int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
6int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
7void versatile_clcd_remove_dma(struct clcd_fb *);
8
9#endif
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index fe6ca574d093..2e78760f3495 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -34,7 +34,7 @@ ENDPROC(do_vfp)
34 34
35ENTRY(vfp_null_entry) 35ENTRY(vfp_null_entry)
36 dec_preempt_count_ti r10, r4 36 dec_preempt_count_ti r10, r4
37 mov pc, lr 37 ret lr
38ENDPROC(vfp_null_entry) 38ENDPROC(vfp_null_entry)
39 39
40 .align 2 40 .align 2
@@ -49,7 +49,7 @@ ENTRY(vfp_testing_entry)
49 dec_preempt_count_ti r10, r4 49 dec_preempt_count_ti r10, r4
50 ldr r0, VFP_arch_address 50 ldr r0, VFP_arch_address
51 str r0, [r0] @ set to non-zero value 51 str r0, [r0] @ set to non-zero value
52 mov pc, r9 @ we have handled the fault 52 ret r9 @ we have handled the fault
53ENDPROC(vfp_testing_entry) 53ENDPROC(vfp_testing_entry)
54 54
55 .align 2 55 .align 2
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index be807625ed8c..cda654cbf2c2 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -183,7 +183,7 @@ vfp_hw_state_valid:
183 @ always subtract 4 from the following 183 @ always subtract 4 from the following
184 @ instruction address. 184 @ instruction address.
185 dec_preempt_count_ti r10, r4 185 dec_preempt_count_ti r10, r4
186 mov pc, r9 @ we think we have handled things 186 ret r9 @ we think we have handled things
187 187
188 188
189look_for_VFP_exceptions: 189look_for_VFP_exceptions:
@@ -202,7 +202,7 @@ look_for_VFP_exceptions:
202 202
203 DBGSTR "not VFP" 203 DBGSTR "not VFP"
204 dec_preempt_count_ti r10, r4 204 dec_preempt_count_ti r10, r4
205 mov pc, lr 205 ret lr
206 206
207process_exception: 207process_exception:
208 DBGSTR "bounce" 208 DBGSTR "bounce"
@@ -234,7 +234,7 @@ ENTRY(vfp_save_state)
234 VFPFMRX r12, FPINST2 @ FPINST2 if needed (and present) 234 VFPFMRX r12, FPINST2 @ FPINST2 if needed (and present)
2351: 2351:
236 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 236 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2
237 mov pc, lr 237 ret lr
238ENDPROC(vfp_save_state) 238ENDPROC(vfp_save_state)
239 239
240 .align 240 .align
@@ -245,7 +245,7 @@ vfp_current_hw_state_address:
245#ifdef CONFIG_THUMB2_KERNEL 245#ifdef CONFIG_THUMB2_KERNEL
246 adr \tmp, 1f 246 adr \tmp, 1f
247 add \tmp, \tmp, \base, lsl \shift 247 add \tmp, \tmp, \base, lsl \shift
248 mov pc, \tmp 248 ret \tmp
249#else 249#else
250 add pc, pc, \base, lsl \shift 250 add pc, pc, \base, lsl \shift
251 mov r0, r0 251 mov r0, r0
@@ -257,10 +257,10 @@ ENTRY(vfp_get_float)
257 tbl_branch r0, r3, #3 257 tbl_branch r0, r3, #3
258 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 258 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
2591: mrc p10, 0, r0, c\dr, c0, 0 @ fmrs r0, s0 2591: mrc p10, 0, r0, c\dr, c0, 0 @ fmrs r0, s0
260 mov pc, lr 260 ret lr
261 .org 1b + 8 261 .org 1b + 8
2621: mrc p10, 0, r0, c\dr, c0, 4 @ fmrs r0, s1 2621: mrc p10, 0, r0, c\dr, c0, 4 @ fmrs r0, s1
263 mov pc, lr 263 ret lr
264 .org 1b + 8 264 .org 1b + 8
265 .endr 265 .endr
266ENDPROC(vfp_get_float) 266ENDPROC(vfp_get_float)
@@ -269,10 +269,10 @@ ENTRY(vfp_put_float)
269 tbl_branch r1, r3, #3 269 tbl_branch r1, r3, #3
270 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 270 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
2711: mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0 2711: mcr p10, 0, r0, c\dr, c0, 0 @ fmsr r0, s0
272 mov pc, lr 272 ret lr
273 .org 1b + 8 273 .org 1b + 8
2741: mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1 2741: mcr p10, 0, r0, c\dr, c0, 4 @ fmsr r0, s1
275 mov pc, lr 275 ret lr
276 .org 1b + 8 276 .org 1b + 8
277 .endr 277 .endr
278ENDPROC(vfp_put_float) 278ENDPROC(vfp_put_float)
@@ -281,14 +281,14 @@ ENTRY(vfp_get_double)
281 tbl_branch r0, r3, #3 281 tbl_branch r0, r3, #3
282 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 282 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
2831: fmrrd r0, r1, d\dr 2831: fmrrd r0, r1, d\dr
284 mov pc, lr 284 ret lr
285 .org 1b + 8 285 .org 1b + 8
286 .endr 286 .endr
287#ifdef CONFIG_VFPv3 287#ifdef CONFIG_VFPv3
288 @ d16 - d31 registers 288 @ d16 - d31 registers
289 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 289 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
2901: mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr 2901: mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr
291 mov pc, lr 291 ret lr
292 .org 1b + 8 292 .org 1b + 8
293 .endr 293 .endr
294#endif 294#endif
@@ -296,21 +296,21 @@ ENTRY(vfp_get_double)
296 @ virtual register 16 (or 32 if VFPv3) for compare with zero 296 @ virtual register 16 (or 32 if VFPv3) for compare with zero
297 mov r0, #0 297 mov r0, #0
298 mov r1, #0 298 mov r1, #0
299 mov pc, lr 299 ret lr
300ENDPROC(vfp_get_double) 300ENDPROC(vfp_get_double)
301 301
302ENTRY(vfp_put_double) 302ENTRY(vfp_put_double)
303 tbl_branch r2, r3, #3 303 tbl_branch r2, r3, #3
304 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 304 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
3051: fmdrr d\dr, r0, r1 3051: fmdrr d\dr, r0, r1
306 mov pc, lr 306 ret lr
307 .org 1b + 8 307 .org 1b + 8
308 .endr 308 .endr
309#ifdef CONFIG_VFPv3 309#ifdef CONFIG_VFPv3
310 @ d16 - d31 registers 310 @ d16 - d31 registers
311 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 311 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
3121: mcrr p11, 3, r0, r1, c\dr @ fmdrr r0, r1, d\dr 3121: mcrr p11, 3, r0, r1, c\dr @ fmdrr r0, r1, d\dr
313 mov pc, lr 313 ret lr
314 .org 1b + 8 314 .org 1b + 8
315 .endr 315 .endr
316#endif 316#endif
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 1e632430570b..98544c5f86e9 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -181,8 +181,7 @@ static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
181 struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; 181 struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
182 int rc; 182 int rc;
183 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); 183 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
184 if (rc) 184 BUG_ON(rc);
185 BUG();
186} 185}
187 186
188static void xen_power_off(void) 187static void xen_power_off(void)
@@ -190,8 +189,7 @@ static void xen_power_off(void)
190 struct sched_shutdown r = { .reason = SHUTDOWN_poweroff }; 189 struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
191 int rc; 190 int rc;
192 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); 191 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
193 if (rc) 192 BUG_ON(rc);
194 BUG();
195} 193}
196 194
197static int xen_cpu_notification(struct notifier_block *self, 195static int xen_cpu_notification(struct notifier_block *self,
diff --git a/arch/arm/xen/grant-table.c b/arch/arm/xen/grant-table.c
index 91cf08ba1e95..e43791829ace 100644
--- a/arch/arm/xen/grant-table.c
+++ b/arch/arm/xen/grant-table.c
@@ -45,14 +45,7 @@ void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
45 return; 45 return;
46} 46}
47 47
48int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, 48int arch_gnttab_init(unsigned long nr_shared)
49 unsigned long max_nr_gframes,
50 grant_status_t **__shared)
51{
52 return -ENOSYS;
53}
54
55int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status)
56{ 49{
57 return 0; 50 return 0;
58} 51}
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
index 44e3a5f10c4c..f00e08075938 100644
--- a/arch/arm/xen/hypercall.S
+++ b/arch/arm/xen/hypercall.S
@@ -58,7 +58,7 @@
58ENTRY(HYPERVISOR_##hypercall) \ 58ENTRY(HYPERVISOR_##hypercall) \
59 mov r12, #__HYPERVISOR_##hypercall; \ 59 mov r12, #__HYPERVISOR_##hypercall; \
60 __HVC(XEN_IMM); \ 60 __HVC(XEN_IMM); \
61 mov pc, lr; \ 61 ret lr; \
62ENDPROC(HYPERVISOR_##hypercall) 62ENDPROC(HYPERVISOR_##hypercall)
63 63
64#define HYPERCALL0 HYPERCALL_SIMPLE 64#define HYPERCALL0 HYPERCALL_SIMPLE
@@ -74,7 +74,7 @@ ENTRY(HYPERVISOR_##hypercall) \
74 mov r12, #__HYPERVISOR_##hypercall; \ 74 mov r12, #__HYPERVISOR_##hypercall; \
75 __HVC(XEN_IMM); \ 75 __HVC(XEN_IMM); \
76 ldm sp!, {r4} \ 76 ldm sp!, {r4} \
77 mov pc, lr \ 77 ret lr \
78ENDPROC(HYPERVISOR_##hypercall) 78ENDPROC(HYPERVISOR_##hypercall)
79 79
80 .text 80 .text
@@ -101,5 +101,5 @@ ENTRY(privcmd_call)
101 ldr r4, [sp, #4] 101 ldr r4, [sp, #4]
102 __HVC(XEN_IMM) 102 __HVC(XEN_IMM)
103 ldm sp!, {r4} 103 ldm sp!, {r4}
104 mov pc, lr 104 ret lr
105ENDPROC(privcmd_call); 105ENDPROC(privcmd_call);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b0f9c9db9590..fd4e81a4e1ce 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,6 +1,7 @@
1config ARM64 1config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_HAS_SG_CHAIN
4 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
5 select ARCH_USE_CMPXCHG_LOCKREF 6 select ARCH_USE_CMPXCHG_LOCKREF
6 select ARCH_SUPPORTS_ATOMIC_RMW 7 select ARCH_SUPPORTS_ATOMIC_RMW
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index 6541962f5d70..b2f56229aa5e 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -28,3 +28,7 @@
28&serial0 { 28&serial0 {
29 status = "ok"; 29 status = "ok";
30}; 30};
31
32&menet {
33 status = "ok";
34};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index 40aa96ce13c4..c0aceef7f5b3 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -167,14 +167,13 @@
167 clock-output-names = "ethclk"; 167 clock-output-names = "ethclk";
168 }; 168 };
169 169
170 eth8clk: eth8clk { 170 menetclk: menetclk {
171 compatible = "apm,xgene-device-clock"; 171 compatible = "apm,xgene-device-clock";
172 #clock-cells = <1>; 172 #clock-cells = <1>;
173 clocks = <&ethclk 0>; 173 clocks = <&ethclk 0>;
174 clock-names = "eth8clk";
175 reg = <0x0 0x1702C000 0x0 0x1000>; 174 reg = <0x0 0x1702C000 0x0 0x1000>;
176 reg-names = "csr-reg"; 175 reg-names = "csr-reg";
177 clock-output-names = "eth8clk"; 176 clock-output-names = "menetclk";
178 }; 177 };
179 178
180 sataphy1clk: sataphy1clk@1f21c000 { 179 sataphy1clk: sataphy1clk@1f21c000 {
@@ -397,5 +396,30 @@
397 #clock-cells = <1>; 396 #clock-cells = <1>;
398 clocks = <&rtcclk 0>; 397 clocks = <&rtcclk 0>;
399 }; 398 };
399
400 menet: ethernet@17020000 {
401 compatible = "apm,xgene-enet";
402 status = "disabled";
403 reg = <0x0 0x17020000 0x0 0xd100>,
404 <0x0 0X17030000 0x0 0X400>,
405 <0x0 0X10000000 0x0 0X200>;
406 reg-names = "enet_csr", "ring_csr", "ring_cmd";
407 interrupts = <0x0 0x3c 0x4>;
408 dma-coherent;
409 clocks = <&menetclk 0>;
410 local-mac-address = [00 01 73 00 00 01];
411 phy-connection-type = "rgmii";
412 phy-handle = <&menetphy>;
413 mdio {
414 compatible = "apm,xgene-mdio";
415 #address-cells = <1>;
416 #size-cells = <0>;
417 menetphy: menetphy@3 {
418 compatible = "ethernet-phy-id001c.c915";
419 reg = <0x3>;
420 };
421
422 };
423 };
400 }; 424 };
401}; 425};
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 6e9b5b36921c..7fb343779498 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -18,6 +18,15 @@
18 18
19#ifdef __KERNEL__ 19#ifdef __KERNEL__
20 20
21/* Low-level stepping controls. */
22#define DBG_MDSCR_SS (1 << 0)
23#define DBG_SPSR_SS (1 << 21)
24
25/* MDSCR_EL1 enabling bits */
26#define DBG_MDSCR_KDE (1 << 13)
27#define DBG_MDSCR_MDE (1 << 15)
28#define DBG_MDSCR_MASK ~(DBG_MDSCR_KDE | DBG_MDSCR_MDE)
29
21#define DBG_ESR_EVT(x) (((x) >> 27) & 0x7) 30#define DBG_ESR_EVT(x) (((x) >> 27) & 0x7)
22 31
23/* AArch64 */ 32/* AArch64 */
@@ -73,11 +82,6 @@
73 82
74#define CACHE_FLUSH_IS_SAFE 1 83#define CACHE_FLUSH_IS_SAFE 1
75 84
76enum debug_el {
77 DBG_ACTIVE_EL0 = 0,
78 DBG_ACTIVE_EL1,
79};
80
81/* AArch32 */ 85/* AArch32 */
82#define DBG_ESR_EVT_BKPT 0x4 86#define DBG_ESR_EVT_BKPT 0x4
83#define DBG_ESR_EVT_VECC 0x5 87#define DBG_ESR_EVT_VECC 0x5
@@ -115,6 +119,11 @@ void unregister_break_hook(struct break_hook *hook);
115 119
116u8 debug_monitors_arch(void); 120u8 debug_monitors_arch(void);
117 121
122enum debug_el {
123 DBG_ACTIVE_EL0 = 0,
124 DBG_ACTIVE_EL1,
125};
126
118void enable_debug_monitors(enum debug_el el); 127void enable_debug_monitors(enum debug_el el);
119void disable_debug_monitors(enum debug_el el); 128void disable_debug_monitors(enum debug_el el);
120 129
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 3d6903006a8a..cc83520459ed 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -76,9 +76,10 @@
76 */ 76 */
77#define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \ 77#define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \
78 HCR_TVM | HCR_BSU_IS | HCR_FB | HCR_TAC | \ 78 HCR_TVM | HCR_BSU_IS | HCR_FB | HCR_TAC | \
79 HCR_AMO | HCR_IMO | HCR_FMO | \ 79 HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW)
80 HCR_SWIO | HCR_TIDCP | HCR_RW)
81#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF) 80#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF)
81#define HCR_INT_OVERRIDE (HCR_FMO | HCR_IMO)
82
82 83
83/* Hyp System Control Register (SCTLR_EL2) bits */ 84/* Hyp System Control Register (SCTLR_EL2) bits */
84#define SCTLR_EL2_EE (1 << 25) 85#define SCTLR_EL2_EE (1 << 25)
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index 9fcd54b1e16d..483842180f8f 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -18,6 +18,8 @@
18#ifndef __ARM_KVM_ASM_H__ 18#ifndef __ARM_KVM_ASM_H__
19#define __ARM_KVM_ASM_H__ 19#define __ARM_KVM_ASM_H__
20 20
21#include <asm/virt.h>
22
21/* 23/*
22 * 0 is reserved as an invalid value. 24 * 0 is reserved as an invalid value.
23 * Order *must* be kept in sync with the hyp switch code. 25 * Order *must* be kept in sync with the hyp switch code.
@@ -43,14 +45,25 @@
43#define AMAIR_EL1 19 /* Aux Memory Attribute Indirection Register */ 45#define AMAIR_EL1 19 /* Aux Memory Attribute Indirection Register */
44#define CNTKCTL_EL1 20 /* Timer Control Register (EL1) */ 46#define CNTKCTL_EL1 20 /* Timer Control Register (EL1) */
45#define PAR_EL1 21 /* Physical Address Register */ 47#define PAR_EL1 21 /* Physical Address Register */
48#define MDSCR_EL1 22 /* Monitor Debug System Control Register */
49#define DBGBCR0_EL1 23 /* Debug Breakpoint Control Registers (0-15) */
50#define DBGBCR15_EL1 38
51#define DBGBVR0_EL1 39 /* Debug Breakpoint Value Registers (0-15) */
52#define DBGBVR15_EL1 54
53#define DBGWCR0_EL1 55 /* Debug Watchpoint Control Registers (0-15) */
54#define DBGWCR15_EL1 70
55#define DBGWVR0_EL1 71 /* Debug Watchpoint Value Registers (0-15) */
56#define DBGWVR15_EL1 86
57#define MDCCINT_EL1 87 /* Monitor Debug Comms Channel Interrupt Enable Reg */
58
46/* 32bit specific registers. Keep them at the end of the range */ 59/* 32bit specific registers. Keep them at the end of the range */
47#define DACR32_EL2 22 /* Domain Access Control Register */ 60#define DACR32_EL2 88 /* Domain Access Control Register */
48#define IFSR32_EL2 23 /* Instruction Fault Status Register */ 61#define IFSR32_EL2 89 /* Instruction Fault Status Register */
49#define FPEXC32_EL2 24 /* Floating-Point Exception Control Register */ 62#define FPEXC32_EL2 90 /* Floating-Point Exception Control Register */
50#define DBGVCR32_EL2 25 /* Debug Vector Catch Register */ 63#define DBGVCR32_EL2 91 /* Debug Vector Catch Register */
51#define TEECR32_EL1 26 /* ThumbEE Configuration Register */ 64#define TEECR32_EL1 92 /* ThumbEE Configuration Register */
52#define TEEHBR32_EL1 27 /* ThumbEE Handler Base Register */ 65#define TEEHBR32_EL1 93 /* ThumbEE Handler Base Register */
53#define NR_SYS_REGS 28 66#define NR_SYS_REGS 94
54 67
55/* 32bit mapping */ 68/* 32bit mapping */
56#define c0_MPIDR (MPIDR_EL1 * 2) /* MultiProcessor ID Register */ 69#define c0_MPIDR (MPIDR_EL1 * 2) /* MultiProcessor ID Register */
@@ -82,11 +95,23 @@
82#define c10_AMAIR0 (AMAIR_EL1 * 2) /* Aux Memory Attr Indirection Reg */ 95#define c10_AMAIR0 (AMAIR_EL1 * 2) /* Aux Memory Attr Indirection Reg */
83#define c10_AMAIR1 (c10_AMAIR0 + 1)/* Aux Memory Attr Indirection Reg */ 96#define c10_AMAIR1 (c10_AMAIR0 + 1)/* Aux Memory Attr Indirection Reg */
84#define c14_CNTKCTL (CNTKCTL_EL1 * 2) /* Timer Control Register (PL1) */ 97#define c14_CNTKCTL (CNTKCTL_EL1 * 2) /* Timer Control Register (PL1) */
85#define NR_CP15_REGS (NR_SYS_REGS * 2) 98
99#define cp14_DBGDSCRext (MDSCR_EL1 * 2)
100#define cp14_DBGBCR0 (DBGBCR0_EL1 * 2)
101#define cp14_DBGBVR0 (DBGBVR0_EL1 * 2)
102#define cp14_DBGBXVR0 (cp14_DBGBVR0 + 1)
103#define cp14_DBGWCR0 (DBGWCR0_EL1 * 2)
104#define cp14_DBGWVR0 (DBGWVR0_EL1 * 2)
105#define cp14_DBGDCCINT (MDCCINT_EL1 * 2)
106
107#define NR_COPRO_REGS (NR_SYS_REGS * 2)
86 108
87#define ARM_EXCEPTION_IRQ 0 109#define ARM_EXCEPTION_IRQ 0
88#define ARM_EXCEPTION_TRAP 1 110#define ARM_EXCEPTION_TRAP 1
89 111
112#define KVM_ARM64_DEBUG_DIRTY_SHIFT 0
113#define KVM_ARM64_DEBUG_DIRTY (1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
114
90#ifndef __ASSEMBLY__ 115#ifndef __ASSEMBLY__
91struct kvm; 116struct kvm;
92struct kvm_vcpu; 117struct kvm_vcpu;
@@ -96,13 +121,21 @@ extern char __kvm_hyp_init_end[];
96 121
97extern char __kvm_hyp_vector[]; 122extern char __kvm_hyp_vector[];
98 123
99extern char __kvm_hyp_code_start[]; 124#define __kvm_hyp_code_start __hyp_text_start
100extern char __kvm_hyp_code_end[]; 125#define __kvm_hyp_code_end __hyp_text_end
101 126
102extern void __kvm_flush_vm_context(void); 127extern void __kvm_flush_vm_context(void);
103extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); 128extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
104 129
105extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); 130extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
131
132extern u64 __vgic_v3_get_ich_vtr_el2(void);
133
134extern char __save_vgic_v2_state[];
135extern char __restore_vgic_v2_state[];
136extern char __save_vgic_v3_state[];
137extern char __restore_vgic_v3_state[];
138
106#endif 139#endif
107 140
108#endif /* __ARM_KVM_ASM_H__ */ 141#endif /* __ARM_KVM_ASM_H__ */
diff --git a/arch/arm64/include/asm/kvm_coproc.h b/arch/arm64/include/asm/kvm_coproc.h
index 9a59301cd014..0b52377a6c11 100644
--- a/arch/arm64/include/asm/kvm_coproc.h
+++ b/arch/arm64/include/asm/kvm_coproc.h
@@ -39,7 +39,8 @@ void kvm_register_target_sys_reg_table(unsigned int target,
39 struct kvm_sys_reg_target_table *table); 39 struct kvm_sys_reg_target_table *table);
40 40
41int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run); 41int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run);
42int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run); 42int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run);
43int kvm_handle_cp14_64(struct kvm_vcpu *vcpu, struct kvm_run *run);
43int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run); 44int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run);
44int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run); 45int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run);
45int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run); 46int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run);
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index dd8ecfc3f995..fdc3e21abd8d 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -213,6 +213,17 @@ static inline unsigned long vcpu_data_guest_to_host(struct kvm_vcpu *vcpu,
213 default: 213 default:
214 return be64_to_cpu(data); 214 return be64_to_cpu(data);
215 } 215 }
216 } else {
217 switch (len) {
218 case 1:
219 return data & 0xff;
220 case 2:
221 return le16_to_cpu(data & 0xffff);
222 case 4:
223 return le32_to_cpu(data & 0xffffffff);
224 default:
225 return le64_to_cpu(data);
226 }
216 } 227 }
217 228
218 return data; /* Leave LE untouched */ 229 return data; /* Leave LE untouched */
@@ -233,6 +244,17 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
233 default: 244 default:
234 return cpu_to_be64(data); 245 return cpu_to_be64(data);
235 } 246 }
247 } else {
248 switch (len) {
249 case 1:
250 return data & 0xff;
251 case 2:
252 return cpu_to_le16(data & 0xffff);
253 case 4:
254 return cpu_to_le32(data & 0xffffffff);
255 default:
256 return cpu_to_le64(data);
257 }
236 } 258 }
237 259
238 return data; /* Leave LE untouched */ 260 return data; /* Leave LE untouched */
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 92242ce06309..e10c45a578e3 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -86,7 +86,7 @@ struct kvm_cpu_context {
86 struct kvm_regs gp_regs; 86 struct kvm_regs gp_regs;
87 union { 87 union {
88 u64 sys_regs[NR_SYS_REGS]; 88 u64 sys_regs[NR_SYS_REGS];
89 u32 cp15[NR_CP15_REGS]; 89 u32 copro[NR_COPRO_REGS];
90 }; 90 };
91}; 91};
92 92
@@ -101,6 +101,9 @@ struct kvm_vcpu_arch {
101 /* Exception Information */ 101 /* Exception Information */
102 struct kvm_vcpu_fault_info fault; 102 struct kvm_vcpu_fault_info fault;
103 103
104 /* Debug state */
105 u64 debug_flags;
106
104 /* Pointer to host CPU context */ 107 /* Pointer to host CPU context */
105 kvm_cpu_context_t *host_cpu_context; 108 kvm_cpu_context_t *host_cpu_context;
106 109
@@ -138,7 +141,20 @@ struct kvm_vcpu_arch {
138 141
139#define vcpu_gp_regs(v) (&(v)->arch.ctxt.gp_regs) 142#define vcpu_gp_regs(v) (&(v)->arch.ctxt.gp_regs)
140#define vcpu_sys_reg(v,r) ((v)->arch.ctxt.sys_regs[(r)]) 143#define vcpu_sys_reg(v,r) ((v)->arch.ctxt.sys_regs[(r)])
141#define vcpu_cp15(v,r) ((v)->arch.ctxt.cp15[(r)]) 144/*
145 * CP14 and CP15 live in the same array, as they are backed by the
146 * same system registers.
147 */
148#define vcpu_cp14(v,r) ((v)->arch.ctxt.copro[(r)])
149#define vcpu_cp15(v,r) ((v)->arch.ctxt.copro[(r)])
150
151#ifdef CONFIG_CPU_BIG_ENDIAN
152#define vcpu_cp15_64_high(v,r) vcpu_cp15((v),(r))
153#define vcpu_cp15_64_low(v,r) vcpu_cp15((v),(r) + 1)
154#else
155#define vcpu_cp15_64_high(v,r) vcpu_cp15((v),(r) + 1)
156#define vcpu_cp15_64_low(v,r) vcpu_cp15((v),(r))
157#endif
142 158
143struct kvm_vm_stat { 159struct kvm_vm_stat {
144 u32 remote_tlb_flush; 160 u32 remote_tlb_flush;
@@ -200,4 +216,32 @@ static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
200 hyp_stack_ptr, vector_ptr); 216 hyp_stack_ptr, vector_ptr);
201} 217}
202 218
219struct vgic_sr_vectors {
220 void *save_vgic;
221 void *restore_vgic;
222};
223
224static inline void vgic_arch_setup(const struct vgic_params *vgic)
225{
226 extern struct vgic_sr_vectors __vgic_sr_vectors;
227
228 switch(vgic->type)
229 {
230 case VGIC_V2:
231 __vgic_sr_vectors.save_vgic = __save_vgic_v2_state;
232 __vgic_sr_vectors.restore_vgic = __restore_vgic_v2_state;
233 break;
234
235#ifdef CONFIG_ARM_GIC_V3
236 case VGIC_V3:
237 __vgic_sr_vectors.save_vgic = __save_vgic_v3_state;
238 __vgic_sr_vectors.restore_vgic = __restore_vgic_v3_state;
239 break;
240#endif
241
242 default:
243 BUG();
244 }
245}
246
203#endif /* __ARM64_KVM_HOST_H__ */ 247#endif /* __ARM64_KVM_HOST_H__ */
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 7d29847a893b..8e138c7c53ac 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -125,6 +125,21 @@ static inline void kvm_set_s2pmd_writable(pmd_t *pmd)
125#define kvm_pud_addr_end(addr, end) pud_addr_end(addr, end) 125#define kvm_pud_addr_end(addr, end) pud_addr_end(addr, end)
126#define kvm_pmd_addr_end(addr, end) pmd_addr_end(addr, end) 126#define kvm_pmd_addr_end(addr, end) pmd_addr_end(addr, end)
127 127
128static inline bool kvm_page_empty(void *ptr)
129{
130 struct page *ptr_page = virt_to_page(ptr);
131 return page_count(ptr_page) == 1;
132}
133
134#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
135#ifndef CONFIG_ARM64_64K_PAGES
136#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
137#else
138#define kvm_pmd_table_empty(pmdp) (0)
139#endif
140#define kvm_pud_table_empty(pudp) (0)
141
142
128struct kvm; 143struct kvm;
129 144
130#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) 145#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l))
diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h
index 7a3f462133b0..22b16232bd60 100644
--- a/arch/arm64/include/asm/page.h
+++ b/arch/arm64/include/asm/page.h
@@ -28,9 +28,6 @@
28#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 28#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
29#define PAGE_MASK (~(PAGE_SIZE-1)) 29#define PAGE_MASK (~(PAGE_SIZE-1))
30 30
31/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
32#define __HAVE_ARCH_GATE_AREA 1
33
34/* 31/*
35 * The idmap and swapper page tables need some space reserved in the kernel 32 * The idmap and swapper page tables need some space reserved in the kernel
36 * image. Both require pgd, pud (4 levels only) and pmd tables to (section) 33 * image. Both require pgd, pud (4 levels only) and pmd tables to (section)
diff --git a/arch/arm64/include/asm/signal32.h b/arch/arm64/include/asm/signal32.h
index 7c275e3b640f..eeaa97559bab 100644
--- a/arch/arm64/include/asm/signal32.h
+++ b/arch/arm64/include/asm/signal32.h
@@ -24,22 +24,21 @@
24 24
25extern const compat_ulong_t aarch32_sigret_code[6]; 25extern const compat_ulong_t aarch32_sigret_code[6];
26 26
27int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, 27int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
28 struct pt_regs *regs); 28 struct pt_regs *regs);
29int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 29int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
30 sigset_t *set, struct pt_regs *regs); 30 struct pt_regs *regs);
31 31
32void compat_setup_restart_syscall(struct pt_regs *regs); 32void compat_setup_restart_syscall(struct pt_regs *regs);
33#else 33#else
34 34
35static inline int compat_setup_frame(int usid, struct k_sigaction *ka, 35static inline int compat_setup_frame(int usid, struct ksignal *ksig,
36 sigset_t *set, struct pt_regs *regs) 36 sigset_t *set, struct pt_regs *regs)
37{ 37{
38 return -ENOSYS; 38 return -ENOSYS;
39} 39}
40 40
41static inline int compat_setup_rt_frame(int usig, struct k_sigaction *ka, 41static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
42 siginfo_t *info, sigset_t *set,
43 struct pt_regs *regs) 42 struct pt_regs *regs)
44{ 43{
45 return -ENOSYS; 44 return -ENOSYS;
diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
index 215ad4649dd7..7a5df5252dd7 100644
--- a/arch/arm64/include/asm/virt.h
+++ b/arch/arm64/include/asm/virt.h
@@ -50,6 +50,10 @@ static inline bool is_hyp_mode_mismatched(void)
50 return __boot_cpu_mode[0] != __boot_cpu_mode[1]; 50 return __boot_cpu_mode[0] != __boot_cpu_mode[1];
51} 51}
52 52
53/* The section containing the hypervisor text */
54extern char __hyp_text_start[];
55extern char __hyp_text_end[];
56
53#endif /* __ASSEMBLY__ */ 57#endif /* __ASSEMBLY__ */
54 58
55#endif /* ! __ASM__VIRT_H */ 59#endif /* ! __ASM__VIRT_H */
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index 646f888387cd..9a9fce090d58 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -120,6 +120,7 @@ int main(void)
120 DEFINE(VCPU_ESR_EL2, offsetof(struct kvm_vcpu, arch.fault.esr_el2)); 120 DEFINE(VCPU_ESR_EL2, offsetof(struct kvm_vcpu, arch.fault.esr_el2));
121 DEFINE(VCPU_FAR_EL2, offsetof(struct kvm_vcpu, arch.fault.far_el2)); 121 DEFINE(VCPU_FAR_EL2, offsetof(struct kvm_vcpu, arch.fault.far_el2));
122 DEFINE(VCPU_HPFAR_EL2, offsetof(struct kvm_vcpu, arch.fault.hpfar_el2)); 122 DEFINE(VCPU_HPFAR_EL2, offsetof(struct kvm_vcpu, arch.fault.hpfar_el2));
123 DEFINE(VCPU_DEBUG_FLAGS, offsetof(struct kvm_vcpu, arch.debug_flags));
123 DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2)); 124 DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));
124 DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines)); 125 DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines));
125 DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context)); 126 DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context));
@@ -129,13 +130,24 @@ int main(void)
129 DEFINE(KVM_TIMER_ENABLED, offsetof(struct kvm, arch.timer.enabled)); 130 DEFINE(KVM_TIMER_ENABLED, offsetof(struct kvm, arch.timer.enabled));
130 DEFINE(VCPU_KVM, offsetof(struct kvm_vcpu, kvm)); 131 DEFINE(VCPU_KVM, offsetof(struct kvm_vcpu, kvm));
131 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu)); 132 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu));
132 DEFINE(VGIC_CPU_HCR, offsetof(struct vgic_cpu, vgic_hcr)); 133 DEFINE(VGIC_SAVE_FN, offsetof(struct vgic_sr_vectors, save_vgic));
133 DEFINE(VGIC_CPU_VMCR, offsetof(struct vgic_cpu, vgic_vmcr)); 134 DEFINE(VGIC_RESTORE_FN, offsetof(struct vgic_sr_vectors, restore_vgic));
134 DEFINE(VGIC_CPU_MISR, offsetof(struct vgic_cpu, vgic_misr)); 135 DEFINE(VGIC_SR_VECTOR_SZ, sizeof(struct vgic_sr_vectors));
135 DEFINE(VGIC_CPU_EISR, offsetof(struct vgic_cpu, vgic_eisr)); 136 DEFINE(VGIC_V2_CPU_HCR, offsetof(struct vgic_cpu, vgic_v2.vgic_hcr));
136 DEFINE(VGIC_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_elrsr)); 137 DEFINE(VGIC_V2_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v2.vgic_vmcr));
137 DEFINE(VGIC_CPU_APR, offsetof(struct vgic_cpu, vgic_apr)); 138 DEFINE(VGIC_V2_CPU_MISR, offsetof(struct vgic_cpu, vgic_v2.vgic_misr));
138 DEFINE(VGIC_CPU_LR, offsetof(struct vgic_cpu, vgic_lr)); 139 DEFINE(VGIC_V2_CPU_EISR, offsetof(struct vgic_cpu, vgic_v2.vgic_eisr));
140 DEFINE(VGIC_V2_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_v2.vgic_elrsr));
141 DEFINE(VGIC_V2_CPU_APR, offsetof(struct vgic_cpu, vgic_v2.vgic_apr));
142 DEFINE(VGIC_V2_CPU_LR, offsetof(struct vgic_cpu, vgic_v2.vgic_lr));
143 DEFINE(VGIC_V3_CPU_HCR, offsetof(struct vgic_cpu, vgic_v3.vgic_hcr));
144 DEFINE(VGIC_V3_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v3.vgic_vmcr));
145 DEFINE(VGIC_V3_CPU_MISR, offsetof(struct vgic_cpu, vgic_v3.vgic_misr));
146 DEFINE(VGIC_V3_CPU_EISR, offsetof(struct vgic_cpu, vgic_v3.vgic_eisr));
147 DEFINE(VGIC_V3_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_v3.vgic_elrsr));
148 DEFINE(VGIC_V3_CPU_AP0R, offsetof(struct vgic_cpu, vgic_v3.vgic_ap0r));
149 DEFINE(VGIC_V3_CPU_AP1R, offsetof(struct vgic_cpu, vgic_v3.vgic_ap1r));
150 DEFINE(VGIC_V3_CPU_LR, offsetof(struct vgic_cpu, vgic_v3.vgic_lr));
139 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr)); 151 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr));
140 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr)); 152 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr));
141 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base)); 153 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base));
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index fe5b94078d82..b056369fd47d 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -30,15 +30,6 @@
30#include <asm/cputype.h> 30#include <asm/cputype.h>
31#include <asm/system_misc.h> 31#include <asm/system_misc.h>
32 32
33/* Low-level stepping controls. */
34#define DBG_MDSCR_SS (1 << 0)
35#define DBG_SPSR_SS (1 << 21)
36
37/* MDSCR_EL1 enabling bits */
38#define DBG_MDSCR_KDE (1 << 13)
39#define DBG_MDSCR_MDE (1 << 15)
40#define DBG_MDSCR_MASK ~(DBG_MDSCR_KDE | DBG_MDSCR_MDE)
41
42/* Determine debug architecture. */ 33/* Determine debug architecture. */
43u8 debug_monitors_arch(void) 34u8 debug_monitors_arch(void)
44{ 35{
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e72f3100958f..5dbb7bd3b838 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -463,6 +463,8 @@ static int __init arm64_enter_virtual_mode(void)
463 efi_native_runtime_setup(); 463 efi_native_runtime_setup();
464 set_bit(EFI_RUNTIME_SERVICES, &efi.flags); 464 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
465 465
466 efi.runtime_version = efi.systab->hdr.revision;
467
466 return 0; 468 return 0;
467 469
468err_unmap: 470err_unmap:
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 6357b9c6c90e..6fa792137eda 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -209,19 +209,13 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
209 return err; 209 return err;
210} 210}
211 211
212static struct rt_sigframe __user *get_sigframe(struct k_sigaction *ka, 212static struct rt_sigframe __user *get_sigframe(struct ksignal *ksig,
213 struct pt_regs *regs) 213 struct pt_regs *regs)
214{ 214{
215 unsigned long sp, sp_top; 215 unsigned long sp, sp_top;
216 struct rt_sigframe __user *frame; 216 struct rt_sigframe __user *frame;
217 217
218 sp = sp_top = regs->sp; 218 sp = sp_top = sigsp(regs->sp, ksig);
219
220 /*
221 * This is the X/Open sanctioned signal stack switching.
222 */
223 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
224 sp = sp_top = current->sas_ss_sp + current->sas_ss_size;
225 219
226 sp = (sp - sizeof(struct rt_sigframe)) & ~15; 220 sp = (sp - sizeof(struct rt_sigframe)) & ~15;
227 frame = (struct rt_sigframe __user *)sp; 221 frame = (struct rt_sigframe __user *)sp;
@@ -253,13 +247,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka,
253 regs->regs[30] = (unsigned long)sigtramp; 247 regs->regs[30] = (unsigned long)sigtramp;
254} 248}
255 249
256static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 250static int setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
257 sigset_t *set, struct pt_regs *regs) 251 struct pt_regs *regs)
258{ 252{
259 struct rt_sigframe __user *frame; 253 struct rt_sigframe __user *frame;
260 int err = 0; 254 int err = 0;
261 255
262 frame = get_sigframe(ka, regs); 256 frame = get_sigframe(ksig, regs);
263 if (!frame) 257 if (!frame)
264 return 1; 258 return 1;
265 259
@@ -269,9 +263,9 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
269 err |= __save_altstack(&frame->uc.uc_stack, regs->sp); 263 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
270 err |= setup_sigframe(frame, regs, set); 264 err |= setup_sigframe(frame, regs, set);
271 if (err == 0) { 265 if (err == 0) {
272 setup_return(regs, ka, frame, usig); 266 setup_return(regs, &ksig->ka, frame, usig);
273 if (ka->sa.sa_flags & SA_SIGINFO) { 267 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
274 err |= copy_siginfo_to_user(&frame->info, info); 268 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
275 regs->regs[1] = (unsigned long)&frame->info; 269 regs->regs[1] = (unsigned long)&frame->info;
276 regs->regs[2] = (unsigned long)&frame->uc; 270 regs->regs[2] = (unsigned long)&frame->uc;
277 } 271 }
@@ -291,13 +285,12 @@ static void setup_restart_syscall(struct pt_regs *regs)
291/* 285/*
292 * OK, we're invoking a handler 286 * OK, we're invoking a handler
293 */ 287 */
294static void handle_signal(unsigned long sig, struct k_sigaction *ka, 288static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
295 siginfo_t *info, struct pt_regs *regs)
296{ 289{
297 struct thread_info *thread = current_thread_info(); 290 struct thread_info *thread = current_thread_info();
298 struct task_struct *tsk = current; 291 struct task_struct *tsk = current;
299 sigset_t *oldset = sigmask_to_save(); 292 sigset_t *oldset = sigmask_to_save();
300 int usig = sig; 293 int usig = ksig->sig;
301 int ret; 294 int ret;
302 295
303 /* 296 /*
@@ -310,13 +303,12 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
310 * Set up the stack frame 303 * Set up the stack frame
311 */ 304 */
312 if (is_compat_task()) { 305 if (is_compat_task()) {
313 if (ka->sa.sa_flags & SA_SIGINFO) 306 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
314 ret = compat_setup_rt_frame(usig, ka, info, oldset, 307 ret = compat_setup_rt_frame(usig, ksig, oldset, regs);
315 regs);
316 else 308 else
317 ret = compat_setup_frame(usig, ka, oldset, regs); 309 ret = compat_setup_frame(usig, ksig, oldset, regs);
318 } else { 310 } else {
319 ret = setup_rt_frame(usig, ka, info, oldset, regs); 311 ret = setup_rt_frame(usig, ksig, oldset, regs);
320 } 312 }
321 313
322 /* 314 /*
@@ -324,18 +316,14 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
324 */ 316 */
325 ret |= !valid_user_regs(&regs->user_regs); 317 ret |= !valid_user_regs(&regs->user_regs);
326 318
327 if (ret != 0) {
328 force_sigsegv(sig, tsk);
329 return;
330 }
331
332 /* 319 /*
333 * Fast forward the stepping logic so we step into the signal 320 * Fast forward the stepping logic so we step into the signal
334 * handler. 321 * handler.
335 */ 322 */
336 user_fastforward_single_step(tsk); 323 if (!ret)
324 user_fastforward_single_step(tsk);
337 325
338 signal_delivered(sig, info, ka, regs, 0); 326 signal_setup_done(ret, ksig, 0);
339} 327}
340 328
341/* 329/*
@@ -350,10 +338,9 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
350static void do_signal(struct pt_regs *regs) 338static void do_signal(struct pt_regs *regs)
351{ 339{
352 unsigned long continue_addr = 0, restart_addr = 0; 340 unsigned long continue_addr = 0, restart_addr = 0;
353 struct k_sigaction ka; 341 int retval = 0;
354 siginfo_t info;
355 int signr, retval = 0;
356 int syscall = (int)regs->syscallno; 342 int syscall = (int)regs->syscallno;
343 struct ksignal ksig;
357 344
358 /* 345 /*
359 * If we were from a system call, check for system call restarting... 346 * If we were from a system call, check for system call restarting...
@@ -387,8 +374,7 @@ static void do_signal(struct pt_regs *regs)
387 * Get the signal to deliver. When running under ptrace, at this point 374 * Get the signal to deliver. When running under ptrace, at this point
388 * the debugger may change all of our registers. 375 * the debugger may change all of our registers.
389 */ 376 */
390 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 377 if (get_signal(&ksig)) {
391 if (signr > 0) {
392 /* 378 /*
393 * Depending on the signal settings, we may need to revert the 379 * Depending on the signal settings, we may need to revert the
394 * decision to restart the system call, but skip this if a 380 * decision to restart the system call, but skip this if a
@@ -398,12 +384,12 @@ static void do_signal(struct pt_regs *regs)
398 (retval == -ERESTARTNOHAND || 384 (retval == -ERESTARTNOHAND ||
399 retval == -ERESTART_RESTARTBLOCK || 385 retval == -ERESTART_RESTARTBLOCK ||
400 (retval == -ERESTARTSYS && 386 (retval == -ERESTARTSYS &&
401 !(ka.sa.sa_flags & SA_RESTART)))) { 387 !(ksig.ka.sa.sa_flags & SA_RESTART)))) {
402 regs->regs[0] = -EINTR; 388 regs->regs[0] = -EINTR;
403 regs->pc = continue_addr; 389 regs->pc = continue_addr;
404 } 390 }
405 391
406 handle_signal(signr, &ka, &info, regs); 392 handle_signal(&ksig, regs);
407 return; 393 return;
408 } 394 }
409 395
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index c5ee208321c3..1b9ad02837cf 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -407,20 +407,14 @@ badframe:
407 return 0; 407 return 0;
408} 408}
409 409
410static void __user *compat_get_sigframe(struct k_sigaction *ka, 410static void __user *compat_get_sigframe(struct ksignal *ksig,
411 struct pt_regs *regs, 411 struct pt_regs *regs,
412 int framesize) 412 int framesize)
413{ 413{
414 compat_ulong_t sp = regs->compat_sp; 414 compat_ulong_t sp = sigsp(regs->compat_sp, ksig);
415 void __user *frame; 415 void __user *frame;
416 416
417 /* 417 /*
418 * This is the X/Open sanctioned signal stack switching.
419 */
420 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
421 sp = current->sas_ss_sp + current->sas_ss_size;
422
423 /*
424 * ATPCS B01 mandates 8-byte alignment 418 * ATPCS B01 mandates 8-byte alignment
425 */ 419 */
426 frame = compat_ptr((compat_uptr_t)((sp - framesize) & ~7)); 420 frame = compat_ptr((compat_uptr_t)((sp - framesize) & ~7));
@@ -520,18 +514,18 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf,
520/* 514/*
521 * 32-bit signal handling routines called from signal.c 515 * 32-bit signal handling routines called from signal.c
522 */ 516 */
523int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 517int compat_setup_rt_frame(int usig, struct ksignal *ksig,
524 sigset_t *set, struct pt_regs *regs) 518 sigset_t *set, struct pt_regs *regs)
525{ 519{
526 struct compat_rt_sigframe __user *frame; 520 struct compat_rt_sigframe __user *frame;
527 int err = 0; 521 int err = 0;
528 522
529 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 523 frame = compat_get_sigframe(ksig, regs, sizeof(*frame));
530 524
531 if (!frame) 525 if (!frame)
532 return 1; 526 return 1;
533 527
534 err |= copy_siginfo_to_user32(&frame->info, info); 528 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
535 529
536 __put_user_error(0, &frame->sig.uc.uc_flags, err); 530 __put_user_error(0, &frame->sig.uc.uc_flags, err);
537 __put_user_error(0, &frame->sig.uc.uc_link, err); 531 __put_user_error(0, &frame->sig.uc.uc_link, err);
@@ -541,7 +535,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
541 err |= compat_setup_sigframe(&frame->sig, regs, set); 535 err |= compat_setup_sigframe(&frame->sig, regs, set);
542 536
543 if (err == 0) { 537 if (err == 0) {
544 compat_setup_return(regs, ka, frame->sig.retcode, frame, usig); 538 compat_setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
545 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info; 539 regs->regs[1] = (compat_ulong_t)(unsigned long)&frame->info;
546 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc; 540 regs->regs[2] = (compat_ulong_t)(unsigned long)&frame->sig.uc;
547 } 541 }
@@ -549,13 +543,13 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
549 return err; 543 return err;
550} 544}
551 545
552int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, 546int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
553 struct pt_regs *regs) 547 struct pt_regs *regs)
554{ 548{
555 struct compat_sigframe __user *frame; 549 struct compat_sigframe __user *frame;
556 int err = 0; 550 int err = 0;
557 551
558 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 552 frame = compat_get_sigframe(ksig, regs, sizeof(*frame));
559 553
560 if (!frame) 554 if (!frame)
561 return 1; 555 return 1;
@@ -564,7 +558,7 @@ int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set,
564 558
565 err |= compat_setup_sigframe(frame, regs, set); 559 err |= compat_setup_sigframe(frame, regs, set);
566 if (err == 0) 560 if (err == 0)
567 compat_setup_return(regs, ka, frame->retcode, frame, usig); 561 compat_setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
568 562
569 return err; 563 return err;
570} 564}
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 3e2f5ebbf63e..474339718105 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -51,6 +51,9 @@
51#include <asm/tlbflush.h> 51#include <asm/tlbflush.h>
52#include <asm/ptrace.h> 52#include <asm/ptrace.h>
53 53
54#define CREATE_TRACE_POINTS
55#include <trace/events/ipi.h>
56
54/* 57/*
55 * as from 2.5, kernels no longer have an init_tasks structure 58 * as from 2.5, kernels no longer have an init_tasks structure
56 * so we need some other way of telling a new secondary core 59 * so we need some other way of telling a new secondary core
@@ -313,8 +316,6 @@ void __init smp_prepare_boot_cpu(void)
313 set_my_cpu_offset(per_cpu_offset(smp_processor_id())); 316 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
314} 317}
315 318
316static void (*smp_cross_call)(const struct cpumask *, unsigned int);
317
318/* 319/*
319 * Enumerate the possible CPU set from the device tree and build the 320 * Enumerate the possible CPU set from the device tree and build the
320 * cpu logical map array containing MPIDR values related to logical 321 * cpu logical map array containing MPIDR values related to logical
@@ -469,32 +470,15 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
469 } 470 }
470} 471}
471 472
473static void (*__smp_cross_call)(const struct cpumask *, unsigned int);
472 474
473void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) 475void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
474{ 476{
475 smp_cross_call = fn; 477 __smp_cross_call = fn;
476} 478}
477 479
478void arch_send_call_function_ipi_mask(const struct cpumask *mask) 480static const char *ipi_types[NR_IPI] __tracepoint_string = {
479{ 481#define S(x,s) [x] = s
480 smp_cross_call(mask, IPI_CALL_FUNC);
481}
482
483void arch_send_call_function_single_ipi(int cpu)
484{
485 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
486}
487
488#ifdef CONFIG_IRQ_WORK
489void arch_irq_work_raise(void)
490{
491 if (smp_cross_call)
492 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
493}
494#endif
495
496static const char *ipi_types[NR_IPI] = {
497#define S(x,s) [x - IPI_RESCHEDULE] = s
498 S(IPI_RESCHEDULE, "Rescheduling interrupts"), 482 S(IPI_RESCHEDULE, "Rescheduling interrupts"),
499 S(IPI_CALL_FUNC, "Function call interrupts"), 483 S(IPI_CALL_FUNC, "Function call interrupts"),
500 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"), 484 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
@@ -503,12 +487,18 @@ static const char *ipi_types[NR_IPI] = {
503 S(IPI_IRQ_WORK, "IRQ work interrupts"), 487 S(IPI_IRQ_WORK, "IRQ work interrupts"),
504}; 488};
505 489
490static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
491{
492 trace_ipi_raise(target, ipi_types[ipinr]);
493 __smp_cross_call(target, ipinr);
494}
495
506void show_ipi_list(struct seq_file *p, int prec) 496void show_ipi_list(struct seq_file *p, int prec)
507{ 497{
508 unsigned int cpu, i; 498 unsigned int cpu, i;
509 499
510 for (i = 0; i < NR_IPI; i++) { 500 for (i = 0; i < NR_IPI; i++) {
511 seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i + IPI_RESCHEDULE, 501 seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i,
512 prec >= 4 ? " " : ""); 502 prec >= 4 ? " " : "");
513 for_each_online_cpu(cpu) 503 for_each_online_cpu(cpu)
514 seq_printf(p, "%10u ", 504 seq_printf(p, "%10u ",
@@ -528,6 +518,24 @@ u64 smp_irq_stat_cpu(unsigned int cpu)
528 return sum; 518 return sum;
529} 519}
530 520
521void arch_send_call_function_ipi_mask(const struct cpumask *mask)
522{
523 smp_cross_call(mask, IPI_CALL_FUNC);
524}
525
526void arch_send_call_function_single_ipi(int cpu)
527{
528 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
529}
530
531#ifdef CONFIG_IRQ_WORK
532void arch_irq_work_raise(void)
533{
534 if (__smp_cross_call)
535 smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
536}
537#endif
538
531static DEFINE_RAW_SPINLOCK(stop_lock); 539static DEFINE_RAW_SPINLOCK(stop_lock);
532 540
533/* 541/*
@@ -559,8 +567,10 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
559 unsigned int cpu = smp_processor_id(); 567 unsigned int cpu = smp_processor_id();
560 struct pt_regs *old_regs = set_irq_regs(regs); 568 struct pt_regs *old_regs = set_irq_regs(regs);
561 569
562 if (ipinr >= IPI_RESCHEDULE && ipinr < IPI_RESCHEDULE + NR_IPI) 570 if ((unsigned)ipinr < NR_IPI) {
563 __inc_irq_stat(cpu, ipi_irqs[ipinr - IPI_RESCHEDULE]); 571 trace_ipi_entry(ipi_types[ipinr]);
572 __inc_irq_stat(cpu, ipi_irqs[ipinr]);
573 }
564 574
565 switch (ipinr) { 575 switch (ipinr) {
566 case IPI_RESCHEDULE: 576 case IPI_RESCHEDULE:
@@ -605,6 +615,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
605 pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr); 615 pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
606 break; 616 break;
607 } 617 }
618
619 if ((unsigned)ipinr < NR_IPI)
620 trace_ipi_exit(ipi_types[ipinr]);
608 set_irq_regs(old_regs); 621 set_irq_regs(old_regs);
609} 622}
610 623
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 24f2e8c62479..32aeea083d93 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -195,31 +195,12 @@ up_fail:
195} 195}
196 196
197/* 197/*
198 * We define AT_SYSINFO_EHDR, so we need these function stubs to keep
199 * Linux happy.
200 */
201int in_gate_area_no_mm(unsigned long addr)
202{
203 return 0;
204}
205
206int in_gate_area(struct mm_struct *mm, unsigned long addr)
207{
208 return 0;
209}
210
211struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
212{
213 return NULL;
214}
215
216/*
217 * Update the vDSO data page to keep in sync with kernel timekeeping. 198 * Update the vDSO data page to keep in sync with kernel timekeeping.
218 */ 199 */
219void update_vsyscall(struct timekeeper *tk) 200void update_vsyscall(struct timekeeper *tk)
220{ 201{
221 struct timespec xtime_coarse; 202 struct timespec xtime_coarse;
222 u32 use_syscall = strcmp(tk->clock->name, "arch_sys_counter"); 203 u32 use_syscall = strcmp(tk->tkr.clock->name, "arch_sys_counter");
223 204
224 ++vdso_data->tb_seq_count; 205 ++vdso_data->tb_seq_count;
225 smp_wmb(); 206 smp_wmb();
@@ -232,11 +213,11 @@ void update_vsyscall(struct timekeeper *tk)
232 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; 213 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
233 214
234 if (!use_syscall) { 215 if (!use_syscall) {
235 vdso_data->cs_cycle_last = tk->clock->cycle_last; 216 vdso_data->cs_cycle_last = tk->tkr.cycle_last;
236 vdso_data->xtime_clock_sec = tk->xtime_sec; 217 vdso_data->xtime_clock_sec = tk->xtime_sec;
237 vdso_data->xtime_clock_nsec = tk->xtime_nsec; 218 vdso_data->xtime_clock_nsec = tk->tkr.xtime_nsec;
238 vdso_data->cs_mult = tk->mult; 219 vdso_data->cs_mult = tk->tkr.mult;
239 vdso_data->cs_shift = tk->shift; 220 vdso_data->cs_shift = tk->tkr.shift;
240 } 221 }
241 222
242 smp_wmb(); 223 smp_wmb();
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 72a9fd583ad3..32a096174b94 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -20,4 +20,8 @@ kvm-$(CONFIG_KVM_ARM_HOST) += hyp.o hyp-init.o handle_exit.o
20kvm-$(CONFIG_KVM_ARM_HOST) += guest.o reset.o sys_regs.o sys_regs_generic_v8.o 20kvm-$(CONFIG_KVM_ARM_HOST) += guest.o reset.o sys_regs.o sys_regs_generic_v8.o
21 21
22kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o 22kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
23kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2.o
24kvm-$(CONFIG_KVM_ARM_VGIC) += vgic-v2-switch.o
25kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v3.o
26kvm-$(CONFIG_KVM_ARM_VGIC) += vgic-v3-switch.o
23kvm-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o 27kvm-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 60b5c31f3c10..8d1ec2887a26 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -136,13 +136,67 @@ static unsigned long num_core_regs(void)
136} 136}
137 137
138/** 138/**
139 * ARM64 versions of the TIMER registers, always available on arm64
140 */
141
142#define NUM_TIMER_REGS 3
143
144static bool is_timer_reg(u64 index)
145{
146 switch (index) {
147 case KVM_REG_ARM_TIMER_CTL:
148 case KVM_REG_ARM_TIMER_CNT:
149 case KVM_REG_ARM_TIMER_CVAL:
150 return true;
151 }
152 return false;
153}
154
155static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
156{
157 if (put_user(KVM_REG_ARM_TIMER_CTL, uindices))
158 return -EFAULT;
159 uindices++;
160 if (put_user(KVM_REG_ARM_TIMER_CNT, uindices))
161 return -EFAULT;
162 uindices++;
163 if (put_user(KVM_REG_ARM_TIMER_CVAL, uindices))
164 return -EFAULT;
165
166 return 0;
167}
168
169static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
170{
171 void __user *uaddr = (void __user *)(long)reg->addr;
172 u64 val;
173 int ret;
174
175 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
176 if (ret != 0)
177 return ret;
178
179 return kvm_arm_timer_set_reg(vcpu, reg->id, val);
180}
181
182static int get_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
183{
184 void __user *uaddr = (void __user *)(long)reg->addr;
185 u64 val;
186
187 val = kvm_arm_timer_get_reg(vcpu, reg->id);
188 return copy_to_user(uaddr, &val, KVM_REG_SIZE(reg->id));
189}
190
191/**
139 * kvm_arm_num_regs - how many registers do we present via KVM_GET_ONE_REG 192 * kvm_arm_num_regs - how many registers do we present via KVM_GET_ONE_REG
140 * 193 *
141 * This is for all registers. 194 * This is for all registers.
142 */ 195 */
143unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) 196unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu)
144{ 197{
145 return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu); 198 return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu)
199 + NUM_TIMER_REGS;
146} 200}
147 201
148/** 202/**
@@ -154,6 +208,7 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
154{ 208{
155 unsigned int i; 209 unsigned int i;
156 const u64 core_reg = KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE; 210 const u64 core_reg = KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE;
211 int ret;
157 212
158 for (i = 0; i < sizeof(struct kvm_regs) / sizeof(__u32); i++) { 213 for (i = 0; i < sizeof(struct kvm_regs) / sizeof(__u32); i++) {
159 if (put_user(core_reg | i, uindices)) 214 if (put_user(core_reg | i, uindices))
@@ -161,6 +216,11 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
161 uindices++; 216 uindices++;
162 } 217 }
163 218
219 ret = copy_timer_indices(vcpu, uindices);
220 if (ret)
221 return ret;
222 uindices += NUM_TIMER_REGS;
223
164 return kvm_arm_copy_sys_reg_indices(vcpu, uindices); 224 return kvm_arm_copy_sys_reg_indices(vcpu, uindices);
165} 225}
166 226
@@ -174,6 +234,9 @@ int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
174 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) 234 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
175 return get_core_reg(vcpu, reg); 235 return get_core_reg(vcpu, reg);
176 236
237 if (is_timer_reg(reg->id))
238 return get_timer_reg(vcpu, reg);
239
177 return kvm_arm_sys_reg_get_reg(vcpu, reg); 240 return kvm_arm_sys_reg_get_reg(vcpu, reg);
178} 241}
179 242
@@ -187,6 +250,9 @@ int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
187 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) 250 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
188 return set_core_reg(vcpu, reg); 251 return set_core_reg(vcpu, reg);
189 252
253 if (is_timer_reg(reg->id))
254 return set_timer_reg(vcpu, reg);
255
190 return kvm_arm_sys_reg_set_reg(vcpu, reg); 256 return kvm_arm_sys_reg_set_reg(vcpu, reg);
191} 257}
192 258
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index 182415e1a952..e28be510380c 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -73,9 +73,9 @@ static exit_handle_fn arm_exit_handlers[] = {
73 [ESR_EL2_EC_WFI] = kvm_handle_wfx, 73 [ESR_EL2_EC_WFI] = kvm_handle_wfx,
74 [ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32, 74 [ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32,
75 [ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64, 75 [ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64,
76 [ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_access, 76 [ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_32,
77 [ESR_EL2_EC_CP14_LS] = kvm_handle_cp14_load_store, 77 [ESR_EL2_EC_CP14_LS] = kvm_handle_cp14_load_store,
78 [ESR_EL2_EC_CP14_64] = kvm_handle_cp14_access, 78 [ESR_EL2_EC_CP14_64] = kvm_handle_cp14_64,
79 [ESR_EL2_EC_HVC32] = handle_hvc, 79 [ESR_EL2_EC_HVC32] = handle_hvc,
80 [ESR_EL2_EC_SMC32] = handle_smc, 80 [ESR_EL2_EC_SMC32] = handle_smc,
81 [ESR_EL2_EC_HVC64] = handle_hvc, 81 [ESR_EL2_EC_HVC64] = handle_hvc,
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index b0d1512acf08..b72aa9f9215c 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -16,11 +16,11 @@
16 */ 16 */
17 17
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <linux/irqchip/arm-gic.h>
20 19
21#include <asm/assembler.h> 20#include <asm/assembler.h>
22#include <asm/memory.h> 21#include <asm/memory.h>
23#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/debug-monitors.h>
24#include <asm/fpsimdmacros.h> 24#include <asm/fpsimdmacros.h>
25#include <asm/kvm.h> 25#include <asm/kvm.h>
26#include <asm/kvm_asm.h> 26#include <asm/kvm_asm.h>
@@ -36,9 +36,6 @@
36 .pushsection .hyp.text, "ax" 36 .pushsection .hyp.text, "ax"
37 .align PAGE_SHIFT 37 .align PAGE_SHIFT
38 38
39__kvm_hyp_code_start:
40 .globl __kvm_hyp_code_start
41
42.macro save_common_regs 39.macro save_common_regs
43 // x2: base address for cpu context 40 // x2: base address for cpu context
44 // x3: tmp register 41 // x3: tmp register
@@ -215,6 +212,7 @@ __kvm_hyp_code_start:
215 mrs x22, amair_el1 212 mrs x22, amair_el1
216 mrs x23, cntkctl_el1 213 mrs x23, cntkctl_el1
217 mrs x24, par_el1 214 mrs x24, par_el1
215 mrs x25, mdscr_el1
218 216
219 stp x4, x5, [x3] 217 stp x4, x5, [x3]
220 stp x6, x7, [x3, #16] 218 stp x6, x7, [x3, #16]
@@ -226,7 +224,202 @@ __kvm_hyp_code_start:
226 stp x18, x19, [x3, #112] 224 stp x18, x19, [x3, #112]
227 stp x20, x21, [x3, #128] 225 stp x20, x21, [x3, #128]
228 stp x22, x23, [x3, #144] 226 stp x22, x23, [x3, #144]
229 str x24, [x3, #160] 227 stp x24, x25, [x3, #160]
228.endm
229
230.macro save_debug
231 // x2: base address for cpu context
232 // x3: tmp register
233
234 mrs x26, id_aa64dfr0_el1
235 ubfx x24, x26, #12, #4 // Extract BRPs
236 ubfx x25, x26, #20, #4 // Extract WRPs
237 mov w26, #15
238 sub w24, w26, w24 // How many BPs to skip
239 sub w25, w26, w25 // How many WPs to skip
240
241 add x3, x2, #CPU_SYSREG_OFFSET(DBGBCR0_EL1)
242
243 adr x26, 1f
244 add x26, x26, x24, lsl #2
245 br x26
2461:
247 mrs x20, dbgbcr15_el1
248 mrs x19, dbgbcr14_el1
249 mrs x18, dbgbcr13_el1
250 mrs x17, dbgbcr12_el1
251 mrs x16, dbgbcr11_el1
252 mrs x15, dbgbcr10_el1
253 mrs x14, dbgbcr9_el1
254 mrs x13, dbgbcr8_el1
255 mrs x12, dbgbcr7_el1
256 mrs x11, dbgbcr6_el1
257 mrs x10, dbgbcr5_el1
258 mrs x9, dbgbcr4_el1
259 mrs x8, dbgbcr3_el1
260 mrs x7, dbgbcr2_el1
261 mrs x6, dbgbcr1_el1
262 mrs x5, dbgbcr0_el1
263
264 adr x26, 1f
265 add x26, x26, x24, lsl #2
266 br x26
267
2681:
269 str x20, [x3, #(15 * 8)]
270 str x19, [x3, #(14 * 8)]
271 str x18, [x3, #(13 * 8)]
272 str x17, [x3, #(12 * 8)]
273 str x16, [x3, #(11 * 8)]
274 str x15, [x3, #(10 * 8)]
275 str x14, [x3, #(9 * 8)]
276 str x13, [x3, #(8 * 8)]
277 str x12, [x3, #(7 * 8)]
278 str x11, [x3, #(6 * 8)]
279 str x10, [x3, #(5 * 8)]
280 str x9, [x3, #(4 * 8)]
281 str x8, [x3, #(3 * 8)]
282 str x7, [x3, #(2 * 8)]
283 str x6, [x3, #(1 * 8)]
284 str x5, [x3, #(0 * 8)]
285
286 add x3, x2, #CPU_SYSREG_OFFSET(DBGBVR0_EL1)
287
288 adr x26, 1f
289 add x26, x26, x24, lsl #2
290 br x26
2911:
292 mrs x20, dbgbvr15_el1
293 mrs x19, dbgbvr14_el1
294 mrs x18, dbgbvr13_el1
295 mrs x17, dbgbvr12_el1
296 mrs x16, dbgbvr11_el1
297 mrs x15, dbgbvr10_el1
298 mrs x14, dbgbvr9_el1
299 mrs x13, dbgbvr8_el1
300 mrs x12, dbgbvr7_el1
301 mrs x11, dbgbvr6_el1
302 mrs x10, dbgbvr5_el1
303 mrs x9, dbgbvr4_el1
304 mrs x8, dbgbvr3_el1
305 mrs x7, dbgbvr2_el1
306 mrs x6, dbgbvr1_el1
307 mrs x5, dbgbvr0_el1
308
309 adr x26, 1f
310 add x26, x26, x24, lsl #2
311 br x26
312
3131:
314 str x20, [x3, #(15 * 8)]
315 str x19, [x3, #(14 * 8)]
316 str x18, [x3, #(13 * 8)]
317 str x17, [x3, #(12 * 8)]
318 str x16, [x3, #(11 * 8)]
319 str x15, [x3, #(10 * 8)]
320 str x14, [x3, #(9 * 8)]
321 str x13, [x3, #(8 * 8)]
322 str x12, [x3, #(7 * 8)]
323 str x11, [x3, #(6 * 8)]
324 str x10, [x3, #(5 * 8)]
325 str x9, [x3, #(4 * 8)]
326 str x8, [x3, #(3 * 8)]
327 str x7, [x3, #(2 * 8)]
328 str x6, [x3, #(1 * 8)]
329 str x5, [x3, #(0 * 8)]
330
331 add x3, x2, #CPU_SYSREG_OFFSET(DBGWCR0_EL1)
332
333 adr x26, 1f
334 add x26, x26, x25, lsl #2
335 br x26
3361:
337 mrs x20, dbgwcr15_el1
338 mrs x19, dbgwcr14_el1
339 mrs x18, dbgwcr13_el1
340 mrs x17, dbgwcr12_el1
341 mrs x16, dbgwcr11_el1
342 mrs x15, dbgwcr10_el1
343 mrs x14, dbgwcr9_el1
344 mrs x13, dbgwcr8_el1
345 mrs x12, dbgwcr7_el1
346 mrs x11, dbgwcr6_el1
347 mrs x10, dbgwcr5_el1
348 mrs x9, dbgwcr4_el1
349 mrs x8, dbgwcr3_el1
350 mrs x7, dbgwcr2_el1
351 mrs x6, dbgwcr1_el1
352 mrs x5, dbgwcr0_el1
353
354 adr x26, 1f
355 add x26, x26, x25, lsl #2
356 br x26
357
3581:
359 str x20, [x3, #(15 * 8)]
360 str x19, [x3, #(14 * 8)]
361 str x18, [x3, #(13 * 8)]
362 str x17, [x3, #(12 * 8)]
363 str x16, [x3, #(11 * 8)]
364 str x15, [x3, #(10 * 8)]
365 str x14, [x3, #(9 * 8)]
366 str x13, [x3, #(8 * 8)]
367 str x12, [x3, #(7 * 8)]
368 str x11, [x3, #(6 * 8)]
369 str x10, [x3, #(5 * 8)]
370 str x9, [x3, #(4 * 8)]
371 str x8, [x3, #(3 * 8)]
372 str x7, [x3, #(2 * 8)]
373 str x6, [x3, #(1 * 8)]
374 str x5, [x3, #(0 * 8)]
375
376 add x3, x2, #CPU_SYSREG_OFFSET(DBGWVR0_EL1)
377
378 adr x26, 1f
379 add x26, x26, x25, lsl #2
380 br x26
3811:
382 mrs x20, dbgwvr15_el1
383 mrs x19, dbgwvr14_el1
384 mrs x18, dbgwvr13_el1
385 mrs x17, dbgwvr12_el1
386 mrs x16, dbgwvr11_el1
387 mrs x15, dbgwvr10_el1
388 mrs x14, dbgwvr9_el1
389 mrs x13, dbgwvr8_el1
390 mrs x12, dbgwvr7_el1
391 mrs x11, dbgwvr6_el1
392 mrs x10, dbgwvr5_el1
393 mrs x9, dbgwvr4_el1
394 mrs x8, dbgwvr3_el1
395 mrs x7, dbgwvr2_el1
396 mrs x6, dbgwvr1_el1
397 mrs x5, dbgwvr0_el1
398
399 adr x26, 1f
400 add x26, x26, x25, lsl #2
401 br x26
402
4031:
404 str x20, [x3, #(15 * 8)]
405 str x19, [x3, #(14 * 8)]
406 str x18, [x3, #(13 * 8)]
407 str x17, [x3, #(12 * 8)]
408 str x16, [x3, #(11 * 8)]
409 str x15, [x3, #(10 * 8)]
410 str x14, [x3, #(9 * 8)]
411 str x13, [x3, #(8 * 8)]
412 str x12, [x3, #(7 * 8)]
413 str x11, [x3, #(6 * 8)]
414 str x10, [x3, #(5 * 8)]
415 str x9, [x3, #(4 * 8)]
416 str x8, [x3, #(3 * 8)]
417 str x7, [x3, #(2 * 8)]
418 str x6, [x3, #(1 * 8)]
419 str x5, [x3, #(0 * 8)]
420
421 mrs x21, mdccint_el1
422 str x21, [x2, #CPU_SYSREG_OFFSET(MDCCINT_EL1)]
230.endm 423.endm
231 424
232.macro restore_sysregs 425.macro restore_sysregs
@@ -245,7 +438,7 @@ __kvm_hyp_code_start:
245 ldp x18, x19, [x3, #112] 438 ldp x18, x19, [x3, #112]
246 ldp x20, x21, [x3, #128] 439 ldp x20, x21, [x3, #128]
247 ldp x22, x23, [x3, #144] 440 ldp x22, x23, [x3, #144]
248 ldr x24, [x3, #160] 441 ldp x24, x25, [x3, #160]
249 442
250 msr vmpidr_el2, x4 443 msr vmpidr_el2, x4
251 msr csselr_el1, x5 444 msr csselr_el1, x5
@@ -268,6 +461,198 @@ __kvm_hyp_code_start:
268 msr amair_el1, x22 461 msr amair_el1, x22
269 msr cntkctl_el1, x23 462 msr cntkctl_el1, x23
270 msr par_el1, x24 463 msr par_el1, x24
464 msr mdscr_el1, x25
465.endm
466
467.macro restore_debug
468 // x2: base address for cpu context
469 // x3: tmp register
470
471 mrs x26, id_aa64dfr0_el1
472 ubfx x24, x26, #12, #4 // Extract BRPs
473 ubfx x25, x26, #20, #4 // Extract WRPs
474 mov w26, #15
475 sub w24, w26, w24 // How many BPs to skip
476 sub w25, w26, w25 // How many WPs to skip
477
478 add x3, x2, #CPU_SYSREG_OFFSET(DBGBCR0_EL1)
479
480 adr x26, 1f
481 add x26, x26, x24, lsl #2
482 br x26
4831:
484 ldr x20, [x3, #(15 * 8)]
485 ldr x19, [x3, #(14 * 8)]
486 ldr x18, [x3, #(13 * 8)]
487 ldr x17, [x3, #(12 * 8)]
488 ldr x16, [x3, #(11 * 8)]
489 ldr x15, [x3, #(10 * 8)]
490 ldr x14, [x3, #(9 * 8)]
491 ldr x13, [x3, #(8 * 8)]
492 ldr x12, [x3, #(7 * 8)]
493 ldr x11, [x3, #(6 * 8)]
494 ldr x10, [x3, #(5 * 8)]
495 ldr x9, [x3, #(4 * 8)]
496 ldr x8, [x3, #(3 * 8)]
497 ldr x7, [x3, #(2 * 8)]
498 ldr x6, [x3, #(1 * 8)]
499 ldr x5, [x3, #(0 * 8)]
500
501 adr x26, 1f
502 add x26, x26, x24, lsl #2
503 br x26
5041:
505 msr dbgbcr15_el1, x20
506 msr dbgbcr14_el1, x19
507 msr dbgbcr13_el1, x18
508 msr dbgbcr12_el1, x17
509 msr dbgbcr11_el1, x16
510 msr dbgbcr10_el1, x15
511 msr dbgbcr9_el1, x14
512 msr dbgbcr8_el1, x13
513 msr dbgbcr7_el1, x12
514 msr dbgbcr6_el1, x11
515 msr dbgbcr5_el1, x10
516 msr dbgbcr4_el1, x9
517 msr dbgbcr3_el1, x8
518 msr dbgbcr2_el1, x7
519 msr dbgbcr1_el1, x6
520 msr dbgbcr0_el1, x5
521
522 add x3, x2, #CPU_SYSREG_OFFSET(DBGBVR0_EL1)
523
524 adr x26, 1f
525 add x26, x26, x24, lsl #2
526 br x26
5271:
528 ldr x20, [x3, #(15 * 8)]
529 ldr x19, [x3, #(14 * 8)]
530 ldr x18, [x3, #(13 * 8)]
531 ldr x17, [x3, #(12 * 8)]
532 ldr x16, [x3, #(11 * 8)]
533 ldr x15, [x3, #(10 * 8)]
534 ldr x14, [x3, #(9 * 8)]
535 ldr x13, [x3, #(8 * 8)]
536 ldr x12, [x3, #(7 * 8)]
537 ldr x11, [x3, #(6 * 8)]
538 ldr x10, [x3, #(5 * 8)]
539 ldr x9, [x3, #(4 * 8)]
540 ldr x8, [x3, #(3 * 8)]
541 ldr x7, [x3, #(2 * 8)]
542 ldr x6, [x3, #(1 * 8)]
543 ldr x5, [x3, #(0 * 8)]
544
545 adr x26, 1f
546 add x26, x26, x24, lsl #2
547 br x26
5481:
549 msr dbgbvr15_el1, x20
550 msr dbgbvr14_el1, x19
551 msr dbgbvr13_el1, x18
552 msr dbgbvr12_el1, x17
553 msr dbgbvr11_el1, x16
554 msr dbgbvr10_el1, x15
555 msr dbgbvr9_el1, x14
556 msr dbgbvr8_el1, x13
557 msr dbgbvr7_el1, x12
558 msr dbgbvr6_el1, x11
559 msr dbgbvr5_el1, x10
560 msr dbgbvr4_el1, x9
561 msr dbgbvr3_el1, x8
562 msr dbgbvr2_el1, x7
563 msr dbgbvr1_el1, x6
564 msr dbgbvr0_el1, x5
565
566 add x3, x2, #CPU_SYSREG_OFFSET(DBGWCR0_EL1)
567
568 adr x26, 1f
569 add x26, x26, x25, lsl #2
570 br x26
5711:
572 ldr x20, [x3, #(15 * 8)]
573 ldr x19, [x3, #(14 * 8)]
574 ldr x18, [x3, #(13 * 8)]
575 ldr x17, [x3, #(12 * 8)]
576 ldr x16, [x3, #(11 * 8)]
577 ldr x15, [x3, #(10 * 8)]
578 ldr x14, [x3, #(9 * 8)]
579 ldr x13, [x3, #(8 * 8)]
580 ldr x12, [x3, #(7 * 8)]
581 ldr x11, [x3, #(6 * 8)]
582 ldr x10, [x3, #(5 * 8)]
583 ldr x9, [x3, #(4 * 8)]
584 ldr x8, [x3, #(3 * 8)]
585 ldr x7, [x3, #(2 * 8)]
586 ldr x6, [x3, #(1 * 8)]
587 ldr x5, [x3, #(0 * 8)]
588
589 adr x26, 1f
590 add x26, x26, x25, lsl #2
591 br x26
5921:
593 msr dbgwcr15_el1, x20
594 msr dbgwcr14_el1, x19
595 msr dbgwcr13_el1, x18
596 msr dbgwcr12_el1, x17
597 msr dbgwcr11_el1, x16
598 msr dbgwcr10_el1, x15
599 msr dbgwcr9_el1, x14
600 msr dbgwcr8_el1, x13
601 msr dbgwcr7_el1, x12
602 msr dbgwcr6_el1, x11
603 msr dbgwcr5_el1, x10
604 msr dbgwcr4_el1, x9
605 msr dbgwcr3_el1, x8
606 msr dbgwcr2_el1, x7
607 msr dbgwcr1_el1, x6
608 msr dbgwcr0_el1, x5
609
610 add x3, x2, #CPU_SYSREG_OFFSET(DBGWVR0_EL1)
611
612 adr x26, 1f
613 add x26, x26, x25, lsl #2
614 br x26
6151:
616 ldr x20, [x3, #(15 * 8)]
617 ldr x19, [x3, #(14 * 8)]
618 ldr x18, [x3, #(13 * 8)]
619 ldr x17, [x3, #(12 * 8)]
620 ldr x16, [x3, #(11 * 8)]
621 ldr x15, [x3, #(10 * 8)]
622 ldr x14, [x3, #(9 * 8)]
623 ldr x13, [x3, #(8 * 8)]
624 ldr x12, [x3, #(7 * 8)]
625 ldr x11, [x3, #(6 * 8)]
626 ldr x10, [x3, #(5 * 8)]
627 ldr x9, [x3, #(4 * 8)]
628 ldr x8, [x3, #(3 * 8)]
629 ldr x7, [x3, #(2 * 8)]
630 ldr x6, [x3, #(1 * 8)]
631 ldr x5, [x3, #(0 * 8)]
632
633 adr x26, 1f
634 add x26, x26, x25, lsl #2
635 br x26
6361:
637 msr dbgwvr15_el1, x20
638 msr dbgwvr14_el1, x19
639 msr dbgwvr13_el1, x18
640 msr dbgwvr12_el1, x17
641 msr dbgwvr11_el1, x16
642 msr dbgwvr10_el1, x15
643 msr dbgwvr9_el1, x14
644 msr dbgwvr8_el1, x13
645 msr dbgwvr7_el1, x12
646 msr dbgwvr6_el1, x11
647 msr dbgwvr5_el1, x10
648 msr dbgwvr4_el1, x9
649 msr dbgwvr3_el1, x8
650 msr dbgwvr2_el1, x7
651 msr dbgwvr1_el1, x6
652 msr dbgwvr0_el1, x5
653
654 ldr x21, [x2, #CPU_SYSREG_OFFSET(MDCCINT_EL1)]
655 msr mdccint_el1, x21
271.endm 656.endm
272 657
273.macro skip_32bit_state tmp, target 658.macro skip_32bit_state tmp, target
@@ -282,6 +667,35 @@ __kvm_hyp_code_start:
282 tbz \tmp, #12, \target 667 tbz \tmp, #12, \target
283.endm 668.endm
284 669
670.macro skip_debug_state tmp, target
671 ldr \tmp, [x0, #VCPU_DEBUG_FLAGS]
672 tbz \tmp, #KVM_ARM64_DEBUG_DIRTY_SHIFT, \target
673.endm
674
675.macro compute_debug_state target
676 // Compute debug state: If any of KDE, MDE or KVM_ARM64_DEBUG_DIRTY
677 // is set, we do a full save/restore cycle and disable trapping.
678 add x25, x0, #VCPU_CONTEXT
679
680 // Check the state of MDSCR_EL1
681 ldr x25, [x25, #CPU_SYSREG_OFFSET(MDSCR_EL1)]
682 and x26, x25, #DBG_MDSCR_KDE
683 and x25, x25, #DBG_MDSCR_MDE
684 adds xzr, x25, x26
685 b.eq 9998f // Nothing to see there
686
687 // If any interesting bits was set, we must set the flag
688 mov x26, #KVM_ARM64_DEBUG_DIRTY
689 str x26, [x0, #VCPU_DEBUG_FLAGS]
690 b 9999f // Don't skip restore
691
6929998:
693 // Otherwise load the flags from memory in case we recently
694 // trapped
695 skip_debug_state x25, \target
6969999:
697.endm
698
285.macro save_guest_32bit_state 699.macro save_guest_32bit_state
286 skip_32bit_state x3, 1f 700 skip_32bit_state x3, 1f
287 701
@@ -297,10 +711,13 @@ __kvm_hyp_code_start:
297 mrs x4, dacr32_el2 711 mrs x4, dacr32_el2
298 mrs x5, ifsr32_el2 712 mrs x5, ifsr32_el2
299 mrs x6, fpexc32_el2 713 mrs x6, fpexc32_el2
300 mrs x7, dbgvcr32_el2
301 stp x4, x5, [x3] 714 stp x4, x5, [x3]
302 stp x6, x7, [x3, #16] 715 str x6, [x3, #16]
303 716
717 skip_debug_state x8, 2f
718 mrs x7, dbgvcr32_el2
719 str x7, [x3, #24]
7202:
304 skip_tee_state x8, 1f 721 skip_tee_state x8, 1f
305 722
306 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1) 723 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1)
@@ -323,12 +740,15 @@ __kvm_hyp_code_start:
323 740
324 add x3, x2, #CPU_SYSREG_OFFSET(DACR32_EL2) 741 add x3, x2, #CPU_SYSREG_OFFSET(DACR32_EL2)
325 ldp x4, x5, [x3] 742 ldp x4, x5, [x3]
326 ldp x6, x7, [x3, #16] 743 ldr x6, [x3, #16]
327 msr dacr32_el2, x4 744 msr dacr32_el2, x4
328 msr ifsr32_el2, x5 745 msr ifsr32_el2, x5
329 msr fpexc32_el2, x6 746 msr fpexc32_el2, x6
330 msr dbgvcr32_el2, x7
331 747
748 skip_debug_state x8, 2f
749 ldr x7, [x3, #24]
750 msr dbgvcr32_el2, x7
7512:
332 skip_tee_state x8, 1f 752 skip_tee_state x8, 1f
333 753
334 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1) 754 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1)
@@ -339,11 +759,8 @@ __kvm_hyp_code_start:
339.endm 759.endm
340 760
341.macro activate_traps 761.macro activate_traps
342 ldr x2, [x0, #VCPU_IRQ_LINES] 762 ldr x2, [x0, #VCPU_HCR_EL2]
343 ldr x1, [x0, #VCPU_HCR_EL2] 763 msr hcr_el2, x2
344 orr x2, x2, x1
345 msr hcr_el2, x2
346
347 ldr x2, =(CPTR_EL2_TTA) 764 ldr x2, =(CPTR_EL2_TTA)
348 msr cptr_el2, x2 765 msr cptr_el2, x2
349 766
@@ -353,6 +770,14 @@ __kvm_hyp_code_start:
353 mrs x2, mdcr_el2 770 mrs x2, mdcr_el2
354 and x2, x2, #MDCR_EL2_HPMN_MASK 771 and x2, x2, #MDCR_EL2_HPMN_MASK
355 orr x2, x2, #(MDCR_EL2_TPM | MDCR_EL2_TPMCR) 772 orr x2, x2, #(MDCR_EL2_TPM | MDCR_EL2_TPMCR)
773 orr x2, x2, #(MDCR_EL2_TDRA | MDCR_EL2_TDOSA)
774
775 // Check for KVM_ARM64_DEBUG_DIRTY, and set debug to trap
776 // if not dirty.
777 ldr x3, [x0, #VCPU_DEBUG_FLAGS]
778 tbnz x3, #KVM_ARM64_DEBUG_DIRTY_SHIFT, 1f
779 orr x2, x2, #MDCR_EL2_TDA
7801:
356 msr mdcr_el2, x2 781 msr mdcr_el2, x2
357.endm 782.endm
358 783
@@ -379,100 +804,33 @@ __kvm_hyp_code_start:
379.endm 804.endm
380 805
381/* 806/*
382 * Save the VGIC CPU state into memory 807 * Call into the vgic backend for state saving
383 * x0: Register pointing to VCPU struct
384 * Do not corrupt x1!!!
385 */ 808 */
386.macro save_vgic_state 809.macro save_vgic_state
387 /* Get VGIC VCTRL base into x2 */ 810 adr x24, __vgic_sr_vectors
388 ldr x2, [x0, #VCPU_KVM] 811 ldr x24, [x24, VGIC_SAVE_FN]
389 kern_hyp_va x2 812 kern_hyp_va x24
390 ldr x2, [x2, #KVM_VGIC_VCTRL] 813 blr x24
391 kern_hyp_va x2 814 mrs x24, hcr_el2
392 cbz x2, 2f // disabled 815 mov x25, #HCR_INT_OVERRIDE
393 816 neg x25, x25
394 /* Compute the address of struct vgic_cpu */ 817 and x24, x24, x25
395 add x3, x0, #VCPU_VGIC_CPU 818 msr hcr_el2, x24
396
397 /* Save all interesting registers */
398 ldr w4, [x2, #GICH_HCR]
399 ldr w5, [x2, #GICH_VMCR]
400 ldr w6, [x2, #GICH_MISR]
401 ldr w7, [x2, #GICH_EISR0]
402 ldr w8, [x2, #GICH_EISR1]
403 ldr w9, [x2, #GICH_ELRSR0]
404 ldr w10, [x2, #GICH_ELRSR1]
405 ldr w11, [x2, #GICH_APR]
406CPU_BE( rev w4, w4 )
407CPU_BE( rev w5, w5 )
408CPU_BE( rev w6, w6 )
409CPU_BE( rev w7, w7 )
410CPU_BE( rev w8, w8 )
411CPU_BE( rev w9, w9 )
412CPU_BE( rev w10, w10 )
413CPU_BE( rev w11, w11 )
414
415 str w4, [x3, #VGIC_CPU_HCR]
416 str w5, [x3, #VGIC_CPU_VMCR]
417 str w6, [x3, #VGIC_CPU_MISR]
418 str w7, [x3, #VGIC_CPU_EISR]
419 str w8, [x3, #(VGIC_CPU_EISR + 4)]
420 str w9, [x3, #VGIC_CPU_ELRSR]
421 str w10, [x3, #(VGIC_CPU_ELRSR + 4)]
422 str w11, [x3, #VGIC_CPU_APR]
423
424 /* Clear GICH_HCR */
425 str wzr, [x2, #GICH_HCR]
426
427 /* Save list registers */
428 add x2, x2, #GICH_LR0
429 ldr w4, [x3, #VGIC_CPU_NR_LR]
430 add x3, x3, #VGIC_CPU_LR
4311: ldr w5, [x2], #4
432CPU_BE( rev w5, w5 )
433 str w5, [x3], #4
434 sub w4, w4, #1
435 cbnz w4, 1b
4362:
437.endm 819.endm
438 820
439/* 821/*
440 * Restore the VGIC CPU state from memory 822 * Call into the vgic backend for state restoring
441 * x0: Register pointing to VCPU struct
442 */ 823 */
443.macro restore_vgic_state 824.macro restore_vgic_state
444 /* Get VGIC VCTRL base into x2 */ 825 mrs x24, hcr_el2
445 ldr x2, [x0, #VCPU_KVM] 826 ldr x25, [x0, #VCPU_IRQ_LINES]
446 kern_hyp_va x2 827 orr x24, x24, #HCR_INT_OVERRIDE
447 ldr x2, [x2, #KVM_VGIC_VCTRL] 828 orr x24, x24, x25
448 kern_hyp_va x2 829 msr hcr_el2, x24
449 cbz x2, 2f // disabled 830 adr x24, __vgic_sr_vectors
450 831 ldr x24, [x24, #VGIC_RESTORE_FN]
451 /* Compute the address of struct vgic_cpu */ 832 kern_hyp_va x24
452 add x3, x0, #VCPU_VGIC_CPU 833 blr x24
453
454 /* We only restore a minimal set of registers */
455 ldr w4, [x3, #VGIC_CPU_HCR]
456 ldr w5, [x3, #VGIC_CPU_VMCR]
457 ldr w6, [x3, #VGIC_CPU_APR]
458CPU_BE( rev w4, w4 )
459CPU_BE( rev w5, w5 )
460CPU_BE( rev w6, w6 )
461
462 str w4, [x2, #GICH_HCR]
463 str w5, [x2, #GICH_VMCR]
464 str w6, [x2, #GICH_APR]
465
466 /* Restore list registers */
467 add x2, x2, #GICH_LR0
468 ldr w4, [x3, #VGIC_CPU_NR_LR]
469 add x3, x3, #VGIC_CPU_LR
4701: ldr w5, [x3], #4
471CPU_BE( rev w5, w5 )
472 str w5, [x2], #4
473 sub w4, w4, #1
474 cbnz w4, 1b
4752:
476.endm 834.endm
477 835
478.macro save_timer_state 836.macro save_timer_state
@@ -537,6 +895,14 @@ __restore_sysregs:
537 restore_sysregs 895 restore_sysregs
538 ret 896 ret
539 897
898__save_debug:
899 save_debug
900 ret
901
902__restore_debug:
903 restore_debug
904 ret
905
540__save_fpsimd: 906__save_fpsimd:
541 save_fpsimd 907 save_fpsimd
542 ret 908 ret
@@ -568,6 +934,9 @@ ENTRY(__kvm_vcpu_run)
568 bl __save_fpsimd 934 bl __save_fpsimd
569 bl __save_sysregs 935 bl __save_sysregs
570 936
937 compute_debug_state 1f
938 bl __save_debug
9391:
571 activate_traps 940 activate_traps
572 activate_vm 941 activate_vm
573 942
@@ -579,6 +948,10 @@ ENTRY(__kvm_vcpu_run)
579 948
580 bl __restore_sysregs 949 bl __restore_sysregs
581 bl __restore_fpsimd 950 bl __restore_fpsimd
951
952 skip_debug_state x3, 1f
953 bl __restore_debug
9541:
582 restore_guest_32bit_state 955 restore_guest_32bit_state
583 restore_guest_regs 956 restore_guest_regs
584 957
@@ -595,6 +968,10 @@ __kvm_vcpu_return:
595 save_guest_regs 968 save_guest_regs
596 bl __save_fpsimd 969 bl __save_fpsimd
597 bl __save_sysregs 970 bl __save_sysregs
971
972 skip_debug_state x3, 1f
973 bl __save_debug
9741:
598 save_guest_32bit_state 975 save_guest_32bit_state
599 976
600 save_timer_state 977 save_timer_state
@@ -609,6 +986,14 @@ __kvm_vcpu_return:
609 986
610 bl __restore_sysregs 987 bl __restore_sysregs
611 bl __restore_fpsimd 988 bl __restore_fpsimd
989
990 skip_debug_state x3, 1f
991 // Clear the dirty flag for the next run, as all the state has
992 // already been saved. Note that we nuke the whole 64bit word.
993 // If we ever add more flags, we'll have to be more careful...
994 str xzr, [x0, #VCPU_DEBUG_FLAGS]
995 bl __restore_debug
9961:
612 restore_host_regs 997 restore_host_regs
613 998
614 mov x0, x1 999 mov x0, x1
@@ -653,6 +1038,12 @@ ENTRY(__kvm_flush_vm_context)
653 ret 1038 ret
654ENDPROC(__kvm_flush_vm_context) 1039ENDPROC(__kvm_flush_vm_context)
655 1040
1041 // struct vgic_sr_vectors __vgi_sr_vectors;
1042 .align 3
1043ENTRY(__vgic_sr_vectors)
1044 .skip VGIC_SR_VECTOR_SZ
1045ENDPROC(__vgic_sr_vectors)
1046
656__kvm_hyp_panic: 1047__kvm_hyp_panic:
657 // Guess the context by looking at VTTBR: 1048 // Guess the context by looking at VTTBR:
658 // If zero, then we're already a host. 1049 // If zero, then we're already a host.
@@ -830,7 +1221,7 @@ el1_trap:
830 mrs x2, far_el2 1221 mrs x2, far_el2
831 1222
8322: mrs x0, tpidr_el2 12232: mrs x0, tpidr_el2
833 str x1, [x0, #VCPU_ESR_EL2] 1224 str w1, [x0, #VCPU_ESR_EL2]
834 str x2, [x0, #VCPU_FAR_EL2] 1225 str x2, [x0, #VCPU_FAR_EL2]
835 str x3, [x0, #VCPU_HPFAR_EL2] 1226 str x3, [x0, #VCPU_HPFAR_EL2]
836 1227
@@ -880,7 +1271,4 @@ ENTRY(__kvm_hyp_vector)
880 ventry el1_error_invalid // Error 32-bit EL1 1271 ventry el1_error_invalid // Error 32-bit EL1
881ENDPROC(__kvm_hyp_vector) 1272ENDPROC(__kvm_hyp_vector)
882 1273
883__kvm_hyp_code_end:
884 .globl __kvm_hyp_code_end
885
886 .popsection 1274 .popsection
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index c59a1bdab5eb..5805e7c4a4dd 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -30,6 +30,7 @@
30#include <asm/kvm_mmu.h> 30#include <asm/kvm_mmu.h>
31#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
32#include <asm/cputype.h> 32#include <asm/cputype.h>
33#include <asm/debug-monitors.h>
33#include <trace/events/kvm.h> 34#include <trace/events/kvm.h>
34 35
35#include "sys_regs.h" 36#include "sys_regs.h"
@@ -137,10 +138,11 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu,
137 if (!p->is_aarch32) { 138 if (!p->is_aarch32) {
138 vcpu_sys_reg(vcpu, r->reg) = val; 139 vcpu_sys_reg(vcpu, r->reg) = val;
139 } else { 140 } else {
140 vcpu_cp15(vcpu, r->reg) = val & 0xffffffffUL;
141 if (!p->is_32bit) 141 if (!p->is_32bit)
142 vcpu_cp15(vcpu, r->reg + 1) = val >> 32; 142 vcpu_cp15_64_high(vcpu, r->reg) = val >> 32;
143 vcpu_cp15_64_low(vcpu, r->reg) = val & 0xffffffffUL;
143 } 144 }
145
144 return true; 146 return true;
145} 147}
146 148
@@ -163,18 +165,9 @@ static bool access_sctlr(struct kvm_vcpu *vcpu,
163 return true; 165 return true;
164} 166}
165 167
166/* 168static bool trap_raz_wi(struct kvm_vcpu *vcpu,
167 * We could trap ID_DFR0 and tell the guest we don't support performance 169 const struct sys_reg_params *p,
168 * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was 170 const struct sys_reg_desc *r)
169 * NAKed, so it will read the PMCR anyway.
170 *
171 * Therefore we tell the guest we have 0 counters. Unfortunately, we
172 * must always support PMCCNTR (the cycle counter): we just RAZ/WI for
173 * all PM registers, which doesn't crash the guest kernel at least.
174 */
175static bool pm_fake(struct kvm_vcpu *vcpu,
176 const struct sys_reg_params *p,
177 const struct sys_reg_desc *r)
178{ 171{
179 if (p->is_write) 172 if (p->is_write)
180 return ignore_write(vcpu, p); 173 return ignore_write(vcpu, p);
@@ -182,6 +175,73 @@ static bool pm_fake(struct kvm_vcpu *vcpu,
182 return read_zero(vcpu, p); 175 return read_zero(vcpu, p);
183} 176}
184 177
178static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,
179 const struct sys_reg_params *p,
180 const struct sys_reg_desc *r)
181{
182 if (p->is_write) {
183 return ignore_write(vcpu, p);
184 } else {
185 *vcpu_reg(vcpu, p->Rt) = (1 << 3);
186 return true;
187 }
188}
189
190static bool trap_dbgauthstatus_el1(struct kvm_vcpu *vcpu,
191 const struct sys_reg_params *p,
192 const struct sys_reg_desc *r)
193{
194 if (p->is_write) {
195 return ignore_write(vcpu, p);
196 } else {
197 u32 val;
198 asm volatile("mrs %0, dbgauthstatus_el1" : "=r" (val));
199 *vcpu_reg(vcpu, p->Rt) = val;
200 return true;
201 }
202}
203
204/*
205 * We want to avoid world-switching all the DBG registers all the
206 * time:
207 *
208 * - If we've touched any debug register, it is likely that we're
209 * going to touch more of them. It then makes sense to disable the
210 * traps and start doing the save/restore dance
211 * - If debug is active (DBG_MDSCR_KDE or DBG_MDSCR_MDE set), it is
212 * then mandatory to save/restore the registers, as the guest
213 * depends on them.
214 *
215 * For this, we use a DIRTY bit, indicating the guest has modified the
216 * debug registers, used as follow:
217 *
218 * On guest entry:
219 * - If the dirty bit is set (because we're coming back from trapping),
220 * disable the traps, save host registers, restore guest registers.
221 * - If debug is actively in use (DBG_MDSCR_KDE or DBG_MDSCR_MDE set),
222 * set the dirty bit, disable the traps, save host registers,
223 * restore guest registers.
224 * - Otherwise, enable the traps
225 *
226 * On guest exit:
227 * - If the dirty bit is set, save guest registers, restore host
228 * registers and clear the dirty bit. This ensure that the host can
229 * now use the debug registers.
230 */
231static bool trap_debug_regs(struct kvm_vcpu *vcpu,
232 const struct sys_reg_params *p,
233 const struct sys_reg_desc *r)
234{
235 if (p->is_write) {
236 vcpu_sys_reg(vcpu, r->reg) = *vcpu_reg(vcpu, p->Rt);
237 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
238 } else {
239 *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, r->reg);
240 }
241
242 return true;
243}
244
185static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) 245static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
186{ 246{
187 u64 amair; 247 u64 amair;
@@ -198,9 +258,39 @@ static void reset_mpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
198 vcpu_sys_reg(vcpu, MPIDR_EL1) = (1UL << 31) | (vcpu->vcpu_id & 0xff); 258 vcpu_sys_reg(vcpu, MPIDR_EL1) = (1UL << 31) | (vcpu->vcpu_id & 0xff);
199} 259}
200 260
261/* Silly macro to expand the DBG{BCR,BVR,WVR,WCR}n_EL1 registers in one go */
262#define DBG_BCR_BVR_WCR_WVR_EL1(n) \
263 /* DBGBVRn_EL1 */ \
264 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm((n)), Op2(0b100), \
265 trap_debug_regs, reset_val, (DBGBVR0_EL1 + (n)), 0 }, \
266 /* DBGBCRn_EL1 */ \
267 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm((n)), Op2(0b101), \
268 trap_debug_regs, reset_val, (DBGBCR0_EL1 + (n)), 0 }, \
269 /* DBGWVRn_EL1 */ \
270 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm((n)), Op2(0b110), \
271 trap_debug_regs, reset_val, (DBGWVR0_EL1 + (n)), 0 }, \
272 /* DBGWCRn_EL1 */ \
273 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm((n)), Op2(0b111), \
274 trap_debug_regs, reset_val, (DBGWCR0_EL1 + (n)), 0 }
275
201/* 276/*
202 * Architected system registers. 277 * Architected system registers.
203 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 278 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2
279 *
280 * We could trap ID_DFR0 and tell the guest we don't support performance
281 * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was
282 * NAKed, so it will read the PMCR anyway.
283 *
284 * Therefore we tell the guest we have 0 counters. Unfortunately, we
285 * must always support PMCCNTR (the cycle counter): we just RAZ/WI for
286 * all PM registers, which doesn't crash the guest kernel at least.
287 *
288 * Debug handling: We do trap most, if not all debug related system
289 * registers. The implementation is good enough to ensure that a guest
290 * can use these with minimal performance degradation. The drawback is
291 * that we don't implement any of the external debug, none of the
292 * OSlock protocol. This should be revisited if we ever encounter a
293 * more demanding guest...
204 */ 294 */
205static const struct sys_reg_desc sys_reg_descs[] = { 295static const struct sys_reg_desc sys_reg_descs[] = {
206 /* DC ISW */ 296 /* DC ISW */
@@ -213,12 +303,71 @@ static const struct sys_reg_desc sys_reg_descs[] = {
213 { Op0(0b01), Op1(0b000), CRn(0b0111), CRm(0b1110), Op2(0b010), 303 { Op0(0b01), Op1(0b000), CRn(0b0111), CRm(0b1110), Op2(0b010),
214 access_dcsw }, 304 access_dcsw },
215 305
306 DBG_BCR_BVR_WCR_WVR_EL1(0),
307 DBG_BCR_BVR_WCR_WVR_EL1(1),
308 /* MDCCINT_EL1 */
309 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b000),
310 trap_debug_regs, reset_val, MDCCINT_EL1, 0 },
311 /* MDSCR_EL1 */
312 { Op0(0b10), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b010),
313 trap_debug_regs, reset_val, MDSCR_EL1, 0 },
314 DBG_BCR_BVR_WCR_WVR_EL1(2),
315 DBG_BCR_BVR_WCR_WVR_EL1(3),
316 DBG_BCR_BVR_WCR_WVR_EL1(4),
317 DBG_BCR_BVR_WCR_WVR_EL1(5),
318 DBG_BCR_BVR_WCR_WVR_EL1(6),
319 DBG_BCR_BVR_WCR_WVR_EL1(7),
320 DBG_BCR_BVR_WCR_WVR_EL1(8),
321 DBG_BCR_BVR_WCR_WVR_EL1(9),
322 DBG_BCR_BVR_WCR_WVR_EL1(10),
323 DBG_BCR_BVR_WCR_WVR_EL1(11),
324 DBG_BCR_BVR_WCR_WVR_EL1(12),
325 DBG_BCR_BVR_WCR_WVR_EL1(13),
326 DBG_BCR_BVR_WCR_WVR_EL1(14),
327 DBG_BCR_BVR_WCR_WVR_EL1(15),
328
329 /* MDRAR_EL1 */
330 { Op0(0b10), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b000),
331 trap_raz_wi },
332 /* OSLAR_EL1 */
333 { Op0(0b10), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b100),
334 trap_raz_wi },
335 /* OSLSR_EL1 */
336 { Op0(0b10), Op1(0b000), CRn(0b0001), CRm(0b0001), Op2(0b100),
337 trap_oslsr_el1 },
338 /* OSDLR_EL1 */
339 { Op0(0b10), Op1(0b000), CRn(0b0001), CRm(0b0011), Op2(0b100),
340 trap_raz_wi },
341 /* DBGPRCR_EL1 */
342 { Op0(0b10), Op1(0b000), CRn(0b0001), CRm(0b0100), Op2(0b100),
343 trap_raz_wi },
344 /* DBGCLAIMSET_EL1 */
345 { Op0(0b10), Op1(0b000), CRn(0b0111), CRm(0b1000), Op2(0b110),
346 trap_raz_wi },
347 /* DBGCLAIMCLR_EL1 */
348 { Op0(0b10), Op1(0b000), CRn(0b0111), CRm(0b1001), Op2(0b110),
349 trap_raz_wi },
350 /* DBGAUTHSTATUS_EL1 */
351 { Op0(0b10), Op1(0b000), CRn(0b0111), CRm(0b1110), Op2(0b110),
352 trap_dbgauthstatus_el1 },
353
216 /* TEECR32_EL1 */ 354 /* TEECR32_EL1 */
217 { Op0(0b10), Op1(0b010), CRn(0b0000), CRm(0b0000), Op2(0b000), 355 { Op0(0b10), Op1(0b010), CRn(0b0000), CRm(0b0000), Op2(0b000),
218 NULL, reset_val, TEECR32_EL1, 0 }, 356 NULL, reset_val, TEECR32_EL1, 0 },
219 /* TEEHBR32_EL1 */ 357 /* TEEHBR32_EL1 */
220 { Op0(0b10), Op1(0b010), CRn(0b0001), CRm(0b0000), Op2(0b000), 358 { Op0(0b10), Op1(0b010), CRn(0b0001), CRm(0b0000), Op2(0b000),
221 NULL, reset_val, TEEHBR32_EL1, 0 }, 359 NULL, reset_val, TEEHBR32_EL1, 0 },
360
361 /* MDCCSR_EL1 */
362 { Op0(0b10), Op1(0b011), CRn(0b0000), CRm(0b0001), Op2(0b000),
363 trap_raz_wi },
364 /* DBGDTR_EL0 */
365 { Op0(0b10), Op1(0b011), CRn(0b0000), CRm(0b0100), Op2(0b000),
366 trap_raz_wi },
367 /* DBGDTR[TR]X_EL0 */
368 { Op0(0b10), Op1(0b011), CRn(0b0000), CRm(0b0101), Op2(0b000),
369 trap_raz_wi },
370
222 /* DBGVCR32_EL2 */ 371 /* DBGVCR32_EL2 */
223 { Op0(0b10), Op1(0b100), CRn(0b0000), CRm(0b0111), Op2(0b000), 372 { Op0(0b10), Op1(0b100), CRn(0b0000), CRm(0b0111), Op2(0b000),
224 NULL, reset_val, DBGVCR32_EL2, 0 }, 373 NULL, reset_val, DBGVCR32_EL2, 0 },
@@ -260,10 +409,10 @@ static const struct sys_reg_desc sys_reg_descs[] = {
260 409
261 /* PMINTENSET_EL1 */ 410 /* PMINTENSET_EL1 */
262 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001), 411 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001),
263 pm_fake }, 412 trap_raz_wi },
264 /* PMINTENCLR_EL1 */ 413 /* PMINTENCLR_EL1 */
265 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b010), 414 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b010),
266 pm_fake }, 415 trap_raz_wi },
267 416
268 /* MAIR_EL1 */ 417 /* MAIR_EL1 */
269 { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0010), Op2(0b000), 418 { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0010), Op2(0b000),
@@ -292,43 +441,43 @@ static const struct sys_reg_desc sys_reg_descs[] = {
292 441
293 /* PMCR_EL0 */ 442 /* PMCR_EL0 */
294 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b000), 443 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b000),
295 pm_fake }, 444 trap_raz_wi },
296 /* PMCNTENSET_EL0 */ 445 /* PMCNTENSET_EL0 */
297 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b001), 446 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b001),
298 pm_fake }, 447 trap_raz_wi },
299 /* PMCNTENCLR_EL0 */ 448 /* PMCNTENCLR_EL0 */
300 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b010), 449 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b010),
301 pm_fake }, 450 trap_raz_wi },
302 /* PMOVSCLR_EL0 */ 451 /* PMOVSCLR_EL0 */
303 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011), 452 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011),
304 pm_fake }, 453 trap_raz_wi },
305 /* PMSWINC_EL0 */ 454 /* PMSWINC_EL0 */
306 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100), 455 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100),
307 pm_fake }, 456 trap_raz_wi },
308 /* PMSELR_EL0 */ 457 /* PMSELR_EL0 */
309 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101), 458 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101),
310 pm_fake }, 459 trap_raz_wi },
311 /* PMCEID0_EL0 */ 460 /* PMCEID0_EL0 */
312 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110), 461 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110),
313 pm_fake }, 462 trap_raz_wi },
314 /* PMCEID1_EL0 */ 463 /* PMCEID1_EL0 */
315 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b111), 464 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b111),
316 pm_fake }, 465 trap_raz_wi },
317 /* PMCCNTR_EL0 */ 466 /* PMCCNTR_EL0 */
318 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b000), 467 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b000),
319 pm_fake }, 468 trap_raz_wi },
320 /* PMXEVTYPER_EL0 */ 469 /* PMXEVTYPER_EL0 */
321 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b001), 470 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b001),
322 pm_fake }, 471 trap_raz_wi },
323 /* PMXEVCNTR_EL0 */ 472 /* PMXEVCNTR_EL0 */
324 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b010), 473 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b010),
325 pm_fake }, 474 trap_raz_wi },
326 /* PMUSERENR_EL0 */ 475 /* PMUSERENR_EL0 */
327 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b000), 476 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b000),
328 pm_fake }, 477 trap_raz_wi },
329 /* PMOVSSET_EL0 */ 478 /* PMOVSSET_EL0 */
330 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011), 479 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011),
331 pm_fake }, 480 trap_raz_wi },
332 481
333 /* TPIDR_EL0 */ 482 /* TPIDR_EL0 */
334 { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010), 483 { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010),
@@ -348,13 +497,161 @@ static const struct sys_reg_desc sys_reg_descs[] = {
348 NULL, reset_val, FPEXC32_EL2, 0x70 }, 497 NULL, reset_val, FPEXC32_EL2, 0x70 },
349}; 498};
350 499
500static bool trap_dbgidr(struct kvm_vcpu *vcpu,
501 const struct sys_reg_params *p,
502 const struct sys_reg_desc *r)
503{
504 if (p->is_write) {
505 return ignore_write(vcpu, p);
506 } else {
507 u64 dfr = read_cpuid(ID_AA64DFR0_EL1);
508 u64 pfr = read_cpuid(ID_AA64PFR0_EL1);
509 u32 el3 = !!((pfr >> 12) & 0xf);
510
511 *vcpu_reg(vcpu, p->Rt) = ((((dfr >> 20) & 0xf) << 28) |
512 (((dfr >> 12) & 0xf) << 24) |
513 (((dfr >> 28) & 0xf) << 20) |
514 (6 << 16) | (el3 << 14) | (el3 << 12));
515 return true;
516 }
517}
518
519static bool trap_debug32(struct kvm_vcpu *vcpu,
520 const struct sys_reg_params *p,
521 const struct sys_reg_desc *r)
522{
523 if (p->is_write) {
524 vcpu_cp14(vcpu, r->reg) = *vcpu_reg(vcpu, p->Rt);
525 vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
526 } else {
527 *vcpu_reg(vcpu, p->Rt) = vcpu_cp14(vcpu, r->reg);
528 }
529
530 return true;
531}
532
533#define DBG_BCR_BVR_WCR_WVR(n) \
534 /* DBGBVRn */ \
535 { Op1( 0), CRn( 0), CRm((n)), Op2( 4), trap_debug32, \
536 NULL, (cp14_DBGBVR0 + (n) * 2) }, \
537 /* DBGBCRn */ \
538 { Op1( 0), CRn( 0), CRm((n)), Op2( 5), trap_debug32, \
539 NULL, (cp14_DBGBCR0 + (n) * 2) }, \
540 /* DBGWVRn */ \
541 { Op1( 0), CRn( 0), CRm((n)), Op2( 6), trap_debug32, \
542 NULL, (cp14_DBGWVR0 + (n) * 2) }, \
543 /* DBGWCRn */ \
544 { Op1( 0), CRn( 0), CRm((n)), Op2( 7), trap_debug32, \
545 NULL, (cp14_DBGWCR0 + (n) * 2) }
546
547#define DBGBXVR(n) \
548 { Op1( 0), CRn( 1), CRm((n)), Op2( 1), trap_debug32, \
549 NULL, cp14_DBGBXVR0 + n * 2 }
550
551/*
552 * Trapped cp14 registers. We generally ignore most of the external
553 * debug, on the principle that they don't really make sense to a
554 * guest. Revisit this one day, whould this principle change.
555 */
556static const struct sys_reg_desc cp14_regs[] = {
557 /* DBGIDR */
558 { Op1( 0), CRn( 0), CRm( 0), Op2( 0), trap_dbgidr },
559 /* DBGDTRRXext */
560 { Op1( 0), CRn( 0), CRm( 0), Op2( 2), trap_raz_wi },
561
562 DBG_BCR_BVR_WCR_WVR(0),
563 /* DBGDSCRint */
564 { Op1( 0), CRn( 0), CRm( 1), Op2( 0), trap_raz_wi },
565 DBG_BCR_BVR_WCR_WVR(1),
566 /* DBGDCCINT */
567 { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32 },
568 /* DBGDSCRext */
569 { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32 },
570 DBG_BCR_BVR_WCR_WVR(2),
571 /* DBGDTR[RT]Xint */
572 { Op1( 0), CRn( 0), CRm( 3), Op2( 0), trap_raz_wi },
573 /* DBGDTR[RT]Xext */
574 { Op1( 0), CRn( 0), CRm( 3), Op2( 2), trap_raz_wi },
575 DBG_BCR_BVR_WCR_WVR(3),
576 DBG_BCR_BVR_WCR_WVR(4),
577 DBG_BCR_BVR_WCR_WVR(5),
578 /* DBGWFAR */
579 { Op1( 0), CRn( 0), CRm( 6), Op2( 0), trap_raz_wi },
580 /* DBGOSECCR */
581 { Op1( 0), CRn( 0), CRm( 6), Op2( 2), trap_raz_wi },
582 DBG_BCR_BVR_WCR_WVR(6),
583 /* DBGVCR */
584 { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32 },
585 DBG_BCR_BVR_WCR_WVR(7),
586 DBG_BCR_BVR_WCR_WVR(8),
587 DBG_BCR_BVR_WCR_WVR(9),
588 DBG_BCR_BVR_WCR_WVR(10),
589 DBG_BCR_BVR_WCR_WVR(11),
590 DBG_BCR_BVR_WCR_WVR(12),
591 DBG_BCR_BVR_WCR_WVR(13),
592 DBG_BCR_BVR_WCR_WVR(14),
593 DBG_BCR_BVR_WCR_WVR(15),
594
595 /* DBGDRAR (32bit) */
596 { Op1( 0), CRn( 1), CRm( 0), Op2( 0), trap_raz_wi },
597
598 DBGBXVR(0),
599 /* DBGOSLAR */
600 { Op1( 0), CRn( 1), CRm( 0), Op2( 4), trap_raz_wi },
601 DBGBXVR(1),
602 /* DBGOSLSR */
603 { Op1( 0), CRn( 1), CRm( 1), Op2( 4), trap_oslsr_el1 },
604 DBGBXVR(2),
605 DBGBXVR(3),
606 /* DBGOSDLR */
607 { Op1( 0), CRn( 1), CRm( 3), Op2( 4), trap_raz_wi },
608 DBGBXVR(4),
609 /* DBGPRCR */
610 { Op1( 0), CRn( 1), CRm( 4), Op2( 4), trap_raz_wi },
611 DBGBXVR(5),
612 DBGBXVR(6),
613 DBGBXVR(7),
614 DBGBXVR(8),
615 DBGBXVR(9),
616 DBGBXVR(10),
617 DBGBXVR(11),
618 DBGBXVR(12),
619 DBGBXVR(13),
620 DBGBXVR(14),
621 DBGBXVR(15),
622
623 /* DBGDSAR (32bit) */
624 { Op1( 0), CRn( 2), CRm( 0), Op2( 0), trap_raz_wi },
625
626 /* DBGDEVID2 */
627 { Op1( 0), CRn( 7), CRm( 0), Op2( 7), trap_raz_wi },
628 /* DBGDEVID1 */
629 { Op1( 0), CRn( 7), CRm( 1), Op2( 7), trap_raz_wi },
630 /* DBGDEVID */
631 { Op1( 0), CRn( 7), CRm( 2), Op2( 7), trap_raz_wi },
632 /* DBGCLAIMSET */
633 { Op1( 0), CRn( 7), CRm( 8), Op2( 6), trap_raz_wi },
634 /* DBGCLAIMCLR */
635 { Op1( 0), CRn( 7), CRm( 9), Op2( 6), trap_raz_wi },
636 /* DBGAUTHSTATUS */
637 { Op1( 0), CRn( 7), CRm(14), Op2( 6), trap_dbgauthstatus_el1 },
638};
639
640/* Trapped cp14 64bit registers */
641static const struct sys_reg_desc cp14_64_regs[] = {
642 /* DBGDRAR (64bit) */
643 { Op1( 0), CRm( 1), .access = trap_raz_wi },
644
645 /* DBGDSAR (64bit) */
646 { Op1( 0), CRm( 2), .access = trap_raz_wi },
647};
648
351/* 649/*
352 * Trapped cp15 registers. TTBR0/TTBR1 get a double encoding, 650 * Trapped cp15 registers. TTBR0/TTBR1 get a double encoding,
353 * depending on the way they are accessed (as a 32bit or a 64bit 651 * depending on the way they are accessed (as a 32bit or a 64bit
354 * register). 652 * register).
355 */ 653 */
356static const struct sys_reg_desc cp15_regs[] = { 654static const struct sys_reg_desc cp15_regs[] = {
357 { Op1( 0), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
358 { Op1( 0), CRn( 1), CRm( 0), Op2( 0), access_sctlr, NULL, c1_SCTLR }, 655 { Op1( 0), CRn( 1), CRm( 0), Op2( 0), access_sctlr, NULL, c1_SCTLR },
359 { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 }, 656 { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
360 { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 }, 657 { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 },
@@ -374,26 +671,30 @@ static const struct sys_reg_desc cp15_regs[] = {
374 { Op1( 0), CRn( 7), CRm(10), Op2( 2), access_dcsw }, 671 { Op1( 0), CRn( 7), CRm(10), Op2( 2), access_dcsw },
375 { Op1( 0), CRn( 7), CRm(14), Op2( 2), access_dcsw }, 672 { Op1( 0), CRn( 7), CRm(14), Op2( 2), access_dcsw },
376 673
377 { Op1( 0), CRn( 9), CRm(12), Op2( 0), pm_fake }, 674 /* PMU */
378 { Op1( 0), CRn( 9), CRm(12), Op2( 1), pm_fake }, 675 { Op1( 0), CRn( 9), CRm(12), Op2( 0), trap_raz_wi },
379 { Op1( 0), CRn( 9), CRm(12), Op2( 2), pm_fake }, 676 { Op1( 0), CRn( 9), CRm(12), Op2( 1), trap_raz_wi },
380 { Op1( 0), CRn( 9), CRm(12), Op2( 3), pm_fake }, 677 { Op1( 0), CRn( 9), CRm(12), Op2( 2), trap_raz_wi },
381 { Op1( 0), CRn( 9), CRm(12), Op2( 5), pm_fake }, 678 { Op1( 0), CRn( 9), CRm(12), Op2( 3), trap_raz_wi },
382 { Op1( 0), CRn( 9), CRm(12), Op2( 6), pm_fake }, 679 { Op1( 0), CRn( 9), CRm(12), Op2( 5), trap_raz_wi },
383 { Op1( 0), CRn( 9), CRm(12), Op2( 7), pm_fake }, 680 { Op1( 0), CRn( 9), CRm(12), Op2( 6), trap_raz_wi },
384 { Op1( 0), CRn( 9), CRm(13), Op2( 0), pm_fake }, 681 { Op1( 0), CRn( 9), CRm(12), Op2( 7), trap_raz_wi },
385 { Op1( 0), CRn( 9), CRm(13), Op2( 1), pm_fake }, 682 { Op1( 0), CRn( 9), CRm(13), Op2( 0), trap_raz_wi },
386 { Op1( 0), CRn( 9), CRm(13), Op2( 2), pm_fake }, 683 { Op1( 0), CRn( 9), CRm(13), Op2( 1), trap_raz_wi },
387 { Op1( 0), CRn( 9), CRm(14), Op2( 0), pm_fake }, 684 { Op1( 0), CRn( 9), CRm(13), Op2( 2), trap_raz_wi },
388 { Op1( 0), CRn( 9), CRm(14), Op2( 1), pm_fake }, 685 { Op1( 0), CRn( 9), CRm(14), Op2( 0), trap_raz_wi },
389 { Op1( 0), CRn( 9), CRm(14), Op2( 2), pm_fake }, 686 { Op1( 0), CRn( 9), CRm(14), Op2( 1), trap_raz_wi },
687 { Op1( 0), CRn( 9), CRm(14), Op2( 2), trap_raz_wi },
390 688
391 { Op1( 0), CRn(10), CRm( 2), Op2( 0), access_vm_reg, NULL, c10_PRRR }, 689 { Op1( 0), CRn(10), CRm( 2), Op2( 0), access_vm_reg, NULL, c10_PRRR },
392 { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, 690 { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR },
393 { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, 691 { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 },
394 { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, 692 { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 },
395 { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, 693 { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID },
694};
396 695
696static const struct sys_reg_desc cp15_64_regs[] = {
697 { Op1( 0), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
397 { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR1 }, 698 { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR1 },
398}; 699};
399 700
@@ -454,26 +755,29 @@ int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run)
454 return 1; 755 return 1;
455} 756}
456 757
457int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run) 758/*
458{ 759 * emulate_cp -- tries to match a sys_reg access in a handling table, and
459 kvm_inject_undefined(vcpu); 760 * call the corresponding trap handler.
460 return 1; 761 *
461} 762 * @params: pointer to the descriptor of the access
462 763 * @table: array of trap descriptors
463static void emulate_cp15(struct kvm_vcpu *vcpu, 764 * @num: size of the trap descriptor array
464 const struct sys_reg_params *params) 765 *
766 * Return 0 if the access has been handled, and -1 if not.
767 */
768static int emulate_cp(struct kvm_vcpu *vcpu,
769 const struct sys_reg_params *params,
770 const struct sys_reg_desc *table,
771 size_t num)
465{ 772{
466 size_t num; 773 const struct sys_reg_desc *r;
467 const struct sys_reg_desc *table, *r;
468 774
469 table = get_target_table(vcpu->arch.target, false, &num); 775 if (!table)
776 return -1; /* Not handled */
470 777
471 /* Search target-specific then generic table. */
472 r = find_reg(params, table, num); 778 r = find_reg(params, table, num);
473 if (!r)
474 r = find_reg(params, cp15_regs, ARRAY_SIZE(cp15_regs));
475 779
476 if (likely(r)) { 780 if (r) {
477 /* 781 /*
478 * Not having an accessor means that we have 782 * Not having an accessor means that we have
479 * configured a trap that we don't know how to 783 * configured a trap that we don't know how to
@@ -485,22 +789,51 @@ static void emulate_cp15(struct kvm_vcpu *vcpu,
485 if (likely(r->access(vcpu, params, r))) { 789 if (likely(r->access(vcpu, params, r))) {
486 /* Skip instruction, since it was emulated */ 790 /* Skip instruction, since it was emulated */
487 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); 791 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
488 return;
489 } 792 }
490 /* If access function fails, it should complain. */ 793
794 /* Handled */
795 return 0;
491 } 796 }
492 797
493 kvm_err("Unsupported guest CP15 access at: %08lx\n", *vcpu_pc(vcpu)); 798 /* Not handled */
799 return -1;
800}
801
802static void unhandled_cp_access(struct kvm_vcpu *vcpu,
803 struct sys_reg_params *params)
804{
805 u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
806 int cp;
807
808 switch(hsr_ec) {
809 case ESR_EL2_EC_CP15_32:
810 case ESR_EL2_EC_CP15_64:
811 cp = 15;
812 break;
813 case ESR_EL2_EC_CP14_MR:
814 case ESR_EL2_EC_CP14_64:
815 cp = 14;
816 break;
817 default:
818 WARN_ON((cp = -1));
819 }
820
821 kvm_err("Unsupported guest CP%d access at: %08lx\n",
822 cp, *vcpu_pc(vcpu));
494 print_sys_reg_instr(params); 823 print_sys_reg_instr(params);
495 kvm_inject_undefined(vcpu); 824 kvm_inject_undefined(vcpu);
496} 825}
497 826
498/** 827/**
499 * kvm_handle_cp15_64 -- handles a mrrc/mcrr trap on a guest CP15 access 828 * kvm_handle_cp_64 -- handles a mrrc/mcrr trap on a guest CP15 access
500 * @vcpu: The VCPU pointer 829 * @vcpu: The VCPU pointer
501 * @run: The kvm_run struct 830 * @run: The kvm_run struct
502 */ 831 */
503int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run) 832static int kvm_handle_cp_64(struct kvm_vcpu *vcpu,
833 const struct sys_reg_desc *global,
834 size_t nr_global,
835 const struct sys_reg_desc *target_specific,
836 size_t nr_specific)
504{ 837{
505 struct sys_reg_params params; 838 struct sys_reg_params params;
506 u32 hsr = kvm_vcpu_get_hsr(vcpu); 839 u32 hsr = kvm_vcpu_get_hsr(vcpu);
@@ -529,8 +862,14 @@ int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
529 *vcpu_reg(vcpu, params.Rt) = val; 862 *vcpu_reg(vcpu, params.Rt) = val;
530 } 863 }
531 864
532 emulate_cp15(vcpu, &params); 865 if (!emulate_cp(vcpu, &params, target_specific, nr_specific))
866 goto out;
867 if (!emulate_cp(vcpu, &params, global, nr_global))
868 goto out;
533 869
870 unhandled_cp_access(vcpu, &params);
871
872out:
534 /* Do the opposite hack for the read side */ 873 /* Do the opposite hack for the read side */
535 if (!params.is_write) { 874 if (!params.is_write) {
536 u64 val = *vcpu_reg(vcpu, params.Rt); 875 u64 val = *vcpu_reg(vcpu, params.Rt);
@@ -546,7 +885,11 @@ int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
546 * @vcpu: The VCPU pointer 885 * @vcpu: The VCPU pointer
547 * @run: The kvm_run struct 886 * @run: The kvm_run struct
548 */ 887 */
549int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run) 888static int kvm_handle_cp_32(struct kvm_vcpu *vcpu,
889 const struct sys_reg_desc *global,
890 size_t nr_global,
891 const struct sys_reg_desc *target_specific,
892 size_t nr_specific)
550{ 893{
551 struct sys_reg_params params; 894 struct sys_reg_params params;
552 u32 hsr = kvm_vcpu_get_hsr(vcpu); 895 u32 hsr = kvm_vcpu_get_hsr(vcpu);
@@ -561,10 +904,51 @@ int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run)
561 params.Op1 = (hsr >> 14) & 0x7; 904 params.Op1 = (hsr >> 14) & 0x7;
562 params.Op2 = (hsr >> 17) & 0x7; 905 params.Op2 = (hsr >> 17) & 0x7;
563 906
564 emulate_cp15(vcpu, &params); 907 if (!emulate_cp(vcpu, &params, target_specific, nr_specific))
908 return 1;
909 if (!emulate_cp(vcpu, &params, global, nr_global))
910 return 1;
911
912 unhandled_cp_access(vcpu, &params);
565 return 1; 913 return 1;
566} 914}
567 915
916int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
917{
918 const struct sys_reg_desc *target_specific;
919 size_t num;
920
921 target_specific = get_target_table(vcpu->arch.target, false, &num);
922 return kvm_handle_cp_64(vcpu,
923 cp15_64_regs, ARRAY_SIZE(cp15_64_regs),
924 target_specific, num);
925}
926
927int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run)
928{
929 const struct sys_reg_desc *target_specific;
930 size_t num;
931
932 target_specific = get_target_table(vcpu->arch.target, false, &num);
933 return kvm_handle_cp_32(vcpu,
934 cp15_regs, ARRAY_SIZE(cp15_regs),
935 target_specific, num);
936}
937
938int kvm_handle_cp14_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
939{
940 return kvm_handle_cp_64(vcpu,
941 cp14_64_regs, ARRAY_SIZE(cp14_64_regs),
942 NULL, 0);
943}
944
945int kvm_handle_cp14_32(struct kvm_vcpu *vcpu, struct kvm_run *run)
946{
947 return kvm_handle_cp_32(vcpu,
948 cp14_regs, ARRAY_SIZE(cp14_regs),
949 NULL, 0);
950}
951
568static int emulate_sys_reg(struct kvm_vcpu *vcpu, 952static int emulate_sys_reg(struct kvm_vcpu *vcpu,
569 const struct sys_reg_params *params) 953 const struct sys_reg_params *params)
570{ 954{
@@ -776,17 +1160,15 @@ static struct sys_reg_desc invariant_sys_regs[] = {
776 NULL, get_ctr_el0 }, 1160 NULL, get_ctr_el0 },
777}; 1161};
778 1162
779static int reg_from_user(void *val, const void __user *uaddr, u64 id) 1163static int reg_from_user(u64 *val, const void __user *uaddr, u64 id)
780{ 1164{
781 /* This Just Works because we are little endian. */
782 if (copy_from_user(val, uaddr, KVM_REG_SIZE(id)) != 0) 1165 if (copy_from_user(val, uaddr, KVM_REG_SIZE(id)) != 0)
783 return -EFAULT; 1166 return -EFAULT;
784 return 0; 1167 return 0;
785} 1168}
786 1169
787static int reg_to_user(void __user *uaddr, const void *val, u64 id) 1170static int reg_to_user(void __user *uaddr, const u64 *val, u64 id)
788{ 1171{
789 /* This Just Works because we are little endian. */
790 if (copy_to_user(uaddr, val, KVM_REG_SIZE(id)) != 0) 1172 if (copy_to_user(uaddr, val, KVM_REG_SIZE(id)) != 0)
791 return -EFAULT; 1173 return -EFAULT;
792 return 0; 1174 return 0;
@@ -962,7 +1344,7 @@ static unsigned int num_demux_regs(void)
962 1344
963static int write_demux_regids(u64 __user *uindices) 1345static int write_demux_regids(u64 __user *uindices)
964{ 1346{
965 u64 val = KVM_REG_ARM | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX; 1347 u64 val = KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX;
966 unsigned int i; 1348 unsigned int i;
967 1349
968 val |= KVM_REG_ARM_DEMUX_ID_CCSIDR; 1350 val |= KVM_REG_ARM_DEMUX_ID_CCSIDR;
@@ -1069,14 +1451,32 @@ int kvm_arm_copy_sys_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
1069 return write_demux_regids(uindices); 1451 return write_demux_regids(uindices);
1070} 1452}
1071 1453
1454static int check_sysreg_table(const struct sys_reg_desc *table, unsigned int n)
1455{
1456 unsigned int i;
1457
1458 for (i = 1; i < n; i++) {
1459 if (cmp_sys_reg(&table[i-1], &table[i]) >= 0) {
1460 kvm_err("sys_reg table %p out of order (%d)\n", table, i - 1);
1461 return 1;
1462 }
1463 }
1464
1465 return 0;
1466}
1467
1072void kvm_sys_reg_table_init(void) 1468void kvm_sys_reg_table_init(void)
1073{ 1469{
1074 unsigned int i; 1470 unsigned int i;
1075 struct sys_reg_desc clidr; 1471 struct sys_reg_desc clidr;
1076 1472
1077 /* Make sure tables are unique and in order. */ 1473 /* Make sure tables are unique and in order. */
1078 for (i = 1; i < ARRAY_SIZE(sys_reg_descs); i++) 1474 BUG_ON(check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs)));
1079 BUG_ON(cmp_sys_reg(&sys_reg_descs[i-1], &sys_reg_descs[i]) >= 0); 1475 BUG_ON(check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs)));
1476 BUG_ON(check_sysreg_table(cp14_64_regs, ARRAY_SIZE(cp14_64_regs)));
1477 BUG_ON(check_sysreg_table(cp15_regs, ARRAY_SIZE(cp15_regs)));
1478 BUG_ON(check_sysreg_table(cp15_64_regs, ARRAY_SIZE(cp15_64_regs)));
1479 BUG_ON(check_sysreg_table(invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs)));
1080 1480
1081 /* We abuse the reset function to overwrite the table itself. */ 1481 /* We abuse the reset function to overwrite the table itself. */
1082 for (i = 0; i < ARRAY_SIZE(invariant_sys_regs); i++) 1482 for (i = 0; i < ARRAY_SIZE(invariant_sys_regs); i++)
diff --git a/arch/arm64/kvm/vgic-v2-switch.S b/arch/arm64/kvm/vgic-v2-switch.S
new file mode 100644
index 000000000000..ae211772f991
--- /dev/null
+++ b/arch/arm64/kvm/vgic-v2-switch.S
@@ -0,0 +1,133 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <linux/linkage.h>
19#include <linux/irqchip/arm-gic.h>
20
21#include <asm/assembler.h>
22#include <asm/memory.h>
23#include <asm/asm-offsets.h>
24#include <asm/kvm.h>
25#include <asm/kvm_asm.h>
26#include <asm/kvm_arm.h>
27#include <asm/kvm_mmu.h>
28
29 .text
30 .pushsection .hyp.text, "ax"
31
32/*
33 * Save the VGIC CPU state into memory
34 * x0: Register pointing to VCPU struct
35 * Do not corrupt x1!!!
36 */
37ENTRY(__save_vgic_v2_state)
38__save_vgic_v2_state:
39 /* Get VGIC VCTRL base into x2 */
40 ldr x2, [x0, #VCPU_KVM]
41 kern_hyp_va x2
42 ldr x2, [x2, #KVM_VGIC_VCTRL]
43 kern_hyp_va x2
44 cbz x2, 2f // disabled
45
46 /* Compute the address of struct vgic_cpu */
47 add x3, x0, #VCPU_VGIC_CPU
48
49 /* Save all interesting registers */
50 ldr w4, [x2, #GICH_HCR]
51 ldr w5, [x2, #GICH_VMCR]
52 ldr w6, [x2, #GICH_MISR]
53 ldr w7, [x2, #GICH_EISR0]
54 ldr w8, [x2, #GICH_EISR1]
55 ldr w9, [x2, #GICH_ELRSR0]
56 ldr w10, [x2, #GICH_ELRSR1]
57 ldr w11, [x2, #GICH_APR]
58CPU_BE( rev w4, w4 )
59CPU_BE( rev w5, w5 )
60CPU_BE( rev w6, w6 )
61CPU_BE( rev w7, w7 )
62CPU_BE( rev w8, w8 )
63CPU_BE( rev w9, w9 )
64CPU_BE( rev w10, w10 )
65CPU_BE( rev w11, w11 )
66
67 str w4, [x3, #VGIC_V2_CPU_HCR]
68 str w5, [x3, #VGIC_V2_CPU_VMCR]
69 str w6, [x3, #VGIC_V2_CPU_MISR]
70 str w7, [x3, #VGIC_V2_CPU_EISR]
71 str w8, [x3, #(VGIC_V2_CPU_EISR + 4)]
72 str w9, [x3, #VGIC_V2_CPU_ELRSR]
73 str w10, [x3, #(VGIC_V2_CPU_ELRSR + 4)]
74 str w11, [x3, #VGIC_V2_CPU_APR]
75
76 /* Clear GICH_HCR */
77 str wzr, [x2, #GICH_HCR]
78
79 /* Save list registers */
80 add x2, x2, #GICH_LR0
81 ldr w4, [x3, #VGIC_CPU_NR_LR]
82 add x3, x3, #VGIC_V2_CPU_LR
831: ldr w5, [x2], #4
84CPU_BE( rev w5, w5 )
85 str w5, [x3], #4
86 sub w4, w4, #1
87 cbnz w4, 1b
882:
89 ret
90ENDPROC(__save_vgic_v2_state)
91
92/*
93 * Restore the VGIC CPU state from memory
94 * x0: Register pointing to VCPU struct
95 */
96ENTRY(__restore_vgic_v2_state)
97__restore_vgic_v2_state:
98 /* Get VGIC VCTRL base into x2 */
99 ldr x2, [x0, #VCPU_KVM]
100 kern_hyp_va x2
101 ldr x2, [x2, #KVM_VGIC_VCTRL]
102 kern_hyp_va x2
103 cbz x2, 2f // disabled
104
105 /* Compute the address of struct vgic_cpu */
106 add x3, x0, #VCPU_VGIC_CPU
107
108 /* We only restore a minimal set of registers */
109 ldr w4, [x3, #VGIC_V2_CPU_HCR]
110 ldr w5, [x3, #VGIC_V2_CPU_VMCR]
111 ldr w6, [x3, #VGIC_V2_CPU_APR]
112CPU_BE( rev w4, w4 )
113CPU_BE( rev w5, w5 )
114CPU_BE( rev w6, w6 )
115
116 str w4, [x2, #GICH_HCR]
117 str w5, [x2, #GICH_VMCR]
118 str w6, [x2, #GICH_APR]
119
120 /* Restore list registers */
121 add x2, x2, #GICH_LR0
122 ldr w4, [x3, #VGIC_CPU_NR_LR]
123 add x3, x3, #VGIC_V2_CPU_LR
1241: ldr w5, [x3], #4
125CPU_BE( rev w5, w5 )
126 str w5, [x2], #4
127 sub w4, w4, #1
128 cbnz w4, 1b
1292:
130 ret
131ENDPROC(__restore_vgic_v2_state)
132
133 .popsection
diff --git a/arch/arm64/kvm/vgic-v3-switch.S b/arch/arm64/kvm/vgic-v3-switch.S
new file mode 100644
index 000000000000..d16046999e06
--- /dev/null
+++ b/arch/arm64/kvm/vgic-v3-switch.S
@@ -0,0 +1,267 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <linux/linkage.h>
19#include <linux/irqchip/arm-gic-v3.h>
20
21#include <asm/assembler.h>
22#include <asm/memory.h>
23#include <asm/asm-offsets.h>
24#include <asm/kvm.h>
25#include <asm/kvm_asm.h>
26#include <asm/kvm_arm.h>
27
28 .text
29 .pushsection .hyp.text, "ax"
30
31/*
32 * We store LRs in reverse order to let the CPU deal with streaming
33 * access. Use this macro to make it look saner...
34 */
35#define LR_OFFSET(n) (VGIC_V3_CPU_LR + (15 - n) * 8)
36
37/*
38 * Save the VGIC CPU state into memory
39 * x0: Register pointing to VCPU struct
40 * Do not corrupt x1!!!
41 */
42.macro save_vgic_v3_state
43 // Compute the address of struct vgic_cpu
44 add x3, x0, #VCPU_VGIC_CPU
45
46 // Make sure stores to the GIC via the memory mapped interface
47 // are now visible to the system register interface
48 dsb st
49
50 // Save all interesting registers
51 mrs_s x4, ICH_HCR_EL2
52 mrs_s x5, ICH_VMCR_EL2
53 mrs_s x6, ICH_MISR_EL2
54 mrs_s x7, ICH_EISR_EL2
55 mrs_s x8, ICH_ELSR_EL2
56
57 str w4, [x3, #VGIC_V3_CPU_HCR]
58 str w5, [x3, #VGIC_V3_CPU_VMCR]
59 str w6, [x3, #VGIC_V3_CPU_MISR]
60 str w7, [x3, #VGIC_V3_CPU_EISR]
61 str w8, [x3, #VGIC_V3_CPU_ELRSR]
62
63 msr_s ICH_HCR_EL2, xzr
64
65 mrs_s x21, ICH_VTR_EL2
66 mvn w22, w21
67 ubfiz w23, w22, 2, 4 // w23 = (15 - ListRegs) * 4
68
69 adr x24, 1f
70 add x24, x24, x23
71 br x24
72
731:
74 mrs_s x20, ICH_LR15_EL2
75 mrs_s x19, ICH_LR14_EL2
76 mrs_s x18, ICH_LR13_EL2
77 mrs_s x17, ICH_LR12_EL2
78 mrs_s x16, ICH_LR11_EL2
79 mrs_s x15, ICH_LR10_EL2
80 mrs_s x14, ICH_LR9_EL2
81 mrs_s x13, ICH_LR8_EL2
82 mrs_s x12, ICH_LR7_EL2
83 mrs_s x11, ICH_LR6_EL2
84 mrs_s x10, ICH_LR5_EL2
85 mrs_s x9, ICH_LR4_EL2
86 mrs_s x8, ICH_LR3_EL2
87 mrs_s x7, ICH_LR2_EL2
88 mrs_s x6, ICH_LR1_EL2
89 mrs_s x5, ICH_LR0_EL2
90
91 adr x24, 1f
92 add x24, x24, x23
93 br x24
94
951:
96 str x20, [x3, #LR_OFFSET(15)]
97 str x19, [x3, #LR_OFFSET(14)]
98 str x18, [x3, #LR_OFFSET(13)]
99 str x17, [x3, #LR_OFFSET(12)]
100 str x16, [x3, #LR_OFFSET(11)]
101 str x15, [x3, #LR_OFFSET(10)]
102 str x14, [x3, #LR_OFFSET(9)]
103 str x13, [x3, #LR_OFFSET(8)]
104 str x12, [x3, #LR_OFFSET(7)]
105 str x11, [x3, #LR_OFFSET(6)]
106 str x10, [x3, #LR_OFFSET(5)]
107 str x9, [x3, #LR_OFFSET(4)]
108 str x8, [x3, #LR_OFFSET(3)]
109 str x7, [x3, #LR_OFFSET(2)]
110 str x6, [x3, #LR_OFFSET(1)]
111 str x5, [x3, #LR_OFFSET(0)]
112
113 tbnz w21, #29, 6f // 6 bits
114 tbz w21, #30, 5f // 5 bits
115 // 7 bits
116 mrs_s x20, ICH_AP0R3_EL2
117 str w20, [x3, #(VGIC_V3_CPU_AP0R + 3*4)]
118 mrs_s x19, ICH_AP0R2_EL2
119 str w19, [x3, #(VGIC_V3_CPU_AP0R + 2*4)]
1206: mrs_s x18, ICH_AP0R1_EL2
121 str w18, [x3, #(VGIC_V3_CPU_AP0R + 1*4)]
1225: mrs_s x17, ICH_AP0R0_EL2
123 str w17, [x3, #VGIC_V3_CPU_AP0R]
124
125 tbnz w21, #29, 6f // 6 bits
126 tbz w21, #30, 5f // 5 bits
127 // 7 bits
128 mrs_s x20, ICH_AP1R3_EL2
129 str w20, [x3, #(VGIC_V3_CPU_AP1R + 3*4)]
130 mrs_s x19, ICH_AP1R2_EL2
131 str w19, [x3, #(VGIC_V3_CPU_AP1R + 2*4)]
1326: mrs_s x18, ICH_AP1R1_EL2
133 str w18, [x3, #(VGIC_V3_CPU_AP1R + 1*4)]
1345: mrs_s x17, ICH_AP1R0_EL2
135 str w17, [x3, #VGIC_V3_CPU_AP1R]
136
137 // Restore SRE_EL1 access and re-enable SRE at EL1.
138 mrs_s x5, ICC_SRE_EL2
139 orr x5, x5, #ICC_SRE_EL2_ENABLE
140 msr_s ICC_SRE_EL2, x5
141 isb
142 mov x5, #1
143 msr_s ICC_SRE_EL1, x5
144.endm
145
146/*
147 * Restore the VGIC CPU state from memory
148 * x0: Register pointing to VCPU struct
149 */
150.macro restore_vgic_v3_state
151 // Disable SRE_EL1 access. Necessary, otherwise
152 // ICH_VMCR_EL2.VFIQEn becomes one, and FIQ happens...
153 msr_s ICC_SRE_EL1, xzr
154 isb
155
156 // Compute the address of struct vgic_cpu
157 add x3, x0, #VCPU_VGIC_CPU
158
159 // Restore all interesting registers
160 ldr w4, [x3, #VGIC_V3_CPU_HCR]
161 ldr w5, [x3, #VGIC_V3_CPU_VMCR]
162
163 msr_s ICH_HCR_EL2, x4
164 msr_s ICH_VMCR_EL2, x5
165
166 mrs_s x21, ICH_VTR_EL2
167
168 tbnz w21, #29, 6f // 6 bits
169 tbz w21, #30, 5f // 5 bits
170 // 7 bits
171 ldr w20, [x3, #(VGIC_V3_CPU_AP1R + 3*4)]
172 msr_s ICH_AP1R3_EL2, x20
173 ldr w19, [x3, #(VGIC_V3_CPU_AP1R + 2*4)]
174 msr_s ICH_AP1R2_EL2, x19
1756: ldr w18, [x3, #(VGIC_V3_CPU_AP1R + 1*4)]
176 msr_s ICH_AP1R1_EL2, x18
1775: ldr w17, [x3, #VGIC_V3_CPU_AP1R]
178 msr_s ICH_AP1R0_EL2, x17
179
180 tbnz w21, #29, 6f // 6 bits
181 tbz w21, #30, 5f // 5 bits
182 // 7 bits
183 ldr w20, [x3, #(VGIC_V3_CPU_AP0R + 3*4)]
184 msr_s ICH_AP0R3_EL2, x20
185 ldr w19, [x3, #(VGIC_V3_CPU_AP0R + 2*4)]
186 msr_s ICH_AP0R2_EL2, x19
1876: ldr w18, [x3, #(VGIC_V3_CPU_AP0R + 1*4)]
188 msr_s ICH_AP0R1_EL2, x18
1895: ldr w17, [x3, #VGIC_V3_CPU_AP0R]
190 msr_s ICH_AP0R0_EL2, x17
191
192 and w22, w21, #0xf
193 mvn w22, w21
194 ubfiz w23, w22, 2, 4 // w23 = (15 - ListRegs) * 4
195
196 adr x24, 1f
197 add x24, x24, x23
198 br x24
199
2001:
201 ldr x20, [x3, #LR_OFFSET(15)]
202 ldr x19, [x3, #LR_OFFSET(14)]
203 ldr x18, [x3, #LR_OFFSET(13)]
204 ldr x17, [x3, #LR_OFFSET(12)]
205 ldr x16, [x3, #LR_OFFSET(11)]
206 ldr x15, [x3, #LR_OFFSET(10)]
207 ldr x14, [x3, #LR_OFFSET(9)]
208 ldr x13, [x3, #LR_OFFSET(8)]
209 ldr x12, [x3, #LR_OFFSET(7)]
210 ldr x11, [x3, #LR_OFFSET(6)]
211 ldr x10, [x3, #LR_OFFSET(5)]
212 ldr x9, [x3, #LR_OFFSET(4)]
213 ldr x8, [x3, #LR_OFFSET(3)]
214 ldr x7, [x3, #LR_OFFSET(2)]
215 ldr x6, [x3, #LR_OFFSET(1)]
216 ldr x5, [x3, #LR_OFFSET(0)]
217
218 adr x24, 1f
219 add x24, x24, x23
220 br x24
221
2221:
223 msr_s ICH_LR15_EL2, x20
224 msr_s ICH_LR14_EL2, x19
225 msr_s ICH_LR13_EL2, x18
226 msr_s ICH_LR12_EL2, x17
227 msr_s ICH_LR11_EL2, x16
228 msr_s ICH_LR10_EL2, x15
229 msr_s ICH_LR9_EL2, x14
230 msr_s ICH_LR8_EL2, x13
231 msr_s ICH_LR7_EL2, x12
232 msr_s ICH_LR6_EL2, x11
233 msr_s ICH_LR5_EL2, x10
234 msr_s ICH_LR4_EL2, x9
235 msr_s ICH_LR3_EL2, x8
236 msr_s ICH_LR2_EL2, x7
237 msr_s ICH_LR1_EL2, x6
238 msr_s ICH_LR0_EL2, x5
239
240 // Ensure that the above will have reached the
241 // (re)distributors. This ensure the guest will read
242 // the correct values from the memory-mapped interface.
243 isb
244 dsb sy
245
246 // Prevent the guest from touching the GIC system registers
247 mrs_s x5, ICC_SRE_EL2
248 and x5, x5, #~ICC_SRE_EL2_ENABLE
249 msr_s ICC_SRE_EL2, x5
250.endm
251
252ENTRY(__save_vgic_v3_state)
253 save_vgic_v3_state
254 ret
255ENDPROC(__save_vgic_v3_state)
256
257ENTRY(__restore_vgic_v3_state)
258 restore_vgic_v3_state
259 ret
260ENDPROC(__restore_vgic_v3_state)
261
262ENTRY(__vgic_v3_get_ich_vtr_el2)
263 mrs_s x0, ICH_VTR_EL2
264 ret
265ENDPROC(__vgic_v3_get_ich_vtr_el2)
266
267 .popsection
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
index 1ba09e4c02b1..91146b416cdb 100644
--- a/arch/avr32/boards/atngw100/mrmt.c
+++ b/arch/avr32/boards/atngw100/mrmt.c
@@ -17,6 +17,8 @@
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/pwm.h>
21#include <linux/leds_pwm.h>
20#include <linux/input.h> 22#include <linux/input.h>
21#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
22#include <linux/atmel_serial.h> 24#include <linux/atmel_serial.h>
@@ -155,21 +157,28 @@ static struct platform_device rmt_ts_device = {
155 157
156#ifdef CONFIG_BOARD_MRMT_BL_PWM 158#ifdef CONFIG_BOARD_MRMT_BL_PWM
157/* PWM LEDs: LCD Backlight, etc */ 159/* PWM LEDs: LCD Backlight, etc */
158static struct gpio_led rmt_pwm_led[] = { 160static struct pwm_lookup pwm_lookup[] = {
159 /* here the "gpio" is actually a PWM channel */ 161 PWM_LOOKUP("at91sam9rl-pwm", PWM_CH_BL, "leds_pwm", "ds1",
160 { .name = "backlight", .gpio = PWM_CH_BL, }, 162 5000, PWM_POLARITY_INVERSED),
161}; 163};
162 164
163static struct gpio_led_platform_data rmt_pwm_led_data = { 165static struct led_pwm pwm_leds[] = {
164 .num_leds = ARRAY_SIZE(rmt_pwm_led), 166 {
165 .leds = rmt_pwm_led, 167 .name = "backlight",
168 .max_brightness = 255,
169 },
170};
171
172static struct led_pwm_platform_data pwm_data = {
173 .num_leds = ARRAY_SIZE(pwm_leds),
174 .leds = pwm_leds,
166}; 175};
167 176
168static struct platform_device rmt_pwm_led_dev = { 177static struct platform_device leds_pwm = {
169 .name = "leds-atmel-pwm", 178 .name = "leds_pwm",
170 .id = -1, 179 .id = -1,
171 .dev = { 180 .dev = {
172 .platform_data = &rmt_pwm_led_data, 181 .platform_data = &pwm_data,
173 }, 182 },
174}; 183};
175#endif 184#endif
@@ -325,7 +334,8 @@ static int __init mrmt1_init(void)
325#ifdef CONFIG_BOARD_MRMT_BL_PWM 334#ifdef CONFIG_BOARD_MRMT_BL_PWM
326 /* Use PWM for Backlight controls */ 335 /* Use PWM for Backlight controls */
327 at32_add_device_pwm(1 << PWM_CH_BL); 336 at32_add_device_pwm(1 << PWM_CH_BL);
328 platform_device_register(&rmt_pwm_led_dev); 337 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
338 platform_device_register(&leds_pwm);
329#else 339#else
330 /* Backlight always on */ 340 /* Backlight always on */
331 udelay( 1 ); 341 udelay( 1 );
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 1f121497b517..234cb071c601 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -18,7 +18,10 @@
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
21#include <linux/atmel-pwm-bl.h> 21#include <linux/pwm.h>
22#include <linux/pwm_backlight.h>
23#include <linux/regulator/fixed.h>
24#include <linux/regulator/machine.h>
22#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
23#include <linux/spi/ads7846.h> 26#include <linux/spi/ads7846.h>
24 27
@@ -33,6 +36,8 @@
33#include <mach/board.h> 36#include <mach/board.h>
34#include <mach/portmux.h> 37#include <mach/portmux.h>
35 38
39#define PWM_BL_CH 2
40
36/* Oscillator frequencies. These are board-specific */ 41/* Oscillator frequencies. These are board-specific */
37unsigned long at32_board_osc_rates[3] = { 42unsigned long at32_board_osc_rates[3] = {
38 [0] = 32768, /* 32.768 kHz on RTC osc */ 43 [0] = 32768, /* 32.768 kHz on RTC osc */
@@ -227,29 +232,36 @@ void __init favr32_setup_leds(void)
227 platform_device_register(&favr32_led_dev); 232 platform_device_register(&favr32_led_dev);
228} 233}
229 234
230static struct atmel_pwm_bl_platform_data atmel_pwm_bl_pdata = { 235static struct pwm_lookup pwm_lookup[] = {
231 .pwm_channel = 2, 236 PWM_LOOKUP("at91sam9rl-pwm", PWM_BL_CH, "pwm-backlight.0", NULL,
232 .pwm_frequency = 200000, 237 5000, PWM_POLARITY_INVERSED),
233 .pwm_compare_max = 345,
234 .pwm_duty_max = 345,
235 .pwm_duty_min = 90,
236 .pwm_active_low = 1,
237 .gpio_on = GPIO_PIN_PA(28),
238 .on_active_low = 0,
239}; 238};
240 239
241static struct platform_device atmel_pwm_bl_dev = { 240static struct regulator_consumer_supply fixed_power_consumers[] = {
242 .name = "atmel-pwm-bl", 241 REGULATOR_SUPPLY("power", "pwm-backlight.0"),
243 .id = 0, 242};
244 .dev = { 243
245 .platform_data = &atmel_pwm_bl_pdata, 244static struct platform_pwm_backlight_data pwm_bl_data = {
245 .enable_gpio = GPIO_PIN_PA(28),
246 .max_brightness = 255,
247 .dft_brightness = 255,
248 .lth_brightness = 50,
249};
250
251static struct platform_device pwm_bl_device = {
252 .name = "pwm-backlight",
253 .dev = {
254 .platform_data = &pwm_bl_data,
246 }, 255 },
247}; 256};
248 257
249static void __init favr32_setup_atmel_pwm_bl(void) 258static void __init favr32_setup_atmel_pwm_bl(void)
250{ 259{
251 platform_device_register(&atmel_pwm_bl_dev); 260 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
252 at32_select_gpio(atmel_pwm_bl_pdata.gpio_on, 0); 261 regulator_register_always_on(0, "fixed", fixed_power_consumers,
262 ARRAY_SIZE(fixed_power_consumers), 3300000);
263 platform_device_register(&pwm_bl_device);
264 at32_select_gpio(pwm_bl_data.enable_gpio, 0);
253} 265}
254 266
255void __init setup_board(void) 267void __init setup_board(void)
@@ -339,7 +351,7 @@ static int __init favr32_init(void)
339 351
340 set_abdac_rate(at32_add_device_abdac(0, &abdac0_data)); 352 set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
341 353
342 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); 354 at32_add_device_pwm(1 << PWM_BL_CH);
343 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 355 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
344 at32_add_device_mci(0, &mci0_data); 356 at32_add_device_mci(0, &mci0_data);
345 at32_add_device_usba(0, NULL); 357 at32_add_device_usba(0, NULL);
diff --git a/arch/avr32/boards/hammerhead/flash.c b/arch/avr32/boards/hammerhead/flash.c
index 776c3cb9b6e4..e86280ccd8fa 100644
--- a/arch/avr32/boards/hammerhead/flash.c
+++ b/arch/avr32/boards/hammerhead/flash.c
@@ -190,14 +190,19 @@ static int __init hammerhead_usbh_init(void)
190 190
191 /* setup gclk0 to run from osc1 */ 191 /* setup gclk0 to run from osc1 */
192 gclk = clk_get(NULL, "gclk0"); 192 gclk = clk_get(NULL, "gclk0");
193 if (IS_ERR(gclk)) 193 if (IS_ERR(gclk)) {
194 ret = PTR_ERR(gclk);
194 goto err_gclk; 195 goto err_gclk;
196 }
195 197
196 osc = clk_get(NULL, "osc1"); 198 osc = clk_get(NULL, "osc1");
197 if (IS_ERR(osc)) 199 if (IS_ERR(osc)) {
200 ret = PTR_ERR(osc);
198 goto err_osc; 201 goto err_osc;
202 }
199 203
200 if (clk_set_parent(gclk, osc)) { 204 ret = clk_set_parent(gclk, osc);
205 if (ret < 0) {
201 pr_debug("hammerhead: failed to set osc1 for USBH clock\n"); 206 pr_debug("hammerhead: failed to set osc1 for USBH clock\n");
202 goto err_set_clk; 207 goto err_set_clk;
203 } 208 }
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index ed137e335796..83d896cc2aed 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -22,6 +22,8 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/fb.h> 23#include <linux/fb.h>
24#include <linux/atmel-mci.h> 24#include <linux/atmel-mci.h>
25#include <linux/pwm.h>
26#include <linux/leds_pwm.h>
25 27
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/setup.h> 29#include <asm/setup.h>
@@ -167,24 +169,29 @@ static struct i2c_board_info __initdata i2c_info[] = {
167 }, 169 },
168}; 170};
169 171
170#ifdef CONFIG_LEDS_ATMEL_PWM 172#if IS_ENABLED(CONFIG_LEDS_PWM)
171static struct gpio_led stk_pwm_led[] = { 173static struct pwm_lookup pwm_lookup[] = {
174 PWM_LOOKUP("at91sam9rl-pwm", 0, "leds_pwm", "backlight",
175 5000, PWM_POLARITY_NORMAL),
176};
177
178static struct led_pwm pwm_leds[] = {
172 { 179 {
173 .name = "backlight", 180 .name = "backlight",
174 .gpio = 0, /* PWM channel 0 (LCD backlight) */ 181 .max_brightness = 255,
175 }, 182 },
176}; 183};
177 184
178static struct gpio_led_platform_data stk_pwm_led_data = { 185static struct led_pwm_platform_data pwm_data = {
179 .num_leds = ARRAY_SIZE(stk_pwm_led), 186 .num_leds = ARRAY_SIZE(pwm_leds),
180 .leds = stk_pwm_led, 187 .leds = pwm_leds,
181}; 188};
182 189
183static struct platform_device stk_pwm_led_dev = { 190static struct platform_device leds_pwm = {
184 .name = "leds-atmel-pwm", 191 .name = "leds_pwm",
185 .id = -1, 192 .id = -1,
186 .dev = { 193 .dev = {
187 .platform_data = &stk_pwm_led_data, 194 .platform_data = &pwm_data,
188 }, 195 },
189}; 196};
190#endif 197#endif
@@ -278,9 +285,10 @@ static int __init merisc_init(void)
278 285
279 at32_add_device_mci(0, &mci0_data); 286 at32_add_device_mci(0, &mci0_data);
280 287
281#ifdef CONFIG_LEDS_ATMEL_PWM 288#if IS_ENABLED(CONFIG_LEDS_PWM)
289 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
282 at32_add_device_pwm((1 << 0) | (1 << 2)); 290 at32_add_device_pwm((1 << 0) | (1 << 2));
283 platform_device_register(&stk_pwm_led_dev); 291 platform_device_register(&leds_pwm);
284#else 292#else
285 at32_add_device_pwm((1 << 2)); 293 at32_add_device_pwm((1 << 2));
286#endif 294#endif
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig b/arch/avr32/configs/atngw100_mrmt_defconfig
index 9a57da44eb6f..6838781e966f 100644
--- a/arch/avr32/configs/atngw100_mrmt_defconfig
+++ b/arch/avr32/configs/atngw100_mrmt_defconfig
@@ -56,7 +56,6 @@ CONFIG_MTD_CFI_AMDSTD=y
56CONFIG_MTD_PHYSMAP=y 56CONFIG_MTD_PHYSMAP=y
57CONFIG_MTD_DATAFLASH=y 57CONFIG_MTD_DATAFLASH=y
58CONFIG_BLK_DEV_LOOP=y 58CONFIG_BLK_DEV_LOOP=y
59CONFIG_ATMEL_PWM=y
60CONFIG_NETDEVICES=y 59CONFIG_NETDEVICES=y
61CONFIG_NET_ETHERNET=y 60CONFIG_NET_ETHERNET=y
62CONFIG_MACB=y 61CONFIG_MACB=y
@@ -104,8 +103,8 @@ CONFIG_MMC=y
104CONFIG_MMC_ATMELMCI=y 103CONFIG_MMC_ATMELMCI=y
105CONFIG_NEW_LEDS=y 104CONFIG_NEW_LEDS=y
106CONFIG_LEDS_CLASS=y 105CONFIG_LEDS_CLASS=y
107CONFIG_LEDS_ATMEL_PWM=y
108CONFIG_LEDS_GPIO=y 106CONFIG_LEDS_GPIO=y
107CONFIG_LEDS_PWM=y
109CONFIG_LEDS_TRIGGERS=y 108CONFIG_LEDS_TRIGGERS=y
110CONFIG_LEDS_TRIGGER_TIMER=y 109CONFIG_LEDS_TRIGGER_TIMER=y
111CONFIG_LEDS_TRIGGER_HEARTBEAT=y 110CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -114,6 +113,8 @@ CONFIG_RTC_DRV_S35390A=m
114CONFIG_RTC_DRV_AT32AP700X=m 113CONFIG_RTC_DRV_AT32AP700X=m
115CONFIG_DMADEVICES=y 114CONFIG_DMADEVICES=y
116CONFIG_UIO=y 115CONFIG_UIO=y
116CONFIG_PWM=y
117CONFIG_PWM_ATMEL=y
117CONFIG_EXT2_FS=y 118CONFIG_EXT2_FS=y
118CONFIG_EXT2_FS_XATTR=y 119CONFIG_EXT2_FS_XATTR=y
119CONFIG_EXT3_FS=y 120CONFIG_EXT3_FS=y
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index 2813dd2b9138..b056820eef33 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -64,7 +64,6 @@ CONFIG_BLK_DEV_LOOP=m
64CONFIG_BLK_DEV_NBD=m 64CONFIG_BLK_DEV_NBD=m
65CONFIG_BLK_DEV_RAM=m 65CONFIG_BLK_DEV_RAM=m
66CONFIG_MISC_DEVICES=y 66CONFIG_MISC_DEVICES=y
67CONFIG_ATMEL_PWM=m
68CONFIG_ATMEL_TCLIB=y 67CONFIG_ATMEL_TCLIB=y
69CONFIG_ATMEL_SSC=m 68CONFIG_ATMEL_SSC=m
70# CONFIG_SCSI_PROC_FS is not set 69# CONFIG_SCSI_PROC_FS is not set
@@ -133,14 +132,16 @@ CONFIG_MMC_TEST=m
133CONFIG_MMC_ATMELMCI=y 132CONFIG_MMC_ATMELMCI=y
134CONFIG_NEW_LEDS=y 133CONFIG_NEW_LEDS=y
135CONFIG_LEDS_CLASS=y 134CONFIG_LEDS_CLASS=y
136CONFIG_LEDS_ATMEL_PWM=m
137CONFIG_LEDS_GPIO=m 135CONFIG_LEDS_GPIO=m
136CONFIG_LEDS_PWM=m
138CONFIG_LEDS_TRIGGERS=y 137CONFIG_LEDS_TRIGGERS=y
139CONFIG_LEDS_TRIGGER_TIMER=m 138CONFIG_LEDS_TRIGGER_TIMER=m
140CONFIG_LEDS_TRIGGER_HEARTBEAT=m 139CONFIG_LEDS_TRIGGER_HEARTBEAT=m
141CONFIG_RTC_CLASS=y 140CONFIG_RTC_CLASS=y
142CONFIG_RTC_DRV_AT32AP700X=y 141CONFIG_RTC_DRV_AT32AP700X=y
143CONFIG_DMADEVICES=y 142CONFIG_DMADEVICES=y
143CONFIG_PWM=y
144CONFIG_PWM_ATMEL=m
144CONFIG_EXT2_FS=y 145CONFIG_EXT2_FS=y
145CONFIG_EXT3_FS=y 146CONFIG_EXT3_FS=y
146# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 147# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index f8ff3a3baad4..0cd23a303da1 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_defconfig
@@ -53,7 +53,6 @@ CONFIG_BLK_DEV_LOOP=m
53CONFIG_BLK_DEV_NBD=m 53CONFIG_BLK_DEV_NBD=m
54CONFIG_BLK_DEV_RAM=m 54CONFIG_BLK_DEV_RAM=m
55CONFIG_MISC_DEVICES=y 55CONFIG_MISC_DEVICES=y
56CONFIG_ATMEL_PWM=m
57CONFIG_ATMEL_TCLIB=y 56CONFIG_ATMEL_TCLIB=y
58CONFIG_ATMEL_SSC=m 57CONFIG_ATMEL_SSC=m
59# CONFIG_SCSI_PROC_FS is not set 58# CONFIG_SCSI_PROC_FS is not set
@@ -112,14 +111,16 @@ CONFIG_MMC_TEST=m
112CONFIG_MMC_ATMELMCI=y 111CONFIG_MMC_ATMELMCI=y
113CONFIG_NEW_LEDS=y 112CONFIG_NEW_LEDS=y
114CONFIG_LEDS_CLASS=y 113CONFIG_LEDS_CLASS=y
115CONFIG_LEDS_ATMEL_PWM=m
116CONFIG_LEDS_GPIO=m 114CONFIG_LEDS_GPIO=m
115CONFIG_LEDS_PWM=m
117CONFIG_LEDS_TRIGGERS=y 116CONFIG_LEDS_TRIGGERS=y
118CONFIG_LEDS_TRIGGER_TIMER=m 117CONFIG_LEDS_TRIGGER_TIMER=m
119CONFIG_LEDS_TRIGGER_HEARTBEAT=m 118CONFIG_LEDS_TRIGGER_HEARTBEAT=m
120CONFIG_RTC_CLASS=y 119CONFIG_RTC_CLASS=y
121CONFIG_RTC_DRV_AT32AP700X=y 120CONFIG_RTC_DRV_AT32AP700X=y
122CONFIG_DMADEVICES=y 121CONFIG_DMADEVICES=y
122CONFIG_PWM=y
123CONFIG_PWM_ATMEL=m
123CONFIG_EXT2_FS=y 124CONFIG_EXT2_FS=y
124CONFIG_EXT3_FS=y 125CONFIG_EXT3_FS=y
125# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 126# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig
index 992228e54e38..ac1041f5f85a 100644
--- a/arch/avr32/configs/atstk1004_defconfig
+++ b/arch/avr32/configs/atstk1004_defconfig
@@ -53,7 +53,6 @@ CONFIG_BLK_DEV_LOOP=m
53CONFIG_BLK_DEV_NBD=m 53CONFIG_BLK_DEV_NBD=m
54CONFIG_BLK_DEV_RAM=m 54CONFIG_BLK_DEV_RAM=m
55CONFIG_MISC_DEVICES=y 55CONFIG_MISC_DEVICES=y
56CONFIG_ATMEL_PWM=m
57CONFIG_ATMEL_TCLIB=y 56CONFIG_ATMEL_TCLIB=y
58CONFIG_ATMEL_SSC=m 57CONFIG_ATMEL_SSC=m
59# CONFIG_SCSI_PROC_FS is not set 58# CONFIG_SCSI_PROC_FS is not set
@@ -111,14 +110,16 @@ CONFIG_MMC_TEST=m
111CONFIG_MMC_ATMELMCI=y 110CONFIG_MMC_ATMELMCI=y
112CONFIG_NEW_LEDS=y 111CONFIG_NEW_LEDS=y
113CONFIG_LEDS_CLASS=y 112CONFIG_LEDS_CLASS=y
114CONFIG_LEDS_ATMEL_PWM=m
115CONFIG_LEDS_GPIO=m 113CONFIG_LEDS_GPIO=m
114CONFIG_LEDS_PWM=m
116CONFIG_LEDS_TRIGGERS=y 115CONFIG_LEDS_TRIGGERS=y
117CONFIG_LEDS_TRIGGER_TIMER=m 116CONFIG_LEDS_TRIGGER_TIMER=m
118CONFIG_LEDS_TRIGGER_HEARTBEAT=m 117CONFIG_LEDS_TRIGGER_HEARTBEAT=m
119CONFIG_RTC_CLASS=y 118CONFIG_RTC_CLASS=y
120CONFIG_RTC_DRV_AT32AP700X=y 119CONFIG_RTC_DRV_AT32AP700X=y
121CONFIG_DMADEVICES=y 120CONFIG_DMADEVICES=y
121CONFIG_PWM=y
122CONFIG_PWM_ATMEL=m
122CONFIG_EXT2_FS=y 123CONFIG_EXT2_FS=y
123CONFIG_EXT3_FS=y 124CONFIG_EXT3_FS=y
124# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 125# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig
index b8e698b0d1fa..ea4f670cb995 100644
--- a/arch/avr32/configs/atstk1006_defconfig
+++ b/arch/avr32/configs/atstk1006_defconfig
@@ -67,7 +67,6 @@ CONFIG_BLK_DEV_LOOP=m
67CONFIG_BLK_DEV_NBD=m 67CONFIG_BLK_DEV_NBD=m
68CONFIG_BLK_DEV_RAM=m 68CONFIG_BLK_DEV_RAM=m
69CONFIG_MISC_DEVICES=y 69CONFIG_MISC_DEVICES=y
70CONFIG_ATMEL_PWM=m
71CONFIG_ATMEL_TCLIB=y 70CONFIG_ATMEL_TCLIB=y
72CONFIG_ATMEL_SSC=m 71CONFIG_ATMEL_SSC=m
73# CONFIG_SCSI_PROC_FS is not set 72# CONFIG_SCSI_PROC_FS is not set
@@ -136,14 +135,16 @@ CONFIG_MMC_TEST=m
136CONFIG_MMC_ATMELMCI=y 135CONFIG_MMC_ATMELMCI=y
137CONFIG_NEW_LEDS=y 136CONFIG_NEW_LEDS=y
138CONFIG_LEDS_CLASS=y 137CONFIG_LEDS_CLASS=y
139CONFIG_LEDS_ATMEL_PWM=m
140CONFIG_LEDS_GPIO=m 138CONFIG_LEDS_GPIO=m
139CONFIG_LEDS_PWM=m
141CONFIG_LEDS_TRIGGERS=y 140CONFIG_LEDS_TRIGGERS=y
142CONFIG_LEDS_TRIGGER_TIMER=m 141CONFIG_LEDS_TRIGGER_TIMER=m
143CONFIG_LEDS_TRIGGER_HEARTBEAT=m 142CONFIG_LEDS_TRIGGER_HEARTBEAT=m
144CONFIG_RTC_CLASS=y 143CONFIG_RTC_CLASS=y
145CONFIG_RTC_DRV_AT32AP700X=y 144CONFIG_RTC_DRV_AT32AP700X=y
146CONFIG_DMADEVICES=y 145CONFIG_DMADEVICES=y
146CONFIG_PWM=y
147CONFIG_PWM_ATMEL=m
147CONFIG_EXT2_FS=y 148CONFIG_EXT2_FS=y
148CONFIG_EXT3_FS=y 149CONFIG_EXT3_FS=y
149# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 150# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
index 07bed3f7eb5e..b3eb67dc05ac 100644
--- a/arch/avr32/configs/favr-32_defconfig
+++ b/arch/avr32/configs/favr-32_defconfig
@@ -67,7 +67,6 @@ CONFIG_MTD_PHYSMAP=y
67CONFIG_BLK_DEV_LOOP=m 67CONFIG_BLK_DEV_LOOP=m
68CONFIG_BLK_DEV_NBD=m 68CONFIG_BLK_DEV_NBD=m
69CONFIG_BLK_DEV_RAM=m 69CONFIG_BLK_DEV_RAM=m
70CONFIG_ATMEL_PWM=m
71CONFIG_ATMEL_TCLIB=y 70CONFIG_ATMEL_TCLIB=y
72CONFIG_ATMEL_SSC=m 71CONFIG_ATMEL_SSC=m
73CONFIG_NETDEVICES=y 72CONFIG_NETDEVICES=y
@@ -108,7 +107,7 @@ CONFIG_FB=y
108CONFIG_FB_ATMEL=y 107CONFIG_FB_ATMEL=y
109CONFIG_BACKLIGHT_LCD_SUPPORT=y 108CONFIG_BACKLIGHT_LCD_SUPPORT=y
110# CONFIG_LCD_CLASS_DEVICE is not set 109# CONFIG_LCD_CLASS_DEVICE is not set
111CONFIG_BACKLIGHT_ATMEL_PWM=m 110CONFIG_BACKLIGHT_PWM=m
112CONFIG_SOUND=m 111CONFIG_SOUND=m
113CONFIG_SOUND_PRIME=m 112CONFIG_SOUND_PRIME=m
114# CONFIG_HID_SUPPORT is not set 113# CONFIG_HID_SUPPORT is not set
@@ -123,7 +122,6 @@ CONFIG_MMC=y
123CONFIG_MMC_ATMELMCI=y 122CONFIG_MMC_ATMELMCI=y
124CONFIG_NEW_LEDS=y 123CONFIG_NEW_LEDS=y
125CONFIG_LEDS_CLASS=y 124CONFIG_LEDS_CLASS=y
126CONFIG_LEDS_ATMEL_PWM=m
127CONFIG_LEDS_GPIO=y 125CONFIG_LEDS_GPIO=y
128CONFIG_LEDS_TRIGGERS=y 126CONFIG_LEDS_TRIGGERS=y
129CONFIG_LEDS_TRIGGER_TIMER=y 127CONFIG_LEDS_TRIGGER_TIMER=y
@@ -132,6 +130,8 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
132CONFIG_RTC_CLASS=y 130CONFIG_RTC_CLASS=y
133CONFIG_RTC_DRV_AT32AP700X=y 131CONFIG_RTC_DRV_AT32AP700X=y
134CONFIG_DMADEVICES=y 132CONFIG_DMADEVICES=y
133CONFIG_PWM=y
134CONFIG_PWM_ATMEL=y
135CONFIG_EXT2_FS=y 135CONFIG_EXT2_FS=y
136CONFIG_EXT3_FS=y 136CONFIG_EXT3_FS=y
137# CONFIG_EXT3_FS_XATTR is not set 137# CONFIG_EXT3_FS_XATTR is not set
diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig
index 91df6b2986be..b9ef4cc85d08 100644
--- a/arch/avr32/configs/merisc_defconfig
+++ b/arch/avr32/configs/merisc_defconfig
@@ -55,7 +55,6 @@ CONFIG_MTD_ABSENT=y
55CONFIG_MTD_PHYSMAP=y 55CONFIG_MTD_PHYSMAP=y
56CONFIG_MTD_BLOCK2MTD=y 56CONFIG_MTD_BLOCK2MTD=y
57CONFIG_BLK_DEV_LOOP=y 57CONFIG_BLK_DEV_LOOP=y
58CONFIG_ATMEL_PWM=y
59CONFIG_ATMEL_SSC=y 58CONFIG_ATMEL_SSC=y
60CONFIG_SCSI=y 59CONFIG_SCSI=y
61CONFIG_BLK_DEV_SD=y 60CONFIG_BLK_DEV_SD=y
@@ -103,12 +102,14 @@ CONFIG_MMC=y
103CONFIG_MMC_ATMELMCI=y 102CONFIG_MMC_ATMELMCI=y
104CONFIG_NEW_LEDS=y 103CONFIG_NEW_LEDS=y
105CONFIG_LEDS_CLASS=y 104CONFIG_LEDS_CLASS=y
106CONFIG_LEDS_ATMEL_PWM=y 105CONFIG_LEDS_PWM=y
107CONFIG_RTC_CLASS=y 106CONFIG_RTC_CLASS=y
108# CONFIG_RTC_HCTOSYS is not set 107# CONFIG_RTC_HCTOSYS is not set
109CONFIG_RTC_DRV_PCF8563=y 108CONFIG_RTC_DRV_PCF8563=y
110CONFIG_DMADEVICES=y 109CONFIG_DMADEVICES=y
111CONFIG_UIO=y 110CONFIG_UIO=y
111CONFIG_PWM=y
112CONFIG_PWM_ATMEL=m
112CONFIG_EXT2_FS=y 113CONFIG_EXT2_FS=y
113# CONFIG_DNOTIFY is not set 114# CONFIG_DNOTIFY is not set
114CONFIG_FUSE_FS=y 115CONFIG_FUSE_FS=y
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c
index b80c0b3d2bab..d309fbcc3bd6 100644
--- a/arch/avr32/kernel/signal.c
+++ b/arch/avr32/kernel/signal.c
@@ -127,24 +127,20 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
127} 127}
128 128
129static inline void __user * 129static inline void __user *
130get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) 130get_sigframe(struct ksignal *ksig, struct pt_regs *regs, int framesize)
131{ 131{
132 unsigned long sp = regs->sp; 132 unsigned long sp = sigsp(regs->sp, ksig);
133
134 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
135 sp = current->sas_ss_sp + current->sas_ss_size;
136 133
137 return (void __user *)((sp - framesize) & ~3); 134 return (void __user *)((sp - framesize) & ~3);
138} 135}
139 136
140static int 137static int
141setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 138setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
142 sigset_t *set, struct pt_regs *regs)
143{ 139{
144 struct rt_sigframe __user *frame; 140 struct rt_sigframe __user *frame;
145 int err = 0; 141 int err = 0;
146 142
147 frame = get_sigframe(ka, regs, sizeof(*frame)); 143 frame = get_sigframe(ksig, regs, sizeof(*frame));
148 err = -EFAULT; 144 err = -EFAULT;
149 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 145 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
150 goto out; 146 goto out;
@@ -164,7 +160,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
164 err = __put_user(0x3008d733 | (__NR_rt_sigreturn << 20), 160 err = __put_user(0x3008d733 | (__NR_rt_sigreturn << 20),
165 &frame->retcode); 161 &frame->retcode);
166 162
167 err |= copy_siginfo_to_user(&frame->info, info); 163 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
168 164
169 /* Set up the ucontext */ 165 /* Set up the ucontext */
170 err |= __put_user(0, &frame->uc.uc_flags); 166 err |= __put_user(0, &frame->uc.uc_flags);
@@ -176,12 +172,12 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
176 if (err) 172 if (err)
177 goto out; 173 goto out;
178 174
179 regs->r12 = sig; 175 regs->r12 = ksig->sig;
180 regs->r11 = (unsigned long) &frame->info; 176 regs->r11 = (unsigned long) &frame->info;
181 regs->r10 = (unsigned long) &frame->uc; 177 regs->r10 = (unsigned long) &frame->uc;
182 regs->sp = (unsigned long) frame; 178 regs->sp = (unsigned long) frame;
183 if (ka->sa.sa_flags & SA_RESTORER) 179 if (ksig->ka.sa.sa_flags & SA_RESTORER)
184 regs->lr = (unsigned long)ka->sa.sa_restorer; 180 regs->lr = (unsigned long)ksig->ka.sa.sa_restorer;
185 else { 181 else {
186 printk(KERN_NOTICE "[%s:%d] did not set SA_RESTORER\n", 182 printk(KERN_NOTICE "[%s:%d] did not set SA_RESTORER\n",
187 current->comm, current->pid); 183 current->comm, current->pid);
@@ -189,10 +185,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
189 } 185 }
190 186
191 pr_debug("SIG deliver [%s:%d]: sig=%d sp=0x%lx pc=0x%lx->0x%p lr=0x%lx\n", 187 pr_debug("SIG deliver [%s:%d]: sig=%d sp=0x%lx pc=0x%lx->0x%p lr=0x%lx\n",
192 current->comm, current->pid, sig, regs->sp, 188 current->comm, current->pid, ksig->sig, regs->sp,
193 regs->pc, ka->sa.sa_handler, regs->lr); 189 regs->pc, ksig->ka.sa.sa_handler, regs->lr);
194 190
195 regs->pc = (unsigned long) ka->sa.sa_handler; 191 regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
196 192
197out: 193out:
198 return err; 194 return err;
@@ -208,15 +204,14 @@ static inline void setup_syscall_restart(struct pt_regs *regs)
208} 204}
209 205
210static inline void 206static inline void
211handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 207handle_signal(struct ksignal *ksig, struct pt_regs *regs, int syscall)
212 struct pt_regs *regs, int syscall)
213{ 208{
214 int ret; 209 int ret;
215 210
216 /* 211 /*
217 * Set up the stack frame 212 * Set up the stack frame
218 */ 213 */
219 ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); 214 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
220 215
221 /* 216 /*
222 * Check that the resulting registers are sane 217 * Check that the resulting registers are sane
@@ -226,10 +221,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
226 /* 221 /*
227 * Block the signal if we were successful. 222 * Block the signal if we were successful.
228 */ 223 */
229 if (ret != 0) 224 signal_setup_done(ret, ksig, 0);
230 force_sigsegv(sig, current);
231 else
232 signal_delivered(sig, info, ka, regs, 0);
233} 225}
234 226
235/* 227/*
@@ -239,9 +231,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
239 */ 231 */
240static void do_signal(struct pt_regs *regs, int syscall) 232static void do_signal(struct pt_regs *regs, int syscall)
241{ 233{
242 siginfo_t info; 234 struct ksignal ksig;
243 int signr;
244 struct k_sigaction ka;
245 235
246 /* 236 /*
247 * We want the common case to go fast, which is why we may in 237 * We want the common case to go fast, which is why we may in
@@ -251,18 +241,18 @@ static void do_signal(struct pt_regs *regs, int syscall)
251 if (!user_mode(regs)) 241 if (!user_mode(regs))
252 return; 242 return;
253 243
254 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 244 get_signal(&ksig);
255 if (syscall) { 245 if (syscall) {
256 switch (regs->r12) { 246 switch (regs->r12) {
257 case -ERESTART_RESTARTBLOCK: 247 case -ERESTART_RESTARTBLOCK:
258 case -ERESTARTNOHAND: 248 case -ERESTARTNOHAND:
259 if (signr > 0) { 249 if (ksig.sig > 0) {
260 regs->r12 = -EINTR; 250 regs->r12 = -EINTR;
261 break; 251 break;
262 } 252 }
263 /* fall through */ 253 /* fall through */
264 case -ERESTARTSYS: 254 case -ERESTARTSYS:
265 if (signr > 0 && !(ka.sa.sa_flags & SA_RESTART)) { 255 if (ksig.sig > 0 && !(ksig.ka.sa.sa_flags & SA_RESTART)) {
266 regs->r12 = -EINTR; 256 regs->r12 = -EINTR;
267 break; 257 break;
268 } 258 }
@@ -272,13 +262,13 @@ static void do_signal(struct pt_regs *regs, int syscall)
272 } 262 }
273 } 263 }
274 264
275 if (signr == 0) { 265 if (!ksig.sig) {
276 /* No signal to deliver -- put the saved sigmask back */ 266 /* No signal to deliver -- put the saved sigmask back */
277 restore_saved_sigmask(); 267 restore_saved_sigmask();
278 return; 268 return;
279 } 269 }
280 270
281 handle_signal(signr, &ka, &info, regs, syscall); 271 handle_signal(&ksig, regs, syscall);
282} 272}
283 273
284asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) 274asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti)
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index a1f4d1e91b52..db85b5ec3351 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1553,7 +1553,7 @@ static struct resource atmel_pwm0_resource[] __initdata = {
1553 IRQ(24), 1553 IRQ(24),
1554}; 1554};
1555static struct clk atmel_pwm0_mck = { 1555static struct clk atmel_pwm0_mck = {
1556 .name = "pwm_clk", 1556 .name = "at91sam9rl-pwm",
1557 .parent = &pbb_clk, 1557 .parent = &pbb_clk,
1558 .mode = pbb_clk_mode, 1558 .mode = pbb_clk_mode,
1559 .get_rate = pbb_clk_get_rate, 1559 .get_rate = pbb_clk_get_rate,
@@ -1568,7 +1568,7 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
1568 if (!mask) 1568 if (!mask)
1569 return NULL; 1569 return NULL;
1570 1570
1571 pdev = platform_device_alloc("atmel_pwm", 0); 1571 pdev = platform_device_alloc("at91sam9rl-pwm", 0);
1572 if (!pdev) 1572 if (!pdev)
1573 return NULL; 1573 return NULL;
1574 1574
@@ -1576,9 +1576,6 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
1576 ARRAY_SIZE(atmel_pwm0_resource))) 1576 ARRAY_SIZE(atmel_pwm0_resource)))
1577 goto out_free_pdev; 1577 goto out_free_pdev;
1578 1578
1579 if (platform_device_add_data(pdev, &mask, sizeof(mask)))
1580 goto out_free_pdev;
1581
1582 pin_mask = 0; 1579 pin_mask = 0;
1583 if (mask & (1 << 0)) 1580 if (mask & (1 << 0))
1584 pin_mask |= (1 << 28); 1581 pin_mask |= (1 << 28);
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index b022af6c48f8..ef275571d885 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -135,40 +135,31 @@ static inline int rt_setup_sigcontext(struct sigcontext *sc, struct pt_regs *reg
135 return err; 135 return err;
136} 136}
137 137
138static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 138static inline void *get_sigframe(struct ksignal *ksig,
139 size_t frame_size) 139 size_t frame_size)
140{ 140{
141 unsigned long usp; 141 unsigned long usp = sigsp(rdusp(), ksig);
142 142
143 /* Default to using normal stack. */
144 usp = rdusp();
145
146 /* This is the X/Open sanctioned signal stack switching. */
147 if (ka->sa.sa_flags & SA_ONSTACK) {
148 if (!on_sig_stack(usp))
149 usp = current->sas_ss_sp + current->sas_ss_size;
150 }
151 return (void *)((usp - frame_size) & -8UL); 143 return (void *)((usp - frame_size) & -8UL);
152} 144}
153 145
154static int 146static int
155setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, 147setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
156 sigset_t * set, struct pt_regs *regs)
157{ 148{
158 struct rt_sigframe *frame; 149 struct rt_sigframe *frame;
159 int err = 0; 150 int err = 0;
160 151
161 frame = get_sigframe(ka, regs, sizeof(*frame)); 152 frame = get_sigframe(ksig, sizeof(*frame));
162 153
163 err |= __put_user((current_thread_info()->exec_domain 154 err |= __put_user((current_thread_info()->exec_domain
164 && current_thread_info()->exec_domain->signal_invmap 155 && current_thread_info()->exec_domain->signal_invmap
165 && sig < 32 156 && ksig->sig < 32
166 ? current_thread_info()->exec_domain-> 157 ? current_thread_info()->exec_domain->
167 signal_invmap[sig] : sig), &frame->sig); 158 signal_invmap[ksig->sig] : ksig->sig), &frame->sig);
168 159
169 err |= __put_user(&frame->info, &frame->pinfo); 160 err |= __put_user(&frame->info, &frame->pinfo);
170 err |= __put_user(&frame->uc, &frame->puc); 161 err |= __put_user(&frame->uc, &frame->puc);
171 err |= copy_siginfo_to_user(&frame->info, info); 162 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
172 163
173 /* Create the ucontext. */ 164 /* Create the ucontext. */
174 err |= __put_user(0, &frame->uc.uc_flags); 165 err |= __put_user(0, &frame->uc.uc_flags);
@@ -183,7 +174,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info,
183 /* Set up registers for signal handler */ 174 /* Set up registers for signal handler */
184 if (current->personality & FDPIC_FUNCPTRS) { 175 if (current->personality & FDPIC_FUNCPTRS) {
185 struct fdpic_func_descriptor __user *funcptr = 176 struct fdpic_func_descriptor __user *funcptr =
186 (struct fdpic_func_descriptor *) ka->sa.sa_handler; 177 (struct fdpic_func_descriptor *) ksig->ka.sa.sa_handler;
187 u32 pc, p3; 178 u32 pc, p3;
188 err |= __get_user(pc, &funcptr->text); 179 err |= __get_user(pc, &funcptr->text);
189 err |= __get_user(p3, &funcptr->GOT); 180 err |= __get_user(p3, &funcptr->GOT);
@@ -192,7 +183,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info,
192 regs->pc = pc; 183 regs->pc = pc;
193 regs->p3 = p3; 184 regs->p3 = p3;
194 } else 185 } else
195 regs->pc = (unsigned long)ka->sa.sa_handler; 186 regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
196 wrusp((unsigned long)frame); 187 wrusp((unsigned long)frame);
197 regs->rets = SIGRETURN_STUB; 188 regs->rets = SIGRETURN_STUB;
198 189
@@ -237,20 +228,19 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
237 * OK, we're invoking a handler 228 * OK, we're invoking a handler
238 */ 229 */
239static void 230static void
240handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, 231handle_signal(struct ksignal *ksig, struct pt_regs *regs)
241 struct pt_regs *regs)
242{ 232{
233 int ret;
234
243 /* are we from a system call? to see pt_regs->orig_p0 */ 235 /* are we from a system call? to see pt_regs->orig_p0 */
244 if (regs->orig_p0 >= 0) 236 if (regs->orig_p0 >= 0)
245 /* If so, check system call restarting.. */ 237 /* If so, check system call restarting.. */
246 handle_restart(regs, ka, 1); 238 handle_restart(regs, &ksig->ka, 1);
247 239
248 /* set up the stack frame */ 240 /* set up the stack frame */
249 if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) 241 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
250 force_sigsegv(sig, current); 242
251 else 243 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
252 signal_delivered(sig, info, ka, regs,
253 test_thread_flag(TIF_SINGLESTEP));
254} 244}
255 245
256/* 246/*
@@ -264,16 +254,13 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
264 */ 254 */
265asmlinkage void do_signal(struct pt_regs *regs) 255asmlinkage void do_signal(struct pt_regs *regs)
266{ 256{
267 siginfo_t info; 257 struct ksignal ksig;
268 int signr;
269 struct k_sigaction ka;
270 258
271 current->thread.esp0 = (unsigned long)regs; 259 current->thread.esp0 = (unsigned long)regs;
272 260
273 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 261 if (get_signal(&ksig)) {
274 if (signr > 0) {
275 /* Whee! Actually deliver the signal. */ 262 /* Whee! Actually deliver the signal. */
276 handle_signal(signr, &info, &ka, regs); 263 handle_signal(&ksig, regs);
277 return; 264 return;
278 } 265 }
279 266
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c
index 3998b24e26f2..fe68226f6c4d 100644
--- a/arch/c6x/kernel/signal.c
+++ b/arch/c6x/kernel/signal.c
@@ -127,17 +127,11 @@ static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
127 return err; 127 return err;
128} 128}
129 129
130static inline void __user *get_sigframe(struct k_sigaction *ka, 130static inline void __user *get_sigframe(struct ksignal *ksig,
131 struct pt_regs *regs, 131 struct pt_regs *regs,
132 unsigned long framesize) 132 unsigned long framesize)
133{ 133{
134 unsigned long sp = regs->sp; 134 unsigned long sp = sigsp(regs->sp, ksig);
135
136 /*
137 * This is the X/Open sanctioned signal stack switching.
138 */
139 if ((ka->sa.sa_flags & SA_ONSTACK) && sas_ss_flags(sp) == 0)
140 sp = current->sas_ss_sp + current->sas_ss_size;
141 135
142 /* 136 /*
143 * No matter what happens, 'sp' must be dword 137 * No matter what happens, 'sp' must be dword
@@ -146,21 +140,21 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
146 return (void __user *)((sp - framesize) & ~7); 140 return (void __user *)((sp - framesize) & ~7);
147} 141}
148 142
149static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, 143static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
150 sigset_t *set, struct pt_regs *regs) 144 struct pt_regs *regs)
151{ 145{
152 struct rt_sigframe __user *frame; 146 struct rt_sigframe __user *frame;
153 unsigned long __user *retcode; 147 unsigned long __user *retcode;
154 int err = 0; 148 int err = 0;
155 149
156 frame = get_sigframe(ka, regs, sizeof(*frame)); 150 frame = get_sigframe(ksig, regs, sizeof(*frame));
157 151
158 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 152 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
159 goto segv_and_exit; 153 return -EFAULT;
160 154
161 err |= __put_user(&frame->info, &frame->pinfo); 155 err |= __put_user(&frame->info, &frame->pinfo);
162 err |= __put_user(&frame->uc, &frame->puc); 156 err |= __put_user(&frame->uc, &frame->puc);
163 err |= copy_siginfo_to_user(&frame->info, info); 157 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
164 158
165 /* Clear all the bits of the ucontext we don't use. */ 159 /* Clear all the bits of the ucontext we don't use. */
166 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 160 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
@@ -188,7 +182,7 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
188#undef COPY 182#undef COPY
189 183
190 if (err) 184 if (err)
191 goto segv_and_exit; 185 return -EFAULT;
192 186
193 flush_icache_range((unsigned long) &frame->retcode, 187 flush_icache_range((unsigned long) &frame->retcode,
194 (unsigned long) &frame->retcode + RETCODE_SIZE); 188 (unsigned long) &frame->retcode + RETCODE_SIZE);
@@ -198,10 +192,10 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
198 /* Change user context to branch to signal handler */ 192 /* Change user context to branch to signal handler */
199 regs->sp = (unsigned long) frame - 8; 193 regs->sp = (unsigned long) frame - 8;
200 regs->b3 = (unsigned long) retcode; 194 regs->b3 = (unsigned long) retcode;
201 regs->pc = (unsigned long) ka->sa.sa_handler; 195 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
202 196
203 /* Give the signal number to the handler */ 197 /* Give the signal number to the handler */
204 regs->a4 = signr; 198 regs->a4 = ksig->sig;
205 199
206 /* 200 /*
207 * For realtime signals we must also set the second and third 201 * For realtime signals we must also set the second and third
@@ -212,10 +206,6 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
212 regs->a6 = (unsigned long)&frame->uc; 206 regs->a6 = (unsigned long)&frame->uc;
213 207
214 return 0; 208 return 0;
215
216segv_and_exit:
217 force_sigsegv(signr, current);
218 return -EFAULT;
219} 209}
220 210
221static inline void 211static inline void
@@ -245,10 +235,11 @@ do_restart:
245/* 235/*
246 * handle the actual delivery of a signal to userspace 236 * handle the actual delivery of a signal to userspace
247 */ 237 */
248static void handle_signal(int sig, 238static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
249 siginfo_t *info, struct k_sigaction *ka, 239 int syscall)
250 struct pt_regs *regs, int syscall)
251{ 240{
241 int ret;
242
252 /* Are we from a system call? */ 243 /* Are we from a system call? */
253 if (syscall) { 244 if (syscall) {
254 /* If so, check system call restarting.. */ 245 /* If so, check system call restarting.. */
@@ -259,7 +250,7 @@ static void handle_signal(int sig,
259 break; 250 break;
260 251
261 case -ERESTARTSYS: 252 case -ERESTARTSYS:
262 if (!(ka->sa.sa_flags & SA_RESTART)) { 253 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
263 regs->a4 = -EINTR; 254 regs->a4 = -EINTR;
264 break; 255 break;
265 } 256 }
@@ -272,9 +263,8 @@ static void handle_signal(int sig,
272 } 263 }
273 264
274 /* Set up the stack frame */ 265 /* Set up the stack frame */
275 if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) 266 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
276 return; 267 signal_setup_done(ret, ksig, 0);
277 signal_delivered(sig, info, ka, regs, 0);
278} 268}
279 269
280/* 270/*
@@ -282,18 +272,15 @@ static void handle_signal(int sig,
282 */ 272 */
283static void do_signal(struct pt_regs *regs, int syscall) 273static void do_signal(struct pt_regs *regs, int syscall)
284{ 274{
285 struct k_sigaction ka; 275 struct ksignal ksig;
286 siginfo_t info;
287 int signr;
288 276
289 /* we want the common case to go fast, which is why we may in certain 277 /* we want the common case to go fast, which is why we may in certain
290 * cases get here from kernel mode */ 278 * cases get here from kernel mode */
291 if (!user_mode(regs)) 279 if (!user_mode(regs))
292 return; 280 return;
293 281
294 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 282 if (get_signal(&ksig)) {
295 if (signr > 0) { 283 handle_signal(&ksig, regs, syscall);
296 handle_signal(signr, &info, &ka, regs, syscall);
297 return; 284 return;
298 } 285 }
299 286
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 61ce6273a895..9b32d338838b 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -203,15 +203,9 @@ static int setup_sigcontext(struct sigcontext __user *sc,
203 * - usually on the stack. */ 203 * - usually on the stack. */
204 204
205static inline void __user * 205static inline void __user *
206get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 206get_sigframe(struct ksignal *ksig, size_t frame_size)
207{ 207{
208 unsigned long sp = rdusp(); 208 unsigned long sp = sigsp(rdusp(), ksig);
209
210 /* This is the X/Open sanctioned signal stack switching. */
211 if (ka->sa.sa_flags & SA_ONSTACK) {
212 if (! on_sig_stack(sp))
213 sp = current->sas_ss_sp + current->sas_ss_size;
214 }
215 209
216 /* make sure the frame is dword-aligned */ 210 /* make sure the frame is dword-aligned */
217 211
@@ -228,33 +222,33 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
228 * user-mode trampoline. 222 * user-mode trampoline.
229 */ 223 */
230 224
231static int setup_frame(int sig, struct k_sigaction *ka, 225static int setup_frame(struct ksignal *ksig, sigset_t *set,
232 sigset_t *set, struct pt_regs *regs) 226 struct pt_regs *regs)
233{ 227{
234 struct sigframe __user *frame; 228 struct sigframe __user *frame;
235 unsigned long return_ip; 229 unsigned long return_ip;
236 int err = 0; 230 int err = 0;
237 231
238 frame = get_sigframe(ka, regs, sizeof(*frame)); 232 frame = get_sigframe(ksig, sizeof(*frame));
239 233
240 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 234 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
241 goto give_sigsegv; 235 return -EFAULT;
242 236
243 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); 237 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
244 if (err) 238 if (err)
245 goto give_sigsegv; 239 return -EFAULT;
246 240
247 if (_NSIG_WORDS > 1) { 241 if (_NSIG_WORDS > 1) {
248 err |= __copy_to_user(frame->extramask, &set->sig[1], 242 err |= __copy_to_user(frame->extramask, &set->sig[1],
249 sizeof(frame->extramask)); 243 sizeof(frame->extramask));
250 } 244 }
251 if (err) 245 if (err)
252 goto give_sigsegv; 246 return -EFAULT;
253 247
254 /* Set up to return from userspace. If provided, use a stub 248 /* Set up to return from userspace. If provided, use a stub
255 already in userspace. */ 249 already in userspace. */
256 if (ka->sa.sa_flags & SA_RESTORER) { 250 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
257 return_ip = (unsigned long)ka->sa.sa_restorer; 251 return_ip = (unsigned long)ksig->ka.sa.sa_restorer;
258 } else { 252 } else {
259 /* trampoline - the desired return ip is the retcode itself */ 253 /* trampoline - the desired return ip is the retcode itself */
260 return_ip = (unsigned long)&frame->retcode; 254 return_ip = (unsigned long)&frame->retcode;
@@ -265,42 +259,38 @@ static int setup_frame(int sig, struct k_sigaction *ka,
265 } 259 }
266 260
267 if (err) 261 if (err)
268 goto give_sigsegv; 262 return -EFAULT;
269 263
270 /* Set up registers for signal handler */ 264 /* Set up registers for signal handler */
271 265
272 regs->irp = (unsigned long) ka->sa.sa_handler; /* what we enter NOW */ 266 regs->irp = (unsigned long) ksig->ka.sa.sa_handler; /* what we enter NOW */
273 regs->srp = return_ip; /* what we enter LATER */ 267 regs->srp = return_ip; /* what we enter LATER */
274 regs->r10 = sig; /* first argument is signo */ 268 regs->r10 = ksig->sig; /* first argument is signo */
275 269
276 /* actually move the usp to reflect the stacked frame */ 270 /* actually move the usp to reflect the stacked frame */
277 271
278 wrusp((unsigned long)frame); 272 wrusp((unsigned long)frame);
279 273
280 return 0; 274 return 0;
281
282give_sigsegv:
283 force_sigsegv(sig, current);
284 return -EFAULT;
285} 275}
286 276
287static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 277static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
288 sigset_t *set, struct pt_regs *regs) 278 struct pt_regs *regs)
289{ 279{
290 struct rt_sigframe __user *frame; 280 struct rt_sigframe __user *frame;
291 unsigned long return_ip; 281 unsigned long return_ip;
292 int err = 0; 282 int err = 0;
293 283
294 frame = get_sigframe(ka, regs, sizeof(*frame)); 284 frame = get_sigframe(ksig, sizeof(*frame));
295 285
296 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 286 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
297 goto give_sigsegv; 287 return -EFAULT;
298 288
299 err |= __put_user(&frame->info, &frame->pinfo); 289 err |= __put_user(&frame->info, &frame->pinfo);
300 err |= __put_user(&frame->uc, &frame->puc); 290 err |= __put_user(&frame->uc, &frame->puc);
301 err |= copy_siginfo_to_user(&frame->info, info); 291 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
302 if (err) 292 if (err)
303 goto give_sigsegv; 293 return -EFAULT;
304 294
305 /* Clear all the bits of the ucontext we don't use. */ 295 /* Clear all the bits of the ucontext we don't use. */
306 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 296 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
@@ -312,12 +302,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
312 err |= __save_altstack(&frame->uc.uc_stack, rdusp()); 302 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
313 303
314 if (err) 304 if (err)
315 goto give_sigsegv; 305 return -EFAULT;
316 306
317 /* Set up to return from userspace. If provided, use a stub 307 /* Set up to return from userspace. If provided, use a stub
318 already in userspace. */ 308 already in userspace. */
319 if (ka->sa.sa_flags & SA_RESTORER) { 309 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
320 return_ip = (unsigned long)ka->sa.sa_restorer; 310 return_ip = (unsigned long)ksig->ka.sa.sa_restorer;
321 } else { 311 } else {
322 /* trampoline - the desired return ip is the retcode itself */ 312 /* trampoline - the desired return ip is the retcode itself */
323 return_ip = (unsigned long)&frame->retcode; 313 return_ip = (unsigned long)&frame->retcode;
@@ -329,18 +319,18 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
329 } 319 }
330 320
331 if (err) 321 if (err)
332 goto give_sigsegv; 322 return -EFAULT;
333 323
334 /* TODO what is the current->exec_domain stuff and invmap ? */ 324 /* TODO what is the current->exec_domain stuff and invmap ? */
335 325
336 /* Set up registers for signal handler */ 326 /* Set up registers for signal handler */
337 327
338 /* What we enter NOW */ 328 /* What we enter NOW */
339 regs->irp = (unsigned long) ka->sa.sa_handler; 329 regs->irp = (unsigned long) ksig->ka.sa.sa_handler;
340 /* What we enter LATER */ 330 /* What we enter LATER */
341 regs->srp = return_ip; 331 regs->srp = return_ip;
342 /* First argument is signo */ 332 /* First argument is signo */
343 regs->r10 = sig; 333 regs->r10 = ksig->sig;
344 /* Second argument is (siginfo_t *) */ 334 /* Second argument is (siginfo_t *) */
345 regs->r11 = (unsigned long)&frame->info; 335 regs->r11 = (unsigned long)&frame->info;
346 /* Third argument is unused */ 336 /* Third argument is unused */
@@ -350,19 +340,14 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
350 wrusp((unsigned long)frame); 340 wrusp((unsigned long)frame);
351 341
352 return 0; 342 return 0;
353
354give_sigsegv:
355 force_sigsegv(sig, current);
356 return -EFAULT;
357} 343}
358 344
359/* 345/*
360 * OK, we're invoking a handler 346 * OK, we're invoking a handler
361 */ 347 */
362 348
363static inline void handle_signal(int canrestart, unsigned long sig, 349static inline void handle_signal(int canrestart, struct ksignal *ksig,
364 siginfo_t *info, struct k_sigaction *ka, 350 struct pt_regs *regs)
365 struct pt_regs *regs)
366{ 351{
367 sigset_t *oldset = sigmask_to_save(); 352 sigset_t *oldset = sigmask_to_save();
368 int ret; 353 int ret;
@@ -383,7 +368,7 @@ static inline void handle_signal(int canrestart, unsigned long sig,
383 /* ERESTARTSYS means to restart the syscall if 368 /* ERESTARTSYS means to restart the syscall if
384 * there is no handler or the handler was 369 * there is no handler or the handler was
385 * registered with SA_RESTART */ 370 * registered with SA_RESTART */
386 if (!(ka->sa.sa_flags & SA_RESTART)) { 371 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
387 regs->r10 = -EINTR; 372 regs->r10 = -EINTR;
388 break; 373 break;
389 } 374 }
@@ -396,13 +381,12 @@ static inline void handle_signal(int canrestart, unsigned long sig,
396 } 381 }
397 382
398 /* Set up the stack frame */ 383 /* Set up the stack frame */
399 if (ka->sa.sa_flags & SA_SIGINFO) 384 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
400 ret = setup_rt_frame(sig, ka, info, oldset, regs); 385 ret = setup_rt_frame(ksig, oldset, regs);
401 else 386 else
402 ret = setup_frame(sig, ka, oldset, regs); 387 ret = setup_frame(ksig, oldset, regs);
403 388
404 if (ret == 0) 389 signal_setup_done(ret, ksig, 0);
405 signal_delivered(sig, info, ka, regs, 0);
406} 390}
407 391
408/* 392/*
@@ -419,9 +403,7 @@ static inline void handle_signal(int canrestart, unsigned long sig,
419 403
420void do_signal(int canrestart, struct pt_regs *regs) 404void do_signal(int canrestart, struct pt_regs *regs)
421{ 405{
422 siginfo_t info; 406 struct ksignal ksig;
423 int signr;
424 struct k_sigaction ka;
425 407
426 /* 408 /*
427 * We want the common case to go fast, which 409 * We want the common case to go fast, which
@@ -432,10 +414,9 @@ void do_signal(int canrestart, struct pt_regs *regs)
432 if (!user_mode(regs)) 414 if (!user_mode(regs))
433 return; 415 return;
434 416
435 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 417 if (get_signal(&ksig)) {
436 if (signr > 0) {
437 /* Whee! Actually deliver the signal. */ 418 /* Whee! Actually deliver the signal. */
438 handle_signal(canrestart, signr, &info, &ka, regs); 419 handle_signal(canrestart, &ksig, regs);
439 return; 420 return;
440 } 421 }
441 422
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index 01d1375c9004..78ce3b1c9bcb 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -189,17 +189,9 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
189 189
190/* Figure out where to put the new signal frame - usually on the stack. */ 190/* Figure out where to put the new signal frame - usually on the stack. */
191static inline void __user * 191static inline void __user *
192get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) 192get_sigframe(struct ksignal *ksig, size_t frame_size)
193{ 193{
194 unsigned long sp; 194 unsigned long sp = sigsp(rdusp(), ksig);
195
196 sp = rdusp();
197
198 /* This is the X/Open sanctioned signal stack switching. */
199 if (ka->sa.sa_flags & SA_ONSTACK) {
200 if (!on_sig_stack(sp))
201 sp = current->sas_ss_sp + current->sas_ss_size;
202 }
203 195
204 /* Make sure the frame is dword-aligned. */ 196 /* Make sure the frame is dword-aligned. */
205 sp &= ~3; 197 sp &= ~3;
@@ -215,23 +207,22 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
215 * trampoline. 207 * trampoline.
216 */ 208 */
217static int 209static int
218setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 210setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
219 struct pt_regs * regs)
220{ 211{
221 int err; 212 int err;
222 unsigned long return_ip; 213 unsigned long return_ip;
223 struct signal_frame __user *frame; 214 struct signal_frame __user *frame;
224 215
225 err = 0; 216 err = 0;
226 frame = get_sigframe(ka, regs, sizeof(*frame)); 217 frame = get_sigframe(ksig, sizeof(*frame));
227 218
228 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 219 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
229 goto give_sigsegv; 220 return -EFAULT;
230 221
231 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); 222 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
232 223
233 if (err) 224 if (err)
234 goto give_sigsegv; 225 return -EFAULT;
235 226
236 if (_NSIG_WORDS > 1) { 227 if (_NSIG_WORDS > 1) {
237 err |= __copy_to_user(frame->extramask, &set->sig[1], 228 err |= __copy_to_user(frame->extramask, &set->sig[1],
@@ -239,14 +230,14 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
239 } 230 }
240 231
241 if (err) 232 if (err)
242 goto give_sigsegv; 233 return -EFAULT;
243 234
244 /* 235 /*
245 * Set up to return from user-space. If provided, use a stub 236 * Set up to return from user-space. If provided, use a stub
246 * already located in user-space. 237 * already located in user-space.
247 */ 238 */
248 if (ka->sa.sa_flags & SA_RESTORER) { 239 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
249 return_ip = (unsigned long)ka->sa.sa_restorer; 240 return_ip = (unsigned long)ksig->ka.sa.sa_restorer;
250 } else { 241 } else {
251 /* Trampoline - the desired return ip is in the signal return page. */ 242 /* Trampoline - the desired return ip is in the signal return page. */
252 return_ip = cris_signal_return_page; 243 return_ip = cris_signal_return_page;
@@ -264,7 +255,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
264 } 255 }
265 256
266 if (err) 257 if (err)
267 goto give_sigsegv; 258 return -EFAULT;
268 259
269 /* 260 /*
270 * Set up registers for signal handler. 261 * Set up registers for signal handler.
@@ -273,42 +264,37 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
273 * Where the code enter later. 264 * Where the code enter later.
274 * First argument, signo. 265 * First argument, signo.
275 */ 266 */
276 regs->erp = (unsigned long) ka->sa.sa_handler; 267 regs->erp = (unsigned long) ksig->ka.sa.sa_handler;
277 regs->srp = return_ip; 268 regs->srp = return_ip;
278 regs->r10 = sig; 269 regs->r10 = ksig->sig;
279 270
280 /* Actually move the USP to reflect the stacked frame. */ 271 /* Actually move the USP to reflect the stacked frame. */
281 wrusp((unsigned long)frame); 272 wrusp((unsigned long)frame);
282 273
283 return 0; 274 return 0;
284
285give_sigsegv:
286 force_sigsegv(sig, current);
287 return -EFAULT;
288} 275}
289 276
290static int 277static int
291setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 278setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
292 sigset_t *set, struct pt_regs * regs)
293{ 279{
294 int err; 280 int err;
295 unsigned long return_ip; 281 unsigned long return_ip;
296 struct rt_signal_frame __user *frame; 282 struct rt_signal_frame __user *frame;
297 283
298 err = 0; 284 err = 0;
299 frame = get_sigframe(ka, regs, sizeof(*frame)); 285 frame = get_sigframe(ksig, sizeof(*frame));
300 286
301 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 287 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
302 goto give_sigsegv; 288 return -EFAULT;
303 289
304 /* TODO: what is the current->exec_domain stuff and invmap ? */ 290 /* TODO: what is the current->exec_domain stuff and invmap ? */
305 291
306 err |= __put_user(&frame->info, &frame->pinfo); 292 err |= __put_user(&frame->info, &frame->pinfo);
307 err |= __put_user(&frame->uc, &frame->puc); 293 err |= __put_user(&frame->uc, &frame->puc);
308 err |= copy_siginfo_to_user(&frame->info, info); 294 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
309 295
310 if (err) 296 if (err)
311 goto give_sigsegv; 297 return -EFAULT;
312 298
313 /* Clear all the bits of the ucontext we don't use. */ 299 /* Clear all the bits of the ucontext we don't use. */
314 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 300 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
@@ -317,14 +303,14 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
317 err |= __save_altstack(&frame->uc.uc_stack, rdusp()); 303 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
318 304
319 if (err) 305 if (err)
320 goto give_sigsegv; 306 return -EFAULT;
321 307
322 /* 308 /*
323 * Set up to return from user-space. If provided, use a stub 309 * Set up to return from user-space. If provided, use a stub
324 * already located in user-space. 310 * already located in user-space.
325 */ 311 */
326 if (ka->sa.sa_flags & SA_RESTORER) { 312 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
327 return_ip = (unsigned long) ka->sa.sa_restorer; 313 return_ip = (unsigned long) ksig->ka.sa.sa_restorer;
328 } else { 314 } else {
329 /* Trampoline - the desired return ip is in the signal return page. */ 315 /* Trampoline - the desired return ip is in the signal return page. */
330 return_ip = cris_signal_return_page + 6; 316 return_ip = cris_signal_return_page + 6;
@@ -345,7 +331,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
345 } 331 }
346 332
347 if (err) 333 if (err)
348 goto give_sigsegv; 334 return -EFAULT;
349 335
350 /* 336 /*
351 * Set up registers for signal handler. 337 * Set up registers for signal handler.
@@ -356,9 +342,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
356 * Second argument is (siginfo_t *). 342 * Second argument is (siginfo_t *).
357 * Third argument is unused. 343 * Third argument is unused.
358 */ 344 */
359 regs->erp = (unsigned long) ka->sa.sa_handler; 345 regs->erp = (unsigned long) ksig->ka.sa.sa_handler;
360 regs->srp = return_ip; 346 regs->srp = return_ip;
361 regs->r10 = sig; 347 regs->r10 = ksig->sig;
362 regs->r11 = (unsigned long) &frame->info; 348 regs->r11 = (unsigned long) &frame->info;
363 regs->r12 = 0; 349 regs->r12 = 0;
364 350
@@ -366,17 +352,11 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
366 wrusp((unsigned long)frame); 352 wrusp((unsigned long)frame);
367 353
368 return 0; 354 return 0;
369
370give_sigsegv:
371 force_sigsegv(sig, current);
372 return -EFAULT;
373} 355}
374 356
375/* Invoke a signal handler to, well, handle the signal. */ 357/* Invoke a signal handler to, well, handle the signal. */
376static inline void 358static inline void
377handle_signal(int canrestart, unsigned long sig, 359handle_signal(int canrestart, struct ksignal *ksig, struct pt_regs *regs)
378 siginfo_t *info, struct k_sigaction *ka,
379 struct pt_regs * regs)
380{ 360{
381 sigset_t *oldset = sigmask_to_save(); 361 sigset_t *oldset = sigmask_to_save();
382 int ret; 362 int ret;
@@ -404,7 +384,7 @@ handle_signal(int canrestart, unsigned long sig,
404 * there is no handler, or the handler 384 * there is no handler, or the handler
405 * was registered with SA_RESTART. 385 * was registered with SA_RESTART.
406 */ 386 */
407 if (!(ka->sa.sa_flags & SA_RESTART)) { 387 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
408 regs->r10 = -EINTR; 388 regs->r10 = -EINTR;
409 break; 389 break;
410 } 390 }
@@ -423,13 +403,12 @@ handle_signal(int canrestart, unsigned long sig,
423 } 403 }
424 404
425 /* Set up the stack frame. */ 405 /* Set up the stack frame. */
426 if (ka->sa.sa_flags & SA_SIGINFO) 406 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
427 ret = setup_rt_frame(sig, ka, info, oldset, regs); 407 ret = setup_rt_frame(ksig, oldset, regs);
428 else 408 else
429 ret = setup_frame(sig, ka, oldset, regs); 409 ret = setup_frame(ksig, oldset, regs);
430 410
431 if (ret == 0) 411 signal_setup_done(ret, ksig, 0);
432 signal_delivered(sig, info, ka, regs, 0);
433} 412}
434 413
435/* 414/*
@@ -446,9 +425,7 @@ handle_signal(int canrestart, unsigned long sig,
446void 425void
447do_signal(int canrestart, struct pt_regs *regs) 426do_signal(int canrestart, struct pt_regs *regs)
448{ 427{
449 int signr; 428 struct ksignal ksig;
450 siginfo_t info;
451 struct k_sigaction ka;
452 429
453 /* 430 /*
454 * The common case should go fast, which is why this point is 431 * The common case should go fast, which is why this point is
@@ -458,11 +435,9 @@ do_signal(int canrestart, struct pt_regs *regs)
458 if (!user_mode(regs)) 435 if (!user_mode(regs))
459 return; 436 return;
460 437
461 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 438 if (get_signal(&ksig)) {
462
463 if (signr > 0) {
464 /* Whee! Actually deliver the signal. */ 439 /* Whee! Actually deliver the signal. */
465 handle_signal(canrestart, signr, &info, &ka, regs); 440 handle_signal(canrestart, &ksig, regs);
466 return; 441 return;
467 } 442 }
468 443
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index afff5105909d..31742dfadff9 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += linkage.h
13generic-y += mcs_spinlock.h 13generic-y += mcs_spinlock.h
14generic-y += module.h 14generic-y += module.h
15generic-y += preempt.h 15generic-y += preempt.h
16generic-y += scatterlist.h
16generic-y += trace_clock.h 17generic-y += trace_clock.h
17generic-y += vga.h 18generic-y += vga.h
18generic-y += xor.h 19generic-y += xor.h
diff --git a/arch/cris/include/asm/scatterlist.h b/arch/cris/include/asm/scatterlist.h
deleted file mode 100644
index f11f8f40ec4a..000000000000
--- a/arch/cris/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_CRIS_SCATTERLIST_H
2#define __ASM_CRIS_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* !(__ASM_CRIS_SCATTERLIST_H) */
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index 87b95eb8aee5..5b73921b6e9d 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -5,4 +5,5 @@ generic-y += exec.h
5generic-y += hash.h 5generic-y += hash.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += preempt.h 7generic-y += preempt.h
8generic-y += scatterlist.h
8generic-y += trace_clock.h 9generic-y += trace_clock.h
diff --git a/arch/frv/include/asm/scatterlist.h b/arch/frv/include/asm/scatterlist.h
deleted file mode 100644
index 0e5eb3018468..000000000000
--- a/arch/frv/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SCATTERLIST_H
2#define _ASM_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* !_ASM_SCATTERLIST_H */
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d822700d4f15..dc3d59de0870 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -158,19 +158,10 @@ static int setup_sigcontext(struct sigcontext __user *sc, unsigned long mask)
158/* 158/*
159 * Determine which stack to use.. 159 * Determine which stack to use..
160 */ 160 */
161static inline void __user *get_sigframe(struct k_sigaction *ka, 161static inline void __user *get_sigframe(struct ksignal *ksig,
162 size_t frame_size) 162 size_t frame_size)
163{ 163{
164 unsigned long sp; 164 unsigned long sp = sigsp(__frame->sp, ksig);
165
166 /* Default to using normal stack */
167 sp = __frame->sp;
168
169 /* This is the X/Open sanctioned signal stack switching. */
170 if (ka->sa.sa_flags & SA_ONSTACK) {
171 if (! sas_ss_flags(sp))
172 sp = current->sas_ss_sp + current->sas_ss_size;
173 }
174 165
175 return (void __user *) ((sp - frame_size) & ~7UL); 166 return (void __user *) ((sp - frame_size) & ~7UL);
176 167
@@ -180,17 +171,17 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
180/* 171/*
181 * 172 *
182 */ 173 */
183static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) 174static int setup_frame(struct ksignal *ksig, sigset_t *set)
184{ 175{
185 struct sigframe __user *frame; 176 struct sigframe __user *frame;
186 int rsig; 177 int rsig, sig = ksig->sig;
187 178
188 set_fs(USER_DS); 179 set_fs(USER_DS);
189 180
190 frame = get_sigframe(ka, sizeof(*frame)); 181 frame = get_sigframe(ksig, sizeof(*frame));
191 182
192 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
193 goto give_sigsegv; 184 return -EFAULT;
194 185
195 rsig = sig; 186 rsig = sig;
196 if (sig < 32 && 187 if (sig < 32 &&
@@ -199,22 +190,22 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
199 rsig = __current_thread_info->exec_domain->signal_invmap[sig]; 190 rsig = __current_thread_info->exec_domain->signal_invmap[sig];
200 191
201 if (__put_user(rsig, &frame->sig) < 0) 192 if (__put_user(rsig, &frame->sig) < 0)
202 goto give_sigsegv; 193 return -EFAULT;
203 194
204 if (setup_sigcontext(&frame->sc, set->sig[0])) 195 if (setup_sigcontext(&frame->sc, set->sig[0]))
205 goto give_sigsegv; 196 return -EFAULT;
206 197
207 if (_NSIG_WORDS > 1) { 198 if (_NSIG_WORDS > 1) {
208 if (__copy_to_user(frame->extramask, &set->sig[1], 199 if (__copy_to_user(frame->extramask, &set->sig[1],
209 sizeof(frame->extramask))) 200 sizeof(frame->extramask)))
210 goto give_sigsegv; 201 return -EFAULT;
211 } 202 }
212 203
213 /* Set up to return from userspace. If provided, use a stub 204 /* Set up to return from userspace. If provided, use a stub
214 * already in userspace. */ 205 * already in userspace. */
215 if (ka->sa.sa_flags & SA_RESTORER) { 206 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
216 if (__put_user(ka->sa.sa_restorer, &frame->pretcode) < 0) 207 if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode) < 0)
217 goto give_sigsegv; 208 return -EFAULT;
218 } 209 }
219 else { 210 else {
220 /* Set up the following code on the stack: 211 /* Set up the following code on the stack:
@@ -224,7 +215,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
224 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || 215 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
225 __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) || 216 __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) ||
226 __put_user(0xc0700000, &frame->retcode[1])) 217 __put_user(0xc0700000, &frame->retcode[1]))
227 goto give_sigsegv; 218 return -EFAULT;
228 219
229 flush_icache_range((unsigned long) frame->retcode, 220 flush_icache_range((unsigned long) frame->retcode,
230 (unsigned long) (frame->retcode + 2)); 221 (unsigned long) (frame->retcode + 2));
@@ -233,14 +224,14 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
233 /* Set up registers for the signal handler */ 224 /* Set up registers for the signal handler */
234 if (current->personality & FDPIC_FUNCPTRS) { 225 if (current->personality & FDPIC_FUNCPTRS) {
235 struct fdpic_func_descriptor __user *funcptr = 226 struct fdpic_func_descriptor __user *funcptr =
236 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 227 (struct fdpic_func_descriptor __user *) ksig->ka.sa.sa_handler;
237 struct fdpic_func_descriptor desc; 228 struct fdpic_func_descriptor desc;
238 if (copy_from_user(&desc, funcptr, sizeof(desc))) 229 if (copy_from_user(&desc, funcptr, sizeof(desc)))
239 goto give_sigsegv; 230 return -EFAULT;
240 __frame->pc = desc.text; 231 __frame->pc = desc.text;
241 __frame->gr15 = desc.GOT; 232 __frame->gr15 = desc.GOT;
242 } else { 233 } else {
243 __frame->pc = (unsigned long) ka->sa.sa_handler; 234 __frame->pc = (unsigned long) ksig->ka.sa.sa_handler;
244 __frame->gr15 = 0; 235 __frame->gr15 = 0;
245 } 236 }
246 237
@@ -255,29 +246,23 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
255#endif 246#endif
256 247
257 return 0; 248 return 0;
258
259give_sigsegv:
260 force_sigsegv(sig, current);
261 return -EFAULT;
262
263} /* end setup_frame() */ 249} /* end setup_frame() */
264 250
265/*****************************************************************************/ 251/*****************************************************************************/
266/* 252/*
267 * 253 *
268 */ 254 */
269static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 255static int setup_rt_frame(struct ksignal *ksig, sigset_t *set)
270 sigset_t *set)
271{ 256{
272 struct rt_sigframe __user *frame; 257 struct rt_sigframe __user *frame;
273 int rsig; 258 int rsig, sig = ksig->sig;
274 259
275 set_fs(USER_DS); 260 set_fs(USER_DS);
276 261
277 frame = get_sigframe(ka, sizeof(*frame)); 262 frame = get_sigframe(ksig, sizeof(*frame));
278 263
279 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 264 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
280 goto give_sigsegv; 265 return -EFAULT;
281 266
282 rsig = sig; 267 rsig = sig;
283 if (sig < 32 && 268 if (sig < 32 &&
@@ -288,28 +273,28 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
288 if (__put_user(rsig, &frame->sig) || 273 if (__put_user(rsig, &frame->sig) ||
289 __put_user(&frame->info, &frame->pinfo) || 274 __put_user(&frame->info, &frame->pinfo) ||
290 __put_user(&frame->uc, &frame->puc)) 275 __put_user(&frame->uc, &frame->puc))
291 goto give_sigsegv; 276 return -EFAULT;
292 277
293 if (copy_siginfo_to_user(&frame->info, info)) 278 if (copy_siginfo_to_user(&frame->info, &ksig->info))
294 goto give_sigsegv; 279 return -EFAULT;
295 280
296 /* Create the ucontext. */ 281 /* Create the ucontext. */
297 if (__put_user(0, &frame->uc.uc_flags) || 282 if (__put_user(0, &frame->uc.uc_flags) ||
298 __put_user(NULL, &frame->uc.uc_link) || 283 __put_user(NULL, &frame->uc.uc_link) ||
299 __save_altstack(&frame->uc.uc_stack, __frame->sp)) 284 __save_altstack(&frame->uc.uc_stack, __frame->sp))
300 goto give_sigsegv; 285 return -EFAULT;
301 286
302 if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0])) 287 if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0]))
303 goto give_sigsegv; 288 return -EFAULT;
304 289
305 if (__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set))) 290 if (__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)))
306 goto give_sigsegv; 291 return -EFAULT;
307 292
308 /* Set up to return from userspace. If provided, use a stub 293 /* Set up to return from userspace. If provided, use a stub
309 * already in userspace. */ 294 * already in userspace. */
310 if (ka->sa.sa_flags & SA_RESTORER) { 295 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
311 if (__put_user(ka->sa.sa_restorer, &frame->pretcode)) 296 if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode))
312 goto give_sigsegv; 297 return -EFAULT;
313 } 298 }
314 else { 299 else {
315 /* Set up the following code on the stack: 300 /* Set up the following code on the stack:
@@ -319,7 +304,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
319 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || 304 if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) ||
320 __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) || 305 __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) ||
321 __put_user(0xc0700000, &frame->retcode[1])) 306 __put_user(0xc0700000, &frame->retcode[1]))
322 goto give_sigsegv; 307 return -EFAULT;
323 308
324 flush_icache_range((unsigned long) frame->retcode, 309 flush_icache_range((unsigned long) frame->retcode,
325 (unsigned long) (frame->retcode + 2)); 310 (unsigned long) (frame->retcode + 2));
@@ -328,14 +313,14 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
328 /* Set up registers for signal handler */ 313 /* Set up registers for signal handler */
329 if (current->personality & FDPIC_FUNCPTRS) { 314 if (current->personality & FDPIC_FUNCPTRS) {
330 struct fdpic_func_descriptor __user *funcptr = 315 struct fdpic_func_descriptor __user *funcptr =
331 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 316 (struct fdpic_func_descriptor __user *) ksig->ka.sa.sa_handler;
332 struct fdpic_func_descriptor desc; 317 struct fdpic_func_descriptor desc;
333 if (copy_from_user(&desc, funcptr, sizeof(desc))) 318 if (copy_from_user(&desc, funcptr, sizeof(desc)))
334 goto give_sigsegv; 319 return -EFAULT;
335 __frame->pc = desc.text; 320 __frame->pc = desc.text;
336 __frame->gr15 = desc.GOT; 321 __frame->gr15 = desc.GOT;
337 } else { 322 } else {
338 __frame->pc = (unsigned long) ka->sa.sa_handler; 323 __frame->pc = (unsigned long) ksig->ka.sa.sa_handler;
339 __frame->gr15 = 0; 324 __frame->gr15 = 0;
340 } 325 }
341 326
@@ -349,21 +334,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
349 sig, current->comm, current->pid, frame, __frame->pc, 334 sig, current->comm, current->pid, frame, __frame->pc,
350 frame->pretcode); 335 frame->pretcode);
351#endif 336#endif
352
353 return 0; 337 return 0;
354 338
355give_sigsegv:
356 force_sigsegv(sig, current);
357 return -EFAULT;
358
359} /* end setup_rt_frame() */ 339} /* end setup_rt_frame() */
360 340
361/*****************************************************************************/ 341/*****************************************************************************/
362/* 342/*
363 * OK, we're invoking a handler 343 * OK, we're invoking a handler
364 */ 344 */
365static void handle_signal(unsigned long sig, siginfo_t *info, 345static void handle_signal(struct ksignal *ksig)
366 struct k_sigaction *ka)
367{ 346{
368 sigset_t *oldset = sigmask_to_save(); 347 sigset_t *oldset = sigmask_to_save();
369 int ret; 348 int ret;
@@ -378,7 +357,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
378 break; 357 break;
379 358
380 case -ERESTARTSYS: 359 case -ERESTARTSYS:
381 if (!(ka->sa.sa_flags & SA_RESTART)) { 360 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
382 __frame->gr8 = -EINTR; 361 __frame->gr8 = -EINTR;
383 break; 362 break;
384 } 363 }
@@ -392,16 +371,12 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
392 } 371 }
393 372
394 /* Set up the stack frame */ 373 /* Set up the stack frame */
395 if (ka->sa.sa_flags & SA_SIGINFO) 374 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
396 ret = setup_rt_frame(sig, ka, info, oldset); 375 ret = setup_rt_frame(ksig, oldset);
397 else 376 else
398 ret = setup_frame(sig, ka, oldset); 377 ret = setup_frame(ksig, oldset);
399
400 if (ret)
401 return;
402 378
403 signal_delivered(sig, info, ka, __frame, 379 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
404 test_thread_flag(TIF_SINGLESTEP));
405} /* end handle_signal() */ 380} /* end handle_signal() */
406 381
407/*****************************************************************************/ 382/*****************************************************************************/
@@ -412,13 +387,10 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
412 */ 387 */
413static void do_signal(void) 388static void do_signal(void)
414{ 389{
415 struct k_sigaction ka; 390 struct ksignal ksig;
416 siginfo_t info;
417 int signr;
418 391
419 signr = get_signal_to_deliver(&info, &ka, __frame, NULL); 392 if (get_signal(&ksig)) {
420 if (signr > 0) { 393 handle_signal(&ksig);
421 handle_signal(signr, &info, &ka);
422 return; 394 return;
423 } 395 }
424 396
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 0fd6138f6203..4dc89d1f9c48 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -23,7 +23,6 @@ config HEXAGON
23 select GENERIC_IOMAP 23 select GENERIC_IOMAP
24 select GENERIC_SMP_IDLE_THREAD 24 select GENERIC_SMP_IDLE_THREAD
25 select STACKTRACE_SUPPORT 25 select STACKTRACE_SUPPORT
26 select KTIME_SCALAR
27 select GENERIC_CLOCKEVENTS 26 select GENERIC_CLOCKEVENTS
28 select GENERIC_CLOCKEVENTS_BROADCAST 27 select GENERIC_CLOCKEVENTS_BROADCAST
29 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
diff --git a/arch/hexagon/include/asm/cache.h b/arch/hexagon/include/asm/cache.h
index f4ca594fdf8c..263511719a4a 100644
--- a/arch/hexagon/include/asm/cache.h
+++ b/arch/hexagon/include/asm/cache.h
@@ -28,7 +28,7 @@
28#define __cacheline_aligned __aligned(L1_CACHE_BYTES) 28#define __cacheline_aligned __aligned(L1_CACHE_BYTES)
29#define ____cacheline_aligned __aligned(L1_CACHE_BYTES) 29#define ____cacheline_aligned __aligned(L1_CACHE_BYTES)
30 30
31/* See http://kerneltrap.org/node/15100 */ 31/* See http://lwn.net/Articles/262554/ */
32#define __read_mostly 32#define __read_mostly
33 33
34#endif 34#endif
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index d7c73874b515..eadd70e47e7e 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -36,18 +36,10 @@ struct rt_sigframe {
36 struct ucontext uc; 36 struct ucontext uc;
37}; 37};
38 38
39static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 39static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
40 size_t frame_size) 40 size_t frame_size)
41{ 41{
42 unsigned long sp = regs->r29; 42 unsigned long sp = sigsp(regs->r29, ksig);
43
44 /* check if we would overflow the alt stack */
45 if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size)))
46 return (void __user __force *)-1UL;
47
48 /* Switch to signal stack if appropriate */
49 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
50 sp = current->sas_ss_sp + current->sas_ss_size;
51 43
52 return (void __user *)((sp - frame_size) & ~(sizeof(long long) - 1)); 44 return (void __user *)((sp - frame_size) & ~(sizeof(long long) - 1));
53} 45}
@@ -112,20 +104,20 @@ static int restore_sigcontext(struct pt_regs *regs,
112/* 104/*
113 * Setup signal stack frame with siginfo structure 105 * Setup signal stack frame with siginfo structure
114 */ 106 */
115static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info, 107static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
116 sigset_t *set, struct pt_regs *regs) 108 struct pt_regs *regs)
117{ 109{
118 int err = 0; 110 int err = 0;
119 struct rt_sigframe __user *frame; 111 struct rt_sigframe __user *frame;
120 struct hexagon_vdso *vdso = current->mm->context.vdso; 112 struct hexagon_vdso *vdso = current->mm->context.vdso;
121 113
122 frame = get_sigframe(ka, regs, sizeof(struct rt_sigframe)); 114 frame = get_sigframe(ksig, regs, sizeof(struct rt_sigframe));
123 115
124 if (!access_ok(VERIFY_WRITE, frame, sizeof(struct rt_sigframe))) 116 if (!access_ok(VERIFY_WRITE, frame, sizeof(struct rt_sigframe)))
125 goto sigsegv; 117 return -EFAULT;
126 118
127 if (copy_siginfo_to_user(&frame->info, info)) 119 if (copy_siginfo_to_user(&frame->info, &ksig->info))
128 goto sigsegv; 120 return -EFAULT;
129 121
130 /* The on-stack signal trampoline is no longer executed; 122 /* The on-stack signal trampoline is no longer executed;
131 * however, the libgcc signal frame unwinding code checks for 123 * however, the libgcc signal frame unwinding code checks for
@@ -137,29 +129,26 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
137 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 129 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
138 err |= __save_altstack(&frame->uc.uc_stack, user_stack_pointer(regs)); 130 err |= __save_altstack(&frame->uc.uc_stack, user_stack_pointer(regs));
139 if (err) 131 if (err)
140 goto sigsegv; 132 return -EFAULT;
141 133
142 /* Load r0/r1 pair with signumber/siginfo pointer... */ 134 /* Load r0/r1 pair with signumber/siginfo pointer... */
143 regs->r0100 = ((unsigned long long)((unsigned long)&frame->info) << 32) 135 regs->r0100 = ((unsigned long long)((unsigned long)&frame->info) << 32)
144 | (unsigned long long)signr; 136 | (unsigned long long)ksig->sig;
145 regs->r02 = (unsigned long) &frame->uc; 137 regs->r02 = (unsigned long) &frame->uc;
146 regs->r31 = (unsigned long) vdso->rt_signal_trampoline; 138 regs->r31 = (unsigned long) vdso->rt_signal_trampoline;
147 pt_psp(regs) = (unsigned long) frame; 139 pt_psp(regs) = (unsigned long) frame;
148 pt_set_elr(regs, (unsigned long)ka->sa.sa_handler); 140 pt_set_elr(regs, (unsigned long)ksig->ka.sa.sa_handler);
149 141
150 return 0; 142 return 0;
151
152sigsegv:
153 force_sigsegv(signr, current);
154 return -EFAULT;
155} 143}
156 144
157/* 145/*
158 * Setup invocation of signal handler 146 * Setup invocation of signal handler
159 */ 147 */
160static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, 148static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
161 struct pt_regs *regs)
162{ 149{
150 int ret;
151
163 /* 152 /*
164 * If we're handling a signal that aborted a system call, 153 * If we're handling a signal that aborted a system call,
165 * set up the error return value before adding the signal 154 * set up the error return value before adding the signal
@@ -173,7 +162,7 @@ static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
173 regs->r00 = -EINTR; 162 regs->r00 = -EINTR;
174 break; 163 break;
175 case -ERESTARTSYS: 164 case -ERESTARTSYS:
176 if (!(ka->sa.sa_flags & SA_RESTART)) { 165 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
177 regs->r00 = -EINTR; 166 regs->r00 = -EINTR;
178 break; 167 break;
179 } 168 }
@@ -193,11 +182,9 @@ static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
193 * only set up the rt_frame flavor. 182 * only set up the rt_frame flavor.
194 */ 183 */
195 /* If there was an error on setup, no signal was delivered. */ 184 /* If there was an error on setup, no signal was delivered. */
196 if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) 185 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
197 return;
198 186
199 signal_delivered(sig, info, ka, regs, 187 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
200 test_thread_flag(TIF_SINGLESTEP));
201} 188}
202 189
203/* 190/*
@@ -205,17 +192,13 @@ static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
205 */ 192 */
206void do_signal(struct pt_regs *regs) 193void do_signal(struct pt_regs *regs)
207{ 194{
208 struct k_sigaction sigact; 195 struct ksignal ksig;
209 siginfo_t info;
210 int signo;
211 196
212 if (!user_mode(regs)) 197 if (!user_mode(regs))
213 return; 198 return;
214 199
215 signo = get_signal_to_deliver(&info, &sigact, regs, NULL); 200 if (get_signal(&ksig)) {
216 201 handle_signal(&ksig, regs);
217 if (signo > 0) {
218 handle_signal(signo, &info, &sigact, regs);
219 return; 202 return;
220 } 203 }
221 204
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2f3abcf8f6bc..64aefb76bd69 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -10,6 +10,7 @@ config IA64
10 select ARCH_MIGHT_HAVE_PC_SERIO 10 select ARCH_MIGHT_HAVE_PC_SERIO
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 PM if (!IA64_HP_SIM) 14 select PM if (!IA64_HP_SIM)
14 select HAVE_UNSTABLE_SCHED_CLOCK 15 select HAVE_UNSTABLE_SCHED_CLOCK
15 select HAVE_IDE 16 select HAVE_IDE
@@ -27,6 +28,7 @@ config IA64
27 select HAVE_MEMBLOCK 28 select HAVE_MEMBLOCK
28 select HAVE_MEMBLOCK_NODE_MAP 29 select HAVE_MEMBLOCK_NODE_MAP
29 select HAVE_VIRT_CPU_ACCOUNTING 30 select HAVE_VIRT_CPU_ACCOUNTING
31 select ARCH_HAS_SG_CHAIN
30 select VIRT_TO_BUS 32 select VIRT_TO_BUS
31 select ARCH_DISCARD_MEMBLOCK 33 select ARCH_DISCARD_MEMBLOCK
32 select GENERIC_IRQ_PROBE 34 select GENERIC_IRQ_PROBE
@@ -547,6 +549,8 @@ source "drivers/sn/Kconfig"
547config KEXEC 549config KEXEC
548 bool "kexec system call" 550 bool "kexec system call"
549 depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) 551 depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU)
552 select CRYPTO
553 select CRYPTO_SHA256
550 help 554 help
551 kexec is a system call that implements the ability to shutdown your 555 kexec is a system call that implements the ability to shutdown your
552 current kernel, and to start another kernel. It is like a reboot 556 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index f37238f45bcd..5441b14994fc 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -76,7 +76,7 @@ vmlinux.gz: vmlinux
76 $(Q)$(MAKE) $(build)=$(boot) $@ 76 $(Q)$(MAKE) $(build)=$(boot) $@
77 77
78unwcheck: vmlinux 78unwcheck: vmlinux
79 -$(Q)READELF=$(READELF) python $(srctree)/arch/ia64/scripts/unwcheck.py $< 79 -$(Q)READELF=$(READELF) $(PYTHON) $(srctree)/arch/ia64/scripts/unwcheck.py $<
80 80
81archclean: 81archclean:
82 $(Q)$(MAKE) $(clean)=$(boot) 82 $(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 0da4aa2602ae..e8317d2d6c8d 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -5,5 +5,6 @@ generic-y += hash.h
5generic-y += kvm_para.h 5generic-y += kvm_para.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += preempt.h 7generic-y += preempt.h
8generic-y += scatterlist.h
8generic-y += trace_clock.h 9generic-y += trace_clock.h
9generic-y += vtime.h 10generic-y += vtime.h
diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index 3f9eaeec9873..35ff13afbf34 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -19,8 +19,6 @@
19 19
20/* Asm macros */ 20/* Asm macros */
21 21
22#ifdef CONFIG_ACPI
23
24static inline int 22static inline int
25ia64_acpi_acquire_global_lock(unsigned int *lock) 23ia64_acpi_acquire_global_lock(unsigned int *lock)
26{ 24{
@@ -51,6 +49,4 @@ ia64_acpi_release_global_lock(unsigned int *lock)
51#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ 49#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
52 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock)) 50 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
53 51
54#endif
55
56#endif /* _ASM_IA64_ACENV_H */ 52#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 75dc59a793d6..a1d91ab4c5ef 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -40,6 +40,11 @@ extern int acpi_lapic;
40#define acpi_noirq 0 /* ACPI always enabled on IA64 */ 40#define acpi_noirq 0 /* ACPI always enabled on IA64 */
41#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */ 41#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
42#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */ 42#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */
43
44static inline bool acpi_has_cpu_in_madt(void)
45{
46 return !!acpi_lapic;
47}
43#endif 48#endif
44#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */ 49#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
45static inline void disable_acpi(void) { } 50static inline void disable_acpi(void) { }
diff --git a/arch/ia64/include/asm/page.h b/arch/ia64/include/asm/page.h
index f1e1b2e3cdb3..1f1bf144fe62 100644
--- a/arch/ia64/include/asm/page.h
+++ b/arch/ia64/include/asm/page.h
@@ -231,4 +231,6 @@ get_order (unsigned long size)
231#define PERCPU_ADDR (-PERCPU_PAGE_SIZE) 231#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
232#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE) 232#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE)
233 233
234#define __HAVE_ARCH_GATE_AREA 1
235
234#endif /* _ASM_IA64_PAGE_H */ 236#endif /* _ASM_IA64_PAGE_H */
diff --git a/arch/ia64/include/asm/scatterlist.h b/arch/ia64/include/asm/scatterlist.h
deleted file mode 100644
index 08fd93bff1db..000000000000
--- a/arch/ia64/include/asm/scatterlist.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_IA64_SCATTERLIST_H
2#define _ASM_IA64_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5#define ARCH_HAS_SG_CHAIN
6
7#endif /* _ASM_IA64_SCATTERLIST_H */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index fb13dc5e8f8c..4254f5d3218c 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 315 /* length of syscall table */ 14#define NR_syscalls 316 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 7de0a2d65da4..99801c3be914 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -328,5 +328,6 @@
328#define __NR_sched_setattr 1336 328#define __NR_sched_setattr 1336
329#define __NR_sched_getattr 1337 329#define __NR_sched_getattr 1337
330#define __NR_renameat2 1338 330#define __NR_renameat2 1338
331#define __NR_getrandom 1339
331 332
332#endif /* _UAPI_ASM_IA64_UNISTD_H */ 333#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index ba3d03503e84..4c13837a9269 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1776,6 +1776,7 @@ sys_call_table:
1776 data8 sys_sched_setattr 1776 data8 sys_sched_setattr
1777 data8 sys_sched_getattr 1777 data8 sys_sched_getattr
1778 data8 sys_renameat2 1778 data8 sys_renameat2
1779 data8 sys_getrandom
1779 1780
1780 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1781 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1781#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1782#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 33cab9a8adff..6d92170be457 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -309,12 +309,11 @@ force_sigsegv_info (int sig, void __user *addr)
309 si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); 309 si.si_uid = from_kuid_munged(current_user_ns(), current_uid());
310 si.si_addr = addr; 310 si.si_addr = addr;
311 force_sig_info(SIGSEGV, &si, current); 311 force_sig_info(SIGSEGV, &si, current);
312 return 0; 312 return 1;
313} 313}
314 314
315static long 315static long
316setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, 316setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
317 struct sigscratch *scr)
318{ 317{
319 extern char __kernel_sigtramp[]; 318 extern char __kernel_sigtramp[];
320 unsigned long tramp_addr, new_rbs = 0, new_sp; 319 unsigned long tramp_addr, new_rbs = 0, new_sp;
@@ -323,7 +322,7 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
323 322
324 new_sp = scr->pt.r12; 323 new_sp = scr->pt.r12;
325 tramp_addr = (unsigned long) __kernel_sigtramp; 324 tramp_addr = (unsigned long) __kernel_sigtramp;
326 if (ka->sa.sa_flags & SA_ONSTACK) { 325 if (ksig->ka.sa.sa_flags & SA_ONSTACK) {
327 int onstack = sas_ss_flags(new_sp); 326 int onstack = sas_ss_flags(new_sp);
328 327
329 if (onstack == 0) { 328 if (onstack == 0) {
@@ -347,29 +346,29 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
347 */ 346 */
348 check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN; 347 check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN;
349 if (!likely(on_sig_stack(check_sp))) 348 if (!likely(on_sig_stack(check_sp)))
350 return force_sigsegv_info(sig, (void __user *) 349 return force_sigsegv_info(ksig->sig, (void __user *)
351 check_sp); 350 check_sp);
352 } 351 }
353 } 352 }
354 frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN); 353 frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN);
355 354
356 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 355 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
357 return force_sigsegv_info(sig, frame); 356 return force_sigsegv_info(ksig->sig, frame);
358 357
359 err = __put_user(sig, &frame->arg0); 358 err = __put_user(ksig->sig, &frame->arg0);
360 err |= __put_user(&frame->info, &frame->arg1); 359 err |= __put_user(&frame->info, &frame->arg1);
361 err |= __put_user(&frame->sc, &frame->arg2); 360 err |= __put_user(&frame->sc, &frame->arg2);
362 err |= __put_user(new_rbs, &frame->sc.sc_rbs_base); 361 err |= __put_user(new_rbs, &frame->sc.sc_rbs_base);
363 err |= __put_user(0, &frame->sc.sc_loadrs); /* initialize to zero */ 362 err |= __put_user(0, &frame->sc.sc_loadrs); /* initialize to zero */
364 err |= __put_user(ka->sa.sa_handler, &frame->handler); 363 err |= __put_user(ksig->ka.sa.sa_handler, &frame->handler);
365 364
366 err |= copy_siginfo_to_user(&frame->info, info); 365 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
367 366
368 err |= __save_altstack(&frame->sc.sc_stack, scr->pt.r12); 367 err |= __save_altstack(&frame->sc.sc_stack, scr->pt.r12);
369 err |= setup_sigcontext(&frame->sc, set, scr); 368 err |= setup_sigcontext(&frame->sc, set, scr);
370 369
371 if (unlikely(err)) 370 if (unlikely(err))
372 return force_sigsegv_info(sig, frame); 371 return force_sigsegv_info(ksig->sig, frame);
373 372
374 scr->pt.r12 = (unsigned long) frame - 16; /* new stack pointer */ 373 scr->pt.r12 = (unsigned long) frame - 16; /* new stack pointer */
375 scr->pt.ar_fpsr = FPSR_DEFAULT; /* reset fpsr for signal handler */ 374 scr->pt.ar_fpsr = FPSR_DEFAULT; /* reset fpsr for signal handler */
@@ -394,22 +393,20 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
394 393
395#if DEBUG_SIG 394#if DEBUG_SIG
396 printk("SIG deliver (%s:%d): sig=%d sp=%lx ip=%lx handler=%p\n", 395 printk("SIG deliver (%s:%d): sig=%d sp=%lx ip=%lx handler=%p\n",
397 current->comm, current->pid, sig, scr->pt.r12, frame->sc.sc_ip, frame->handler); 396 current->comm, current->pid, ksig->sig, scr->pt.r12, frame->sc.sc_ip, frame->handler);
398#endif 397#endif
399 return 1; 398 return 0;
400} 399}
401 400
402static long 401static long
403handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 402handle_signal (struct ksignal *ksig, struct sigscratch *scr)
404 struct sigscratch *scr)
405{ 403{
406 if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) 404 int ret = setup_frame(ksig, sigmask_to_save(), scr);
407 return 0;
408 405
409 signal_delivered(sig, info, ka, &scr->pt, 406 if (!ret)
410 test_thread_flag(TIF_SINGLESTEP)); 407 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
411 408
412 return 1; 409 return ret;
413} 410}
414 411
415/* 412/*
@@ -419,17 +416,16 @@ handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
419void 416void
420ia64_do_signal (struct sigscratch *scr, long in_syscall) 417ia64_do_signal (struct sigscratch *scr, long in_syscall)
421{ 418{
422 struct k_sigaction ka;
423 siginfo_t info;
424 long restart = in_syscall; 419 long restart = in_syscall;
425 long errno = scr->pt.r8; 420 long errno = scr->pt.r8;
421 struct ksignal ksig;
426 422
427 /* 423 /*
428 * This only loops in the rare cases of handle_signal() failing, in which case we 424 * This only loops in the rare cases of handle_signal() failing, in which case we
429 * need to push through a forced SIGSEGV. 425 * need to push through a forced SIGSEGV.
430 */ 426 */
431 while (1) { 427 while (1) {
432 int signr = get_signal_to_deliver(&info, &ka, &scr->pt, NULL); 428 get_signal(&ksig);
433 429
434 /* 430 /*
435 * get_signal_to_deliver() may have run a debugger (via notify_parent()) 431 * get_signal_to_deliver() may have run a debugger (via notify_parent())
@@ -446,7 +442,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
446 */ 442 */
447 restart = 0; 443 restart = 0;
448 444
449 if (signr <= 0) 445 if (ksig.sig <= 0)
450 break; 446 break;
451 447
452 if (unlikely(restart)) { 448 if (unlikely(restart)) {
@@ -458,7 +454,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
458 break; 454 break;
459 455
460 case ERESTARTSYS: 456 case ERESTARTSYS:
461 if ((ka.sa.sa_flags & SA_RESTART) == 0) { 457 if ((ksig.ka.sa.sa_flags & SA_RESTART) == 0) {
462 scr->pt.r8 = EINTR; 458 scr->pt.r8 = EINTR;
463 /* note: scr->pt.r10 is already -1 */ 459 /* note: scr->pt.r10 is already -1 */
464 break; 460 break;
@@ -473,7 +469,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
473 * Whee! Actually deliver the signal. If the delivery failed, we need to 469 * Whee! Actually deliver the signal. If the delivery failed, we need to
474 * continue to iterate in this loop so we can deliver the SIGSEGV... 470 * continue to iterate in this loop so we can deliver the SIGSEGV...
475 */ 471 */
476 if (handle_signal(signr, &ka, &info, scr)) 472 if (handle_signal(&ksig, scr))
477 return; 473 return;
478 } 474 }
479 475
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 71c52bc7c28d..9a0104a38cd3 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -384,21 +384,6 @@ static struct irqaction timer_irqaction = {
384 .name = "timer" 384 .name = "timer"
385}; 385};
386 386
387static struct platform_device rtc_efi_dev = {
388 .name = "rtc-efi",
389 .id = -1,
390};
391
392static int __init rtc_init(void)
393{
394 if (platform_device_register(&rtc_efi_dev) < 0)
395 printk(KERN_ERR "unable to register rtc device...\n");
396
397 /* not necessarily an error */
398 return 0;
399}
400module_init(rtc_init);
401
402void read_persistent_clock(struct timespec *ts) 387void read_persistent_clock(struct timespec *ts)
403{ 388{
404 efi_gettimeofday(ts); 389 efi_gettimeofday(ts);
@@ -441,7 +426,7 @@ void update_vsyscall_tz(void)
441} 426}
442 427
443void update_vsyscall_old(struct timespec *wall, struct timespec *wtm, 428void update_vsyscall_old(struct timespec *wall, struct timespec *wtm,
444 struct clocksource *c, u32 mult) 429 struct clocksource *c, u32 mult, cycle_t cycle_last)
445{ 430{
446 write_seqcount_begin(&fsyscall_gtod_data.seq); 431 write_seqcount_begin(&fsyscall_gtod_data.seq);
447 432
@@ -450,7 +435,7 @@ void update_vsyscall_old(struct timespec *wall, struct timespec *wtm,
450 fsyscall_gtod_data.clk_mult = mult; 435 fsyscall_gtod_data.clk_mult = mult;
451 fsyscall_gtod_data.clk_shift = c->shift; 436 fsyscall_gtod_data.clk_shift = c->shift;
452 fsyscall_gtod_data.clk_fsys_mmio = c->archdata.fsys_mmio; 437 fsyscall_gtod_data.clk_fsys_mmio = c->archdata.fsys_mmio;
453 fsyscall_gtod_data.clk_cycle_last = c->cycle_last; 438 fsyscall_gtod_data.clk_cycle_last = cycle_last;
454 439
455 /* copy kernel time structures */ 440 /* copy kernel time structures */
456 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec; 441 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec;
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index 990b86420cc6..3d50ea955c4c 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -25,6 +25,7 @@ config KVM
25 select PREEMPT_NOTIFIERS 25 select PREEMPT_NOTIFIERS
26 select ANON_INODES 26 select ANON_INODES
27 select HAVE_KVM_IRQCHIP 27 select HAVE_KVM_IRQCHIP
28 select HAVE_KVM_IRQFD
28 select HAVE_KVM_IRQ_ROUTING 29 select HAVE_KVM_IRQ_ROUTING
29 select KVM_APIC_ARCHITECTURE 30 select KVM_APIC_ARCHITECTURE
30 select KVM_MMIO 31 select KVM_MMIO
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 6a4309bb821a..0729ba6acddf 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -190,7 +190,7 @@ void kvm_arch_check_processor_compat(void *rtn)
190 *(int *)rtn = 0; 190 *(int *)rtn = 0;
191} 191}
192 192
193int kvm_dev_ioctl_check_extension(long ext) 193int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
194{ 194{
195 195
196 int r; 196 int r;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 25c350264a41..6b3345758d3e 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -278,6 +278,37 @@ setup_gate (void)
278 ia64_patch_gate(); 278 ia64_patch_gate();
279} 279}
280 280
281static struct vm_area_struct gate_vma;
282
283static int __init gate_vma_init(void)
284{
285 gate_vma.vm_mm = NULL;
286 gate_vma.vm_start = FIXADDR_USER_START;
287 gate_vma.vm_end = FIXADDR_USER_END;
288 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
289 gate_vma.vm_page_prot = __P101;
290
291 return 0;
292}
293__initcall(gate_vma_init);
294
295struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
296{
297 return &gate_vma;
298}
299
300int in_gate_area_no_mm(unsigned long addr)
301{
302 if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
303 return 1;
304 return 0;
305}
306
307int in_gate_area(struct mm_struct *mm, unsigned long addr)
308{
309 return in_gate_area_no_mm(addr);
310}
311
281void ia64_mmu_init(void *my_cpu_data) 312void ia64_mmu_init(void *my_cpu_data)
282{ 313{
283 unsigned long pta, impl_va_bits; 314 unsigned long pta, impl_va_bits;
@@ -631,7 +662,8 @@ int arch_add_memory(int nid, u64 start, u64 size)
631 662
632 pgdat = NODE_DATA(nid); 663 pgdat = NODE_DATA(nid);
633 664
634 zone = pgdat->node_zones + ZONE_NORMAL; 665 zone = pgdat->node_zones +
666 zone_for_memory(nid, start, size, ZONE_NORMAL);
635 ret = __add_pages(nid, zone, start_pfn, nr_pages); 667 ret = __add_pages(nid, zone, start_pfn, nr_pages);
636 668
637 if (ret) 669 if (ret)
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index 67779a74b62d..accc10a3dc78 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -6,4 +6,5 @@ generic-y += hash.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += module.h 7generic-y += module.h
8generic-y += preempt.h 8generic-y += preempt.h
9generic-y += scatterlist.h
9generic-y += trace_clock.h 10generic-y += trace_clock.h
diff --git a/arch/m32r/include/asm/scatterlist.h b/arch/m32r/include/asm/scatterlist.h
deleted file mode 100644
index 7370b8b6243e..000000000000
--- a/arch/m32r/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_SCATTERLIST_H
2#define _ASM_M32R_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* _ASM_M32R_SCATTERLIST_H */
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index d503568cb753..95408b8f130a 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -162,28 +162,22 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
162 * Determine which stack to use.. 162 * Determine which stack to use..
163 */ 163 */
164static inline void __user * 164static inline void __user *
165get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) 165get_sigframe(struct ksignal *ksig, unsigned long sp, size_t frame_size)
166{ 166{
167 /* This is the X/Open sanctioned signal stack switching. */ 167 return (void __user *)((sigsp(sp, ksig) - frame_size) & -8ul);
168 if (ka->sa.sa_flags & SA_ONSTACK) {
169 if (sas_ss_flags(sp) == 0)
170 sp = current->sas_ss_sp + current->sas_ss_size;
171 }
172
173 return (void __user *)((sp - frame_size) & -8ul);
174} 168}
175 169
176static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 170static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
177 sigset_t *set, struct pt_regs *regs) 171 struct pt_regs *regs)
178{ 172{
179 struct rt_sigframe __user *frame; 173 struct rt_sigframe __user *frame;
180 int err = 0; 174 int err = 0;
181 int signal; 175 int signal, sig = ksig->sig;
182 176
183 frame = get_sigframe(ka, regs->spu, sizeof(*frame)); 177 frame = get_sigframe(ksig, regs->spu, sizeof(*frame));
184 178
185 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 179 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
186 goto give_sigsegv; 180 return -EFAULT;
187 181
188 signal = current_thread_info()->exec_domain 182 signal = current_thread_info()->exec_domain
189 && current_thread_info()->exec_domain->signal_invmap 183 && current_thread_info()->exec_domain->signal_invmap
@@ -193,13 +187,13 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
193 187
194 err |= __put_user(signal, &frame->sig); 188 err |= __put_user(signal, &frame->sig);
195 if (err) 189 if (err)
196 goto give_sigsegv; 190 return -EFAULT;
197 191
198 err |= __put_user(&frame->info, &frame->pinfo); 192 err |= __put_user(&frame->info, &frame->pinfo);
199 err |= __put_user(&frame->uc, &frame->puc); 193 err |= __put_user(&frame->uc, &frame->puc);
200 err |= copy_siginfo_to_user(&frame->info, info); 194 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
201 if (err) 195 if (err)
202 goto give_sigsegv; 196 return -EFAULT;
203 197
204 /* Create the ucontext. */ 198 /* Create the ucontext. */
205 err |= __put_user(0, &frame->uc.uc_flags); 199 err |= __put_user(0, &frame->uc.uc_flags);
@@ -208,17 +202,17 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
208 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 202 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
209 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 203 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
210 if (err) 204 if (err)
211 goto give_sigsegv; 205 return -EFAULT;
212 206
213 /* Set up to return from userspace. */ 207 /* Set up to return from userspace. */
214 regs->lr = (unsigned long)ka->sa.sa_restorer; 208 regs->lr = (unsigned long)ksig->ka.sa.sa_restorer;
215 209
216 /* Set up registers for signal handler */ 210 /* Set up registers for signal handler */
217 regs->spu = (unsigned long)frame; 211 regs->spu = (unsigned long)frame;
218 regs->r0 = signal; /* Arg for signal handler */ 212 regs->r0 = signal; /* Arg for signal handler */
219 regs->r1 = (unsigned long)&frame->info; 213 regs->r1 = (unsigned long)&frame->info;
220 regs->r2 = (unsigned long)&frame->uc; 214 regs->r2 = (unsigned long)&frame->uc;
221 regs->bpc = (unsigned long)ka->sa.sa_handler; 215 regs->bpc = (unsigned long)ksig->ka.sa.sa_handler;
222 216
223 set_fs(USER_DS); 217 set_fs(USER_DS);
224 218
@@ -228,10 +222,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
228#endif 222#endif
229 223
230 return 0; 224 return 0;
231
232give_sigsegv:
233 force_sigsegv(sig, current);
234 return -EFAULT;
235} 225}
236 226
237static int prev_insn(struct pt_regs *regs) 227static int prev_insn(struct pt_regs *regs)
@@ -252,9 +242,10 @@ static int prev_insn(struct pt_regs *regs)
252 */ 242 */
253 243
254static void 244static void
255handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 245handle_signal(struct ksignal *ksig, struct pt_regs *regs)
256 struct pt_regs *regs)
257{ 246{
247 int ret;
248
258 /* Are we from a system call? */ 249 /* Are we from a system call? */
259 if (regs->syscall_nr >= 0) { 250 if (regs->syscall_nr >= 0) {
260 /* If so, check system call restarting.. */ 251 /* If so, check system call restarting.. */
@@ -265,7 +256,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
265 break; 256 break;
266 257
267 case -ERESTARTSYS: 258 case -ERESTARTSYS:
268 if (!(ka->sa.sa_flags & SA_RESTART)) { 259 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
269 regs->r0 = -EINTR; 260 regs->r0 = -EINTR;
270 break; 261 break;
271 } 262 }
@@ -278,10 +269,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
278 } 269 }
279 270
280 /* Set up the stack frame */ 271 /* Set up the stack frame */
281 if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) 272 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
282 return;
283 273
284 signal_delivered(sig, info, ka, regs, 0); 274 signal_setup_done(ret, ksig, 0);
285} 275}
286 276
287/* 277/*
@@ -291,9 +281,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
291 */ 281 */
292static void do_signal(struct pt_regs *regs) 282static void do_signal(struct pt_regs *regs)
293{ 283{
294 siginfo_t info; 284 struct ksignal ksig;
295 int signr;
296 struct k_sigaction ka;
297 285
298 /* 286 /*
299 * We want the common case to go fast, which 287 * We want the common case to go fast, which
@@ -304,8 +292,7 @@ static void do_signal(struct pt_regs *regs)
304 if (!user_mode(regs)) 292 if (!user_mode(regs))
305 return; 293 return;
306 294
307 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 295 if (get_signal(&ksig)) {
308 if (signr > 0) {
309 /* Re-enable any watchpoints before delivering the 296 /* Re-enable any watchpoints before delivering the
310 * signal to user space. The processor register will 297 * signal to user space. The processor register will
311 * have been cleared if the watchpoint triggered 298 * have been cleared if the watchpoint triggered
@@ -313,7 +300,7 @@ static void do_signal(struct pt_regs *regs)
313 */ 300 */
314 301
315 /* Whee! Actually deliver the signal. */ 302 /* Whee! Actually deliver the signal. */
316 handle_signal(signr, &ka, &info, regs); 303 handle_signal(&ksig, regs);
317 304
318 return; 305 return;
319 } 306 }
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 87b7c7581b1d..3ff8c9a25335 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -91,6 +91,8 @@ config MMU_SUN3
91config KEXEC 91config KEXEC
92 bool "kexec system call" 92 bool "kexec system call"
93 depends on M68KCLASSIC 93 depends on M68KCLASSIC
94 select CRYPTO
95 select CRYPTO_SHA256
94 help 96 help
95 kexec is a system call that implements the ability to shutdown your 97 kexec is a system call that implements the ability to shutdown your
96 current kernel, and to start another kernel. It is like a reboot 98 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index d7eac833a94f..399df883c8bb 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_defconfig
@@ -257,7 +257,6 @@ CONFIG_BLK_DEV_GAYLE=y
257CONFIG_BLK_DEV_BUDDHA=y 257CONFIG_BLK_DEV_BUDDHA=y
258CONFIG_RAID_ATTRS=m 258CONFIG_RAID_ATTRS=m
259CONFIG_SCSI=y 259CONFIG_SCSI=y
260CONFIG_SCSI_TGT=m
261CONFIG_BLK_DEV_SD=y 260CONFIG_BLK_DEV_SD=y
262CONFIG_CHR_DEV_ST=m 261CONFIG_CHR_DEV_ST=m
263CONFIG_CHR_DEV_OSST=m 262CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index 650ee75de6cd..be16740c0749 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_defconfig
@@ -244,7 +244,6 @@ CONFIG_ATA_OVER_ETH=m
244CONFIG_DUMMY_IRQ=m 244CONFIG_DUMMY_IRQ=m
245CONFIG_RAID_ATTRS=m 245CONFIG_RAID_ATTRS=m
246CONFIG_SCSI=y 246CONFIG_SCSI=y
247CONFIG_SCSI_TGT=m
248CONFIG_BLK_DEV_SD=y 247CONFIG_BLK_DEV_SD=y
249CONFIG_CHR_DEV_ST=m 248CONFIG_CHR_DEV_ST=m
250CONFIG_CHR_DEV_OSST=m 249CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index 3142e69342fa..391e185d73be 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -251,7 +251,6 @@ CONFIG_BLK_DEV_IDECD=y
251CONFIG_BLK_DEV_FALCON_IDE=y 251CONFIG_BLK_DEV_FALCON_IDE=y
252CONFIG_RAID_ATTRS=m 252CONFIG_RAID_ATTRS=m
253CONFIG_SCSI=y 253CONFIG_SCSI=y
254CONFIG_SCSI_TGT=m
255CONFIG_BLK_DEV_SD=y 254CONFIG_BLK_DEV_SD=y
256CONFIG_CHR_DEV_ST=m 255CONFIG_CHR_DEV_ST=m
257CONFIG_CHR_DEV_OSST=m 256CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig
index 0daa8a172f30..d0e705d1a063 100644
--- a/arch/m68k/configs/bvme6000_defconfig
+++ b/arch/m68k/configs/bvme6000_defconfig
@@ -242,7 +242,6 @@ CONFIG_ATA_OVER_ETH=m
242CONFIG_DUMMY_IRQ=m 242CONFIG_DUMMY_IRQ=m
243CONFIG_RAID_ATTRS=m 243CONFIG_RAID_ATTRS=m
244CONFIG_SCSI=y 244CONFIG_SCSI=y
245CONFIG_SCSI_TGT=m
246CONFIG_BLK_DEV_SD=y 245CONFIG_BLK_DEV_SD=y
247CONFIG_CHR_DEV_ST=m 246CONFIG_CHR_DEV_ST=m
248CONFIG_CHR_DEV_OSST=m 247CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig
index 88af78f7bad9..fdc7e9672249 100644
--- a/arch/m68k/configs/hp300_defconfig
+++ b/arch/m68k/configs/hp300_defconfig
@@ -244,7 +244,6 @@ CONFIG_ATA_OVER_ETH=m
244CONFIG_DUMMY_IRQ=m 244CONFIG_DUMMY_IRQ=m
245CONFIG_RAID_ATTRS=m 245CONFIG_RAID_ATTRS=m
246CONFIG_SCSI=y 246CONFIG_SCSI=y
247CONFIG_SCSI_TGT=m
248CONFIG_BLK_DEV_SD=y 247CONFIG_BLK_DEV_SD=y
249CONFIG_CHR_DEV_ST=m 248CONFIG_CHR_DEV_ST=m
250CONFIG_CHR_DEV_OSST=m 249CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index 66f915574a85..3d345641d5a0 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_defconfig
@@ -251,7 +251,6 @@ CONFIG_BLK_DEV_IDECD=y
251CONFIG_BLK_DEV_MAC_IDE=y 251CONFIG_BLK_DEV_MAC_IDE=y
252CONFIG_RAID_ATTRS=m 252CONFIG_RAID_ATTRS=m
253CONFIG_SCSI=y 253CONFIG_SCSI=y
254CONFIG_SCSI_TGT=m
255CONFIG_BLK_DEV_SD=y 254CONFIG_BLK_DEV_SD=y
256CONFIG_CHR_DEV_ST=m 255CONFIG_CHR_DEV_ST=m
257CONFIG_CHR_DEV_OSST=m 256CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 5eaa49924fa6..59aa42096000 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -273,7 +273,6 @@ CONFIG_BLK_DEV_MAC_IDE=y
273CONFIG_BLK_DEV_Q40IDE=y 273CONFIG_BLK_DEV_Q40IDE=y
274CONFIG_RAID_ATTRS=m 274CONFIG_RAID_ATTRS=m
275CONFIG_SCSI=y 275CONFIG_SCSI=y
276CONFIG_SCSI_TGT=m
277CONFIG_BLK_DEV_SD=y 276CONFIG_BLK_DEV_SD=y
278CONFIG_CHR_DEV_ST=m 277CONFIG_CHR_DEV_ST=m
279CONFIG_CHR_DEV_OSST=m 278CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig
index 324d0b4d8351..066b24af095e 100644
--- a/arch/m68k/configs/mvme147_defconfig
+++ b/arch/m68k/configs/mvme147_defconfig
@@ -241,7 +241,6 @@ CONFIG_ATA_OVER_ETH=m
241CONFIG_DUMMY_IRQ=m 241CONFIG_DUMMY_IRQ=m
242CONFIG_RAID_ATTRS=m 242CONFIG_RAID_ATTRS=m
243CONFIG_SCSI=y 243CONFIG_SCSI=y
244CONFIG_SCSI_TGT=m
245CONFIG_BLK_DEV_SD=y 244CONFIG_BLK_DEV_SD=y
246CONFIG_CHR_DEV_ST=m 245CONFIG_CHR_DEV_ST=m
247CONFIG_CHR_DEV_OSST=m 246CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index f0cb4338952e..9326ea664a5b 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_defconfig
@@ -242,7 +242,6 @@ CONFIG_ATA_OVER_ETH=m
242CONFIG_DUMMY_IRQ=m 242CONFIG_DUMMY_IRQ=m
243CONFIG_RAID_ATTRS=m 243CONFIG_RAID_ATTRS=m
244CONFIG_SCSI=y 244CONFIG_SCSI=y
245CONFIG_SCSI_TGT=m
246CONFIG_BLK_DEV_SD=y 245CONFIG_BLK_DEV_SD=y
247CONFIG_CHR_DEV_ST=m 246CONFIG_CHR_DEV_ST=m
248CONFIG_CHR_DEV_OSST=m 247CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index d6cf0880c463..d7d1101e31b5 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -249,7 +249,6 @@ CONFIG_BLK_DEV_IDECD=y
249CONFIG_BLK_DEV_Q40IDE=y 249CONFIG_BLK_DEV_Q40IDE=y
250CONFIG_RAID_ATTRS=m 250CONFIG_RAID_ATTRS=m
251CONFIG_SCSI=y 251CONFIG_SCSI=y
252CONFIG_SCSI_TGT=m
253CONFIG_BLK_DEV_SD=y 252CONFIG_BLK_DEV_SD=y
254CONFIG_CHR_DEV_ST=m 253CONFIG_CHR_DEV_ST=m
255CONFIG_CHR_DEV_OSST=m 254CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig
index f4e88d1c7472..98522e8fb852 100644
--- a/arch/m68k/configs/sun3_defconfig
+++ b/arch/m68k/configs/sun3_defconfig
@@ -239,7 +239,6 @@ CONFIG_ATA_OVER_ETH=m
239CONFIG_DUMMY_IRQ=m 239CONFIG_DUMMY_IRQ=m
240CONFIG_RAID_ATTRS=m 240CONFIG_RAID_ATTRS=m
241CONFIG_SCSI=y 241CONFIG_SCSI=y
242CONFIG_SCSI_TGT=m
243CONFIG_BLK_DEV_SD=y 242CONFIG_BLK_DEV_SD=y
244CONFIG_CHR_DEV_ST=m 243CONFIG_CHR_DEV_ST=m
245CONFIG_CHR_DEV_OSST=m 244CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig
index 49f4032c1ad6..5128a8c3f4e3 100644
--- a/arch/m68k/configs/sun3x_defconfig
+++ b/arch/m68k/configs/sun3x_defconfig
@@ -239,7 +239,6 @@ CONFIG_ATA_OVER_ETH=m
239CONFIG_DUMMY_IRQ=m 239CONFIG_DUMMY_IRQ=m
240CONFIG_RAID_ATTRS=m 240CONFIG_RAID_ATTRS=m
241CONFIG_SCSI=y 241CONFIG_SCSI=y
242CONFIG_SCSI_TGT=m
243CONFIG_BLK_DEV_SD=y 242CONFIG_BLK_DEV_SD=y
244CONFIG_CHR_DEV_ST=m 243CONFIG_CHR_DEV_ST=m
245CONFIG_CHR_DEV_OSST=m 244CONFIG_CHR_DEV_OSST=m
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index c527fc2ecf82..11859b86b1f9 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -46,11 +46,6 @@ static inline int pte_file(pte_t pte) { return 0; }
46#define ZERO_PAGE(vaddr) (virt_to_page(0)) 46#define ZERO_PAGE(vaddr) (virt_to_page(0))
47 47
48/* 48/*
49 * These would be in other places but having them here reduces the diffs.
50 */
51extern unsigned int kobjsize(const void *objp);
52
53/*
54 * No page table caches to initialise. 49 * No page table caches to initialise.
55 */ 50 */
56#define pgtable_cache_init() do { } while (0) 51#define pgtable_cache_init() do { } while (0)
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index f35229b8651d..b8a82fb1cef8 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -26,16 +26,12 @@ static inline void *phys_to_virt(unsigned long address)
26} 26}
27 27
28/* Permanent address of a page. */ 28/* Permanent address of a page. */
29#ifdef CONFIG_MMU 29#if defined(CONFIG_MMU) && defined(CONFIG_SINGLE_MEMORY_CHUNK)
30#ifdef CONFIG_SINGLE_MEMORY_CHUNK
31#define page_to_phys(page) \ 30#define page_to_phys(page) \
32 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT)) 31 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
33#else 32#else
34#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 33#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
35#endif 34#endif
36#else
37#define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT)
38#endif
39 35
40/* 36/*
41 * IO bus memory addresses are 1:1 with the physical address, 37 * IO bus memory addresses are 1:1 with the physical address,
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 57fd286e4b0b..967a8b7e1527 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -835,38 +835,30 @@ static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *
835} 835}
836 836
837static inline void __user * 837static inline void __user *
838get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 838get_sigframe(struct ksignal *ksig, size_t frame_size)
839{ 839{
840 unsigned long usp; 840 unsigned long usp = sigsp(rdusp(), ksig);
841
842 /* Default to using normal stack. */
843 usp = rdusp();
844 841
845 /* This is the X/Open sanctioned signal stack switching. */
846 if (ka->sa.sa_flags & SA_ONSTACK) {
847 if (!sas_ss_flags(usp))
848 usp = current->sas_ss_sp + current->sas_ss_size;
849 }
850 return (void __user *)((usp - frame_size) & -8UL); 842 return (void __user *)((usp - frame_size) & -8UL);
851} 843}
852 844
853static int setup_frame (int sig, struct k_sigaction *ka, 845static int setup_frame(struct ksignal *ksig, sigset_t *set,
854 sigset_t *set, struct pt_regs *regs) 846 struct pt_regs *regs)
855{ 847{
856 struct sigframe __user *frame; 848 struct sigframe __user *frame;
857 int fsize = frame_extra_sizes(regs->format); 849 int fsize = frame_extra_sizes(regs->format);
858 struct sigcontext context; 850 struct sigcontext context;
859 int err = 0; 851 int err = 0, sig = ksig->sig;
860 852
861 if (fsize < 0) { 853 if (fsize < 0) {
862#ifdef DEBUG 854#ifdef DEBUG
863 printk ("setup_frame: Unknown frame format %#x\n", 855 printk ("setup_frame: Unknown frame format %#x\n",
864 regs->format); 856 regs->format);
865#endif 857#endif
866 goto give_sigsegv; 858 return -EFAULT;
867 } 859 }
868 860
869 frame = get_sigframe(ka, regs, sizeof(*frame) + fsize); 861 frame = get_sigframe(ksig, sizeof(*frame) + fsize);
870 862
871 if (fsize) 863 if (fsize)
872 err |= copy_to_user (frame + 1, regs + 1, fsize); 864 err |= copy_to_user (frame + 1, regs + 1, fsize);
@@ -899,7 +891,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
899#endif 891#endif
900 892
901 if (err) 893 if (err)
902 goto give_sigsegv; 894 return -EFAULT;
903 895
904 push_cache ((unsigned long) &frame->retcode); 896 push_cache ((unsigned long) &frame->retcode);
905 897
@@ -908,7 +900,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
908 * to destroy is successfully copied to sigframe. 900 * to destroy is successfully copied to sigframe.
909 */ 901 */
910 wrusp ((unsigned long) frame); 902 wrusp ((unsigned long) frame);
911 regs->pc = (unsigned long) ka->sa.sa_handler; 903 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
912 adjustformat(regs); 904 adjustformat(regs);
913 905
914 /* 906 /*
@@ -934,28 +926,24 @@ static int setup_frame (int sig, struct k_sigaction *ka,
934 tregs->sr = regs->sr; 926 tregs->sr = regs->sr;
935 } 927 }
936 return 0; 928 return 0;
937
938give_sigsegv:
939 force_sigsegv(sig, current);
940 return err;
941} 929}
942 930
943static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, 931static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
944 sigset_t *set, struct pt_regs *regs) 932 struct pt_regs *regs)
945{ 933{
946 struct rt_sigframe __user *frame; 934 struct rt_sigframe __user *frame;
947 int fsize = frame_extra_sizes(regs->format); 935 int fsize = frame_extra_sizes(regs->format);
948 int err = 0; 936 int err = 0, sig = ksig->sig;
949 937
950 if (fsize < 0) { 938 if (fsize < 0) {
951#ifdef DEBUG 939#ifdef DEBUG
952 printk ("setup_frame: Unknown frame format %#x\n", 940 printk ("setup_frame: Unknown frame format %#x\n",
953 regs->format); 941 regs->format);
954#endif 942#endif
955 goto give_sigsegv; 943 return -EFAULT;
956 } 944 }
957 945
958 frame = get_sigframe(ka, regs, sizeof(*frame)); 946 frame = get_sigframe(ksig, sizeof(*frame));
959 947
960 if (fsize) 948 if (fsize)
961 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize); 949 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
@@ -968,7 +956,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
968 &frame->sig); 956 &frame->sig);
969 err |= __put_user(&frame->info, &frame->pinfo); 957 err |= __put_user(&frame->info, &frame->pinfo);
970 err |= __put_user(&frame->uc, &frame->puc); 958 err |= __put_user(&frame->uc, &frame->puc);
971 err |= copy_siginfo_to_user(&frame->info, info); 959 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
972 960
973 /* Create the ucontext. */ 961 /* Create the ucontext. */
974 err |= __put_user(0, &frame->uc.uc_flags); 962 err |= __put_user(0, &frame->uc.uc_flags);
@@ -996,7 +984,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
996#endif /* CONFIG_MMU */ 984#endif /* CONFIG_MMU */
997 985
998 if (err) 986 if (err)
999 goto give_sigsegv; 987 return -EFAULT;
1000 988
1001 push_cache ((unsigned long) &frame->retcode); 989 push_cache ((unsigned long) &frame->retcode);
1002 990
@@ -1005,7 +993,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
1005 * to destroy is successfully copied to sigframe. 993 * to destroy is successfully copied to sigframe.
1006 */ 994 */
1007 wrusp ((unsigned long) frame); 995 wrusp ((unsigned long) frame);
1008 regs->pc = (unsigned long) ka->sa.sa_handler; 996 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
1009 adjustformat(regs); 997 adjustformat(regs);
1010 998
1011 /* 999 /*
@@ -1031,10 +1019,6 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
1031 tregs->sr = regs->sr; 1019 tregs->sr = regs->sr;
1032 } 1020 }
1033 return 0; 1021 return 0;
1034
1035give_sigsegv:
1036 force_sigsegv(sig, current);
1037 return err;
1038} 1022}
1039 1023
1040static inline void 1024static inline void
@@ -1074,26 +1058,22 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
1074 * OK, we're invoking a handler 1058 * OK, we're invoking a handler
1075 */ 1059 */
1076static void 1060static void
1077handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, 1061handle_signal(struct ksignal *ksig, struct pt_regs *regs)
1078 struct pt_regs *regs)
1079{ 1062{
1080 sigset_t *oldset = sigmask_to_save(); 1063 sigset_t *oldset = sigmask_to_save();
1081 int err; 1064 int err;
1082 /* are we from a system call? */ 1065 /* are we from a system call? */
1083 if (regs->orig_d0 >= 0) 1066 if (regs->orig_d0 >= 0)
1084 /* If so, check system call restarting.. */ 1067 /* If so, check system call restarting.. */
1085 handle_restart(regs, ka, 1); 1068 handle_restart(regs, &ksig->ka, 1);
1086 1069
1087 /* set up the stack frame */ 1070 /* set up the stack frame */
1088 if (ka->sa.sa_flags & SA_SIGINFO) 1071 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
1089 err = setup_rt_frame(sig, ka, info, oldset, regs); 1072 err = setup_rt_frame(ksig, oldset, regs);
1090 else 1073 else
1091 err = setup_frame(sig, ka, oldset, regs); 1074 err = setup_frame(ksig, oldset, regs);
1092
1093 if (err)
1094 return;
1095 1075
1096 signal_delivered(sig, info, ka, regs, 0); 1076 signal_setup_done(err, ksig, 0);
1097 1077
1098 if (test_thread_flag(TIF_DELAYED_TRACE)) { 1078 if (test_thread_flag(TIF_DELAYED_TRACE)) {
1099 regs->sr &= ~0x8000; 1079 regs->sr &= ~0x8000;
@@ -1108,16 +1088,13 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1108 */ 1088 */
1109static void do_signal(struct pt_regs *regs) 1089static void do_signal(struct pt_regs *regs)
1110{ 1090{
1111 siginfo_t info; 1091 struct ksignal ksig;
1112 struct k_sigaction ka;
1113 int signr;
1114 1092
1115 current->thread.esp0 = (unsigned long) regs; 1093 current->thread.esp0 = (unsigned long) regs;
1116 1094
1117 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 1095 if (get_signal(&ksig)) {
1118 if (signr > 0) {
1119 /* Whee! Actually deliver the signal. */ 1096 /* Whee! Actually deliver the signal. */
1120 handle_signal(signr, &ka, &info, regs); 1097 handle_signal(&ksig, regs);
1121 return; 1098 return;
1122 } 1099 }
1123 1100
diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 0a2385fa2a1d..04b7d4f8429a 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -55,7 +55,7 @@ unsigned int get_global_icache_size(void)
55 return (get_icache_size() * ((temp >> SYSC_xCPARTG_AND_S) + 1)) >> 4; 55 return (get_icache_size() * ((temp >> SYSC_xCPARTG_AND_S) + 1)) >> 4;
56} 56}
57 57
58static unsigned int get_thread_cache_size(unsigned int cache, int thread_id) 58static int get_thread_cache_size(unsigned int cache, int thread_id)
59{ 59{
60 unsigned int cache_size; 60 unsigned int cache_size;
61 unsigned int t_cache_part; 61 unsigned int t_cache_part;
@@ -94,7 +94,7 @@ static unsigned int get_thread_cache_size(unsigned int cache, int thread_id)
94 94
95void check_for_cache_aliasing(int thread_id) 95void check_for_cache_aliasing(int thread_id)
96{ 96{
97 unsigned int thread_cache_size; 97 int thread_cache_size;
98 unsigned int cache_type; 98 unsigned int cache_type;
99 for (cache_type = ICACHE; cache_type <= DCACHE; cache_type++) { 99 for (cache_type = ICACHE; cache_type <= DCACHE; cache_type++) {
100 thread_cache_size = 100 thread_cache_size =
diff --git a/arch/metag/kernel/signal.c b/arch/metag/kernel/signal.c
index b9e4a82d2bd4..0d100d5c1407 100644
--- a/arch/metag/kernel/signal.c
+++ b/arch/metag/kernel/signal.c
@@ -140,13 +140,9 @@ static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
140/* 140/*
141 * Determine which stack to use.. 141 * Determine which stack to use..
142 */ 142 */
143static void __user *get_sigframe(struct k_sigaction *ka, unsigned long sp, 143static void __user *get_sigframe(struct ksignal *ksig, unsigned long sp)
144 size_t frame_size)
145{ 144{
146 /* Meta stacks grows upwards */ 145 sp = sigsp(sp, ksig);
147 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
148 sp = current->sas_ss_sp;
149
150 sp = (sp + 7) & ~7; /* 8byte align stack */ 146 sp = (sp + 7) & ~7; /* 8byte align stack */
151 147
152 return (void __user *)sp; 148 return (void __user *)sp;
@@ -159,7 +155,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
159 int err; 155 int err;
160 unsigned long code; 156 unsigned long code;
161 157
162 frame = get_sigframe(&ksig->ka, regs->REG_SP, sizeof(*frame)); 158 frame = get_sigframe(ksig, regs->REG_SP);
163 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 159 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
164 return -EFAULT; 160 return -EFAULT;
165 161
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
index 3c52fa6d0f8e..3c32075d2945 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
@@ -173,7 +173,7 @@ new_search:
173 mm->context.part_huge = 0; 173 mm->context.part_huge = 0;
174 return addr; 174 return addr;
175 } 175 }
176 if (vma && (vma->vm_flags & MAP_HUGETLB)) { 176 if (vma->vm_flags & MAP_HUGETLB) {
177 /* space after a huge vma in 2nd level page table? */ 177 /* space after a huge vma in 2nd level page table? */
178 if (vma->vm_end & HUGEPT_MASK) { 178 if (vma->vm_end & HUGEPT_MASK) {
179 after_huge = 1; 179 after_huge = 1;
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 35b3ecaf25d5..27a3acda6c19 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -7,5 +7,6 @@ generic-y += exec.h
7generic-y += hash.h 7generic-y += hash.h
8generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
9generic-y += preempt.h 9generic-y += preempt.h
10generic-y += scatterlist.h
10generic-y += syscalls.h 11generic-y += syscalls.h
11generic-y += trace_clock.h 12generic-y += trace_clock.h
diff --git a/arch/microblaze/include/asm/delay.h b/arch/microblaze/include/asm/delay.h
index 66fc24c24238..60cb39deb533 100644
--- a/arch/microblaze/include/asm/delay.h
+++ b/arch/microblaze/include/asm/delay.h
@@ -61,13 +61,29 @@ extern inline void __udelay(unsigned int x)
61extern void __bad_udelay(void); /* deliberately undefined */ 61extern void __bad_udelay(void); /* deliberately undefined */
62extern void __bad_ndelay(void); /* deliberately undefined */ 62extern void __bad_ndelay(void); /* deliberately undefined */
63 63
64#define udelay(n) (__builtin_constant_p(n) ? \ 64#define udelay(n) \
65 ((n) > __MAX_UDELAY ? __bad_udelay() : __udelay((n) * (19 * HZ))) : \ 65 ({ \
66 __udelay((n) * (19 * HZ))) 66 if (__builtin_constant_p(n)) { \
67 if ((n) / __MAX_UDELAY >= 1) \
68 __bad_udelay(); \
69 else \
70 __udelay((n) * (19 * HZ)); \
71 } else { \
72 __udelay((n) * (19 * HZ)); \
73 } \
74 })
67 75
68#define ndelay(n) (__builtin_constant_p(n) ? \ 76#define ndelay(n) \
69 ((n) > __MAX_NDELAY ? __bad_ndelay() : __udelay((n) * HZ)) : \ 77 ({ \
70 __udelay((n) * HZ)) 78 if (__builtin_constant_p(n)) { \
79 if ((n) / __MAX_NDELAY >= 1) \
80 __bad_ndelay(); \
81 else \
82 __udelay((n) * HZ); \
83 } else { \
84 __udelay((n) * HZ); \
85 } \
86 })
71 87
72#define muldiv(a, b, c) (((a)*(b))/(c)) 88#define muldiv(a, b, c) (((a)*(b))/(c))
73 89
diff --git a/arch/microblaze/include/asm/scatterlist.h b/arch/microblaze/include/asm/scatterlist.h
deleted file mode 100644
index 35d786fe93ae..000000000000
--- a/arch/microblaze/include/asm/scatterlist.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/scatterlist.h>
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h
index 8d0791b49b31..4e1ddc930a68 100644
--- a/arch/microblaze/include/uapi/asm/unistd.h
+++ b/arch/microblaze/include/uapi/asm/unistd.h
@@ -398,5 +398,6 @@
398#define __NR_finit_module 380 398#define __NR_finit_module 380
399#define __NR_sched_setattr 381 399#define __NR_sched_setattr 381
400#define __NR_sched_getattr 382 400#define __NR_sched_getattr 382
401#define __NR_renameat2 383
401 402
402#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ 403#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 49a07a4d76d0..8955a3829cf0 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -145,22 +145,19 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
145 * Determine which stack to use.. 145 * Determine which stack to use..
146 */ 146 */
147static inline void __user * 147static inline void __user *
148get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 148get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size)
149{ 149{
150 /* Default to using normal stack */ 150 /* Default to using normal stack */
151 unsigned long sp = regs->r1; 151 unsigned long sp = sigsp(regs->r1, ksig);
152
153 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && !on_sig_stack(sp))
154 sp = current->sas_ss_sp + current->sas_ss_size;
155 152
156 return (void __user *)((sp - frame_size) & -8UL); 153 return (void __user *)((sp - frame_size) & -8UL);
157} 154}
158 155
159static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 156static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
160 sigset_t *set, struct pt_regs *regs) 157 struct pt_regs *regs)
161{ 158{
162 struct rt_sigframe __user *frame; 159 struct rt_sigframe __user *frame;
163 int err = 0; 160 int err = 0, sig = ksig->sig;
164 int signal; 161 int signal;
165 unsigned long address = 0; 162 unsigned long address = 0;
166#ifdef CONFIG_MMU 163#ifdef CONFIG_MMU
@@ -168,10 +165,10 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
168 pte_t *ptep; 165 pte_t *ptep;
169#endif 166#endif
170 167
171 frame = get_sigframe(ka, regs, sizeof(*frame)); 168 frame = get_sigframe(ksig, regs, sizeof(*frame));
172 169
173 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 170 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
174 goto give_sigsegv; 171 return -EFAULT;
175 172
176 signal = current_thread_info()->exec_domain 173 signal = current_thread_info()->exec_domain
177 && current_thread_info()->exec_domain->signal_invmap 174 && current_thread_info()->exec_domain->signal_invmap
@@ -179,8 +176,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
179 ? current_thread_info()->exec_domain->signal_invmap[sig] 176 ? current_thread_info()->exec_domain->signal_invmap[sig]
180 : sig; 177 : sig;
181 178
182 if (info) 179 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
183 err |= copy_siginfo_to_user(&frame->info, info); 180 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
184 181
185 /* Create the ucontext. */ 182 /* Create the ucontext. */
186 err |= __put_user(0, &frame->uc.uc_flags); 183 err |= __put_user(0, &frame->uc.uc_flags);
@@ -227,7 +224,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
227 flush_dcache_range(address, address + 8); 224 flush_dcache_range(address, address + 8);
228#endif 225#endif
229 if (err) 226 if (err)
230 goto give_sigsegv; 227 return -EFAULT;
231 228
232 /* Set up registers for signal handler */ 229 /* Set up registers for signal handler */
233 regs->r1 = (unsigned long) frame; 230 regs->r1 = (unsigned long) frame;
@@ -237,7 +234,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
237 regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */ 234 regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
238 regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */ 235 regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */
239 /* Offset to handle microblaze rtid r14, 0 */ 236 /* Offset to handle microblaze rtid r14, 0 */
240 regs->pc = (unsigned long)ka->sa.sa_handler; 237 regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
241 238
242 set_fs(USER_DS); 239 set_fs(USER_DS);
243 240
@@ -247,10 +244,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
247#endif 244#endif
248 245
249 return 0; 246 return 0;
250
251give_sigsegv:
252 force_sigsegv(sig, current);
253 return -EFAULT;
254} 247}
255 248
256/* Handle restarting system calls */ 249/* Handle restarting system calls */
@@ -283,23 +276,15 @@ do_restart:
283 */ 276 */
284 277
285static void 278static void
286handle_signal(unsigned long sig, struct k_sigaction *ka, 279handle_signal(struct ksignal *ksig, struct pt_regs *regs)
287 siginfo_t *info, struct pt_regs *regs)
288{ 280{
289 sigset_t *oldset = sigmask_to_save(); 281 sigset_t *oldset = sigmask_to_save();
290 int ret; 282 int ret;
291 283
292 /* Set up the stack frame */ 284 /* Set up the stack frame */
293 if (ka->sa.sa_flags & SA_SIGINFO) 285 ret = setup_rt_frame(ksig, oldset, regs);
294 ret = setup_rt_frame(sig, ka, info, oldset, regs);
295 else
296 ret = setup_rt_frame(sig, ka, NULL, oldset, regs);
297 286
298 if (ret) 287 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
299 return;
300
301 signal_delivered(sig, info, ka, regs,
302 test_thread_flag(TIF_SINGLESTEP));
303} 288}
304 289
305/* 290/*
@@ -313,21 +298,19 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
313 */ 298 */
314static void do_signal(struct pt_regs *regs, int in_syscall) 299static void do_signal(struct pt_regs *regs, int in_syscall)
315{ 300{
316 siginfo_t info; 301 struct ksignal ksig;
317 int signr; 302
318 struct k_sigaction ka;
319#ifdef DEBUG_SIG 303#ifdef DEBUG_SIG
320 pr_info("do signal: %p %d\n", regs, in_syscall); 304 pr_info("do signal: %p %d\n", regs, in_syscall);
321 pr_info("do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1, 305 pr_info("do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
322 regs->r12, current_thread_info()->flags); 306 regs->r12, current_thread_info()->flags);
323#endif 307#endif
324 308
325 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 309 if (get_signal(&ksig)) {
326 if (signr > 0) {
327 /* Whee! Actually deliver the signal. */ 310 /* Whee! Actually deliver the signal. */
328 if (in_syscall) 311 if (in_syscall)
329 handle_restart(regs, &ka, 1); 312 handle_restart(regs, &ksig.ka, 1);
330 handle_signal(signr, &ka, &info, regs); 313 handle_signal(&ksig, regs);
331 return; 314 return;
332 } 315 }
333 316
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 329dfbad810b..1a23d5d5480c 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -380,6 +380,7 @@ ENTRY(sys_call_table)
380 .long sys_process_vm_readv 380 .long sys_process_vm_readv
381 .long sys_process_vm_writev 381 .long sys_process_vm_writev
382 .long sys_kcmp 382 .long sys_kcmp
383 .long sys_finit_module 383 .long sys_finit_module /* 380 */
384 .long sys_sched_setattr 384 .long sys_sched_setattr
385 .long sys_sched_getattr 385 .long sys_sched_getattr
386 .long sys_renameat2
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index 844960e8ae18..70c7ae6a3fb5 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -18,14 +18,6 @@ endif
18 18
19lib-y += uaccess_old.o 19lib-y += uaccess_old.o
20 20
21lib-y += ashldi3.o 21# libgcc-style stuff needed in the kernel
22lib-y += ashrdi3.o 22obj-y += ashldi3.o ashrdi3.o cmpdi2.o divsi3.o lshrdi3.o modsi3.o
23lib-y += cmpdi2.o 23obj-y += muldi3.o mulsi3.o ucmpdi2.o udivsi3.o umodsi3.o
24lib-y += divsi3.o
25lib-y += lshrdi3.o
26lib-y += modsi3.o
27lib-y += muldi3.o
28lib-y += mulsi3.o
29lib-y += ucmpdi2.o
30lib-y += udivsi3.o
31lib-y += umodsi3.o
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 10f270bd3e25..df51e78a72cc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -71,6 +71,7 @@ config MIPS_ALCHEMY
71 select SYS_SUPPORTS_APM_EMULATION 71 select SYS_SUPPORTS_APM_EMULATION
72 select ARCH_REQUIRE_GPIOLIB 72 select ARCH_REQUIRE_GPIOLIB
73 select SYS_SUPPORTS_ZBOOT 73 select SYS_SUPPORTS_ZBOOT
74 select COMMON_CLK
74 75
75config AR7 76config AR7
76 bool "Texas Instruments AR7" 77 bool "Texas Instruments AR7"
@@ -129,6 +130,8 @@ config BCM47XX
129 select SYS_SUPPORTS_MIPS16 130 select SYS_SUPPORTS_MIPS16
130 select SYS_HAS_EARLY_PRINTK 131 select SYS_HAS_EARLY_PRINTK
131 select USE_GENERIC_EARLY_PRINTK_8250 132 select USE_GENERIC_EARLY_PRINTK_8250
133 select GPIOLIB
134 select LEDS_GPIO_REGISTER
132 help 135 help
133 Support for BCM47XX based boards 136 Support for BCM47XX based boards
134 137
@@ -137,6 +140,7 @@ config BCM63XX
137 select BOOT_RAW 140 select BOOT_RAW
138 select CEVT_R4K 141 select CEVT_R4K
139 select CSRC_R4K 142 select CSRC_R4K
143 select SYNC_R4K
140 select DMA_NONCOHERENT 144 select DMA_NONCOHERENT
141 select IRQ_CPU 145 select IRQ_CPU
142 select SYS_SUPPORTS_32BIT_KERNEL 146 select SYS_SUPPORTS_32BIT_KERNEL
@@ -2056,6 +2060,7 @@ config MIPS_CPS
2056 support is unavailable. 2060 support is unavailable.
2057 2061
2058config MIPS_CPS_PM 2062config MIPS_CPS_PM
2063 select MIPS_CPC
2059 bool 2064 bool
2060 2065
2061config MIPS_GIC_IPI 2066config MIPS_GIC_IPI
@@ -2109,9 +2114,9 @@ config CPU_MICROMIPS
2109 microMIPS ISA 2114 microMIPS ISA
2110 2115
2111config CPU_HAS_MSA 2116config CPU_HAS_MSA
2112 bool "Support for the MIPS SIMD Architecture" 2117 bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)"
2113 depends on CPU_SUPPORTS_MSA 2118 depends on CPU_SUPPORTS_MSA
2114 default y 2119 depends on 64BIT || MIPS_O32_FP64_SUPPORT
2115 help 2120 help
2116 MIPS SIMD Architecture (MSA) introduces 128 bit wide vector registers 2121 MIPS SIMD Architecture (MSA) introduces 128 bit wide vector registers
2117 and a set of SIMD instructions to operate on them. When this option 2122 and a set of SIMD instructions to operate on them. When this option
@@ -2391,6 +2396,8 @@ source "kernel/Kconfig.preempt"
2391 2396
2392config KEXEC 2397config KEXEC
2393 bool "Kexec system call" 2398 bool "Kexec system call"
2399 select CRYPTO
2400 select CRYPTO_SHA256
2394 help 2401 help
2395 kexec is a system call that implements the ability to shutdown your 2402 kexec is a system call that implements the ability to shutdown your
2396 current kernel, and to start another kernel. It is like a reboot 2403 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index a8521de14791..9336509f47ad 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -151,8 +151,10 @@ cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
151 -Wa,--trap 151 -Wa,--trap
152cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ 152cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
153 -Wa,--trap 153 -Wa,--trap
154cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1 -mno-mdmx -mno-mips3d,-march=r5000) \ 154cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \
155 -Wa,--trap 155 -Wa,--trap
156cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx)
157cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d)
156cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap 158cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
157cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ 159cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
158 -Wa,--trap 160 -Wa,--trap
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 25a59a23547e..1e3b102389ef 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -85,10 +85,10 @@ void __init board_setup(void)
85#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */ 85#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */
86 86
87 /* Initialize sys_pinfunc */ 87 /* Initialize sys_pinfunc */
88 au_writel(SYS_PF_NI2, SYS_PINFUNC); 88 alchemy_wrsys(SYS_PF_NI2, AU1000_SYS_PINFUNC);
89 89
90 /* Initialize GPIO */ 90 /* Initialize GPIO */
91 au_writel(~0, KSEG1ADDR(AU1000_SYS_PHYS_ADDR) + SYS_TRIOUTCLR); 91 alchemy_wrsys(~0, AU1000_SYS_TRIOUTCLR);
92 alchemy_gpio_direction_output(0, 0); /* Disable M66EN (PCI 66MHz) */ 92 alchemy_gpio_direction_output(0, 0); /* Disable M66EN (PCI 66MHz) */
93 alchemy_gpio_direction_output(3, 1); /* Disable PCI CLKRUN# */ 93 alchemy_gpio_direction_output(3, 1); /* Disable PCI CLKRUN# */
94 alchemy_gpio_direction_output(1, 1); /* Enable EXT_IO3 */ 94 alchemy_gpio_direction_output(1, 1); /* Enable EXT_IO3 */
diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c
index 3fb814be0e91..0fc53e08a894 100644
--- a/arch/mips/alchemy/board-xxs1500.c
+++ b/arch/mips/alchemy/board-xxs1500.c
@@ -87,9 +87,9 @@ void __init board_setup(void)
87 alchemy_gpio2_enable(); 87 alchemy_gpio2_enable();
88 88
89 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */ 89 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
90 pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3; 90 pin_func = alchemy_rdsys(AU1000_SYS_PINFUNC) & ~SYS_PF_UR3;
91 pin_func |= SYS_PF_UR3; 91 pin_func |= SYS_PF_UR3;
92 au_writel(pin_func, SYS_PINFUNC); 92 alchemy_wrsys(pin_func, AU1000_SYS_PINFUNC);
93 93
94 /* Enable UART */ 94 /* Enable UART */
95 alchemy_uart_enable(AU1000_UART3_PHYS_ADDR); 95 alchemy_uart_enable(AU1000_UART3_PHYS_ADDR);
diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile
index cb83d8d21aef..f64744f3b59f 100644
--- a/arch/mips/alchemy/common/Makefile
+++ b/arch/mips/alchemy/common/Makefile
@@ -5,8 +5,8 @@
5# Makefile for the Alchemy Au1xx0 CPUs, generic files. 5# Makefile for the Alchemy Au1xx0 CPUs, generic files.
6# 6#
7 7
8obj-y += prom.o time.o clocks.o platform.o power.o setup.o \ 8obj-y += prom.o time.o clock.o platform.o power.o \
9 sleeper.o dma.o dbdma.o vss.o irq.o usb.o 9 setup.o sleeper.o dma.o dbdma.o vss.o irq.o usb.o
10 10
11# optional gpiolib support 11# optional gpiolib support
12ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),) 12ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),)
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
new file mode 100644
index 000000000000..d7557cde271a
--- /dev/null
+++ b/arch/mips/alchemy/common/clock.c
@@ -0,0 +1,1094 @@
1/*
2 * Alchemy clocks.
3 *
4 * Exposes all configurable internal clock sources to the clk framework.
5 *
6 * We have:
7 * - Root source, usually 12MHz supplied by an external crystal
8 * - 3 PLLs which generate multiples of root rate [AUX, CPU, AUX2]
9 *
10 * Dividers:
11 * - 6 clock dividers with:
12 * * selectable source [one of the PLLs],
13 * * output divided between [2 .. 512 in steps of 2] (!Au1300)
14 * or [1 .. 256 in steps of 1] (Au1300),
15 * * can be enabled individually.
16 *
17 * - up to 6 "internal" (fixed) consumers which:
18 * * take either AUXPLL or one of the above 6 dividers as input,
19 * * divide this input by 1, 2, or 4 (and 3 on Au1300).
20 * * can be disabled separately.
21 *
22 * Misc clocks:
23 * - sysbus clock: CPU core clock (CPUPLL) divided by 2, 3 or 4.
24 * depends on board design and should be set by bootloader, read-only.
25 * - peripheral clock: half the rate of sysbus clock, source for a lot
26 * of peripheral blocks, read-only.
27 * - memory clock: clk rate to main memory chips, depends on board
28 * design and is read-only,
29 * - lrclk: the static bus clock signal for synchronous operation.
30 * depends on board design, must be set by bootloader,
31 * but may be required to correctly configure devices attached to
32 * the static bus. The Au1000/1500/1100 manuals call it LCLK, on
33 * later models it's called RCLK.
34 */
35
36#include <linux/init.h>
37#include <linux/io.h>
38#include <linux/clk-provider.h>
39#include <linux/clkdev.h>
40#include <linux/clk-private.h>
41#include <linux/slab.h>
42#include <linux/spinlock.h>
43#include <linux/types.h>
44#include <asm/mach-au1x00/au1000.h>
45
46/* Base clock: 12MHz is the default in all databooks, and I haven't
47 * found any board yet which uses a different rate.
48 */
49#define ALCHEMY_ROOTCLK_RATE 12000000
50
51/*
52 * the internal sources which can be driven by the PLLs and dividers.
53 * Names taken from the databooks, refer to them for more information,
54 * especially which ones are share a clock line.
55 */
56static const char * const alchemy_au1300_intclknames[] = {
57 "lcd_intclk", "gpemgp_clk", "maempe_clk", "maebsa_clk",
58 "EXTCLK0", "EXTCLK1"
59};
60
61static const char * const alchemy_au1200_intclknames[] = {
62 "lcd_intclk", NULL, NULL, NULL, "EXTCLK0", "EXTCLK1"
63};
64
65static const char * const alchemy_au1550_intclknames[] = {
66 "usb_clk", "psc0_intclk", "psc1_intclk", "pci_clko",
67 "EXTCLK0", "EXTCLK1"
68};
69
70static const char * const alchemy_au1100_intclknames[] = {
71 "usb_clk", "lcd_intclk", NULL, "i2s_clk", "EXTCLK0", "EXTCLK1"
72};
73
74static const char * const alchemy_au1500_intclknames[] = {
75 NULL, "usbd_clk", "usbh_clk", "pci_clko", "EXTCLK0", "EXTCLK1"
76};
77
78static const char * const alchemy_au1000_intclknames[] = {
79 "irda_clk", "usbd_clk", "usbh_clk", "i2s_clk", "EXTCLK0",
80 "EXTCLK1"
81};
82
83/* aliases for a few on-chip sources which are either shared
84 * or have gone through name changes.
85 */
86static struct clk_aliastable {
87 char *alias;
88 char *base;
89 int cputype;
90} alchemy_clk_aliases[] __initdata = {
91 { "usbh_clk", "usb_clk", ALCHEMY_CPU_AU1100 },
92 { "usbd_clk", "usb_clk", ALCHEMY_CPU_AU1100 },
93 { "irda_clk", "usb_clk", ALCHEMY_CPU_AU1100 },
94 { "usbh_clk", "usb_clk", ALCHEMY_CPU_AU1550 },
95 { "usbd_clk", "usb_clk", ALCHEMY_CPU_AU1550 },
96 { "psc2_intclk", "usb_clk", ALCHEMY_CPU_AU1550 },
97 { "psc3_intclk", "EXTCLK0", ALCHEMY_CPU_AU1550 },
98 { "psc0_intclk", "EXTCLK0", ALCHEMY_CPU_AU1200 },
99 { "psc1_intclk", "EXTCLK1", ALCHEMY_CPU_AU1200 },
100 { "psc0_intclk", "EXTCLK0", ALCHEMY_CPU_AU1300 },
101 { "psc2_intclk", "EXTCLK0", ALCHEMY_CPU_AU1300 },
102 { "psc1_intclk", "EXTCLK1", ALCHEMY_CPU_AU1300 },
103 { "psc3_intclk", "EXTCLK1", ALCHEMY_CPU_AU1300 },
104
105 { NULL, NULL, 0 },
106};
107
108#define IOMEM(x) ((void __iomem *)(KSEG1ADDR(CPHYSADDR(x))))
109
110/* access locks to SYS_FREQCTRL0/1 and SYS_CLKSRC registers */
111static spinlock_t alchemy_clk_fg0_lock;
112static spinlock_t alchemy_clk_fg1_lock;
113static spinlock_t alchemy_clk_csrc_lock;
114
115/* CPU Core clock *****************************************************/
116
117static unsigned long alchemy_clk_cpu_recalc(struct clk_hw *hw,
118 unsigned long parent_rate)
119{
120 unsigned long t;
121
122 /*
123 * On early Au1000, sys_cpupll was write-only. Since these
124 * silicon versions of Au1000 are not sold, we don't bend
125 * over backwards trying to determine the frequency.
126 */
127 if (unlikely(au1xxx_cpu_has_pll_wo()))
128 t = 396000000;
129 else {
130 t = alchemy_rdsys(AU1000_SYS_CPUPLL) & 0x7f;
131 t *= parent_rate;
132 }
133
134 return t;
135}
136
137static struct clk_ops alchemy_clkops_cpu = {
138 .recalc_rate = alchemy_clk_cpu_recalc,
139};
140
141static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name,
142 int ctype)
143{
144 struct clk_init_data id;
145 struct clk_hw *h;
146
147 h = kzalloc(sizeof(*h), GFP_KERNEL);
148 if (!h)
149 return ERR_PTR(-ENOMEM);
150
151 id.name = ALCHEMY_CPU_CLK;
152 id.parent_names = &parent_name;
153 id.num_parents = 1;
154 id.flags = CLK_IS_BASIC;
155 id.ops = &alchemy_clkops_cpu;
156 h->init = &id;
157
158 return clk_register(NULL, h);
159}
160
161/* AUXPLLs ************************************************************/
162
163struct alchemy_auxpll_clk {
164 struct clk_hw hw;
165 unsigned long reg; /* au1300 has also AUXPLL2 */
166 int maxmult; /* max multiplier */
167};
168#define to_auxpll_clk(x) container_of(x, struct alchemy_auxpll_clk, hw)
169
170static unsigned long alchemy_clk_aux_recalc(struct clk_hw *hw,
171 unsigned long parent_rate)
172{
173 struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
174
175 return (alchemy_rdsys(a->reg) & 0xff) * parent_rate;
176}
177
178static int alchemy_clk_aux_setr(struct clk_hw *hw,
179 unsigned long rate,
180 unsigned long parent_rate)
181{
182 struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
183 unsigned long d = rate;
184
185 if (rate)
186 d /= parent_rate;
187 else
188 d = 0;
189
190 /* minimum is 84MHz, max is 756-1032 depending on variant */
191 if (((d < 7) && (d != 0)) || (d > a->maxmult))
192 return -EINVAL;
193
194 alchemy_wrsys(d, a->reg);
195 return 0;
196}
197
198static long alchemy_clk_aux_roundr(struct clk_hw *hw,
199 unsigned long rate,
200 unsigned long *parent_rate)
201{
202 struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
203 unsigned long mult;
204
205 if (!rate || !*parent_rate)
206 return 0;
207
208 mult = rate / (*parent_rate);
209
210 if (mult && (mult < 7))
211 mult = 7;
212 if (mult > a->maxmult)
213 mult = a->maxmult;
214
215 return (*parent_rate) * mult;
216}
217
218static struct clk_ops alchemy_clkops_aux = {
219 .recalc_rate = alchemy_clk_aux_recalc,
220 .set_rate = alchemy_clk_aux_setr,
221 .round_rate = alchemy_clk_aux_roundr,
222};
223
224static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,
225 char *name, int maxmult,
226 unsigned long reg)
227{
228 struct clk_init_data id;
229 struct clk *c;
230 struct alchemy_auxpll_clk *a;
231
232 a = kzalloc(sizeof(*a), GFP_KERNEL);
233 if (!a)
234 return ERR_PTR(-ENOMEM);
235
236 id.name = name;
237 id.parent_names = &parent_name;
238 id.num_parents = 1;
239 id.flags = CLK_GET_RATE_NOCACHE;
240 id.ops = &alchemy_clkops_aux;
241
242 a->reg = reg;
243 a->maxmult = maxmult;
244 a->hw.init = &id;
245
246 c = clk_register(NULL, &a->hw);
247 if (!IS_ERR(c))
248 clk_register_clkdev(c, name, NULL);
249 else
250 kfree(a);
251
252 return c;
253}
254
255/* sysbus_clk *********************************************************/
256
257static struct clk __init *alchemy_clk_setup_sysbus(const char *pn)
258{
259 unsigned long v = (alchemy_rdsys(AU1000_SYS_POWERCTRL) & 3) + 2;
260 struct clk *c;
261
262 c = clk_register_fixed_factor(NULL, ALCHEMY_SYSBUS_CLK,
263 pn, 0, 1, v);
264 if (!IS_ERR(c))
265 clk_register_clkdev(c, ALCHEMY_SYSBUS_CLK, NULL);
266 return c;
267}
268
269/* Peripheral Clock ***************************************************/
270
271static struct clk __init *alchemy_clk_setup_periph(const char *pn)
272{
273 /* Peripheral clock runs at half the rate of sysbus clk */
274 struct clk *c;
275
276 c = clk_register_fixed_factor(NULL, ALCHEMY_PERIPH_CLK,
277 pn, 0, 1, 2);
278 if (!IS_ERR(c))
279 clk_register_clkdev(c, ALCHEMY_PERIPH_CLK, NULL);
280 return c;
281}
282
283/* mem clock **********************************************************/
284
285static struct clk __init *alchemy_clk_setup_mem(const char *pn, int ct)
286{
287 void __iomem *addr = IOMEM(AU1000_MEM_PHYS_ADDR);
288 unsigned long v;
289 struct clk *c;
290 int div;
291
292 switch (ct) {
293 case ALCHEMY_CPU_AU1550:
294 case ALCHEMY_CPU_AU1200:
295 v = __raw_readl(addr + AU1550_MEM_SDCONFIGB);
296 div = (v & (1 << 15)) ? 1 : 2;
297 break;
298 case ALCHEMY_CPU_AU1300:
299 v = __raw_readl(addr + AU1550_MEM_SDCONFIGB);
300 div = (v & (1 << 31)) ? 1 : 2;
301 break;
302 case ALCHEMY_CPU_AU1000:
303 case ALCHEMY_CPU_AU1500:
304 case ALCHEMY_CPU_AU1100:
305 default:
306 div = 2;
307 break;
308 }
309
310 c = clk_register_fixed_factor(NULL, ALCHEMY_MEM_CLK, pn,
311 0, 1, div);
312 if (!IS_ERR(c))
313 clk_register_clkdev(c, ALCHEMY_MEM_CLK, NULL);
314 return c;
315}
316
317/* lrclk: external synchronous static bus clock ***********************/
318
319static struct clk __init *alchemy_clk_setup_lrclk(const char *pn)
320{
321 /* MEM_STCFG0[15:13] = divisor.
322 * L/RCLK = periph_clk / (divisor + 1)
323 * On Au1000, Au1500, Au1100 it's called LCLK,
324 * on later models it's called RCLK, but it's the same thing.
325 */
326 struct clk *c;
327 unsigned long v = alchemy_rdsmem(AU1000_MEM_STCFG0) >> 13;
328
329 v = (v & 7) + 1;
330 c = clk_register_fixed_factor(NULL, ALCHEMY_LR_CLK,
331 pn, 0, 1, v);
332 if (!IS_ERR(c))
333 clk_register_clkdev(c, ALCHEMY_LR_CLK, NULL);
334 return c;
335}
336
337/* Clock dividers and muxes *******************************************/
338
339/* data for fgen and csrc mux-dividers */
340struct alchemy_fgcs_clk {
341 struct clk_hw hw;
342 spinlock_t *reglock; /* register lock */
343 unsigned long reg; /* SYS_FREQCTRL0/1 */
344 int shift; /* offset in register */
345 int parent; /* parent before disable [Au1300] */
346 int isen; /* is it enabled? */
347 int *dt; /* dividertable for csrc */
348};
349#define to_fgcs_clk(x) container_of(x, struct alchemy_fgcs_clk, hw)
350
351static long alchemy_calc_div(unsigned long rate, unsigned long prate,
352 int scale, int maxdiv, unsigned long *rv)
353{
354 long div1, div2;
355
356 div1 = prate / rate;
357 if ((prate / div1) > rate)
358 div1++;
359
360 if (scale == 2) { /* only div-by-multiple-of-2 possible */
361 if (div1 & 1)
362 div1++; /* stay <=prate */
363 }
364
365 div2 = (div1 / scale) - 1; /* value to write to register */
366
367 if (div2 > maxdiv)
368 div2 = maxdiv;
369 if (rv)
370 *rv = div2;
371
372 div1 = ((div2 + 1) * scale);
373 return div1;
374}
375
376static long alchemy_clk_fgcs_detr(struct clk_hw *hw, unsigned long rate,
377 unsigned long *best_parent_rate,
378 struct clk **best_parent_clk,
379 int scale, int maxdiv)
380{
381 struct clk *pc, *bpc, *free;
382 long tdv, tpr, pr, nr, br, bpr, diff, lastdiff;
383 int j;
384
385 lastdiff = INT_MAX;
386 bpr = 0;
387 bpc = NULL;
388 br = -EINVAL;
389 free = NULL;
390
391 /* look at the rates each enabled parent supplies and select
392 * the one that gets closest to but not over the requested rate.
393 */
394 for (j = 0; j < 7; j++) {
395 pc = clk_get_parent_by_index(hw->clk, j);
396 if (!pc)
397 break;
398
399 /* if this parent is currently unused, remember it.
400 * XXX: I know it's a layering violation, but it works
401 * so well.. (if (!clk_has_active_children(pc)) )
402 */
403 if (pc->prepare_count == 0) {
404 if (!free)
405 free = pc;
406 }
407
408 pr = clk_get_rate(pc);
409 if (pr < rate)
410 continue;
411
412 /* what can hardware actually provide */
413 tdv = alchemy_calc_div(rate, pr, scale, maxdiv, NULL);
414 nr = pr / tdv;
415 diff = rate - nr;
416 if (nr > rate)
417 continue;
418
419 if (diff < lastdiff) {
420 lastdiff = diff;
421 bpr = pr;
422 bpc = pc;
423 br = nr;
424 }
425 if (diff == 0)
426 break;
427 }
428
429 /* if we couldn't get the exact rate we wanted from the enabled
430 * parents, maybe we can tell an available disabled/inactive one
431 * to give us a rate we can divide down to the requested rate.
432 */
433 if (lastdiff && free) {
434 for (j = (maxdiv == 4) ? 1 : scale; j <= maxdiv; j += scale) {
435 tpr = rate * j;
436 if (tpr < 0)
437 break;
438 pr = clk_round_rate(free, tpr);
439
440 tdv = alchemy_calc_div(rate, pr, scale, maxdiv, NULL);
441 nr = pr / tdv;
442 diff = rate - nr;
443 if (nr > rate)
444 continue;
445 if (diff < lastdiff) {
446 lastdiff = diff;
447 bpr = pr;
448 bpc = free;
449 br = nr;
450 }
451 if (diff == 0)
452 break;
453 }
454 }
455
456 *best_parent_rate = bpr;
457 *best_parent_clk = bpc;
458 return br;
459}
460
461static int alchemy_clk_fgv1_en(struct clk_hw *hw)
462{
463 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
464 unsigned long v, flags;
465
466 spin_lock_irqsave(c->reglock, flags);
467 v = alchemy_rdsys(c->reg);
468 v |= (1 << 1) << c->shift;
469 alchemy_wrsys(v, c->reg);
470 spin_unlock_irqrestore(c->reglock, flags);
471
472 return 0;
473}
474
475static int alchemy_clk_fgv1_isen(struct clk_hw *hw)
476{
477 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
478 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 1);
479
480 return v & 1;
481}
482
483static void alchemy_clk_fgv1_dis(struct clk_hw *hw)
484{
485 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
486 unsigned long v, flags;
487
488 spin_lock_irqsave(c->reglock, flags);
489 v = alchemy_rdsys(c->reg);
490 v &= ~((1 << 1) << c->shift);
491 alchemy_wrsys(v, c->reg);
492 spin_unlock_irqrestore(c->reglock, flags);
493}
494
495static int alchemy_clk_fgv1_setp(struct clk_hw *hw, u8 index)
496{
497 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
498 unsigned long v, flags;
499
500 spin_lock_irqsave(c->reglock, flags);
501 v = alchemy_rdsys(c->reg);
502 if (index)
503 v |= (1 << c->shift);
504 else
505 v &= ~(1 << c->shift);
506 alchemy_wrsys(v, c->reg);
507 spin_unlock_irqrestore(c->reglock, flags);
508
509 return 0;
510}
511
512static u8 alchemy_clk_fgv1_getp(struct clk_hw *hw)
513{
514 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
515
516 return (alchemy_rdsys(c->reg) >> c->shift) & 1;
517}
518
519static int alchemy_clk_fgv1_setr(struct clk_hw *hw, unsigned long rate,
520 unsigned long parent_rate)
521{
522 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
523 unsigned long div, v, flags, ret;
524 int sh = c->shift + 2;
525
526 if (!rate || !parent_rate || rate > (parent_rate / 2))
527 return -EINVAL;
528 ret = alchemy_calc_div(rate, parent_rate, 2, 512, &div);
529 spin_lock_irqsave(c->reglock, flags);
530 v = alchemy_rdsys(c->reg);
531 v &= ~(0xff << sh);
532 v |= div << sh;
533 alchemy_wrsys(v, c->reg);
534 spin_unlock_irqrestore(c->reglock, flags);
535
536 return 0;
537}
538
539static unsigned long alchemy_clk_fgv1_recalc(struct clk_hw *hw,
540 unsigned long parent_rate)
541{
542 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
543 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 2);
544
545 v = ((v & 0xff) + 1) * 2;
546 return parent_rate / v;
547}
548
549static long alchemy_clk_fgv1_detr(struct clk_hw *hw, unsigned long rate,
550 unsigned long *best_parent_rate,
551 struct clk **best_parent_clk)
552{
553 return alchemy_clk_fgcs_detr(hw, rate, best_parent_rate,
554 best_parent_clk, 2, 512);
555}
556
557/* Au1000, Au1100, Au15x0, Au12x0 */
558static struct clk_ops alchemy_clkops_fgenv1 = {
559 .recalc_rate = alchemy_clk_fgv1_recalc,
560 .determine_rate = alchemy_clk_fgv1_detr,
561 .set_rate = alchemy_clk_fgv1_setr,
562 .set_parent = alchemy_clk_fgv1_setp,
563 .get_parent = alchemy_clk_fgv1_getp,
564 .enable = alchemy_clk_fgv1_en,
565 .disable = alchemy_clk_fgv1_dis,
566 .is_enabled = alchemy_clk_fgv1_isen,
567};
568
569static void __alchemy_clk_fgv2_en(struct alchemy_fgcs_clk *c)
570{
571 unsigned long v = alchemy_rdsys(c->reg);
572
573 v &= ~(3 << c->shift);
574 v |= (c->parent & 3) << c->shift;
575 alchemy_wrsys(v, c->reg);
576 c->isen = 1;
577}
578
579static int alchemy_clk_fgv2_en(struct clk_hw *hw)
580{
581 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
582 unsigned long flags;
583
584 /* enable by setting the previous parent clock */
585 spin_lock_irqsave(c->reglock, flags);
586 __alchemy_clk_fgv2_en(c);
587 spin_unlock_irqrestore(c->reglock, flags);
588
589 return 0;
590}
591
592static int alchemy_clk_fgv2_isen(struct clk_hw *hw)
593{
594 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
595
596 return ((alchemy_rdsys(c->reg) >> c->shift) & 3) != 0;
597}
598
599static void alchemy_clk_fgv2_dis(struct clk_hw *hw)
600{
601 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
602 unsigned long v, flags;
603
604 spin_lock_irqsave(c->reglock, flags);
605 v = alchemy_rdsys(c->reg);
606 v &= ~(3 << c->shift); /* set input mux to "disabled" state */
607 alchemy_wrsys(v, c->reg);
608 c->isen = 0;
609 spin_unlock_irqrestore(c->reglock, flags);
610}
611
612static int alchemy_clk_fgv2_setp(struct clk_hw *hw, u8 index)
613{
614 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
615 unsigned long flags;
616
617 spin_lock_irqsave(c->reglock, flags);
618 c->parent = index + 1; /* value to write to register */
619 if (c->isen)
620 __alchemy_clk_fgv2_en(c);
621 spin_unlock_irqrestore(c->reglock, flags);
622
623 return 0;
624}
625
626static u8 alchemy_clk_fgv2_getp(struct clk_hw *hw)
627{
628 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
629 unsigned long flags, v;
630
631 spin_lock_irqsave(c->reglock, flags);
632 v = c->parent - 1;
633 spin_unlock_irqrestore(c->reglock, flags);
634 return v;
635}
636
637/* fg0-2 and fg4-6 share a "scale"-bit. With this bit cleared, the
638 * dividers behave exactly as on previous models (dividers are multiples
639 * of 2); with the bit set, dividers are multiples of 1, halving their
640 * range, but making them also much more flexible.
641 */
642static int alchemy_clk_fgv2_setr(struct clk_hw *hw, unsigned long rate,
643 unsigned long parent_rate)
644{
645 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
646 int sh = c->shift + 2;
647 unsigned long div, v, flags, ret;
648
649 if (!rate || !parent_rate || rate > parent_rate)
650 return -EINVAL;
651
652 v = alchemy_rdsys(c->reg) & (1 << 30); /* test "scale" bit */
653 ret = alchemy_calc_div(rate, parent_rate, v ? 1 : 2,
654 v ? 256 : 512, &div);
655
656 spin_lock_irqsave(c->reglock, flags);
657 v = alchemy_rdsys(c->reg);
658 v &= ~(0xff << sh);
659 v |= (div & 0xff) << sh;
660 alchemy_wrsys(v, c->reg);
661 spin_unlock_irqrestore(c->reglock, flags);
662
663 return 0;
664}
665
666static unsigned long alchemy_clk_fgv2_recalc(struct clk_hw *hw,
667 unsigned long parent_rate)
668{
669 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
670 int sh = c->shift + 2;
671 unsigned long v, t;
672
673 v = alchemy_rdsys(c->reg);
674 t = parent_rate / (((v >> sh) & 0xff) + 1);
675 if ((v & (1 << 30)) == 0) /* test scale bit */
676 t /= 2;
677
678 return t;
679}
680
681static long alchemy_clk_fgv2_detr(struct clk_hw *hw, unsigned long rate,
682 unsigned long *best_parent_rate,
683 struct clk **best_parent_clk)
684{
685 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
686 int scale, maxdiv;
687
688 if (alchemy_rdsys(c->reg) & (1 << 30)) {
689 scale = 1;
690 maxdiv = 256;
691 } else {
692 scale = 2;
693 maxdiv = 512;
694 }
695
696 return alchemy_clk_fgcs_detr(hw, rate, best_parent_rate,
697 best_parent_clk, scale, maxdiv);
698}
699
700/* Au1300 larger input mux, no separate disable bit, flexible divider */
701static struct clk_ops alchemy_clkops_fgenv2 = {
702 .recalc_rate = alchemy_clk_fgv2_recalc,
703 .determine_rate = alchemy_clk_fgv2_detr,
704 .set_rate = alchemy_clk_fgv2_setr,
705 .set_parent = alchemy_clk_fgv2_setp,
706 .get_parent = alchemy_clk_fgv2_getp,
707 .enable = alchemy_clk_fgv2_en,
708 .disable = alchemy_clk_fgv2_dis,
709 .is_enabled = alchemy_clk_fgv2_isen,
710};
711
712static const char * const alchemy_clk_fgv1_parents[] = {
713 ALCHEMY_CPU_CLK, ALCHEMY_AUXPLL_CLK
714};
715
716static const char * const alchemy_clk_fgv2_parents[] = {
717 ALCHEMY_AUXPLL2_CLK, ALCHEMY_CPU_CLK, ALCHEMY_AUXPLL_CLK
718};
719
720static const char * const alchemy_clk_fgen_names[] = {
721 ALCHEMY_FG0_CLK, ALCHEMY_FG1_CLK, ALCHEMY_FG2_CLK,
722 ALCHEMY_FG3_CLK, ALCHEMY_FG4_CLK, ALCHEMY_FG5_CLK };
723
724static int __init alchemy_clk_init_fgens(int ctype)
725{
726 struct clk *c;
727 struct clk_init_data id;
728 struct alchemy_fgcs_clk *a;
729 unsigned long v;
730 int i, ret;
731
732 switch (ctype) {
733 case ALCHEMY_CPU_AU1000...ALCHEMY_CPU_AU1200:
734 id.ops = &alchemy_clkops_fgenv1;
735 id.parent_names = (const char **)alchemy_clk_fgv1_parents;
736 id.num_parents = 2;
737 break;
738 case ALCHEMY_CPU_AU1300:
739 id.ops = &alchemy_clkops_fgenv2;
740 id.parent_names = (const char **)alchemy_clk_fgv2_parents;
741 id.num_parents = 3;
742 break;
743 default:
744 return -ENODEV;
745 }
746 id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE;
747
748 a = kzalloc((sizeof(*a)) * 6, GFP_KERNEL);
749 if (!a)
750 return -ENOMEM;
751
752 spin_lock_init(&alchemy_clk_fg0_lock);
753 spin_lock_init(&alchemy_clk_fg1_lock);
754 ret = 0;
755 for (i = 0; i < 6; i++) {
756 id.name = alchemy_clk_fgen_names[i];
757 a->shift = 10 * (i < 3 ? i : i - 3);
758 if (i > 2) {
759 a->reg = AU1000_SYS_FREQCTRL1;
760 a->reglock = &alchemy_clk_fg1_lock;
761 } else {
762 a->reg = AU1000_SYS_FREQCTRL0;
763 a->reglock = &alchemy_clk_fg0_lock;
764 }
765
766 /* default to first parent if bootloader has set
767 * the mux to disabled state.
768 */
769 if (ctype == ALCHEMY_CPU_AU1300) {
770 v = alchemy_rdsys(a->reg);
771 a->parent = (v >> a->shift) & 3;
772 if (!a->parent) {
773 a->parent = 1;
774 a->isen = 0;
775 } else
776 a->isen = 1;
777 }
778
779 a->hw.init = &id;
780 c = clk_register(NULL, &a->hw);
781 if (IS_ERR(c))
782 ret++;
783 else
784 clk_register_clkdev(c, id.name, NULL);
785 a++;
786 }
787
788 return ret;
789}
790
791/* internal sources muxes *********************************************/
792
793static int alchemy_clk_csrc_isen(struct clk_hw *hw)
794{
795 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
796 unsigned long v = alchemy_rdsys(c->reg);
797
798 return (((v >> c->shift) >> 2) & 7) != 0;
799}
800
801static void __alchemy_clk_csrc_en(struct alchemy_fgcs_clk *c)
802{
803 unsigned long v = alchemy_rdsys(c->reg);
804
805 v &= ~((7 << 2) << c->shift);
806 v |= ((c->parent & 7) << 2) << c->shift;
807 alchemy_wrsys(v, c->reg);
808 c->isen = 1;
809}
810
811static int alchemy_clk_csrc_en(struct clk_hw *hw)
812{
813 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
814 unsigned long flags;
815
816 /* enable by setting the previous parent clock */
817 spin_lock_irqsave(c->reglock, flags);
818 __alchemy_clk_csrc_en(c);
819 spin_unlock_irqrestore(c->reglock, flags);
820
821 return 0;
822}
823
824static void alchemy_clk_csrc_dis(struct clk_hw *hw)
825{
826 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
827 unsigned long v, flags;
828
829 spin_lock_irqsave(c->reglock, flags);
830 v = alchemy_rdsys(c->reg);
831 v &= ~((3 << 2) << c->shift); /* mux to "disabled" state */
832 alchemy_wrsys(v, c->reg);
833 c->isen = 0;
834 spin_unlock_irqrestore(c->reglock, flags);
835}
836
837static int alchemy_clk_csrc_setp(struct clk_hw *hw, u8 index)
838{
839 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
840 unsigned long flags;
841
842 spin_lock_irqsave(c->reglock, flags);
843 c->parent = index + 1; /* value to write to register */
844 if (c->isen)
845 __alchemy_clk_csrc_en(c);
846 spin_unlock_irqrestore(c->reglock, flags);
847
848 return 0;
849}
850
851static u8 alchemy_clk_csrc_getp(struct clk_hw *hw)
852{
853 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
854
855 return c->parent - 1;
856}
857
858static unsigned long alchemy_clk_csrc_recalc(struct clk_hw *hw,
859 unsigned long parent_rate)
860{
861 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
862 unsigned long v = (alchemy_rdsys(c->reg) >> c->shift) & 3;
863
864 return parent_rate / c->dt[v];
865}
866
867static int alchemy_clk_csrc_setr(struct clk_hw *hw, unsigned long rate,
868 unsigned long parent_rate)
869{
870 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
871 unsigned long d, v, flags;
872 int i;
873
874 if (!rate || !parent_rate || rate > parent_rate)
875 return -EINVAL;
876
877 d = (parent_rate + (rate / 2)) / rate;
878 if (d > 4)
879 return -EINVAL;
880 if ((d == 3) && (c->dt[2] != 3))
881 d = 4;
882
883 for (i = 0; i < 4; i++)
884 if (c->dt[i] == d)
885 break;
886
887 if (i >= 4)
888 return -EINVAL; /* oops */
889
890 spin_lock_irqsave(c->reglock, flags);
891 v = alchemy_rdsys(c->reg);
892 v &= ~(3 << c->shift);
893 v |= (i & 3) << c->shift;
894 alchemy_wrsys(v, c->reg);
895 spin_unlock_irqrestore(c->reglock, flags);
896
897 return 0;
898}
899
900static long alchemy_clk_csrc_detr(struct clk_hw *hw, unsigned long rate,
901 unsigned long *best_parent_rate,
902 struct clk **best_parent_clk)
903{
904 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw);
905 int scale = c->dt[2] == 3 ? 1 : 2; /* au1300 check */
906
907 return alchemy_clk_fgcs_detr(hw, rate, best_parent_rate,
908 best_parent_clk, scale, 4);
909}
910
911static struct clk_ops alchemy_clkops_csrc = {
912 .recalc_rate = alchemy_clk_csrc_recalc,
913 .determine_rate = alchemy_clk_csrc_detr,
914 .set_rate = alchemy_clk_csrc_setr,
915 .set_parent = alchemy_clk_csrc_setp,
916 .get_parent = alchemy_clk_csrc_getp,
917 .enable = alchemy_clk_csrc_en,
918 .disable = alchemy_clk_csrc_dis,
919 .is_enabled = alchemy_clk_csrc_isen,
920};
921
922static const char * const alchemy_clk_csrc_parents[] = {
923 /* disabled at index 0 */ ALCHEMY_AUXPLL_CLK,
924 ALCHEMY_FG0_CLK, ALCHEMY_FG1_CLK, ALCHEMY_FG2_CLK,
925 ALCHEMY_FG3_CLK, ALCHEMY_FG4_CLK, ALCHEMY_FG5_CLK
926};
927
928/* divider tables */
929static int alchemy_csrc_dt1[] = { 1, 4, 1, 2 }; /* rest */
930static int alchemy_csrc_dt2[] = { 1, 4, 3, 2 }; /* Au1300 */
931
932static int __init alchemy_clk_setup_imux(int ctype)
933{
934 struct alchemy_fgcs_clk *a;
935 const char * const *names;
936 struct clk_init_data id;
937 unsigned long v;
938 int i, ret, *dt;
939 struct clk *c;
940
941 id.ops = &alchemy_clkops_csrc;
942 id.parent_names = (const char **)alchemy_clk_csrc_parents;
943 id.num_parents = 7;
944 id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE;
945
946 dt = alchemy_csrc_dt1;
947 switch (ctype) {
948 case ALCHEMY_CPU_AU1000:
949 names = alchemy_au1000_intclknames;
950 break;
951 case ALCHEMY_CPU_AU1500:
952 names = alchemy_au1500_intclknames;
953 break;
954 case ALCHEMY_CPU_AU1100:
955 names = alchemy_au1100_intclknames;
956 break;
957 case ALCHEMY_CPU_AU1550:
958 names = alchemy_au1550_intclknames;
959 break;
960 case ALCHEMY_CPU_AU1200:
961 names = alchemy_au1200_intclknames;
962 break;
963 case ALCHEMY_CPU_AU1300:
964 dt = alchemy_csrc_dt2;
965 names = alchemy_au1300_intclknames;
966 break;
967 default:
968 return -ENODEV;
969 }
970
971 a = kzalloc((sizeof(*a)) * 6, GFP_KERNEL);
972 if (!a)
973 return -ENOMEM;
974
975 spin_lock_init(&alchemy_clk_csrc_lock);
976 ret = 0;
977
978 for (i = 0; i < 6; i++) {
979 id.name = names[i];
980 if (!id.name)
981 goto next;
982
983 a->shift = i * 5;
984 a->reg = AU1000_SYS_CLKSRC;
985 a->reglock = &alchemy_clk_csrc_lock;
986 a->dt = dt;
987
988 /* default to first parent clock if mux is initially
989 * set to disabled state.
990 */
991 v = alchemy_rdsys(a->reg);
992 a->parent = ((v >> a->shift) >> 2) & 7;
993 if (!a->parent) {
994 a->parent = 1;
995 a->isen = 0;
996 } else
997 a->isen = 1;
998
999 a->hw.init = &id;
1000 c = clk_register(NULL, &a->hw);
1001 if (IS_ERR(c))
1002 ret++;
1003 else
1004 clk_register_clkdev(c, id.name, NULL);
1005next:
1006 a++;
1007 }
1008
1009 return ret;
1010}
1011
1012
1013/**********************************************************************/
1014
1015
1016#define ERRCK(x) \
1017 if (IS_ERR(x)) { \
1018 ret = PTR_ERR(x); \
1019 goto out; \
1020 }
1021
1022static int __init alchemy_clk_init(void)
1023{
1024 int ctype = alchemy_get_cputype(), ret, i;
1025 struct clk_aliastable *t = alchemy_clk_aliases;
1026 struct clk *c;
1027
1028 /* Root of the Alchemy clock tree: external 12MHz crystal osc */
1029 c = clk_register_fixed_rate(NULL, ALCHEMY_ROOT_CLK, NULL,
1030 CLK_IS_ROOT,
1031 ALCHEMY_ROOTCLK_RATE);
1032 ERRCK(c)
1033
1034 /* CPU core clock */
1035 c = alchemy_clk_setup_cpu(ALCHEMY_ROOT_CLK, ctype);
1036 ERRCK(c)
1037
1038 /* AUXPLLs: max 1GHz on Au1300, 748MHz on older models */
1039 i = (ctype == ALCHEMY_CPU_AU1300) ? 84 : 63;
1040 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK, ALCHEMY_AUXPLL_CLK,
1041 i, AU1000_SYS_AUXPLL);
1042 ERRCK(c)
1043
1044 if (ctype == ALCHEMY_CPU_AU1300) {
1045 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK,
1046 ALCHEMY_AUXPLL2_CLK, i,
1047 AU1300_SYS_AUXPLL2);
1048 ERRCK(c)
1049 }
1050
1051 /* sysbus clock: cpu core clock divided by 2, 3 or 4 */
1052 c = alchemy_clk_setup_sysbus(ALCHEMY_CPU_CLK);
1053 ERRCK(c)
1054
1055 /* peripheral clock: runs at half rate of sysbus clk */
1056 c = alchemy_clk_setup_periph(ALCHEMY_SYSBUS_CLK);
1057 ERRCK(c)
1058
1059 /* SDR/DDR memory clock */
1060 c = alchemy_clk_setup_mem(ALCHEMY_SYSBUS_CLK, ctype);
1061 ERRCK(c)
1062
1063 /* L/RCLK: external static bus clock for synchronous mode */
1064 c = alchemy_clk_setup_lrclk(ALCHEMY_PERIPH_CLK);
1065 ERRCK(c)
1066
1067 /* Frequency dividers 0-5 */
1068 ret = alchemy_clk_init_fgens(ctype);
1069 if (ret) {
1070 ret = -ENODEV;
1071 goto out;
1072 }
1073
1074 /* diving muxes for internal sources */
1075 ret = alchemy_clk_setup_imux(ctype);
1076 if (ret) {
1077 ret = -ENODEV;
1078 goto out;
1079 }
1080
1081 /* set up aliases drivers might look for */
1082 while (t->base) {
1083 if (t->cputype == ctype)
1084 clk_add_alias(t->alias, NULL, t->base, NULL);
1085 t++;
1086 }
1087
1088 pr_info("Alchemy clocktree installed\n");
1089 return 0;
1090
1091out:
1092 return ret;
1093}
1094postcore_initcall(alchemy_clk_init);
diff --git a/arch/mips/alchemy/common/clocks.c b/arch/mips/alchemy/common/clocks.c
deleted file mode 100644
index f38298a8b98c..000000000000
--- a/arch/mips/alchemy/common/clocks.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1xx0 clocks routines.
4 *
5 * Copyright 2001, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. <source@mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#include <linux/module.h>
30#include <linux/spinlock.h>
31#include <asm/time.h>
32#include <asm/mach-au1x00/au1000.h>
33
34/*
35 * I haven't found anyone that doesn't use a 12 MHz source clock,
36 * but just in case.....
37 */
38#define AU1000_SRC_CLK 12000000
39
40static unsigned int au1x00_clock; /* Hz */
41static unsigned long uart_baud_base;
42
43/*
44 * Set the au1000_clock
45 */
46void set_au1x00_speed(unsigned int new_freq)
47{
48 au1x00_clock = new_freq;
49}
50
51unsigned int get_au1x00_speed(void)
52{
53 return au1x00_clock;
54}
55EXPORT_SYMBOL(get_au1x00_speed);
56
57/*
58 * The UART baud base is not known at compile time ... if
59 * we want to be able to use the same code on different
60 * speed CPUs.
61 */
62unsigned long get_au1x00_uart_baud_base(void)
63{
64 return uart_baud_base;
65}
66
67void set_au1x00_uart_baud_base(unsigned long new_baud_base)
68{
69 uart_baud_base = new_baud_base;
70}
71
72/*
73 * We read the real processor speed from the PLL. This is important
74 * because it is more accurate than computing it from the 32 KHz
75 * counter, if it exists. If we don't have an accurate processor
76 * speed, all of the peripherals that derive their clocks based on
77 * this advertised speed will introduce error and sometimes not work
78 * properly. This function is further convoluted to still allow configurations
79 * to do that in case they have really, really old silicon with a
80 * write-only PLL register. -- Dan
81 */
82unsigned long au1xxx_calc_clock(void)
83{
84 unsigned long cpu_speed;
85
86 /*
87 * On early Au1000, sys_cpupll was write-only. Since these
88 * silicon versions of Au1000 are not sold by AMD, we don't bend
89 * over backwards trying to determine the frequency.
90 */
91 if (au1xxx_cpu_has_pll_wo())
92 cpu_speed = 396000000;
93 else
94 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
95
96 /* On Alchemy CPU:counter ratio is 1:1 */
97 mips_hpt_frequency = cpu_speed;
98 /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */
99 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)
100 & 0x03) + 2) * 16));
101
102 set_au1x00_speed(cpu_speed);
103
104 return cpu_speed;
105}
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 19d5642c16d9..745695db5ba0 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -341,7 +341,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
341 (dtp->dev_flags & DEV_FLAGS_SYNC)) 341 (dtp->dev_flags & DEV_FLAGS_SYNC))
342 i |= DDMA_CFG_SYNC; 342 i |= DDMA_CFG_SYNC;
343 cp->ddma_cfg = i; 343 cp->ddma_cfg = i;
344 au_sync(); 344 wmb(); /* drain writebuffer */
345 345
346 /* 346 /*
347 * Return a non-zero value that can be used to find the channel 347 * Return a non-zero value that can be used to find the channel
@@ -631,7 +631,7 @@ u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
631 */ 631 */
632 dma_cache_wback_inv((unsigned long)buf, nbytes); 632 dma_cache_wback_inv((unsigned long)buf, nbytes);
633 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 633 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
634 au_sync(); 634 wmb(); /* drain writebuffer */
635 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp)); 635 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
636 ctp->chan_ptr->ddma_dbell = 0; 636 ctp->chan_ptr->ddma_dbell = 0;
637 637
@@ -693,7 +693,7 @@ u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
693 */ 693 */
694 dma_cache_inv((unsigned long)buf, nbytes); 694 dma_cache_inv((unsigned long)buf, nbytes);
695 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 695 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
696 au_sync(); 696 wmb(); /* drain writebuffer */
697 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp)); 697 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
698 ctp->chan_ptr->ddma_dbell = 0; 698 ctp->chan_ptr->ddma_dbell = 0;
699 699
@@ -760,7 +760,7 @@ void au1xxx_dbdma_stop(u32 chanid)
760 760
761 cp = ctp->chan_ptr; 761 cp = ctp->chan_ptr;
762 cp->ddma_cfg &= ~DDMA_CFG_EN; /* Disable channel */ 762 cp->ddma_cfg &= ~DDMA_CFG_EN; /* Disable channel */
763 au_sync(); 763 wmb(); /* drain writebuffer */
764 while (!(cp->ddma_stat & DDMA_STAT_H)) { 764 while (!(cp->ddma_stat & DDMA_STAT_H)) {
765 udelay(1); 765 udelay(1);
766 halt_timeout++; 766 halt_timeout++;
@@ -771,7 +771,7 @@ void au1xxx_dbdma_stop(u32 chanid)
771 } 771 }
772 /* clear current desc valid and doorbell */ 772 /* clear current desc valid and doorbell */
773 cp->ddma_stat |= (DDMA_STAT_DB | DDMA_STAT_V); 773 cp->ddma_stat |= (DDMA_STAT_DB | DDMA_STAT_V);
774 au_sync(); 774 wmb(); /* drain writebuffer */
775} 775}
776EXPORT_SYMBOL(au1xxx_dbdma_stop); 776EXPORT_SYMBOL(au1xxx_dbdma_stop);
777 777
@@ -789,9 +789,9 @@ void au1xxx_dbdma_start(u32 chanid)
789 cp = ctp->chan_ptr; 789 cp = ctp->chan_ptr;
790 cp->ddma_desptr = virt_to_phys(ctp->cur_ptr); 790 cp->ddma_desptr = virt_to_phys(ctp->cur_ptr);
791 cp->ddma_cfg |= DDMA_CFG_EN; /* Enable channel */ 791 cp->ddma_cfg |= DDMA_CFG_EN; /* Enable channel */
792 au_sync(); 792 wmb(); /* drain writebuffer */
793 cp->ddma_dbell = 0; 793 cp->ddma_dbell = 0;
794 au_sync(); 794 wmb(); /* drain writebuffer */
795} 795}
796EXPORT_SYMBOL(au1xxx_dbdma_start); 796EXPORT_SYMBOL(au1xxx_dbdma_start);
797 797
@@ -832,7 +832,7 @@ u32 au1xxx_get_dma_residue(u32 chanid)
832 832
833 /* This is only valid if the channel is stopped. */ 833 /* This is only valid if the channel is stopped. */
834 rv = cp->ddma_bytecnt; 834 rv = cp->ddma_bytecnt;
835 au_sync(); 835 wmb(); /* drain writebuffer */
836 836
837 return rv; 837 return rv;
838} 838}
@@ -868,7 +868,7 @@ static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
868 au1x_dma_chan_t *cp; 868 au1x_dma_chan_t *cp;
869 869
870 intstat = dbdma_gptr->ddma_intstat; 870 intstat = dbdma_gptr->ddma_intstat;
871 au_sync(); 871 wmb(); /* drain writebuffer */
872 chan_index = __ffs(intstat); 872 chan_index = __ffs(intstat);
873 873
874 ctp = chan_tab_ptr[chan_index]; 874 ctp = chan_tab_ptr[chan_index];
@@ -877,7 +877,7 @@ static irqreturn_t dbdma_interrupt(int irq, void *dev_id)
877 877
878 /* Reset interrupt. */ 878 /* Reset interrupt. */
879 cp->ddma_irq = 0; 879 cp->ddma_irq = 0;
880 au_sync(); 880 wmb(); /* drain writebuffer */
881 881
882 if (ctp->chan_callback) 882 if (ctp->chan_callback)
883 ctp->chan_callback(irq, ctp->chan_callparam); 883 ctp->chan_callback(irq, ctp->chan_callparam);
@@ -1061,7 +1061,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)
1061 dbdma_gptr->ddma_config = 0; 1061 dbdma_gptr->ddma_config = 0;
1062 dbdma_gptr->ddma_throttle = 0; 1062 dbdma_gptr->ddma_throttle = 0;
1063 dbdma_gptr->ddma_inten = 0xffff; 1063 dbdma_gptr->ddma_inten = 0xffff;
1064 au_sync(); 1064 wmb(); /* drain writebuffer */
1065 1065
1066 ret = request_irq(irq, dbdma_interrupt, 0, "dbdma", (void *)dbdma_gptr); 1066 ret = request_irq(irq, dbdma_interrupt, 0, "dbdma", (void *)dbdma_gptr);
1067 if (ret) 1067 if (ret)
diff --git a/arch/mips/alchemy/common/dma.c b/arch/mips/alchemy/common/dma.c
index 9b624e2c0fcf..4fb6207b883b 100644
--- a/arch/mips/alchemy/common/dma.c
+++ b/arch/mips/alchemy/common/dma.c
@@ -141,17 +141,17 @@ void dump_au1000_dma_channel(unsigned int dmanr)
141 141
142 printk(KERN_INFO "Au1000 DMA%d Register Dump:\n", dmanr); 142 printk(KERN_INFO "Au1000 DMA%d Register Dump:\n", dmanr);
143 printk(KERN_INFO " mode = 0x%08x\n", 143 printk(KERN_INFO " mode = 0x%08x\n",
144 au_readl(chan->io + DMA_MODE_SET)); 144 __raw_readl(chan->io + DMA_MODE_SET));
145 printk(KERN_INFO " addr = 0x%08x\n", 145 printk(KERN_INFO " addr = 0x%08x\n",
146 au_readl(chan->io + DMA_PERIPHERAL_ADDR)); 146 __raw_readl(chan->io + DMA_PERIPHERAL_ADDR));
147 printk(KERN_INFO " start0 = 0x%08x\n", 147 printk(KERN_INFO " start0 = 0x%08x\n",
148 au_readl(chan->io + DMA_BUFFER0_START)); 148 __raw_readl(chan->io + DMA_BUFFER0_START));
149 printk(KERN_INFO " start1 = 0x%08x\n", 149 printk(KERN_INFO " start1 = 0x%08x\n",
150 au_readl(chan->io + DMA_BUFFER1_START)); 150 __raw_readl(chan->io + DMA_BUFFER1_START));
151 printk(KERN_INFO " count0 = 0x%08x\n", 151 printk(KERN_INFO " count0 = 0x%08x\n",
152 au_readl(chan->io + DMA_BUFFER0_COUNT)); 152 __raw_readl(chan->io + DMA_BUFFER0_COUNT));
153 printk(KERN_INFO " count1 = 0x%08x\n", 153 printk(KERN_INFO " count1 = 0x%08x\n",
154 au_readl(chan->io + DMA_BUFFER1_COUNT)); 154 __raw_readl(chan->io + DMA_BUFFER1_COUNT));
155} 155}
156 156
157/* 157/*
@@ -204,7 +204,8 @@ int request_au1000_dma(int dev_id, const char *dev_str,
204 } 204 }
205 205
206 /* fill it in */ 206 /* fill it in */
207 chan->io = KSEG1ADDR(AU1000_DMA_PHYS_ADDR) + i * DMA_CHANNEL_LEN; 207 chan->io = (void __iomem *)(KSEG1ADDR(AU1000_DMA_PHYS_ADDR) +
208 i * DMA_CHANNEL_LEN);
208 chan->dev_id = dev_id; 209 chan->dev_id = dev_id;
209 chan->dev_str = dev_str; 210 chan->dev_str = dev_str;
210 chan->fifo_addr = dev->fifo_addr; 211 chan->fifo_addr = dev->fifo_addr;
diff --git a/arch/mips/alchemy/common/irq.c b/arch/mips/alchemy/common/irq.c
index 63a71817a00c..6cb60abfdcc9 100644
--- a/arch/mips/alchemy/common/irq.c
+++ b/arch/mips/alchemy/common/irq.c
@@ -389,13 +389,12 @@ static int au1x_ic1_setwake(struct irq_data *d, unsigned int on)
389 return -EINVAL; 389 return -EINVAL;
390 390
391 local_irq_save(flags); 391 local_irq_save(flags);
392 wakemsk = __raw_readl((void __iomem *)SYS_WAKEMSK); 392 wakemsk = alchemy_rdsys(AU1000_SYS_WAKEMSK);
393 if (on) 393 if (on)
394 wakemsk |= 1 << bit; 394 wakemsk |= 1 << bit;
395 else 395 else
396 wakemsk &= ~(1 << bit); 396 wakemsk &= ~(1 << bit);
397 __raw_writel(wakemsk, (void __iomem *)SYS_WAKEMSK); 397 alchemy_wrsys(wakemsk, AU1000_SYS_WAKEMSK);
398 wmb();
399 local_irq_restore(flags); 398 local_irq_restore(flags);
400 399
401 return 0; 400 return 0;
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 9837a134a6d6..d77a64f4c78b 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -11,6 +11,7 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/clk.h>
14#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
15#include <linux/etherdevice.h> 16#include <linux/etherdevice.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -99,10 +100,20 @@ static struct platform_device au1xx0_uart_device = {
99 100
100static void __init alchemy_setup_uarts(int ctype) 101static void __init alchemy_setup_uarts(int ctype)
101{ 102{
102 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 103 long uartclk;
103 int s = sizeof(struct plat_serial8250_port); 104 int s = sizeof(struct plat_serial8250_port);
104 int c = alchemy_get_uarts(ctype); 105 int c = alchemy_get_uarts(ctype);
105 struct plat_serial8250_port *ports; 106 struct plat_serial8250_port *ports;
107 struct clk *clk = clk_get(NULL, ALCHEMY_PERIPH_CLK);
108
109 if (IS_ERR(clk))
110 return;
111 if (clk_prepare_enable(clk)) {
112 clk_put(clk);
113 return;
114 }
115 uartclk = clk_get_rate(clk);
116 clk_put(clk);
106 117
107 ports = kzalloc(s * (c + 1), GFP_KERNEL); 118 ports = kzalloc(s * (c + 1), GFP_KERNEL);
108 if (!ports) { 119 if (!ports) {
@@ -420,7 +431,7 @@ static void __init alchemy_setup_macs(int ctype)
420 memcpy(au1xxx_eth1_platform_data.mac, ethaddr, 6); 431 memcpy(au1xxx_eth1_platform_data.mac, ethaddr, 6);
421 432
422 /* Register second MAC if enabled in pinfunc */ 433 /* Register second MAC if enabled in pinfunc */
423 if (!(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) { 434 if (!(alchemy_rdsys(AU1000_SYS_PINFUNC) & SYS_PF_NI2)) {
424 ret = platform_device_register(&au1xxx_eth1_device); 435 ret = platform_device_register(&au1xxx_eth1_device);
425 if (ret) 436 if (ret)
426 printk(KERN_INFO "Alchemy: failed to register MAC1\n"); 437 printk(KERN_INFO "Alchemy: failed to register MAC1\n");
diff --git a/arch/mips/alchemy/common/power.c b/arch/mips/alchemy/common/power.c
index bdb28dee8fdd..921ed30b440c 100644
--- a/arch/mips/alchemy/common/power.c
+++ b/arch/mips/alchemy/common/power.c
@@ -54,28 +54,28 @@ static unsigned int sleep_static_memctlr[4][3];
54static void save_core_regs(void) 54static void save_core_regs(void)
55{ 55{
56 /* Clocks and PLLs. */ 56 /* Clocks and PLLs. */
57 sleep_sys_clocks[0] = au_readl(SYS_FREQCTRL0); 57 sleep_sys_clocks[0] = alchemy_rdsys(AU1000_SYS_FREQCTRL0);
58 sleep_sys_clocks[1] = au_readl(SYS_FREQCTRL1); 58 sleep_sys_clocks[1] = alchemy_rdsys(AU1000_SYS_FREQCTRL1);
59 sleep_sys_clocks[2] = au_readl(SYS_CLKSRC); 59 sleep_sys_clocks[2] = alchemy_rdsys(AU1000_SYS_CLKSRC);
60 sleep_sys_clocks[3] = au_readl(SYS_CPUPLL); 60 sleep_sys_clocks[3] = alchemy_rdsys(AU1000_SYS_CPUPLL);
61 sleep_sys_clocks[4] = au_readl(SYS_AUXPLL); 61 sleep_sys_clocks[4] = alchemy_rdsys(AU1000_SYS_AUXPLL);
62 62
63 /* pin mux config */ 63 /* pin mux config */
64 sleep_sys_pinfunc = au_readl(SYS_PINFUNC); 64 sleep_sys_pinfunc = alchemy_rdsys(AU1000_SYS_PINFUNC);
65 65
66 /* Save the static memory controller configuration. */ 66 /* Save the static memory controller configuration. */
67 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0); 67 sleep_static_memctlr[0][0] = alchemy_rdsmem(AU1000_MEM_STCFG0);
68 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0); 68 sleep_static_memctlr[0][1] = alchemy_rdsmem(AU1000_MEM_STTIME0);
69 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0); 69 sleep_static_memctlr[0][2] = alchemy_rdsmem(AU1000_MEM_STADDR0);
70 sleep_static_memctlr[1][0] = au_readl(MEM_STCFG1); 70 sleep_static_memctlr[1][0] = alchemy_rdsmem(AU1000_MEM_STCFG1);
71 sleep_static_memctlr[1][1] = au_readl(MEM_STTIME1); 71 sleep_static_memctlr[1][1] = alchemy_rdsmem(AU1000_MEM_STTIME1);
72 sleep_static_memctlr[1][2] = au_readl(MEM_STADDR1); 72 sleep_static_memctlr[1][2] = alchemy_rdsmem(AU1000_MEM_STADDR1);
73 sleep_static_memctlr[2][0] = au_readl(MEM_STCFG2); 73 sleep_static_memctlr[2][0] = alchemy_rdsmem(AU1000_MEM_STCFG2);
74 sleep_static_memctlr[2][1] = au_readl(MEM_STTIME2); 74 sleep_static_memctlr[2][1] = alchemy_rdsmem(AU1000_MEM_STTIME2);
75 sleep_static_memctlr[2][2] = au_readl(MEM_STADDR2); 75 sleep_static_memctlr[2][2] = alchemy_rdsmem(AU1000_MEM_STADDR2);
76 sleep_static_memctlr[3][0] = au_readl(MEM_STCFG3); 76 sleep_static_memctlr[3][0] = alchemy_rdsmem(AU1000_MEM_STCFG3);
77 sleep_static_memctlr[3][1] = au_readl(MEM_STTIME3); 77 sleep_static_memctlr[3][1] = alchemy_rdsmem(AU1000_MEM_STTIME3);
78 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3); 78 sleep_static_memctlr[3][2] = alchemy_rdsmem(AU1000_MEM_STADDR3);
79} 79}
80 80
81static void restore_core_regs(void) 81static void restore_core_regs(void)
@@ -85,30 +85,28 @@ static void restore_core_regs(void)
85 * one of those Au1000 with a write-only PLL, where we dont 85 * one of those Au1000 with a write-only PLL, where we dont
86 * have a valid value) 86 * have a valid value)
87 */ 87 */
88 au_writel(sleep_sys_clocks[0], SYS_FREQCTRL0); 88 alchemy_wrsys(sleep_sys_clocks[0], AU1000_SYS_FREQCTRL0);
89 au_writel(sleep_sys_clocks[1], SYS_FREQCTRL1); 89 alchemy_wrsys(sleep_sys_clocks[1], AU1000_SYS_FREQCTRL1);
90 au_writel(sleep_sys_clocks[2], SYS_CLKSRC); 90 alchemy_wrsys(sleep_sys_clocks[2], AU1000_SYS_CLKSRC);
91 au_writel(sleep_sys_clocks[4], SYS_AUXPLL); 91 alchemy_wrsys(sleep_sys_clocks[4], AU1000_SYS_AUXPLL);
92 if (!au1xxx_cpu_has_pll_wo()) 92 if (!au1xxx_cpu_has_pll_wo())
93 au_writel(sleep_sys_clocks[3], SYS_CPUPLL); 93 alchemy_wrsys(sleep_sys_clocks[3], AU1000_SYS_CPUPLL);
94 au_sync();
95 94
96 au_writel(sleep_sys_pinfunc, SYS_PINFUNC); 95 alchemy_wrsys(sleep_sys_pinfunc, AU1000_SYS_PINFUNC);
97 au_sync();
98 96
99 /* Restore the static memory controller configuration. */ 97 /* Restore the static memory controller configuration. */
100 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0); 98 alchemy_wrsmem(sleep_static_memctlr[0][0], AU1000_MEM_STCFG0);
101 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0); 99 alchemy_wrsmem(sleep_static_memctlr[0][1], AU1000_MEM_STTIME0);
102 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0); 100 alchemy_wrsmem(sleep_static_memctlr[0][2], AU1000_MEM_STADDR0);
103 au_writel(sleep_static_memctlr[1][0], MEM_STCFG1); 101 alchemy_wrsmem(sleep_static_memctlr[1][0], AU1000_MEM_STCFG1);
104 au_writel(sleep_static_memctlr[1][1], MEM_STTIME1); 102 alchemy_wrsmem(sleep_static_memctlr[1][1], AU1000_MEM_STTIME1);
105 au_writel(sleep_static_memctlr[1][2], MEM_STADDR1); 103 alchemy_wrsmem(sleep_static_memctlr[1][2], AU1000_MEM_STADDR1);
106 au_writel(sleep_static_memctlr[2][0], MEM_STCFG2); 104 alchemy_wrsmem(sleep_static_memctlr[2][0], AU1000_MEM_STCFG2);
107 au_writel(sleep_static_memctlr[2][1], MEM_STTIME2); 105 alchemy_wrsmem(sleep_static_memctlr[2][1], AU1000_MEM_STTIME2);
108 au_writel(sleep_static_memctlr[2][2], MEM_STADDR2); 106 alchemy_wrsmem(sleep_static_memctlr[2][2], AU1000_MEM_STADDR2);
109 au_writel(sleep_static_memctlr[3][0], MEM_STCFG3); 107 alchemy_wrsmem(sleep_static_memctlr[3][0], AU1000_MEM_STCFG3);
110 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3); 108 alchemy_wrsmem(sleep_static_memctlr[3][1], AU1000_MEM_STTIME3);
111 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3); 109 alchemy_wrsmem(sleep_static_memctlr[3][2], AU1000_MEM_STADDR3);
112} 110}
113 111
114void au_sleep(void) 112void au_sleep(void)
diff --git a/arch/mips/alchemy/common/setup.c b/arch/mips/alchemy/common/setup.c
index 8267e3c97721..ea8f41869e56 100644
--- a/arch/mips/alchemy/common/setup.c
+++ b/arch/mips/alchemy/common/setup.c
@@ -27,12 +27,9 @@
27 27
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/jiffies.h>
31#include <linux/module.h>
32 30
33#include <asm/dma-coherence.h> 31#include <asm/dma-coherence.h>
34#include <asm/mipsregs.h> 32#include <asm/mipsregs.h>
35#include <asm/time.h>
36 33
37#include <au1000.h> 34#include <au1000.h>
38 35
@@ -41,18 +38,6 @@ extern void set_cpuspec(void);
41 38
42void __init plat_mem_setup(void) 39void __init plat_mem_setup(void)
43{ 40{
44 unsigned long est_freq;
45
46 /* determine core clock */
47 est_freq = au1xxx_calc_clock();
48 est_freq += 5000; /* round */
49 est_freq -= est_freq % 10000;
50 printk(KERN_INFO "(PRId %08x) @ %lu.%02lu MHz\n", read_c0_prid(),
51 est_freq / 1000000, ((est_freq % 1000000) * 100) / 1000000);
52
53 /* this is faster than wasting cycles trying to approximate it */
54 preset_lpj = (est_freq >> 1) / HZ;
55
56 if (au1xxx_cpu_needs_config_od()) 41 if (au1xxx_cpu_needs_config_od())
57 /* Various early Au1xx0 errata corrected by this */ 42 /* Various early Au1xx0 errata corrected by this */
58 set_c0_config(1 << 19); /* Set Config[OD] */ 43 set_c0_config(1 << 19); /* Set Config[OD] */
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index 93fa586d52e2..50e17e13c18b 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -46,7 +46,7 @@
46 46
47static cycle_t au1x_counter1_read(struct clocksource *cs) 47static cycle_t au1x_counter1_read(struct clocksource *cs)
48{ 48{
49 return au_readl(SYS_RTCREAD); 49 return alchemy_rdsys(AU1000_SYS_RTCREAD);
50} 50}
51 51
52static struct clocksource au1x_counter1_clocksource = { 52static struct clocksource au1x_counter1_clocksource = {
@@ -60,12 +60,11 @@ static struct clocksource au1x_counter1_clocksource = {
60static int au1x_rtcmatch2_set_next_event(unsigned long delta, 60static int au1x_rtcmatch2_set_next_event(unsigned long delta,
61 struct clock_event_device *cd) 61 struct clock_event_device *cd)
62{ 62{
63 delta += au_readl(SYS_RTCREAD); 63 delta += alchemy_rdsys(AU1000_SYS_RTCREAD);
64 /* wait for register access */ 64 /* wait for register access */
65 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M21) 65 while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M21)
66 ; 66 ;
67 au_writel(delta, SYS_RTCMATCH2); 67 alchemy_wrsys(delta, AU1000_SYS_RTCMATCH2);
68 au_sync();
69 68
70 return 0; 69 return 0;
71} 70}
@@ -112,31 +111,29 @@ static int __init alchemy_time_init(unsigned int m2int)
112 * (the 32S bit seems to be stuck set to 1 once a single clock- 111 * (the 32S bit seems to be stuck set to 1 once a single clock-
113 * edge is detected, hence the timeouts). 112 * edge is detected, hence the timeouts).
114 */ 113 */
115 if (CNTR_OK != (au_readl(SYS_COUNTER_CNTRL) & CNTR_OK)) 114 if (CNTR_OK != (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & CNTR_OK))
116 goto cntr_err; 115 goto cntr_err;
117 116
118 /* 117 /*
119 * setup counter 1 (RTC) to tick at full speed 118 * setup counter 1 (RTC) to tick at full speed
120 */ 119 */
121 t = 0xffffff; 120 t = 0xffffff;
122 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && --t) 121 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_T1S) && --t)
123 asm volatile ("nop"); 122 asm volatile ("nop");
124 if (!t) 123 if (!t)
125 goto cntr_err; 124 goto cntr_err;
126 125
127 au_writel(0, SYS_RTCTRIM); /* 32.768 kHz */ 126 alchemy_wrsys(0, AU1000_SYS_RTCTRIM); /* 32.768 kHz */
128 au_sync();
129 127
130 t = 0xffffff; 128 t = 0xffffff;
131 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) 129 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_C1S) && --t)
132 asm volatile ("nop"); 130 asm volatile ("nop");
133 if (!t) 131 if (!t)
134 goto cntr_err; 132 goto cntr_err;
135 au_writel(0, SYS_RTCWRITE); 133 alchemy_wrsys(0, AU1000_SYS_RTCWRITE);
136 au_sync();
137 134
138 t = 0xffffff; 135 t = 0xffffff;
139 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) 136 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_C1S) && --t)
140 asm volatile ("nop"); 137 asm volatile ("nop");
141 if (!t) 138 if (!t)
142 goto cntr_err; 139 goto cntr_err;
diff --git a/arch/mips/alchemy/common/usb.c b/arch/mips/alchemy/common/usb.c
index d193dbea84a1..297805ade849 100644
--- a/arch/mips/alchemy/common/usb.c
+++ b/arch/mips/alchemy/common/usb.c
@@ -9,6 +9,7 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/clk.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/io.h> 14#include <linux/io.h>
14#include <linux/module.h> 15#include <linux/module.h>
@@ -387,10 +388,25 @@ static inline void au1200_usb_init(void)
387 udelay(1000); 388 udelay(1000);
388} 389}
389 390
390static inline void au1000_usb_init(unsigned long rb, int reg) 391static inline int au1000_usb_init(unsigned long rb, int reg)
391{ 392{
392 void __iomem *base = (void __iomem *)KSEG1ADDR(rb + reg); 393 void __iomem *base = (void __iomem *)KSEG1ADDR(rb + reg);
393 unsigned long r = __raw_readl(base); 394 unsigned long r = __raw_readl(base);
395 struct clk *c;
396
397 /* 48MHz check. Don't init if no one can provide it */
398 c = clk_get(NULL, "usbh_clk");
399 if (IS_ERR(c))
400 return -ENODEV;
401 if (clk_round_rate(c, 48000000) != 48000000) {
402 clk_put(c);
403 return -ENODEV;
404 }
405 if (clk_set_rate(c, 48000000)) {
406 clk_put(c);
407 return -ENODEV;
408 }
409 clk_put(c);
394 410
395#if defined(__BIG_ENDIAN) 411#if defined(__BIG_ENDIAN)
396 r |= USBHEN_BE; 412 r |= USBHEN_BE;
@@ -400,6 +416,8 @@ static inline void au1000_usb_init(unsigned long rb, int reg)
400 __raw_writel(r, base); 416 __raw_writel(r, base);
401 wmb(); 417 wmb();
402 udelay(1000); 418 udelay(1000);
419
420 return 0;
403} 421}
404 422
405 423
@@ -407,8 +425,15 @@ static inline void __au1xx0_ohci_control(int enable, unsigned long rb, int creg)
407{ 425{
408 void __iomem *base = (void __iomem *)KSEG1ADDR(rb); 426 void __iomem *base = (void __iomem *)KSEG1ADDR(rb);
409 unsigned long r = __raw_readl(base + creg); 427 unsigned long r = __raw_readl(base + creg);
428 struct clk *c = clk_get(NULL, "usbh_clk");
429
430 if (IS_ERR(c))
431 return;
410 432
411 if (enable) { 433 if (enable) {
434 if (clk_prepare_enable(c))
435 goto out;
436
412 __raw_writel(r | USBHEN_CE, base + creg); 437 __raw_writel(r | USBHEN_CE, base + creg);
413 wmb(); 438 wmb();
414 udelay(1000); 439 udelay(1000);
@@ -423,7 +448,10 @@ static inline void __au1xx0_ohci_control(int enable, unsigned long rb, int creg)
423 } else { 448 } else {
424 __raw_writel(r & ~(USBHEN_CE | USBHEN_E), base + creg); 449 __raw_writel(r & ~(USBHEN_CE | USBHEN_E), base + creg);
425 wmb(); 450 wmb();
451 clk_disable_unprepare(c);
426 } 452 }
453out:
454 clk_put(c);
427} 455}
428 456
429static inline int au1000_usb_control(int block, int enable, unsigned long rb, 457static inline int au1000_usb_control(int block, int enable, unsigned long rb,
@@ -457,11 +485,11 @@ int alchemy_usb_control(int block, int enable)
457 case ALCHEMY_CPU_AU1500: 485 case ALCHEMY_CPU_AU1500:
458 case ALCHEMY_CPU_AU1100: 486 case ALCHEMY_CPU_AU1100:
459 ret = au1000_usb_control(block, enable, 487 ret = au1000_usb_control(block, enable,
460 AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG); 488 AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG);
461 break; 489 break;
462 case ALCHEMY_CPU_AU1550: 490 case ALCHEMY_CPU_AU1550:
463 ret = au1000_usb_control(block, enable, 491 ret = au1000_usb_control(block, enable,
464 AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG); 492 AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG);
465 break; 493 break;
466 case ALCHEMY_CPU_AU1200: 494 case ALCHEMY_CPU_AU1200:
467 ret = au1200_usb_control(block, enable); 495 ret = au1200_usb_control(block, enable);
@@ -569,14 +597,18 @@ static struct syscore_ops alchemy_usb_pm_ops = {
569 597
570static int __init alchemy_usb_init(void) 598static int __init alchemy_usb_init(void)
571{ 599{
600 int ret = 0;
601
572 switch (alchemy_get_cputype()) { 602 switch (alchemy_get_cputype()) {
573 case ALCHEMY_CPU_AU1000: 603 case ALCHEMY_CPU_AU1000:
574 case ALCHEMY_CPU_AU1500: 604 case ALCHEMY_CPU_AU1500:
575 case ALCHEMY_CPU_AU1100: 605 case ALCHEMY_CPU_AU1100:
576 au1000_usb_init(AU1000_USB_OHCI_PHYS_ADDR, AU1000_OHCICFG); 606 ret = au1000_usb_init(AU1000_USB_OHCI_PHYS_ADDR,
607 AU1000_OHCICFG);
577 break; 608 break;
578 case ALCHEMY_CPU_AU1550: 609 case ALCHEMY_CPU_AU1550:
579 au1000_usb_init(AU1550_USB_OHCI_PHYS_ADDR, AU1550_OHCICFG); 610 ret = au1000_usb_init(AU1550_USB_OHCI_PHYS_ADDR,
611 AU1550_OHCICFG);
580 break; 612 break;
581 case ALCHEMY_CPU_AU1200: 613 case ALCHEMY_CPU_AU1200:
582 au1200_usb_init(); 614 au1200_usb_init();
@@ -586,8 +618,9 @@ static int __init alchemy_usb_init(void)
586 break; 618 break;
587 } 619 }
588 620
589 register_syscore_ops(&alchemy_usb_pm_ops); 621 if (!ret)
622 register_syscore_ops(&alchemy_usb_pm_ops);
590 623
591 return 0; 624 return ret;
592} 625}
593arch_initcall(alchemy_usb_init); 626arch_initcall(alchemy_usb_init);
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c
index 92dd929d4057..001102e197f1 100644
--- a/arch/mips/alchemy/devboards/db1000.c
+++ b/arch/mips/alchemy/devboards/db1000.c
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#include <linux/clk.h>
22#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
23#include <linux/gpio.h> 24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
@@ -496,6 +497,7 @@ int __init db1000_dev_setup(void)
496 int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); 497 int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
497 int c0, c1, d0, d1, s0, s1, flashsize = 32, twosocks = 1; 498 int c0, c1, d0, d1, s0, s1, flashsize = 32, twosocks = 1;
498 unsigned long pfc; 499 unsigned long pfc;
500 struct clk *c, *p;
499 501
500 if (board == BCSR_WHOAMI_DB1500) { 502 if (board == BCSR_WHOAMI_DB1500) {
501 c0 = AU1500_GPIO2_INT; 503 c0 = AU1500_GPIO2_INT;
@@ -518,14 +520,25 @@ int __init db1000_dev_setup(void)
518 gpio_direction_input(20); /* sd1 cd# */ 520 gpio_direction_input(20); /* sd1 cd# */
519 521
520 /* spi_gpio on SSI0 pins */ 522 /* spi_gpio on SSI0 pins */
521 pfc = __raw_readl((void __iomem *)SYS_PINFUNC); 523 pfc = alchemy_rdsys(AU1000_SYS_PINFUNC);
522 pfc |= (1 << 0); /* SSI0 pins as GPIOs */ 524 pfc |= (1 << 0); /* SSI0 pins as GPIOs */
523 __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); 525 alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
524 wmb();
525 526
526 spi_register_board_info(db1100_spi_info, 527 spi_register_board_info(db1100_spi_info,
527 ARRAY_SIZE(db1100_spi_info)); 528 ARRAY_SIZE(db1100_spi_info));
528 529
530 /* link LCD clock to AUXPLL */
531 p = clk_get(NULL, "auxpll_clk");
532 c = clk_get(NULL, "lcd_intclk");
533 if (!IS_ERR(c) && !IS_ERR(p)) {
534 clk_set_parent(c, p);
535 clk_set_rate(c, clk_get_rate(p));
536 }
537 if (!IS_ERR(c))
538 clk_put(c);
539 if (!IS_ERR(p))
540 clk_put(p);
541
529 platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); 542 platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs));
530 platform_device_register(&db1100_spi_dev); 543 platform_device_register(&db1100_spi_dev);
531 } else if (board == BCSR_WHOAMI_DB1000) { 544 } else if (board == BCSR_WHOAMI_DB1000) {
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
index 9e46667f2597..776188908dfc 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clk.h>
21#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/i2c.h> 24#include <linux/i2c.h>
@@ -129,7 +130,6 @@ static int __init db1200_detect_board(void)
129 130
130int __init db1200_board_setup(void) 131int __init db1200_board_setup(void)
131{ 132{
132 unsigned long freq0, clksrc, div, pfc;
133 unsigned short whoami; 133 unsigned short whoami;
134 134
135 if (db1200_detect_board()) 135 if (db1200_detect_board())
@@ -149,34 +149,6 @@ int __init db1200_board_setup(void)
149 " Board-ID %d Daughtercard ID %d\n", get_system_type(), 149 " Board-ID %d Daughtercard ID %d\n", get_system_type(),
150 (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); 150 (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
151 151
152 /* SMBus/SPI on PSC0, Audio on PSC1 */
153 pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
154 pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
155 pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
156 pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
157 __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
158 wmb();
159
160 /* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from
161 * CPU clock; all other clock generators off/unused.
162 */
163 div = (get_au1x00_speed() + 25000000) / 50000000;
164 if (div & 1)
165 div++;
166 div = ((div >> 1) - 1) & 0xff;
167
168 freq0 = div << SYS_FC_FRDIV0_BIT;
169 __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
170 wmb();
171 freq0 |= SYS_FC_FE0; /* enable F0 */
172 __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
173 wmb();
174
175 /* psc0_intclk comes 1:1 from F0 */
176 clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
177 __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
178 wmb();
179
180 return 0; 152 return 0;
181} 153}
182 154
@@ -250,7 +222,7 @@ static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
250 222
251static int au1200_nand_device_ready(struct mtd_info *mtd) 223static int au1200_nand_device_ready(struct mtd_info *mtd)
252{ 224{
253 return __raw_readl((void __iomem *)MEM_STSTAT) & 1; 225 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
254} 226}
255 227
256static struct mtd_partition db1200_nand_parts[] = { 228static struct mtd_partition db1200_nand_parts[] = {
@@ -847,6 +819,7 @@ int __init db1200_dev_setup(void)
847 unsigned long pfc; 819 unsigned long pfc;
848 unsigned short sw; 820 unsigned short sw;
849 int swapped, bid; 821 int swapped, bid;
822 struct clk *c;
850 823
851 bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); 824 bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
852 if ((bid == BCSR_WHOAMI_PB1200_DDR1) || 825 if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
@@ -859,6 +832,24 @@ int __init db1200_dev_setup(void)
859 irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW); 832 irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW);
860 bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT); 833 bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
861 834
835 /* SMBus/SPI on PSC0, Audio on PSC1 */
836 pfc = alchemy_rdsys(AU1000_SYS_PINFUNC);
837 pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
838 pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
839 pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
840 alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
841
842 /* get 50MHz for I2C driver on PSC0 */
843 c = clk_get(NULL, "psc0_intclk");
844 if (!IS_ERR(c)) {
845 pfc = clk_round_rate(c, 50000000);
846 if ((pfc < 1) || (abs(50000000 - pfc) > 2500000))
847 pr_warn("DB1200: cant get I2C close to 50MHz\n");
848 else
849 clk_set_rate(c, pfc);
850 clk_put(c);
851 }
852
862 /* insert/eject pairs: one of both is always screaming. To avoid 853 /* insert/eject pairs: one of both is always screaming. To avoid
863 * issues they must not be automatically enabled when initially 854 * issues they must not be automatically enabled when initially
864 * requested. 855 * requested.
@@ -886,7 +877,7 @@ int __init db1200_dev_setup(void)
886 * As a result, in SPI mode, OTG simply won't work (PSC0 uses 877 * As a result, in SPI mode, OTG simply won't work (PSC0 uses
887 * it as an input pin which is pulled high on the boards). 878 * it as an input pin which is pulled high on the boards).
888 */ 879 */
889 pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A; 880 pfc = alchemy_rdsys(AU1000_SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
890 881
891 /* switch off OTG VBUS supply */ 882 /* switch off OTG VBUS supply */
892 gpio_request(215, "otg-vbus"); 883 gpio_request(215, "otg-vbus");
@@ -912,8 +903,7 @@ int __init db1200_dev_setup(void)
912 printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n"); 903 printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
913 printk(KERN_INFO " OTG port VBUS supply disabled\n"); 904 printk(KERN_INFO " OTG port VBUS supply disabled\n");
914 } 905 }
915 __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); 906 alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
916 wmb();
917 907
918 /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S! 908 /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
919 * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S 909 * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
@@ -932,6 +922,11 @@ int __init db1200_dev_setup(void)
932 } 922 }
933 923
934 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ 924 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
925 c = clk_get(NULL, "psc1_intclk");
926 if (!IS_ERR(c)) {
927 clk_prepare_enable(c);
928 clk_put(c);
929 }
935 __raw_writel(PSC_SEL_CLK_SERCLK, 930 __raw_writel(PSC_SEL_CLK_SERCLK,
936 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 931 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
937 wmb(); 932 wmb();
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c
index 1aed6be4de10..ef93ee3f6a2c 100644
--- a/arch/mips/alchemy/devboards/db1300.c
+++ b/arch/mips/alchemy/devboards/db1300.c
@@ -4,6 +4,7 @@
4 * (c) 2009 Manuel Lauss <manuel.lauss@googlemail.com> 4 * (c) 2009 Manuel Lauss <manuel.lauss@googlemail.com>
5 */ 5 */
6 6
7#include <linux/clk.h>
7#include <linux/dma-mapping.h> 8#include <linux/dma-mapping.h>
8#include <linux/gpio.h> 9#include <linux/gpio.h>
9#include <linux/gpio_keys.h> 10#include <linux/gpio_keys.h>
@@ -169,7 +170,7 @@ static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
169 170
170static int au1300_nand_device_ready(struct mtd_info *mtd) 171static int au1300_nand_device_ready(struct mtd_info *mtd)
171{ 172{
172 return __raw_readl((void __iomem *)MEM_STSTAT) & 1; 173 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
173} 174}
174 175
175static struct mtd_partition db1300_nand_parts[] = { 176static struct mtd_partition db1300_nand_parts[] = {
@@ -731,6 +732,7 @@ static struct platform_device *db1300_dev[] __initdata = {
731int __init db1300_dev_setup(void) 732int __init db1300_dev_setup(void)
732{ 733{
733 int swapped, cpldirq; 734 int swapped, cpldirq;
735 struct clk *c;
734 736
735 /* setup CPLD IRQ muxer */ 737 /* setup CPLD IRQ muxer */
736 cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1); 738 cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1);
@@ -761,6 +763,11 @@ int __init db1300_dev_setup(void)
761 (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); 763 (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET);
762 wmb(); 764 wmb();
763 /* I2C uses internal 48MHz EXTCLK1 */ 765 /* I2C uses internal 48MHz EXTCLK1 */
766 c = clk_get(NULL, "psc3_intclk");
767 if (!IS_ERR(c)) {
768 clk_prepare_enable(c);
769 clk_put(c);
770 }
764 __raw_writel(PSC_SEL_CLK_INTCLK, 771 __raw_writel(PSC_SEL_CLK_INTCLK,
765 (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET); 772 (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET);
766 wmb(); 773 wmb();
diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c
index bbd8d9884702..7e89936f763e 100644
--- a/arch/mips/alchemy/devboards/db1550.c
+++ b/arch/mips/alchemy/devboards/db1550.c
@@ -4,6 +4,7 @@
4 * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com> 4 * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com>
5 */ 5 */
6 6
7#include <linux/clk.h>
7#include <linux/dma-mapping.h> 8#include <linux/dma-mapping.h>
8#include <linux/gpio.h> 9#include <linux/gpio.h>
9#include <linux/i2c.h> 10#include <linux/i2c.h>
@@ -31,16 +32,16 @@
31static void __init db1550_hw_setup(void) 32static void __init db1550_hw_setup(void)
32{ 33{
33 void __iomem *base; 34 void __iomem *base;
35 unsigned long v;
34 36
35 /* complete SPI setup: link psc0_intclk to a 48MHz source, 37 /* complete SPI setup: link psc0_intclk to a 48MHz source,
36 * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) as well as PSC1_SYNC 38 * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) as well as PSC1_SYNC
37 * for AC97 on PB1550. 39 * for AC97 on PB1550.
38 */ 40 */
39 base = (void __iomem *)SYS_CLKSRC; 41 v = alchemy_rdsys(AU1000_SYS_CLKSRC);
40 __raw_writel(__raw_readl(base) | 0x000001e0, base); 42 alchemy_wrsys(v | 0x000001e0, AU1000_SYS_CLKSRC);
41 base = (void __iomem *)SYS_PINFUNC; 43 v = alchemy_rdsys(AU1000_SYS_PINFUNC);
42 __raw_writel(__raw_readl(base) | 1 | SYS_PF_PSC1_S1, base); 44 alchemy_wrsys(v | 1 | SYS_PF_PSC1_S1, AU1000_SYS_PINFUNC);
43 wmb();
44 45
45 /* reset the AC97 codec now, the reset time in the psc-ac97 driver 46 /* reset the AC97 codec now, the reset time in the psc-ac97 driver
46 * is apparently too short although it's ridiculous as it is. 47 * is apparently too short although it's ridiculous as it is.
@@ -151,7 +152,7 @@ static void au1550_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
151 152
152static int au1550_nand_device_ready(struct mtd_info *mtd) 153static int au1550_nand_device_ready(struct mtd_info *mtd)
153{ 154{
154 return __raw_readl((void __iomem *)MEM_STSTAT) & 1; 155 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
155} 156}
156 157
157static struct mtd_partition db1550_nand_parts[] = { 158static struct mtd_partition db1550_nand_parts[] = {
@@ -217,7 +218,7 @@ static struct platform_device pb1550_nand_dev = {
217 218
218static void __init pb1550_nand_setup(void) 219static void __init pb1550_nand_setup(void)
219{ 220{
220 int boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | 221 int boot_swapboot = (alchemy_rdsmem(AU1000_MEM_STSTAT) & (0x7 << 1)) |
221 ((bcsr_read(BCSR_STATUS) >> 6) & 0x1); 222 ((bcsr_read(BCSR_STATUS) >> 6) & 0x1);
222 223
223 gpio_direction_input(206); /* de-assert NAND CS# */ 224 gpio_direction_input(206); /* de-assert NAND CS# */
@@ -574,6 +575,7 @@ static void __init pb1550_devices(void)
574int __init db1550_dev_setup(void) 575int __init db1550_dev_setup(void)
575{ 576{
576 int swapped, id; 577 int swapped, id;
578 struct clk *c;
577 579
578 id = (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) != BCSR_WHOAMI_DB1550); 580 id = (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) != BCSR_WHOAMI_DB1550);
579 581
@@ -582,6 +584,17 @@ int __init db1550_dev_setup(void)
582 spi_register_board_info(db1550_spi_devs, 584 spi_register_board_info(db1550_spi_devs,
583 ARRAY_SIZE(db1550_i2c_devs)); 585 ARRAY_SIZE(db1550_i2c_devs));
584 586
587 c = clk_get(NULL, "psc0_intclk");
588 if (!IS_ERR(c)) {
589 clk_prepare_enable(c);
590 clk_put(c);
591 }
592 c = clk_get(NULL, "psc2_intclk");
593 if (!IS_ERR(c)) {
594 clk_prepare_enable(c);
595 clk_put(c);
596 }
597
585 /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */ 598 /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */
586 __raw_writel(PSC_SEL_CLK_SERCLK, 599 __raw_writel(PSC_SEL_CLK_SERCLK,
587 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 600 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
diff --git a/arch/mips/alchemy/devboards/pm.c b/arch/mips/alchemy/devboards/pm.c
index 61e90fe9eab1..bfeb8f3c0be6 100644
--- a/arch/mips/alchemy/devboards/pm.c
+++ b/arch/mips/alchemy/devboards/pm.c
@@ -45,23 +45,20 @@ static int db1x_pm_enter(suspend_state_t state)
45 alchemy_gpio1_input_enable(); 45 alchemy_gpio1_input_enable();
46 46
47 /* clear and setup wake cause and source */ 47 /* clear and setup wake cause and source */
48 au_writel(0, SYS_WAKEMSK); 48 alchemy_wrsys(0, AU1000_SYS_WAKEMSK);
49 au_sync(); 49 alchemy_wrsys(0, AU1000_SYS_WAKESRC);
50 au_writel(0, SYS_WAKESRC);
51 au_sync();
52 50
53 au_writel(db1x_pm_wakemsk, SYS_WAKEMSK); 51 alchemy_wrsys(db1x_pm_wakemsk, AU1000_SYS_WAKEMSK);
54 au_sync();
55 52
56 /* setup 1Hz-timer-based wakeup: wait for reg access */ 53 /* setup 1Hz-timer-based wakeup: wait for reg access */
57 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) 54 while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M20)
58 asm volatile ("nop"); 55 asm volatile ("nop");
59 56
60 au_writel(au_readl(SYS_TOYREAD) + db1x_pm_sleep_secs, SYS_TOYMATCH2); 57 alchemy_wrsys(alchemy_rdsys(AU1000_SYS_TOYREAD) + db1x_pm_sleep_secs,
61 au_sync(); 58 AU1000_SYS_TOYMATCH2);
62 59
63 /* wait for value to really hit the register */ 60 /* wait for value to really hit the register */
64 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) 61 while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M20)
65 asm volatile ("nop"); 62 asm volatile ("nop");
66 63
67 /* ...and now the sandman can come! */ 64 /* ...and now the sandman can come! */
@@ -102,12 +99,10 @@ static void db1x_pm_end(void)
102 /* read and store wakeup source, the clear the register. To 99 /* read and store wakeup source, the clear the register. To
103 * be able to clear it, WAKEMSK must be cleared first. 100 * be able to clear it, WAKEMSK must be cleared first.
104 */ 101 */
105 db1x_pm_last_wakesrc = au_readl(SYS_WAKESRC); 102 db1x_pm_last_wakesrc = alchemy_rdsys(AU1000_SYS_WAKESRC);
106
107 au_writel(0, SYS_WAKEMSK);
108 au_writel(0, SYS_WAKESRC);
109 au_sync();
110 103
104 alchemy_wrsys(0, AU1000_SYS_WAKEMSK);
105 alchemy_wrsys(0, AU1000_SYS_WAKESRC);
111} 106}
112 107
113static const struct platform_suspend_ops db1x_pm_ops = { 108static const struct platform_suspend_ops db1x_pm_ops = {
@@ -242,17 +237,13 @@ static int __init pm_init(void)
242 * for confirmation since there's plenty of time from here to 237 * for confirmation since there's plenty of time from here to
243 * the next suspend cycle. 238 * the next suspend cycle.
244 */ 239 */
245 if (au_readl(SYS_TOYTRIM) != 32767) { 240 if (alchemy_rdsys(AU1000_SYS_TOYTRIM) != 32767)
246 au_writel(32767, SYS_TOYTRIM); 241 alchemy_wrsys(32767, AU1000_SYS_TOYTRIM);
247 au_sync();
248 }
249 242
250 db1x_pm_last_wakesrc = au_readl(SYS_WAKESRC); 243 db1x_pm_last_wakesrc = alchemy_rdsys(AU1000_SYS_WAKESRC);
251 244
252 au_writel(0, SYS_WAKESRC); 245 alchemy_wrsys(0, AU1000_SYS_WAKESRC);
253 au_sync(); 246 alchemy_wrsys(0, AU1000_SYS_WAKEMSK);
254 au_writel(0, SYS_WAKEMSK);
255 au_sync();
256 247
257 suspend_set_ops(&db1x_pm_ops); 248 suspend_set_ops(&db1x_pm_ops);
258 249
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
index 09cb6f7aa3db..fc21d3659fa0 100644
--- a/arch/mips/bcm47xx/Kconfig
+++ b/arch/mips/bcm47xx/Kconfig
@@ -11,8 +11,6 @@ config BCM47XX_SSB
11 select SSB_DRIVER_PCICORE if PCI 11 select SSB_DRIVER_PCICORE if PCI
12 select SSB_PCICORE_HOSTMODE if PCI 12 select SSB_PCICORE_HOSTMODE if PCI
13 select SSB_DRIVER_GPIO 13 select SSB_DRIVER_GPIO
14 select GPIOLIB
15 select LEDS_GPIO_REGISTER
16 default y 14 default y
17 help 15 help
18 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support. 16 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -22,6 +20,7 @@ config BCM47XX_SSB
22config BCM47XX_BCMA 20config BCM47XX_BCMA
23 bool "BCMA Support for Broadcom BCM47XX" 21 bool "BCMA Support for Broadcom BCM47XX"
24 select SYS_HAS_CPU_MIPS32_R2 22 select SYS_HAS_CPU_MIPS32_R2
23 select SYS_SUPPORTS_HIGHMEM
25 select CPU_MIPSR2_IRQ_VI 24 select CPU_MIPSR2_IRQ_VI
26 select BCMA 25 select BCMA
27 select BCMA_HOST_SOC 26 select BCMA_HOST_SOC
@@ -29,8 +28,6 @@ config BCM47XX_BCMA
29 select BCMA_HOST_PCI if PCI 28 select BCMA_HOST_PCI if PCI
30 select BCMA_DRIVER_PCI_HOSTMODE if PCI 29 select BCMA_DRIVER_PCI_HOSTMODE if PCI
31 select BCMA_DRIVER_GPIO 30 select BCMA_DRIVER_GPIO
32 select GPIOLIB
33 select LEDS_GPIO_REGISTER
34 default y 31 default y
35 help 32 help
36 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus. 33 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
index 0194c3b9a729..f1cc9d0495d8 100644
--- a/arch/mips/bcm47xx/bcm47xx_private.h
+++ b/arch/mips/bcm47xx/bcm47xx_private.h
@@ -3,6 +3,9 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6/* prom.c */
7void __init bcm47xx_prom_highmem_init(void);
8
6/* buttons.c */ 9/* buttons.c */
7int __init bcm47xx_buttons_register(void); 10int __init bcm47xx_buttons_register(void);
8 11
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index 44ab1be68c3c..b3ae068ca4fa 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -58,6 +58,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst =
58static const 58static const
59struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = { 59struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
60 {{BCM47XX_BOARD_ASUS_RTN10U, "Asus RT-N10U"}, "RTN10U"}, 60 {{BCM47XX_BOARD_ASUS_RTN10U, "Asus RT-N10U"}, "RTN10U"},
61 {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-N10D"}, "RTN10D"},
61 {{BCM47XX_BOARD_ASUS_RTN12, "Asus RT-N12"}, "RT-N12"}, 62 {{BCM47XX_BOARD_ASUS_RTN12, "Asus RT-N12"}, "RT-N12"},
62 {{BCM47XX_BOARD_ASUS_RTN12B1, "Asus RT-N12B1"}, "RTN12B1"}, 63 {{BCM47XX_BOARD_ASUS_RTN12B1, "Asus RT-N12B1"}, "RTN12B1"},
63 {{BCM47XX_BOARD_ASUS_RTN12C1, "Asus RT-N12C1"}, "RTN12C1"}, 64 {{BCM47XX_BOARD_ASUS_RTN12C1, "Asus RT-N12C1"}, "RTN12C1"},
@@ -80,6 +81,14 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons
80 { {0}, NULL}, 81 { {0}, NULL},
81}; 82};
82 83
84/* hardware_version, boardnum */
85static const
86struct bcm47xx_board_type_list2 bcm47xx_board_list_hw_version_num[] __initconst = {
87 {{BCM47XX_BOARD_MICROSOFT_MN700, "Microsoft MN-700"}, "WL500-", "mn700"},
88 {{BCM47XX_BOARD_ASUS_WL500G, "Asus WL500G"}, "WL500-", "asusX"},
89 { {0}, NULL},
90};
91
83/* productid */ 92/* productid */
84static const 93static const
85struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = { 94struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
@@ -98,7 +107,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
98/* ModelId */ 107/* ModelId */
99static const 108static const
100struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = { 109struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = {
101 {{BCM47XX_BOARD_DELL_TM2300, "Dell WX-5565"}, "WX-5565"}, 110 {{BCM47XX_BOARD_DELL_TM2300, "Dell TrueMobile 2300"}, "WX-5565"},
102 {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"}, 111 {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"},
103 {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"}, 112 {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"},
104 {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "Motorola WR850G"}, "WR850G"}, 113 {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "Motorola WR850G"}, "WR850G"},
@@ -180,9 +189,9 @@ struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = {
180 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"}, 189 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
181 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"}, 190 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
182 {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "0x04CF", "3500", "02"}, 191 {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "0x04CF", "3500", "02"},
183 {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0101", "42", "0x10"}, 192 {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101, "Linksys WRT54G/GS/GL"}, "0x0101", "42", "0x10"},
184 {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0467", "42", "0x10"}, 193 {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467, "Linksys WRT54G/GS/GL"}, "0x0467", "42", "0x10"},
185 {{BCM47XX_BOARD_LINKSYS_WRT54G, "Linksys WRT54G/GS/GL"}, "0x0708", "42", "0x10"}, 194 {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708, "Linksys WRT54G/GS/GL"}, "0x0708", "42", "0x10"},
186 { {0}, NULL}, 195 { {0}, NULL},
187}; 196};
188 197
@@ -237,6 +246,15 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
237 } 246 }
238 } 247 }
239 248
249 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 &&
250 bcm47xx_nvram_getenv("boardtype", buf2, sizeof(buf2)) >= 0) {
251 for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) {
252 if (!strstarts(buf1, e2->value1) &&
253 !strcmp(buf2, e2->value2))
254 return &e2->board;
255 }
256 }
257
240 if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) { 258 if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) {
241 for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) { 259 for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) {
242 if (!strcmp(buf1, e1->value1)) 260 if (!strcmp(buf1, e1->value1))
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
index 49a1ce06844b..913182bcafb8 100644
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -56,6 +56,11 @@ bcm47xx_buttons_asus_wl330ge[] __initconst = {
56}; 56};
57 57
58static const struct gpio_keys_button 58static const struct gpio_keys_button
59bcm47xx_buttons_asus_wl500g[] __initconst = {
60 BCM47XX_GPIO_KEY(6, KEY_RESTART),
61};
62
63static const struct gpio_keys_button
59bcm47xx_buttons_asus_wl500gd[] __initconst = { 64bcm47xx_buttons_asus_wl500gd[] __initconst = {
60 BCM47XX_GPIO_KEY(6, KEY_RESTART), 65 BCM47XX_GPIO_KEY(6, KEY_RESTART),
61}; 66};
@@ -265,7 +270,7 @@ bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = {
265}; 270};
266 271
267static const struct gpio_keys_button 272static const struct gpio_keys_button
268bcm47xx_buttons_linksys_wrt54gsv1[] __initconst = { 273bcm47xx_buttons_linksys_wrt54g_generic[] __initconst = {
269 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 274 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
270 BCM47XX_GPIO_KEY(6, KEY_RESTART), 275 BCM47XX_GPIO_KEY(6, KEY_RESTART),
271}; 276};
@@ -288,6 +293,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
288 BCM47XX_GPIO_KEY(6, KEY_RESTART), 293 BCM47XX_GPIO_KEY(6, KEY_RESTART),
289}; 294};
290 295
296/* Microsoft */
297
298static const struct gpio_keys_button
299bcm47xx_buttons_microsoft_nm700[] __initconst = {
300 BCM47XX_GPIO_KEY(7, KEY_RESTART),
301};
302
291/* Motorola */ 303/* Motorola */
292 304
293static const struct gpio_keys_button 305static const struct gpio_keys_button
@@ -329,6 +341,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __initconst = {
329}; 341};
330 342
331static const struct gpio_keys_button 343static const struct gpio_keys_button
344bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
345 BCM47XX_GPIO_KEY(4, KEY_RESTART),
346 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
347};
348
349static const struct gpio_keys_button
332bcm47xx_buttons_netgear_wnr834bv2[] __initconst = { 350bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
333 BCM47XX_GPIO_KEY(6, KEY_RESTART), 351 BCM47XX_GPIO_KEY(6, KEY_RESTART),
334}; 352};
@@ -395,6 +413,9 @@ int __init bcm47xx_buttons_register(void)
395 case BCM47XX_BOARD_ASUS_WL330GE: 413 case BCM47XX_BOARD_ASUS_WL330GE:
396 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge); 414 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
397 break; 415 break;
416 case BCM47XX_BOARD_ASUS_WL500G:
417 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
418 break;
398 case BCM47XX_BOARD_ASUS_WL500GD: 419 case BCM47XX_BOARD_ASUS_WL500GD:
399 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd); 420 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
400 break; 421 break;
@@ -501,12 +522,14 @@ int __init bcm47xx_buttons_register(void)
501 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 522 case BCM47XX_BOARD_LINKSYS_WRT310NV1:
502 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); 523 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
503 break; 524 break;
504 case BCM47XX_BOARD_LINKSYS_WRT54G:
505 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54gsv1);
506 break;
507 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 525 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
508 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); 526 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
509 break; 527 break;
528 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
529 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
530 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
531 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
532 break;
510 case BCM47XX_BOARD_LINKSYS_WRT610NV1: 533 case BCM47XX_BOARD_LINKSYS_WRT610NV1:
511 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1); 534 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
512 break; 535 break;
@@ -517,6 +540,10 @@ int __init bcm47xx_buttons_register(void)
517 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); 540 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
518 break; 541 break;
519 542
543 case BCM47XX_BOARD_MICROSOFT_MN700:
544 err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
545 break;
546
520 case BCM47XX_BOARD_MOTOROLA_WE800G: 547 case BCM47XX_BOARD_MOTOROLA_WE800G:
521 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g); 548 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
522 break; 549 break;
@@ -536,6 +563,9 @@ int __init bcm47xx_buttons_register(void)
536 case BCM47XX_BOARD_NETGEAR_WNDR4500V1: 563 case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
537 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); 564 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
538 break; 565 break;
566 case BCM47XX_BOARD_NETGEAR_WNR3500L:
567 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
568 break;
539 case BCM47XX_BOARD_NETGEAR_WNR834BV2: 569 case BCM47XX_BOARD_NETGEAR_WNR834BV2:
540 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2); 570 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
541 break; 571 break;
diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c
index adcb547a91c3..903a656d4119 100644
--- a/arch/mips/bcm47xx/leds.c
+++ b/arch/mips/bcm47xx/leds.c
@@ -35,6 +35,15 @@ bcm47xx_leds_asus_rtn12[] __initconst = {
35}; 35};
36 36
37static const struct gpio_led 37static const struct gpio_led
38bcm47xx_leds_asus_rtn15u[] __initconst = {
39 /* TODO: Add "wlan" LED */
40 BCM47XX_GPIO_LED(3, "blue", "wan", 1, LEDS_GPIO_DEFSTATE_OFF),
41 BCM47XX_GPIO_LED(4, "blue", "lan", 1, LEDS_GPIO_DEFSTATE_OFF),
42 BCM47XX_GPIO_LED(6, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
43 BCM47XX_GPIO_LED(9, "blue", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
44};
45
46static const struct gpio_led
38bcm47xx_leds_asus_rtn16[] __initconst = { 47bcm47xx_leds_asus_rtn16[] __initconst = {
39 BCM47XX_GPIO_LED(1, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON), 48 BCM47XX_GPIO_LED(1, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
40 BCM47XX_GPIO_LED(7, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 49 BCM47XX_GPIO_LED(7, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
@@ -42,8 +51,8 @@ bcm47xx_leds_asus_rtn16[] __initconst = {
42 51
43static const struct gpio_led 52static const struct gpio_led
44bcm47xx_leds_asus_rtn66u[] __initconst = { 53bcm47xx_leds_asus_rtn66u[] __initconst = {
45 BCM47XX_GPIO_LED(12, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 54 BCM47XX_GPIO_LED(12, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
46 BCM47XX_GPIO_LED(15, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF), 55 BCM47XX_GPIO_LED(15, "blue", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
47}; 56};
48 57
49static const struct gpio_led 58static const struct gpio_led
@@ -64,6 +73,11 @@ bcm47xx_leds_asus_wl330ge[] __initconst = {
64}; 73};
65 74
66static const struct gpio_led 75static const struct gpio_led
76bcm47xx_leds_asus_wl500g[] __initconst = {
77 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
78};
79
80static const struct gpio_led
67bcm47xx_leds_asus_wl500gd[] __initconst = { 81bcm47xx_leds_asus_wl500gd[] __initconst = {
68 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 82 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
69}; 83};
@@ -216,8 +230,8 @@ bcm47xx_leds_linksys_e1000v1[] __initconst = {
216 230
217static const struct gpio_led 231static const struct gpio_led
218bcm47xx_leds_linksys_e1000v21[] __initconst = { 232bcm47xx_leds_linksys_e1000v21[] __initconst = {
219 BCM47XX_GPIO_LED(5, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 233 BCM47XX_GPIO_LED(5, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
220 BCM47XX_GPIO_LED(6, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 234 BCM47XX_GPIO_LED(6, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
221 BCM47XX_GPIO_LED(7, "amber", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 235 BCM47XX_GPIO_LED(7, "amber", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
222 BCM47XX_GPIO_LED(8, "blue", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 236 BCM47XX_GPIO_LED(8, "blue", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
223}; 237};
@@ -292,7 +306,7 @@ bcm47xx_leds_linksys_wrt310nv1[] __initconst = {
292}; 306};
293 307
294static const struct gpio_led 308static const struct gpio_led
295bcm47xx_leds_linksys_wrt54gsv1[] __initconst = { 309bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
296 BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 310 BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
297 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), 311 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
298 BCM47XX_GPIO_LED(5, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 312 BCM47XX_GPIO_LED(5, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
@@ -306,6 +320,24 @@ bcm47xx_leds_linksys_wrt54g3gv2[] __initconst = {
306 BCM47XX_GPIO_LED(3, "blue", "3g", 0, LEDS_GPIO_DEFSTATE_OFF), 320 BCM47XX_GPIO_LED(3, "blue", "3g", 0, LEDS_GPIO_DEFSTATE_OFF),
307}; 321};
308 322
323/* Verified on: WRT54GS V1.0 */
324static const struct gpio_led
325bcm47xx_leds_linksys_wrt54g_type_0101[] __initconst = {
326 BCM47XX_GPIO_LED(0, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
327 BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
328 BCM47XX_GPIO_LED(7, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
329};
330
331/* Verified on: WRT54GL V1.1 */
332static const struct gpio_led
333bcm47xx_leds_linksys_wrt54g_type_0467[] __initconst = {
334 BCM47XX_GPIO_LED(0, "green", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
335 BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
336 BCM47XX_GPIO_LED(2, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
337 BCM47XX_GPIO_LED(3, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
338 BCM47XX_GPIO_LED(7, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
339};
340
309static const struct gpio_led 341static const struct gpio_led
310bcm47xx_leds_linksys_wrt610nv1[] __initconst = { 342bcm47xx_leds_linksys_wrt610nv1[] __initconst = {
311 BCM47XX_GPIO_LED(0, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF), 343 BCM47XX_GPIO_LED(0, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
@@ -325,11 +357,17 @@ bcm47xx_leds_linksys_wrt610nv2[] __initconst = {
325 357
326static const struct gpio_led 358static const struct gpio_led
327bcm47xx_leds_linksys_wrtsl54gs[] __initconst = { 359bcm47xx_leds_linksys_wrtsl54gs[] __initconst = {
328 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 360 BCM47XX_GPIO_LED(0, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
329 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), 361 BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
330 BCM47XX_GPIO_LED(2, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 362 BCM47XX_GPIO_LED(5, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
331 BCM47XX_GPIO_LED(3, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 363 BCM47XX_GPIO_LED(7, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
332 BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 364};
365
366/* Microsoft */
367
368static const struct gpio_led
369bcm47xx_leds_microsoft_nm700[] __initconst = {
370 BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
333}; 371};
334 372
335/* Motorola */ 373/* Motorola */
@@ -377,6 +415,15 @@ bcm47xx_leds_netgear_wndr4500v1[] __initconst = {
377}; 415};
378 416
379static const struct gpio_led 417static const struct gpio_led
418bcm47xx_leds_netgear_wnr3500lv1[] __initconst = {
419 BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
420 BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
421 BCM47XX_GPIO_LED(2, "green", "wan", 1, LEDS_GPIO_DEFSTATE_OFF),
422 BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
423 BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
424};
425
426static const struct gpio_led
380bcm47xx_leds_netgear_wnr834bv2[] __initconst = { 427bcm47xx_leds_netgear_wnr834bv2[] __initconst = {
381 BCM47XX_GPIO_LED(2, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON), 428 BCM47XX_GPIO_LED(2, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
382 BCM47XX_GPIO_LED(3, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF), 429 BCM47XX_GPIO_LED(3, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
@@ -417,6 +464,9 @@ void __init bcm47xx_leds_register(void)
417 case BCM47XX_BOARD_ASUS_RTN12: 464 case BCM47XX_BOARD_ASUS_RTN12:
418 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); 465 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
419 break; 466 break;
467 case BCM47XX_BOARD_ASUS_RTN15U:
468 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn15u);
469 break;
420 case BCM47XX_BOARD_ASUS_RTN16: 470 case BCM47XX_BOARD_ASUS_RTN16:
421 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn16); 471 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn16);
422 break; 472 break;
@@ -432,6 +482,9 @@ void __init bcm47xx_leds_register(void)
432 case BCM47XX_BOARD_ASUS_WL330GE: 482 case BCM47XX_BOARD_ASUS_WL330GE:
433 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge); 483 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
434 break; 484 break;
485 case BCM47XX_BOARD_ASUS_WL500G:
486 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g);
487 break;
435 case BCM47XX_BOARD_ASUS_WL500GD: 488 case BCM47XX_BOARD_ASUS_WL500GD:
436 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd); 489 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
437 break; 490 break;
@@ -538,12 +591,18 @@ void __init bcm47xx_leds_register(void)
538 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 591 case BCM47XX_BOARD_LINKSYS_WRT310NV1:
539 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); 592 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
540 break; 593 break;
541 case BCM47XX_BOARD_LINKSYS_WRT54G:
542 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54gsv1);
543 break;
544 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 594 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
545 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2); 595 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2);
546 break; 596 break;
597 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
598 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0101);
599 break;
600 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
601 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0467);
602 break;
603 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
604 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_generic);
605 break;
547 case BCM47XX_BOARD_LINKSYS_WRT610NV1: 606 case BCM47XX_BOARD_LINKSYS_WRT610NV1:
548 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv1); 607 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv1);
549 break; 608 break;
@@ -554,6 +613,10 @@ void __init bcm47xx_leds_register(void)
554 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); 613 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
555 break; 614 break;
556 615
616 case BCM47XX_BOARD_MICROSOFT_MN700:
617 bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700);
618 break;
619
557 case BCM47XX_BOARD_MOTOROLA_WE800G: 620 case BCM47XX_BOARD_MOTOROLA_WE800G:
558 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g); 621 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
559 break; 622 break;
@@ -570,6 +633,9 @@ void __init bcm47xx_leds_register(void)
570 case BCM47XX_BOARD_NETGEAR_WNDR4500V1: 633 case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
571 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1); 634 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
572 break; 635 break;
636 case BCM47XX_BOARD_NETGEAR_WNR3500L:
637 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1);
638 break;
573 case BCM47XX_BOARD_NETGEAR_WNR834BV2: 639 case BCM47XX_BOARD_NETGEAR_WNR834BV2:
574 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2); 640 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2);
575 break; 641 break;
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 1a03a2f43496..1b170bf5f7f0 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -51,6 +51,8 @@ __init void bcm47xx_set_system_type(u16 chip_id)
51 chip_id); 51 chip_id);
52} 52}
53 53
54static unsigned long lowmem __initdata;
55
54static __init void prom_init_mem(void) 56static __init void prom_init_mem(void)
55{ 57{
56 unsigned long mem; 58 unsigned long mem;
@@ -87,6 +89,7 @@ static __init void prom_init_mem(void)
87 if (!memcmp(prom_init, prom_init + mem, 32)) 89 if (!memcmp(prom_init, prom_init + mem, 32))
88 break; 90 break;
89 } 91 }
92 lowmem = mem;
90 93
91 /* Ignoring the last page when ddr size is 128M. Cached 94 /* Ignoring the last page when ddr size is 128M. Cached
92 * accesses to last page is causing the processor to prefetch 95 * accesses to last page is causing the processor to prefetch
@@ -95,7 +98,6 @@ static __init void prom_init_mem(void)
95 */ 98 */
96 if (c->cputype == CPU_74K && (mem == (128 << 20))) 99 if (c->cputype == CPU_74K && (mem == (128 << 20)))
97 mem -= 0x1000; 100 mem -= 0x1000;
98
99 add_memory_region(0, mem, BOOT_MEM_RAM); 101 add_memory_region(0, mem, BOOT_MEM_RAM);
100} 102}
101 103
@@ -114,3 +116,67 @@ void __init prom_init(void)
114void __init prom_free_prom_memory(void) 116void __init prom_free_prom_memory(void)
115{ 117{
116} 118}
119
120#if defined(CONFIG_BCM47XX_BCMA) && defined(CONFIG_HIGHMEM)
121
122#define EXTVBASE 0xc0000000
123#define ENTRYLO(x) ((pte_val(pfn_pte((x) >> _PFN_SHIFT, PAGE_KERNEL_UNCACHED)) >> 6) | 1)
124
125#include <asm/tlbflush.h>
126
127/* Stripped version of tlb_init, with the call to build_tlb_refill_handler
128 * dropped. Calling it at this stage causes a hang.
129 */
130void __cpuinit early_tlb_init(void)
131{
132 write_c0_pagemask(PM_DEFAULT_MASK);
133 write_c0_wired(0);
134 temp_tlb_entry = current_cpu_data.tlbsize - 1;
135 local_flush_tlb_all();
136}
137
138void __init bcm47xx_prom_highmem_init(void)
139{
140 unsigned long off = (unsigned long)prom_init;
141 unsigned long extmem = 0;
142 bool highmem_region = false;
143
144 if (WARN_ON(bcm47xx_bus_type != BCM47XX_BUS_TYPE_BCMA))
145 return;
146
147 if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706)
148 highmem_region = true;
149
150 if (lowmem != 128 << 20 || !highmem_region)
151 return;
152
153 early_tlb_init();
154
155 /* Add one temporary TLB entry to map SDRAM Region 2.
156 * Physical Virtual
157 * 0x80000000 0xc0000000 (1st: 256MB)
158 * 0x90000000 0xd0000000 (2nd: 256MB)
159 */
160 add_temporary_entry(ENTRYLO(0x80000000),
161 ENTRYLO(0x80000000 + (256 << 20)),
162 EXTVBASE, PM_256M);
163
164 off = EXTVBASE + __pa(off);
165 for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) {
166 if (!memcmp(prom_init, (void *)(off + extmem), 16))
167 break;
168 }
169 extmem -= lowmem;
170
171 early_tlb_init();
172
173 if (!extmem)
174 return;
175
176 pr_warn("Found %lu MiB of extra memory, but highmem is unsupported yet!\n",
177 extmem >> 20);
178
179 /* TODO: Register extra memory */
180}
181
182#endif /* defined(CONFIG_BCM47XX_BCMA) && defined(CONFIG_HIGHMEM) */
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 63a4b0e915dc..2b63e7e7d3d3 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -59,12 +59,12 @@ static void bcm47xx_machine_restart(char *command)
59 switch (bcm47xx_bus_type) { 59 switch (bcm47xx_bus_type) {
60#ifdef CONFIG_BCM47XX_SSB 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB: 61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1); 62 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3);
63 break; 63 break;
64#endif 64#endif
65#ifdef CONFIG_BCM47XX_BCMA 65#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA: 66 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1); 67 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3);
68 break; 68 break;
69#endif 69#endif
70 } 70 }
@@ -218,6 +218,9 @@ void __init plat_mem_setup(void)
218 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; 218 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
219 bcm47xx_register_bcma(); 219 bcm47xx_register_bcma();
220 bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id); 220 bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id);
221#ifdef CONFIG_HIGHMEM
222 bcm47xx_prom_highmem_init();
223#endif
221#endif 224#endif
222 } else { 225 } else {
223 printk(KERN_INFO "bcm47xx: using ssb bus\n"); 226 printk(KERN_INFO "bcm47xx: using ssb bus\n");
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index da4cdb16844e..41226b68de3d 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -28,6 +28,8 @@
28 28
29#include <bcm47xx.h> 29#include <bcm47xx.h>
30#include <bcm47xx_nvram.h> 30#include <bcm47xx_nvram.h>
31#include <linux/if_ether.h>
32#include <linux/etherdevice.h>
31 33
32static void create_key(const char *prefix, const char *postfix, 34static void create_key(const char *prefix, const char *postfix,
33 const char *name, char *buf, int len) 35 const char *name, char *buf, int len)
@@ -631,6 +633,33 @@ static void bcm47xx_fill_sprom_path_r45(struct ssb_sprom *sprom,
631 } 633 }
632} 634}
633 635
636static bool bcm47xx_is_valid_mac(u8 *mac)
637{
638 return mac && !(mac[0] == 0x00 && mac[1] == 0x90 && mac[2] == 0x4c);
639}
640
641static int bcm47xx_increase_mac_addr(u8 *mac, u8 num)
642{
643 u8 *oui = mac + ETH_ALEN/2 - 1;
644 u8 *p = mac + ETH_ALEN - 1;
645
646 do {
647 (*p) += num;
648 if (*p > num)
649 break;
650 p--;
651 num = 1;
652 } while (p != oui);
653
654 if (p == oui) {
655 pr_err("unable to fetch mac address\n");
656 return -ENOENT;
657 }
658 return 0;
659}
660
661static int mac_addr_used = 2;
662
634static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, 663static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
635 const char *prefix, bool fallback) 664 const char *prefix, bool fallback)
636{ 665{
@@ -648,6 +677,25 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
648 677
649 nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback); 678 nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback);
650 nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback); 679 nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
680
681 /* The address prefix 00:90:4C is used by Broadcom in their initial
682 configuration. When a mac address with the prefix 00:90:4C is used
683 all devices from the same series are sharing the same mac address.
684 To prevent mac address collisions we replace them with a mac address
685 based on the base address. */
686 if (!bcm47xx_is_valid_mac(sprom->il0mac)) {
687 u8 mac[6];
688
689 nvram_read_macaddr(NULL, "et0macaddr", mac, false);
690 if (bcm47xx_is_valid_mac(mac)) {
691 int err = bcm47xx_increase_mac_addr(mac, mac_addr_used);
692
693 if (!err) {
694 ether_addr_copy(sprom->il0mac, mac);
695 mac_addr_used++;
696 }
697 }
698 }
651} 699}
652 700
653static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix, 701static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index fd4e76c00a42..536f64443031 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -24,7 +24,9 @@ EXPORT_SYMBOL(bcm63xx_regs_base);
24const int *bcm63xx_irqs; 24const int *bcm63xx_irqs;
25EXPORT_SYMBOL(bcm63xx_irqs); 25EXPORT_SYMBOL(bcm63xx_irqs);
26 26
27static u16 bcm63xx_cpu_id; 27u16 bcm63xx_cpu_id __read_mostly;
28EXPORT_SYMBOL(bcm63xx_cpu_id);
29
28static u8 bcm63xx_cpu_rev; 30static u8 bcm63xx_cpu_rev;
29static unsigned int bcm63xx_cpu_freq; 31static unsigned int bcm63xx_cpu_freq;
30static unsigned int bcm63xx_memory_size; 32static unsigned int bcm63xx_memory_size;
@@ -97,13 +99,6 @@ static const int bcm6368_irqs[] = {
97 99
98}; 100};
99 101
100u16 __bcm63xx_get_cpu_id(void)
101{
102 return bcm63xx_cpu_id;
103}
104
105EXPORT_SYMBOL(__bcm63xx_get_cpu_id);
106
107u8 bcm63xx_get_cpu_rev(void) 102u8 bcm63xx_get_cpu_rev(void)
108{ 103{
109 return bcm63xx_cpu_rev; 104 return bcm63xx_cpu_rev;
diff --git a/arch/mips/bcm63xx/dev-enet.c b/arch/mips/bcm63xx/dev-enet.c
index 52bc01df9bfe..e8284771d620 100644
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -14,7 +14,6 @@
14#include <bcm63xx_io.h> 14#include <bcm63xx_io.h>
15#include <bcm63xx_regs.h> 15#include <bcm63xx_regs.h>
16 16
17#ifdef BCMCPU_RUNTIME_DETECT
18static const unsigned long bcm6348_regs_enetdmac[] = { 17static const unsigned long bcm6348_regs_enetdmac[] = {
19 [ENETDMAC_CHANCFG] = ENETDMAC_CHANCFG_REG, 18 [ENETDMAC_CHANCFG] = ENETDMAC_CHANCFG_REG,
20 [ENETDMAC_IR] = ENETDMAC_IR_REG, 19 [ENETDMAC_IR] = ENETDMAC_IR_REG,
@@ -43,9 +42,6 @@ static __init void bcm63xx_enetdmac_regs_init(void)
43 else 42 else
44 bcm63xx_regs_enetdmac = bcm6348_regs_enetdmac; 43 bcm63xx_regs_enetdmac = bcm6348_regs_enetdmac;
45} 44}
46#else
47static __init void bcm63xx_enetdmac_regs_init(void) { }
48#endif
49 45
50static struct resource shared_res[] = { 46static struct resource shared_res[] = {
51 { 47 {
diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c
index d12daed749bc..ad448e41e3bd 100644
--- a/arch/mips/bcm63xx/dev-spi.c
+++ b/arch/mips/bcm63xx/dev-spi.c
@@ -18,7 +18,6 @@
18#include <bcm63xx_dev_spi.h> 18#include <bcm63xx_dev_spi.h>
19#include <bcm63xx_regs.h> 19#include <bcm63xx_regs.h>
20 20
21#ifdef BCMCPU_RUNTIME_DETECT
22/* 21/*
23 * register offsets 22 * register offsets
24 */ 23 */
@@ -41,9 +40,6 @@ static __init void bcm63xx_spi_regs_init(void)
41 BCMCPU_IS_6362() || BCMCPU_IS_6368()) 40 BCMCPU_IS_6362() || BCMCPU_IS_6368())
42 bcm63xx_regs_spi = bcm6358_regs_spi; 41 bcm63xx_regs_spi = bcm6358_regs_spi;
43} 42}
44#else
45static __init void bcm63xx_spi_regs_init(void) { }
46#endif
47 43
48static struct resource spi_resources[] = { 44static struct resource spi_resources[] = {
49 { 45 {
diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index a6c2135dbf38..468bc7b99cd3 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -18,19 +18,6 @@
18#include <bcm63xx_io.h> 18#include <bcm63xx_io.h>
19#include <bcm63xx_regs.h> 19#include <bcm63xx_regs.h>
20 20
21#ifndef BCMCPU_RUNTIME_DETECT
22#define gpio_out_low_reg GPIO_DATA_LO_REG
23#ifdef CONFIG_BCM63XX_CPU_6345
24#ifdef gpio_out_low_reg
25#undef gpio_out_low_reg
26#define gpio_out_low_reg GPIO_DATA_LO_REG_6345
27#endif /* gpio_out_low_reg */
28#endif /* CONFIG_BCM63XX_CPU_6345 */
29
30static inline void bcm63xx_gpio_out_low_reg_init(void)
31{
32}
33#else /* ! BCMCPU_RUNTIME_DETECT */
34static u32 gpio_out_low_reg; 21static u32 gpio_out_low_reg;
35 22
36static void bcm63xx_gpio_out_low_reg_init(void) 23static void bcm63xx_gpio_out_low_reg_init(void)
@@ -44,7 +31,6 @@ static void bcm63xx_gpio_out_low_reg_init(void)
44 break; 31 break;
45 } 32 }
46} 33}
47#endif /* ! BCMCPU_RUNTIME_DETECT */
48 34
49static DEFINE_SPINLOCK(bcm63xx_gpio_lock); 35static DEFINE_SPINLOCK(bcm63xx_gpio_lock);
50static u32 gpio_out_low, gpio_out_high; 36static u32 gpio_out_low, gpio_out_high;
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index 1525f8a3841b..37eb2d1fa69a 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -12,6 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/spinlock.h>
15#include <asm/irq_cpu.h> 16#include <asm/irq_cpu.h>
16#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
17#include <bcm63xx_cpu.h> 18#include <bcm63xx_cpu.h>
@@ -19,222 +20,20 @@
19#include <bcm63xx_io.h> 20#include <bcm63xx_io.h>
20#include <bcm63xx_irq.h> 21#include <bcm63xx_irq.h>
21 22
22static void __dispatch_internal(void) __maybe_unused;
23static void __dispatch_internal_64(void) __maybe_unused;
24static void __internal_irq_mask_32(unsigned int irq) __maybe_unused;
25static void __internal_irq_mask_64(unsigned int irq) __maybe_unused;
26static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused;
27static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused;
28
29#ifndef BCMCPU_RUNTIME_DETECT
30#ifdef CONFIG_BCM63XX_CPU_3368
31#define irq_stat_reg PERF_IRQSTAT_3368_REG
32#define irq_mask_reg PERF_IRQMASK_3368_REG
33#define irq_bits 32
34#define is_ext_irq_cascaded 0
35#define ext_irq_start 0
36#define ext_irq_end 0
37#define ext_irq_count 4
38#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_3368
39#define ext_irq_cfg_reg2 0
40#endif
41#ifdef CONFIG_BCM63XX_CPU_6328
42#define irq_stat_reg PERF_IRQSTAT_6328_REG
43#define irq_mask_reg PERF_IRQMASK_6328_REG
44#define irq_bits 64
45#define is_ext_irq_cascaded 1
46#define ext_irq_start (BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE)
47#define ext_irq_end (BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE)
48#define ext_irq_count 4
49#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6328
50#define ext_irq_cfg_reg2 0
51#endif
52#ifdef CONFIG_BCM63XX_CPU_6338
53#define irq_stat_reg PERF_IRQSTAT_6338_REG
54#define irq_mask_reg PERF_IRQMASK_6338_REG
55#define irq_bits 32
56#define is_ext_irq_cascaded 0
57#define ext_irq_start 0
58#define ext_irq_end 0
59#define ext_irq_count 4
60#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6338
61#define ext_irq_cfg_reg2 0
62#endif
63#ifdef CONFIG_BCM63XX_CPU_6345
64#define irq_stat_reg PERF_IRQSTAT_6345_REG
65#define irq_mask_reg PERF_IRQMASK_6345_REG
66#define irq_bits 32
67#define is_ext_irq_cascaded 0
68#define ext_irq_start 0
69#define ext_irq_end 0
70#define ext_irq_count 4
71#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6345
72#define ext_irq_cfg_reg2 0
73#endif
74#ifdef CONFIG_BCM63XX_CPU_6348
75#define irq_stat_reg PERF_IRQSTAT_6348_REG
76#define irq_mask_reg PERF_IRQMASK_6348_REG
77#define irq_bits 32
78#define is_ext_irq_cascaded 0
79#define ext_irq_start 0
80#define ext_irq_end 0
81#define ext_irq_count 4
82#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6348
83#define ext_irq_cfg_reg2 0
84#endif
85#ifdef CONFIG_BCM63XX_CPU_6358
86#define irq_stat_reg PERF_IRQSTAT_6358_REG
87#define irq_mask_reg PERF_IRQMASK_6358_REG
88#define irq_bits 32
89#define is_ext_irq_cascaded 1
90#define ext_irq_start (BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE)
91#define ext_irq_end (BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE)
92#define ext_irq_count 4
93#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6358
94#define ext_irq_cfg_reg2 0
95#endif
96#ifdef CONFIG_BCM63XX_CPU_6362
97#define irq_stat_reg PERF_IRQSTAT_6362_REG
98#define irq_mask_reg PERF_IRQMASK_6362_REG
99#define irq_bits 64
100#define is_ext_irq_cascaded 1
101#define ext_irq_start (BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE)
102#define ext_irq_end (BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE)
103#define ext_irq_count 4
104#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6362
105#define ext_irq_cfg_reg2 0
106#endif
107#ifdef CONFIG_BCM63XX_CPU_6368
108#define irq_stat_reg PERF_IRQSTAT_6368_REG
109#define irq_mask_reg PERF_IRQMASK_6368_REG
110#define irq_bits 64
111#define is_ext_irq_cascaded 1
112#define ext_irq_start (BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE)
113#define ext_irq_end (BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE)
114#define ext_irq_count 6
115#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6368
116#define ext_irq_cfg_reg2 PERF_EXTIRQ_CFG_REG2_6368
117#endif
118
119#if irq_bits == 32
120#define dispatch_internal __dispatch_internal
121#define internal_irq_mask __internal_irq_mask_32
122#define internal_irq_unmask __internal_irq_unmask_32
123#else
124#define dispatch_internal __dispatch_internal_64
125#define internal_irq_mask __internal_irq_mask_64
126#define internal_irq_unmask __internal_irq_unmask_64
127#endif
128 23
129#define irq_stat_addr (bcm63xx_regset_address(RSET_PERF) + irq_stat_reg) 24static DEFINE_SPINLOCK(ipic_lock);
130#define irq_mask_addr (bcm63xx_regset_address(RSET_PERF) + irq_mask_reg) 25static DEFINE_SPINLOCK(epic_lock);
131 26
132static inline void bcm63xx_init_irq(void) 27static u32 irq_stat_addr[2];
133{ 28static u32 irq_mask_addr[2];
134} 29static void (*dispatch_internal)(int cpu);
135#else /* ! BCMCPU_RUNTIME_DETECT */
136
137static u32 irq_stat_addr, irq_mask_addr;
138static void (*dispatch_internal)(void);
139static int is_ext_irq_cascaded; 30static int is_ext_irq_cascaded;
140static unsigned int ext_irq_count; 31static unsigned int ext_irq_count;
141static unsigned int ext_irq_start, ext_irq_end; 32static unsigned int ext_irq_start, ext_irq_end;
142static unsigned int ext_irq_cfg_reg1, ext_irq_cfg_reg2; 33static unsigned int ext_irq_cfg_reg1, ext_irq_cfg_reg2;
143static void (*internal_irq_mask)(unsigned int irq); 34static void (*internal_irq_mask)(struct irq_data *d);
144static void (*internal_irq_unmask)(unsigned int irq); 35static void (*internal_irq_unmask)(struct irq_data *d, const struct cpumask *m);
145 36
146static void bcm63xx_init_irq(void)
147{
148 int irq_bits;
149
150 irq_stat_addr = bcm63xx_regset_address(RSET_PERF);
151 irq_mask_addr = bcm63xx_regset_address(RSET_PERF);
152
153 switch (bcm63xx_get_cpu_id()) {
154 case BCM3368_CPU_ID:
155 irq_stat_addr += PERF_IRQSTAT_3368_REG;
156 irq_mask_addr += PERF_IRQMASK_3368_REG;
157 irq_bits = 32;
158 ext_irq_count = 4;
159 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
160 break;
161 case BCM6328_CPU_ID:
162 irq_stat_addr += PERF_IRQSTAT_6328_REG;
163 irq_mask_addr += PERF_IRQMASK_6328_REG;
164 irq_bits = 64;
165 ext_irq_count = 4;
166 is_ext_irq_cascaded = 1;
167 ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE;
168 ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE;
169 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328;
170 break;
171 case BCM6338_CPU_ID:
172 irq_stat_addr += PERF_IRQSTAT_6338_REG;
173 irq_mask_addr += PERF_IRQMASK_6338_REG;
174 irq_bits = 32;
175 ext_irq_count = 4;
176 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338;
177 break;
178 case BCM6345_CPU_ID:
179 irq_stat_addr += PERF_IRQSTAT_6345_REG;
180 irq_mask_addr += PERF_IRQMASK_6345_REG;
181 irq_bits = 32;
182 ext_irq_count = 4;
183 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345;
184 break;
185 case BCM6348_CPU_ID:
186 irq_stat_addr += PERF_IRQSTAT_6348_REG;
187 irq_mask_addr += PERF_IRQMASK_6348_REG;
188 irq_bits = 32;
189 ext_irq_count = 4;
190 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348;
191 break;
192 case BCM6358_CPU_ID:
193 irq_stat_addr += PERF_IRQSTAT_6358_REG;
194 irq_mask_addr += PERF_IRQMASK_6358_REG;
195 irq_bits = 32;
196 ext_irq_count = 4;
197 is_ext_irq_cascaded = 1;
198 ext_irq_start = BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE;
199 ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE;
200 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358;
201 break;
202 case BCM6362_CPU_ID:
203 irq_stat_addr += PERF_IRQSTAT_6362_REG;
204 irq_mask_addr += PERF_IRQMASK_6362_REG;
205 irq_bits = 64;
206 ext_irq_count = 4;
207 is_ext_irq_cascaded = 1;
208 ext_irq_start = BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE;
209 ext_irq_end = BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE;
210 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362;
211 break;
212 case BCM6368_CPU_ID:
213 irq_stat_addr += PERF_IRQSTAT_6368_REG;
214 irq_mask_addr += PERF_IRQMASK_6368_REG;
215 irq_bits = 64;
216 ext_irq_count = 6;
217 is_ext_irq_cascaded = 1;
218 ext_irq_start = BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE;
219 ext_irq_end = BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE;
220 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6368;
221 ext_irq_cfg_reg2 = PERF_EXTIRQ_CFG_REG2_6368;
222 break;
223 default:
224 BUG();
225 }
226
227 if (irq_bits == 32) {
228 dispatch_internal = __dispatch_internal;
229 internal_irq_mask = __internal_irq_mask_32;
230 internal_irq_unmask = __internal_irq_unmask_32;
231 } else {
232 dispatch_internal = __dispatch_internal_64;
233 internal_irq_mask = __internal_irq_mask_64;
234 internal_irq_unmask = __internal_irq_unmask_64;
235 }
236}
237#endif /* ! BCMCPU_RUNTIME_DETECT */
238 37
239static inline u32 get_ext_irq_perf_reg(int irq) 38static inline u32 get_ext_irq_perf_reg(int irq)
240{ 39{
@@ -252,53 +51,113 @@ static inline void handle_internal(int intbit)
252 do_IRQ(intbit + IRQ_INTERNAL_BASE); 51 do_IRQ(intbit + IRQ_INTERNAL_BASE);
253} 52}
254 53
54static inline int enable_irq_for_cpu(int cpu, struct irq_data *d,
55 const struct cpumask *m)
56{
57 bool enable = cpu_online(cpu);
58
59#ifdef CONFIG_SMP
60 if (m)
61 enable &= cpu_isset(cpu, *m);
62 else if (irqd_affinity_was_set(d))
63 enable &= cpu_isset(cpu, *d->affinity);
64#endif
65 return enable;
66}
67
255/* 68/*
256 * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not 69 * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not
257 * prioritize any interrupt relatively to another. the static counter 70 * prioritize any interrupt relatively to another. the static counter
258 * will resume the loop where it ended the last time we left this 71 * will resume the loop where it ended the last time we left this
259 * function. 72 * function.
260 */ 73 */
261static void __dispatch_internal(void)
262{
263 u32 pending;
264 static int i;
265
266 pending = bcm_readl(irq_stat_addr) & bcm_readl(irq_mask_addr);
267 74
268 if (!pending) 75#define BUILD_IPIC_INTERNAL(width) \
269 return ; 76void __dispatch_internal_##width(int cpu) \
270 77{ \
271 while (1) { 78 u32 pending[width / 32]; \
272 int to_call = i; 79 unsigned int src, tgt; \
273 80 bool irqs_pending = false; \
274 i = (i + 1) & 0x1f; 81 static unsigned int i[2]; \
275 if (pending & (1 << to_call)) { 82 unsigned int *next = &i[cpu]; \
276 handle_internal(to_call); 83 unsigned long flags; \
277 break; 84 \
278 } 85 /* read registers in reverse order */ \
279 } 86 spin_lock_irqsave(&ipic_lock, flags); \
87 for (src = 0, tgt = (width / 32); src < (width / 32); src++) { \
88 u32 val; \
89 \
90 val = bcm_readl(irq_stat_addr[cpu] + src * sizeof(u32)); \
91 val &= bcm_readl(irq_mask_addr[cpu] + src * sizeof(u32)); \
92 pending[--tgt] = val; \
93 \
94 if (val) \
95 irqs_pending = true; \
96 } \
97 spin_unlock_irqrestore(&ipic_lock, flags); \
98 \
99 if (!irqs_pending) \
100 return; \
101 \
102 while (1) { \
103 unsigned int to_call = *next; \
104 \
105 *next = (*next + 1) & (width - 1); \
106 if (pending[to_call / 32] & (1 << (to_call & 0x1f))) { \
107 handle_internal(to_call); \
108 break; \
109 } \
110 } \
111} \
112 \
113static void __internal_irq_mask_##width(struct irq_data *d) \
114{ \
115 u32 val; \
116 unsigned irq = d->irq - IRQ_INTERNAL_BASE; \
117 unsigned reg = (irq / 32) ^ (width/32 - 1); \
118 unsigned bit = irq & 0x1f; \
119 unsigned long flags; \
120 int cpu; \
121 \
122 spin_lock_irqsave(&ipic_lock, flags); \
123 for_each_present_cpu(cpu) { \
124 if (!irq_mask_addr[cpu]) \
125 break; \
126 \
127 val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\
128 val &= ~(1 << bit); \
129 bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\
130 } \
131 spin_unlock_irqrestore(&ipic_lock, flags); \
132} \
133 \
134static void __internal_irq_unmask_##width(struct irq_data *d, \
135 const struct cpumask *m) \
136{ \
137 u32 val; \
138 unsigned irq = d->irq - IRQ_INTERNAL_BASE; \
139 unsigned reg = (irq / 32) ^ (width/32 - 1); \
140 unsigned bit = irq & 0x1f; \
141 unsigned long flags; \
142 int cpu; \
143 \
144 spin_lock_irqsave(&ipic_lock, flags); \
145 for_each_present_cpu(cpu) { \
146 if (!irq_mask_addr[cpu]) \
147 break; \
148 \
149 val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\
150 if (enable_irq_for_cpu(cpu, d, m)) \
151 val |= (1 << bit); \
152 else \
153 val &= ~(1 << bit); \
154 bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\
155 } \
156 spin_unlock_irqrestore(&ipic_lock, flags); \
280} 157}
281 158
282static void __dispatch_internal_64(void) 159BUILD_IPIC_INTERNAL(32);
283{ 160BUILD_IPIC_INTERNAL(64);
284 u64 pending;
285 static int i;
286
287 pending = bcm_readq(irq_stat_addr) & bcm_readq(irq_mask_addr);
288
289 if (!pending)
290 return ;
291
292 while (1) {
293 int to_call = i;
294
295 i = (i + 1) & 0x3f;
296 if (pending & (1ull << to_call)) {
297 handle_internal(to_call);
298 break;
299 }
300 }
301}
302 161
303asmlinkage void plat_irq_dispatch(void) 162asmlinkage void plat_irq_dispatch(void)
304{ 163{
@@ -317,8 +176,11 @@ asmlinkage void plat_irq_dispatch(void)
317 if (cause & CAUSEF_IP1) 176 if (cause & CAUSEF_IP1)
318 do_IRQ(1); 177 do_IRQ(1);
319 if (cause & CAUSEF_IP2) 178 if (cause & CAUSEF_IP2)
320 dispatch_internal(); 179 dispatch_internal(0);
321 if (!is_ext_irq_cascaded) { 180 if (is_ext_irq_cascaded) {
181 if (cause & CAUSEF_IP3)
182 dispatch_internal(1);
183 } else {
322 if (cause & CAUSEF_IP3) 184 if (cause & CAUSEF_IP3)
323 do_IRQ(IRQ_EXT_0); 185 do_IRQ(IRQ_EXT_0);
324 if (cause & CAUSEF_IP4) 186 if (cause & CAUSEF_IP4)
@@ -335,50 +197,14 @@ asmlinkage void plat_irq_dispatch(void)
335 * internal IRQs operations: only mask/unmask on PERF irq mask 197 * internal IRQs operations: only mask/unmask on PERF irq mask
336 * register. 198 * register.
337 */ 199 */
338static void __internal_irq_mask_32(unsigned int irq)
339{
340 u32 mask;
341
342 mask = bcm_readl(irq_mask_addr);
343 mask &= ~(1 << irq);
344 bcm_writel(mask, irq_mask_addr);
345}
346
347static void __internal_irq_mask_64(unsigned int irq)
348{
349 u64 mask;
350
351 mask = bcm_readq(irq_mask_addr);
352 mask &= ~(1ull << irq);
353 bcm_writeq(mask, irq_mask_addr);
354}
355
356static void __internal_irq_unmask_32(unsigned int irq)
357{
358 u32 mask;
359
360 mask = bcm_readl(irq_mask_addr);
361 mask |= (1 << irq);
362 bcm_writel(mask, irq_mask_addr);
363}
364
365static void __internal_irq_unmask_64(unsigned int irq)
366{
367 u64 mask;
368
369 mask = bcm_readq(irq_mask_addr);
370 mask |= (1ull << irq);
371 bcm_writeq(mask, irq_mask_addr);
372}
373
374static void bcm63xx_internal_irq_mask(struct irq_data *d) 200static void bcm63xx_internal_irq_mask(struct irq_data *d)
375{ 201{
376 internal_irq_mask(d->irq - IRQ_INTERNAL_BASE); 202 internal_irq_mask(d);
377} 203}
378 204
379static void bcm63xx_internal_irq_unmask(struct irq_data *d) 205static void bcm63xx_internal_irq_unmask(struct irq_data *d)
380{ 206{
381 internal_irq_unmask(d->irq - IRQ_INTERNAL_BASE); 207 internal_irq_unmask(d, NULL);
382} 208}
383 209
384/* 210/*
@@ -389,8 +215,10 @@ static void bcm63xx_external_irq_mask(struct irq_data *d)
389{ 215{
390 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; 216 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
391 u32 reg, regaddr; 217 u32 reg, regaddr;
218 unsigned long flags;
392 219
393 regaddr = get_ext_irq_perf_reg(irq); 220 regaddr = get_ext_irq_perf_reg(irq);
221 spin_lock_irqsave(&epic_lock, flags);
394 reg = bcm_perf_readl(regaddr); 222 reg = bcm_perf_readl(regaddr);
395 223
396 if (BCMCPU_IS_6348()) 224 if (BCMCPU_IS_6348())
@@ -399,16 +227,20 @@ static void bcm63xx_external_irq_mask(struct irq_data *d)
399 reg &= ~EXTIRQ_CFG_MASK(irq % 4); 227 reg &= ~EXTIRQ_CFG_MASK(irq % 4);
400 228
401 bcm_perf_writel(reg, regaddr); 229 bcm_perf_writel(reg, regaddr);
230 spin_unlock_irqrestore(&epic_lock, flags);
231
402 if (is_ext_irq_cascaded) 232 if (is_ext_irq_cascaded)
403 internal_irq_mask(irq + ext_irq_start); 233 internal_irq_mask(irq_get_irq_data(irq + ext_irq_start));
404} 234}
405 235
406static void bcm63xx_external_irq_unmask(struct irq_data *d) 236static void bcm63xx_external_irq_unmask(struct irq_data *d)
407{ 237{
408 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; 238 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
409 u32 reg, regaddr; 239 u32 reg, regaddr;
240 unsigned long flags;
410 241
411 regaddr = get_ext_irq_perf_reg(irq); 242 regaddr = get_ext_irq_perf_reg(irq);
243 spin_lock_irqsave(&epic_lock, flags);
412 reg = bcm_perf_readl(regaddr); 244 reg = bcm_perf_readl(regaddr);
413 245
414 if (BCMCPU_IS_6348()) 246 if (BCMCPU_IS_6348())
@@ -417,17 +249,21 @@ static void bcm63xx_external_irq_unmask(struct irq_data *d)
417 reg |= EXTIRQ_CFG_MASK(irq % 4); 249 reg |= EXTIRQ_CFG_MASK(irq % 4);
418 250
419 bcm_perf_writel(reg, regaddr); 251 bcm_perf_writel(reg, regaddr);
252 spin_unlock_irqrestore(&epic_lock, flags);
420 253
421 if (is_ext_irq_cascaded) 254 if (is_ext_irq_cascaded)
422 internal_irq_unmask(irq + ext_irq_start); 255 internal_irq_unmask(irq_get_irq_data(irq + ext_irq_start),
256 NULL);
423} 257}
424 258
425static void bcm63xx_external_irq_clear(struct irq_data *d) 259static void bcm63xx_external_irq_clear(struct irq_data *d)
426{ 260{
427 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; 261 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
428 u32 reg, regaddr; 262 u32 reg, regaddr;
263 unsigned long flags;
429 264
430 regaddr = get_ext_irq_perf_reg(irq); 265 regaddr = get_ext_irq_perf_reg(irq);
266 spin_lock_irqsave(&epic_lock, flags);
431 reg = bcm_perf_readl(regaddr); 267 reg = bcm_perf_readl(regaddr);
432 268
433 if (BCMCPU_IS_6348()) 269 if (BCMCPU_IS_6348())
@@ -436,6 +272,7 @@ static void bcm63xx_external_irq_clear(struct irq_data *d)
436 reg |= EXTIRQ_CFG_CLEAR(irq % 4); 272 reg |= EXTIRQ_CFG_CLEAR(irq % 4);
437 273
438 bcm_perf_writel(reg, regaddr); 274 bcm_perf_writel(reg, regaddr);
275 spin_unlock_irqrestore(&epic_lock, flags);
439} 276}
440 277
441static int bcm63xx_external_irq_set_type(struct irq_data *d, 278static int bcm63xx_external_irq_set_type(struct irq_data *d,
@@ -444,6 +281,7 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
444 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; 281 unsigned int irq = d->irq - IRQ_EXTERNAL_BASE;
445 u32 reg, regaddr; 282 u32 reg, regaddr;
446 int levelsense, sense, bothedge; 283 int levelsense, sense, bothedge;
284 unsigned long flags;
447 285
448 flow_type &= IRQ_TYPE_SENSE_MASK; 286 flow_type &= IRQ_TYPE_SENSE_MASK;
449 287
@@ -478,6 +316,7 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
478 } 316 }
479 317
480 regaddr = get_ext_irq_perf_reg(irq); 318 regaddr = get_ext_irq_perf_reg(irq);
319 spin_lock_irqsave(&epic_lock, flags);
481 reg = bcm_perf_readl(regaddr); 320 reg = bcm_perf_readl(regaddr);
482 irq %= 4; 321 irq %= 4;
483 322
@@ -522,6 +361,7 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
522 } 361 }
523 362
524 bcm_perf_writel(reg, regaddr); 363 bcm_perf_writel(reg, regaddr);
364 spin_unlock_irqrestore(&epic_lock, flags);
525 365
526 irqd_set_trigger_type(d, flow_type); 366 irqd_set_trigger_type(d, flow_type);
527 if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) 367 if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
@@ -532,6 +372,18 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
532 return IRQ_SET_MASK_OK_NOCOPY; 372 return IRQ_SET_MASK_OK_NOCOPY;
533} 373}
534 374
375#ifdef CONFIG_SMP
376static int bcm63xx_internal_set_affinity(struct irq_data *data,
377 const struct cpumask *dest,
378 bool force)
379{
380 if (!irqd_irq_disabled(data))
381 internal_irq_unmask(data, dest);
382
383 return 0;
384}
385#endif
386
535static struct irq_chip bcm63xx_internal_irq_chip = { 387static struct irq_chip bcm63xx_internal_irq_chip = {
536 .name = "bcm63xx_ipic", 388 .name = "bcm63xx_ipic",
537 .irq_mask = bcm63xx_internal_irq_mask, 389 .irq_mask = bcm63xx_internal_irq_mask,
@@ -554,12 +406,130 @@ static struct irqaction cpu_ip2_cascade_action = {
554 .flags = IRQF_NO_THREAD, 406 .flags = IRQF_NO_THREAD,
555}; 407};
556 408
409#ifdef CONFIG_SMP
410static struct irqaction cpu_ip3_cascade_action = {
411 .handler = no_action,
412 .name = "cascade_ip3",
413 .flags = IRQF_NO_THREAD,
414};
415#endif
416
557static struct irqaction cpu_ext_cascade_action = { 417static struct irqaction cpu_ext_cascade_action = {
558 .handler = no_action, 418 .handler = no_action,
559 .name = "cascade_extirq", 419 .name = "cascade_extirq",
560 .flags = IRQF_NO_THREAD, 420 .flags = IRQF_NO_THREAD,
561}; 421};
562 422
423static void bcm63xx_init_irq(void)
424{
425 int irq_bits;
426
427 irq_stat_addr[0] = bcm63xx_regset_address(RSET_PERF);
428 irq_mask_addr[0] = bcm63xx_regset_address(RSET_PERF);
429 irq_stat_addr[1] = bcm63xx_regset_address(RSET_PERF);
430 irq_mask_addr[1] = bcm63xx_regset_address(RSET_PERF);
431
432 switch (bcm63xx_get_cpu_id()) {
433 case BCM3368_CPU_ID:
434 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG;
435 irq_mask_addr[0] += PERF_IRQMASK_3368_REG;
436 irq_stat_addr[1] = 0;
437 irq_stat_addr[1] = 0;
438 irq_bits = 32;
439 ext_irq_count = 4;
440 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
441 break;
442 case BCM6328_CPU_ID:
443 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0);
444 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0);
445 irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1);
446 irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1);
447 irq_bits = 64;
448 ext_irq_count = 4;
449 is_ext_irq_cascaded = 1;
450 ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE;
451 ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE;
452 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328;
453 break;
454 case BCM6338_CPU_ID:
455 irq_stat_addr[0] += PERF_IRQSTAT_6338_REG;
456 irq_mask_addr[0] += PERF_IRQMASK_6338_REG;
457 irq_stat_addr[1] = 0;
458 irq_mask_addr[1] = 0;
459 irq_bits = 32;
460 ext_irq_count = 4;
461 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338;
462 break;
463 case BCM6345_CPU_ID:
464 irq_stat_addr[0] += PERF_IRQSTAT_6345_REG;
465 irq_mask_addr[0] += PERF_IRQMASK_6345_REG;
466 irq_stat_addr[1] = 0;
467 irq_mask_addr[1] = 0;
468 irq_bits = 32;
469 ext_irq_count = 4;
470 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345;
471 break;
472 case BCM6348_CPU_ID:
473 irq_stat_addr[0] += PERF_IRQSTAT_6348_REG;
474 irq_mask_addr[0] += PERF_IRQMASK_6348_REG;
475 irq_stat_addr[1] = 0;
476 irq_mask_addr[1] = 0;
477 irq_bits = 32;
478 ext_irq_count = 4;
479 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348;
480 break;
481 case BCM6358_CPU_ID:
482 irq_stat_addr[0] += PERF_IRQSTAT_6358_REG(0);
483 irq_mask_addr[0] += PERF_IRQMASK_6358_REG(0);
484 irq_stat_addr[1] += PERF_IRQSTAT_6358_REG(1);
485 irq_mask_addr[1] += PERF_IRQMASK_6358_REG(1);
486 irq_bits = 32;
487 ext_irq_count = 4;
488 is_ext_irq_cascaded = 1;
489 ext_irq_start = BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE;
490 ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE;
491 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358;
492 break;
493 case BCM6362_CPU_ID:
494 irq_stat_addr[0] += PERF_IRQSTAT_6362_REG(0);
495 irq_mask_addr[0] += PERF_IRQMASK_6362_REG(0);
496 irq_stat_addr[1] += PERF_IRQSTAT_6362_REG(1);
497 irq_mask_addr[1] += PERF_IRQMASK_6362_REG(1);
498 irq_bits = 64;
499 ext_irq_count = 4;
500 is_ext_irq_cascaded = 1;
501 ext_irq_start = BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE;
502 ext_irq_end = BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE;
503 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362;
504 break;
505 case BCM6368_CPU_ID:
506 irq_stat_addr[0] += PERF_IRQSTAT_6368_REG(0);
507 irq_mask_addr[0] += PERF_IRQMASK_6368_REG(0);
508 irq_stat_addr[1] += PERF_IRQSTAT_6368_REG(1);
509 irq_mask_addr[1] += PERF_IRQMASK_6368_REG(1);
510 irq_bits = 64;
511 ext_irq_count = 6;
512 is_ext_irq_cascaded = 1;
513 ext_irq_start = BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE;
514 ext_irq_end = BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE;
515 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6368;
516 ext_irq_cfg_reg2 = PERF_EXTIRQ_CFG_REG2_6368;
517 break;
518 default:
519 BUG();
520 }
521
522 if (irq_bits == 32) {
523 dispatch_internal = __dispatch_internal_32;
524 internal_irq_mask = __internal_irq_mask_32;
525 internal_irq_unmask = __internal_irq_unmask_32;
526 } else {
527 dispatch_internal = __dispatch_internal_64;
528 internal_irq_mask = __internal_irq_mask_64;
529 internal_irq_unmask = __internal_irq_unmask_64;
530 }
531}
532
563void __init arch_init_irq(void) 533void __init arch_init_irq(void)
564{ 534{
565 int i; 535 int i;
@@ -580,4 +550,14 @@ void __init arch_init_irq(void)
580 } 550 }
581 551
582 setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action); 552 setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action);
553#ifdef CONFIG_SMP
554 if (is_ext_irq_cascaded) {
555 setup_irq(MIPS_CPU_IRQ_BASE + 3, &cpu_ip3_cascade_action);
556 bcm63xx_internal_irq_chip.irq_set_affinity =
557 bcm63xx_internal_set_affinity;
558
559 cpumask_clear(irq_default_affinity);
560 cpumask_set_cpu(smp_processor_id(), irq_default_affinity);
561 }
562#endif
583} 563}
diff --git a/arch/mips/bcm63xx/reset.c b/arch/mips/bcm63xx/reset.c
index acbeb1fe7c57..d1fe51edf5e6 100644
--- a/arch/mips/bcm63xx/reset.c
+++ b/arch/mips/bcm63xx/reset.c
@@ -125,8 +125,6 @@
125#define BCM6368_RESET_PCIE 0 125#define BCM6368_RESET_PCIE 0
126#define BCM6368_RESET_PCIE_EXT 0 126#define BCM6368_RESET_PCIE_EXT 0
127 127
128#ifdef BCMCPU_RUNTIME_DETECT
129
130/* 128/*
131 * core reset bits 129 * core reset bits
132 */ 130 */
@@ -188,64 +186,6 @@ static int __init bcm63xx_reset_bits_init(void)
188 186
189 return 0; 187 return 0;
190} 188}
191#else
192
193#ifdef CONFIG_BCM63XX_CPU_3368
194static const u32 bcm63xx_reset_bits[] = {
195 __GEN_RESET_BITS_TABLE(3368)
196};
197#define reset_reg PERF_SOFTRESET_6358_REG
198#endif
199
200#ifdef CONFIG_BCM63XX_CPU_6328
201static const u32 bcm63xx_reset_bits[] = {
202 __GEN_RESET_BITS_TABLE(6328)
203};
204#define reset_reg PERF_SOFTRESET_6328_REG
205#endif
206
207#ifdef CONFIG_BCM63XX_CPU_6338
208static const u32 bcm63xx_reset_bits[] = {
209 __GEN_RESET_BITS_TABLE(6338)
210};
211#define reset_reg PERF_SOFTRESET_REG
212#endif
213
214#ifdef CONFIG_BCM63XX_CPU_6345
215static const u32 bcm63xx_reset_bits[] = { };
216#define reset_reg 0
217#endif
218
219#ifdef CONFIG_BCM63XX_CPU_6348
220static const u32 bcm63xx_reset_bits[] = {
221 __GEN_RESET_BITS_TABLE(6348)
222};
223#define reset_reg PERF_SOFTRESET_REG
224#endif
225
226#ifdef CONFIG_BCM63XX_CPU_6358
227static const u32 bcm63xx_reset_bits[] = {
228 __GEN_RESET_BITS_TABLE(6358)
229};
230#define reset_reg PERF_SOFTRESET_6358_REG
231#endif
232
233#ifdef CONFIG_BCM63XX_CPU_6362
234static const u32 bcm63xx_reset_bits[] = {
235 __GEN_RESET_BITS_TABLE(6362)
236};
237#define reset_reg PERF_SOFTRESET_6362_REG
238#endif
239
240#ifdef CONFIG_BCM63XX_CPU_6368
241static const u32 bcm63xx_reset_bits[] = {
242 __GEN_RESET_BITS_TABLE(6368)
243};
244#define reset_reg PERF_SOFTRESET_6368_REG
245#endif
246
247static int __init bcm63xx_reset_bits_init(void) { return 0; }
248#endif
249 189
250static DEFINE_SPINLOCK(reset_mutex); 190static DEFINE_SPINLOCK(reset_mutex);
251 191
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index c00c4ddf4514..b49c7adbfa89 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -67,10 +67,24 @@ void error(char *x)
67#include "../../../../lib/decompress_unxz.c" 67#include "../../../../lib/decompress_unxz.c"
68#endif 68#endif
69 69
70unsigned long __stack_chk_guard;
71
72void __stack_chk_guard_setup(void)
73{
74 __stack_chk_guard = 0x000a0dff;
75}
76
77void __stack_chk_fail(void)
78{
79 error("stack-protector: Kernel stack is corrupted\n");
80}
81
70void decompress_kernel(unsigned long boot_heap_start) 82void decompress_kernel(unsigned long boot_heap_start)
71{ 83{
72 unsigned long zimage_start, zimage_size; 84 unsigned long zimage_start, zimage_size;
73 85
86 __stack_chk_guard_setup();
87
74 zimage_start = (unsigned long)(&__image_begin); 88 zimage_start = (unsigned long)(&__image_begin);
75 zimage_size = (unsigned long)(&__image_end) - 89 zimage_size = (unsigned long)(&__image_end) -
76 (unsigned long)(&__image_begin); 90 (unsigned long)(&__image_begin);
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index b764df64be40..5dfef84b9576 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -186,6 +186,15 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
186 return 7 - ipd_port; 186 return 7 - ipd_port;
187 else 187 else
188 return -1; 188 return -1;
189 case CVMX_BOARD_TYPE_CUST_DSR1000N:
190 /*
191 * Port 2 connects to Broadcom PHY (B5081). Other ports (0-1)
192 * connect to a switch (BCM53115).
193 */
194 if (ipd_port == 2)
195 return 8;
196 else
197 return -1;
189 } 198 }
190 199
191 /* Some unknown board. Somebody forgot to update this function... */ 200 /* Some unknown board. Somebody forgot to update this function... */
@@ -274,6 +283,18 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
274 return result; 283 return result;
275 } 284 }
276 break; 285 break;
286 case CVMX_BOARD_TYPE_CUST_DSR1000N:
287 if (ipd_port == 0 || ipd_port == 1) {
288 /* Ports 0 and 1 connect to a switch (BCM53115). */
289 result.s.link_up = 1;
290 result.s.full_duplex = 1;
291 result.s.speed = 1000;
292 return result;
293 } else {
294 /* Port 2 uses a Broadcom PHY (B5081). */
295 is_broadcom_phy = 1;
296 }
297 break;
277 } 298 }
278 299
279 phy_addr = cvmx_helper_board_get_mii_address(ipd_port); 300 phy_addr = cvmx_helper_board_get_mii_address(ipd_port);
@@ -738,6 +759,7 @@ enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(vo
738 case CVMX_BOARD_TYPE_LANAI2_G: 759 case CVMX_BOARD_TYPE_LANAI2_G:
739 case CVMX_BOARD_TYPE_NIC10E_66: 760 case CVMX_BOARD_TYPE_NIC10E_66:
740 case CVMX_BOARD_TYPE_UBNT_E100: 761 case CVMX_BOARD_TYPE_UBNT_E100:
762 case CVMX_BOARD_TYPE_CUST_DSR1000N:
741 return USB_CLOCK_TYPE_CRYSTAL_12; 763 return USB_CLOCK_TYPE_CRYSTAL_12;
742 case CVMX_BOARD_TYPE_NIC10E: 764 case CVMX_BOARD_TYPE_NIC10E:
743 return USB_CLOCK_TYPE_REF_12; 765 return USB_CLOCK_TYPE_REF_12;
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
index 45f18cce31a9..6f9609e63a65 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-sgmii.c
@@ -317,10 +317,14 @@ static int __cvmx_helper_sgmii_hardware_init(int interface, int num_ports)
317 for (index = 0; index < num_ports; index++) { 317 for (index = 0; index < num_ports; index++) {
318 int ipd_port = cvmx_helper_get_ipd_port(interface, index); 318 int ipd_port = cvmx_helper_get_ipd_port(interface, index);
319 __cvmx_helper_sgmii_hardware_init_one_time(interface, index); 319 __cvmx_helper_sgmii_hardware_init_one_time(interface, index);
320 __cvmx_helper_sgmii_link_set(ipd_port, 320 /* Linux kernel driver will call ....link_set with the
321 __cvmx_helper_sgmii_link_get 321 * proper link state. In the simulator there is no
322 (ipd_port)); 322 * link state polling and hence it is set from
323 323 * here.
324 */
325 if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_SIM)
326 __cvmx_helper_sgmii_link_set(ipd_port,
327 __cvmx_helper_sgmii_link_get(ipd_port));
324 } 328 }
325 329
326 return 0; 330 return 0;
diff --git a/arch/mips/cavium-octeon/oct_ilm.c b/arch/mips/cavium-octeon/oct_ilm.c
index 71b213dbb621..2d68a39f1443 100644
--- a/arch/mips/cavium-octeon/oct_ilm.c
+++ b/arch/mips/cavium-octeon/oct_ilm.c
@@ -194,8 +194,7 @@ err_irq:
194static __exit void oct_ilm_module_exit(void) 194static __exit void oct_ilm_module_exit(void)
195{ 195{
196 disable_timer(TIMER_NUM); 196 disable_timer(TIMER_NUM);
197 if (dir) 197 debugfs_remove_recursive(dir);
198 debugfs_remove_recursive(dir);
199 free_irq(OCTEON_IRQ_TIMER0 + TIMER_NUM, 0); 198 free_irq(OCTEON_IRQ_TIMER0 + TIMER_NUM, 0);
200} 199}
201 200
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index a7b3ae104d8c..ecd903dd1c45 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -84,9 +84,14 @@ static void octeon_smp_hotplug_setup(void)
84#ifdef CONFIG_HOTPLUG_CPU 84#ifdef CONFIG_HOTPLUG_CPU
85 struct linux_app_boot_info *labi; 85 struct linux_app_boot_info *labi;
86 86
87 if (!setup_max_cpus)
88 return;
89
87 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER); 90 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
88 if (labi->labi_signature != LABI_SIGNATURE) 91 if (labi->labi_signature != LABI_SIGNATURE) {
89 panic("The bootloader version on this board is incorrect."); 92 pr_info("The bootloader on this board does not support HOTPLUG_CPU.");
93 return;
94 }
90 95
91 octeon_bootloader_entry_addr = labi->InitTLBStart_addr; 96 octeon_bootloader_entry_addr = labi->InitTLBStart_addr;
92#endif 97#endif
@@ -129,7 +134,8 @@ static void octeon_smp_setup(void)
129 * will assign CPU numbers for possible cores as well. Cores 134 * will assign CPU numbers for possible cores as well. Cores
130 * are always consecutively numberd from 0. 135 * are always consecutively numberd from 0.
131 */ 136 */
132 for (id = 0; id < num_cores && id < NR_CPUS; id++) { 137 for (id = 0; setup_max_cpus && octeon_bootloader_entry_addr &&
138 id < num_cores && id < NR_CPUS; id++) {
133 if (!(core_mask & (1 << id))) { 139 if (!(core_mask & (1 << id))) {
134 set_cpu_possible(cpus, true); 140 set_cpu_possible(cpus, true);
135 __cpu_number_map[id] = cpus; 141 __cpu_number_map[id] = cpus;
@@ -192,14 +198,6 @@ static void octeon_init_secondary(void)
192 */ 198 */
193void octeon_prepare_cpus(unsigned int max_cpus) 199void octeon_prepare_cpus(unsigned int max_cpus)
194{ 200{
195#ifdef CONFIG_HOTPLUG_CPU
196 struct linux_app_boot_info *labi;
197
198 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
199
200 if (labi->labi_signature != LABI_SIGNATURE)
201 panic("The bootloader version on this board is incorrect.");
202#endif
203 /* 201 /*
204 * Only the low order mailbox bits are used for IPIs, leave 202 * Only the low order mailbox bits are used for IPIs, leave
205 * the other bits alone. 203 * the other bits alone.
@@ -237,6 +235,9 @@ static int octeon_cpu_disable(void)
237 if (cpu == 0) 235 if (cpu == 0)
238 return -EBUSY; 236 return -EBUSY;
239 237
238 if (!octeon_bootloader_entry_addr)
239 return -ENOTSUPP;
240
240 set_cpu_online(cpu, false); 241 set_cpu_online(cpu, false);
241 cpu_clear(cpu, cpu_callin_map); 242 cpu_clear(cpu, cpu_callin_map);
242 local_irq_disable(); 243 local_irq_disable();
diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig
index dace58268ce1..b2476a1c4aaa 100644
--- a/arch/mips/configs/cavium_octeon_defconfig
+++ b/arch/mips/configs/cavium_octeon_defconfig
@@ -124,7 +124,6 @@ CONFIG_RTC_CLASS=y
124CONFIG_RTC_DRV_DS1307=y 124CONFIG_RTC_DRV_DS1307=y
125CONFIG_STAGING=y 125CONFIG_STAGING=y
126CONFIG_OCTEON_ETHERNET=y 126CONFIG_OCTEON_ETHERNET=y
127# CONFIG_NET_VENDOR_SILICOM is not set
128# CONFIG_IOMMU_SUPPORT is not set 127# CONFIG_IOMMU_SUPPORT is not set
129CONFIG_EXT4_FS=y 128CONFIG_EXT4_FS=y
130CONFIG_EXT4_FS_POSIX_ACL=y 129CONFIG_EXT4_FS_POSIX_ACL=y
diff --git a/arch/mips/configs/db1xxx_defconfig b/arch/mips/configs/db1xxx_defconfig
index a64b30b96a0d..46e8f7676a15 100644
--- a/arch/mips/configs/db1xxx_defconfig
+++ b/arch/mips/configs/db1xxx_defconfig
@@ -116,7 +116,6 @@ CONFIG_MTD_NAND_PLATFORM=y
116CONFIG_MTD_SPI_NOR=y 116CONFIG_MTD_SPI_NOR=y
117CONFIG_EEPROM_AT24=y 117CONFIG_EEPROM_AT24=y
118CONFIG_EEPROM_AT25=y 118CONFIG_EEPROM_AT25=y
119CONFIG_SCSI_TGT=y
120CONFIG_BLK_DEV_SD=y 119CONFIG_BLK_DEV_SD=y
121CONFIG_CHR_DEV_SG=y 120CONFIG_CHR_DEV_SG=y
122CONFIG_SCSI_MULTI_LUN=y 121CONFIG_SCSI_MULTI_LUN=y
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 87d0340837aa..ebc011c51e5a 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -45,7 +45,6 @@ CONFIG_VLAN_8021Q=m
45CONFIG_CONNECTOR=m 45CONFIG_CONNECTOR=m
46CONFIG_BLK_DEV_LOOP=m 46CONFIG_BLK_DEV_LOOP=m
47CONFIG_SCSI=y 47CONFIG_SCSI=y
48CONFIG_SCSI_TGT=m
49CONFIG_BLK_DEV_SD=y 48CONFIG_BLK_DEV_SD=y
50CONFIG_CHR_DEV_ST=m 49CONFIG_CHR_DEV_ST=m
51CONFIG_BLK_DEV_SR=m 50CONFIG_BLK_DEV_SR=m
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 936ec5a5ed8d..57ed466e00db 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -219,7 +219,6 @@ CONFIG_ATA_OVER_ETH=m
219# CONFIG_MISC_DEVICES is not set 219# CONFIG_MISC_DEVICES is not set
220CONFIG_RAID_ATTRS=m 220CONFIG_RAID_ATTRS=m
221CONFIG_SCSI=y 221CONFIG_SCSI=y
222CONFIG_SCSI_TGT=m
223CONFIG_BLK_DEV_SD=y 222CONFIG_BLK_DEV_SD=y
224CONFIG_CHR_DEV_ST=y 223CONFIG_CHR_DEV_ST=y
225CONFIG_BLK_DEV_SR=y 224CONFIG_BLK_DEV_SR=y
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 0e36abcd39cc..cc0756021398 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -106,7 +106,6 @@ CONFIG_CDROM_PKTCDVD=m
106CONFIG_ATA_OVER_ETH=m 106CONFIG_ATA_OVER_ETH=m
107# CONFIG_MISC_DEVICES is not set 107# CONFIG_MISC_DEVICES is not set
108CONFIG_SCSI=y 108CONFIG_SCSI=y
109CONFIG_SCSI_TGT=m
110CONFIG_BLK_DEV_SD=y 109CONFIG_BLK_DEV_SD=y
111CONFIG_CHR_DEV_ST=y 110CONFIG_CHR_DEV_ST=y
112CONFIG_BLK_DEV_SR=m 111CONFIG_BLK_DEV_SR=m
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 7bbd52194fc3..70ffe9b55829 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -54,7 +54,6 @@ CONFIG_BLK_DEV_NBD=m
54CONFIG_SGI_IOC4=y 54CONFIG_SGI_IOC4=y
55CONFIG_RAID_ATTRS=y 55CONFIG_RAID_ATTRS=y
56CONFIG_SCSI=y 56CONFIG_SCSI=y
57CONFIG_SCSI_TGT=y
58CONFIG_BLK_DEV_SD=y 57CONFIG_BLK_DEV_SD=y
59CONFIG_BLK_DEV_SR=y 58CONFIG_BLK_DEV_SR=y
60CONFIG_BLK_DEV_SR_VENDOR=y 59CONFIG_BLK_DEV_SR_VENDOR=y
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index 0315ee37a20b..2575302aa2be 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -208,7 +208,6 @@ CONFIG_CDROM_PKTCDVD=m
208CONFIG_ATA_OVER_ETH=m 208CONFIG_ATA_OVER_ETH=m
209CONFIG_RAID_ATTRS=m 209CONFIG_RAID_ATTRS=m
210CONFIG_SCSI=y 210CONFIG_SCSI=y
211CONFIG_SCSI_TGT=m
212CONFIG_BLK_DEV_SD=y 211CONFIG_BLK_DEV_SD=y
213CONFIG_CHR_DEV_ST=m 212CONFIG_CHR_DEV_ST=m
214CONFIG_BLK_DEV_SR=m 213CONFIG_BLK_DEV_SR=m
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index ea1761f0f917..4cb787ff273e 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -1,6 +1,6 @@
1CONFIG_MACH_LOONGSON=y 1CONFIG_MACH_LOONGSON=y
2CONFIG_SWIOTLB=y 2CONFIG_SWIOTLB=y
3CONFIG_LEMOTE_MACH3A=y 3CONFIG_LOONGSON_MACH3X=y
4CONFIG_CPU_LOONGSON3=y 4CONFIG_CPU_LOONGSON3=y
5CONFIG_64BIT=y 5CONFIG_64BIT=y
6CONFIG_PAGE_SIZE_16KB=y 6CONFIG_PAGE_SIZE_16KB=y
@@ -120,7 +120,6 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
120CONFIG_BLK_DEV_RAM=y 120CONFIG_BLK_DEV_RAM=y
121CONFIG_BLK_DEV_RAM_SIZE=8192 121CONFIG_BLK_DEV_RAM_SIZE=8192
122CONFIG_RAID_ATTRS=m 122CONFIG_RAID_ATTRS=m
123CONFIG_SCSI_TGT=y
124CONFIG_BLK_DEV_SD=y 123CONFIG_BLK_DEV_SD=y
125CONFIG_BLK_DEV_SR=y 124CONFIG_BLK_DEV_SR=y
126CONFIG_CHR_DEV_SG=y 125CONFIG_CHR_DEV_SG=y
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index b745b6a9f322..e18741ea1771 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -253,7 +253,6 @@ CONFIG_BLK_DEV_IT8213=m
253CONFIG_BLK_DEV_TC86C001=m 253CONFIG_BLK_DEV_TC86C001=m
254CONFIG_RAID_ATTRS=m 254CONFIG_RAID_ATTRS=m
255CONFIG_SCSI=m 255CONFIG_SCSI=m
256CONFIG_SCSI_TGT=m
257CONFIG_BLK_DEV_SD=m 256CONFIG_BLK_DEV_SD=m
258CONFIG_CHR_DEV_ST=m 257CONFIG_CHR_DEV_ST=m
259CONFIG_CHR_DEV_OSST=m 258CONFIG_CHR_DEV_OSST=m
diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig
index 4f7d952d8517..cf0e01f814e1 100644
--- a/arch/mips/configs/malta_kvm_defconfig
+++ b/arch/mips/configs/malta_kvm_defconfig
@@ -254,7 +254,6 @@ CONFIG_BLK_DEV_IT8213=m
254CONFIG_BLK_DEV_TC86C001=m 254CONFIG_BLK_DEV_TC86C001=m
255CONFIG_RAID_ATTRS=m 255CONFIG_RAID_ATTRS=m
256CONFIG_SCSI=m 256CONFIG_SCSI=m
257CONFIG_SCSI_TGT=m
258CONFIG_BLK_DEV_SD=m 257CONFIG_BLK_DEV_SD=m
259CONFIG_CHR_DEV_ST=m 258CONFIG_CHR_DEV_ST=m
260CONFIG_CHR_DEV_OSST=m 259CONFIG_CHR_DEV_OSST=m
diff --git a/arch/mips/configs/malta_kvm_guest_defconfig b/arch/mips/configs/malta_kvm_guest_defconfig
index e36681c24ddc..edd9ec9cb678 100644
--- a/arch/mips/configs/malta_kvm_guest_defconfig
+++ b/arch/mips/configs/malta_kvm_guest_defconfig
@@ -254,7 +254,6 @@ CONFIG_BLK_DEV_IT8213=m
254CONFIG_BLK_DEV_TC86C001=m 254CONFIG_BLK_DEV_TC86C001=m
255CONFIG_RAID_ATTRS=m 255CONFIG_RAID_ATTRS=m
256CONFIG_SCSI=m 256CONFIG_SCSI=m
257CONFIG_SCSI_TGT=m
258CONFIG_BLK_DEV_SD=m 257CONFIG_BLK_DEV_SD=m
259CONFIG_CHR_DEV_ST=m 258CONFIG_CHR_DEV_ST=m
260CONFIG_CHR_DEV_OSST=m 259CONFIG_CHR_DEV_OSST=m
diff --git a/arch/mips/configs/markeins_defconfig b/arch/mips/configs/markeins_defconfig
index 4c2c0c4b9bb1..0f08e4623ee4 100644
--- a/arch/mips/configs/markeins_defconfig
+++ b/arch/mips/configs/markeins_defconfig
@@ -134,7 +134,6 @@ CONFIG_BLK_DEV_LOOP=m
134CONFIG_BLK_DEV_CRYPTOLOOP=m 134CONFIG_BLK_DEV_CRYPTOLOOP=m
135CONFIG_SGI_IOC4=m 135CONFIG_SGI_IOC4=m
136CONFIG_SCSI=m 136CONFIG_SCSI=m
137CONFIG_SCSI_TGT=m
138# CONFIG_SCSI_PROC_FS is not set 137# CONFIG_SCSI_PROC_FS is not set
139CONFIG_BLK_DEV_SD=m 138CONFIG_BLK_DEV_SD=m
140CONFIG_CHR_DEV_SG=m 139CONFIG_CHR_DEV_SG=m
diff --git a/arch/mips/configs/nlm_xlp_defconfig b/arch/mips/configs/nlm_xlp_defconfig
index 5468b1c7b2a5..2f660e9a0da6 100644
--- a/arch/mips/configs/nlm_xlp_defconfig
+++ b/arch/mips/configs/nlm_xlp_defconfig
@@ -334,7 +334,6 @@ CONFIG_BLK_DEV_RAM=y
334CONFIG_BLK_DEV_RAM_SIZE=65536 334CONFIG_BLK_DEV_RAM_SIZE=65536
335CONFIG_CDROM_PKTCDVD=y 335CONFIG_CDROM_PKTCDVD=y
336CONFIG_RAID_ATTRS=m 336CONFIG_RAID_ATTRS=m
337CONFIG_SCSI_TGT=m
338CONFIG_BLK_DEV_SD=y 337CONFIG_BLK_DEV_SD=y
339CONFIG_CHR_DEV_ST=m 338CONFIG_CHR_DEV_ST=m
340CONFIG_CHR_DEV_OSST=m 339CONFIG_CHR_DEV_OSST=m
@@ -346,10 +345,8 @@ CONFIG_SCSI_CONSTANTS=y
346CONFIG_SCSI_LOGGING=y 345CONFIG_SCSI_LOGGING=y
347CONFIG_SCSI_SCAN_ASYNC=y 346CONFIG_SCSI_SCAN_ASYNC=y
348CONFIG_SCSI_SPI_ATTRS=m 347CONFIG_SCSI_SPI_ATTRS=m
349CONFIG_SCSI_FC_TGT_ATTRS=y
350CONFIG_SCSI_SAS_LIBSAS=m 348CONFIG_SCSI_SAS_LIBSAS=m
351CONFIG_SCSI_SRP_ATTRS=m 349CONFIG_SCSI_SRP_ATTRS=m
352CONFIG_SCSI_SRP_TGT_ATTRS=y
353CONFIG_ISCSI_TCP=m 350CONFIG_ISCSI_TCP=m
354CONFIG_LIBFCOE=m 351CONFIG_LIBFCOE=m
355CONFIG_SCSI_DEBUG=m 352CONFIG_SCSI_DEBUG=m
diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig
index 44b473420d51..c6f84655c98a 100644
--- a/arch/mips/configs/nlm_xlr_defconfig
+++ b/arch/mips/configs/nlm_xlr_defconfig
@@ -311,7 +311,6 @@ CONFIG_CDROM_PKTCDVD=y
311CONFIG_MISC_DEVICES=y 311CONFIG_MISC_DEVICES=y
312CONFIG_RAID_ATTRS=m 312CONFIG_RAID_ATTRS=m
313CONFIG_SCSI=y 313CONFIG_SCSI=y
314CONFIG_SCSI_TGT=m
315CONFIG_BLK_DEV_SD=y 314CONFIG_BLK_DEV_SD=y
316CONFIG_CHR_DEV_ST=m 315CONFIG_CHR_DEV_ST=m
317CONFIG_CHR_DEV_OSST=m 316CONFIG_CHR_DEV_OSST=m
@@ -323,10 +322,8 @@ CONFIG_SCSI_CONSTANTS=y
323CONFIG_SCSI_LOGGING=y 322CONFIG_SCSI_LOGGING=y
324CONFIG_SCSI_SCAN_ASYNC=y 323CONFIG_SCSI_SCAN_ASYNC=y
325CONFIG_SCSI_SPI_ATTRS=m 324CONFIG_SCSI_SPI_ATTRS=m
326CONFIG_SCSI_FC_TGT_ATTRS=y
327CONFIG_SCSI_SAS_LIBSAS=m 325CONFIG_SCSI_SAS_LIBSAS=m
328CONFIG_SCSI_SRP_ATTRS=m 326CONFIG_SCSI_SRP_ATTRS=m
329CONFIG_SCSI_SRP_TGT_ATTRS=y
330CONFIG_ISCSI_TCP=m 327CONFIG_ISCSI_TCP=m
331CONFIG_LIBFCOE=m 328CONFIG_LIBFCOE=m
332CONFIG_SCSI_DEBUG=m 329CONFIG_SCSI_DEBUG=m
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 73e7bf49461c..29d79ae8a823 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -221,7 +221,6 @@ CONFIG_ATA_OVER_ETH=m
221CONFIG_SGI_IOC4=m 221CONFIG_SGI_IOC4=m
222CONFIG_RAID_ATTRS=m 222CONFIG_RAID_ATTRS=m
223CONFIG_SCSI=y 223CONFIG_SCSI=y
224CONFIG_SCSI_TGT=m
225CONFIG_BLK_DEV_SD=y 224CONFIG_BLK_DEV_SD=y
226CONFIG_CHR_DEV_ST=m 225CONFIG_CHR_DEV_ST=m
227CONFIG_BLK_DEV_SR=m 226CONFIG_BLK_DEV_SR=m
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index d99b1905a1ba..9327b3af32cd 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -39,7 +39,6 @@ CONFIG_BLK_DEV_RAM=y
39CONFIG_BLK_DEV_XIP=y 39CONFIG_BLK_DEV_XIP=y
40# CONFIG_MISC_DEVICES is not set 40# CONFIG_MISC_DEVICES is not set
41CONFIG_SCSI=y 41CONFIG_SCSI=y
42CONFIG_SCSI_TGT=m
43CONFIG_BLK_DEV_SD=y 42CONFIG_BLK_DEV_SD=y
44CONFIG_SCSI_MULTI_LUN=y 43CONFIG_SCSI_MULTI_LUN=y
45CONFIG_SCSI_SCAN_ASYNC=y 44CONFIG_SCSI_SCAN_ASYNC=y
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index c415c4f0e5c2..a967289b7970 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -44,7 +44,6 @@ CONFIG_BLK_DEV_NBD=m
44CONFIG_BLK_DEV_RAM=y 44CONFIG_BLK_DEV_RAM=y
45CONFIG_BLK_DEV_XIP=y 45CONFIG_BLK_DEV_XIP=y
46# CONFIG_MISC_DEVICES is not set 46# CONFIG_MISC_DEVICES is not set
47CONFIG_SCSI_TGT=m
48CONFIG_BLK_DEV_SD=y 47CONFIG_BLK_DEV_SD=y
49CONFIG_SCSI_SCAN_ASYNC=y 48CONFIG_SCSI_SCAN_ASYNC=y
50# CONFIG_SCSI_LOWLEVEL is not set 49# CONFIG_SCSI_LOWLEVEL is not set
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 05439187891d..335e5290ec75 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -15,4 +15,5 @@ generic-y += segment.h
15generic-y += serial.h 15generic-y += serial.h
16generic-y += trace_clock.h 16generic-y += trace_clock.h
17generic-y += ucontext.h 17generic-y += ucontext.h
18generic-y += user.h
18generic-y += xor.h 19generic-y += xor.h
diff --git a/arch/mips/include/asm/abi.h b/arch/mips/include/asm/abi.h
index 909bb6984866..7186bb51b89b 100644
--- a/arch/mips/include/asm/abi.h
+++ b/arch/mips/include/asm/abi.h
@@ -13,13 +13,11 @@
13#include <asm/siginfo.h> 13#include <asm/siginfo.h>
14 14
15struct mips_abi { 15struct mips_abi {
16 int (* const setup_frame)(void *sig_return, struct k_sigaction *ka, 16 int (* const setup_frame)(void *sig_return, struct ksignal *ksig,
17 struct pt_regs *regs, int signr, 17 struct pt_regs *regs, sigset_t *set);
18 sigset_t *set);
19 const unsigned long signal_return_offset; 18 const unsigned long signal_return_offset;
20 int (* const setup_rt_frame)(void *sig_return, struct k_sigaction *ka, 19 int (* const setup_rt_frame)(void *sig_return, struct ksignal *ksig,
21 struct pt_regs *regs, int signr, 20 struct pt_regs *regs, sigset_t *set);
22 sigset_t *set, siginfo_t *info);
23 const unsigned long rt_signal_return_offset; 21 const unsigned long rt_signal_return_offset;
24 const unsigned long restart; 22 const unsigned long restart;
25}; 23};
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 3f745459fdb5..3b0e51d5a613 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -52,7 +52,7 @@
52 */ 52 */
53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) 53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
54#define XPHYSADDR(a) ((_ACAST64_(a)) & \ 54#define XPHYSADDR(a) ((_ACAST64_(a)) & \
55 _CONST64_(0x000000ffffffffff)) 55 _CONST64_(0x0000ffffffffffff))
56 56
57#ifdef CONFIG_64BIT 57#ifdef CONFIG_64BIT
58 58
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index 935543f14538..cd9a98bc8f60 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -10,6 +10,7 @@
10 10
11#include <asm/hazards.h> 11#include <asm/hazards.h>
12#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/msa.h>
13 14
14#ifdef CONFIG_32BIT 15#ifdef CONFIG_32BIT
15#include <asm/asmmacro-32.h> 16#include <asm/asmmacro-32.h>
@@ -378,9 +379,19 @@
378 st_d 29, THREAD_FPR29, \thread 379 st_d 29, THREAD_FPR29, \thread
379 st_d 30, THREAD_FPR30, \thread 380 st_d 30, THREAD_FPR30, \thread
380 st_d 31, THREAD_FPR31, \thread 381 st_d 31, THREAD_FPR31, \thread
382 .set push
383 .set noat
384 cfcmsa $1, MSA_CSR
385 sw $1, THREAD_MSA_CSR(\thread)
386 .set pop
381 .endm 387 .endm
382 388
383 .macro msa_restore_all thread 389 .macro msa_restore_all thread
390 .set push
391 .set noat
392 lw $1, THREAD_MSA_CSR(\thread)
393 ctcmsa MSA_CSR, $1
394 .set pop
384 ld_d 0, THREAD_FPR0, \thread 395 ld_d 0, THREAD_FPR0, \thread
385 ld_d 1, THREAD_FPR1, \thread 396 ld_d 1, THREAD_FPR1, \thread
386 ld_d 2, THREAD_FPR2, \thread 397 ld_d 2, THREAD_FPR2, \thread
@@ -415,4 +426,24 @@
415 ld_d 31, THREAD_FPR31, \thread 426 ld_d 31, THREAD_FPR31, \thread
416 .endm 427 .endm
417 428
429 .macro msa_init_upper wd
430#ifdef CONFIG_64BIT
431 insert_d \wd, 1
432#else
433 insert_w \wd, 2
434 insert_w \wd, 3
435#endif
436 .if 31-\wd
437 msa_init_upper (\wd+1)
438 .endif
439 .endm
440
441 .macro msa_init_all_upper
442 .set push
443 .set noat
444 not $1, zero
445 msa_init_upper 0
446 .set pop
447 .endm
448
418#endif /* _ASM_ASMMACRO_H */ 449#endif /* _ASM_ASMMACRO_H */
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 7c8816f7b7c4..bae6b0fa8ab5 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -559,7 +559,13 @@ static inline int fls(int x)
559 int r; 559 int r;
560 560
561 if (__builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) { 561 if (__builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) {
562 __asm__("clz %0, %1" : "=r" (x) : "r" (x)); 562 __asm__(
563 " .set push \n"
564 " .set mips32 \n"
565 " clz %0, %1 \n"
566 " .set pop \n"
567 : "=r" (x)
568 : "r" (x));
563 569
564 return 32 - x; 570 return 32 - x;
565 } 571 }
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index c1516cc0285f..d0352983b94d 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -32,6 +32,14 @@ extern void nlm_cop2_restore(struct nlm_cop2_state *);
32#define cop2_present 1 32#define cop2_present 1
33#define cop2_lazy_restore 0 33#define cop2_lazy_restore 0
34 34
35#elif defined(CONFIG_CPU_LOONGSON3)
36
37#define cop2_save(r)
38#define cop2_restore(r)
39
40#define cop2_present 1
41#define cop2_lazy_restore 1
42
35#else 43#else
36 44
37#define cop2_present 0 45#define cop2_present 0
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index c7d8c997d93e..e079598ae051 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -29,6 +29,15 @@
29#ifndef cpu_has_eva 29#ifndef cpu_has_eva
30#define cpu_has_eva (cpu_data[0].options & MIPS_CPU_EVA) 30#define cpu_has_eva (cpu_data[0].options & MIPS_CPU_EVA)
31#endif 31#endif
32#ifndef cpu_has_htw
33#define cpu_has_htw (cpu_data[0].options & MIPS_CPU_HTW)
34#endif
35#ifndef cpu_has_rixiex
36#define cpu_has_rixiex (cpu_data[0].options & MIPS_CPU_RIXIEX)
37#endif
38#ifndef cpu_has_maar
39#define cpu_has_maar (cpu_data[0].options & MIPS_CPU_MAAR)
40#endif
32 41
33/* 42/*
34 * For the moment we don't consider R6000 and R8000 so we can assume that 43 * For the moment we don't consider R6000 and R8000 so we can assume that
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index 47d5967ce7ef..d5f42c168001 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -44,8 +44,8 @@ struct cpuinfo_mips {
44 /* 44 /*
45 * Capability and feature descriptor structure for MIPS CPU 45 * Capability and feature descriptor structure for MIPS CPU
46 */ 46 */
47 unsigned long options;
48 unsigned long ases; 47 unsigned long ases;
48 unsigned long long options;
49 unsigned int udelay_val; 49 unsigned int udelay_val;
50 unsigned int processor_id; 50 unsigned int processor_id;
51 unsigned int fpu_id; 51 unsigned int fpu_id;
@@ -61,6 +61,7 @@ struct cpuinfo_mips {
61 struct cache_desc scache; /* Secondary cache */ 61 struct cache_desc scache; /* Secondary cache */
62 struct cache_desc tcache; /* Tertiary/split secondary cache */ 62 struct cache_desc tcache; /* Tertiary/split secondary cache */
63 int srsets; /* Shadow register sets */ 63 int srsets; /* Shadow register sets */
64 int package;/* physical package number */
64 int core; /* physical core number */ 65 int core; /* physical core number */
65#ifdef CONFIG_64BIT 66#ifdef CONFIG_64BIT
66 int vmbits; /* Virtual memory size in bits */ 67 int vmbits; /* Virtual memory size in bits */
@@ -115,7 +116,7 @@ struct proc_cpuinfo_notifier_args {
115#ifdef CONFIG_MIPS_MT_SMP 116#ifdef CONFIG_MIPS_MT_SMP
116# define cpu_vpe_id(cpuinfo) ((cpuinfo)->vpe_id) 117# define cpu_vpe_id(cpuinfo) ((cpuinfo)->vpe_id)
117#else 118#else
118# define cpu_vpe_id(cpuinfo) 0 119# define cpu_vpe_id(cpuinfo) ({ (void)cpuinfo; 0; })
119#endif 120#endif
120 121
121#endif /* __ASM_CPU_INFO_H */ 122#endif /* __ASM_CPU_INFO_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 129d08701e91..dfdc77ed1839 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -233,6 +233,8 @@
233#define PRID_REV_LOONGSON2E 0x0002 233#define PRID_REV_LOONGSON2E 0x0002
234#define PRID_REV_LOONGSON2F 0x0003 234#define PRID_REV_LOONGSON2F 0x0003
235#define PRID_REV_LOONGSON3A 0x0005 235#define PRID_REV_LOONGSON3A 0x0005
236#define PRID_REV_LOONGSON3B_R1 0x0006
237#define PRID_REV_LOONGSON3B_R2 0x0007
236 238
237/* 239/*
238 * Older processors used to encode processor version and revision in two 240 * Older processors used to encode processor version and revision in two
@@ -335,34 +337,37 @@ enum cpu_type_enum {
335/* 337/*
336 * CPU Option encodings 338 * CPU Option encodings
337 */ 339 */
338#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */ 340#define MIPS_CPU_TLB 0x00000001ull /* CPU has TLB */
339#define MIPS_CPU_4KEX 0x00000002 /* "R4K" exception model */ 341#define MIPS_CPU_4KEX 0x00000002ull /* "R4K" exception model */
340#define MIPS_CPU_3K_CACHE 0x00000004 /* R3000-style caches */ 342#define MIPS_CPU_3K_CACHE 0x00000004ull /* R3000-style caches */
341#define MIPS_CPU_4K_CACHE 0x00000008 /* R4000-style caches */ 343#define MIPS_CPU_4K_CACHE 0x00000008ull /* R4000-style caches */
342#define MIPS_CPU_TX39_CACHE 0x00000010 /* TX3900-style caches */ 344#define MIPS_CPU_TX39_CACHE 0x00000010ull /* TX3900-style caches */
343#define MIPS_CPU_FPU 0x00000020 /* CPU has FPU */ 345#define MIPS_CPU_FPU 0x00000020ull /* CPU has FPU */
344#define MIPS_CPU_32FPR 0x00000040 /* 32 dbl. prec. FP registers */ 346#define MIPS_CPU_32FPR 0x00000040ull /* 32 dbl. prec. FP registers */
345#define MIPS_CPU_COUNTER 0x00000080 /* Cycle count/compare */ 347#define MIPS_CPU_COUNTER 0x00000080ull /* Cycle count/compare */
346#define MIPS_CPU_WATCH 0x00000100 /* watchpoint registers */ 348#define MIPS_CPU_WATCH 0x00000100ull /* watchpoint registers */
347#define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */ 349#define MIPS_CPU_DIVEC 0x00000200ull /* dedicated interrupt vector */
348#define MIPS_CPU_VCE 0x00000400 /* virt. coherence conflict possible */ 350#define MIPS_CPU_VCE 0x00000400ull /* virt. coherence conflict possible */
349#define MIPS_CPU_CACHE_CDEX_P 0x00000800 /* Create_Dirty_Exclusive CACHE op */ 351#define MIPS_CPU_CACHE_CDEX_P 0x00000800ull /* Create_Dirty_Exclusive CACHE op */
350#define MIPS_CPU_CACHE_CDEX_S 0x00001000 /* ... same for seconary cache ... */ 352#define MIPS_CPU_CACHE_CDEX_S 0x00001000ull /* ... same for seconary cache ... */
351#define MIPS_CPU_MCHECK 0x00002000 /* Machine check exception */ 353#define MIPS_CPU_MCHECK 0x00002000ull /* Machine check exception */
352#define MIPS_CPU_EJTAG 0x00004000 /* EJTAG exception */ 354#define MIPS_CPU_EJTAG 0x00004000ull /* EJTAG exception */
353#define MIPS_CPU_NOFPUEX 0x00008000 /* no FPU exception */ 355#define MIPS_CPU_NOFPUEX 0x00008000ull /* no FPU exception */
354#define MIPS_CPU_LLSC 0x00010000 /* CPU has ll/sc instructions */ 356#define MIPS_CPU_LLSC 0x00010000ull /* CPU has ll/sc instructions */
355#define MIPS_CPU_INCLUSIVE_CACHES 0x00020000 /* P-cache subset enforced */ 357#define MIPS_CPU_INCLUSIVE_CACHES 0x00020000ull /* P-cache subset enforced */
356#define MIPS_CPU_PREFETCH 0x00040000 /* CPU has usable prefetch */ 358#define MIPS_CPU_PREFETCH 0x00040000ull /* CPU has usable prefetch */
357#define MIPS_CPU_VINT 0x00080000 /* CPU supports MIPSR2 vectored interrupts */ 359#define MIPS_CPU_VINT 0x00080000ull /* CPU supports MIPSR2 vectored interrupts */
358#define MIPS_CPU_VEIC 0x00100000 /* CPU supports MIPSR2 external interrupt controller mode */ 360#define MIPS_CPU_VEIC 0x00100000ull /* CPU supports MIPSR2 external interrupt controller mode */
359#define MIPS_CPU_ULRI 0x00200000 /* CPU has ULRI feature */ 361#define MIPS_CPU_ULRI 0x00200000ull /* CPU has ULRI feature */
360#define MIPS_CPU_PCI 0x00400000 /* CPU has Perf Ctr Int indicator */ 362#define MIPS_CPU_PCI 0x00400000ull /* CPU has Perf Ctr Int indicator */
361#define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */ 363#define MIPS_CPU_RIXI 0x00800000ull /* CPU has TLB Read/eXec Inhibit */
362#define MIPS_CPU_MICROMIPS 0x01000000 /* CPU has microMIPS capability */ 364#define MIPS_CPU_MICROMIPS 0x01000000ull /* CPU has microMIPS capability */
363#define MIPS_CPU_TLBINV 0x02000000 /* CPU supports TLBINV/F */ 365#define MIPS_CPU_TLBINV 0x02000000ull /* CPU supports TLBINV/F */
364#define MIPS_CPU_SEGMENTS 0x04000000 /* CPU supports Segmentation Control registers */ 366#define MIPS_CPU_SEGMENTS 0x04000000ull /* CPU supports Segmentation Control registers */
365#define MIPS_CPU_EVA 0x80000000 /* CPU supports Enhanced Virtual Addressing */ 367#define MIPS_CPU_EVA 0x80000000ull /* CPU supports Enhanced Virtual Addressing */
368#define MIPS_CPU_HTW 0x100000000ull /* CPU support Hardware Page Table Walker */
369#define MIPS_CPU_RIXIEX 0x200000000ull /* CPU has unique exception codes for {Read, Execute}-Inhibit exceptions */
370#define MIPS_CPU_MAAR 0x400000000ull /* MAAR(I) registers are present */
366 371
367/* 372/*
368 * CPU ASE encodings 373 * CPU ASE encodings
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index d4144056e928..1d38fe0edd2d 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -339,23 +339,6 @@ do { \
339 339
340#endif /* CONFIG_64BIT */ 340#endif /* CONFIG_64BIT */
341 341
342struct pt_regs;
343struct task_struct;
344
345extern void elf_dump_regs(elf_greg_t *, struct pt_regs *regs);
346extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
347extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
348
349#ifndef ELF_CORE_COPY_REGS
350#define ELF_CORE_COPY_REGS(elf_regs, regs) \
351 elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
352#endif
353#ifndef ELF_CORE_COPY_TASK_REGS
354#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
355#endif
356#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
357 dump_task_fpu(tsk, elf_fpregs)
358
359#define CORE_DUMP_USE_REGSET 342#define CORE_DUMP_USE_REGSET
360#define ELF_EXEC_PAGESIZE PAGE_SIZE 343#define ELF_EXEC_PAGESIZE PAGE_SIZE
361 344
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index a939574f8293..4d0aeda68397 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -21,6 +21,7 @@
21#include <asm/hazards.h> 21#include <asm/hazards.h>
22#include <asm/processor.h> 22#include <asm/processor.h>
23#include <asm/current.h> 23#include <asm/current.h>
24#include <asm/msa.h>
24 25
25#ifdef CONFIG_MIPS_MT_FPAFF 26#ifdef CONFIG_MIPS_MT_FPAFF
26#include <asm/mips_mt.h> 27#include <asm/mips_mt.h>
@@ -141,13 +142,21 @@ static inline int own_fpu(int restore)
141static inline void lose_fpu(int save) 142static inline void lose_fpu(int save)
142{ 143{
143 preempt_disable(); 144 preempt_disable();
144 if (is_fpu_owner()) { 145 if (is_msa_enabled()) {
146 if (save) {
147 save_msa(current);
148 asm volatile("cfc1 %0, $31"
149 : "=r"(current->thread.fpu.fcr31));
150 }
151 disable_msa();
152 clear_thread_flag(TIF_USEDMSA);
153 } else if (is_fpu_owner()) {
145 if (save) 154 if (save)
146 _save_fp(current); 155 _save_fp(current);
147 KSTK_STATUS(current) &= ~ST0_CU1;
148 clear_thread_flag(TIF_USEDFPU);
149 __disable_fpu(); 156 __disable_fpu();
150 } 157 }
158 KSTK_STATUS(current) &= ~ST0_CU1;
159 clear_thread_flag(TIF_USEDFPU);
151 preempt_enable(); 160 preempt_enable();
152} 161}
153 162
@@ -155,8 +164,6 @@ static inline int init_fpu(void)
155{ 164{
156 int ret = 0; 165 int ret = 0;
157 166
158 preempt_disable();
159
160 if (cpu_has_fpu) { 167 if (cpu_has_fpu) {
161 ret = __own_fpu(); 168 ret = __own_fpu();
162 if (!ret) 169 if (!ret)
@@ -164,8 +171,6 @@ static inline int init_fpu(void)
164 } else 171 } else
165 fpu_emulator_init_fpu(); 172 fpu_emulator_init_fpu();
166 173
167 preempt_enable();
168
169 return ret; 174 return ret;
170} 175}
171 176
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 10f6a99f92c2..3f20b2111d56 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -14,6 +14,8 @@
14#include <linux/bitmap.h> 14#include <linux/bitmap.h>
15#include <linux/threads.h> 15#include <linux/threads.h>
16 16
17#include <irq.h>
18
17#undef GICISBYTELITTLEENDIAN 19#undef GICISBYTELITTLEENDIAN
18 20
19/* Constants */ 21/* Constants */
@@ -22,8 +24,6 @@
22#define GIC_TRIG_EDGE 1 24#define GIC_TRIG_EDGE 1
23#define GIC_TRIG_LEVEL 0 25#define GIC_TRIG_LEVEL 0
24 26
25#define GIC_NUM_INTRS (24 + NR_CPUS * 2)
26
27#define MSK(n) ((1 << (n)) - 1) 27#define MSK(n) ((1 << (n)) - 1)
28#define REG32(addr) (*(volatile unsigned int *) (addr)) 28#define REG32(addr) (*(volatile unsigned int *) (addr))
29#define REG(base, offs) REG32((unsigned long)(base) + offs##_##OFS) 29#define REG(base, offs) REG32((unsigned long)(base) + offs##_##OFS)
@@ -43,18 +43,17 @@
43#ifdef GICISBYTELITTLEENDIAN 43#ifdef GICISBYTELITTLEENDIAN
44#define GICREAD(reg, data) ((data) = (reg), (data) = le32_to_cpu(data)) 44#define GICREAD(reg, data) ((data) = (reg), (data) = le32_to_cpu(data))
45#define GICWRITE(reg, data) ((reg) = cpu_to_le32(data)) 45#define GICWRITE(reg, data) ((reg) = cpu_to_le32(data))
46#define GICBIS(reg, bits) \
47 ({unsigned int data; \
48 GICREAD(reg, data); \
49 data |= bits; \
50 GICWRITE(reg, data); \
51 })
52
53#else 46#else
54#define GICREAD(reg, data) ((data) = (reg)) 47#define GICREAD(reg, data) ((data) = (reg))
55#define GICWRITE(reg, data) ((reg) = (data)) 48#define GICWRITE(reg, data) ((reg) = (data))
56#define GICBIS(reg, bits) ((reg) |= (bits))
57#endif 49#endif
50#define GICBIS(reg, mask, bits) \
51 do { u32 data; \
52 GICREAD((reg), data); \
53 data &= ~(mask); \
54 data |= ((bits) & (mask)); \
55 GICWRITE((reg), data); \
56 } while (0)
58 57
59 58
60/* GIC Address Space */ 59/* GIC Address Space */
@@ -170,13 +169,15 @@
170#define GIC_SH_SET_POLARITY_OFS 0x0100 169#define GIC_SH_SET_POLARITY_OFS 0x0100
171#define GIC_SET_POLARITY(intr, pol) \ 170#define GIC_SET_POLARITY(intr, pol) \
172 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + \ 171 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + \
173 GIC_INTR_OFS(intr)), (pol) << GIC_INTR_BIT(intr)) 172 GIC_INTR_OFS(intr)), (1 << GIC_INTR_BIT(intr)), \
173 (pol) << GIC_INTR_BIT(intr))
174 174
175/* Triggering : Reset Value is always 0 */ 175/* Triggering : Reset Value is always 0 */
176#define GIC_SH_SET_TRIGGER_OFS 0x0180 176#define GIC_SH_SET_TRIGGER_OFS 0x0180
177#define GIC_SET_TRIGGER(intr, trig) \ 177#define GIC_SET_TRIGGER(intr, trig) \
178 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + \ 178 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + \
179 GIC_INTR_OFS(intr)), (trig) << GIC_INTR_BIT(intr)) 179 GIC_INTR_OFS(intr)), (1 << GIC_INTR_BIT(intr)), \
180 (trig) << GIC_INTR_BIT(intr))
180 181
181/* Mask manipulation */ 182/* Mask manipulation */
182#define GIC_SH_SMASK_OFS 0x0380 183#define GIC_SH_SMASK_OFS 0x0380
@@ -306,18 +307,6 @@
306 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe)), \ 307 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe)), \
307 GIC_SH_MAP_TO_VPE_REG_BIT(vpe)) 308 GIC_SH_MAP_TO_VPE_REG_BIT(vpe))
308 309
309struct gic_pcpu_mask {
310 DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS);
311};
312
313struct gic_pending_regs {
314 DECLARE_BITMAP(pending, GIC_NUM_INTRS);
315};
316
317struct gic_intrmask_regs {
318 DECLARE_BITMAP(intrmask, GIC_NUM_INTRS);
319};
320
321/* 310/*
322 * Interrupt Meta-data specification. The ipiflag helps 311 * Interrupt Meta-data specification. The ipiflag helps
323 * in building ipi_map. 312 * in building ipi_map.
@@ -329,8 +318,7 @@ struct gic_intr_map {
329 unsigned int polarity; /* Polarity : +/- */ 318 unsigned int polarity; /* Polarity : +/- */
330 unsigned int trigtype; /* Trigger : Edge/Levl */ 319 unsigned int trigtype; /* Trigger : Edge/Levl */
331 unsigned int flags; /* Misc flags */ 320 unsigned int flags; /* Misc flags */
332#define GIC_FLAG_IPI 0x01 321#define GIC_FLAG_TRANSPARENT 0x01
333#define GIC_FLAG_TRANSPARENT 0x02
334}; 322};
335 323
336/* 324/*
@@ -386,6 +374,7 @@ extern unsigned int plat_ipi_call_int_xlate(unsigned int);
386extern unsigned int plat_ipi_resched_int_xlate(unsigned int); 374extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
387extern void gic_bind_eic_interrupt(int irq, int set); 375extern void gic_bind_eic_interrupt(int irq, int set);
388extern unsigned int gic_get_timer_pending(void); 376extern unsigned int gic_get_timer_pending(void);
377extern void gic_get_int_mask(unsigned long *dst, const unsigned long *src);
389extern unsigned int gic_get_int(void); 378extern unsigned int gic_get_int(void);
390extern void gic_enable_interrupt(int irq_vec); 379extern void gic_enable_interrupt(int irq_vec);
391extern void gic_disable_interrupt(int irq_vec); 380extern void gic_disable_interrupt(int irq_vec);
diff --git a/arch/mips/include/asm/maar.h b/arch/mips/include/asm/maar.h
new file mode 100644
index 000000000000..6c62b0f899c0
--- /dev/null
+++ b/arch/mips/include/asm/maar.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MIPS_ASM_MIPS_MAAR_H__
12#define __MIPS_ASM_MIPS_MAAR_H__
13
14#include <asm/hazards.h>
15#include <asm/mipsregs.h>
16
17/**
18 * platform_maar_init() - perform platform-level MAAR configuration
19 * @num_pairs: The number of MAAR pairs present in the system.
20 *
21 * Platforms should implement this function such that it configures as many
22 * MAAR pairs as required, from 0 up to the maximum of num_pairs-1, and returns
23 * the number that were used. Any further MAARs will be configured to be
24 * invalid. The default implementation of this function will simply indicate
25 * that it has configured 0 MAAR pairs.
26 *
27 * Return: The number of MAAR pairs configured.
28 */
29unsigned __weak platform_maar_init(unsigned num_pairs);
30
31/**
32 * write_maar_pair() - write to a pair of MAARs
33 * @idx: The index of the pair (ie. use MAARs idx*2 & (idx*2)+1).
34 * @lower: The lowest address that the MAAR pair will affect. Must be
35 * aligned to a 2^16 byte boundary.
36 * @upper: The highest address that the MAAR pair will affect. Must be
37 * aligned to one byte before a 2^16 byte boundary.
38 * @attrs: The accessibility attributes to program, eg. MIPS_MAAR_S. The
39 * MIPS_MAAR_V attribute will automatically be set.
40 *
41 * Program the pair of MAAR registers specified by idx to apply the attributes
42 * specified by attrs to the range of addresses from lower to higher.
43 */
44static inline void write_maar_pair(unsigned idx, phys_addr_t lower,
45 phys_addr_t upper, unsigned attrs)
46{
47 /* Addresses begin at bit 16, but are shifted right 4 bits */
48 BUG_ON(lower & (0xffff | ~(MIPS_MAAR_ADDR << 4)));
49 BUG_ON(((upper & 0xffff) != 0xffff)
50 || ((upper & ~0xffffull) & ~(MIPS_MAAR_ADDR << 4)));
51
52 /* Automatically set MIPS_MAAR_V */
53 attrs |= MIPS_MAAR_V;
54
55 /* Write the upper address & attributes (only MIPS_MAAR_V matters) */
56 write_c0_maari(idx << 1);
57 back_to_back_c0_hazard();
58 write_c0_maar(((upper >> 4) & MIPS_MAAR_ADDR) | attrs);
59 back_to_back_c0_hazard();
60
61 /* Write the lower address & attributes */
62 write_c0_maari((idx << 1) | 0x1);
63 back_to_back_c0_hazard();
64 write_c0_maar((lower >> 4) | attrs);
65 back_to_back_c0_hazard();
66}
67
68/**
69 * struct maar_config - MAAR configuration data
70 * @lower: The lowest address that the MAAR pair will affect. Must be
71 * aligned to a 2^16 byte boundary.
72 * @upper: The highest address that the MAAR pair will affect. Must be
73 * aligned to one byte before a 2^16 byte boundary.
74 * @attrs: The accessibility attributes to program, eg. MIPS_MAAR_S. The
75 * MIPS_MAAR_V attribute will automatically be set.
76 *
77 * Describes the configuration of a pair of Memory Accessibility Attribute
78 * Registers - applying attributes from attrs to the range of physical
79 * addresses from lower to upper inclusive.
80 */
81struct maar_config {
82 phys_addr_t lower;
83 phys_addr_t upper;
84 unsigned attrs;
85};
86
87/**
88 * maar_config() - configure MAARs according to provided data
89 * @cfg: Pointer to an array of struct maar_config.
90 * @num_cfg: The number of structs in the cfg array.
91 * @num_pairs: The number of MAAR pairs present in the system.
92 *
93 * Configures as many MAARs as are present and specified in the cfg
94 * array with the values taken from the cfg array.
95 *
96 * Return: The number of MAAR pairs configured.
97 */
98static inline unsigned maar_config(const struct maar_config *cfg,
99 unsigned num_cfg, unsigned num_pairs)
100{
101 unsigned i;
102
103 for (i = 0; i < min(num_cfg, num_pairs); i++)
104 write_maar_pair(i, cfg[i].lower, cfg[i].upper, cfg[i].attrs);
105
106 return i;
107}
108
109#endif /* __MIPS_ASM_MIPS_MAAR_H__ */
diff --git a/arch/mips/include/asm/mach-au1x00/au1000.h b/arch/mips/include/asm/mach-au1x00/au1000.h
index b4c3ecb17d48..a7eec3364a64 100644
--- a/arch/mips/include/asm/mach-au1x00/au1000.h
+++ b/arch/mips/include/asm/mach-au1x00/au1000.h
@@ -34,6 +34,558 @@
34#ifndef _AU1000_H_ 34#ifndef _AU1000_H_
35#define _AU1000_H_ 35#define _AU1000_H_
36 36
37/* SOC Interrupt numbers */
38/* Au1000-style (IC0/1): 2 controllers with 32 sources each */
39#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
40#define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
41#define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
42#define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
43#define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
44
45/* Au1300-style (GPIC): 1 controller with up to 128 sources */
46#define ALCHEMY_GPIC_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
47#define ALCHEMY_GPIC_INT_NUM 128
48#define ALCHEMY_GPIC_INT_LAST (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
49
50/* common clock names, shared among all variants. AUXPLL2 is Au1300 */
51#define ALCHEMY_ROOT_CLK "root_clk"
52#define ALCHEMY_CPU_CLK "cpu_clk"
53#define ALCHEMY_AUXPLL_CLK "auxpll_clk"
54#define ALCHEMY_AUXPLL2_CLK "auxpll2_clk"
55#define ALCHEMY_SYSBUS_CLK "sysbus_clk"
56#define ALCHEMY_PERIPH_CLK "periph_clk"
57#define ALCHEMY_MEM_CLK "mem_clk"
58#define ALCHEMY_LR_CLK "lr_clk"
59#define ALCHEMY_FG0_CLK "fg0_clk"
60#define ALCHEMY_FG1_CLK "fg1_clk"
61#define ALCHEMY_FG2_CLK "fg2_clk"
62#define ALCHEMY_FG3_CLK "fg3_clk"
63#define ALCHEMY_FG4_CLK "fg4_clk"
64#define ALCHEMY_FG5_CLK "fg5_clk"
65
66/* Au1300 peripheral interrupt numbers */
67#define AU1300_FIRST_INT (ALCHEMY_GPIC_INT_BASE)
68#define AU1300_UART1_INT (AU1300_FIRST_INT + 17)
69#define AU1300_UART2_INT (AU1300_FIRST_INT + 25)
70#define AU1300_UART3_INT (AU1300_FIRST_INT + 27)
71#define AU1300_SD1_INT (AU1300_FIRST_INT + 32)
72#define AU1300_SD2_INT (AU1300_FIRST_INT + 38)
73#define AU1300_PSC0_INT (AU1300_FIRST_INT + 48)
74#define AU1300_PSC1_INT (AU1300_FIRST_INT + 52)
75#define AU1300_PSC2_INT (AU1300_FIRST_INT + 56)
76#define AU1300_PSC3_INT (AU1300_FIRST_INT + 60)
77#define AU1300_NAND_INT (AU1300_FIRST_INT + 62)
78#define AU1300_DDMA_INT (AU1300_FIRST_INT + 75)
79#define AU1300_MMU_INT (AU1300_FIRST_INT + 76)
80#define AU1300_MPU_INT (AU1300_FIRST_INT + 77)
81#define AU1300_GPU_INT (AU1300_FIRST_INT + 78)
82#define AU1300_UDMA_INT (AU1300_FIRST_INT + 79)
83#define AU1300_TOY_INT (AU1300_FIRST_INT + 80)
84#define AU1300_TOY_MATCH0_INT (AU1300_FIRST_INT + 81)
85#define AU1300_TOY_MATCH1_INT (AU1300_FIRST_INT + 82)
86#define AU1300_TOY_MATCH2_INT (AU1300_FIRST_INT + 83)
87#define AU1300_RTC_INT (AU1300_FIRST_INT + 84)
88#define AU1300_RTC_MATCH0_INT (AU1300_FIRST_INT + 85)
89#define AU1300_RTC_MATCH1_INT (AU1300_FIRST_INT + 86)
90#define AU1300_RTC_MATCH2_INT (AU1300_FIRST_INT + 87)
91#define AU1300_UART0_INT (AU1300_FIRST_INT + 88)
92#define AU1300_SD0_INT (AU1300_FIRST_INT + 89)
93#define AU1300_USB_INT (AU1300_FIRST_INT + 90)
94#define AU1300_LCD_INT (AU1300_FIRST_INT + 91)
95#define AU1300_BSA_INT (AU1300_FIRST_INT + 92)
96#define AU1300_MPE_INT (AU1300_FIRST_INT + 93)
97#define AU1300_ITE_INT (AU1300_FIRST_INT + 94)
98#define AU1300_AES_INT (AU1300_FIRST_INT + 95)
99#define AU1300_CIM_INT (AU1300_FIRST_INT + 96)
100
101/**********************************************************************/
102
103/*
104 * Physical base addresses for integrated peripherals
105 * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
106 */
107
108#define AU1000_AC97_PHYS_ADDR 0x10000000 /* 012 */
109#define AU1300_ROM_PHYS_ADDR 0x10000000 /* 5 */
110#define AU1300_OTP_PHYS_ADDR 0x10002000 /* 5 */
111#define AU1300_VSS_PHYS_ADDR 0x10003000 /* 5 */
112#define AU1300_UART0_PHYS_ADDR 0x10100000 /* 5 */
113#define AU1300_UART1_PHYS_ADDR 0x10101000 /* 5 */
114#define AU1300_UART2_PHYS_ADDR 0x10102000 /* 5 */
115#define AU1300_UART3_PHYS_ADDR 0x10103000 /* 5 */
116#define AU1000_USB_OHCI_PHYS_ADDR 0x10100000 /* 012 */
117#define AU1000_USB_UDC_PHYS_ADDR 0x10200000 /* 0123 */
118#define AU1300_GPIC_PHYS_ADDR 0x10200000 /* 5 */
119#define AU1000_IRDA_PHYS_ADDR 0x10300000 /* 02 */
120#define AU1200_AES_PHYS_ADDR 0x10300000 /* 45 */
121#define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
122#define AU1300_GPU_PHYS_ADDR 0x10500000 /* 5 */
123#define AU1000_MAC0_PHYS_ADDR 0x10500000 /* 023 */
124#define AU1000_MAC1_PHYS_ADDR 0x10510000 /* 023 */
125#define AU1000_MACEN_PHYS_ADDR 0x10520000 /* 023 */
126#define AU1100_SD0_PHYS_ADDR 0x10600000 /* 245 */
127#define AU1300_SD1_PHYS_ADDR 0x10601000 /* 5 */
128#define AU1300_SD2_PHYS_ADDR 0x10602000 /* 5 */
129#define AU1100_SD1_PHYS_ADDR 0x10680000 /* 24 */
130#define AU1300_SYS_PHYS_ADDR 0x10900000 /* 5 */
131#define AU1550_PSC2_PHYS_ADDR 0x10A00000 /* 3 */
132#define AU1550_PSC3_PHYS_ADDR 0x10B00000 /* 3 */
133#define AU1300_PSC0_PHYS_ADDR 0x10A00000 /* 5 */
134#define AU1300_PSC1_PHYS_ADDR 0x10A01000 /* 5 */
135#define AU1300_PSC2_PHYS_ADDR 0x10A02000 /* 5 */
136#define AU1300_PSC3_PHYS_ADDR 0x10A03000 /* 5 */
137#define AU1000_I2S_PHYS_ADDR 0x11000000 /* 02 */
138#define AU1500_MAC0_PHYS_ADDR 0x11500000 /* 1 */
139#define AU1500_MAC1_PHYS_ADDR 0x11510000 /* 1 */
140#define AU1500_MACEN_PHYS_ADDR 0x11520000 /* 1 */
141#define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
142#define AU1200_SWCNT_PHYS_ADDR 0x1110010C /* 4 */
143#define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
144#define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
145#define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
146#define AU1000_SSI0_PHYS_ADDR 0x11600000 /* 02 */
147#define AU1000_SSI1_PHYS_ADDR 0x11680000 /* 02 */
148#define AU1500_GPIO2_PHYS_ADDR 0x11700000 /* 1234 */
149#define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
150#define AU1000_SYS_PHYS_ADDR 0x11900000 /* 012345 */
151#define AU1550_PSC0_PHYS_ADDR 0x11A00000 /* 34 */
152#define AU1550_PSC1_PHYS_ADDR 0x11B00000 /* 34 */
153#define AU1000_MEM_PHYS_ADDR 0x14000000 /* 01234 */
154#define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
155#define AU1300_UDMA_PHYS_ADDR 0x14001800 /* 5 */
156#define AU1000_DMA_PHYS_ADDR 0x14002000 /* 012 */
157#define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 345 */
158#define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
159#define AU1000_MACDMA0_PHYS_ADDR 0x14004000 /* 0123 */
160#define AU1000_MACDMA1_PHYS_ADDR 0x14004200 /* 0123 */
161#define AU1200_CIM_PHYS_ADDR 0x14004000 /* 45 */
162#define AU1500_PCI_PHYS_ADDR 0x14005000 /* 13 */
163#define AU1550_PE_PHYS_ADDR 0x14008000 /* 3 */
164#define AU1200_MAEBE_PHYS_ADDR 0x14010000 /* 4 */
165#define AU1200_MAEFE_PHYS_ADDR 0x14012000 /* 4 */
166#define AU1300_MAEITE_PHYS_ADDR 0x14010000 /* 5 */
167#define AU1300_MAEMPE_PHYS_ADDR 0x14014000 /* 5 */
168#define AU1550_USB_OHCI_PHYS_ADDR 0x14020000 /* 3 */
169#define AU1200_USB_CTL_PHYS_ADDR 0x14020000 /* 4 */
170#define AU1200_USB_OTG_PHYS_ADDR 0x14020020 /* 4 */
171#define AU1200_USB_OHCI_PHYS_ADDR 0x14020100 /* 4 */
172#define AU1200_USB_EHCI_PHYS_ADDR 0x14020200 /* 4 */
173#define AU1200_USB_UDC_PHYS_ADDR 0x14022000 /* 4 */
174#define AU1300_USB_EHCI_PHYS_ADDR 0x14020000 /* 5 */
175#define AU1300_USB_OHCI0_PHYS_ADDR 0x14020400 /* 5 */
176#define AU1300_USB_OHCI1_PHYS_ADDR 0x14020800 /* 5 */
177#define AU1300_USB_CTL_PHYS_ADDR 0x14021000 /* 5 */
178#define AU1300_USB_OTG_PHYS_ADDR 0x14022000 /* 5 */
179#define AU1300_MAEBSA_PHYS_ADDR 0x14030000 /* 5 */
180#define AU1100_LCD_PHYS_ADDR 0x15000000 /* 2 */
181#define AU1200_LCD_PHYS_ADDR 0x15000000 /* 45 */
182#define AU1500_PCI_MEM_PHYS_ADDR 0x400000000ULL /* 13 */
183#define AU1500_PCI_IO_PHYS_ADDR 0x500000000ULL /* 13 */
184#define AU1500_PCI_CONFIG0_PHYS_ADDR 0x600000000ULL /* 13 */
185#define AU1500_PCI_CONFIG1_PHYS_ADDR 0x680000000ULL /* 13 */
186#define AU1000_PCMCIA_IO_PHYS_ADDR 0xF00000000ULL /* 012345 */
187#define AU1000_PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL /* 012345 */
188#define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
189
190/**********************************************************************/
191
192
193/*
194 * Au1300 GPIO+INT controller (GPIC) register offsets and bits
195 * Registers are 128bits (0x10 bytes), divided into 4 "banks".
196 */
197#define AU1300_GPIC_PINVAL 0x0000
198#define AU1300_GPIC_PINVALCLR 0x0010
199#define AU1300_GPIC_IPEND 0x0020
200#define AU1300_GPIC_PRIENC 0x0030
201#define AU1300_GPIC_IEN 0x0040 /* int_mask in manual */
202#define AU1300_GPIC_IDIS 0x0050 /* int_maskclr in manual */
203#define AU1300_GPIC_DMASEL 0x0060
204#define AU1300_GPIC_DEVSEL 0x0080
205#define AU1300_GPIC_DEVCLR 0x0090
206#define AU1300_GPIC_RSTVAL 0x00a0
207/* pin configuration space. one 32bit register for up to 128 IRQs */
208#define AU1300_GPIC_PINCFG 0x1000
209
210#define GPIC_GPIO_TO_BIT(gpio) \
211 (1 << ((gpio) & 0x1f))
212
213#define GPIC_GPIO_BANKOFF(gpio) \
214 (((gpio) >> 5) * 4)
215
216/* Pin Control bits: who owns the pin, what does it do */
217#define GPIC_CFG_PC_GPIN 0
218#define GPIC_CFG_PC_DEV 1
219#define GPIC_CFG_PC_GPOLOW 2
220#define GPIC_CFG_PC_GPOHIGH 3
221#define GPIC_CFG_PC_MASK 3
222
223/* assign pin to MIPS IRQ line */
224#define GPIC_CFG_IL_SET(x) (((x) & 3) << 2)
225#define GPIC_CFG_IL_MASK (3 << 2)
226
227/* pin interrupt type setup */
228#define GPIC_CFG_IC_OFF (0 << 4)
229#define GPIC_CFG_IC_LEVEL_LOW (1 << 4)
230#define GPIC_CFG_IC_LEVEL_HIGH (2 << 4)
231#define GPIC_CFG_IC_EDGE_FALL (5 << 4)
232#define GPIC_CFG_IC_EDGE_RISE (6 << 4)
233#define GPIC_CFG_IC_EDGE_BOTH (7 << 4)
234#define GPIC_CFG_IC_MASK (7 << 4)
235
236/* allow interrupt to wake cpu from 'wait' */
237#define GPIC_CFG_IDLEWAKE (1 << 7)
238
239/***********************************************************************/
240
241/* Au1000 SDRAM memory controller register offsets */
242#define AU1000_MEM_SDMODE0 0x0000
243#define AU1000_MEM_SDMODE1 0x0004
244#define AU1000_MEM_SDMODE2 0x0008
245#define AU1000_MEM_SDADDR0 0x000C
246#define AU1000_MEM_SDADDR1 0x0010
247#define AU1000_MEM_SDADDR2 0x0014
248#define AU1000_MEM_SDREFCFG 0x0018
249#define AU1000_MEM_SDPRECMD 0x001C
250#define AU1000_MEM_SDAUTOREF 0x0020
251#define AU1000_MEM_SDWRMD0 0x0024
252#define AU1000_MEM_SDWRMD1 0x0028
253#define AU1000_MEM_SDWRMD2 0x002C
254#define AU1000_MEM_SDSLEEP 0x0030
255#define AU1000_MEM_SDSMCKE 0x0034
256
257/* MEM_SDMODE register content definitions */
258#define MEM_SDMODE_F (1 << 22)
259#define MEM_SDMODE_SR (1 << 21)
260#define MEM_SDMODE_BS (1 << 20)
261#define MEM_SDMODE_RS (3 << 18)
262#define MEM_SDMODE_CS (7 << 15)
263#define MEM_SDMODE_TRAS (15 << 11)
264#define MEM_SDMODE_TMRD (3 << 9)
265#define MEM_SDMODE_TWR (3 << 7)
266#define MEM_SDMODE_TRP (3 << 5)
267#define MEM_SDMODE_TRCD (3 << 3)
268#define MEM_SDMODE_TCL (7 << 0)
269
270#define MEM_SDMODE_BS_2Bank (0 << 20)
271#define MEM_SDMODE_BS_4Bank (1 << 20)
272#define MEM_SDMODE_RS_11Row (0 << 18)
273#define MEM_SDMODE_RS_12Row (1 << 18)
274#define MEM_SDMODE_RS_13Row (2 << 18)
275#define MEM_SDMODE_RS_N(N) ((N) << 18)
276#define MEM_SDMODE_CS_7Col (0 << 15)
277#define MEM_SDMODE_CS_8Col (1 << 15)
278#define MEM_SDMODE_CS_9Col (2 << 15)
279#define MEM_SDMODE_CS_10Col (3 << 15)
280#define MEM_SDMODE_CS_11Col (4 << 15)
281#define MEM_SDMODE_CS_N(N) ((N) << 15)
282#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
283#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
284#define MEM_SDMODE_TWR_N(N) ((N) << 7)
285#define MEM_SDMODE_TRP_N(N) ((N) << 5)
286#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
287#define MEM_SDMODE_TCL_N(N) ((N) << 0)
288
289/* MEM_SDADDR register contents definitions */
290#define MEM_SDADDR_E (1 << 20)
291#define MEM_SDADDR_CSBA (0x03FF << 10)
292#define MEM_SDADDR_CSMASK (0x03FF << 0)
293#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
294#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
295
296/* MEM_SDREFCFG register content definitions */
297#define MEM_SDREFCFG_TRC (15 << 28)
298#define MEM_SDREFCFG_TRPM (3 << 26)
299#define MEM_SDREFCFG_E (1 << 25)
300#define MEM_SDREFCFG_RE (0x1ffffff << 0)
301#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
302#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
303#define MEM_SDREFCFG_REF_N(N) (N)
304
305/* Au1550 SDRAM Register Offsets */
306#define AU1550_MEM_SDMODE0 0x0800
307#define AU1550_MEM_SDMODE1 0x0808
308#define AU1550_MEM_SDMODE2 0x0810
309#define AU1550_MEM_SDADDR0 0x0820
310#define AU1550_MEM_SDADDR1 0x0828
311#define AU1550_MEM_SDADDR2 0x0830
312#define AU1550_MEM_SDCONFIGA 0x0840
313#define AU1550_MEM_SDCONFIGB 0x0848
314#define AU1550_MEM_SDSTAT 0x0850
315#define AU1550_MEM_SDERRADDR 0x0858
316#define AU1550_MEM_SDSTRIDE0 0x0860
317#define AU1550_MEM_SDSTRIDE1 0x0868
318#define AU1550_MEM_SDSTRIDE2 0x0870
319#define AU1550_MEM_SDWRMD0 0x0880
320#define AU1550_MEM_SDWRMD1 0x0888
321#define AU1550_MEM_SDWRMD2 0x0890
322#define AU1550_MEM_SDPRECMD 0x08C0
323#define AU1550_MEM_SDAUTOREF 0x08C8
324#define AU1550_MEM_SDSREF 0x08D0
325#define AU1550_MEM_SDSLEEP MEM_SDSREF
326
327/* Static Bus Controller register offsets */
328#define AU1000_MEM_STCFG0 0x000
329#define AU1000_MEM_STTIME0 0x004
330#define AU1000_MEM_STADDR0 0x008
331#define AU1000_MEM_STCFG1 0x010
332#define AU1000_MEM_STTIME1 0x014
333#define AU1000_MEM_STADDR1 0x018
334#define AU1000_MEM_STCFG2 0x020
335#define AU1000_MEM_STTIME2 0x024
336#define AU1000_MEM_STADDR2 0x028
337#define AU1000_MEM_STCFG3 0x030
338#define AU1000_MEM_STTIME3 0x034
339#define AU1000_MEM_STADDR3 0x038
340#define AU1000_MEM_STNDCTL 0x100
341#define AU1000_MEM_STSTAT 0x104
342
343#define MEM_STNAND_CMD 0x0
344#define MEM_STNAND_ADDR 0x4
345#define MEM_STNAND_DATA 0x20
346
347
348/* Programmable Counters 0 and 1 */
349#define AU1000_SYS_CNTRCTRL 0x14
350# define SYS_CNTRL_E1S (1 << 23)
351# define SYS_CNTRL_T1S (1 << 20)
352# define SYS_CNTRL_M21 (1 << 19)
353# define SYS_CNTRL_M11 (1 << 18)
354# define SYS_CNTRL_M01 (1 << 17)
355# define SYS_CNTRL_C1S (1 << 16)
356# define SYS_CNTRL_BP (1 << 14)
357# define SYS_CNTRL_EN1 (1 << 13)
358# define SYS_CNTRL_BT1 (1 << 12)
359# define SYS_CNTRL_EN0 (1 << 11)
360# define SYS_CNTRL_BT0 (1 << 10)
361# define SYS_CNTRL_E0 (1 << 8)
362# define SYS_CNTRL_E0S (1 << 7)
363# define SYS_CNTRL_32S (1 << 5)
364# define SYS_CNTRL_T0S (1 << 4)
365# define SYS_CNTRL_M20 (1 << 3)
366# define SYS_CNTRL_M10 (1 << 2)
367# define SYS_CNTRL_M00 (1 << 1)
368# define SYS_CNTRL_C0S (1 << 0)
369
370/* Programmable Counter 0 Registers */
371#define AU1000_SYS_TOYTRIM 0x00
372#define AU1000_SYS_TOYWRITE 0x04
373#define AU1000_SYS_TOYMATCH0 0x08
374#define AU1000_SYS_TOYMATCH1 0x0c
375#define AU1000_SYS_TOYMATCH2 0x10
376#define AU1000_SYS_TOYREAD 0x40
377
378/* Programmable Counter 1 Registers */
379#define AU1000_SYS_RTCTRIM 0x44
380#define AU1000_SYS_RTCWRITE 0x48
381#define AU1000_SYS_RTCMATCH0 0x4c
382#define AU1000_SYS_RTCMATCH1 0x50
383#define AU1000_SYS_RTCMATCH2 0x54
384#define AU1000_SYS_RTCREAD 0x58
385
386
387/* GPIO */
388#define AU1000_SYS_PINFUNC 0x2C
389# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
390# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
391# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
392# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
393# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
394# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
395# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
396# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
397# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
398# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
399# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
400# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
401# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
402# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
403# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
404# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
405
406/* Au1100 only */
407# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
408# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
409# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
410# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
411
412/* Au1550 only. Redefines lots of pins */
413# define SYS_PF_PSC2_MASK (7 << 17)
414# define SYS_PF_PSC2_AC97 0
415# define SYS_PF_PSC2_SPI 0
416# define SYS_PF_PSC2_I2S (1 << 17)
417# define SYS_PF_PSC2_SMBUS (3 << 17)
418# define SYS_PF_PSC2_GPIO (7 << 17)
419# define SYS_PF_PSC3_MASK (7 << 20)
420# define SYS_PF_PSC3_AC97 0
421# define SYS_PF_PSC3_SPI 0
422# define SYS_PF_PSC3_I2S (1 << 20)
423# define SYS_PF_PSC3_SMBUS (3 << 20)
424# define SYS_PF_PSC3_GPIO (7 << 20)
425# define SYS_PF_PSC1_S1 (1 << 1)
426# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
427
428/* Au1200 only */
429#define SYS_PINFUNC_DMA (1 << 31)
430#define SYS_PINFUNC_S0A (1 << 30)
431#define SYS_PINFUNC_S1A (1 << 29)
432#define SYS_PINFUNC_LP0 (1 << 28)
433#define SYS_PINFUNC_LP1 (1 << 27)
434#define SYS_PINFUNC_LD16 (1 << 26)
435#define SYS_PINFUNC_LD8 (1 << 25)
436#define SYS_PINFUNC_LD1 (1 << 24)
437#define SYS_PINFUNC_LD0 (1 << 23)
438#define SYS_PINFUNC_P1A (3 << 21)
439#define SYS_PINFUNC_P1B (1 << 20)
440#define SYS_PINFUNC_FS3 (1 << 19)
441#define SYS_PINFUNC_P0A (3 << 17)
442#define SYS_PINFUNC_CS (1 << 16)
443#define SYS_PINFUNC_CIM (1 << 15)
444#define SYS_PINFUNC_P1C (1 << 14)
445#define SYS_PINFUNC_U1T (1 << 12)
446#define SYS_PINFUNC_U1R (1 << 11)
447#define SYS_PINFUNC_EX1 (1 << 10)
448#define SYS_PINFUNC_EX0 (1 << 9)
449#define SYS_PINFUNC_U0R (1 << 8)
450#define SYS_PINFUNC_MC (1 << 7)
451#define SYS_PINFUNC_S0B (1 << 6)
452#define SYS_PINFUNC_S0C (1 << 5)
453#define SYS_PINFUNC_P0B (1 << 4)
454#define SYS_PINFUNC_U0T (1 << 3)
455#define SYS_PINFUNC_S1B (1 << 2)
456
457/* Power Management */
458#define AU1000_SYS_SCRATCH0 0x18
459#define AU1000_SYS_SCRATCH1 0x1c
460#define AU1000_SYS_WAKEMSK 0x34
461#define AU1000_SYS_ENDIAN 0x38
462#define AU1000_SYS_POWERCTRL 0x3c
463#define AU1000_SYS_WAKESRC 0x5c
464#define AU1000_SYS_SLPPWR 0x78
465#define AU1000_SYS_SLEEP 0x7c
466
467#define SYS_WAKEMSK_D2 (1 << 9)
468#define SYS_WAKEMSK_M2 (1 << 8)
469#define SYS_WAKEMSK_GPIO(x) (1 << (x))
470
471/* Clock Controller */
472#define AU1000_SYS_FREQCTRL0 0x20
473#define AU1000_SYS_FREQCTRL1 0x24
474#define AU1000_SYS_CLKSRC 0x28
475#define AU1000_SYS_CPUPLL 0x60
476#define AU1000_SYS_AUXPLL 0x64
477#define AU1300_SYS_AUXPLL2 0x68
478
479
480/**********************************************************************/
481
482
483/* The PCI chip selects are outside the 32bit space, and since we can't
484 * just program the 36bit addresses into BARs, we have to take a chunk
485 * out of the 32bit space and reserve it for PCI. When these addresses
486 * are ioremap()ed, they'll be fixed up to the real 36bit address before
487 * being passed to the real ioremap function.
488 */
489#define ALCHEMY_PCI_MEMWIN_START (AU1500_PCI_MEM_PHYS_ADDR >> 4)
490#define ALCHEMY_PCI_MEMWIN_END (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
491
492/* for PCI IO it's simpler because we get to do the ioremap ourselves and then
493 * adjust the device's resources.
494 */
495#define ALCHEMY_PCI_IOWIN_START 0x00001000
496#define ALCHEMY_PCI_IOWIN_END 0x0000FFFF
497
498#ifdef CONFIG_PCI
499
500#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
501#define IOPORT_RESOURCE_END 0xffffffff
502#define IOMEM_RESOURCE_START 0x10000000
503#define IOMEM_RESOURCE_END 0xfffffffffULL
504
505#else
506
507/* Don't allow any legacy ports probing */
508#define IOPORT_RESOURCE_START 0x10000000
509#define IOPORT_RESOURCE_END 0xffffffff
510#define IOMEM_RESOURCE_START 0x10000000
511#define IOMEM_RESOURCE_END 0xfffffffffULL
512
513#endif
514
515/* PCI controller block register offsets */
516#define PCI_REG_CMEM 0x0000
517#define PCI_REG_CONFIG 0x0004
518#define PCI_REG_B2BMASK_CCH 0x0008
519#define PCI_REG_B2BBASE0_VID 0x000C
520#define PCI_REG_B2BBASE1_SID 0x0010
521#define PCI_REG_MWMASK_DEV 0x0014
522#define PCI_REG_MWBASE_REV_CCL 0x0018
523#define PCI_REG_ERR_ADDR 0x001C
524#define PCI_REG_SPEC_INTACK 0x0020
525#define PCI_REG_ID 0x0100
526#define PCI_REG_STATCMD 0x0104
527#define PCI_REG_CLASSREV 0x0108
528#define PCI_REG_PARAM 0x010C
529#define PCI_REG_MBAR 0x0110
530#define PCI_REG_TIMEOUT 0x0140
531
532/* PCI controller block register bits */
533#define PCI_CMEM_E (1 << 28) /* enable cacheable memory */
534#define PCI_CMEM_CMBASE(x) (((x) & 0x3fff) << 14)
535#define PCI_CMEM_CMMASK(x) ((x) & 0x3fff)
536#define PCI_CONFIG_ERD (1 << 27) /* pci error during R/W */
537#define PCI_CONFIG_ET (1 << 26) /* error in target mode */
538#define PCI_CONFIG_EF (1 << 25) /* fatal error */
539#define PCI_CONFIG_EP (1 << 24) /* parity error */
540#define PCI_CONFIG_EM (1 << 23) /* multiple errors */
541#define PCI_CONFIG_BM (1 << 22) /* bad master error */
542#define PCI_CONFIG_PD (1 << 20) /* PCI Disable */
543#define PCI_CONFIG_BME (1 << 19) /* Byte Mask Enable for reads */
544#define PCI_CONFIG_NC (1 << 16) /* mark mem access non-coherent */
545#define PCI_CONFIG_IA (1 << 15) /* INTA# enabled (target mode) */
546#define PCI_CONFIG_IP (1 << 13) /* int on PCI_PERR# */
547#define PCI_CONFIG_IS (1 << 12) /* int on PCI_SERR# */
548#define PCI_CONFIG_IMM (1 << 11) /* int on master abort */
549#define PCI_CONFIG_ITM (1 << 10) /* int on target abort (as master) */
550#define PCI_CONFIG_ITT (1 << 9) /* int on target abort (as target) */
551#define PCI_CONFIG_IPB (1 << 8) /* int on PERR# in bus master acc */
552#define PCI_CONFIG_SIC_NO (0 << 6) /* no byte mask changes */
553#define PCI_CONFIG_SIC_BA_ADR (1 << 6) /* on byte/hw acc, invert adr bits */
554#define PCI_CONFIG_SIC_HWA_DAT (2 << 6) /* on halfword acc, swap data */
555#define PCI_CONFIG_SIC_ALL (3 << 6) /* swap data bytes on all accesses */
556#define PCI_CONFIG_ST (1 << 5) /* swap data by target transactions */
557#define PCI_CONFIG_SM (1 << 4) /* swap data from PCI ctl */
558#define PCI_CONFIG_AEN (1 << 3) /* enable internal arbiter */
559#define PCI_CONFIG_R2H (1 << 2) /* REQ2# to hi-prio arbiter */
560#define PCI_CONFIG_R1H (1 << 1) /* REQ1# to hi-prio arbiter */
561#define PCI_CONFIG_CH (1 << 0) /* PCI ctl to hi-prio arbiter */
562#define PCI_B2BMASK_B2BMASK(x) (((x) & 0xffff) << 16)
563#define PCI_B2BMASK_CCH(x) ((x) & 0xffff) /* 16 upper bits of class code */
564#define PCI_B2BBASE0_VID_B0(x) (((x) & 0xffff) << 16)
565#define PCI_B2BBASE0_VID_SV(x) ((x) & 0xffff)
566#define PCI_B2BBASE1_SID_B1(x) (((x) & 0xffff) << 16)
567#define PCI_B2BBASE1_SID_SI(x) ((x) & 0xffff)
568#define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
569#define PCI_MWMASKDEV_DEVID(x) ((x) & 0xffff)
570#define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
571#define PCI_MWBASEREVCCL_REV(x) (((x) & 0xff) << 8)
572#define PCI_MWBASEREVCCL_CCL(x) ((x) & 0xff)
573#define PCI_ID_DID(x) (((x) & 0xffff) << 16)
574#define PCI_ID_VID(x) ((x) & 0xffff)
575#define PCI_STATCMD_STATUS(x) (((x) & 0xffff) << 16)
576#define PCI_STATCMD_CMD(x) ((x) & 0xffff)
577#define PCI_CLASSREV_CLASS(x) (((x) & 0x00ffffff) << 8)
578#define PCI_CLASSREV_REV(x) ((x) & 0xff)
579#define PCI_PARAM_BIST(x) (((x) & 0xff) << 24)
580#define PCI_PARAM_HT(x) (((x) & 0xff) << 16)
581#define PCI_PARAM_LT(x) (((x) & 0xff) << 8)
582#define PCI_PARAM_CLS(x) ((x) & 0xff)
583#define PCI_TIMEOUT_RETRIES(x) (((x) & 0xff) << 8) /* max retries */
584#define PCI_TIMEOUT_TO(x) ((x) & 0xff) /* target ready timeout */
585
586
587/**********************************************************************/
588
37 589
38#ifndef _LANGUAGE_ASSEMBLY 590#ifndef _LANGUAGE_ASSEMBLY
39 591
@@ -45,52 +597,36 @@
45 597
46#include <asm/cpu.h> 598#include <asm/cpu.h>
47 599
48/* cpu pipeline flush */ 600/* helpers to access the SYS_* registers */
49void static inline au_sync(void) 601static inline unsigned long alchemy_rdsys(int regofs)
50{ 602{
51 __asm__ volatile ("sync"); 603 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
52}
53 604
54void static inline au_sync_udelay(int us) 605 return __raw_readl(b + regofs);
55{
56 __asm__ volatile ("sync");
57 udelay(us);
58} 606}
59 607
60void static inline au_sync_delay(int ms) 608static inline void alchemy_wrsys(unsigned long v, int regofs)
61{ 609{
62 __asm__ volatile ("sync"); 610 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
63 mdelay(ms);
64}
65 611
66void static inline au_writeb(u8 val, unsigned long reg) 612 __raw_writel(v, b + regofs);
67{ 613 wmb(); /* drain writebuffer */
68 *(volatile u8 *)reg = val;
69} 614}
70 615
71void static inline au_writew(u16 val, unsigned long reg) 616/* helpers to access static memctrl registers */
617static inline unsigned long alchemy_rdsmem(int regofs)
72{ 618{
73 *(volatile u16 *)reg = val; 619 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
74}
75 620
76void static inline au_writel(u32 val, unsigned long reg) 621 return __raw_readl(b + regofs);
77{
78 *(volatile u32 *)reg = val;
79} 622}
80 623
81static inline u8 au_readb(unsigned long reg) 624static inline void alchemy_wrsmem(unsigned long v, int regofs)
82{ 625{
83 return *(volatile u8 *)reg; 626 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
84}
85 627
86static inline u16 au_readw(unsigned long reg) 628 __raw_writel(v, b + regofs);
87{ 629 wmb(); /* drain writebuffer */
88 return *(volatile u16 *)reg;
89}
90
91static inline u32 au_readl(unsigned long reg)
92{
93 return *(volatile u32 *)reg;
94} 630}
95 631
96/* Early Au1000 have a write-only SYS_CPUPLL register. */ 632/* Early Au1000 have a write-only SYS_CPUPLL register. */
@@ -192,19 +728,20 @@ static inline void alchemy_uart_enable(u32 uart_phys)
192 /* reset, enable clock, deassert reset */ 728 /* reset, enable clock, deassert reset */
193 if ((__raw_readl(addr + 0x100) & 3) != 3) { 729 if ((__raw_readl(addr + 0x100) & 3) != 3) {
194 __raw_writel(0, addr + 0x100); 730 __raw_writel(0, addr + 0x100);
195 wmb(); 731 wmb(); /* drain writebuffer */
196 __raw_writel(1, addr + 0x100); 732 __raw_writel(1, addr + 0x100);
197 wmb(); 733 wmb(); /* drain writebuffer */
198 } 734 }
199 __raw_writel(3, addr + 0x100); 735 __raw_writel(3, addr + 0x100);
200 wmb(); 736 wmb(); /* drain writebuffer */
201} 737}
202 738
203static inline void alchemy_uart_disable(u32 uart_phys) 739static inline void alchemy_uart_disable(u32 uart_phys)
204{ 740{
205 void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys); 741 void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
742
206 __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */ 743 __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */
207 wmb(); 744 wmb(); /* drain writebuffer */
208} 745}
209 746
210static inline void alchemy_uart_putchar(u32 uart_phys, u8 c) 747static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
@@ -223,7 +760,7 @@ static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
223 } while (--timeout); 760 } while (--timeout);
224 761
225 __raw_writel(c, base + 0x04); /* tx */ 762 __raw_writel(c, base + 0x04); /* tx */
226 wmb(); 763 wmb(); /* drain writebuffer */
227} 764}
228 765
229/* return number of ethernet MACs on a given cputype */ 766/* return number of ethernet MACs on a given cputype */
@@ -240,20 +777,13 @@ static inline int alchemy_get_macs(int type)
240 return 0; 777 return 0;
241} 778}
242 779
243/* arch/mips/au1000/common/clocks.c */
244extern void set_au1x00_speed(unsigned int new_freq);
245extern unsigned int get_au1x00_speed(void);
246extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
247extern unsigned long get_au1x00_uart_baud_base(void);
248extern unsigned long au1xxx_calc_clock(void);
249
250/* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */ 780/* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
251void alchemy_sleep_au1000(void); 781void alchemy_sleep_au1000(void);
252void alchemy_sleep_au1550(void); 782void alchemy_sleep_au1550(void);
253void alchemy_sleep_au1300(void); 783void alchemy_sleep_au1300(void);
254void au_sleep(void); 784void au_sleep(void);
255 785
256/* USB: drivers/usb/host/alchemy-common.c */ 786/* USB: arch/mips/alchemy/common/usb.c */
257enum alchemy_usb_block { 787enum alchemy_usb_block {
258 ALCHEMY_USB_OHCI0, 788 ALCHEMY_USB_OHCI0,
259 ALCHEMY_USB_UDC0, 789 ALCHEMY_USB_UDC0,
@@ -272,6 +802,20 @@ struct alchemy_pci_platdata {
272 unsigned long pci_cfg_clr; 802 unsigned long pci_cfg_clr;
273}; 803};
274 804
805/* The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's
806 * not used to select FIR/SIR mode on the transceiver but as a GPIO.
807 * Instead a CPLD has to be told about the mode. The driver calls the
808 * set_phy_mode() function in addition to driving the IRFIRSEL pin.
809 */
810#define AU1000_IRDA_PHY_MODE_OFF 0
811#define AU1000_IRDA_PHY_MODE_SIR 1
812#define AU1000_IRDA_PHY_MODE_FIR 2
813
814struct au1k_irda_platform_data {
815 void (*set_phy_mode)(int mode);
816};
817
818
275/* Multifunction pins: Each of these pins can either be assigned to the 819/* Multifunction pins: Each of these pins can either be assigned to the
276 * GPIO controller or a on-chip peripheral. 820 * GPIO controller or a on-chip peripheral.
277 * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to 821 * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to
@@ -344,20 +888,6 @@ enum au1300_vss_block {
344 888
345extern void au1300_vss_block_control(int block, int enable); 889extern void au1300_vss_block_control(int block, int enable);
346 890
347
348/* SOC Interrupt numbers */
349/* Au1000-style (IC0/1): 2 controllers with 32 sources each */
350#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
351#define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
352#define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
353#define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
354#define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
355
356/* Au1300-style (GPIC): 1 controller with up to 128 sources */
357#define ALCHEMY_GPIC_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
358#define ALCHEMY_GPIC_INT_NUM 128
359#define ALCHEMY_GPIC_INT_LAST (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
360
361enum soc_au1000_ints { 891enum soc_au1000_ints {
362 AU1000_FIRST_INT = AU1000_INTC0_INT_BASE, 892 AU1000_FIRST_INT = AU1000_INTC0_INT_BASE,
363 AU1000_UART0_INT = AU1000_FIRST_INT, 893 AU1000_UART0_INT = AU1000_FIRST_INT,
@@ -678,885 +1208,4 @@ enum soc_au1200_ints {
678 1208
679#endif /* !defined (_LANGUAGE_ASSEMBLY) */ 1209#endif /* !defined (_LANGUAGE_ASSEMBLY) */
680 1210
681/* Au1300 peripheral interrupt numbers */
682#define AU1300_FIRST_INT (ALCHEMY_GPIC_INT_BASE)
683#define AU1300_UART1_INT (AU1300_FIRST_INT + 17)
684#define AU1300_UART2_INT (AU1300_FIRST_INT + 25)
685#define AU1300_UART3_INT (AU1300_FIRST_INT + 27)
686#define AU1300_SD1_INT (AU1300_FIRST_INT + 32)
687#define AU1300_SD2_INT (AU1300_FIRST_INT + 38)
688#define AU1300_PSC0_INT (AU1300_FIRST_INT + 48)
689#define AU1300_PSC1_INT (AU1300_FIRST_INT + 52)
690#define AU1300_PSC2_INT (AU1300_FIRST_INT + 56)
691#define AU1300_PSC3_INT (AU1300_FIRST_INT + 60)
692#define AU1300_NAND_INT (AU1300_FIRST_INT + 62)
693#define AU1300_DDMA_INT (AU1300_FIRST_INT + 75)
694#define AU1300_MMU_INT (AU1300_FIRST_INT + 76)
695#define AU1300_MPU_INT (AU1300_FIRST_INT + 77)
696#define AU1300_GPU_INT (AU1300_FIRST_INT + 78)
697#define AU1300_UDMA_INT (AU1300_FIRST_INT + 79)
698#define AU1300_TOY_INT (AU1300_FIRST_INT + 80)
699#define AU1300_TOY_MATCH0_INT (AU1300_FIRST_INT + 81)
700#define AU1300_TOY_MATCH1_INT (AU1300_FIRST_INT + 82)
701#define AU1300_TOY_MATCH2_INT (AU1300_FIRST_INT + 83)
702#define AU1300_RTC_INT (AU1300_FIRST_INT + 84)
703#define AU1300_RTC_MATCH0_INT (AU1300_FIRST_INT + 85)
704#define AU1300_RTC_MATCH1_INT (AU1300_FIRST_INT + 86)
705#define AU1300_RTC_MATCH2_INT (AU1300_FIRST_INT + 87)
706#define AU1300_UART0_INT (AU1300_FIRST_INT + 88)
707#define AU1300_SD0_INT (AU1300_FIRST_INT + 89)
708#define AU1300_USB_INT (AU1300_FIRST_INT + 90)
709#define AU1300_LCD_INT (AU1300_FIRST_INT + 91)
710#define AU1300_BSA_INT (AU1300_FIRST_INT + 92)
711#define AU1300_MPE_INT (AU1300_FIRST_INT + 93)
712#define AU1300_ITE_INT (AU1300_FIRST_INT + 94)
713#define AU1300_AES_INT (AU1300_FIRST_INT + 95)
714#define AU1300_CIM_INT (AU1300_FIRST_INT + 96)
715
716/**********************************************************************/
717
718/*
719 * Physical base addresses for integrated peripherals
720 * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
721 */
722
723#define AU1000_AC97_PHYS_ADDR 0x10000000 /* 012 */
724#define AU1300_ROM_PHYS_ADDR 0x10000000 /* 5 */
725#define AU1300_OTP_PHYS_ADDR 0x10002000 /* 5 */
726#define AU1300_VSS_PHYS_ADDR 0x10003000 /* 5 */
727#define AU1300_UART0_PHYS_ADDR 0x10100000 /* 5 */
728#define AU1300_UART1_PHYS_ADDR 0x10101000 /* 5 */
729#define AU1300_UART2_PHYS_ADDR 0x10102000 /* 5 */
730#define AU1300_UART3_PHYS_ADDR 0x10103000 /* 5 */
731#define AU1000_USB_OHCI_PHYS_ADDR 0x10100000 /* 012 */
732#define AU1000_USB_UDC_PHYS_ADDR 0x10200000 /* 0123 */
733#define AU1300_GPIC_PHYS_ADDR 0x10200000 /* 5 */
734#define AU1000_IRDA_PHYS_ADDR 0x10300000 /* 02 */
735#define AU1200_AES_PHYS_ADDR 0x10300000 /* 45 */
736#define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
737#define AU1300_GPU_PHYS_ADDR 0x10500000 /* 5 */
738#define AU1000_MAC0_PHYS_ADDR 0x10500000 /* 023 */
739#define AU1000_MAC1_PHYS_ADDR 0x10510000 /* 023 */
740#define AU1000_MACEN_PHYS_ADDR 0x10520000 /* 023 */
741#define AU1100_SD0_PHYS_ADDR 0x10600000 /* 245 */
742#define AU1300_SD1_PHYS_ADDR 0x10601000 /* 5 */
743#define AU1300_SD2_PHYS_ADDR 0x10602000 /* 5 */
744#define AU1100_SD1_PHYS_ADDR 0x10680000 /* 24 */
745#define AU1300_SYS_PHYS_ADDR 0x10900000 /* 5 */
746#define AU1550_PSC2_PHYS_ADDR 0x10A00000 /* 3 */
747#define AU1550_PSC3_PHYS_ADDR 0x10B00000 /* 3 */
748#define AU1300_PSC0_PHYS_ADDR 0x10A00000 /* 5 */
749#define AU1300_PSC1_PHYS_ADDR 0x10A01000 /* 5 */
750#define AU1300_PSC2_PHYS_ADDR 0x10A02000 /* 5 */
751#define AU1300_PSC3_PHYS_ADDR 0x10A03000 /* 5 */
752#define AU1000_I2S_PHYS_ADDR 0x11000000 /* 02 */
753#define AU1500_MAC0_PHYS_ADDR 0x11500000 /* 1 */
754#define AU1500_MAC1_PHYS_ADDR 0x11510000 /* 1 */
755#define AU1500_MACEN_PHYS_ADDR 0x11520000 /* 1 */
756#define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
757#define AU1200_SWCNT_PHYS_ADDR 0x1110010C /* 4 */
758#define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
759#define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
760#define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
761#define AU1000_SSI0_PHYS_ADDR 0x11600000 /* 02 */
762#define AU1000_SSI1_PHYS_ADDR 0x11680000 /* 02 */
763#define AU1500_GPIO2_PHYS_ADDR 0x11700000 /* 1234 */
764#define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
765#define AU1000_SYS_PHYS_ADDR 0x11900000 /* 012345 */
766#define AU1550_PSC0_PHYS_ADDR 0x11A00000 /* 34 */
767#define AU1550_PSC1_PHYS_ADDR 0x11B00000 /* 34 */
768#define AU1000_MEM_PHYS_ADDR 0x14000000 /* 01234 */
769#define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
770#define AU1300_UDMA_PHYS_ADDR 0x14001800 /* 5 */
771#define AU1000_DMA_PHYS_ADDR 0x14002000 /* 012 */
772#define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 345 */
773#define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
774#define AU1000_MACDMA0_PHYS_ADDR 0x14004000 /* 0123 */
775#define AU1000_MACDMA1_PHYS_ADDR 0x14004200 /* 0123 */
776#define AU1200_CIM_PHYS_ADDR 0x14004000 /* 45 */
777#define AU1500_PCI_PHYS_ADDR 0x14005000 /* 13 */
778#define AU1550_PE_PHYS_ADDR 0x14008000 /* 3 */
779#define AU1200_MAEBE_PHYS_ADDR 0x14010000 /* 4 */
780#define AU1200_MAEFE_PHYS_ADDR 0x14012000 /* 4 */
781#define AU1300_MAEITE_PHYS_ADDR 0x14010000 /* 5 */
782#define AU1300_MAEMPE_PHYS_ADDR 0x14014000 /* 5 */
783#define AU1550_USB_OHCI_PHYS_ADDR 0x14020000 /* 3 */
784#define AU1200_USB_CTL_PHYS_ADDR 0x14020000 /* 4 */
785#define AU1200_USB_OTG_PHYS_ADDR 0x14020020 /* 4 */
786#define AU1200_USB_OHCI_PHYS_ADDR 0x14020100 /* 4 */
787#define AU1200_USB_EHCI_PHYS_ADDR 0x14020200 /* 4 */
788#define AU1200_USB_UDC_PHYS_ADDR 0x14022000 /* 4 */
789#define AU1300_USB_EHCI_PHYS_ADDR 0x14020000 /* 5 */
790#define AU1300_USB_OHCI0_PHYS_ADDR 0x14020400 /* 5 */
791#define AU1300_USB_OHCI1_PHYS_ADDR 0x14020800 /* 5 */
792#define AU1300_USB_CTL_PHYS_ADDR 0x14021000 /* 5 */
793#define AU1300_USB_OTG_PHYS_ADDR 0x14022000 /* 5 */
794#define AU1300_MAEBSA_PHYS_ADDR 0x14030000 /* 5 */
795#define AU1100_LCD_PHYS_ADDR 0x15000000 /* 2 */
796#define AU1200_LCD_PHYS_ADDR 0x15000000 /* 45 */
797#define AU1500_PCI_MEM_PHYS_ADDR 0x400000000ULL /* 13 */
798#define AU1500_PCI_IO_PHYS_ADDR 0x500000000ULL /* 13 */
799#define AU1500_PCI_CONFIG0_PHYS_ADDR 0x600000000ULL /* 13 */
800#define AU1500_PCI_CONFIG1_PHYS_ADDR 0x680000000ULL /* 13 */
801#define AU1000_PCMCIA_IO_PHYS_ADDR 0xF00000000ULL /* 012345 */
802#define AU1000_PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL /* 012345 */
803#define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
804
805/**********************************************************************/
806
807
808/*
809 * Au1300 GPIO+INT controller (GPIC) register offsets and bits
810 * Registers are 128bits (0x10 bytes), divided into 4 "banks".
811 */
812#define AU1300_GPIC_PINVAL 0x0000
813#define AU1300_GPIC_PINVALCLR 0x0010
814#define AU1300_GPIC_IPEND 0x0020
815#define AU1300_GPIC_PRIENC 0x0030
816#define AU1300_GPIC_IEN 0x0040 /* int_mask in manual */
817#define AU1300_GPIC_IDIS 0x0050 /* int_maskclr in manual */
818#define AU1300_GPIC_DMASEL 0x0060
819#define AU1300_GPIC_DEVSEL 0x0080
820#define AU1300_GPIC_DEVCLR 0x0090
821#define AU1300_GPIC_RSTVAL 0x00a0
822/* pin configuration space. one 32bit register for up to 128 IRQs */
823#define AU1300_GPIC_PINCFG 0x1000
824
825#define GPIC_GPIO_TO_BIT(gpio) \
826 (1 << ((gpio) & 0x1f))
827
828#define GPIC_GPIO_BANKOFF(gpio) \
829 (((gpio) >> 5) * 4)
830
831/* Pin Control bits: who owns the pin, what does it do */
832#define GPIC_CFG_PC_GPIN 0
833#define GPIC_CFG_PC_DEV 1
834#define GPIC_CFG_PC_GPOLOW 2
835#define GPIC_CFG_PC_GPOHIGH 3
836#define GPIC_CFG_PC_MASK 3
837
838/* assign pin to MIPS IRQ line */
839#define GPIC_CFG_IL_SET(x) (((x) & 3) << 2)
840#define GPIC_CFG_IL_MASK (3 << 2)
841
842/* pin interrupt type setup */
843#define GPIC_CFG_IC_OFF (0 << 4)
844#define GPIC_CFG_IC_LEVEL_LOW (1 << 4)
845#define GPIC_CFG_IC_LEVEL_HIGH (2 << 4)
846#define GPIC_CFG_IC_EDGE_FALL (5 << 4)
847#define GPIC_CFG_IC_EDGE_RISE (6 << 4)
848#define GPIC_CFG_IC_EDGE_BOTH (7 << 4)
849#define GPIC_CFG_IC_MASK (7 << 4)
850
851/* allow interrupt to wake cpu from 'wait' */
852#define GPIC_CFG_IDLEWAKE (1 << 7)
853
854/***********************************************************************/
855
856/* Au1000 SDRAM memory controller register offsets */
857#define AU1000_MEM_SDMODE0 0x0000
858#define AU1000_MEM_SDMODE1 0x0004
859#define AU1000_MEM_SDMODE2 0x0008
860#define AU1000_MEM_SDADDR0 0x000C
861#define AU1000_MEM_SDADDR1 0x0010
862#define AU1000_MEM_SDADDR2 0x0014
863#define AU1000_MEM_SDREFCFG 0x0018
864#define AU1000_MEM_SDPRECMD 0x001C
865#define AU1000_MEM_SDAUTOREF 0x0020
866#define AU1000_MEM_SDWRMD0 0x0024
867#define AU1000_MEM_SDWRMD1 0x0028
868#define AU1000_MEM_SDWRMD2 0x002C
869#define AU1000_MEM_SDSLEEP 0x0030
870#define AU1000_MEM_SDSMCKE 0x0034
871
872/* MEM_SDMODE register content definitions */
873#define MEM_SDMODE_F (1 << 22)
874#define MEM_SDMODE_SR (1 << 21)
875#define MEM_SDMODE_BS (1 << 20)
876#define MEM_SDMODE_RS (3 << 18)
877#define MEM_SDMODE_CS (7 << 15)
878#define MEM_SDMODE_TRAS (15 << 11)
879#define MEM_SDMODE_TMRD (3 << 9)
880#define MEM_SDMODE_TWR (3 << 7)
881#define MEM_SDMODE_TRP (3 << 5)
882#define MEM_SDMODE_TRCD (3 << 3)
883#define MEM_SDMODE_TCL (7 << 0)
884
885#define MEM_SDMODE_BS_2Bank (0 << 20)
886#define MEM_SDMODE_BS_4Bank (1 << 20)
887#define MEM_SDMODE_RS_11Row (0 << 18)
888#define MEM_SDMODE_RS_12Row (1 << 18)
889#define MEM_SDMODE_RS_13Row (2 << 18)
890#define MEM_SDMODE_RS_N(N) ((N) << 18)
891#define MEM_SDMODE_CS_7Col (0 << 15)
892#define MEM_SDMODE_CS_8Col (1 << 15)
893#define MEM_SDMODE_CS_9Col (2 << 15)
894#define MEM_SDMODE_CS_10Col (3 << 15)
895#define MEM_SDMODE_CS_11Col (4 << 15)
896#define MEM_SDMODE_CS_N(N) ((N) << 15)
897#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
898#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
899#define MEM_SDMODE_TWR_N(N) ((N) << 7)
900#define MEM_SDMODE_TRP_N(N) ((N) << 5)
901#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
902#define MEM_SDMODE_TCL_N(N) ((N) << 0)
903
904/* MEM_SDADDR register contents definitions */
905#define MEM_SDADDR_E (1 << 20)
906#define MEM_SDADDR_CSBA (0x03FF << 10)
907#define MEM_SDADDR_CSMASK (0x03FF << 0)
908#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
909#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
910
911/* MEM_SDREFCFG register content definitions */
912#define MEM_SDREFCFG_TRC (15 << 28)
913#define MEM_SDREFCFG_TRPM (3 << 26)
914#define MEM_SDREFCFG_E (1 << 25)
915#define MEM_SDREFCFG_RE (0x1ffffff << 0)
916#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
917#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
918#define MEM_SDREFCFG_REF_N(N) (N)
919
920/* Au1550 SDRAM Register Offsets */
921#define AU1550_MEM_SDMODE0 0x0800
922#define AU1550_MEM_SDMODE1 0x0808
923#define AU1550_MEM_SDMODE2 0x0810
924#define AU1550_MEM_SDADDR0 0x0820
925#define AU1550_MEM_SDADDR1 0x0828
926#define AU1550_MEM_SDADDR2 0x0830
927#define AU1550_MEM_SDCONFIGA 0x0840
928#define AU1550_MEM_SDCONFIGB 0x0848
929#define AU1550_MEM_SDSTAT 0x0850
930#define AU1550_MEM_SDERRADDR 0x0858
931#define AU1550_MEM_SDSTRIDE0 0x0860
932#define AU1550_MEM_SDSTRIDE1 0x0868
933#define AU1550_MEM_SDSTRIDE2 0x0870
934#define AU1550_MEM_SDWRMD0 0x0880
935#define AU1550_MEM_SDWRMD1 0x0888
936#define AU1550_MEM_SDWRMD2 0x0890
937#define AU1550_MEM_SDPRECMD 0x08C0
938#define AU1550_MEM_SDAUTOREF 0x08C8
939#define AU1550_MEM_SDSREF 0x08D0
940#define AU1550_MEM_SDSLEEP MEM_SDSREF
941
942/* Static Bus Controller */
943#define MEM_STCFG0 0xB4001000
944#define MEM_STTIME0 0xB4001004
945#define MEM_STADDR0 0xB4001008
946
947#define MEM_STCFG1 0xB4001010
948#define MEM_STTIME1 0xB4001014
949#define MEM_STADDR1 0xB4001018
950
951#define MEM_STCFG2 0xB4001020
952#define MEM_STTIME2 0xB4001024
953#define MEM_STADDR2 0xB4001028
954
955#define MEM_STCFG3 0xB4001030
956#define MEM_STTIME3 0xB4001034
957#define MEM_STADDR3 0xB4001038
958
959#define MEM_STNDCTL 0xB4001100
960#define MEM_STSTAT 0xB4001104
961
962#define MEM_STNAND_CMD 0x0
963#define MEM_STNAND_ADDR 0x4
964#define MEM_STNAND_DATA 0x20
965
966
967/* Programmable Counters 0 and 1 */
968#define SYS_BASE 0xB1900000
969#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
970# define SYS_CNTRL_E1S (1 << 23)
971# define SYS_CNTRL_T1S (1 << 20)
972# define SYS_CNTRL_M21 (1 << 19)
973# define SYS_CNTRL_M11 (1 << 18)
974# define SYS_CNTRL_M01 (1 << 17)
975# define SYS_CNTRL_C1S (1 << 16)
976# define SYS_CNTRL_BP (1 << 14)
977# define SYS_CNTRL_EN1 (1 << 13)
978# define SYS_CNTRL_BT1 (1 << 12)
979# define SYS_CNTRL_EN0 (1 << 11)
980# define SYS_CNTRL_BT0 (1 << 10)
981# define SYS_CNTRL_E0 (1 << 8)
982# define SYS_CNTRL_E0S (1 << 7)
983# define SYS_CNTRL_32S (1 << 5)
984# define SYS_CNTRL_T0S (1 << 4)
985# define SYS_CNTRL_M20 (1 << 3)
986# define SYS_CNTRL_M10 (1 << 2)
987# define SYS_CNTRL_M00 (1 << 1)
988# define SYS_CNTRL_C0S (1 << 0)
989
990/* Programmable Counter 0 Registers */
991#define SYS_TOYTRIM (SYS_BASE + 0)
992#define SYS_TOYWRITE (SYS_BASE + 4)
993#define SYS_TOYMATCH0 (SYS_BASE + 8)
994#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
995#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
996#define SYS_TOYREAD (SYS_BASE + 0x40)
997
998/* Programmable Counter 1 Registers */
999#define SYS_RTCTRIM (SYS_BASE + 0x44)
1000#define SYS_RTCWRITE (SYS_BASE + 0x48)
1001#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
1002#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
1003#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
1004#define SYS_RTCREAD (SYS_BASE + 0x58)
1005
1006/* I2S Controller */
1007#define I2S_DATA 0xB1000000
1008# define I2S_DATA_MASK 0xffffff
1009#define I2S_CONFIG 0xB1000004
1010# define I2S_CONFIG_XU (1 << 25)
1011# define I2S_CONFIG_XO (1 << 24)
1012# define I2S_CONFIG_RU (1 << 23)
1013# define I2S_CONFIG_RO (1 << 22)
1014# define I2S_CONFIG_TR (1 << 21)
1015# define I2S_CONFIG_TE (1 << 20)
1016# define I2S_CONFIG_TF (1 << 19)
1017# define I2S_CONFIG_RR (1 << 18)
1018# define I2S_CONFIG_RE (1 << 17)
1019# define I2S_CONFIG_RF (1 << 16)
1020# define I2S_CONFIG_PD (1 << 11)
1021# define I2S_CONFIG_LB (1 << 10)
1022# define I2S_CONFIG_IC (1 << 9)
1023# define I2S_CONFIG_FM_BIT 7
1024# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
1025# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
1026# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
1027# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
1028# define I2S_CONFIG_TN (1 << 6)
1029# define I2S_CONFIG_RN (1 << 5)
1030# define I2S_CONFIG_SZ_BIT 0
1031# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
1032
1033#define I2S_CONTROL 0xB1000008
1034# define I2S_CONTROL_D (1 << 1)
1035# define I2S_CONTROL_CE (1 << 0)
1036
1037
1038/* Ethernet Controllers */
1039
1040/* 4 byte offsets from AU1000_ETH_BASE */
1041#define MAC_CONTROL 0x0
1042# define MAC_RX_ENABLE (1 << 2)
1043# define MAC_TX_ENABLE (1 << 3)
1044# define MAC_DEF_CHECK (1 << 5)
1045# define MAC_SET_BL(X) (((X) & 0x3) << 6)
1046# define MAC_AUTO_PAD (1 << 8)
1047# define MAC_DISABLE_RETRY (1 << 10)
1048# define MAC_DISABLE_BCAST (1 << 11)
1049# define MAC_LATE_COL (1 << 12)
1050# define MAC_HASH_MODE (1 << 13)
1051# define MAC_HASH_ONLY (1 << 15)
1052# define MAC_PASS_ALL (1 << 16)
1053# define MAC_INVERSE_FILTER (1 << 17)
1054# define MAC_PROMISCUOUS (1 << 18)
1055# define MAC_PASS_ALL_MULTI (1 << 19)
1056# define MAC_FULL_DUPLEX (1 << 20)
1057# define MAC_NORMAL_MODE 0
1058# define MAC_INT_LOOPBACK (1 << 21)
1059# define MAC_EXT_LOOPBACK (1 << 22)
1060# define MAC_DISABLE_RX_OWN (1 << 23)
1061# define MAC_BIG_ENDIAN (1 << 30)
1062# define MAC_RX_ALL (1 << 31)
1063#define MAC_ADDRESS_HIGH 0x4
1064#define MAC_ADDRESS_LOW 0x8
1065#define MAC_MCAST_HIGH 0xC
1066#define MAC_MCAST_LOW 0x10
1067#define MAC_MII_CNTRL 0x14
1068# define MAC_MII_BUSY (1 << 0)
1069# define MAC_MII_READ 0
1070# define MAC_MII_WRITE (1 << 1)
1071# define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
1072# define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
1073#define MAC_MII_DATA 0x18
1074#define MAC_FLOW_CNTRL 0x1C
1075# define MAC_FLOW_CNTRL_BUSY (1 << 0)
1076# define MAC_FLOW_CNTRL_ENABLE (1 << 1)
1077# define MAC_PASS_CONTROL (1 << 2)
1078# define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
1079#define MAC_VLAN1_TAG 0x20
1080#define MAC_VLAN2_TAG 0x24
1081
1082/* Ethernet Controller Enable */
1083
1084# define MAC_EN_CLOCK_ENABLE (1 << 0)
1085# define MAC_EN_RESET0 (1 << 1)
1086# define MAC_EN_TOSS (0 << 2)
1087# define MAC_EN_CACHEABLE (1 << 3)
1088# define MAC_EN_RESET1 (1 << 4)
1089# define MAC_EN_RESET2 (1 << 5)
1090# define MAC_DMA_RESET (1 << 6)
1091
1092/* Ethernet Controller DMA Channels */
1093
1094#define MAC0_TX_DMA_ADDR 0xB4004000
1095#define MAC1_TX_DMA_ADDR 0xB4004200
1096/* offsets from MAC_TX_RING_ADDR address */
1097#define MAC_TX_BUFF0_STATUS 0x0
1098# define TX_FRAME_ABORTED (1 << 0)
1099# define TX_JAB_TIMEOUT (1 << 1)
1100# define TX_NO_CARRIER (1 << 2)
1101# define TX_LOSS_CARRIER (1 << 3)
1102# define TX_EXC_DEF (1 << 4)
1103# define TX_LATE_COLL_ABORT (1 << 5)
1104# define TX_EXC_COLL (1 << 6)
1105# define TX_UNDERRUN (1 << 7)
1106# define TX_DEFERRED (1 << 8)
1107# define TX_LATE_COLL (1 << 9)
1108# define TX_COLL_CNT_MASK (0xF << 10)
1109# define TX_PKT_RETRY (1 << 31)
1110#define MAC_TX_BUFF0_ADDR 0x4
1111# define TX_DMA_ENABLE (1 << 0)
1112# define TX_T_DONE (1 << 1)
1113# define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1114#define MAC_TX_BUFF0_LEN 0x8
1115#define MAC_TX_BUFF1_STATUS 0x10
1116#define MAC_TX_BUFF1_ADDR 0x14
1117#define MAC_TX_BUFF1_LEN 0x18
1118#define MAC_TX_BUFF2_STATUS 0x20
1119#define MAC_TX_BUFF2_ADDR 0x24
1120#define MAC_TX_BUFF2_LEN 0x28
1121#define MAC_TX_BUFF3_STATUS 0x30
1122#define MAC_TX_BUFF3_ADDR 0x34
1123#define MAC_TX_BUFF3_LEN 0x38
1124
1125#define MAC0_RX_DMA_ADDR 0xB4004100
1126#define MAC1_RX_DMA_ADDR 0xB4004300
1127/* offsets from MAC_RX_RING_ADDR */
1128#define MAC_RX_BUFF0_STATUS 0x0
1129# define RX_FRAME_LEN_MASK 0x3fff
1130# define RX_WDOG_TIMER (1 << 14)
1131# define RX_RUNT (1 << 15)
1132# define RX_OVERLEN (1 << 16)
1133# define RX_COLL (1 << 17)
1134# define RX_ETHER (1 << 18)
1135# define RX_MII_ERROR (1 << 19)
1136# define RX_DRIBBLING (1 << 20)
1137# define RX_CRC_ERROR (1 << 21)
1138# define RX_VLAN1 (1 << 22)
1139# define RX_VLAN2 (1 << 23)
1140# define RX_LEN_ERROR (1 << 24)
1141# define RX_CNTRL_FRAME (1 << 25)
1142# define RX_U_CNTRL_FRAME (1 << 26)
1143# define RX_MCAST_FRAME (1 << 27)
1144# define RX_BCAST_FRAME (1 << 28)
1145# define RX_FILTER_FAIL (1 << 29)
1146# define RX_PACKET_FILTER (1 << 30)
1147# define RX_MISSED_FRAME (1 << 31)
1148
1149# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
1150 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
1151 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
1152#define MAC_RX_BUFF0_ADDR 0x4
1153# define RX_DMA_ENABLE (1 << 0)
1154# define RX_T_DONE (1 << 1)
1155# define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1156# define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
1157#define MAC_RX_BUFF1_STATUS 0x10
1158#define MAC_RX_BUFF1_ADDR 0x14
1159#define MAC_RX_BUFF2_STATUS 0x20
1160#define MAC_RX_BUFF2_ADDR 0x24
1161#define MAC_RX_BUFF3_STATUS 0x30
1162#define MAC_RX_BUFF3_ADDR 0x34
1163
1164/* SSIO */
1165#define SSI0_STATUS 0xB1600000
1166# define SSI_STATUS_BF (1 << 4)
1167# define SSI_STATUS_OF (1 << 3)
1168# define SSI_STATUS_UF (1 << 2)
1169# define SSI_STATUS_D (1 << 1)
1170# define SSI_STATUS_B (1 << 0)
1171#define SSI0_INT 0xB1600004
1172# define SSI_INT_OI (1 << 3)
1173# define SSI_INT_UI (1 << 2)
1174# define SSI_INT_DI (1 << 1)
1175#define SSI0_INT_ENABLE 0xB1600008
1176# define SSI_INTE_OIE (1 << 3)
1177# define SSI_INTE_UIE (1 << 2)
1178# define SSI_INTE_DIE (1 << 1)
1179#define SSI0_CONFIG 0xB1600020
1180# define SSI_CONFIG_AO (1 << 24)
1181# define SSI_CONFIG_DO (1 << 23)
1182# define SSI_CONFIG_ALEN_BIT 20
1183# define SSI_CONFIG_ALEN_MASK (0x7 << 20)
1184# define SSI_CONFIG_DLEN_BIT 16
1185# define SSI_CONFIG_DLEN_MASK (0x7 << 16)
1186# define SSI_CONFIG_DD (1 << 11)
1187# define SSI_CONFIG_AD (1 << 10)
1188# define SSI_CONFIG_BM_BIT 8
1189# define SSI_CONFIG_BM_MASK (0x3 << 8)
1190# define SSI_CONFIG_CE (1 << 7)
1191# define SSI_CONFIG_DP (1 << 6)
1192# define SSI_CONFIG_DL (1 << 5)
1193# define SSI_CONFIG_EP (1 << 4)
1194#define SSI0_ADATA 0xB1600024
1195# define SSI_AD_D (1 << 24)
1196# define SSI_AD_ADDR_BIT 16
1197# define SSI_AD_ADDR_MASK (0xff << 16)
1198# define SSI_AD_DATA_BIT 0
1199# define SSI_AD_DATA_MASK (0xfff << 0)
1200#define SSI0_CLKDIV 0xB1600028
1201#define SSI0_CONTROL 0xB1600100
1202# define SSI_CONTROL_CD (1 << 1)
1203# define SSI_CONTROL_E (1 << 0)
1204
1205/* SSI1 */
1206#define SSI1_STATUS 0xB1680000
1207#define SSI1_INT 0xB1680004
1208#define SSI1_INT_ENABLE 0xB1680008
1209#define SSI1_CONFIG 0xB1680020
1210#define SSI1_ADATA 0xB1680024
1211#define SSI1_CLKDIV 0xB1680028
1212#define SSI1_ENABLE 0xB1680100
1213
1214/*
1215 * Register content definitions
1216 */
1217#define SSI_STATUS_BF (1 << 4)
1218#define SSI_STATUS_OF (1 << 3)
1219#define SSI_STATUS_UF (1 << 2)
1220#define SSI_STATUS_D (1 << 1)
1221#define SSI_STATUS_B (1 << 0)
1222
1223/* SSI_INT */
1224#define SSI_INT_OI (1 << 3)
1225#define SSI_INT_UI (1 << 2)
1226#define SSI_INT_DI (1 << 1)
1227
1228/* SSI_INTEN */
1229#define SSI_INTEN_OIE (1 << 3)
1230#define SSI_INTEN_UIE (1 << 2)
1231#define SSI_INTEN_DIE (1 << 1)
1232
1233#define SSI_CONFIG_AO (1 << 24)
1234#define SSI_CONFIG_DO (1 << 23)
1235#define SSI_CONFIG_ALEN (7 << 20)
1236#define SSI_CONFIG_DLEN (15 << 16)
1237#define SSI_CONFIG_DD (1 << 11)
1238#define SSI_CONFIG_AD (1 << 10)
1239#define SSI_CONFIG_BM (3 << 8)
1240#define SSI_CONFIG_CE (1 << 7)
1241#define SSI_CONFIG_DP (1 << 6)
1242#define SSI_CONFIG_DL (1 << 5)
1243#define SSI_CONFIG_EP (1 << 4)
1244#define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
1245#define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
1246#define SSI_CONFIG_BM_HI (0 << 8)
1247#define SSI_CONFIG_BM_LO (1 << 8)
1248#define SSI_CONFIG_BM_CY (2 << 8)
1249
1250#define SSI_ADATA_D (1 << 24)
1251#define SSI_ADATA_ADDR (0xFF << 16)
1252#define SSI_ADATA_DATA 0x0FFF
1253#define SSI_ADATA_ADDR_N(N) (N << 16)
1254
1255#define SSI_ENABLE_CD (1 << 1)
1256#define SSI_ENABLE_E (1 << 0)
1257
1258
1259/*
1260 * The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's not
1261 * used to select FIR/SIR mode on the transceiver but as a GPIO. Instead a
1262 * CPLD has to be told about the mode.
1263 */
1264#define AU1000_IRDA_PHY_MODE_OFF 0
1265#define AU1000_IRDA_PHY_MODE_SIR 1
1266#define AU1000_IRDA_PHY_MODE_FIR 2
1267
1268struct au1k_irda_platform_data {
1269 void(*set_phy_mode)(int mode);
1270};
1271
1272
1273/* GPIO */
1274#define SYS_PINFUNC 0xB190002C
1275# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
1276# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
1277# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
1278# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
1279# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
1280# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
1281# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
1282# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
1283# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
1284# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
1285# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
1286# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
1287# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
1288# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
1289# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
1290# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
1291
1292/* Au1100 only */
1293# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
1294# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
1295# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
1296# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
1297
1298/* Au1550 only. Redefines lots of pins */
1299# define SYS_PF_PSC2_MASK (7 << 17)
1300# define SYS_PF_PSC2_AC97 0
1301# define SYS_PF_PSC2_SPI 0
1302# define SYS_PF_PSC2_I2S (1 << 17)
1303# define SYS_PF_PSC2_SMBUS (3 << 17)
1304# define SYS_PF_PSC2_GPIO (7 << 17)
1305# define SYS_PF_PSC3_MASK (7 << 20)
1306# define SYS_PF_PSC3_AC97 0
1307# define SYS_PF_PSC3_SPI 0
1308# define SYS_PF_PSC3_I2S (1 << 20)
1309# define SYS_PF_PSC3_SMBUS (3 << 20)
1310# define SYS_PF_PSC3_GPIO (7 << 20)
1311# define SYS_PF_PSC1_S1 (1 << 1)
1312# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1313
1314/* Au1200 only */
1315#define SYS_PINFUNC_DMA (1 << 31)
1316#define SYS_PINFUNC_S0A (1 << 30)
1317#define SYS_PINFUNC_S1A (1 << 29)
1318#define SYS_PINFUNC_LP0 (1 << 28)
1319#define SYS_PINFUNC_LP1 (1 << 27)
1320#define SYS_PINFUNC_LD16 (1 << 26)
1321#define SYS_PINFUNC_LD8 (1 << 25)
1322#define SYS_PINFUNC_LD1 (1 << 24)
1323#define SYS_PINFUNC_LD0 (1 << 23)
1324#define SYS_PINFUNC_P1A (3 << 21)
1325#define SYS_PINFUNC_P1B (1 << 20)
1326#define SYS_PINFUNC_FS3 (1 << 19)
1327#define SYS_PINFUNC_P0A (3 << 17)
1328#define SYS_PINFUNC_CS (1 << 16)
1329#define SYS_PINFUNC_CIM (1 << 15)
1330#define SYS_PINFUNC_P1C (1 << 14)
1331#define SYS_PINFUNC_U1T (1 << 12)
1332#define SYS_PINFUNC_U1R (1 << 11)
1333#define SYS_PINFUNC_EX1 (1 << 10)
1334#define SYS_PINFUNC_EX0 (1 << 9)
1335#define SYS_PINFUNC_U0R (1 << 8)
1336#define SYS_PINFUNC_MC (1 << 7)
1337#define SYS_PINFUNC_S0B (1 << 6)
1338#define SYS_PINFUNC_S0C (1 << 5)
1339#define SYS_PINFUNC_P0B (1 << 4)
1340#define SYS_PINFUNC_U0T (1 << 3)
1341#define SYS_PINFUNC_S1B (1 << 2)
1342
1343/* Power Management */
1344#define SYS_SCRATCH0 0xB1900018
1345#define SYS_SCRATCH1 0xB190001C
1346#define SYS_WAKEMSK 0xB1900034
1347#define SYS_ENDIAN 0xB1900038
1348#define SYS_POWERCTRL 0xB190003C
1349#define SYS_WAKESRC 0xB190005C
1350#define SYS_SLPPWR 0xB1900078
1351#define SYS_SLEEP 0xB190007C
1352
1353#define SYS_WAKEMSK_D2 (1 << 9)
1354#define SYS_WAKEMSK_M2 (1 << 8)
1355#define SYS_WAKEMSK_GPIO(x) (1 << (x))
1356
1357/* Clock Controller */
1358#define SYS_FREQCTRL0 0xB1900020
1359# define SYS_FC_FRDIV2_BIT 22
1360# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
1361# define SYS_FC_FE2 (1 << 21)
1362# define SYS_FC_FS2 (1 << 20)
1363# define SYS_FC_FRDIV1_BIT 12
1364# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
1365# define SYS_FC_FE1 (1 << 11)
1366# define SYS_FC_FS1 (1 << 10)
1367# define SYS_FC_FRDIV0_BIT 2
1368# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
1369# define SYS_FC_FE0 (1 << 1)
1370# define SYS_FC_FS0 (1 << 0)
1371#define SYS_FREQCTRL1 0xB1900024
1372# define SYS_FC_FRDIV5_BIT 22
1373# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
1374# define SYS_FC_FE5 (1 << 21)
1375# define SYS_FC_FS5 (1 << 20)
1376# define SYS_FC_FRDIV4_BIT 12
1377# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
1378# define SYS_FC_FE4 (1 << 11)
1379# define SYS_FC_FS4 (1 << 10)
1380# define SYS_FC_FRDIV3_BIT 2
1381# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
1382# define SYS_FC_FE3 (1 << 1)
1383# define SYS_FC_FS3 (1 << 0)
1384#define SYS_CLKSRC 0xB1900028
1385# define SYS_CS_ME1_BIT 27
1386# define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
1387# define SYS_CS_DE1 (1 << 26)
1388# define SYS_CS_CE1 (1 << 25)
1389# define SYS_CS_ME0_BIT 22
1390# define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
1391# define SYS_CS_DE0 (1 << 21)
1392# define SYS_CS_CE0 (1 << 20)
1393# define SYS_CS_MI2_BIT 17
1394# define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
1395# define SYS_CS_DI2 (1 << 16)
1396# define SYS_CS_CI2 (1 << 15)
1397
1398# define SYS_CS_ML_BIT 7
1399# define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
1400# define SYS_CS_DL (1 << 6)
1401# define SYS_CS_CL (1 << 5)
1402
1403# define SYS_CS_MUH_BIT 12
1404# define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
1405# define SYS_CS_DUH (1 << 11)
1406# define SYS_CS_CUH (1 << 10)
1407# define SYS_CS_MUD_BIT 7
1408# define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
1409# define SYS_CS_DUD (1 << 6)
1410# define SYS_CS_CUD (1 << 5)
1411
1412# define SYS_CS_MIR_BIT 2
1413# define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
1414# define SYS_CS_DIR (1 << 1)
1415# define SYS_CS_CIR (1 << 0)
1416
1417# define SYS_CS_MUX_AUX 0x1
1418# define SYS_CS_MUX_FQ0 0x2
1419# define SYS_CS_MUX_FQ1 0x3
1420# define SYS_CS_MUX_FQ2 0x4
1421# define SYS_CS_MUX_FQ3 0x5
1422# define SYS_CS_MUX_FQ4 0x6
1423# define SYS_CS_MUX_FQ5 0x7
1424#define SYS_CPUPLL 0xB1900060
1425#define SYS_AUXPLL 0xB1900064
1426
1427/* AC97 Controller */
1428#define AC97C_CONFIG 0xB0000000
1429# define AC97C_RECV_SLOTS_BIT 13
1430# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1431# define AC97C_XMIT_SLOTS_BIT 3
1432# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1433# define AC97C_SG (1 << 2)
1434# define AC97C_SYNC (1 << 1)
1435# define AC97C_RESET (1 << 0)
1436#define AC97C_STATUS 0xB0000004
1437# define AC97C_XU (1 << 11)
1438# define AC97C_XO (1 << 10)
1439# define AC97C_RU (1 << 9)
1440# define AC97C_RO (1 << 8)
1441# define AC97C_READY (1 << 7)
1442# define AC97C_CP (1 << 6)
1443# define AC97C_TR (1 << 5)
1444# define AC97C_TE (1 << 4)
1445# define AC97C_TF (1 << 3)
1446# define AC97C_RR (1 << 2)
1447# define AC97C_RE (1 << 1)
1448# define AC97C_RF (1 << 0)
1449#define AC97C_DATA 0xB0000008
1450#define AC97C_CMD 0xB000000C
1451# define AC97C_WD_BIT 16
1452# define AC97C_READ (1 << 7)
1453# define AC97C_INDEX_MASK 0x7f
1454#define AC97C_CNTRL 0xB0000010
1455# define AC97C_RS (1 << 1)
1456# define AC97C_CE (1 << 0)
1457
1458
1459/* The PCI chip selects are outside the 32bit space, and since we can't
1460 * just program the 36bit addresses into BARs, we have to take a chunk
1461 * out of the 32bit space and reserve it for PCI. When these addresses
1462 * are ioremap()ed, they'll be fixed up to the real 36bit address before
1463 * being passed to the real ioremap function.
1464 */
1465#define ALCHEMY_PCI_MEMWIN_START (AU1500_PCI_MEM_PHYS_ADDR >> 4)
1466#define ALCHEMY_PCI_MEMWIN_END (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
1467
1468/* for PCI IO it's simpler because we get to do the ioremap ourselves and then
1469 * adjust the device's resources.
1470 */
1471#define ALCHEMY_PCI_IOWIN_START 0x00001000
1472#define ALCHEMY_PCI_IOWIN_END 0x0000FFFF
1473
1474#ifdef CONFIG_PCI
1475
1476#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1477#define IOPORT_RESOURCE_END 0xffffffff
1478#define IOMEM_RESOURCE_START 0x10000000
1479#define IOMEM_RESOURCE_END 0xfffffffffULL
1480
1481#else
1482
1483/* Don't allow any legacy ports probing */
1484#define IOPORT_RESOURCE_START 0x10000000
1485#define IOPORT_RESOURCE_END 0xffffffff
1486#define IOMEM_RESOURCE_START 0x10000000
1487#define IOMEM_RESOURCE_END 0xfffffffffULL
1488
1489#endif
1490
1491/* PCI controller block register offsets */
1492#define PCI_REG_CMEM 0x0000
1493#define PCI_REG_CONFIG 0x0004
1494#define PCI_REG_B2BMASK_CCH 0x0008
1495#define PCI_REG_B2BBASE0_VID 0x000C
1496#define PCI_REG_B2BBASE1_SID 0x0010
1497#define PCI_REG_MWMASK_DEV 0x0014
1498#define PCI_REG_MWBASE_REV_CCL 0x0018
1499#define PCI_REG_ERR_ADDR 0x001C
1500#define PCI_REG_SPEC_INTACK 0x0020
1501#define PCI_REG_ID 0x0100
1502#define PCI_REG_STATCMD 0x0104
1503#define PCI_REG_CLASSREV 0x0108
1504#define PCI_REG_PARAM 0x010C
1505#define PCI_REG_MBAR 0x0110
1506#define PCI_REG_TIMEOUT 0x0140
1507
1508/* PCI controller block register bits */
1509#define PCI_CMEM_E (1 << 28) /* enable cacheable memory */
1510#define PCI_CMEM_CMBASE(x) (((x) & 0x3fff) << 14)
1511#define PCI_CMEM_CMMASK(x) ((x) & 0x3fff)
1512#define PCI_CONFIG_ERD (1 << 27) /* pci error during R/W */
1513#define PCI_CONFIG_ET (1 << 26) /* error in target mode */
1514#define PCI_CONFIG_EF (1 << 25) /* fatal error */
1515#define PCI_CONFIG_EP (1 << 24) /* parity error */
1516#define PCI_CONFIG_EM (1 << 23) /* multiple errors */
1517#define PCI_CONFIG_BM (1 << 22) /* bad master error */
1518#define PCI_CONFIG_PD (1 << 20) /* PCI Disable */
1519#define PCI_CONFIG_BME (1 << 19) /* Byte Mask Enable for reads */
1520#define PCI_CONFIG_NC (1 << 16) /* mark mem access non-coherent */
1521#define PCI_CONFIG_IA (1 << 15) /* INTA# enabled (target mode) */
1522#define PCI_CONFIG_IP (1 << 13) /* int on PCI_PERR# */
1523#define PCI_CONFIG_IS (1 << 12) /* int on PCI_SERR# */
1524#define PCI_CONFIG_IMM (1 << 11) /* int on master abort */
1525#define PCI_CONFIG_ITM (1 << 10) /* int on target abort (as master) */
1526#define PCI_CONFIG_ITT (1 << 9) /* int on target abort (as target) */
1527#define PCI_CONFIG_IPB (1 << 8) /* int on PERR# in bus master acc */
1528#define PCI_CONFIG_SIC_NO (0 << 6) /* no byte mask changes */
1529#define PCI_CONFIG_SIC_BA_ADR (1 << 6) /* on byte/hw acc, invert adr bits */
1530#define PCI_CONFIG_SIC_HWA_DAT (2 << 6) /* on halfword acc, swap data */
1531#define PCI_CONFIG_SIC_ALL (3 << 6) /* swap data bytes on all accesses */
1532#define PCI_CONFIG_ST (1 << 5) /* swap data by target transactions */
1533#define PCI_CONFIG_SM (1 << 4) /* swap data from PCI ctl */
1534#define PCI_CONFIG_AEN (1 << 3) /* enable internal arbiter */
1535#define PCI_CONFIG_R2H (1 << 2) /* REQ2# to hi-prio arbiter */
1536#define PCI_CONFIG_R1H (1 << 1) /* REQ1# to hi-prio arbiter */
1537#define PCI_CONFIG_CH (1 << 0) /* PCI ctl to hi-prio arbiter */
1538#define PCI_B2BMASK_B2BMASK(x) (((x) & 0xffff) << 16)
1539#define PCI_B2BMASK_CCH(x) ((x) & 0xffff) /* 16 upper bits of class code */
1540#define PCI_B2BBASE0_VID_B0(x) (((x) & 0xffff) << 16)
1541#define PCI_B2BBASE0_VID_SV(x) ((x) & 0xffff)
1542#define PCI_B2BBASE1_SID_B1(x) (((x) & 0xffff) << 16)
1543#define PCI_B2BBASE1_SID_SI(x) ((x) & 0xffff)
1544#define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
1545#define PCI_MWMASKDEV_DEVID(x) ((x) & 0xffff)
1546#define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
1547#define PCI_MWBASEREVCCL_REV(x) (((x) & 0xff) << 8)
1548#define PCI_MWBASEREVCCL_CCL(x) ((x) & 0xff)
1549#define PCI_ID_DID(x) (((x) & 0xffff) << 16)
1550#define PCI_ID_VID(x) ((x) & 0xffff)
1551#define PCI_STATCMD_STATUS(x) (((x) & 0xffff) << 16)
1552#define PCI_STATCMD_CMD(x) ((x) & 0xffff)
1553#define PCI_CLASSREV_CLASS(x) (((x) & 0x00ffffff) << 8)
1554#define PCI_CLASSREV_REV(x) ((x) & 0xff)
1555#define PCI_PARAM_BIST(x) (((x) & 0xff) << 24)
1556#define PCI_PARAM_HT(x) (((x) & 0xff) << 16)
1557#define PCI_PARAM_LT(x) (((x) & 0xff) << 8)
1558#define PCI_PARAM_CLS(x) ((x) & 0xff)
1559#define PCI_TIMEOUT_RETRIES(x) (((x) & 0xff) << 8) /* max retries */
1560#define PCI_TIMEOUT_TO(x) ((x) & 0xff) /* target ready timeout */
1561
1562#endif 1211#endif
diff --git a/arch/mips/include/asm/mach-au1x00/au1000_dma.h b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
index 7cedca5a305c..0a0cd4270c6f 100644
--- a/arch/mips/include/asm/mach-au1x00/au1000_dma.h
+++ b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
@@ -106,7 +106,7 @@ enum {
106struct dma_chan { 106struct dma_chan {
107 int dev_id; /* this channel is allocated if >= 0, */ 107 int dev_id; /* this channel is allocated if >= 0, */
108 /* free otherwise */ 108 /* free otherwise */
109 unsigned int io; 109 void __iomem *io;
110 const char *dev_str; 110 const char *dev_str;
111 int irq; 111 int irq;
112 void *irq_dev; 112 void *irq_dev;
@@ -157,7 +157,7 @@ static inline void enable_dma_buffer0(unsigned int dmanr)
157 157
158 if (!chan) 158 if (!chan)
159 return; 159 return;
160 au_writel(DMA_BE0, chan->io + DMA_MODE_SET); 160 __raw_writel(DMA_BE0, chan->io + DMA_MODE_SET);
161} 161}
162 162
163static inline void enable_dma_buffer1(unsigned int dmanr) 163static inline void enable_dma_buffer1(unsigned int dmanr)
@@ -166,7 +166,7 @@ static inline void enable_dma_buffer1(unsigned int dmanr)
166 166
167 if (!chan) 167 if (!chan)
168 return; 168 return;
169 au_writel(DMA_BE1, chan->io + DMA_MODE_SET); 169 __raw_writel(DMA_BE1, chan->io + DMA_MODE_SET);
170} 170}
171static inline void enable_dma_buffers(unsigned int dmanr) 171static inline void enable_dma_buffers(unsigned int dmanr)
172{ 172{
@@ -174,7 +174,7 @@ static inline void enable_dma_buffers(unsigned int dmanr)
174 174
175 if (!chan) 175 if (!chan)
176 return; 176 return;
177 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET); 177 __raw_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
178} 178}
179 179
180static inline void start_dma(unsigned int dmanr) 180static inline void start_dma(unsigned int dmanr)
@@ -183,7 +183,7 @@ static inline void start_dma(unsigned int dmanr)
183 183
184 if (!chan) 184 if (!chan)
185 return; 185 return;
186 au_writel(DMA_GO, chan->io + DMA_MODE_SET); 186 __raw_writel(DMA_GO, chan->io + DMA_MODE_SET);
187} 187}
188 188
189#define DMA_HALT_POLL 0x5000 189#define DMA_HALT_POLL 0x5000
@@ -195,11 +195,11 @@ static inline void halt_dma(unsigned int dmanr)
195 195
196 if (!chan) 196 if (!chan)
197 return; 197 return;
198 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR); 198 __raw_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
199 199
200 /* Poll the halt bit */ 200 /* Poll the halt bit */
201 for (i = 0; i < DMA_HALT_POLL; i++) 201 for (i = 0; i < DMA_HALT_POLL; i++)
202 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) 202 if (__raw_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
203 break; 203 break;
204 if (i == DMA_HALT_POLL) 204 if (i == DMA_HALT_POLL)
205 printk(KERN_INFO "halt_dma: HALT poll expired!\n"); 205 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
@@ -215,7 +215,7 @@ static inline void disable_dma(unsigned int dmanr)
215 halt_dma(dmanr); 215 halt_dma(dmanr);
216 216
217 /* Now we can disable the buffers */ 217 /* Now we can disable the buffers */
218 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR); 218 __raw_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
219} 219}
220 220
221static inline int dma_halted(unsigned int dmanr) 221static inline int dma_halted(unsigned int dmanr)
@@ -224,7 +224,7 @@ static inline int dma_halted(unsigned int dmanr)
224 224
225 if (!chan) 225 if (!chan)
226 return 1; 226 return 1;
227 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0; 227 return (__raw_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0;
228} 228}
229 229
230/* Initialize a DMA channel. */ 230/* Initialize a DMA channel. */
@@ -239,14 +239,14 @@ static inline void init_dma(unsigned int dmanr)
239 disable_dma(dmanr); 239 disable_dma(dmanr);
240 240
241 /* Set device FIFO address */ 241 /* Set device FIFO address */
242 au_writel(CPHYSADDR(chan->fifo_addr), chan->io + DMA_PERIPHERAL_ADDR); 242 __raw_writel(CPHYSADDR(chan->fifo_addr), chan->io + DMA_PERIPHERAL_ADDR);
243 243
244 mode = chan->mode | (chan->dev_id << DMA_DID_BIT); 244 mode = chan->mode | (chan->dev_id << DMA_DID_BIT);
245 if (chan->irq) 245 if (chan->irq)
246 mode |= DMA_IE; 246 mode |= DMA_IE;
247 247
248 au_writel(~mode, chan->io + DMA_MODE_CLEAR); 248 __raw_writel(~mode, chan->io + DMA_MODE_CLEAR);
249 au_writel(mode, chan->io + DMA_MODE_SET); 249 __raw_writel(mode, chan->io + DMA_MODE_SET);
250} 250}
251 251
252/* 252/*
@@ -283,7 +283,7 @@ static inline int get_dma_active_buffer(unsigned int dmanr)
283 283
284 if (!chan) 284 if (!chan)
285 return -1; 285 return -1;
286 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0; 286 return (__raw_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
287} 287}
288 288
289/* 289/*
@@ -304,7 +304,7 @@ static inline void set_dma_fifo_addr(unsigned int dmanr, unsigned int a)
304 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05) 304 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
305 return; 305 return;
306 306
307 au_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR); 307 __raw_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR);
308} 308}
309 309
310/* 310/*
@@ -316,7 +316,7 @@ static inline void clear_dma_done0(unsigned int dmanr)
316 316
317 if (!chan) 317 if (!chan)
318 return; 318 return;
319 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR); 319 __raw_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
320} 320}
321 321
322static inline void clear_dma_done1(unsigned int dmanr) 322static inline void clear_dma_done1(unsigned int dmanr)
@@ -325,7 +325,7 @@ static inline void clear_dma_done1(unsigned int dmanr)
325 325
326 if (!chan) 326 if (!chan)
327 return; 327 return;
328 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR); 328 __raw_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
329} 329}
330 330
331/* 331/*
@@ -344,7 +344,7 @@ static inline void set_dma_addr0(unsigned int dmanr, unsigned int a)
344 344
345 if (!chan) 345 if (!chan)
346 return; 346 return;
347 au_writel(a, chan->io + DMA_BUFFER0_START); 347 __raw_writel(a, chan->io + DMA_BUFFER0_START);
348} 348}
349 349
350/* 350/*
@@ -356,7 +356,7 @@ static inline void set_dma_addr1(unsigned int dmanr, unsigned int a)
356 356
357 if (!chan) 357 if (!chan)
358 return; 358 return;
359 au_writel(a, chan->io + DMA_BUFFER1_START); 359 __raw_writel(a, chan->io + DMA_BUFFER1_START);
360} 360}
361 361
362 362
@@ -370,7 +370,7 @@ static inline void set_dma_count0(unsigned int dmanr, unsigned int count)
370 if (!chan) 370 if (!chan)
371 return; 371 return;
372 count &= DMA_COUNT_MASK; 372 count &= DMA_COUNT_MASK;
373 au_writel(count, chan->io + DMA_BUFFER0_COUNT); 373 __raw_writel(count, chan->io + DMA_BUFFER0_COUNT);
374} 374}
375 375
376/* 376/*
@@ -383,7 +383,7 @@ static inline void set_dma_count1(unsigned int dmanr, unsigned int count)
383 if (!chan) 383 if (!chan)
384 return; 384 return;
385 count &= DMA_COUNT_MASK; 385 count &= DMA_COUNT_MASK;
386 au_writel(count, chan->io + DMA_BUFFER1_COUNT); 386 __raw_writel(count, chan->io + DMA_BUFFER1_COUNT);
387} 387}
388 388
389/* 389/*
@@ -396,8 +396,8 @@ static inline void set_dma_count(unsigned int dmanr, unsigned int count)
396 if (!chan) 396 if (!chan)
397 return; 397 return;
398 count &= DMA_COUNT_MASK; 398 count &= DMA_COUNT_MASK;
399 au_writel(count, chan->io + DMA_BUFFER0_COUNT); 399 __raw_writel(count, chan->io + DMA_BUFFER0_COUNT);
400 au_writel(count, chan->io + DMA_BUFFER1_COUNT); 400 __raw_writel(count, chan->io + DMA_BUFFER1_COUNT);
401} 401}
402 402
403/* 403/*
@@ -410,7 +410,7 @@ static inline unsigned int get_dma_buffer_done(unsigned int dmanr)
410 410
411 if (!chan) 411 if (!chan)
412 return 0; 412 return 0;
413 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1); 413 return __raw_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
414} 414}
415 415
416 416
@@ -437,10 +437,10 @@ static inline int get_dma_residue(unsigned int dmanr)
437 if (!chan) 437 if (!chan)
438 return 0; 438 return 0;
439 439
440 curBufCntReg = (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 440 curBufCntReg = (__raw_readl(chan->io + DMA_MODE_READ) & DMA_AB) ?
441 DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT; 441 DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT;
442 442
443 count = au_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK; 443 count = __raw_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK;
444 444
445 if ((chan->mode & DMA_DW_MASK) == DMA_DW16) 445 if ((chan->mode & DMA_DW_MASK) == DMA_DW16)
446 count <<= 1; 446 count <<= 1;
diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
index 796afd051c35..9785e4ebb450 100644
--- a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
+++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
@@ -25,20 +25,20 @@
25#define MAKE_IRQ(intc, off) (AU1000_INTC##intc##_INT_BASE + (off)) 25#define MAKE_IRQ(intc, off) (AU1000_INTC##intc##_INT_BASE + (off))
26 26
27/* GPIO1 registers within SYS_ area */ 27/* GPIO1 registers within SYS_ area */
28#define SYS_TRIOUTRD 0x100 28#define AU1000_SYS_TRIOUTRD 0x100
29#define SYS_TRIOUTCLR 0x100 29#define AU1000_SYS_TRIOUTCLR 0x100
30#define SYS_OUTPUTRD 0x108 30#define AU1000_SYS_OUTPUTRD 0x108
31#define SYS_OUTPUTSET 0x108 31#define AU1000_SYS_OUTPUTSET 0x108
32#define SYS_OUTPUTCLR 0x10C 32#define AU1000_SYS_OUTPUTCLR 0x10C
33#define SYS_PINSTATERD 0x110 33#define AU1000_SYS_PINSTATERD 0x110
34#define SYS_PININPUTEN 0x110 34#define AU1000_SYS_PININPUTEN 0x110
35 35
36/* register offsets within GPIO2 block */ 36/* register offsets within GPIO2 block */
37#define GPIO2_DIR 0x00 37#define AU1000_GPIO2_DIR 0x00
38#define GPIO2_OUTPUT 0x08 38#define AU1000_GPIO2_OUTPUT 0x08
39#define GPIO2_PINSTATE 0x0C 39#define AU1000_GPIO2_PINSTATE 0x0C
40#define GPIO2_INTENABLE 0x10 40#define AU1000_GPIO2_INTENABLE 0x10
41#define GPIO2_ENABLE 0x14 41#define AU1000_GPIO2_ENABLE 0x14
42 42
43struct gpio; 43struct gpio;
44 44
@@ -217,26 +217,21 @@ static inline int au1200_irq_to_gpio(int irq)
217 */ 217 */
218static inline void alchemy_gpio1_set_value(int gpio, int v) 218static inline void alchemy_gpio1_set_value(int gpio, int v)
219{ 219{
220 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
221 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE); 220 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
222 unsigned long r = v ? SYS_OUTPUTSET : SYS_OUTPUTCLR; 221 unsigned long r = v ? AU1000_SYS_OUTPUTSET : AU1000_SYS_OUTPUTCLR;
223 __raw_writel(mask, base + r); 222 alchemy_wrsys(mask, r);
224 wmb();
225} 223}
226 224
227static inline int alchemy_gpio1_get_value(int gpio) 225static inline int alchemy_gpio1_get_value(int gpio)
228{ 226{
229 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
230 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE); 227 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
231 return __raw_readl(base + SYS_PINSTATERD) & mask; 228 return alchemy_rdsys(AU1000_SYS_PINSTATERD) & mask;
232} 229}
233 230
234static inline int alchemy_gpio1_direction_input(int gpio) 231static inline int alchemy_gpio1_direction_input(int gpio)
235{ 232{
236 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
237 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE); 233 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
238 __raw_writel(mask, base + SYS_TRIOUTCLR); 234 alchemy_wrsys(mask, AU1000_SYS_TRIOUTCLR);
239 wmb();
240 return 0; 235 return 0;
241} 236}
242 237
@@ -279,13 +274,13 @@ static inline void __alchemy_gpio2_mod_dir(int gpio, int to_out)
279{ 274{
280 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 275 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
281 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO2_BASE); 276 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO2_BASE);
282 unsigned long d = __raw_readl(base + GPIO2_DIR); 277 unsigned long d = __raw_readl(base + AU1000_GPIO2_DIR);
283 278
284 if (to_out) 279 if (to_out)
285 d |= mask; 280 d |= mask;
286 else 281 else
287 d &= ~mask; 282 d &= ~mask;
288 __raw_writel(d, base + GPIO2_DIR); 283 __raw_writel(d, base + AU1000_GPIO2_DIR);
289 wmb(); 284 wmb();
290} 285}
291 286
@@ -294,14 +289,15 @@ static inline void alchemy_gpio2_set_value(int gpio, int v)
294 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 289 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
295 unsigned long mask; 290 unsigned long mask;
296 mask = ((v) ? 0x00010001 : 0x00010000) << (gpio - ALCHEMY_GPIO2_BASE); 291 mask = ((v) ? 0x00010001 : 0x00010000) << (gpio - ALCHEMY_GPIO2_BASE);
297 __raw_writel(mask, base + GPIO2_OUTPUT); 292 __raw_writel(mask, base + AU1000_GPIO2_OUTPUT);
298 wmb(); 293 wmb();
299} 294}
300 295
301static inline int alchemy_gpio2_get_value(int gpio) 296static inline int alchemy_gpio2_get_value(int gpio)
302{ 297{
303 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 298 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
304 return __raw_readl(base + GPIO2_PINSTATE) & (1 << (gpio - ALCHEMY_GPIO2_BASE)); 299 return __raw_readl(base + AU1000_GPIO2_PINSTATE) &
300 (1 << (gpio - ALCHEMY_GPIO2_BASE));
305} 301}
306 302
307static inline int alchemy_gpio2_direction_input(int gpio) 303static inline int alchemy_gpio2_direction_input(int gpio)
@@ -352,12 +348,12 @@ static inline int alchemy_gpio2_to_irq(int gpio)
352static inline void __alchemy_gpio2_mod_int(int gpio2, int en) 348static inline void __alchemy_gpio2_mod_int(int gpio2, int en)
353{ 349{
354 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 350 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
355 unsigned long r = __raw_readl(base + GPIO2_INTENABLE); 351 unsigned long r = __raw_readl(base + AU1000_GPIO2_INTENABLE);
356 if (en) 352 if (en)
357 r |= 1 << gpio2; 353 r |= 1 << gpio2;
358 else 354 else
359 r &= ~(1 << gpio2); 355 r &= ~(1 << gpio2);
360 __raw_writel(r, base + GPIO2_INTENABLE); 356 __raw_writel(r, base + AU1000_GPIO2_INTENABLE);
361 wmb(); 357 wmb();
362} 358}
363 359
@@ -434,9 +430,9 @@ static inline void alchemy_gpio2_disable_int(int gpio2)
434static inline void alchemy_gpio2_enable(void) 430static inline void alchemy_gpio2_enable(void)
435{ 431{
436 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 432 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
437 __raw_writel(3, base + GPIO2_ENABLE); /* reset, clock enabled */ 433 __raw_writel(3, base + AU1000_GPIO2_ENABLE); /* reset, clock enabled */
438 wmb(); 434 wmb();
439 __raw_writel(1, base + GPIO2_ENABLE); /* clock enabled */ 435 __raw_writel(1, base + AU1000_GPIO2_ENABLE); /* clock enabled */
440 wmb(); 436 wmb();
441} 437}
442 438
@@ -448,7 +444,7 @@ static inline void alchemy_gpio2_enable(void)
448static inline void alchemy_gpio2_disable(void) 444static inline void alchemy_gpio2_disable(void)
449{ 445{
450 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR); 446 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
451 __raw_writel(2, base + GPIO2_ENABLE); /* reset, clock disabled */ 447 __raw_writel(2, base + AU1000_GPIO2_ENABLE); /* reset, clock disabled */
452 wmb(); 448 wmb();
453} 449}
454 450
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
index bba7399a49a3..1f5643b89a91 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -18,6 +18,7 @@ enum bcm47xx_board {
18 BCM47XX_BOARD_ASUS_WL300G, 18 BCM47XX_BOARD_ASUS_WL300G,
19 BCM47XX_BOARD_ASUS_WL320GE, 19 BCM47XX_BOARD_ASUS_WL320GE,
20 BCM47XX_BOARD_ASUS_WL330GE, 20 BCM47XX_BOARD_ASUS_WL330GE,
21 BCM47XX_BOARD_ASUS_WL500G,
21 BCM47XX_BOARD_ASUS_WL500GD, 22 BCM47XX_BOARD_ASUS_WL500GD,
22 BCM47XX_BOARD_ASUS_WL500GPV1, 23 BCM47XX_BOARD_ASUS_WL500GPV1,
23 BCM47XX_BOARD_ASUS_WL500GPV2, 24 BCM47XX_BOARD_ASUS_WL500GPV2,
@@ -70,11 +71,15 @@ enum bcm47xx_board {
70 BCM47XX_BOARD_LINKSYS_WRT310NV1, 71 BCM47XX_BOARD_LINKSYS_WRT310NV1,
71 BCM47XX_BOARD_LINKSYS_WRT310NV2, 72 BCM47XX_BOARD_LINKSYS_WRT310NV2,
72 BCM47XX_BOARD_LINKSYS_WRT54G3GV2, 73 BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
73 BCM47XX_BOARD_LINKSYS_WRT54G, 74 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101,
75 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467,
76 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708,
74 BCM47XX_BOARD_LINKSYS_WRT610NV1, 77 BCM47XX_BOARD_LINKSYS_WRT610NV1,
75 BCM47XX_BOARD_LINKSYS_WRT610NV2, 78 BCM47XX_BOARD_LINKSYS_WRT610NV2,
76 BCM47XX_BOARD_LINKSYS_WRTSL54GS, 79 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
77 80
81 BCM47XX_BOARD_MICROSOFT_MN700,
82
78 BCM47XX_BOARD_MOTOROLA_WE800G, 83 BCM47XX_BOARD_MOTOROLA_WE800G,
79 BCM47XX_BOARD_MOTOROLA_WR850GP, 84 BCM47XX_BOARD_MOTOROLA_WR850GP,
80 BCM47XX_BOARD_MOTOROLA_WR850GV2V3, 85 BCM47XX_BOARD_MOTOROLA_WR850GV2V3,
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
index 3112f08f0c72..56bb19219d48 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -19,118 +19,68 @@
19#define BCM6368_CPU_ID 0x6368 19#define BCM6368_CPU_ID 0x6368
20 20
21void __init bcm63xx_cpu_init(void); 21void __init bcm63xx_cpu_init(void);
22u16 __bcm63xx_get_cpu_id(void);
23u8 bcm63xx_get_cpu_rev(void); 22u8 bcm63xx_get_cpu_rev(void);
24unsigned int bcm63xx_get_cpu_freq(void); 23unsigned int bcm63xx_get_cpu_freq(void);
25 24
25static inline u16 __pure __bcm63xx_get_cpu_id(const u16 cpu_id)
26{
27 switch (cpu_id) {
26#ifdef CONFIG_BCM63XX_CPU_3368 28#ifdef CONFIG_BCM63XX_CPU_3368
27# ifdef bcm63xx_get_cpu_id 29 case BCM3368_CPU_ID:
28# undef bcm63xx_get_cpu_id
29# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
30# define BCMCPU_RUNTIME_DETECT
31# else
32# define bcm63xx_get_cpu_id() BCM3368_CPU_ID
33# endif
34# define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID)
35#else
36# define BCMCPU_IS_3368() (0)
37#endif 30#endif
38 31
39#ifdef CONFIG_BCM63XX_CPU_6328 32#ifdef CONFIG_BCM63XX_CPU_6328
40# ifdef bcm63xx_get_cpu_id 33 case BCM6328_CPU_ID:
41# undef bcm63xx_get_cpu_id
42# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
43# define BCMCPU_RUNTIME_DETECT
44# else
45# define bcm63xx_get_cpu_id() BCM6328_CPU_ID
46# endif
47# define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID)
48#else
49# define BCMCPU_IS_6328() (0)
50#endif 34#endif
51 35
52#ifdef CONFIG_BCM63XX_CPU_6338 36#ifdef CONFIG_BCM63XX_CPU_6338
53# ifdef bcm63xx_get_cpu_id 37 case BCM6338_CPU_ID:
54# undef bcm63xx_get_cpu_id
55# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
56# define BCMCPU_RUNTIME_DETECT
57# else
58# define bcm63xx_get_cpu_id() BCM6338_CPU_ID
59# endif
60# define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
61#else
62# define BCMCPU_IS_6338() (0)
63#endif 38#endif
64 39
65#ifdef CONFIG_BCM63XX_CPU_6345 40#ifdef CONFIG_BCM63XX_CPU_6345
66# ifdef bcm63xx_get_cpu_id 41 case BCM6345_CPU_ID:
67# undef bcm63xx_get_cpu_id
68# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
69# define BCMCPU_RUNTIME_DETECT
70# else
71# define bcm63xx_get_cpu_id() BCM6345_CPU_ID
72# endif
73# define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID)
74#else
75# define BCMCPU_IS_6345() (0)
76#endif 42#endif
77 43
78#ifdef CONFIG_BCM63XX_CPU_6348 44#ifdef CONFIG_BCM63XX_CPU_6348
79# ifdef bcm63xx_get_cpu_id 45 case BCM6348_CPU_ID:
80# undef bcm63xx_get_cpu_id
81# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
82# define BCMCPU_RUNTIME_DETECT
83# else
84# define bcm63xx_get_cpu_id() BCM6348_CPU_ID
85# endif
86# define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
87#else
88# define BCMCPU_IS_6348() (0)
89#endif 46#endif
90 47
91#ifdef CONFIG_BCM63XX_CPU_6358 48#ifdef CONFIG_BCM63XX_CPU_6358
92# ifdef bcm63xx_get_cpu_id 49 case BCM6358_CPU_ID:
93# undef bcm63xx_get_cpu_id
94# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
95# define BCMCPU_RUNTIME_DETECT
96# else
97# define bcm63xx_get_cpu_id() BCM6358_CPU_ID
98# endif
99# define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
100#else
101# define BCMCPU_IS_6358() (0)
102#endif 50#endif
103 51
104#ifdef CONFIG_BCM63XX_CPU_6362 52#ifdef CONFIG_BCM63XX_CPU_6362
105# ifdef bcm63xx_get_cpu_id 53 case BCM6362_CPU_ID:
106# undef bcm63xx_get_cpu_id
107# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
108# define BCMCPU_RUNTIME_DETECT
109# else
110# define bcm63xx_get_cpu_id() BCM6362_CPU_ID
111# endif
112# define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID)
113#else
114# define BCMCPU_IS_6362() (0)
115#endif 54#endif
116 55
117
118#ifdef CONFIG_BCM63XX_CPU_6368 56#ifdef CONFIG_BCM63XX_CPU_6368
119# ifdef bcm63xx_get_cpu_id 57 case BCM6368_CPU_ID:
120# undef bcm63xx_get_cpu_id
121# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
122# define BCMCPU_RUNTIME_DETECT
123# else
124# define bcm63xx_get_cpu_id() BCM6368_CPU_ID
125# endif
126# define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID)
127#else
128# define BCMCPU_IS_6368() (0)
129#endif 58#endif
59 break;
60 default:
61 unreachable();
62 }
130 63
131#ifndef bcm63xx_get_cpu_id 64 return cpu_id;
132#error "No CPU support configured" 65}
133#endif 66
67extern u16 bcm63xx_cpu_id;
68
69static inline u16 __pure bcm63xx_get_cpu_id(void)
70{
71 const u16 cpu_id = bcm63xx_cpu_id;
72
73 return __bcm63xx_get_cpu_id(cpu_id);
74}
75
76#define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID)
77#define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID)
78#define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
79#define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID)
80#define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
81#define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
82#define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID)
83#define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID)
134 84
135/* 85/*
136 * While registers sets are (mostly) the same across 63xx CPU, base 86 * While registers sets are (mostly) the same across 63xx CPU, base
@@ -598,55 +548,6 @@ enum bcm63xx_regs_set {
598 548
599extern const unsigned long *bcm63xx_regs_base; 549extern const unsigned long *bcm63xx_regs_base;
600 550
601#define __GEN_RSET_BASE(__cpu, __rset) \
602 case RSET_## __rset : \
603 return BCM_## __cpu ##_## __rset ##_BASE;
604
605#define __GEN_RSET(__cpu) \
606 switch (set) { \
607 __GEN_RSET_BASE(__cpu, DSL_LMEM) \
608 __GEN_RSET_BASE(__cpu, PERF) \
609 __GEN_RSET_BASE(__cpu, TIMER) \
610 __GEN_RSET_BASE(__cpu, WDT) \
611 __GEN_RSET_BASE(__cpu, UART0) \
612 __GEN_RSET_BASE(__cpu, UART1) \
613 __GEN_RSET_BASE(__cpu, GPIO) \
614 __GEN_RSET_BASE(__cpu, SPI) \
615 __GEN_RSET_BASE(__cpu, HSSPI) \
616 __GEN_RSET_BASE(__cpu, UDC0) \
617 __GEN_RSET_BASE(__cpu, OHCI0) \
618 __GEN_RSET_BASE(__cpu, OHCI_PRIV) \
619 __GEN_RSET_BASE(__cpu, USBH_PRIV) \
620 __GEN_RSET_BASE(__cpu, USBD) \
621 __GEN_RSET_BASE(__cpu, USBDMA) \
622 __GEN_RSET_BASE(__cpu, MPI) \
623 __GEN_RSET_BASE(__cpu, PCMCIA) \
624 __GEN_RSET_BASE(__cpu, PCIE) \
625 __GEN_RSET_BASE(__cpu, DSL) \
626 __GEN_RSET_BASE(__cpu, ENET0) \
627 __GEN_RSET_BASE(__cpu, ENET1) \
628 __GEN_RSET_BASE(__cpu, ENETDMA) \
629 __GEN_RSET_BASE(__cpu, ENETDMAC) \
630 __GEN_RSET_BASE(__cpu, ENETDMAS) \
631 __GEN_RSET_BASE(__cpu, ENETSW) \
632 __GEN_RSET_BASE(__cpu, EHCI0) \
633 __GEN_RSET_BASE(__cpu, SDRAM) \
634 __GEN_RSET_BASE(__cpu, MEMC) \
635 __GEN_RSET_BASE(__cpu, DDR) \
636 __GEN_RSET_BASE(__cpu, M2M) \
637 __GEN_RSET_BASE(__cpu, ATM) \
638 __GEN_RSET_BASE(__cpu, XTM) \
639 __GEN_RSET_BASE(__cpu, XTMDMA) \
640 __GEN_RSET_BASE(__cpu, XTMDMAC) \
641 __GEN_RSET_BASE(__cpu, XTMDMAS) \
642 __GEN_RSET_BASE(__cpu, PCM) \
643 __GEN_RSET_BASE(__cpu, PCMDMA) \
644 __GEN_RSET_BASE(__cpu, PCMDMAC) \
645 __GEN_RSET_BASE(__cpu, PCMDMAS) \
646 __GEN_RSET_BASE(__cpu, RNG) \
647 __GEN_RSET_BASE(__cpu, MISC) \
648 }
649
650#define __GEN_CPU_REGS_TABLE(__cpu) \ 551#define __GEN_CPU_REGS_TABLE(__cpu) \
651 [RSET_DSL_LMEM] = BCM_## __cpu ##_DSL_LMEM_BASE, \ 552 [RSET_DSL_LMEM] = BCM_## __cpu ##_DSL_LMEM_BASE, \
652 [RSET_PERF] = BCM_## __cpu ##_PERF_BASE, \ 553 [RSET_PERF] = BCM_## __cpu ##_PERF_BASE, \
@@ -693,36 +594,7 @@ extern const unsigned long *bcm63xx_regs_base;
693 594
694static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) 595static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set)
695{ 596{
696#ifdef BCMCPU_RUNTIME_DETECT
697 return bcm63xx_regs_base[set]; 597 return bcm63xx_regs_base[set];
698#else
699#ifdef CONFIG_BCM63XX_CPU_3368
700 __GEN_RSET(3368)
701#endif
702#ifdef CONFIG_BCM63XX_CPU_6328
703 __GEN_RSET(6328)
704#endif
705#ifdef CONFIG_BCM63XX_CPU_6338
706 __GEN_RSET(6338)
707#endif
708#ifdef CONFIG_BCM63XX_CPU_6345
709 __GEN_RSET(6345)
710#endif
711#ifdef CONFIG_BCM63XX_CPU_6348
712 __GEN_RSET(6348)
713#endif
714#ifdef CONFIG_BCM63XX_CPU_6358
715 __GEN_RSET(6358)
716#endif
717#ifdef CONFIG_BCM63XX_CPU_6362
718 __GEN_RSET(6362)
719#endif
720#ifdef CONFIG_BCM63XX_CPU_6368
721 __GEN_RSET(6368)
722#endif
723#endif
724 /* unreached */
725 return 0;
726} 598}
727 599
728/* 600/*
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
index 753953e86242..466fc85899f4 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -112,55 +112,9 @@ enum bcm63xx_regs_enetdmac {
112 112
113static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg) 113static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
114{ 114{
115#ifdef BCMCPU_RUNTIME_DETECT
116 extern const unsigned long *bcm63xx_regs_enetdmac; 115 extern const unsigned long *bcm63xx_regs_enetdmac;
117 116
118 return bcm63xx_regs_enetdmac[reg]; 117 return bcm63xx_regs_enetdmac[reg];
119#else
120#ifdef CONFIG_BCM63XX_CPU_6345
121 switch (reg) {
122 case ENETDMAC_CHANCFG:
123 return ENETDMA_6345_CHANCFG_REG;
124 case ENETDMAC_IR:
125 return ENETDMA_6345_IR_REG;
126 case ENETDMAC_IRMASK:
127 return ENETDMA_6345_IRMASK_REG;
128 case ENETDMAC_MAXBURST:
129 return ENETDMA_6345_MAXBURST_REG;
130 case ENETDMAC_BUFALLOC:
131 return ENETDMA_6345_BUFALLOC_REG;
132 case ENETDMAC_RSTART:
133 return ENETDMA_6345_RSTART_REG;
134 case ENETDMAC_FC:
135 return ENETDMA_6345_FC_REG;
136 case ENETDMAC_LEN:
137 return ENETDMA_6345_LEN_REG;
138 }
139#endif
140#if defined(CONFIG_BCM63XX_CPU_6328) || \
141 defined(CONFIG_BCM63XX_CPU_6338) || \
142 defined(CONFIG_BCM63XX_CPU_6348) || \
143 defined(CONFIG_BCM63XX_CPU_6358) || \
144 defined(CONFIG_BCM63XX_CPU_6362) || \
145 defined(CONFIG_BCM63XX_CPU_6368)
146 switch (reg) {
147 case ENETDMAC_CHANCFG:
148 return ENETDMAC_CHANCFG_REG;
149 case ENETDMAC_IR:
150 return ENETDMAC_IR_REG;
151 case ENETDMAC_IRMASK:
152 return ENETDMAC_IRMASK_REG;
153 case ENETDMAC_MAXBURST:
154 return ENETDMAC_MAXBURST_REG;
155 case ENETDMAC_BUFALLOC:
156 case ENETDMAC_RSTART:
157 case ENETDMAC_FC:
158 case ENETDMAC_LEN:
159 return 0;
160 }
161#endif
162#endif
163 return 0;
164} 118}
165 119
166 120
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
index c426cabc620a..25737655d141 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
@@ -30,26 +30,6 @@ enum bcm63xx_regs_spi {
30 SPI_RX_DATA, 30 SPI_RX_DATA,
31}; 31};
32 32
33#define __GEN_SPI_RSET_BASE(__cpu, __rset) \
34 case SPI_## __rset: \
35 return SPI_## __cpu ##_## __rset;
36
37#define __GEN_SPI_RSET(__cpu) \
38 switch (reg) { \
39 __GEN_SPI_RSET_BASE(__cpu, CMD) \
40 __GEN_SPI_RSET_BASE(__cpu, INT_STATUS) \
41 __GEN_SPI_RSET_BASE(__cpu, INT_MASK_ST) \
42 __GEN_SPI_RSET_BASE(__cpu, INT_MASK) \
43 __GEN_SPI_RSET_BASE(__cpu, ST) \
44 __GEN_SPI_RSET_BASE(__cpu, CLK_CFG) \
45 __GEN_SPI_RSET_BASE(__cpu, FILL_BYTE) \
46 __GEN_SPI_RSET_BASE(__cpu, MSG_TAIL) \
47 __GEN_SPI_RSET_BASE(__cpu, RX_TAIL) \
48 __GEN_SPI_RSET_BASE(__cpu, MSG_CTL) \
49 __GEN_SPI_RSET_BASE(__cpu, MSG_DATA) \
50 __GEN_SPI_RSET_BASE(__cpu, RX_DATA) \
51 }
52
53#define __GEN_SPI_REGS_TABLE(__cpu) \ 33#define __GEN_SPI_REGS_TABLE(__cpu) \
54 [SPI_CMD] = SPI_## __cpu ##_CMD, \ 34 [SPI_CMD] = SPI_## __cpu ##_CMD, \
55 [SPI_INT_STATUS] = SPI_## __cpu ##_INT_STATUS, \ 35 [SPI_INT_STATUS] = SPI_## __cpu ##_INT_STATUS, \
@@ -66,20 +46,9 @@ enum bcm63xx_regs_spi {
66 46
67static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg) 47static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg)
68{ 48{
69#ifdef BCMCPU_RUNTIME_DETECT
70 extern const unsigned long *bcm63xx_regs_spi; 49 extern const unsigned long *bcm63xx_regs_spi;
71 50
72 return bcm63xx_regs_spi[reg]; 51 return bcm63xx_regs_spi[reg];
73#else
74#if defined(CONFIG_BCM63XX_CPU_6338) || defined(CONFIG_BCM63XX_CPU_6348)
75 __GEN_SPI_RSET(6348)
76#endif
77#if defined(CONFIG_BCM63XX_CPU_6358) || defined(CONFIG_BCM63XX_CPU_6362) || \
78 defined(CONFIG_BCM63XX_CPU_6368)
79 __GEN_SPI_RSET(6358)
80#endif
81#endif
82 return 0;
83} 52}
84 53
85#endif /* BCM63XX_DEV_SPI_H */ 54#endif /* BCM63XX_DEV_SPI_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index ab427f8814e6..4794067cb5a7 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -215,23 +215,23 @@
215 215
216/* Interrupt Mask register */ 216/* Interrupt Mask register */
217#define PERF_IRQMASK_3368_REG 0xc 217#define PERF_IRQMASK_3368_REG 0xc
218#define PERF_IRQMASK_6328_REG 0x20 218#define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10)
219#define PERF_IRQMASK_6338_REG 0xc 219#define PERF_IRQMASK_6338_REG 0xc
220#define PERF_IRQMASK_6345_REG 0xc 220#define PERF_IRQMASK_6345_REG 0xc
221#define PERF_IRQMASK_6348_REG 0xc 221#define PERF_IRQMASK_6348_REG 0xc
222#define PERF_IRQMASK_6358_REG 0xc 222#define PERF_IRQMASK_6358_REG(x) (0xc + (x) * 0x2c)
223#define PERF_IRQMASK_6362_REG 0x20 223#define PERF_IRQMASK_6362_REG(x) (0x20 + (x) * 0x10)
224#define PERF_IRQMASK_6368_REG 0x20 224#define PERF_IRQMASK_6368_REG(x) (0x20 + (x) * 0x10)
225 225
226/* Interrupt Status register */ 226/* Interrupt Status register */
227#define PERF_IRQSTAT_3368_REG 0x10 227#define PERF_IRQSTAT_3368_REG 0x10
228#define PERF_IRQSTAT_6328_REG 0x28 228#define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10)
229#define PERF_IRQSTAT_6338_REG 0x10 229#define PERF_IRQSTAT_6338_REG 0x10
230#define PERF_IRQSTAT_6345_REG 0x10 230#define PERF_IRQSTAT_6345_REG 0x10
231#define PERF_IRQSTAT_6348_REG 0x10 231#define PERF_IRQSTAT_6348_REG 0x10
232#define PERF_IRQSTAT_6358_REG 0x10 232#define PERF_IRQSTAT_6358_REG(x) (0x10 + (x) * 0x2c)
233#define PERF_IRQSTAT_6362_REG 0x28 233#define PERF_IRQSTAT_6362_REG(x) (0x28 + (x) * 0x10)
234#define PERF_IRQSTAT_6368_REG 0x28 234#define PERF_IRQSTAT_6368_REG(x) (0x28 + (x) * 0x10)
235 235
236/* External Interrupt Configuration register */ 236/* External Interrupt Configuration register */
237#define PERF_EXTIRQ_CFG_REG_3368 0x14 237#define PERF_EXTIRQ_CFG_REG_3368 0x14
diff --git a/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h
index e9c408e8ff4c..bc1167dbd4e3 100644
--- a/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h
@@ -24,7 +24,7 @@
24#define cpu_has_smartmips 0 24#define cpu_has_smartmips 0
25#define cpu_has_vtag_icache 0 25#define cpu_has_vtag_icache 0
26 26
27#if !defined(BCMCPU_RUNTIME_DETECT) && (defined(CONFIG_BCM63XX_CPU_6348) || defined(CONFIG_BCM63XX_CPU_6345) || defined(CONFIG_BCM63XX_CPU_6338)) 27#if !defined(CONFIG_SYS_HAS_CPU_BMIPS4350)
28#define cpu_has_dc_aliases 0 28#define cpu_has_dc_aliases 0
29#endif 29#endif
30 30
diff --git a/arch/mips/include/asm/mach-loongson/boot_param.h b/arch/mips/include/asm/mach-loongson/boot_param.h
index 829a7ec185fb..3388fc53599e 100644
--- a/arch/mips/include/asm/mach-loongson/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson/boot_param.h
@@ -146,6 +146,9 @@ struct boot_params {
146 146
147struct loongson_system_configuration { 147struct loongson_system_configuration {
148 u32 nr_cpus; 148 u32 nr_cpus;
149 u32 nr_nodes;
150 int cores_per_node;
151 int cores_per_package;
149 enum loongson_cpu_type cputype; 152 enum loongson_cpu_type cputype;
150 u64 ht_control_base; 153 u64 ht_control_base;
151 u64 pci_mem_start_addr; 154 u64 pci_mem_start_addr;
@@ -160,4 +163,5 @@ struct loongson_system_configuration {
160 163
161extern struct efi_memory_map_loongson *loongson_memmap; 164extern struct efi_memory_map_loongson *loongson_memmap;
162extern struct loongson_system_configuration loongson_sysconf; 165extern struct loongson_system_configuration loongson_sysconf;
166extern int cpuhotplug_workaround;
163#endif 167#endif
diff --git a/arch/mips/include/asm/mach-loongson/kernel-entry-init.h b/arch/mips/include/asm/mach-loongson/kernel-entry-init.h
new file mode 100644
index 000000000000..df5fca8eeb80
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/kernel-entry-init.h
@@ -0,0 +1,52 @@
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) 2005 Embedded Alley Solutions, Inc
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn)
9 * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com)
10 */
11#ifndef __ASM_MACH_LOONGSON_KERNEL_ENTRY_H
12#define __ASM_MACH_LOONGSON_KERNEL_ENTRY_H
13
14/*
15 * Override macros used in arch/mips/kernel/head.S.
16 */
17 .macro kernel_entry_setup
18#ifdef CONFIG_CPU_LOONGSON3
19 .set push
20 .set mips64
21 /* Set LPA on LOONGSON3 config3 */
22 mfc0 t0, $16, 3
23 or t0, (0x1 << 7)
24 mtc0 t0, $16, 3
25 /* Set ELPA on LOONGSON3 pagegrain */
26 li t0, (0x1 << 29)
27 mtc0 t0, $5, 1
28 _ehb
29 .set pop
30#endif
31 .endm
32
33/*
34 * Do SMP slave processor setup.
35 */
36 .macro smp_slave_setup
37#ifdef CONFIG_CPU_LOONGSON3
38 .set push
39 .set mips64
40 /* Set LPA on LOONGSON3 config3 */
41 mfc0 t0, $16, 3
42 or t0, (0x1 << 7)
43 mtc0 t0, $16, 3
44 /* Set ELPA on LOONGSON3 pagegrain */
45 li t0, (0x1 << 29)
46 mtc0 t0, $5, 1
47 _ehb
48 .set pop
49#endif
50 .endm
51
52#endif /* __ASM_MACH_LOONGSON_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index f3fd1eb8e3dd..92bf76c21441 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -249,8 +249,15 @@ static inline void do_perfcnt_IRQ(void)
249#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68) 249#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68)
250#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c) 250#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c)
251 251
252/* Chip Config */ 252#define MAX_PACKAGES 4
253#define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80) 253
254/* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */
255extern u64 loongson_chipcfg[MAX_PACKAGES];
256#define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id]))
257
258/* Freq Control register of each physical cpu package, PRid >= Loongson-3B */
259extern u64 loongson_freqctrl[MAX_PACKAGES];
260#define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id]))
254 261
255/* pcimap */ 262/* pcimap */
256 263
diff --git a/arch/mips/include/asm/mach-loongson/machine.h b/arch/mips/include/asm/mach-loongson/machine.h
index 1b1f592fa2be..228e37847a36 100644
--- a/arch/mips/include/asm/mach-loongson/machine.h
+++ b/arch/mips/include/asm/mach-loongson/machine.h
@@ -24,10 +24,10 @@
24 24
25#endif 25#endif
26 26
27#ifdef CONFIG_LEMOTE_MACH3A 27#ifdef CONFIG_LOONGSON_MACH3X
28 28
29#define LOONGSON_MACHTYPE MACH_LEMOTE_A1101 29#define LOONGSON_MACHTYPE MACH_LEMOTE_A1101
30 30
31#endif /* CONFIG_LEMOTE_MACH3A */ 31#endif /* CONFIG_LOONGSON_MACH3X */
32 32
33#endif /* __ASM_MACH_LOONGSON_MACHINE_H */ 33#endif /* __ASM_MACH_LOONGSON_MACHINE_H */
diff --git a/arch/mips/include/asm/mach-loongson/mmzone.h b/arch/mips/include/asm/mach-loongson/mmzone.h
new file mode 100644
index 000000000000..37c08a27b4f0
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/mmzone.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
3 * Insititute of Computing Technology
4 * Author: Xiang Gao, gaoxiang@ict.ac.cn
5 * Huacai Chen, chenhc@lemote.com
6 * Xiaofu Meng, Shuangshuang Zhang
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#ifndef _ASM_MACH_MMZONE_H
14#define _ASM_MACH_MMZONE_H
15
16#include <boot_param.h>
17#define NODE_ADDRSPACE_SHIFT 44
18#define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
19#define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
20#define NODE2_ADDRSPACE_OFFSET 0x200000000000UL
21#define NODE3_ADDRSPACE_OFFSET 0x300000000000UL
22
23#define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
24
25#define LEVELS_PER_SLICE 128
26
27struct slice_data {
28 unsigned long irq_enable_mask[2];
29 int level_to_irq[LEVELS_PER_SLICE];
30};
31
32struct hub_data {
33 cpumask_t h_cpus;
34 unsigned long slice_map;
35 unsigned long irq_alloc_mask[2];
36 struct slice_data slice[2];
37};
38
39struct node_data {
40 struct pglist_data pglist;
41 struct hub_data hub;
42 cpumask_t cpumask;
43};
44
45extern struct node_data *__node_data[];
46
47#define NODE_DATA(n) (&__node_data[(n)]->pglist)
48#define hub_data(n) (&__node_data[(n)]->hub)
49
50extern void setup_zero_pages(void);
51extern void __init prom_init_numa_memory(void);
52
53#endif /* _ASM_MACH_MMZONE_H */
diff --git a/arch/mips/include/asm/mach-loongson/topology.h b/arch/mips/include/asm/mach-loongson/topology.h
new file mode 100644
index 000000000000..5598ba77d2ef
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/topology.h
@@ -0,0 +1,23 @@
1#ifndef _ASM_MACH_TOPOLOGY_H
2#define _ASM_MACH_TOPOLOGY_H
3
4#ifdef CONFIG_NUMA
5
6#define cpu_to_node(cpu) ((cpu) >> 2)
7#define parent_node(node) (node)
8#define cpumask_of_node(node) (&__node_data[(node)]->cpumask)
9
10struct pci_bus;
11extern int pcibus_to_node(struct pci_bus *);
12
13#define cpumask_of_pcibus(bus) (cpu_online_mask)
14
15extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
16
17#define node_distance(from, to) (__node_distances[(from)][(to)])
18
19#endif
20
21#include <asm-generic/topology.h>
22
23#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/mach-malta/irq.h b/arch/mips/include/asm/mach-malta/irq.h
index 47cfe64efbb0..f2c13d211abb 100644
--- a/arch/mips/include/asm/mach-malta/irq.h
+++ b/arch/mips/include/asm/mach-malta/irq.h
@@ -2,6 +2,7 @@
2#define __ASM_MACH_MIPS_IRQ_H 2#define __ASM_MACH_MIPS_IRQ_H
3 3
4 4
5#define GIC_NUM_INTRS (24 + NR_CPUS * 2)
5#define NR_IRQS 256 6#define NR_IRQS 256
6 7
7#include_next <irq.h> 8#include_next <irq.h>
diff --git a/arch/mips/include/asm/mach-sead3/irq.h b/arch/mips/include/asm/mach-sead3/irq.h
index 5d154cfbcf4c..d8106f75b9af 100644
--- a/arch/mips/include/asm/mach-sead3/irq.h
+++ b/arch/mips/include/asm/mach-sead3/irq.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_MACH_MIPS_IRQ_H 1#ifndef __ASM_MACH_MIPS_IRQ_H
2#define __ASM_MACH_MIPS_IRQ_H 2#define __ASM_MACH_MIPS_IRQ_H
3 3
4#define GIC_NUM_INTRS (24 + NR_CPUS * 2)
4#define NR_IRQS 256 5#define NR_IRQS 256
5 6
6 7
diff --git a/arch/mips/include/asm/mips-boards/bonito64.h b/arch/mips/include/asm/mips-boards/bonito64.h
index b2048d1bcc1c..5368891d424b 100644
--- a/arch/mips/include/asm/mips-boards/bonito64.h
+++ b/arch/mips/include/asm/mips-boards/bonito64.h
@@ -414,7 +414,6 @@ extern unsigned long _pcictrl_bonito_pcicfg;
414 414
415 415
416#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT) 416#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
417#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
418#define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT) 417#define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
419 418
420#define BONITO_PCITOPHYS(WIN, ADDR, CFG) ( \ 419#define BONITO_PCITOPHYS(WIN, ADDR, CFG) ( \
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 98e9754a4b6b..cf3b580c3df6 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -265,6 +265,7 @@
265#define PG_XIE (_ULCAST_(1) << 30) 265#define PG_XIE (_ULCAST_(1) << 30)
266#define PG_ELPA (_ULCAST_(1) << 29) 266#define PG_ELPA (_ULCAST_(1) << 29)
267#define PG_ESP (_ULCAST_(1) << 28) 267#define PG_ESP (_ULCAST_(1) << 28)
268#define PG_IEC (_ULCAST_(1) << 27)
268 269
269/* 270/*
270 * R4x00 interrupt enable / cause bits 271 * R4x00 interrupt enable / cause bits
@@ -630,7 +631,6 @@
630#define MIPS_CONF4_MMUSIZEEXT_SHIFT (0) 631#define MIPS_CONF4_MMUSIZEEXT_SHIFT (0)
631#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0) 632#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0)
632#define MIPS_CONF4_FTLBSETS_SHIFT (0) 633#define MIPS_CONF4_FTLBSETS_SHIFT (0)
633#define MIPS_CONF4_FTLBSETS_SHIFT (0)
634#define MIPS_CONF4_FTLBSETS (_ULCAST_(15) << MIPS_CONF4_FTLBSETS_SHIFT) 634#define MIPS_CONF4_FTLBSETS (_ULCAST_(15) << MIPS_CONF4_FTLBSETS_SHIFT)
635#define MIPS_CONF4_FTLBWAYS_SHIFT (4) 635#define MIPS_CONF4_FTLBWAYS_SHIFT (4)
636#define MIPS_CONF4_FTLBWAYS (_ULCAST_(15) << MIPS_CONF4_FTLBWAYS_SHIFT) 636#define MIPS_CONF4_FTLBWAYS (_ULCAST_(15) << MIPS_CONF4_FTLBWAYS_SHIFT)
@@ -652,6 +652,7 @@
652 652
653#define MIPS_CONF5_NF (_ULCAST_(1) << 0) 653#define MIPS_CONF5_NF (_ULCAST_(1) << 0)
654#define MIPS_CONF5_UFR (_ULCAST_(1) << 2) 654#define MIPS_CONF5_UFR (_ULCAST_(1) << 2)
655#define MIPS_CONF5_MRP (_ULCAST_(1) << 3)
655#define MIPS_CONF5_MSAEN (_ULCAST_(1) << 27) 656#define MIPS_CONF5_MSAEN (_ULCAST_(1) << 27)
656#define MIPS_CONF5_EVA (_ULCAST_(1) << 28) 657#define MIPS_CONF5_EVA (_ULCAST_(1) << 28)
657#define MIPS_CONF5_CV (_ULCAST_(1) << 29) 658#define MIPS_CONF5_CV (_ULCAST_(1) << 29)
@@ -668,6 +669,12 @@
668#define MIPS_CONF7_IAR (_ULCAST_(1) << 10) 669#define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
669#define MIPS_CONF7_AR (_ULCAST_(1) << 16) 670#define MIPS_CONF7_AR (_ULCAST_(1) << 16)
670 671
672/* MAAR bit definitions */
673#define MIPS_MAAR_ADDR ((BIT_ULL(BITS_PER_LONG - 12) - 1) << 12)
674#define MIPS_MAAR_ADDR_SHIFT 12
675#define MIPS_MAAR_S (_ULCAST_(1) << 1)
676#define MIPS_MAAR_V (_ULCAST_(1) << 0)
677
671/* EntryHI bit definition */ 678/* EntryHI bit definition */
672#define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10) 679#define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10)
673 680
@@ -706,6 +713,37 @@
706#define MIPS_SEGCFG_MK _ULCAST_(1) 713#define MIPS_SEGCFG_MK _ULCAST_(1)
707#define MIPS_SEGCFG_UK _ULCAST_(0) 714#define MIPS_SEGCFG_UK _ULCAST_(0)
708 715
716#define MIPS_PWFIELD_GDI_SHIFT 24
717#define MIPS_PWFIELD_GDI_MASK 0x3f000000
718#define MIPS_PWFIELD_UDI_SHIFT 18
719#define MIPS_PWFIELD_UDI_MASK 0x00fc0000
720#define MIPS_PWFIELD_MDI_SHIFT 12
721#define MIPS_PWFIELD_MDI_MASK 0x0003f000
722#define MIPS_PWFIELD_PTI_SHIFT 6
723#define MIPS_PWFIELD_PTI_MASK 0x00000fc0
724#define MIPS_PWFIELD_PTEI_SHIFT 0
725#define MIPS_PWFIELD_PTEI_MASK 0x0000003f
726
727#define MIPS_PWSIZE_GDW_SHIFT 24
728#define MIPS_PWSIZE_GDW_MASK 0x3f000000
729#define MIPS_PWSIZE_UDW_SHIFT 18
730#define MIPS_PWSIZE_UDW_MASK 0x00fc0000
731#define MIPS_PWSIZE_MDW_SHIFT 12
732#define MIPS_PWSIZE_MDW_MASK 0x0003f000
733#define MIPS_PWSIZE_PTW_SHIFT 6
734#define MIPS_PWSIZE_PTW_MASK 0x00000fc0
735#define MIPS_PWSIZE_PTEW_SHIFT 0
736#define MIPS_PWSIZE_PTEW_MASK 0x0000003f
737
738#define MIPS_PWCTL_PWEN_SHIFT 31
739#define MIPS_PWCTL_PWEN_MASK 0x80000000
740#define MIPS_PWCTL_DPH_SHIFT 7
741#define MIPS_PWCTL_DPH_MASK 0x00000080
742#define MIPS_PWCTL_HUGEPG_SHIFT 6
743#define MIPS_PWCTL_HUGEPG_MASK 0x00000060
744#define MIPS_PWCTL_PSN_SHIFT 0
745#define MIPS_PWCTL_PSN_MASK 0x0000003f
746
709#ifndef __ASSEMBLY__ 747#ifndef __ASSEMBLY__
710 748
711/* 749/*
@@ -1044,6 +1082,11 @@ do { \
1044#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val) 1082#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
1045#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val) 1083#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
1046 1084
1085#define read_c0_maar() __read_ulong_c0_register($17, 1)
1086#define write_c0_maar(val) __write_ulong_c0_register($17, 1, val)
1087#define read_c0_maari() __read_32bit_c0_register($17, 2)
1088#define write_c0_maari(val) __write_32bit_c0_register($17, 2, val)
1089
1047/* 1090/*
1048 * The WatchLo register. There may be up to 8 of them. 1091 * The WatchLo register. There may be up to 8 of them.
1049 */ 1092 */
@@ -1201,6 +1244,19 @@ do { \
1201#define read_c0_segctl2() __read_32bit_c0_register($5, 4) 1244#define read_c0_segctl2() __read_32bit_c0_register($5, 4)
1202#define write_c0_segctl2(val) __write_32bit_c0_register($5, 4, val) 1245#define write_c0_segctl2(val) __write_32bit_c0_register($5, 4, val)
1203 1246
1247/* Hardware Page Table Walker */
1248#define read_c0_pwbase() __read_ulong_c0_register($5, 5)
1249#define write_c0_pwbase(val) __write_ulong_c0_register($5, 5, val)
1250
1251#define read_c0_pwfield() __read_ulong_c0_register($5, 6)
1252#define write_c0_pwfield(val) __write_ulong_c0_register($5, 6, val)
1253
1254#define read_c0_pwsize() __read_ulong_c0_register($5, 7)
1255#define write_c0_pwsize(val) __write_ulong_c0_register($5, 7, val)
1256
1257#define read_c0_pwctl() __read_32bit_c0_register($6, 6)
1258#define write_c0_pwctl(val) __write_32bit_c0_register($6, 6, val)
1259
1204/* Cavium OCTEON (cnMIPS) */ 1260/* Cavium OCTEON (cnMIPS) */
1205#define read_c0_cvmcount() __read_ulong_c0_register($9, 6) 1261#define read_c0_cvmcount() __read_ulong_c0_register($9, 6)
1206#define write_c0_cvmcount(val) __write_ulong_c0_register($9, 6, val) 1262#define write_c0_cvmcount(val) __write_ulong_c0_register($9, 6, val)
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 2e373da5f8e9..2f82568a3ee4 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -20,10 +20,20 @@
20#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
21#include <asm-generic/mm_hooks.h> 21#include <asm-generic/mm_hooks.h>
22 22
23#define htw_set_pwbase(pgd) \
24do { \
25 if (cpu_has_htw) { \
26 write_c0_pwbase(pgd); \
27 back_to_back_c0_hazard(); \
28 htw_reset(); \
29 } \
30} while (0)
31
23#define TLBMISS_HANDLER_SETUP_PGD(pgd) \ 32#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
24do { \ 33do { \
25 extern void tlbmiss_handler_setup_pgd(unsigned long); \ 34 extern void tlbmiss_handler_setup_pgd(unsigned long); \
26 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \ 35 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \
36 htw_set_pwbase((unsigned long)pgd); \
27} while (0) 37} while (0)
28 38
29#ifdef CONFIG_MIPS_PGD_C0_CONTEXT 39#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h
index 538f6d482db8..af5638b12c75 100644
--- a/arch/mips/include/asm/msa.h
+++ b/arch/mips/include/asm/msa.h
@@ -12,8 +12,11 @@
12 12
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15#ifndef __ASSEMBLY__
16
15extern void _save_msa(struct task_struct *); 17extern void _save_msa(struct task_struct *);
16extern void _restore_msa(struct task_struct *); 18extern void _restore_msa(struct task_struct *);
19extern void _init_msa_upper(void);
17 20
18static inline void enable_msa(void) 21static inline void enable_msa(void)
19{ 22{
@@ -112,10 +115,10 @@ static inline unsigned int read_msa_##name(void) \
112 " .set push\n" \ 115 " .set push\n" \
113 " .set noat\n" \ 116 " .set noat\n" \
114 " .insn\n" \ 117 " .insn\n" \
115 " .word #CFC_MSA_INSN | (" #cs " << 11)\n" \ 118 " .word %1 | (" #cs " << 11)\n" \
116 " move %0, $1\n" \ 119 " move %0, $1\n" \
117 " .set pop\n" \ 120 " .set pop\n" \
118 : "=r"(reg)); \ 121 : "=r"(reg) : "i"(CFC_MSA_INSN)); \
119 return reg; \ 122 return reg; \
120} \ 123} \
121 \ 124 \
@@ -126,22 +129,13 @@ static inline void write_msa_##name(unsigned int val) \
126 " .set noat\n" \ 129 " .set noat\n" \
127 " move $1, %0\n" \ 130 " move $1, %0\n" \
128 " .insn\n" \ 131 " .insn\n" \
129 " .word #CTC_MSA_INSN | (" #cs " << 6)\n" \ 132 " .word %1 | (" #cs " << 6)\n" \
130 " .set pop\n" \ 133 " .set pop\n" \
131 : : "r"(val)); \ 134 : : "r"(val), "i"(CTC_MSA_INSN)); \
132} 135}
133 136
134#endif /* !TOOLCHAIN_SUPPORTS_MSA */ 137#endif /* !TOOLCHAIN_SUPPORTS_MSA */
135 138
136#define MSA_IR 0
137#define MSA_CSR 1
138#define MSA_ACCESS 2
139#define MSA_SAVE 3
140#define MSA_MODIFY 4
141#define MSA_REQUEST 5
142#define MSA_MAP 6
143#define MSA_UNMAP 7
144
145__BUILD_MSA_CTL_REG(ir, 0) 139__BUILD_MSA_CTL_REG(ir, 0)
146__BUILD_MSA_CTL_REG(csr, 1) 140__BUILD_MSA_CTL_REG(csr, 1)
147__BUILD_MSA_CTL_REG(access, 2) 141__BUILD_MSA_CTL_REG(access, 2)
@@ -151,6 +145,17 @@ __BUILD_MSA_CTL_REG(request, 5)
151__BUILD_MSA_CTL_REG(map, 6) 145__BUILD_MSA_CTL_REG(map, 6)
152__BUILD_MSA_CTL_REG(unmap, 7) 146__BUILD_MSA_CTL_REG(unmap, 7)
153 147
148#endif /* !__ASSEMBLY__ */
149
150#define MSA_IR 0
151#define MSA_CSR 1
152#define MSA_ACCESS 2
153#define MSA_SAVE 3
154#define MSA_MODIFY 4
155#define MSA_REQUEST 5
156#define MSA_MAP 6
157#define MSA_UNMAP 7
158
154/* MSA Implementation Register (MSAIR) */ 159/* MSA Implementation Register (MSAIR) */
155#define MSA_IR_REVB 0 160#define MSA_IR_REVB 0
156#define MSA_IR_REVF (_ULCAST_(0xff) << MSA_IR_REVB) 161#define MSA_IR_REVF (_ULCAST_(0xff) << MSA_IR_REVB)
diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
index 7b7818d1e4d5..2298199a287e 100644
--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
@@ -228,6 +228,7 @@ enum cvmx_board_types_enum {
228 */ 228 */
229 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, 229 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
230 CVMX_BOARD_TYPE_UBNT_E100 = 20002, 230 CVMX_BOARD_TYPE_UBNT_E100 = 20002,
231 CVMX_BOARD_TYPE_CUST_DSR1000N = 20006,
231 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000, 232 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
232 233
233 /* The remaining range is reserved for future use. */ 234 /* The remaining range is reserved for future use. */
@@ -327,6 +328,7 @@ static inline const char *cvmx_board_type_to_string(enum
327 /* Customer private range */ 328 /* Customer private range */
328 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) 329 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
329 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100) 330 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
331 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DSR1000N)
330 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) 332 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
331 } 333 }
332 return "Unsupported Board"; 334 return "Unsupported Board";
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index b4204c179b97..cd7d6064bcbe 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -18,6 +18,18 @@
18 18
19#include <asm-generic/pgtable-nopmd.h> 19#include <asm-generic/pgtable-nopmd.h>
20 20
21extern int temp_tlb_entry __cpuinitdata;
22
23/*
24 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries
25 * starting at the top and working down. This is for populating the
26 * TLB before trap_init() puts the TLB miss handler in place. It
27 * should be used only for entries matching the actual page tables,
28 * to prevent inconsistencies.
29 */
30extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
31 unsigned long entryhi, unsigned long pagemask);
32
21/* 33/*
22 * Basically we have the same two-level (which is the logical three level 34 * Basically we have the same two-level (which is the logical three level
23 * Linux page table layout folded) page tables as the i386. Some day 35 * Linux page table layout folded) page tables as the i386. Some day
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 539ddd148bbb..027c74db13f9 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -97,6 +97,31 @@ extern void paging_init(void);
97 97
98#define pmd_page_vaddr(pmd) pmd_val(pmd) 98#define pmd_page_vaddr(pmd) pmd_val(pmd)
99 99
100#define htw_stop() \
101do { \
102 if (cpu_has_htw) \
103 write_c0_pwctl(read_c0_pwctl() & \
104 ~(1 << MIPS_PWCTL_PWEN_SHIFT)); \
105} while(0)
106
107#define htw_start() \
108do { \
109 if (cpu_has_htw) \
110 write_c0_pwctl(read_c0_pwctl() | \
111 (1 << MIPS_PWCTL_PWEN_SHIFT)); \
112} while(0)
113
114
115#define htw_reset() \
116do { \
117 if (cpu_has_htw) { \
118 htw_stop(); \
119 back_to_back_c0_hazard(); \
120 htw_start(); \
121 back_to_back_c0_hazard(); \
122 } \
123} while(0)
124
100#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 125#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
101 126
102#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) 127#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
@@ -131,6 +156,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
131 null.pte_low = null.pte_high = _PAGE_GLOBAL; 156 null.pte_low = null.pte_high = _PAGE_GLOBAL;
132 157
133 set_pte_at(mm, addr, ptep, null); 158 set_pte_at(mm, addr, ptep, null);
159 htw_reset();
134} 160}
135#else 161#else
136 162
@@ -168,6 +194,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
168 else 194 else
169#endif 195#endif
170 set_pte_at(mm, addr, ptep, __pte(0)); 196 set_pte_at(mm, addr, ptep, __pte(0));
197 htw_reset();
171} 198}
172#endif 199#endif
173 200
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index d5098bc554f4..05f08438a7c4 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -238,7 +238,13 @@ typedef struct {
238 unsigned long seg; 238 unsigned long seg;
239} mm_segment_t; 239} mm_segment_t;
240 240
241#define ARCH_MIN_TASKALIGN 8 241#ifdef CONFIG_CPU_HAS_MSA
242# define ARCH_MIN_TASKALIGN 16
243# define FPU_ALIGN __aligned(16)
244#else
245# define ARCH_MIN_TASKALIGN 8
246# define FPU_ALIGN
247#endif
242 248
243struct mips_abi; 249struct mips_abi;
244 250
@@ -255,7 +261,7 @@ struct thread_struct {
255 unsigned long cp0_status; 261 unsigned long cp0_status;
256 262
257 /* Saved fpu/fpu emulator stuff. */ 263 /* Saved fpu/fpu emulator stuff. */
258 struct mips_fpu_struct fpu; 264 struct mips_fpu_struct fpu FPU_ALIGN;
259#ifdef CONFIG_MIPS_MT_FPAFF 265#ifdef CONFIG_MIPS_MT_FPAFF
260 /* Emulated instruction count */ 266 /* Emulated instruction count */
261 unsigned long emulated_fp; 267 unsigned long emulated_fp;
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index 7e6e682aece3..fc783f843bdc 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -23,7 +23,7 @@
23struct pt_regs { 23struct pt_regs {
24#ifdef CONFIG_32BIT 24#ifdef CONFIG_32BIT
25 /* Pad bytes for argument save space on the stack. */ 25 /* Pad bytes for argument save space on the stack. */
26 unsigned long pad0[6]; 26 unsigned long pad0[8];
27#endif 27#endif
28 28
29 /* Saved main processor registers. */ 29 /* Saved main processor registers. */
@@ -47,8 +47,10 @@ struct pt_regs {
47 47
48struct task_struct; 48struct task_struct;
49 49
50extern int ptrace_getregs(struct task_struct *child, __s64 __user *data); 50extern int ptrace_getregs(struct task_struct *child,
51extern int ptrace_setregs(struct task_struct *child, __s64 __user *data); 51 struct user_pt_regs __user *data);
52extern int ptrace_setregs(struct task_struct *child,
53 struct user_pt_regs __user *data);
52 54
53extern int ptrace_getfpregs(struct task_struct *child, __u32 __user *data); 55extern int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
54extern int ptrace_setfpregs(struct task_struct *child, __u32 __user *data); 56extern int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
diff --git a/arch/mips/include/asm/reg.h b/arch/mips/include/asm/reg.h
index 910e71a12466..84dc7e2e27a8 100644
--- a/arch/mips/include/asm/reg.h
+++ b/arch/mips/include/asm/reg.h
@@ -1,128 +1 @@
1/* #include <uapi/asm/reg.h>
2 * Various register offset definitions for debuggers, core file
3 * examiners and whatnot.
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 * Copyright (C) 1995, 1999 Ralf Baechle
10 * Copyright (C) 1995, 1999 Silicon Graphics
11 */
12#ifndef __ASM_MIPS_REG_H
13#define __ASM_MIPS_REG_H
14
15
16#if defined(CONFIG_32BIT) || defined(WANT_COMPAT_REG_H)
17
18#define EF_R0 6
19#define EF_R1 7
20#define EF_R2 8
21#define EF_R3 9
22#define EF_R4 10
23#define EF_R5 11
24#define EF_R6 12
25#define EF_R7 13
26#define EF_R8 14
27#define EF_R9 15
28#define EF_R10 16
29#define EF_R11 17
30#define EF_R12 18
31#define EF_R13 19
32#define EF_R14 20
33#define EF_R15 21
34#define EF_R16 22
35#define EF_R17 23
36#define EF_R18 24
37#define EF_R19 25
38#define EF_R20 26
39#define EF_R21 27
40#define EF_R22 28
41#define EF_R23 29
42#define EF_R24 30
43#define EF_R25 31
44
45/*
46 * k0/k1 unsaved
47 */
48#define EF_R26 32
49#define EF_R27 33
50
51#define EF_R28 34
52#define EF_R29 35
53#define EF_R30 36
54#define EF_R31 37
55
56/*
57 * Saved special registers
58 */
59#define EF_LO 38
60#define EF_HI 39
61
62#define EF_CP0_EPC 40
63#define EF_CP0_BADVADDR 41
64#define EF_CP0_STATUS 42
65#define EF_CP0_CAUSE 43
66#define EF_UNUSED0 44
67
68#define EF_SIZE 180
69
70#endif
71
72#if defined(CONFIG_64BIT) && !defined(WANT_COMPAT_REG_H)
73
74#define EF_R0 0
75#define EF_R1 1
76#define EF_R2 2
77#define EF_R3 3
78#define EF_R4 4
79#define EF_R5 5
80#define EF_R6 6
81#define EF_R7 7
82#define EF_R8 8
83#define EF_R9 9
84#define EF_R10 10
85#define EF_R11 11
86#define EF_R12 12
87#define EF_R13 13
88#define EF_R14 14
89#define EF_R15 15
90#define EF_R16 16
91#define EF_R17 17
92#define EF_R18 18
93#define EF_R19 19
94#define EF_R20 20
95#define EF_R21 21
96#define EF_R22 22
97#define EF_R23 23
98#define EF_R24 24
99#define EF_R25 25
100
101/*
102 * k0/k1 unsaved
103 */
104#define EF_R26 26
105#define EF_R27 27
106
107
108#define EF_R28 28
109#define EF_R29 29
110#define EF_R30 30
111#define EF_R31 31
112
113/*
114 * Saved special registers
115 */
116#define EF_LO 32
117#define EF_HI 33
118
119#define EF_CP0_EPC 34
120#define EF_CP0_BADVADDR 35
121#define EF_CP0_STATUS 36
122#define EF_CP0_CAUSE 37
123
124#define EF_SIZE 304 /* size in bytes */
125
126#endif /* CONFIG_64BIT */
127
128#endif /* __ASM_MIPS_REG_H */
diff --git a/arch/mips/include/asm/smp-cps.h b/arch/mips/include/asm/smp-cps.h
index a06a08a9afc6..326c16ebd589 100644
--- a/arch/mips/include/asm/smp-cps.h
+++ b/arch/mips/include/asm/smp-cps.h
@@ -31,11 +31,19 @@ extern void mips_cps_core_init(void);
31 31
32extern struct vpe_boot_config *mips_cps_boot_vpes(void); 32extern struct vpe_boot_config *mips_cps_boot_vpes(void);
33 33
34extern bool mips_cps_smp_in_use(void);
35
36extern void mips_cps_pm_save(void); 34extern void mips_cps_pm_save(void);
37extern void mips_cps_pm_restore(void); 35extern void mips_cps_pm_restore(void);
38 36
37#ifdef CONFIG_MIPS_CPS
38
39extern bool mips_cps_smp_in_use(void);
40
41#else /* !CONFIG_MIPS_CPS */
42
43static inline bool mips_cps_smp_in_use(void) { return false; }
44
45#endif /* !CONFIG_MIPS_CPS */
46
39#else /* __ASSEMBLY__ */ 47#else /* __ASSEMBLY__ */
40 48
41.extern mips_cps_bootcfg; 49.extern mips_cps_bootcfg;
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index b037334fca22..1e0f20a9cdda 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -22,6 +22,7 @@
22 22
23extern int smp_num_siblings; 23extern int smp_num_siblings;
24extern cpumask_t cpu_sibling_map[]; 24extern cpumask_t cpu_sibling_map[];
25extern cpumask_t cpu_core_map[];
25 26
26#define raw_smp_processor_id() (current_thread_info()->cpu) 27#define raw_smp_processor_id() (current_thread_info()->cpu)
27 28
@@ -36,6 +37,11 @@ extern int __cpu_logical_map[NR_CPUS];
36 37
37#define NO_PROC_ID (-1) 38#define NO_PROC_ID (-1)
38 39
40#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
41#define topology_core_id(cpu) (cpu_data[cpu].core)
42#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
43#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
44
39#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ 45#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
40#define SMP_CALL_FUNCTION 0x2 46#define SMP_CALL_FUNCTION 0x2
41/* Octeon - Tell another core to flush its icache */ 47/* Octeon - Tell another core to flush its icache */
diff --git a/arch/mips/include/asm/sparsemem.h b/arch/mips/include/asm/sparsemem.h
index d2da53c2c2f8..b1071c1e54f5 100644
--- a/arch/mips/include/asm/sparsemem.h
+++ b/arch/mips/include/asm/sparsemem.h
@@ -11,7 +11,7 @@
11#else 11#else
12# define SECTION_SIZE_BITS 28 12# define SECTION_SIZE_BITS 28
13#endif 13#endif
14#define MAX_PHYSMEM_BITS 35 14#define MAX_PHYSMEM_BITS 48
15 15
16#endif /* CONFIG_SPARSEMEM */ 16#endif /* CONFIG_SPARSEMEM */
17#endif /* _MIPS_SPARSEMEM_H */ 17#endif /* _MIPS_SPARSEMEM_H */
diff --git a/arch/mips/include/asm/user.h b/arch/mips/include/asm/user.h
deleted file mode 100644
index 6bad61b0a53a..000000000000
--- a/arch/mips/include/asm/user.h
+++ /dev/null
@@ -1,58 +0,0 @@
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, 1995, 1996, 1999 by Ralf Baechle
7 */
8#ifndef _ASM_USER_H
9#define _ASM_USER_H
10
11#include <asm/page.h>
12#include <asm/reg.h>
13
14/*
15 * Core file format: The core file is written in such a way that gdb
16 * can understand it and provide useful information to the user (under
17 * linux we use the `trad-core' bfd, NOT the irix-core). The file
18 * contents are as follows:
19 *
20 * upage: 1 page consisting of a user struct that tells gdb
21 * what is present in the file. Directly after this is a
22 * copy of the task_struct, which is currently not used by gdb,
23 * but it may come in handy at some point. All of the registers
24 * are stored as part of the upage. The upage should always be
25 * only one page long.
26 * data: The data segment follows next. We use current->end_text to
27 * current->brk to pick up all of the user variables, plus any memory
28 * that may have been sbrk'ed. No attempt is made to determine if a
29 * page is demand-zero or if a page is totally unused, we just cover
30 * the entire range. All of the addresses are rounded in such a way
31 * that an integral number of pages is written.
32 * stack: We need the stack information in order to get a meaningful
33 * backtrace. We need to write the data from usp to
34 * current->start_stack, so we round each of these in order to be able
35 * to write an integer number of pages.
36 */
37struct user {
38 unsigned long regs[EF_SIZE / /* integer and fp regs */
39 sizeof(unsigned long) + 64];
40 size_t u_tsize; /* text size (pages) */
41 size_t u_dsize; /* data size (pages) */
42 size_t u_ssize; /* stack size (pages) */
43 unsigned long start_code; /* text starting address */
44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */
47 unsigned long u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */
50};
51
52#define NBPG PAGE_SIZE
53#define UPAGES 1
54#define HOST_TEXT_START_ADDR (u.start_code)
55#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57
58#endif /* _ASM_USER_H */
diff --git a/arch/mips/include/uapi/asm/ptrace.h b/arch/mips/include/uapi/asm/ptrace.h
index b26f7e317279..bbcfb8ba8106 100644
--- a/arch/mips/include/uapi/asm/ptrace.h
+++ b/arch/mips/include/uapi/asm/ptrace.h
@@ -22,24 +22,27 @@
22#define DSP_CONTROL 77 22#define DSP_CONTROL 77
23#define ACX 78 23#define ACX 78
24 24
25#ifndef __KERNEL__
26/* 25/*
27 * This struct defines the way the registers are stored on the stack during a 26 * This struct defines the registers as used by PTRACE_{GET,SET}REGS. The
28 * system call/exception. As usual the registers k0/k1 aren't being saved. 27 * format is the same for both 32- and 64-bit processes. Registers for 32-bit
28 * processes are sign extended.
29 */ 29 */
30#ifdef __KERNEL__
31struct user_pt_regs {
32#else
30struct pt_regs { 33struct pt_regs {
34#endif
31 /* Saved main processor registers. */ 35 /* Saved main processor registers. */
32 unsigned long regs[32]; 36 __u64 regs[32];
33 37
34 /* Saved special registers. */ 38 /* Saved special registers. */
35 unsigned long cp0_status; 39 __u64 lo;
36 unsigned long hi; 40 __u64 hi;
37 unsigned long lo; 41 __u64 cp0_epc;
38 unsigned long cp0_badvaddr; 42 __u64 cp0_badvaddr;
39 unsigned long cp0_cause; 43 __u64 cp0_status;
40 unsigned long cp0_epc; 44 __u64 cp0_cause;
41} __attribute__ ((aligned (8))); 45} __attribute__ ((aligned (8)));
42#endif /* __KERNEL__ */
43 46
44/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 47/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
45#define PTRACE_GETREGS 12 48#define PTRACE_GETREGS 12
diff --git a/arch/mips/include/uapi/asm/reg.h b/arch/mips/include/uapi/asm/reg.h
new file mode 100644
index 000000000000..081e377f4f02
--- /dev/null
+++ b/arch/mips/include/uapi/asm/reg.h
@@ -0,0 +1,206 @@
1/*
2 * Various register offset definitions for debuggers, core file
3 * examiners and whatnot.
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 * Copyright (C) 1995, 1999 Ralf Baechle
10 * Copyright (C) 1995, 1999 Silicon Graphics
11 */
12#ifndef __UAPI_ASM_MIPS_REG_H
13#define __UAPI_ASM_MIPS_REG_H
14
15#define MIPS32_EF_R0 6
16#define MIPS32_EF_R1 7
17#define MIPS32_EF_R2 8
18#define MIPS32_EF_R3 9
19#define MIPS32_EF_R4 10
20#define MIPS32_EF_R5 11
21#define MIPS32_EF_R6 12
22#define MIPS32_EF_R7 13
23#define MIPS32_EF_R8 14
24#define MIPS32_EF_R9 15
25#define MIPS32_EF_R10 16
26#define MIPS32_EF_R11 17
27#define MIPS32_EF_R12 18
28#define MIPS32_EF_R13 19
29#define MIPS32_EF_R14 20
30#define MIPS32_EF_R15 21
31#define MIPS32_EF_R16 22
32#define MIPS32_EF_R17 23
33#define MIPS32_EF_R18 24
34#define MIPS32_EF_R19 25
35#define MIPS32_EF_R20 26
36#define MIPS32_EF_R21 27
37#define MIPS32_EF_R22 28
38#define MIPS32_EF_R23 29
39#define MIPS32_EF_R24 30
40#define MIPS32_EF_R25 31
41
42/*
43 * k0/k1 unsaved
44 */
45#define MIPS32_EF_R26 32
46#define MIPS32_EF_R27 33
47
48#define MIPS32_EF_R28 34
49#define MIPS32_EF_R29 35
50#define MIPS32_EF_R30 36
51#define MIPS32_EF_R31 37
52
53/*
54 * Saved special registers
55 */
56#define MIPS32_EF_LO 38
57#define MIPS32_EF_HI 39
58
59#define MIPS32_EF_CP0_EPC 40
60#define MIPS32_EF_CP0_BADVADDR 41
61#define MIPS32_EF_CP0_STATUS 42
62#define MIPS32_EF_CP0_CAUSE 43
63#define MIPS32_EF_UNUSED0 44
64
65#define MIPS32_EF_SIZE 180
66
67#define MIPS64_EF_R0 0
68#define MIPS64_EF_R1 1
69#define MIPS64_EF_R2 2
70#define MIPS64_EF_R3 3
71#define MIPS64_EF_R4 4
72#define MIPS64_EF_R5 5
73#define MIPS64_EF_R6 6
74#define MIPS64_EF_R7 7
75#define MIPS64_EF_R8 8
76#define MIPS64_EF_R9 9
77#define MIPS64_EF_R10 10
78#define MIPS64_EF_R11 11
79#define MIPS64_EF_R12 12
80#define MIPS64_EF_R13 13
81#define MIPS64_EF_R14 14
82#define MIPS64_EF_R15 15
83#define MIPS64_EF_R16 16
84#define MIPS64_EF_R17 17
85#define MIPS64_EF_R18 18
86#define MIPS64_EF_R19 19
87#define MIPS64_EF_R20 20
88#define MIPS64_EF_R21 21
89#define MIPS64_EF_R22 22
90#define MIPS64_EF_R23 23
91#define MIPS64_EF_R24 24
92#define MIPS64_EF_R25 25
93
94/*
95 * k0/k1 unsaved
96 */
97#define MIPS64_EF_R26 26
98#define MIPS64_EF_R27 27
99
100
101#define MIPS64_EF_R28 28
102#define MIPS64_EF_R29 29
103#define MIPS64_EF_R30 30
104#define MIPS64_EF_R31 31
105
106/*
107 * Saved special registers
108 */
109#define MIPS64_EF_LO 32
110#define MIPS64_EF_HI 33
111
112#define MIPS64_EF_CP0_EPC 34
113#define MIPS64_EF_CP0_BADVADDR 35
114#define MIPS64_EF_CP0_STATUS 36
115#define MIPS64_EF_CP0_CAUSE 37
116
117#define MIPS64_EF_SIZE 304 /* size in bytes */
118
119#if _MIPS_SIM == _MIPS_SIM_ABI32
120
121#define EF_R0 MIPS32_EF_R0
122#define EF_R1 MIPS32_EF_R1
123#define EF_R2 MIPS32_EF_R2
124#define EF_R3 MIPS32_EF_R3
125#define EF_R4 MIPS32_EF_R4
126#define EF_R5 MIPS32_EF_R5
127#define EF_R6 MIPS32_EF_R6
128#define EF_R7 MIPS32_EF_R7
129#define EF_R8 MIPS32_EF_R8
130#define EF_R9 MIPS32_EF_R9
131#define EF_R10 MIPS32_EF_R10
132#define EF_R11 MIPS32_EF_R11
133#define EF_R12 MIPS32_EF_R12
134#define EF_R13 MIPS32_EF_R13
135#define EF_R14 MIPS32_EF_R14
136#define EF_R15 MIPS32_EF_R15
137#define EF_R16 MIPS32_EF_R16
138#define EF_R17 MIPS32_EF_R17
139#define EF_R18 MIPS32_EF_R18
140#define EF_R19 MIPS32_EF_R19
141#define EF_R20 MIPS32_EF_R20
142#define EF_R21 MIPS32_EF_R21
143#define EF_R22 MIPS32_EF_R22
144#define EF_R23 MIPS32_EF_R23
145#define EF_R24 MIPS32_EF_R24
146#define EF_R25 MIPS32_EF_R25
147#define EF_R26 MIPS32_EF_R26
148#define EF_R27 MIPS32_EF_R27
149#define EF_R28 MIPS32_EF_R28
150#define EF_R29 MIPS32_EF_R29
151#define EF_R30 MIPS32_EF_R30
152#define EF_R31 MIPS32_EF_R31
153#define EF_LO MIPS32_EF_LO
154#define EF_HI MIPS32_EF_HI
155#define EF_CP0_EPC MIPS32_EF_CP0_EPC
156#define EF_CP0_BADVADDR MIPS32_EF_CP0_BADVADDR
157#define EF_CP0_STATUS MIPS32_EF_CP0_STATUS
158#define EF_CP0_CAUSE MIPS32_EF_CP0_CAUSE
159#define EF_UNUSED0 MIPS32_EF_UNUSED0
160#define EF_SIZE MIPS32_EF_SIZE
161
162#elif _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
163
164#define EF_R0 MIPS64_EF_R0
165#define EF_R1 MIPS64_EF_R1
166#define EF_R2 MIPS64_EF_R2
167#define EF_R3 MIPS64_EF_R3
168#define EF_R4 MIPS64_EF_R4
169#define EF_R5 MIPS64_EF_R5
170#define EF_R6 MIPS64_EF_R6
171#define EF_R7 MIPS64_EF_R7
172#define EF_R8 MIPS64_EF_R8
173#define EF_R9 MIPS64_EF_R9
174#define EF_R10 MIPS64_EF_R10
175#define EF_R11 MIPS64_EF_R11
176#define EF_R12 MIPS64_EF_R12
177#define EF_R13 MIPS64_EF_R13
178#define EF_R14 MIPS64_EF_R14
179#define EF_R15 MIPS64_EF_R15
180#define EF_R16 MIPS64_EF_R16
181#define EF_R17 MIPS64_EF_R17
182#define EF_R18 MIPS64_EF_R18
183#define EF_R19 MIPS64_EF_R19
184#define EF_R20 MIPS64_EF_R20
185#define EF_R21 MIPS64_EF_R21
186#define EF_R22 MIPS64_EF_R22
187#define EF_R23 MIPS64_EF_R23
188#define EF_R24 MIPS64_EF_R24
189#define EF_R25 MIPS64_EF_R25
190#define EF_R26 MIPS64_EF_R26
191#define EF_R27 MIPS64_EF_R27
192#define EF_R28 MIPS64_EF_R28
193#define EF_R29 MIPS64_EF_R29
194#define EF_R30 MIPS64_EF_R30
195#define EF_R31 MIPS64_EF_R31
196#define EF_LO MIPS64_EF_LO
197#define EF_HI MIPS64_EF_HI
198#define EF_CP0_EPC MIPS64_EF_CP0_EPC
199#define EF_CP0_BADVADDR MIPS64_EF_CP0_BADVADDR
200#define EF_CP0_STATUS MIPS64_EF_CP0_STATUS
201#define EF_CP0_CAUSE MIPS64_EF_CP0_CAUSE
202#define EF_SIZE MIPS64_EF_SIZE
203
204#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
205
206#endif /* __UAPI_ASM_MIPS_REG_H */
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index 5805414777e0..9bc13eaf9d67 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -372,16 +372,17 @@
372#define __NR_sched_setattr (__NR_Linux + 349) 372#define __NR_sched_setattr (__NR_Linux + 349)
373#define __NR_sched_getattr (__NR_Linux + 350) 373#define __NR_sched_getattr (__NR_Linux + 350)
374#define __NR_renameat2 (__NR_Linux + 351) 374#define __NR_renameat2 (__NR_Linux + 351)
375#define __NR_seccomp (__NR_Linux + 352)
375 376
376/* 377/*
377 * Offset of the last Linux o32 flavoured syscall 378 * Offset of the last Linux o32 flavoured syscall
378 */ 379 */
379#define __NR_Linux_syscalls 351 380#define __NR_Linux_syscalls 352
380 381
381#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 382#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
382 383
383#define __NR_O32_Linux 4000 384#define __NR_O32_Linux 4000
384#define __NR_O32_Linux_syscalls 351 385#define __NR_O32_Linux_syscalls 352
385 386
386#if _MIPS_SIM == _MIPS_SIM_ABI64 387#if _MIPS_SIM == _MIPS_SIM_ABI64
387 388
@@ -701,16 +702,17 @@
701#define __NR_sched_setattr (__NR_Linux + 309) 702#define __NR_sched_setattr (__NR_Linux + 309)
702#define __NR_sched_getattr (__NR_Linux + 310) 703#define __NR_sched_getattr (__NR_Linux + 310)
703#define __NR_renameat2 (__NR_Linux + 311) 704#define __NR_renameat2 (__NR_Linux + 311)
705#define __NR_seccomp (__NR_Linux + 312)
704 706
705/* 707/*
706 * Offset of the last Linux 64-bit flavoured syscall 708 * Offset of the last Linux 64-bit flavoured syscall
707 */ 709 */
708#define __NR_Linux_syscalls 311 710#define __NR_Linux_syscalls 312
709 711
710#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 712#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
711 713
712#define __NR_64_Linux 5000 714#define __NR_64_Linux 5000
713#define __NR_64_Linux_syscalls 311 715#define __NR_64_Linux_syscalls 312
714 716
715#if _MIPS_SIM == _MIPS_SIM_NABI32 717#if _MIPS_SIM == _MIPS_SIM_NABI32
716 718
@@ -1034,15 +1036,16 @@
1034#define __NR_sched_setattr (__NR_Linux + 313) 1036#define __NR_sched_setattr (__NR_Linux + 313)
1035#define __NR_sched_getattr (__NR_Linux + 314) 1037#define __NR_sched_getattr (__NR_Linux + 314)
1036#define __NR_renameat2 (__NR_Linux + 315) 1038#define __NR_renameat2 (__NR_Linux + 315)
1039#define __NR_seccomp (__NR_Linux + 316)
1037 1040
1038/* 1041/*
1039 * Offset of the last N32 flavoured syscall 1042 * Offset of the last N32 flavoured syscall
1040 */ 1043 */
1041#define __NR_Linux_syscalls 315 1044#define __NR_Linux_syscalls 316
1042 1045
1043#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1046#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1044 1047
1045#define __NR_N32_Linux 6000 1048#define __NR_N32_Linux 6000
1046#define __NR_N32_Linux_syscalls 315 1049#define __NR_N32_Linux_syscalls 316
1047 1050
1048#endif /* _UAPI_ASM_UNISTD_H */ 1051#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
index 088e92a79ae6..c454525e7695 100644
--- a/arch/mips/jz4740/board-qi_lb60.c
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio/machine.h>
18 19
19#include <linux/input.h> 20#include <linux/input.h>
20#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
diff --git a/arch/mips/jz4740/clock-debugfs.c b/arch/mips/jz4740/clock-debugfs.c
index a8acdeff267e..325422d0d453 100644
--- a/arch/mips/jz4740/clock-debugfs.c
+++ b/arch/mips/jz4740/clock-debugfs.c
@@ -87,8 +87,7 @@ void jz4740_clock_debugfs_add_clk(struct clk *clk)
87/* TODO: Locking */ 87/* TODO: Locking */
88void jz4740_clock_debugfs_update_parent(struct clk *clk) 88void jz4740_clock_debugfs_update_parent(struct clk *clk)
89{ 89{
90 if (clk->debugfs_parent_entry) 90 debugfs_remove(clk->debugfs_parent_entry);
91 debugfs_remove(clk->debugfs_parent_entry);
92 91
93 if (clk->parent) { 92 if (clk->parent) {
94 char parent_path[100]; 93 char parent_path[100];
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
index a447101cf9f1..0b12f273cb2e 100644
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -59,7 +59,7 @@ struct platform_device jz4740_usb_ohci_device = {
59 59
60/* USB Device Controller */ 60/* USB Device Controller */
61struct platform_device jz4740_udc_xceiv_device = { 61struct platform_device jz4740_udc_xceiv_device = {
62 .name = "usb_phy_gen_xceiv", 62 .name = "usb_phy_generic",
63 .id = 0, 63 .id = 0,
64}; 64};
65 65
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 4bb5107511e2..b1d84bd4efb3 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -234,6 +234,7 @@ void output_thread_fpu_defines(void)
234 thread.fpu.fpr[31].val64[FPR_IDX(64, 0)]); 234 thread.fpu.fpr[31].val64[FPR_IDX(64, 0)]);
235 235
236 OFFSET(THREAD_FCR31, task_struct, thread.fpu.fcr31); 236 OFFSET(THREAD_FCR31, task_struct, thread.fpu.fcr31);
237 OFFSET(THREAD_MSA_CSR, task_struct, thread.fpu.msacsr);
237 BLANK(); 238 BLANK();
238} 239}
239 240
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 7faf5f2bee25..928767858b86 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -72,22 +72,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
72 72
73#include <asm/processor.h> 73#include <asm/processor.h>
74 74
75/*
76 * When this file is selected, we are definitely running a 64bit kernel.
77 * So using the right regs define in asm/reg.h
78 */
79#define WANT_COMPAT_REG_H
80
81/* These MUST be defined before elf.h gets included */
82extern void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs);
83#define ELF_CORE_COPY_REGS(_dest, _regs) elf32_core_copy_regs(_dest, _regs);
84#define ELF_CORE_COPY_TASK_REGS(_tsk, _dest) \
85({ \
86 int __res = 1; \
87 elf32_core_copy_regs(*(_dest), task_pt_regs(_tsk)); \
88 __res; \
89})
90
91#include <linux/module.h> 75#include <linux/module.h>
92#include <linux/elfcore.h> 76#include <linux/elfcore.h>
93#include <linux/compat.h> 77#include <linux/compat.h>
@@ -145,28 +129,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
145 value->tv_usec = rem / NSEC_PER_USEC; 129 value->tv_usec = rem / NSEC_PER_USEC;
146} 130}
147 131
148void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs)
149{
150 int i;
151
152 for (i = 0; i < EF_R0; i++)
153 grp[i] = 0;
154 grp[EF_R0] = 0;
155 for (i = 1; i <= 31; i++)
156 grp[EF_R0 + i] = (elf_greg_t) regs->regs[i];
157 grp[EF_R26] = 0;
158 grp[EF_R27] = 0;
159 grp[EF_LO] = (elf_greg_t) regs->lo;
160 grp[EF_HI] = (elf_greg_t) regs->hi;
161 grp[EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc;
162 grp[EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr;
163 grp[EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status;
164 grp[EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause;
165#ifdef EF_UNUSED0
166 grp[EF_UNUSED0] = 0;
167#endif
168}
169
170MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries"); 132MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries");
171MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)"); 133MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
172 134
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d74f957c561e..e34b10be782e 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -54,6 +54,20 @@ static int __init dsp_disable(char *s)
54 54
55__setup("nodsp", dsp_disable); 55__setup("nodsp", dsp_disable);
56 56
57static int mips_htw_disabled;
58
59static int __init htw_disable(char *s)
60{
61 mips_htw_disabled = 1;
62 cpu_data[0].options &= ~MIPS_CPU_HTW;
63 write_c0_pwctl(read_c0_pwctl() &
64 ~(1 << MIPS_PWCTL_PWEN_SHIFT));
65
66 return 1;
67}
68
69__setup("nohtw", htw_disable);
70
57static inline void check_errata(void) 71static inline void check_errata(void)
58{ 72{
59 struct cpuinfo_mips *c = &current_cpu_data; 73 struct cpuinfo_mips *c = &current_cpu_data;
@@ -130,14 +144,13 @@ static inline int __cpu_has_fpu(void)
130 144
131static inline unsigned long cpu_get_msa_id(void) 145static inline unsigned long cpu_get_msa_id(void)
132{ 146{
133 unsigned long status, conf5, msa_id; 147 unsigned long status, msa_id;
134 148
135 status = read_c0_status(); 149 status = read_c0_status();
136 __enable_fpu(FPU_64BIT); 150 __enable_fpu(FPU_64BIT);
137 conf5 = read_c0_config5();
138 enable_msa(); 151 enable_msa();
139 msa_id = read_msa_ir(); 152 msa_id = read_msa_ir();
140 write_c0_config5(conf5); 153 disable_msa();
141 write_c0_status(status); 154 write_c0_status(status);
142 return msa_id; 155 return msa_id;
143} 156}
@@ -321,6 +334,9 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
321 c->options |= MIPS_CPU_SEGMENTS; 334 c->options |= MIPS_CPU_SEGMENTS;
322 if (config3 & MIPS_CONF3_MSA) 335 if (config3 & MIPS_CONF3_MSA)
323 c->ases |= MIPS_ASE_MSA; 336 c->ases |= MIPS_ASE_MSA;
337 /* Only tested on 32-bit cores */
338 if ((config3 & MIPS_CONF3_PW) && config_enabled(CONFIG_32BIT))
339 c->options |= MIPS_CPU_HTW;
324 340
325 return config3 & MIPS_CONF_M; 341 return config3 & MIPS_CONF_M;
326} 342}
@@ -389,6 +405,8 @@ static inline unsigned int decode_config5(struct cpuinfo_mips *c)
389 405
390 if (config5 & MIPS_CONF5_EVA) 406 if (config5 & MIPS_CONF5_EVA)
391 c->options |= MIPS_CPU_EVA; 407 c->options |= MIPS_CPU_EVA;
408 if (config5 & MIPS_CONF5_MRP)
409 c->options |= MIPS_CPU_MAAR;
392 410
393 return config5 & MIPS_CONF_M; 411 return config5 & MIPS_CONF_M;
394} 412}
@@ -421,6 +439,15 @@ static void decode_configs(struct cpuinfo_mips *c)
421 439
422 mips_probe_watch_registers(c); 440 mips_probe_watch_registers(c);
423 441
442 if (cpu_has_rixi) {
443 /* Enable the RIXI exceptions */
444 write_c0_pagegrain(read_c0_pagegrain() | PG_IEC);
445 back_to_back_c0_hazard();
446 /* Verify the IEC bit is set */
447 if (read_c0_pagegrain() & PG_IEC)
448 c->options |= MIPS_CPU_RIXIEX;
449 }
450
424#ifndef CONFIG_MIPS_CPS 451#ifndef CONFIG_MIPS_CPS
425 if (cpu_has_mips_r2) { 452 if (cpu_has_mips_r2) {
426 c->core = get_ebase_cpunum(); 453 c->core = get_ebase_cpunum();
@@ -740,6 +767,12 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
740 __cpu_name[cpu] = "ICT Loongson-3"; 767 __cpu_name[cpu] = "ICT Loongson-3";
741 set_elf_platform(cpu, "loongson3a"); 768 set_elf_platform(cpu, "loongson3a");
742 break; 769 break;
770 case PRID_REV_LOONGSON3B_R1:
771 case PRID_REV_LOONGSON3B_R2:
772 c->cputype = CPU_LOONGSON3;
773 __cpu_name[cpu] = "ICT Loongson-3";
774 set_elf_platform(cpu, "loongson3b");
775 break;
743 } 776 }
744 777
745 set_isa(c, MIPS_CPU_ISA_III); 778 set_isa(c, MIPS_CPU_ISA_III);
@@ -1187,6 +1220,12 @@ void cpu_probe(void)
1187 if (mips_dsp_disabled) 1220 if (mips_dsp_disabled)
1188 c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P); 1221 c->ases &= ~(MIPS_ASE_DSP | MIPS_ASE_DSP2P);
1189 1222
1223 if (mips_htw_disabled) {
1224 c->options &= ~MIPS_CPU_HTW;
1225 write_c0_pwctl(read_c0_pwctl() &
1226 ~(1 << MIPS_PWCTL_PWEN_SHIFT));
1227 }
1228
1190 if (c->options & MIPS_CPU_FPU) { 1229 if (c->options & MIPS_CPU_FPU) {
1191 c->fpu_id = cpu_get_fpu_id(); 1230 c->fpu_id = cpu_get_fpu_id();
1192 1231
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 8b6538750fe1..937c54bc8ccc 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -63,7 +63,7 @@ static inline int in_kernel_space(unsigned long ip)
63 ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK))) 63 ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK)))
64 64
65static unsigned int insn_jal_ftrace_caller __read_mostly; 65static unsigned int insn_jal_ftrace_caller __read_mostly;
66static unsigned int insn_lui_v1_hi16_mcount __read_mostly; 66static unsigned int insn_la_mcount[2] __read_mostly;
67static unsigned int insn_j_ftrace_graph_caller __maybe_unused __read_mostly; 67static unsigned int insn_j_ftrace_graph_caller __maybe_unused __read_mostly;
68 68
69static inline void ftrace_dyn_arch_init_insns(void) 69static inline void ftrace_dyn_arch_init_insns(void)
@@ -71,10 +71,10 @@ static inline void ftrace_dyn_arch_init_insns(void)
71 u32 *buf; 71 u32 *buf;
72 unsigned int v1; 72 unsigned int v1;
73 73
74 /* lui v1, hi16_mcount */ 74 /* la v1, _mcount */
75 v1 = 3; 75 v1 = 3;
76 buf = (u32 *)&insn_lui_v1_hi16_mcount; 76 buf = (u32 *)&insn_la_mcount[0];
77 UASM_i_LA_mostly(&buf, v1, MCOUNT_ADDR); 77 UASM_i_LA(&buf, v1, MCOUNT_ADDR);
78 78
79 /* jal (ftrace_caller + 8), jump over the first two instruction */ 79 /* jal (ftrace_caller + 8), jump over the first two instruction */
80 buf = (u32 *)&insn_jal_ftrace_caller; 80 buf = (u32 *)&insn_jal_ftrace_caller;
@@ -111,14 +111,47 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
111 unsigned int new_code2) 111 unsigned int new_code2)
112{ 112{
113 int faulted; 113 int faulted;
114 mm_segment_t old_fs;
114 115
115 safe_store_code(new_code1, ip, faulted); 116 safe_store_code(new_code1, ip, faulted);
116 if (unlikely(faulted)) 117 if (unlikely(faulted))
117 return -EFAULT; 118 return -EFAULT;
118 safe_store_code(new_code2, ip + 4, faulted); 119
120 ip += 4;
121 safe_store_code(new_code2, ip, faulted);
119 if (unlikely(faulted)) 122 if (unlikely(faulted))
120 return -EFAULT; 123 return -EFAULT;
124
125 ip -= 4;
126 old_fs = get_fs();
127 set_fs(get_ds());
121 flush_icache_range(ip, ip + 8); 128 flush_icache_range(ip, ip + 8);
129 set_fs(old_fs);
130
131 return 0;
132}
133
134static int ftrace_modify_code_2r(unsigned long ip, unsigned int new_code1,
135 unsigned int new_code2)
136{
137 int faulted;
138 mm_segment_t old_fs;
139
140 ip += 4;
141 safe_store_code(new_code2, ip, faulted);
142 if (unlikely(faulted))
143 return -EFAULT;
144
145 ip -= 4;
146 safe_store_code(new_code1, ip, faulted);
147 if (unlikely(faulted))
148 return -EFAULT;
149
150 old_fs = get_fs();
151 set_fs(get_ds());
152 flush_icache_range(ip, ip + 8);
153 set_fs(old_fs);
154
122 return 0; 155 return 0;
123} 156}
124#endif 157#endif
@@ -130,13 +163,14 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
130 * 163 *
131 * move at, ra 164 * move at, ra
132 * jal _mcount --> nop 165 * jal _mcount --> nop
166 * sub sp, sp, 8 --> nop (CONFIG_32BIT)
133 * 167 *
134 * 2. For modules: 168 * 2. For modules:
135 * 169 *
136 * 2.1 For KBUILD_MCOUNT_RA_ADDRESS and CONFIG_32BIT 170 * 2.1 For KBUILD_MCOUNT_RA_ADDRESS and CONFIG_32BIT
137 * 171 *
138 * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005) 172 * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005)
139 * addiu v1, v1, low_16bit_of_mcount 173 * addiu v1, v1, low_16bit_of_mcount --> nop (CONFIG_32BIT)
140 * move at, ra 174 * move at, ra
141 * move $12, ra_address 175 * move $12, ra_address
142 * jalr v1 176 * jalr v1
@@ -145,7 +179,7 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
145 * 2.2 For the Other situations 179 * 2.2 For the Other situations
146 * 180 *
147 * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) 181 * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004)
148 * addiu v1, v1, low_16bit_of_mcount 182 * addiu v1, v1, low_16bit_of_mcount --> nop (CONFIG_32BIT)
149 * move at, ra 183 * move at, ra
150 * jalr v1 184 * jalr v1
151 * nop | move $12, ra_address | sub sp, sp, 8 185 * nop | move $12, ra_address | sub sp, sp, 8
@@ -184,10 +218,14 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
184 unsigned int new; 218 unsigned int new;
185 unsigned long ip = rec->ip; 219 unsigned long ip = rec->ip;
186 220
187 new = in_kernel_space(ip) ? insn_jal_ftrace_caller : 221 new = in_kernel_space(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0];
188 insn_lui_v1_hi16_mcount;
189 222
223#ifdef CONFIG_64BIT
190 return ftrace_modify_code(ip, new); 224 return ftrace_modify_code(ip, new);
225#else
226 return ftrace_modify_code_2r(ip, new, in_kernel_space(ip) ?
227 INSN_NOP : insn_la_mcount[1]);
228#endif
191} 229}
192 230
193#define FTRACE_CALL_IP ((unsigned long)(&ftrace_call)) 231#define FTRACE_CALL_IP ((unsigned long)(&ftrace_call))
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index 88e4c323382c..9e9d8b9a5b97 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -28,6 +28,18 @@ unsigned int gic_irq_flags[GIC_NUM_INTRS];
28/* The index into this array is the vector # of the interrupt. */ 28/* The index into this array is the vector # of the interrupt. */
29struct gic_shared_intr_map gic_shared_intr_map[GIC_NUM_INTRS]; 29struct gic_shared_intr_map gic_shared_intr_map[GIC_NUM_INTRS];
30 30
31struct gic_pcpu_mask {
32 DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS);
33};
34
35struct gic_pending_regs {
36 DECLARE_BITMAP(pending, GIC_NUM_INTRS);
37};
38
39struct gic_intrmask_regs {
40 DECLARE_BITMAP(intrmask, GIC_NUM_INTRS);
41};
42
31static struct gic_pcpu_mask pcpu_masks[NR_CPUS]; 43static struct gic_pcpu_mask pcpu_masks[NR_CPUS];
32static struct gic_pending_regs pending_regs[NR_CPUS]; 44static struct gic_pending_regs pending_regs[NR_CPUS];
33static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; 45static struct gic_intrmask_regs intrmask_regs[NR_CPUS];
@@ -177,7 +189,7 @@ unsigned int gic_compare_int(void)
177 return 0; 189 return 0;
178} 190}
179 191
180unsigned int gic_get_int(void) 192void gic_get_int_mask(unsigned long *dst, const unsigned long *src)
181{ 193{
182 unsigned int i; 194 unsigned int i;
183 unsigned long *pending, *intrmask, *pcpu_mask; 195 unsigned long *pending, *intrmask, *pcpu_mask;
@@ -202,8 +214,17 @@ unsigned int gic_get_int(void)
202 214
203 bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS); 215 bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS);
204 bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS); 216 bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS);
217 bitmap_and(dst, src, pending, GIC_NUM_INTRS);
218}
205 219
206 return find_first_bit(pending, GIC_NUM_INTRS); 220unsigned int gic_get_int(void)
221{
222 DECLARE_BITMAP(interrupts, GIC_NUM_INTRS);
223
224 bitmap_fill(interrupts, GIC_NUM_INTRS);
225 gic_get_int_mask(interrupts, interrupts);
226
227 return find_first_bit(interrupts, GIC_NUM_INTRS);
207} 228}
208 229
209static void gic_mask_irq(struct irq_data *d) 230static void gic_mask_irq(struct irq_data *d)
@@ -269,11 +290,13 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu,
269 290
270 /* Setup Intr to Pin mapping */ 291 /* Setup Intr to Pin mapping */
271 if (pin & GIC_MAP_TO_NMI_MSK) { 292 if (pin & GIC_MAP_TO_NMI_MSK) {
293 int i;
294
272 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin); 295 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin);
273 /* FIXME: hack to route NMI to all cpu's */ 296 /* FIXME: hack to route NMI to all cpu's */
274 for (cpu = 0; cpu < NR_CPUS; cpu += 32) { 297 for (i = 0; i < NR_CPUS; i += 32) {
275 GICWRITE(GIC_REG_ADDR(SHARED, 298 GICWRITE(GIC_REG_ADDR(SHARED,
276 GIC_SH_MAP_TO_VPE_REG_OFF(intr, cpu)), 299 GIC_SH_MAP_TO_VPE_REG_OFF(intr, i)),
277 0xffffffff); 300 0xffffffff);
278 } 301 }
279 } else { 302 } else {
@@ -299,9 +322,10 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu,
299 322
300 /* Init Intr Masks */ 323 /* Init Intr Masks */
301 GIC_CLR_INTR_MASK(intr); 324 GIC_CLR_INTR_MASK(intr);
325
302 /* Initialise per-cpu Interrupt software masks */ 326 /* Initialise per-cpu Interrupt software masks */
303 if (flags & GIC_FLAG_IPI) 327 set_bit(intr, pcpu_masks[cpu].pcpu_mask);
304 set_bit(intr, pcpu_masks[cpu].pcpu_mask); 328
305 if ((flags & GIC_FLAG_TRANSPARENT) && (cpu_has_veic == 0)) 329 if ((flags & GIC_FLAG_TRANSPARENT) && (cpu_has_veic == 0))
306 GIC_SET_INTR_MASK(intr); 330 GIC_SET_INTR_MASK(intr);
307 if (trigtype == GIC_TRIG_EDGE) 331 if (trigtype == GIC_TRIG_EDGE)
@@ -340,8 +364,6 @@ static void __init gic_basic_init(int numintrs, int numvpes,
340 cpu = intrmap[i].cpunum; 364 cpu = intrmap[i].cpunum;
341 if (cpu == GIC_UNUSED) 365 if (cpu == GIC_UNUSED)
342 continue; 366 continue;
343 if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
344 continue;
345 gic_setup_intr(i, 367 gic_setup_intr(i,
346 intrmap[i].cpunum, 368 intrmap[i].cpunum,
347 intrmap[i].pin + pin_offset, 369 intrmap[i].pin + pin_offset,
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 00940d1d5c4f..5d25462de8a6 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -80,6 +80,19 @@ _mcount:
80#endif 80#endif
81 81
82 PTR_SUBU a0, ra, 8 /* arg1: self address */ 82 PTR_SUBU a0, ra, 8 /* arg1: self address */
83 PTR_LA t1, _stext
84 sltu t2, a0, t1 /* t2 = (a0 < _stext) */
85 PTR_LA t1, _etext
86 sltu t3, t1, a0 /* t3 = (a0 > _etext) */
87 or t1, t2, t3
88 beqz t1, ftrace_call
89 nop
90#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
91 PTR_SUBU a0, a0, 16 /* arg1: adjust to module's recorded callsite */
92#else
93 PTR_SUBU a0, a0, 12
94#endif
95
83 .globl ftrace_call 96 .globl ftrace_call
84ftrace_call: 97ftrace_call:
85 nop /* a placeholder for the call to a real tracing function */ 98 nop /* a placeholder for the call to a real tracing function */
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 4f2d9dece7ab..14bf74b0f51c 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -1386,6 +1386,9 @@ static irqreturn_t mipsxx_pmu_handle_irq(int irq, void *dev)
1386/* proAptiv */ 1386/* proAptiv */
1387#define IS_BOTH_COUNTERS_PROAPTIV_EVENT(b) \ 1387#define IS_BOTH_COUNTERS_PROAPTIV_EVENT(b) \
1388 ((b) == 0 || (b) == 1) 1388 ((b) == 0 || (b) == 1)
1389/* P5600 */
1390#define IS_BOTH_COUNTERS_P5600_EVENT(b) \
1391 ((b) == 0 || (b) == 1)
1389 1392
1390/* 1004K */ 1393/* 1004K */
1391#define IS_BOTH_COUNTERS_1004K_EVENT(b) \ 1394#define IS_BOTH_COUNTERS_1004K_EVENT(b) \
@@ -1420,20 +1423,23 @@ static irqreturn_t mipsxx_pmu_handle_irq(int irq, void *dev)
1420 1423
1421 1424
1422/* 1425/*
1423 * User can use 0-255 raw events, where 0-127 for the events of even 1426 * For most cores the user can use 0-255 raw events, where 0-127 for the events
1424 * counters, and 128-255 for odd counters. Note that bit 7 is used to 1427 * of even counters, and 128-255 for odd counters. Note that bit 7 is used to
1425 * indicate the parity. So, for example, when user wants to take the 1428 * indicate the even/odd bank selector. So, for example, when user wants to take
1426 * Event Num of 15 for odd counters (by referring to the user manual), 1429 * the Event Num of 15 for odd counters (by referring to the user manual), then
1427 * then 128 needs to be added to 15 as the input for the event config, 1430 * 128 needs to be added to 15 as the input for the event config, i.e., 143 (0x8F)
1428 * i.e., 143 (0x8F) to be used. 1431 * to be used.
1432 *
1433 * Some newer cores have even more events, in which case the user can use raw
1434 * events 0-511, where 0-255 are for the events of even counters, and 256-511
1435 * are for odd counters, so bit 8 is used to indicate the even/odd bank selector.
1429 */ 1436 */
1430static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) 1437static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1431{ 1438{
1439 /* currently most cores have 7-bit event numbers */
1432 unsigned int raw_id = config & 0xff; 1440 unsigned int raw_id = config & 0xff;
1433 unsigned int base_id = raw_id & 0x7f; 1441 unsigned int base_id = raw_id & 0x7f;
1434 1442
1435 raw_event.event_id = base_id;
1436
1437 switch (current_cpu_type()) { 1443 switch (current_cpu_type()) {
1438 case CPU_24K: 1444 case CPU_24K:
1439 if (IS_BOTH_COUNTERS_24K_EVENT(base_id)) 1445 if (IS_BOTH_COUNTERS_24K_EVENT(base_id))
@@ -1485,6 +1491,19 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1485 raw_event.range = P; 1491 raw_event.range = P;
1486#endif 1492#endif
1487 break; 1493 break;
1494 case CPU_P5600:
1495 /* 8-bit event numbers */
1496 raw_id = config & 0x1ff;
1497 base_id = raw_id & 0xff;
1498 if (IS_BOTH_COUNTERS_P5600_EVENT(base_id))
1499 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
1500 else
1501 raw_event.cntr_mask =
1502 raw_id > 255 ? CNTR_ODD : CNTR_EVEN;
1503#ifdef CONFIG_MIPS_MT_SMP
1504 raw_event.range = P;
1505#endif
1506 break;
1488 case CPU_1004K: 1507 case CPU_1004K:
1489 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id)) 1508 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id))
1490 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; 1509 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
@@ -1523,6 +1542,8 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1523 raw_id > 127 ? CNTR_ODD : CNTR_EVEN; 1542 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
1524 } 1543 }
1525 1544
1545 raw_event.event_id = base_id;
1546
1526 return &raw_event; 1547 return &raw_event;
1527} 1548}
1528 1549
@@ -1633,6 +1654,11 @@ init_hw_perf_events(void)
1633 mipspmu.general_event_map = &mipsxxcore_event_map2; 1654 mipspmu.general_event_map = &mipsxxcore_event_map2;
1634 mipspmu.cache_event_map = &mipsxxcore_cache_map2; 1655 mipspmu.cache_event_map = &mipsxxcore_cache_map2;
1635 break; 1656 break;
1657 case CPU_P5600:
1658 mipspmu.name = "mips/P5600";
1659 mipspmu.general_event_map = &mipsxxcore_event_map2;
1660 mipspmu.cache_event_map = &mipsxxcore_cache_map2;
1661 break;
1636 case CPU_1004K: 1662 case CPU_1004K:
1637 mipspmu.name = "mips/1004K"; 1663 mipspmu.name = "mips/1004K";
1638 mipspmu.general_event_map = &mipsxxcore_event_map; 1664 mipspmu.general_event_map = &mipsxxcore_event_map;
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index c4c2069d3a20..06147179a175 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -149,8 +149,12 @@ int cps_pm_enter_state(enum cps_pm_state state)
149 149
150 /* Setup the VPE to run mips_cps_pm_restore when started again */ 150 /* Setup the VPE to run mips_cps_pm_restore when started again */
151 if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) { 151 if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
152 /* Power gating relies upon CPS SMP */
153 if (!mips_cps_smp_in_use())
154 return -EINVAL;
155
152 core_cfg = &mips_cps_core_bootcfg[core]; 156 core_cfg = &mips_cps_core_bootcfg[core];
153 vpe_cfg = &core_cfg->vpe_config[current_cpu_data.vpe_id]; 157 vpe_cfg = &core_cfg->vpe_config[cpu_vpe_id(&current_cpu_data)];
154 vpe_cfg->pc = (unsigned long)mips_cps_pm_restore; 158 vpe_cfg->pc = (unsigned long)mips_cps_pm_restore;
155 vpe_cfg->gp = (unsigned long)current_thread_info(); 159 vpe_cfg->gp = (unsigned long)current_thread_info();
156 vpe_cfg->sp = 0; 160 vpe_cfg->sp = 0;
@@ -376,6 +380,10 @@ static void * __init cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)
376 memset(relocs, 0, sizeof(relocs)); 380 memset(relocs, 0, sizeof(relocs));
377 381
378 if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) { 382 if (config_enabled(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
383 /* Power gating relies upon CPS SMP */
384 if (!mips_cps_smp_in_use())
385 goto out_err;
386
379 /* 387 /*
380 * Save CPU state. Note the non-standard calling convention 388 * Save CPU state. Note the non-standard calling convention
381 * with the return address placed in v0 to avoid clobbering 389 * with the return address placed in v0 to avoid clobbering
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 037a44d962f3..097fc8d14e42 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -113,6 +113,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
113 if (cpu_has_vz) seq_printf(m, "%s", " vz"); 113 if (cpu_has_vz) seq_printf(m, "%s", " vz");
114 if (cpu_has_msa) seq_printf(m, "%s", " msa"); 114 if (cpu_has_msa) seq_printf(m, "%s", " msa");
115 if (cpu_has_eva) seq_printf(m, "%s", " eva"); 115 if (cpu_has_eva) seq_printf(m, "%s", " eva");
116 if (cpu_has_htw) seq_printf(m, "%s", " htw");
116 seq_printf(m, "\n"); 117 seq_printf(m, "\n");
117 118
118 if (cpu_has_mmips) { 119 if (cpu_has_mmips) {
@@ -123,6 +124,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
123 cpu_data[n].srsets); 124 cpu_data[n].srsets);
124 seq_printf(m, "kscratch registers\t: %d\n", 125 seq_printf(m, "kscratch registers\t: %d\n",
125 hweight8(cpu_data[n].kscratch_mask)); 126 hweight8(cpu_data[n].kscratch_mask));
127 seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
126 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); 128 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
127 129
128 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 130 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 0a1ec0f3beff..636b0745d7c7 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -21,7 +21,6 @@
21#include <linux/mman.h> 21#include <linux/mman.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/sys.h> 23#include <linux/sys.h>
24#include <linux/user.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/completion.h> 25#include <linux/completion.h>
27#include <linux/kallsyms.h> 26#include <linux/kallsyms.h>
@@ -36,6 +35,7 @@
36#include <asm/pgtable.h> 35#include <asm/pgtable.h>
37#include <asm/mipsregs.h> 36#include <asm/mipsregs.h>
38#include <asm/processor.h> 37#include <asm/processor.h>
38#include <asm/reg.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/elf.h> 41#include <asm/elf.h>
@@ -66,6 +66,7 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
66 clear_used_math(); 66 clear_used_math();
67 clear_fpu_owner(); 67 clear_fpu_owner();
68 init_dsp(); 68 init_dsp();
69 clear_thread_flag(TIF_USEDMSA);
69 clear_thread_flag(TIF_MSA_CTX_LIVE); 70 clear_thread_flag(TIF_MSA_CTX_LIVE);
70 disable_msa(); 71 disable_msa();
71 regs->cp0_epc = pc; 72 regs->cp0_epc = pc;
@@ -141,6 +142,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
141 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); 142 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
142 143
143 clear_tsk_thread_flag(p, TIF_USEDFPU); 144 clear_tsk_thread_flag(p, TIF_USEDFPU);
145 clear_tsk_thread_flag(p, TIF_USEDMSA);
146 clear_tsk_thread_flag(p, TIF_MSA_CTX_LIVE);
144 147
145#ifdef CONFIG_MIPS_MT_FPAFF 148#ifdef CONFIG_MIPS_MT_FPAFF
146 clear_tsk_thread_flag(p, TIF_FPUBOUND); 149 clear_tsk_thread_flag(p, TIF_FPUBOUND);
@@ -152,61 +155,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
152 return 0; 155 return 0;
153} 156}
154 157
155/* Fill in the fpu structure for a core dump.. */
156int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
157{
158 int i;
159
160 for (i = 0; i < NUM_FPU_REGS; i++)
161 memcpy(&r[i], &current->thread.fpu.fpr[i], sizeof(*r));
162
163 memcpy(&r[NUM_FPU_REGS], &current->thread.fpu.fcr31,
164 sizeof(current->thread.fpu.fcr31));
165
166 return 1;
167}
168
169void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs)
170{
171 int i;
172
173 for (i = 0; i < EF_R0; i++)
174 gp[i] = 0;
175 gp[EF_R0] = 0;
176 for (i = 1; i <= 31; i++)
177 gp[EF_R0 + i] = regs->regs[i];
178 gp[EF_R26] = 0;
179 gp[EF_R27] = 0;
180 gp[EF_LO] = regs->lo;
181 gp[EF_HI] = regs->hi;
182 gp[EF_CP0_EPC] = regs->cp0_epc;
183 gp[EF_CP0_BADVADDR] = regs->cp0_badvaddr;
184 gp[EF_CP0_STATUS] = regs->cp0_status;
185 gp[EF_CP0_CAUSE] = regs->cp0_cause;
186#ifdef EF_UNUSED0
187 gp[EF_UNUSED0] = 0;
188#endif
189}
190
191int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
192{
193 elf_dump_regs(*regs, task_pt_regs(tsk));
194 return 1;
195}
196
197int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpr)
198{
199 int i;
200
201 for (i = 0; i < NUM_FPU_REGS; i++)
202 memcpy(&fpr[i], &t->thread.fpu.fpr[i], sizeof(*fpr));
203
204 memcpy(&fpr[NUM_FPU_REGS], &t->thread.fpu.fcr31,
205 sizeof(t->thread.fpu.fcr31));
206
207 return 1;
208}
209
210#ifdef CONFIG_CC_STACKPROTECTOR 158#ifdef CONFIG_CC_STACKPROTECTOR
211#include <linux/stackprotector.h> 159#include <linux/stackprotector.h>
212unsigned long __stack_chk_guard __read_mostly; 160unsigned long __stack_chk_guard __read_mostly;
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index f639ccd5060c..645b3c4fcfba 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -24,7 +24,6 @@
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/regset.h> 25#include <linux/regset.h>
26#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/user.h>
28#include <linux/security.h> 27#include <linux/security.h>
29#include <linux/tracehook.h> 28#include <linux/tracehook.h>
30#include <linux/audit.h> 29#include <linux/audit.h>
@@ -63,7 +62,7 @@ void ptrace_disable(struct task_struct *child)
63 * for 32-bit kernels and for 32-bit processes on a 64-bit kernel. 62 * for 32-bit kernels and for 32-bit processes on a 64-bit kernel.
64 * Registers are sign extended to fill the available space. 63 * Registers are sign extended to fill the available space.
65 */ 64 */
66int ptrace_getregs(struct task_struct *child, __s64 __user *data) 65int ptrace_getregs(struct task_struct *child, struct user_pt_regs __user *data)
67{ 66{
68 struct pt_regs *regs; 67 struct pt_regs *regs;
69 int i; 68 int i;
@@ -74,13 +73,13 @@ int ptrace_getregs(struct task_struct *child, __s64 __user *data)
74 regs = task_pt_regs(child); 73 regs = task_pt_regs(child);
75 74
76 for (i = 0; i < 32; i++) 75 for (i = 0; i < 32; i++)
77 __put_user((long)regs->regs[i], data + i); 76 __put_user((long)regs->regs[i], (__s64 __user *)&data->regs[i]);
78 __put_user((long)regs->lo, data + EF_LO - EF_R0); 77 __put_user((long)regs->lo, (__s64 __user *)&data->lo);
79 __put_user((long)regs->hi, data + EF_HI - EF_R0); 78 __put_user((long)regs->hi, (__s64 __user *)&data->hi);
80 __put_user((long)regs->cp0_epc, data + EF_CP0_EPC - EF_R0); 79 __put_user((long)regs->cp0_epc, (__s64 __user *)&data->cp0_epc);
81 __put_user((long)regs->cp0_badvaddr, data + EF_CP0_BADVADDR - EF_R0); 80 __put_user((long)regs->cp0_badvaddr, (__s64 __user *)&data->cp0_badvaddr);
82 __put_user((long)regs->cp0_status, data + EF_CP0_STATUS - EF_R0); 81 __put_user((long)regs->cp0_status, (__s64 __user *)&data->cp0_status);
83 __put_user((long)regs->cp0_cause, data + EF_CP0_CAUSE - EF_R0); 82 __put_user((long)regs->cp0_cause, (__s64 __user *)&data->cp0_cause);
84 83
85 return 0; 84 return 0;
86} 85}
@@ -90,7 +89,7 @@ int ptrace_getregs(struct task_struct *child, __s64 __user *data)
90 * the 64-bit format. On a 32-bit kernel only the lower order half 89 * the 64-bit format. On a 32-bit kernel only the lower order half
91 * (according to endianness) will be used. 90 * (according to endianness) will be used.
92 */ 91 */
93int ptrace_setregs(struct task_struct *child, __s64 __user *data) 92int ptrace_setregs(struct task_struct *child, struct user_pt_regs __user *data)
94{ 93{
95 struct pt_regs *regs; 94 struct pt_regs *regs;
96 int i; 95 int i;
@@ -101,10 +100,10 @@ int ptrace_setregs(struct task_struct *child, __s64 __user *data)
101 regs = task_pt_regs(child); 100 regs = task_pt_regs(child);
102 101
103 for (i = 0; i < 32; i++) 102 for (i = 0; i < 32; i++)
104 __get_user(regs->regs[i], data + i); 103 __get_user(regs->regs[i], (__s64 __user *)&data->regs[i]);
105 __get_user(regs->lo, data + EF_LO - EF_R0); 104 __get_user(regs->lo, (__s64 __user *)&data->lo);
106 __get_user(regs->hi, data + EF_HI - EF_R0); 105 __get_user(regs->hi, (__s64 __user *)&data->hi);
107 __get_user(regs->cp0_epc, data + EF_CP0_EPC - EF_R0); 106 __get_user(regs->cp0_epc, (__s64 __user *)&data->cp0_epc);
108 107
109 /* badvaddr, status, and cause may not be written. */ 108 /* badvaddr, status, and cause may not be written. */
110 109
@@ -129,7 +128,7 @@ int ptrace_getfpregs(struct task_struct *child, __u32 __user *data)
129 } 128 }
130 129
131 __put_user(child->thread.fpu.fcr31, data + 64); 130 __put_user(child->thread.fpu.fcr31, data + 64);
132 __put_user(current_cpu_data.fpu_id, data + 65); 131 __put_user(boot_cpu_data.fpu_id, data + 65);
133 132
134 return 0; 133 return 0;
135} 134}
@@ -151,6 +150,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data)
151 } 150 }
152 151
153 __get_user(child->thread.fpu.fcr31, data + 64); 152 __get_user(child->thread.fpu.fcr31, data + 64);
153 child->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X;
154 154
155 /* FIR may not be written. */ 155 /* FIR may not be written. */
156 156
@@ -246,36 +246,160 @@ int ptrace_set_watch_regs(struct task_struct *child,
246 246
247/* regset get/set implementations */ 247/* regset get/set implementations */
248 248
249static int gpr_get(struct task_struct *target, 249#if defined(CONFIG_32BIT) || defined(CONFIG_MIPS32_O32)
250 const struct user_regset *regset, 250
251 unsigned int pos, unsigned int count, 251static int gpr32_get(struct task_struct *target,
252 void *kbuf, void __user *ubuf) 252 const struct user_regset *regset,
253 unsigned int pos, unsigned int count,
254 void *kbuf, void __user *ubuf)
253{ 255{
254 struct pt_regs *regs = task_pt_regs(target); 256 struct pt_regs *regs = task_pt_regs(target);
257 u32 uregs[ELF_NGREG] = {};
258 unsigned i;
259
260 for (i = MIPS32_EF_R1; i <= MIPS32_EF_R31; i++) {
261 /* k0/k1 are copied as zero. */
262 if (i == MIPS32_EF_R26 || i == MIPS32_EF_R27)
263 continue;
264
265 uregs[i] = regs->regs[i - MIPS32_EF_R0];
266 }
255 267
256 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 268 uregs[MIPS32_EF_LO] = regs->lo;
257 regs, 0, sizeof(*regs)); 269 uregs[MIPS32_EF_HI] = regs->hi;
270 uregs[MIPS32_EF_CP0_EPC] = regs->cp0_epc;
271 uregs[MIPS32_EF_CP0_BADVADDR] = regs->cp0_badvaddr;
272 uregs[MIPS32_EF_CP0_STATUS] = regs->cp0_status;
273 uregs[MIPS32_EF_CP0_CAUSE] = regs->cp0_cause;
274
275 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, 0,
276 sizeof(uregs));
258} 277}
259 278
260static int gpr_set(struct task_struct *target, 279static int gpr32_set(struct task_struct *target,
261 const struct user_regset *regset, 280 const struct user_regset *regset,
262 unsigned int pos, unsigned int count, 281 unsigned int pos, unsigned int count,
263 const void *kbuf, const void __user *ubuf) 282 const void *kbuf, const void __user *ubuf)
264{ 283{
265 struct pt_regs newregs; 284 struct pt_regs *regs = task_pt_regs(target);
266 int ret; 285 u32 uregs[ELF_NGREG];
286 unsigned start, num_regs, i;
287 int err;
288
289 start = pos / sizeof(u32);
290 num_regs = count / sizeof(u32);
291
292 if (start + num_regs > ELF_NGREG)
293 return -EIO;
294
295 err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0,
296 sizeof(uregs));
297 if (err)
298 return err;
299
300 for (i = start; i < num_regs; i++) {
301 /*
302 * Cast all values to signed here so that if this is a 64-bit
303 * kernel, the supplied 32-bit values will be sign extended.
304 */
305 switch (i) {
306 case MIPS32_EF_R1 ... MIPS32_EF_R25:
307 /* k0/k1 are ignored. */
308 case MIPS32_EF_R28 ... MIPS32_EF_R31:
309 regs->regs[i - MIPS32_EF_R0] = (s32)uregs[i];
310 break;
311 case MIPS32_EF_LO:
312 regs->lo = (s32)uregs[i];
313 break;
314 case MIPS32_EF_HI:
315 regs->hi = (s32)uregs[i];
316 break;
317 case MIPS32_EF_CP0_EPC:
318 regs->cp0_epc = (s32)uregs[i];
319 break;
320 }
321 }
322
323 return 0;
324}
325
326#endif /* CONFIG_32BIT || CONFIG_MIPS32_O32 */
327
328#ifdef CONFIG_64BIT
329
330static int gpr64_get(struct task_struct *target,
331 const struct user_regset *regset,
332 unsigned int pos, unsigned int count,
333 void *kbuf, void __user *ubuf)
334{
335 struct pt_regs *regs = task_pt_regs(target);
336 u64 uregs[ELF_NGREG] = {};
337 unsigned i;
338
339 for (i = MIPS64_EF_R1; i <= MIPS64_EF_R31; i++) {
340 /* k0/k1 are copied as zero. */
341 if (i == MIPS64_EF_R26 || i == MIPS64_EF_R27)
342 continue;
343
344 uregs[i] = regs->regs[i - MIPS64_EF_R0];
345 }
346
347 uregs[MIPS64_EF_LO] = regs->lo;
348 uregs[MIPS64_EF_HI] = regs->hi;
349 uregs[MIPS64_EF_CP0_EPC] = regs->cp0_epc;
350 uregs[MIPS64_EF_CP0_BADVADDR] = regs->cp0_badvaddr;
351 uregs[MIPS64_EF_CP0_STATUS] = regs->cp0_status;
352 uregs[MIPS64_EF_CP0_CAUSE] = regs->cp0_cause;
353
354 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, uregs, 0,
355 sizeof(uregs));
356}
267 357
268 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 358static int gpr64_set(struct task_struct *target,
269 &newregs, 359 const struct user_regset *regset,
270 0, sizeof(newregs)); 360 unsigned int pos, unsigned int count,
271 if (ret) 361 const void *kbuf, const void __user *ubuf)
272 return ret; 362{
363 struct pt_regs *regs = task_pt_regs(target);
364 u64 uregs[ELF_NGREG];
365 unsigned start, num_regs, i;
366 int err;
367
368 start = pos / sizeof(u64);
369 num_regs = count / sizeof(u64);
273 370
274 *task_pt_regs(target) = newregs; 371 if (start + num_regs > ELF_NGREG)
372 return -EIO;
373
374 err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, uregs, 0,
375 sizeof(uregs));
376 if (err)
377 return err;
378
379 for (i = start; i < num_regs; i++) {
380 switch (i) {
381 case MIPS64_EF_R1 ... MIPS64_EF_R25:
382 /* k0/k1 are ignored. */
383 case MIPS64_EF_R28 ... MIPS64_EF_R31:
384 regs->regs[i - MIPS64_EF_R0] = uregs[i];
385 break;
386 case MIPS64_EF_LO:
387 regs->lo = uregs[i];
388 break;
389 case MIPS64_EF_HI:
390 regs->hi = uregs[i];
391 break;
392 case MIPS64_EF_CP0_EPC:
393 regs->cp0_epc = uregs[i];
394 break;
395 }
396 }
275 397
276 return 0; 398 return 0;
277} 399}
278 400
401#endif /* CONFIG_64BIT */
402
279static int fpr_get(struct task_struct *target, 403static int fpr_get(struct task_struct *target,
280 const struct user_regset *regset, 404 const struct user_regset *regset,
281 unsigned int pos, unsigned int count, 405 unsigned int pos, unsigned int count,
@@ -337,14 +461,16 @@ enum mips_regset {
337 REGSET_FPR, 461 REGSET_FPR,
338}; 462};
339 463
464#if defined(CONFIG_32BIT) || defined(CONFIG_MIPS32_O32)
465
340static const struct user_regset mips_regsets[] = { 466static const struct user_regset mips_regsets[] = {
341 [REGSET_GPR] = { 467 [REGSET_GPR] = {
342 .core_note_type = NT_PRSTATUS, 468 .core_note_type = NT_PRSTATUS,
343 .n = ELF_NGREG, 469 .n = ELF_NGREG,
344 .size = sizeof(unsigned int), 470 .size = sizeof(unsigned int),
345 .align = sizeof(unsigned int), 471 .align = sizeof(unsigned int),
346 .get = gpr_get, 472 .get = gpr32_get,
347 .set = gpr_set, 473 .set = gpr32_set,
348 }, 474 },
349 [REGSET_FPR] = { 475 [REGSET_FPR] = {
350 .core_note_type = NT_PRFPREG, 476 .core_note_type = NT_PRFPREG,
@@ -364,14 +490,18 @@ static const struct user_regset_view user_mips_view = {
364 .n = ARRAY_SIZE(mips_regsets), 490 .n = ARRAY_SIZE(mips_regsets),
365}; 491};
366 492
493#endif /* CONFIG_32BIT || CONFIG_MIPS32_O32 */
494
495#ifdef CONFIG_64BIT
496
367static const struct user_regset mips64_regsets[] = { 497static const struct user_regset mips64_regsets[] = {
368 [REGSET_GPR] = { 498 [REGSET_GPR] = {
369 .core_note_type = NT_PRSTATUS, 499 .core_note_type = NT_PRSTATUS,
370 .n = ELF_NGREG, 500 .n = ELF_NGREG,
371 .size = sizeof(unsigned long), 501 .size = sizeof(unsigned long),
372 .align = sizeof(unsigned long), 502 .align = sizeof(unsigned long),
373 .get = gpr_get, 503 .get = gpr64_get,
374 .set = gpr_set, 504 .set = gpr64_set,
375 }, 505 },
376 [REGSET_FPR] = { 506 [REGSET_FPR] = {
377 .core_note_type = NT_PRFPREG, 507 .core_note_type = NT_PRFPREG,
@@ -384,25 +514,26 @@ static const struct user_regset mips64_regsets[] = {
384}; 514};
385 515
386static const struct user_regset_view user_mips64_view = { 516static const struct user_regset_view user_mips64_view = {
387 .name = "mips", 517 .name = "mips64",
388 .e_machine = ELF_ARCH, 518 .e_machine = ELF_ARCH,
389 .ei_osabi = ELF_OSABI, 519 .ei_osabi = ELF_OSABI,
390 .regsets = mips64_regsets, 520 .regsets = mips64_regsets,
391 .n = ARRAY_SIZE(mips_regsets), 521 .n = ARRAY_SIZE(mips64_regsets),
392}; 522};
393 523
524#endif /* CONFIG_64BIT */
525
394const struct user_regset_view *task_user_regset_view(struct task_struct *task) 526const struct user_regset_view *task_user_regset_view(struct task_struct *task)
395{ 527{
396#ifdef CONFIG_32BIT 528#ifdef CONFIG_32BIT
397 return &user_mips_view; 529 return &user_mips_view;
398#endif 530#else
399
400#ifdef CONFIG_MIPS32_O32 531#ifdef CONFIG_MIPS32_O32
401 if (test_thread_flag(TIF_32BIT_REGS)) 532 if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
402 return &user_mips_view; 533 return &user_mips_view;
403#endif 534#endif
404
405 return &user_mips64_view; 535 return &user_mips64_view;
536#endif
406} 537}
407 538
408long arch_ptrace(struct task_struct *child, long request, 539long arch_ptrace(struct task_struct *child, long request,
@@ -480,7 +611,7 @@ long arch_ptrace(struct task_struct *child, long request,
480 break; 611 break;
481 case FPC_EIR: 612 case FPC_EIR:
482 /* implementation / version register */ 613 /* implementation / version register */
483 tmp = current_cpu_data.fpu_id; 614 tmp = boot_cpu_data.fpu_id;
484 break; 615 break;
485 case DSP_BASE ... DSP_BASE + 5: { 616 case DSP_BASE ... DSP_BASE + 5: {
486 dspreg_t *dregs; 617 dspreg_t *dregs;
@@ -565,7 +696,7 @@ long arch_ptrace(struct task_struct *child, long request,
565 break; 696 break;
566#endif 697#endif
567 case FPC_CSR: 698 case FPC_CSR:
568 child->thread.fpu.fcr31 = data; 699 child->thread.fpu.fcr31 = data & ~FPU_CSR_ALL_X;
569 break; 700 break;
570 case DSP_BASE ... DSP_BASE + 5: { 701 case DSP_BASE ... DSP_BASE + 5: {
571 dspreg_t *dregs; 702 dspreg_t *dregs;
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index b40c3ca60ee5..283b5a1967d1 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -22,7 +22,6 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/ptrace.h> 23#include <linux/ptrace.h>
24#include <linux/smp.h> 24#include <linux/smp.h>
25#include <linux/user.h>
26#include <linux/security.h> 25#include <linux/security.h>
27 26
28#include <asm/cpu.h> 27#include <asm/cpu.h>
@@ -32,6 +31,7 @@
32#include <asm/mipsmtregs.h> 31#include <asm/mipsmtregs.h>
33#include <asm/pgtable.h> 32#include <asm/pgtable.h>
34#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/reg.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#include <asm/bootinfo.h> 36#include <asm/bootinfo.h>
37 37
@@ -129,7 +129,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
129 break; 129 break;
130 case FPC_EIR: 130 case FPC_EIR:
131 /* implementation / version register */ 131 /* implementation / version register */
132 tmp = current_cpu_data.fpu_id; 132 tmp = boot_cpu_data.fpu_id;
133 break; 133 break;
134 case DSP_BASE ... DSP_BASE + 5: { 134 case DSP_BASE ... DSP_BASE + 5: {
135 dspreg_t *dregs; 135 dspreg_t *dregs;
@@ -256,11 +256,13 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
256 } 256 }
257 257
258 case PTRACE_GETREGS: 258 case PTRACE_GETREGS:
259 ret = ptrace_getregs(child, (__s64 __user *) (__u64) data); 259 ret = ptrace_getregs(child,
260 (struct user_pt_regs __user *) (__u64) data);
260 break; 261 break;
261 262
262 case PTRACE_SETREGS: 263 case PTRACE_SETREGS:
263 ret = ptrace_setregs(child, (__s64 __user *) (__u64) data); 264 ret = ptrace_setregs(child,
265 (struct user_pt_regs __user *) (__u64) data);
264 break; 266 break;
265 267
266 case PTRACE_GETFPREGS: 268 case PTRACE_GETFPREGS:
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 81ca3f70fe29..4c4ec1812420 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -64,8 +64,10 @@
64 /* Check whether we're saving scalar or vector context. */ 64 /* Check whether we're saving scalar or vector context. */
65 bgtz a3, 1f 65 bgtz a3, 1f
66 66
67 /* Save 128b MSA vector context. */ 67 /* Save 128b MSA vector context + scalar FP control & status. */
68 cfc1 t1, fcr31
68 msa_save_all a0 69 msa_save_all a0
70 sw t1, THREAD_FCR31(a0)
69 b 2f 71 b 2f
70 72
711: /* Save 32b/64b scalar FP context. */ 731: /* Save 32b/64b scalar FP context. */
@@ -142,6 +144,11 @@ LEAF(_restore_msa)
142 jr ra 144 jr ra
143 END(_restore_msa) 145 END(_restore_msa)
144 146
147LEAF(_init_msa_upper)
148 msa_init_all_upper
149 jr ra
150 END(_init_msa_upper)
151
145#endif 152#endif
146 153
147/* 154/*
diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c
index 758fb3cd2326..d26dcc4b46e7 100644
--- a/arch/mips/kernel/rtlx-cmp.c
+++ b/arch/mips/kernel/rtlx-cmp.c
@@ -77,6 +77,9 @@ int __init rtlx_module_init(void)
77 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, 77 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
78 "%s%d", RTLX_MODULE_NAME, i); 78 "%s%d", RTLX_MODULE_NAME, i);
79 if (IS_ERR(dev)) { 79 if (IS_ERR(dev)) {
80 while (i--)
81 device_destroy(mt_class, MKDEV(major, i));
82
80 err = PTR_ERR(dev); 83 err = PTR_ERR(dev);
81 goto out_chrdev; 84 goto out_chrdev;
82 } 85 }
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c
index 5a66b975989e..cb95470e2e69 100644
--- a/arch/mips/kernel/rtlx-mt.c
+++ b/arch/mips/kernel/rtlx-mt.c
@@ -103,6 +103,9 @@ int __init rtlx_module_init(void)
103 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, 103 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
104 "%s%d", RTLX_MODULE_NAME, i); 104 "%s%d", RTLX_MODULE_NAME, i);
105 if (IS_ERR(dev)) { 105 if (IS_ERR(dev)) {
106 while (i--)
107 device_destroy(mt_class, MKDEV(major, i));
108
106 err = PTR_ERR(dev); 109 err = PTR_ERR(dev);
107 goto out_chrdev; 110 goto out_chrdev;
108 } 111 }
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 3245474f19d5..f93b4cbec739 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -67,8 +67,6 @@ NESTED(handle_sys, PT_SIZE, sp)
67 67
68 /* 68 /*
69 * Ok, copy the args from the luser stack to the kernel stack. 69 * Ok, copy the args from the luser stack to the kernel stack.
70 * t3 is the precomputed number of instruction bytes needed to
71 * load or store arguments 6-8.
72 */ 70 */
73 71
74 .set push 72 .set push
@@ -495,8 +493,8 @@ EXPORT(sys_call_table)
495 PTR sys_tgkill 493 PTR sys_tgkill
496 PTR sys_utimes 494 PTR sys_utimes
497 PTR sys_mbind 495 PTR sys_mbind
498 PTR sys_ni_syscall /* sys_get_mempolicy */ 496 PTR sys_get_mempolicy
499 PTR sys_ni_syscall /* 4270 sys_set_mempolicy */ 497 PTR sys_set_mempolicy /* 4270 */
500 PTR sys_mq_open 498 PTR sys_mq_open
501 PTR sys_mq_unlink 499 PTR sys_mq_unlink
502 PTR sys_mq_timedsend 500 PTR sys_mq_timedsend
@@ -578,3 +576,4 @@ EXPORT(sys_call_table)
578 PTR sys_sched_setattr 576 PTR sys_sched_setattr
579 PTR sys_sched_getattr /* 4350 */ 577 PTR sys_sched_getattr /* 4350 */
580 PTR sys_renameat2 578 PTR sys_renameat2
579 PTR sys_seccomp
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index be2fedd4ae33..03ebd9979ad2 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -347,8 +347,8 @@ EXPORT(sys_call_table)
347 PTR sys_tgkill /* 5225 */ 347 PTR sys_tgkill /* 5225 */
348 PTR sys_utimes 348 PTR sys_utimes
349 PTR sys_mbind 349 PTR sys_mbind
350 PTR sys_ni_syscall /* sys_get_mempolicy */ 350 PTR sys_get_mempolicy
351 PTR sys_ni_syscall /* sys_set_mempolicy */ 351 PTR sys_set_mempolicy
352 PTR sys_mq_open /* 5230 */ 352 PTR sys_mq_open /* 5230 */
353 PTR sys_mq_unlink 353 PTR sys_mq_unlink
354 PTR sys_mq_timedsend 354 PTR sys_mq_timedsend
@@ -431,4 +431,5 @@ EXPORT(sys_call_table)
431 PTR sys_sched_setattr 431 PTR sys_sched_setattr
432 PTR sys_sched_getattr /* 5310 */ 432 PTR sys_sched_getattr /* 5310 */
433 PTR sys_renameat2 433 PTR sys_renameat2
434 PTR sys_seccomp
434 .size sys_call_table,.-sys_call_table 435 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index c1dbcda4b816..ebc9228e2e15 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -162,7 +162,7 @@ EXPORT(sysn32_call_table)
162 PTR sys_getpeername 162 PTR sys_getpeername
163 PTR sys_socketpair 163 PTR sys_socketpair
164 PTR compat_sys_setsockopt 164 PTR compat_sys_setsockopt
165 PTR sys_getsockopt 165 PTR compat_sys_getsockopt
166 PTR __sys_clone /* 6055 */ 166 PTR __sys_clone /* 6055 */
167 PTR __sys_fork 167 PTR __sys_fork
168 PTR compat_sys_execve 168 PTR compat_sys_execve
@@ -339,9 +339,9 @@ EXPORT(sysn32_call_table)
339 PTR compat_sys_clock_nanosleep 339 PTR compat_sys_clock_nanosleep
340 PTR sys_tgkill 340 PTR sys_tgkill
341 PTR compat_sys_utimes /* 6230 */ 341 PTR compat_sys_utimes /* 6230 */
342 PTR sys_ni_syscall /* sys_mbind */ 342 PTR compat_sys_mbind
343 PTR sys_ni_syscall /* sys_get_mempolicy */ 343 PTR compat_sys_get_mempolicy
344 PTR sys_ni_syscall /* sys_set_mempolicy */ 344 PTR compat_sys_set_mempolicy
345 PTR compat_sys_mq_open 345 PTR compat_sys_mq_open
346 PTR sys_mq_unlink /* 6235 */ 346 PTR sys_mq_unlink /* 6235 */
347 PTR compat_sys_mq_timedsend 347 PTR compat_sys_mq_timedsend
@@ -358,7 +358,7 @@ EXPORT(sysn32_call_table)
358 PTR sys_inotify_init 358 PTR sys_inotify_init
359 PTR sys_inotify_add_watch 359 PTR sys_inotify_add_watch
360 PTR sys_inotify_rm_watch 360 PTR sys_inotify_rm_watch
361 PTR sys_migrate_pages /* 6250 */ 361 PTR compat_sys_migrate_pages /* 6250 */
362 PTR sys_openat 362 PTR sys_openat
363 PTR sys_mkdirat 363 PTR sys_mkdirat
364 PTR sys_mknodat 364 PTR sys_mknodat
@@ -379,7 +379,7 @@ EXPORT(sysn32_call_table)
379 PTR sys_sync_file_range 379 PTR sys_sync_file_range
380 PTR sys_tee 380 PTR sys_tee
381 PTR compat_sys_vmsplice /* 6270 */ 381 PTR compat_sys_vmsplice /* 6270 */
382 PTR sys_move_pages 382 PTR compat_sys_move_pages
383 PTR compat_sys_set_robust_list 383 PTR compat_sys_set_robust_list
384 PTR compat_sys_get_robust_list 384 PTR compat_sys_get_robust_list
385 PTR compat_sys_kexec_load 385 PTR compat_sys_kexec_load
@@ -424,4 +424,5 @@ EXPORT(sysn32_call_table)
424 PTR sys_sched_setattr 424 PTR sys_sched_setattr
425 PTR sys_sched_getattr 425 PTR sys_sched_getattr
426 PTR sys_renameat2 /* 6315 */ 426 PTR sys_renameat2 /* 6315 */
427 PTR sys_seccomp
427 .size sysn32_call_table,.-sysn32_call_table 428 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index f1343ccd7ed7..13b964fddc4a 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -473,9 +473,9 @@ EXPORT(sys32_call_table)
473 PTR compat_sys_clock_nanosleep /* 4265 */ 473 PTR compat_sys_clock_nanosleep /* 4265 */
474 PTR sys_tgkill 474 PTR sys_tgkill
475 PTR compat_sys_utimes 475 PTR compat_sys_utimes
476 PTR sys_ni_syscall /* sys_mbind */ 476 PTR compat_sys_mbind
477 PTR sys_ni_syscall /* sys_get_mempolicy */ 477 PTR compat_sys_get_mempolicy
478 PTR sys_ni_syscall /* 4270 sys_set_mempolicy */ 478 PTR compat_sys_set_mempolicy /* 4270 */
479 PTR compat_sys_mq_open 479 PTR compat_sys_mq_open
480 PTR sys_mq_unlink 480 PTR sys_mq_unlink
481 PTR compat_sys_mq_timedsend 481 PTR compat_sys_mq_timedsend
@@ -492,7 +492,7 @@ EXPORT(sys32_call_table)
492 PTR sys_inotify_init 492 PTR sys_inotify_init
493 PTR sys_inotify_add_watch /* 4285 */ 493 PTR sys_inotify_add_watch /* 4285 */
494 PTR sys_inotify_rm_watch 494 PTR sys_inotify_rm_watch
495 PTR sys_migrate_pages 495 PTR compat_sys_migrate_pages
496 PTR compat_sys_openat 496 PTR compat_sys_openat
497 PTR sys_mkdirat 497 PTR sys_mkdirat
498 PTR sys_mknodat /* 4290 */ 498 PTR sys_mknodat /* 4290 */
@@ -557,4 +557,5 @@ EXPORT(sys32_call_table)
557 PTR sys_sched_setattr 557 PTR sys_sched_setattr
558 PTR sys_sched_getattr /* 4350 */ 558 PTR sys_sched_getattr /* 4350 */
559 PTR sys_renameat2 559 PTR sys_renameat2
560 PTR sys_seccomp
560 .size sys32_call_table,.-sys32_call_table 561 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a842154d57dc..7c1fe2b42d40 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -282,7 +282,7 @@ static unsigned long __init init_initrd(void)
282 * Initialize the bootmem allocator. It also setup initrd related data 282 * Initialize the bootmem allocator. It also setup initrd related data
283 * if needed. 283 * if needed.
284 */ 284 */
285#ifdef CONFIG_SGI_IP27 285#if defined(CONFIG_SGI_IP27) || (defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_NUMA))
286 286
287static void __init bootmem_init(void) 287static void __init bootmem_init(void)
288{ 288{
@@ -729,6 +729,25 @@ static void __init resource_init(void)
729 } 729 }
730} 730}
731 731
732#ifdef CONFIG_SMP
733static void __init prefill_possible_map(void)
734{
735 int i, possible = num_possible_cpus();
736
737 if (possible > nr_cpu_ids)
738 possible = nr_cpu_ids;
739
740 for (i = 0; i < possible; i++)
741 set_cpu_possible(i, true);
742 for (; i < NR_CPUS; i++)
743 set_cpu_possible(i, false);
744
745 nr_cpu_ids = possible;
746}
747#else
748static inline void prefill_possible_map(void) {}
749#endif
750
732void __init setup_arch(char **cmdline_p) 751void __init setup_arch(char **cmdline_p)
733{ 752{
734 cpu_probe(); 753 cpu_probe();
@@ -752,6 +771,7 @@ void __init setup_arch(char **cmdline_p)
752 771
753 resource_init(); 772 resource_init();
754 plat_smp_setup(); 773 plat_smp_setup();
774 prefill_possible_map();
755 775
756 cpu_cache_init(); 776 cpu_cache_init();
757} 777}
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
index 9c60d09e62a7..06805e09bcd3 100644
--- a/arch/mips/kernel/signal-common.h
+++ b/arch/mips/kernel/signal-common.h
@@ -22,7 +22,7 @@
22/* 22/*
23 * Determine which stack to use.. 23 * Determine which stack to use..
24 */ 24 */
25extern void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 25extern void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
26 size_t frame_size); 26 size_t frame_size);
27/* Check and clear pending FPU exceptions in saved CSR */ 27/* Check and clear pending FPU exceptions in saved CSR */
28extern int fpcsr_pending(unsigned int __user *fpcsr); 28extern int fpcsr_pending(unsigned int __user *fpcsr);
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 9e60d117e41e..1d57605e4615 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -280,7 +280,7 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
280 return err; 280 return err;
281} 281}
282 282
283void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 283void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
284 size_t frame_size) 284 size_t frame_size)
285{ 285{
286 unsigned long sp; 286 unsigned long sp;
@@ -295,9 +295,7 @@ void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
295 */ 295 */
296 sp -= 32; 296 sp -= 32;
297 297
298 /* This is the X/Open sanctioned signal stack switching. */ 298 sp = sigsp(sp, ksig);
299 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
300 sp = current->sas_ss_sp + current->sas_ss_size;
301 299
302 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK)); 300 return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK));
303} 301}
@@ -428,20 +426,20 @@ badframe:
428} 426}
429 427
430#ifdef CONFIG_TRAD_SIGNALS 428#ifdef CONFIG_TRAD_SIGNALS
431static int setup_frame(void *sig_return, struct k_sigaction *ka, 429static int setup_frame(void *sig_return, struct ksignal *ksig,
432 struct pt_regs *regs, int signr, sigset_t *set) 430 struct pt_regs *regs, sigset_t *set)
433{ 431{
434 struct sigframe __user *frame; 432 struct sigframe __user *frame;
435 int err = 0; 433 int err = 0;
436 434
437 frame = get_sigframe(ka, regs, sizeof(*frame)); 435 frame = get_sigframe(ksig, regs, sizeof(*frame));
438 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 436 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
439 goto give_sigsegv; 437 return -EFAULT;
440 438
441 err |= setup_sigcontext(regs, &frame->sf_sc); 439 err |= setup_sigcontext(regs, &frame->sf_sc);
442 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set)); 440 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
443 if (err) 441 if (err)
444 goto give_sigsegv; 442 return -EFAULT;
445 443
446 /* 444 /*
447 * Arguments to signal handler: 445 * Arguments to signal handler:
@@ -453,37 +451,32 @@ static int setup_frame(void *sig_return, struct k_sigaction *ka,
453 * $25 and c0_epc point to the signal handler, $29 points to the 451 * $25 and c0_epc point to the signal handler, $29 points to the
454 * struct sigframe. 452 * struct sigframe.
455 */ 453 */
456 regs->regs[ 4] = signr; 454 regs->regs[ 4] = ksig->sig;
457 regs->regs[ 5] = 0; 455 regs->regs[ 5] = 0;
458 regs->regs[ 6] = (unsigned long) &frame->sf_sc; 456 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
459 regs->regs[29] = (unsigned long) frame; 457 regs->regs[29] = (unsigned long) frame;
460 regs->regs[31] = (unsigned long) sig_return; 458 regs->regs[31] = (unsigned long) sig_return;
461 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; 459 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
462 460
463 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", 461 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
464 current->comm, current->pid, 462 current->comm, current->pid,
465 frame, regs->cp0_epc, regs->regs[31]); 463 frame, regs->cp0_epc, regs->regs[31]);
466 return 0; 464 return 0;
467
468give_sigsegv:
469 force_sigsegv(signr, current);
470 return -EFAULT;
471} 465}
472#endif 466#endif
473 467
474static int setup_rt_frame(void *sig_return, struct k_sigaction *ka, 468static int setup_rt_frame(void *sig_return, struct ksignal *ksig,
475 struct pt_regs *regs, int signr, sigset_t *set, 469 struct pt_regs *regs, sigset_t *set)
476 siginfo_t *info)
477{ 470{
478 struct rt_sigframe __user *frame; 471 struct rt_sigframe __user *frame;
479 int err = 0; 472 int err = 0;
480 473
481 frame = get_sigframe(ka, regs, sizeof(*frame)); 474 frame = get_sigframe(ksig, regs, sizeof(*frame));
482 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 475 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
483 goto give_sigsegv; 476 return -EFAULT;
484 477
485 /* Create siginfo. */ 478 /* Create siginfo. */
486 err |= copy_siginfo_to_user(&frame->rs_info, info); 479 err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info);
487 480
488 /* Create the ucontext. */ 481 /* Create the ucontext. */
489 err |= __put_user(0, &frame->rs_uc.uc_flags); 482 err |= __put_user(0, &frame->rs_uc.uc_flags);
@@ -493,7 +486,7 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
493 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 486 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
494 487
495 if (err) 488 if (err)
496 goto give_sigsegv; 489 return -EFAULT;
497 490
498 /* 491 /*
499 * Arguments to signal handler: 492 * Arguments to signal handler:
@@ -505,22 +498,18 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
505 * $25 and c0_epc point to the signal handler, $29 points to 498 * $25 and c0_epc point to the signal handler, $29 points to
506 * the struct rt_sigframe. 499 * the struct rt_sigframe.
507 */ 500 */
508 regs->regs[ 4] = signr; 501 regs->regs[ 4] = ksig->sig;
509 regs->regs[ 5] = (unsigned long) &frame->rs_info; 502 regs->regs[ 5] = (unsigned long) &frame->rs_info;
510 regs->regs[ 6] = (unsigned long) &frame->rs_uc; 503 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
511 regs->regs[29] = (unsigned long) frame; 504 regs->regs[29] = (unsigned long) frame;
512 regs->regs[31] = (unsigned long) sig_return; 505 regs->regs[31] = (unsigned long) sig_return;
513 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; 506 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
514 507
515 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", 508 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
516 current->comm, current->pid, 509 current->comm, current->pid,
517 frame, regs->cp0_epc, regs->regs[31]); 510 frame, regs->cp0_epc, regs->regs[31]);
518 511
519 return 0; 512 return 0;
520
521give_sigsegv:
522 force_sigsegv(signr, current);
523 return -EFAULT;
524} 513}
525 514
526struct mips_abi mips_abi = { 515struct mips_abi mips_abi = {
@@ -534,8 +523,7 @@ struct mips_abi mips_abi = {
534 .restart = __NR_restart_syscall 523 .restart = __NR_restart_syscall
535}; 524};
536 525
537static void handle_signal(unsigned long sig, siginfo_t *info, 526static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
538 struct k_sigaction *ka, struct pt_regs *regs)
539{ 527{
540 sigset_t *oldset = sigmask_to_save(); 528 sigset_t *oldset = sigmask_to_save();
541 int ret; 529 int ret;
@@ -557,7 +545,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
557 regs->regs[2] = EINTR; 545 regs->regs[2] = EINTR;
558 break; 546 break;
559 case ERESTARTSYS: 547 case ERESTARTSYS:
560 if (!(ka->sa.sa_flags & SA_RESTART)) { 548 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
561 regs->regs[2] = EINTR; 549 regs->regs[2] = EINTR;
562 break; 550 break;
563 } 551 }
@@ -571,29 +559,23 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
571 regs->regs[0] = 0; /* Don't deal with this again. */ 559 regs->regs[0] = 0; /* Don't deal with this again. */
572 } 560 }
573 561
574 if (sig_uses_siginfo(ka)) 562 if (sig_uses_siginfo(&ksig->ka))
575 ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset, 563 ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset,
576 ka, regs, sig, oldset, info); 564 ksig, regs, oldset);
577 else 565 else
578 ret = abi->setup_frame(vdso + abi->signal_return_offset, 566 ret = abi->setup_frame(vdso + abi->signal_return_offset, ksig,
579 ka, regs, sig, oldset); 567 regs, oldset);
580
581 if (ret)
582 return;
583 568
584 signal_delivered(sig, info, ka, regs, 0); 569 signal_setup_done(ret, ksig, 0);
585} 570}
586 571
587static void do_signal(struct pt_regs *regs) 572static void do_signal(struct pt_regs *regs)
588{ 573{
589 struct k_sigaction ka; 574 struct ksignal ksig;
590 siginfo_t info;
591 int signr;
592 575
593 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 576 if (get_signal(&ksig)) {
594 if (signr > 0) {
595 /* Whee! Actually deliver the signal. */ 577 /* Whee! Actually deliver the signal. */
596 handle_signal(signr, &info, &ka, regs); 578 handle_signal(&ksig, regs);
597 return; 579 return;
598 } 580 }
599 581
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index bae2e6ee2109..d69179c0d49d 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -490,21 +490,21 @@ badframe:
490 force_sig(SIGSEGV, current); 490 force_sig(SIGSEGV, current);
491} 491}
492 492
493static int setup_frame_32(void *sig_return, struct k_sigaction *ka, 493static int setup_frame_32(void *sig_return, struct ksignal *ksig,
494 struct pt_regs *regs, int signr, sigset_t *set) 494 struct pt_regs *regs, sigset_t *set)
495{ 495{
496 struct sigframe32 __user *frame; 496 struct sigframe32 __user *frame;
497 int err = 0; 497 int err = 0;
498 498
499 frame = get_sigframe(ka, regs, sizeof(*frame)); 499 frame = get_sigframe(ksig, regs, sizeof(*frame));
500 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 500 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
501 goto give_sigsegv; 501 return -EFAULT;
502 502
503 err |= setup_sigcontext32(regs, &frame->sf_sc); 503 err |= setup_sigcontext32(regs, &frame->sf_sc);
504 err |= __copy_conv_sigset_to_user(&frame->sf_mask, set); 504 err |= __copy_conv_sigset_to_user(&frame->sf_mask, set);
505 505
506 if (err) 506 if (err)
507 goto give_sigsegv; 507 return -EFAULT;
508 508
509 /* 509 /*
510 * Arguments to signal handler: 510 * Arguments to signal handler:
@@ -516,37 +516,32 @@ static int setup_frame_32(void *sig_return, struct k_sigaction *ka,
516 * $25 and c0_epc point to the signal handler, $29 points to the 516 * $25 and c0_epc point to the signal handler, $29 points to the
517 * struct sigframe. 517 * struct sigframe.
518 */ 518 */
519 regs->regs[ 4] = signr; 519 regs->regs[ 4] = ksig->sig;
520 regs->regs[ 5] = 0; 520 regs->regs[ 5] = 0;
521 regs->regs[ 6] = (unsigned long) &frame->sf_sc; 521 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
522 regs->regs[29] = (unsigned long) frame; 522 regs->regs[29] = (unsigned long) frame;
523 regs->regs[31] = (unsigned long) sig_return; 523 regs->regs[31] = (unsigned long) sig_return;
524 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; 524 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
525 525
526 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", 526 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
527 current->comm, current->pid, 527 current->comm, current->pid,
528 frame, regs->cp0_epc, regs->regs[31]); 528 frame, regs->cp0_epc, regs->regs[31]);
529 529
530 return 0; 530 return 0;
531
532give_sigsegv:
533 force_sigsegv(signr, current);
534 return -EFAULT;
535} 531}
536 532
537static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka, 533static int setup_rt_frame_32(void *sig_return, struct ksignal *ksig,
538 struct pt_regs *regs, int signr, sigset_t *set, 534 struct pt_regs *regs, sigset_t *set)
539 siginfo_t *info)
540{ 535{
541 struct rt_sigframe32 __user *frame; 536 struct rt_sigframe32 __user *frame;
542 int err = 0; 537 int err = 0;
543 538
544 frame = get_sigframe(ka, regs, sizeof(*frame)); 539 frame = get_sigframe(ksig, regs, sizeof(*frame));
545 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 540 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
546 goto give_sigsegv; 541 return -EFAULT;
547 542
548 /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */ 543 /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */
549 err |= copy_siginfo_to_user32(&frame->rs_info, info); 544 err |= copy_siginfo_to_user32(&frame->rs_info, &ksig->info);
550 545
551 /* Create the ucontext. */ 546 /* Create the ucontext. */
552 err |= __put_user(0, &frame->rs_uc.uc_flags); 547 err |= __put_user(0, &frame->rs_uc.uc_flags);
@@ -556,7 +551,7 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
556 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); 551 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set);
557 552
558 if (err) 553 if (err)
559 goto give_sigsegv; 554 return -EFAULT;
560 555
561 /* 556 /*
562 * Arguments to signal handler: 557 * Arguments to signal handler:
@@ -568,22 +563,18 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
568 * $25 and c0_epc point to the signal handler, $29 points to 563 * $25 and c0_epc point to the signal handler, $29 points to
569 * the struct rt_sigframe32. 564 * the struct rt_sigframe32.
570 */ 565 */
571 regs->regs[ 4] = signr; 566 regs->regs[ 4] = ksig->sig;
572 regs->regs[ 5] = (unsigned long) &frame->rs_info; 567 regs->regs[ 5] = (unsigned long) &frame->rs_info;
573 regs->regs[ 6] = (unsigned long) &frame->rs_uc; 568 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
574 regs->regs[29] = (unsigned long) frame; 569 regs->regs[29] = (unsigned long) frame;
575 regs->regs[31] = (unsigned long) sig_return; 570 regs->regs[31] = (unsigned long) sig_return;
576 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; 571 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
577 572
578 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", 573 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
579 current->comm, current->pid, 574 current->comm, current->pid,
580 frame, regs->cp0_epc, regs->regs[31]); 575 frame, regs->cp0_epc, regs->regs[31]);
581 576
582 return 0; 577 return 0;
583
584give_sigsegv:
585 force_sigsegv(signr, current);
586 return -EFAULT;
587} 578}
588 579
589/* 580/*
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index b2241bb9cac1..f1d4751eead0 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -102,18 +102,18 @@ badframe:
102 force_sig(SIGSEGV, current); 102 force_sig(SIGSEGV, current);
103} 103}
104 104
105static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka, 105static int setup_rt_frame_n32(void *sig_return, struct ksignal *ksig,
106 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) 106 struct pt_regs *regs, sigset_t *set)
107{ 107{
108 struct rt_sigframe_n32 __user *frame; 108 struct rt_sigframe_n32 __user *frame;
109 int err = 0; 109 int err = 0;
110 110
111 frame = get_sigframe(ka, regs, sizeof(*frame)); 111 frame = get_sigframe(ksig, regs, sizeof(*frame));
112 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 112 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
113 goto give_sigsegv; 113 return -EFAULT;
114 114
115 /* Create siginfo. */ 115 /* Create siginfo. */
116 err |= copy_siginfo_to_user32(&frame->rs_info, info); 116 err |= copy_siginfo_to_user32(&frame->rs_info, &ksig->info);
117 117
118 /* Create the ucontext. */ 118 /* Create the ucontext. */
119 err |= __put_user(0, &frame->rs_uc.uc_flags); 119 err |= __put_user(0, &frame->rs_uc.uc_flags);
@@ -123,7 +123,7 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
123 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); 123 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set);
124 124
125 if (err) 125 if (err)
126 goto give_sigsegv; 126 return -EFAULT;
127 127
128 /* 128 /*
129 * Arguments to signal handler: 129 * Arguments to signal handler:
@@ -135,22 +135,18 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
135 * $25 and c0_epc point to the signal handler, $29 points to 135 * $25 and c0_epc point to the signal handler, $29 points to
136 * the struct rt_sigframe. 136 * the struct rt_sigframe.
137 */ 137 */
138 regs->regs[ 4] = signr; 138 regs->regs[ 4] = ksig->sig;
139 regs->regs[ 5] = (unsigned long) &frame->rs_info; 139 regs->regs[ 5] = (unsigned long) &frame->rs_info;
140 regs->regs[ 6] = (unsigned long) &frame->rs_uc; 140 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
141 regs->regs[29] = (unsigned long) frame; 141 regs->regs[29] = (unsigned long) frame;
142 regs->regs[31] = (unsigned long) sig_return; 142 regs->regs[31] = (unsigned long) sig_return;
143 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler; 143 regs->cp0_epc = regs->regs[25] = (unsigned long) ksig->ka.sa.sa_handler;
144 144
145 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n", 145 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
146 current->comm, current->pid, 146 current->comm, current->pid,
147 frame, regs->cp0_epc, regs->regs[31]); 147 frame, regs->cp0_epc, regs->regs[31]);
148 148
149 return 0; 149 return 0;
150
151give_sigsegv:
152 force_sigsegv(signr, current);
153 return -EFAULT;
154} 150}
155 151
156struct mips_abi mips_abi_n32 = { 152struct mips_abi mips_abi_n32 = {
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 949f2c6827a0..e6e16a1d4add 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -14,13 +14,14 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17#include <asm/cacheflush.h> 17#include <asm/bcache.h>
18#include <asm/gic.h> 18#include <asm/gic.h>
19#include <asm/mips-cm.h> 19#include <asm/mips-cm.h>
20#include <asm/mips-cpc.h> 20#include <asm/mips-cpc.h>
21#include <asm/mips_mt.h> 21#include <asm/mips_mt.h>
22#include <asm/mipsregs.h> 22#include <asm/mipsregs.h>
23#include <asm/pm-cps.h> 23#include <asm/pm-cps.h>
24#include <asm/r4kcache.h>
24#include <asm/smp-cps.h> 25#include <asm/smp-cps.h>
25#include <asm/time.h> 26#include <asm/time.h>
26#include <asm/uasm.h> 27#include <asm/uasm.h>
@@ -132,8 +133,11 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
132 entry_code = (u32 *)&mips_cps_core_entry; 133 entry_code = (u32 *)&mips_cps_core_entry;
133 UASM_i_LA(&entry_code, 3, (long)mips_cm_base); 134 UASM_i_LA(&entry_code, 3, (long)mips_cm_base);
134 uasm_i_addiu(&entry_code, 16, 0, cca); 135 uasm_i_addiu(&entry_code, 16, 0, cca);
135 dma_cache_wback_inv((unsigned long)&mips_cps_core_entry, 136 blast_dcache_range((unsigned long)&mips_cps_core_entry,
136 (void *)entry_code - (void *)&mips_cps_core_entry); 137 (unsigned long)entry_code);
138 bc_wback_inv((unsigned long)&mips_cps_core_entry,
139 (void *)entry_code - (void *)&mips_cps_core_entry);
140 __sync();
137 141
138 /* Allocate core boot configuration structs */ 142 /* Allocate core boot configuration structs */
139 mips_cps_core_bootcfg = kcalloc(ncores, sizeof(*mips_cps_core_bootcfg), 143 mips_cps_core_bootcfg = kcalloc(ncores, sizeof(*mips_cps_core_bootcfg),
@@ -360,7 +364,7 @@ void play_dead(void)
360static void wait_for_sibling_halt(void *ptr_cpu) 364static void wait_for_sibling_halt(void *ptr_cpu)
361{ 365{
362 unsigned cpu = (unsigned)ptr_cpu; 366 unsigned cpu = (unsigned)ptr_cpu;
363 unsigned vpe_id = cpu_data[cpu].vpe_id; 367 unsigned vpe_id = cpu_vpe_id(&cpu_data[cpu]);
364 unsigned halted; 368 unsigned halted;
365 unsigned long flags; 369 unsigned long flags;
366 370
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 3babf6e4f894..21f23add04f4 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -288,6 +288,7 @@ struct plat_smp_ops vsmp_smp_ops = {
288 .prepare_cpus = vsmp_prepare_cpus, 288 .prepare_cpus = vsmp_prepare_cpus,
289}; 289};
290 290
291#ifdef CONFIG_PROC_FS
291static int proc_cpuinfo_chain_call(struct notifier_block *nfb, 292static int proc_cpuinfo_chain_call(struct notifier_block *nfb,
292 unsigned long action_unused, void *data) 293 unsigned long action_unused, void *data)
293{ 294{
@@ -309,3 +310,4 @@ static int __init proc_cpuinfo_notifier_init(void)
309} 310}
310 311
311subsys_initcall(proc_cpuinfo_notifier_init); 312subsys_initcall(proc_cpuinfo_notifier_init);
313#endif
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 9bad52ede903..c94c4e92e17d 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -59,9 +59,16 @@ EXPORT_SYMBOL(smp_num_siblings);
59cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 59cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
60EXPORT_SYMBOL(cpu_sibling_map); 60EXPORT_SYMBOL(cpu_sibling_map);
61 61
62/* representing the core map of multi-core chips of each logical CPU */
63cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
64EXPORT_SYMBOL(cpu_core_map);
65
62/* representing cpus for which sibling maps can be computed */ 66/* representing cpus for which sibling maps can be computed */
63static cpumask_t cpu_sibling_setup_map; 67static cpumask_t cpu_sibling_setup_map;
64 68
69/* representing cpus for which core maps can be computed */
70static cpumask_t cpu_core_setup_map;
71
65cpumask_t cpu_coherent_mask; 72cpumask_t cpu_coherent_mask;
66 73
67static inline void set_cpu_sibling_map(int cpu) 74static inline void set_cpu_sibling_map(int cpu)
@@ -72,7 +79,8 @@ static inline void set_cpu_sibling_map(int cpu)
72 79
73 if (smp_num_siblings > 1) { 80 if (smp_num_siblings > 1) {
74 for_each_cpu_mask(i, cpu_sibling_setup_map) { 81 for_each_cpu_mask(i, cpu_sibling_setup_map) {
75 if (cpu_data[cpu].core == cpu_data[i].core) { 82 if (cpu_data[cpu].package == cpu_data[i].package &&
83 cpu_data[cpu].core == cpu_data[i].core) {
76 cpu_set(i, cpu_sibling_map[cpu]); 84 cpu_set(i, cpu_sibling_map[cpu]);
77 cpu_set(cpu, cpu_sibling_map[i]); 85 cpu_set(cpu, cpu_sibling_map[i]);
78 } 86 }
@@ -81,6 +89,20 @@ static inline void set_cpu_sibling_map(int cpu)
81 cpu_set(cpu, cpu_sibling_map[cpu]); 89 cpu_set(cpu, cpu_sibling_map[cpu]);
82} 90}
83 91
92static inline void set_cpu_core_map(int cpu)
93{
94 int i;
95
96 cpu_set(cpu, cpu_core_setup_map);
97
98 for_each_cpu_mask(i, cpu_core_setup_map) {
99 if (cpu_data[cpu].package == cpu_data[i].package) {
100 cpu_set(i, cpu_core_map[cpu]);
101 cpu_set(cpu, cpu_core_map[i]);
102 }
103 }
104}
105
84struct plat_smp_ops *mp_ops; 106struct plat_smp_ops *mp_ops;
85EXPORT_SYMBOL(mp_ops); 107EXPORT_SYMBOL(mp_ops);
86 108
@@ -122,6 +144,7 @@ asmlinkage void start_secondary(void)
122 set_cpu_online(cpu, true); 144 set_cpu_online(cpu, true);
123 145
124 set_cpu_sibling_map(cpu); 146 set_cpu_sibling_map(cpu);
147 set_cpu_core_map(cpu);
125 148
126 cpu_set(cpu, cpu_callin_map); 149 cpu_set(cpu, cpu_callin_map);
127 150
@@ -175,6 +198,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
175 current_thread_info()->cpu = 0; 198 current_thread_info()->cpu = 0;
176 mp_ops->prepare_cpus(max_cpus); 199 mp_ops->prepare_cpus(max_cpus);
177 set_cpu_sibling_map(0); 200 set_cpu_sibling_map(0);
201 set_cpu_core_map(0);
178#ifndef CONFIG_HOTPLUG_CPU 202#ifndef CONFIG_HOTPLUG_CPU
179 init_cpu_present(cpu_possible_mask); 203 init_cpu_present(cpu_possible_mask);
180#endif 204#endif
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 51706d6dd5b0..22b19c275044 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -90,6 +90,7 @@ extern asmlinkage void handle_mt(void);
90extern asmlinkage void handle_dsp(void); 90extern asmlinkage void handle_dsp(void);
91extern asmlinkage void handle_mcheck(void); 91extern asmlinkage void handle_mcheck(void);
92extern asmlinkage void handle_reserved(void); 92extern asmlinkage void handle_reserved(void);
93extern void tlb_do_page_fault_0(void);
93 94
94void (*board_be_init)(void); 95void (*board_be_init)(void);
95int (*board_be_handler)(struct pt_regs *regs, int is_fixup); 96int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
@@ -1088,13 +1089,19 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
1088 1089
1089static int enable_restore_fp_context(int msa) 1090static int enable_restore_fp_context(int msa)
1090{ 1091{
1091 int err, was_fpu_owner; 1092 int err, was_fpu_owner, prior_msa;
1092 1093
1093 if (!used_math()) { 1094 if (!used_math()) {
1094 /* First time FP context user. */ 1095 /* First time FP context user. */
1096 preempt_disable();
1095 err = init_fpu(); 1097 err = init_fpu();
1096 if (msa && !err) 1098 if (msa && !err) {
1097 enable_msa(); 1099 enable_msa();
1100 _init_msa_upper();
1101 set_thread_flag(TIF_USEDMSA);
1102 set_thread_flag(TIF_MSA_CTX_LIVE);
1103 }
1104 preempt_enable();
1098 if (!err) 1105 if (!err)
1099 set_used_math(); 1106 set_used_math();
1100 return err; 1107 return err;
@@ -1134,10 +1141,11 @@ static int enable_restore_fp_context(int msa)
1134 * This task is using or has previously used MSA. Thus we require 1141 * This task is using or has previously used MSA. Thus we require
1135 * that Status.FR == 1. 1142 * that Status.FR == 1.
1136 */ 1143 */
1144 preempt_disable();
1137 was_fpu_owner = is_fpu_owner(); 1145 was_fpu_owner = is_fpu_owner();
1138 err = own_fpu(0); 1146 err = own_fpu_inatomic(0);
1139 if (err) 1147 if (err)
1140 return err; 1148 goto out;
1141 1149
1142 enable_msa(); 1150 enable_msa();
1143 write_msa_csr(current->thread.fpu.msacsr); 1151 write_msa_csr(current->thread.fpu.msacsr);
@@ -1146,13 +1154,42 @@ static int enable_restore_fp_context(int msa)
1146 /* 1154 /*
1147 * If this is the first time that the task is using MSA and it has 1155 * If this is the first time that the task is using MSA and it has
1148 * previously used scalar FP in this time slice then we already nave 1156 * previously used scalar FP in this time slice then we already nave
1149 * FP context which we shouldn't clobber. 1157 * FP context which we shouldn't clobber. We do however need to clear
1158 * the upper 64b of each vector register so that this task has no
1159 * opportunity to see data left behind by another.
1150 */ 1160 */
1151 if (!test_and_set_thread_flag(TIF_MSA_CTX_LIVE) && was_fpu_owner) 1161 prior_msa = test_and_set_thread_flag(TIF_MSA_CTX_LIVE);
1152 return 0; 1162 if (!prior_msa && was_fpu_owner) {
1163 _init_msa_upper();
1164
1165 goto out;
1166 }
1167
1168 if (!prior_msa) {
1169 /*
1170 * Restore the least significant 64b of each vector register
1171 * from the existing scalar FP context.
1172 */
1173 _restore_fp(current);
1174
1175 /*
1176 * The task has not formerly used MSA, so clear the upper 64b
1177 * of each vector register such that it cannot see data left
1178 * behind by another task.
1179 */
1180 _init_msa_upper();
1181 } else {
1182 /* We need to restore the vector context. */
1183 restore_msa(current);
1184
1185 /* Restore the scalar FP control & status register */
1186 if (!was_fpu_owner)
1187 asm volatile("ctc1 %0, $31" : : "r"(current->thread.fpu.fcr31));
1188 }
1189
1190out:
1191 preempt_enable();
1153 1192
1154 /* We need to restore the vector context. */
1155 restore_msa(current);
1156 return 0; 1193 return 0;
1157} 1194}
1158 1195
@@ -2114,6 +2151,12 @@ void __init trap_init(void)
2114 set_except_vector(15, handle_fpe); 2151 set_except_vector(15, handle_fpe);
2115 2152
2116 set_except_vector(16, handle_ftlb); 2153 set_except_vector(16, handle_ftlb);
2154
2155 if (cpu_has_rixiex) {
2156 set_except_vector(19, tlb_do_page_fault_0);
2157 set_except_vector(20, tlb_do_page_fault_0);
2158 }
2159
2117 set_except_vector(21, handle_msa); 2160 set_except_vector(21, handle_msa);
2118 set_except_vector(22, handle_mdmx); 2161 set_except_vector(22, handle_mdmx);
2119 2162
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 2b3517214d6d..e11906dff885 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -690,7 +690,6 @@ static void emulate_load_store_insn(struct pt_regs *regs,
690 case sdc1_op: 690 case sdc1_op:
691 die_if_kernel("Unaligned FP access in kernel code", regs); 691 die_if_kernel("Unaligned FP access in kernel code", regs);
692 BUG_ON(!used_math()); 692 BUG_ON(!used_math());
693 BUG_ON(!is_fpu_owner());
694 693
695 lose_fpu(1); /* Save FPU state for the emulator. */ 694 lose_fpu(1); /* Save FPU state for the emulator. */
696 res = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1, 695 res = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index 4fda672cb58e..cd7114147ae7 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -886,7 +886,7 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
886 return VM_FAULT_SIGBUS; 886 return VM_FAULT_SIGBUS;
887} 887}
888 888
889int kvm_dev_ioctl_check_extension(long ext) 889int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
890{ 890{
891 int r; 891 int r;
892 892
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index e6a86ccc4421..1b91fc6a921b 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -60,8 +60,8 @@ config LEMOTE_MACH2F
60 These family machines include fuloong2f mini PC, yeeloong2f notebook, 60 These family machines include fuloong2f mini PC, yeeloong2f notebook,
61 LingLoong allinone PC and so forth. 61 LingLoong allinone PC and so forth.
62 62
63config LEMOTE_MACH3A 63config LOONGSON_MACH3X
64 bool "Lemote Loongson 3A family machines" 64 bool "Generic Loongson 3 family machines"
65 select ARCH_SPARSEMEM_ENABLE 65 select ARCH_SPARSEMEM_ENABLE
66 select GENERIC_ISA_DMA_SUPPORT_BROKEN 66 select GENERIC_ISA_DMA_SUPPORT_BROKEN
67 select BOOT_ELF32 67 select BOOT_ELF32
@@ -79,6 +79,7 @@ config LEMOTE_MACH3A
79 select SYS_HAS_EARLY_PRINTK 79 select SYS_HAS_EARLY_PRINTK
80 select SYS_SUPPORTS_SMP 80 select SYS_SUPPORTS_SMP
81 select SYS_SUPPORTS_HOTPLUG_CPU 81 select SYS_SUPPORTS_HOTPLUG_CPU
82 select SYS_SUPPORTS_NUMA
82 select SYS_SUPPORTS_64BIT_KERNEL 83 select SYS_SUPPORTS_64BIT_KERNEL
83 select SYS_SUPPORTS_HIGHMEM 84 select SYS_SUPPORTS_HIGHMEM
84 select SYS_SUPPORTS_LITTLE_ENDIAN 85 select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -86,8 +87,8 @@ config LEMOTE_MACH3A
86 select ZONE_DMA32 87 select ZONE_DMA32
87 select LEFI_FIRMWARE_INTERFACE 88 select LEFI_FIRMWARE_INTERFACE
88 help 89 help
89 Lemote Loongson 3A family machines utilize the 3A revision of 90 Generic Loongson 3 family machines utilize the 3A/3B revision
90 Loongson processor and RS780/SBX00 chipset. 91 of Loongson processor and RS780/SBX00 chipset.
91endchoice 92endchoice
92 93
93config CS5536 94config CS5536
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 6205372b6c2d..0ac20eb84ecc 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -30,4 +30,4 @@ platform-$(CONFIG_MACH_LOONGSON) += loongson/
30cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely 30cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
31load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000 31load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
32load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000 32load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
33load-$(CONFIG_CPU_LOONGSON3) += 0xffffffff80200000 33load-$(CONFIG_LOONGSON_MACH3X) += 0xffffffff80200000
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
index 0c543eae49bf..f15228550a22 100644
--- a/arch/mips/loongson/common/env.c
+++ b/arch/mips/loongson/common/env.c
@@ -27,6 +27,12 @@ EXPORT_SYMBOL(cpu_clock_freq);
27struct efi_memory_map_loongson *loongson_memmap; 27struct efi_memory_map_loongson *loongson_memmap;
28struct loongson_system_configuration loongson_sysconf; 28struct loongson_system_configuration loongson_sysconf;
29 29
30u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
31u64 loongson_freqctrl[MAX_PACKAGES];
32
33unsigned long long smp_group[4];
34int cpuhotplug_workaround = 0;
35
30#define parse_even_earlier(res, option, p) \ 36#define parse_even_earlier(res, option, p) \
31do { \ 37do { \
32 unsigned int tmp __maybe_unused; \ 38 unsigned int tmp __maybe_unused; \
@@ -77,9 +83,47 @@ void __init prom_init_env(void)
77 83
78 cpu_clock_freq = ecpu->cpu_clock_freq; 84 cpu_clock_freq = ecpu->cpu_clock_freq;
79 loongson_sysconf.cputype = ecpu->cputype; 85 loongson_sysconf.cputype = ecpu->cputype;
86 if (ecpu->cputype == Loongson_3A) {
87 loongson_sysconf.cores_per_node = 4;
88 loongson_sysconf.cores_per_package = 4;
89 smp_group[0] = 0x900000003ff01000;
90 smp_group[1] = 0x900010003ff01000;
91 smp_group[2] = 0x900020003ff01000;
92 smp_group[3] = 0x900030003ff01000;
93 loongson_chipcfg[0] = 0x900000001fe00180;
94 loongson_chipcfg[1] = 0x900010001fe00180;
95 loongson_chipcfg[2] = 0x900020001fe00180;
96 loongson_chipcfg[3] = 0x900030001fe00180;
97 loongson_sysconf.ht_control_base = 0x90000EFDFB000000;
98 } else if (ecpu->cputype == Loongson_3B) {
99 loongson_sysconf.cores_per_node = 4; /* One chip has 2 nodes */
100 loongson_sysconf.cores_per_package = 8;
101 smp_group[0] = 0x900000003ff01000;
102 smp_group[1] = 0x900010003ff05000;
103 smp_group[2] = 0x900020003ff09000;
104 smp_group[3] = 0x900030003ff0d000;
105 loongson_chipcfg[0] = 0x900000001fe00180;
106 loongson_chipcfg[1] = 0x900020001fe00180;
107 loongson_chipcfg[2] = 0x900040001fe00180;
108 loongson_chipcfg[3] = 0x900060001fe00180;
109 loongson_freqctrl[0] = 0x900000001fe001d0;
110 loongson_freqctrl[1] = 0x900020001fe001d0;
111 loongson_freqctrl[2] = 0x900040001fe001d0;
112 loongson_freqctrl[3] = 0x900060001fe001d0;
113 loongson_sysconf.ht_control_base = 0x90001EFDFB000000;
114 cpuhotplug_workaround = 1;
115 } else {
116 loongson_sysconf.cores_per_node = 1;
117 loongson_sysconf.cores_per_package = 1;
118 loongson_chipcfg[0] = 0x900000001fe00180;
119 }
120
80 loongson_sysconf.nr_cpus = ecpu->nr_cpus; 121 loongson_sysconf.nr_cpus = ecpu->nr_cpus;
81 if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0) 122 if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0)
82 loongson_sysconf.nr_cpus = NR_CPUS; 123 loongson_sysconf.nr_cpus = NR_CPUS;
124 loongson_sysconf.nr_nodes = (loongson_sysconf.nr_cpus +
125 loongson_sysconf.cores_per_node - 1) /
126 loongson_sysconf.cores_per_node;
83 127
84 loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr; 128 loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr;
85 loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr; 129 loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr;
@@ -93,7 +137,6 @@ void __init prom_init_env(void)
93 loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown; 137 loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;
94 loongson_sysconf.suspend_addr = boot_p->reset_system.DoSuspend; 138 loongson_sysconf.suspend_addr = boot_p->reset_system.DoSuspend;
95 139
96 loongson_sysconf.ht_control_base = 0x90000EFDFB000000;
97 loongson_sysconf.vgabios_addr = boot_p->efi.smbios.vga_bios; 140 loongson_sysconf.vgabios_addr = boot_p->efi.smbios.vga_bios;
98 pr_debug("Shutdown Addr: %llx, Restart Addr: %llx, VBIOS Addr: %llx\n", 141 pr_debug("Shutdown Addr: %llx, Restart Addr: %llx, VBIOS Addr: %llx\n",
99 loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr, 142 loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr,
@@ -111,6 +154,10 @@ void __init prom_init_env(void)
111 case PRID_REV_LOONGSON3A: 154 case PRID_REV_LOONGSON3A:
112 cpu_clock_freq = 900000000; 155 cpu_clock_freq = 900000000;
113 break; 156 break;
157 case PRID_REV_LOONGSON3B_R1:
158 case PRID_REV_LOONGSON3B_R2:
159 cpu_clock_freq = 1000000000;
160 break;
114 default: 161 default:
115 cpu_clock_freq = 100000000; 162 cpu_clock_freq = 100000000;
116 break; 163 break;
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson/common/init.c
index f37fe5413b73..f6af3aba4c86 100644
--- a/arch/mips/loongson/common/init.c
+++ b/arch/mips/loongson/common/init.c
@@ -30,7 +30,11 @@ void __init prom_init(void)
30 set_io_port_base((unsigned long) 30 set_io_port_base((unsigned long)
31 ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); 31 ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
32 32
33#ifdef CONFIG_NUMA
34 prom_init_numa_memory();
35#else
33 prom_init_memory(); 36 prom_init_memory();
37#endif
34 38
35 /*init the uart base address */ 39 /*init the uart base address */
36 prom_init_uart_base(); 40 prom_init_uart_base();
diff --git a/arch/mips/loongson/common/pm.c b/arch/mips/loongson/common/pm.c
index f55e07aee071..a6b67ccfc811 100644
--- a/arch/mips/loongson/common/pm.c
+++ b/arch/mips/loongson/common/pm.c
@@ -79,7 +79,7 @@ int __weak wakeup_loongson(void)
79static void wait_for_wakeup_events(void) 79static void wait_for_wakeup_events(void)
80{ 80{
81 while (!wakeup_loongson()) 81 while (!wakeup_loongson())
82 LOONGSON_CHIPCFG0 &= ~0x7; 82 LOONGSON_CHIPCFG(0) &= ~0x7;
83} 83}
84 84
85/* 85/*
@@ -102,15 +102,15 @@ static void loongson_suspend_enter(void)
102 102
103 stop_perf_counters(); 103 stop_perf_counters();
104 104
105 cached_cpu_freq = LOONGSON_CHIPCFG0; 105 cached_cpu_freq = LOONGSON_CHIPCFG(0);
106 106
107 /* Put CPU into wait mode */ 107 /* Put CPU into wait mode */
108 LOONGSON_CHIPCFG0 &= ~0x7; 108 LOONGSON_CHIPCFG(0) &= ~0x7;
109 109
110 /* wait for the given events to wakeup cpu from wait mode */ 110 /* wait for the given events to wakeup cpu from wait mode */
111 wait_for_wakeup_events(); 111 wait_for_wakeup_events();
112 112
113 LOONGSON_CHIPCFG0 = cached_cpu_freq; 113 LOONGSON_CHIPCFG(0) = cached_cpu_freq;
114 mmiowb(); 114 mmiowb();
115} 115}
116 116
diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson/lemote-2f/clock.c
index 1eed38e28b1e..a217061beee3 100644
--- a/arch/mips/loongson/lemote-2f/clock.c
+++ b/arch/mips/loongson/lemote-2f/clock.c
@@ -114,9 +114,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
114 114
115 clk->rate = rate; 115 clk->rate = rate;
116 116
117 regval = LOONGSON_CHIPCFG0; 117 regval = LOONGSON_CHIPCFG(0);
118 regval = (regval & ~0x7) | (pos->driver_data - 1); 118 regval = (regval & ~0x7) | (pos->driver_data - 1);
119 LOONGSON_CHIPCFG0 = regval; 119 LOONGSON_CHIPCFG(0) = regval;
120 120
121 return ret; 121 return ret;
122} 122}
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
index 90962a3a1731..79ac694fe744 100644
--- a/arch/mips/loongson/lemote-2f/reset.c
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -28,7 +28,7 @@ static void reset_cpu(void)
28 * reset cpu to full speed, this is needed when enabling cpu frequency 28 * reset cpu to full speed, this is needed when enabling cpu frequency
29 * scalling 29 * scalling
30 */ 30 */
31 LOONGSON_CHIPCFG0 |= 0x7; 31 LOONGSON_CHIPCFG(0) |= 0x7;
32} 32}
33 33
34/* reset support for fuloong2f */ 34/* reset support for fuloong2f */
diff --git a/arch/mips/loongson/loongson-3/Makefile b/arch/mips/loongson/loongson-3/Makefile
index 70152b252ddc..b4df775b9f30 100644
--- a/arch/mips/loongson/loongson-3/Makefile
+++ b/arch/mips/loongson/loongson-3/Makefile
@@ -1,6 +1,8 @@
1# 1#
2# Makefile for Loongson-3 family machines 2# Makefile for Loongson-3 family machines
3# 3#
4obj-y += irq.o 4obj-y += irq.o cop2-ex.o
5 5
6obj-$(CONFIG_SMP) += smp.o 6obj-$(CONFIG_SMP) += smp.o
7
8obj-$(CONFIG_NUMA) += numa.o
diff --git a/arch/mips/loongson/loongson-3/cop2-ex.c b/arch/mips/loongson/loongson-3/cop2-ex.c
new file mode 100644
index 000000000000..9182e8d2967c
--- /dev/null
+++ b/arch/mips/loongson/loongson-3/cop2-ex.c
@@ -0,0 +1,63 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2014 Lemote Corporation.
7 * written by Huacai Chen <chenhc@lemote.com>
8 *
9 * based on arch/mips/cavium-octeon/cpu.c
10 * Copyright (C) 2009 Wind River Systems,
11 * written by Ralf Baechle <ralf@linux-mips.org>
12 */
13#include <linux/init.h>
14#include <linux/sched.h>
15#include <linux/notifier.h>
16
17#include <asm/fpu.h>
18#include <asm/cop2.h>
19#include <asm/current.h>
20#include <asm/mipsregs.h>
21
22static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
23 void *data)
24{
25 int fpu_enabled;
26 int fr = !test_thread_flag(TIF_32BIT_FPREGS);
27
28 switch (action) {
29 case CU2_EXCEPTION:
30 preempt_disable();
31 fpu_enabled = read_c0_status() & ST0_CU1;
32 if (!fr)
33 set_c0_status(ST0_CU1 | ST0_CU2);
34 else
35 set_c0_status(ST0_CU1 | ST0_CU2 | ST0_FR);
36 enable_fpu_hazard();
37 KSTK_STATUS(current) |= (ST0_CU1 | ST0_CU2);
38 if (fr)
39 KSTK_STATUS(current) |= ST0_FR;
40 else
41 KSTK_STATUS(current) &= ~ST0_FR;
42 /* If FPU is enabled, we needn't init or restore fp */
43 if(!fpu_enabled) {
44 set_thread_flag(TIF_USEDFPU);
45 if (!used_math()) {
46 _init_fpu();
47 set_used_math();
48 } else
49 _restore_fp(current);
50 }
51 preempt_enable();
52
53 return NOTIFY_STOP; /* Don't call default notifier */
54 }
55
56 return NOTIFY_OK; /* Let default notifier send signals */
57}
58
59static int __init loongson_cu2_setup(void)
60{
61 return cu2_notifier(loongson_cu2_call, 0);
62}
63early_initcall(loongson_cu2_setup);
diff --git a/arch/mips/loongson/loongson-3/irq.c b/arch/mips/loongson/loongson-3/irq.c
index f240828181ff..ca1c62af5188 100644
--- a/arch/mips/loongson/loongson-3/irq.c
+++ b/arch/mips/loongson/loongson-3/irq.c
@@ -7,6 +7,8 @@
7#include <asm/i8259.h> 7#include <asm/i8259.h>
8#include <asm/mipsregs.h> 8#include <asm/mipsregs.h>
9 9
10#include "smp.h"
11
10unsigned int ht_irq[] = {1, 3, 4, 5, 6, 7, 8, 12, 14, 15}; 12unsigned int ht_irq[] = {1, 3, 4, 5, 6, 7, 8, 12, 14, 15};
11 13
12static void ht_irqdispatch(void) 14static void ht_irqdispatch(void)
@@ -53,9 +55,15 @@ static inline void mask_loongson_irq(struct irq_data *d)
53 /* Workaround: UART IRQ may deliver to any core */ 55 /* Workaround: UART IRQ may deliver to any core */
54 if (d->irq == LOONGSON_UART_IRQ) { 56 if (d->irq == LOONGSON_UART_IRQ) {
55 int cpu = smp_processor_id(); 57 int cpu = smp_processor_id();
56 58 int node_id = cpu / loongson_sysconf.cores_per_node;
57 LOONGSON_INT_ROUTER_INTENCLR = 1 << 10; 59 int core_id = cpu % loongson_sysconf.cores_per_node;
58 LOONGSON_INT_ROUTER_LPC = 0x10 + (1<<cpu); 60 u64 intenclr_addr = smp_group[node_id] |
61 (u64)(&LOONGSON_INT_ROUTER_INTENCLR);
62 u64 introuter_lpc_addr = smp_group[node_id] |
63 (u64)(&LOONGSON_INT_ROUTER_LPC);
64
65 *(volatile u32 *)intenclr_addr = 1 << 10;
66 *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id);
59 } 67 }
60} 68}
61 69
@@ -64,9 +72,15 @@ static inline void unmask_loongson_irq(struct irq_data *d)
64 /* Workaround: UART IRQ may deliver to any core */ 72 /* Workaround: UART IRQ may deliver to any core */
65 if (d->irq == LOONGSON_UART_IRQ) { 73 if (d->irq == LOONGSON_UART_IRQ) {
66 int cpu = smp_processor_id(); 74 int cpu = smp_processor_id();
67 75 int node_id = cpu / loongson_sysconf.cores_per_node;
68 LOONGSON_INT_ROUTER_INTENSET = 1 << 10; 76 int core_id = cpu % loongson_sysconf.cores_per_node;
69 LOONGSON_INT_ROUTER_LPC = 0x10 + (1<<cpu); 77 u64 intenset_addr = smp_group[node_id] |
78 (u64)(&LOONGSON_INT_ROUTER_INTENSET);
79 u64 introuter_lpc_addr = smp_group[node_id] |
80 (u64)(&LOONGSON_INT_ROUTER_LPC);
81
82 *(volatile u32 *)intenset_addr = 1 << 10;
83 *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id);
70 } 84 }
71 85
72 set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 86 set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c
new file mode 100644
index 000000000000..ca025a6ba559
--- /dev/null
+++ b/arch/mips/loongson/loongson-3/numa.c
@@ -0,0 +1,291 @@
1/*
2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
3 * Insititute of Computing Technology
4 * Author: Xiang Gao, gaoxiang@ict.ac.cn
5 * Huacai Chen, chenhc@lemote.com
6 * Xiaofu Meng, Shuangshuang Zhang
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/mm.h>
16#include <linux/mmzone.h>
17#include <linux/module.h>
18#include <linux/nodemask.h>
19#include <linux/swap.h>
20#include <linux/memblock.h>
21#include <linux/bootmem.h>
22#include <linux/pfn.h>
23#include <linux/highmem.h>
24#include <asm/page.h>
25#include <asm/pgalloc.h>
26#include <asm/sections.h>
27#include <linux/bootmem.h>
28#include <linux/init.h>
29#include <linux/irq.h>
30#include <asm/bootinfo.h>
31#include <asm/mc146818-time.h>
32#include <asm/time.h>
33#include <asm/wbflush.h>
34#include <boot_param.h>
35
36static struct node_data prealloc__node_data[MAX_NUMNODES];
37unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
38struct node_data *__node_data[MAX_NUMNODES];
39EXPORT_SYMBOL(__node_data);
40
41static void enable_lpa(void)
42{
43 unsigned long value;
44
45 value = __read_32bit_c0_register($16, 3);
46 value |= 0x00000080;
47 __write_32bit_c0_register($16, 3, value);
48 value = __read_32bit_c0_register($16, 3);
49 pr_info("CP0_Config3: CP0 16.3 (0x%lx)\n", value);
50
51 value = __read_32bit_c0_register($5, 1);
52 value |= 0x20000000;
53 __write_32bit_c0_register($5, 1, value);
54 value = __read_32bit_c0_register($5, 1);
55 pr_info("CP0_PageGrain: CP0 5.1 (0x%lx)\n", value);
56}
57
58static void cpu_node_probe(void)
59{
60 int i;
61
62 nodes_clear(node_possible_map);
63 nodes_clear(node_online_map);
64 for (i = 0; i < loongson_sysconf.nr_nodes; i++) {
65 node_set_state(num_online_nodes(), N_POSSIBLE);
66 node_set_online(num_online_nodes());
67 }
68
69 pr_info("NUMA: Discovered %d cpus on %d nodes\n",
70 loongson_sysconf.nr_cpus, num_online_nodes());
71}
72
73static int __init compute_node_distance(int row, int col)
74{
75 int package_row = row * loongson_sysconf.cores_per_node /
76 loongson_sysconf.cores_per_package;
77 int package_col = col * loongson_sysconf.cores_per_node /
78 loongson_sysconf.cores_per_package;
79
80 if (col == row)
81 return 0;
82 else if (package_row == package_col)
83 return 40;
84 else
85 return 100;
86}
87
88static void __init init_topology_matrix(void)
89{
90 int row, col;
91
92 for (row = 0; row < MAX_NUMNODES; row++)
93 for (col = 0; col < MAX_NUMNODES; col++)
94 __node_distances[row][col] = -1;
95
96 for_each_online_node(row) {
97 for_each_online_node(col) {
98 __node_distances[row][col] =
99 compute_node_distance(row, col);
100 }
101 }
102}
103
104static unsigned long nid_to_addroffset(unsigned int nid)
105{
106 unsigned long result;
107 switch (nid) {
108 case 0:
109 default:
110 result = NODE0_ADDRSPACE_OFFSET;
111 break;
112 case 1:
113 result = NODE1_ADDRSPACE_OFFSET;
114 break;
115 case 2:
116 result = NODE2_ADDRSPACE_OFFSET;
117 break;
118 case 3:
119 result = NODE3_ADDRSPACE_OFFSET;
120 break;
121 }
122 return result;
123}
124
125static void __init szmem(unsigned int node)
126{
127 u32 i, mem_type;
128 static unsigned long num_physpages = 0;
129 u64 node_id, node_psize, start_pfn, end_pfn, mem_start, mem_size;
130
131 /* Parse memory information and activate */
132 for (i = 0; i < loongson_memmap->nr_map; i++) {
133 node_id = loongson_memmap->map[i].node_id;
134 if (node_id != node)
135 continue;
136
137 mem_type = loongson_memmap->map[i].mem_type;
138 mem_size = loongson_memmap->map[i].mem_size;
139 mem_start = loongson_memmap->map[i].mem_start;
140
141 switch (mem_type) {
142 case SYSTEM_RAM_LOW:
143 start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT;
144 node_psize = (mem_size << 20) >> PAGE_SHIFT;
145 end_pfn = start_pfn + node_psize;
146 num_physpages += node_psize;
147 pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
148 (u32)node_id, mem_type, mem_start, mem_size);
149 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
150 start_pfn, end_pfn, num_physpages);
151 add_memory_region((node_id << 44) + mem_start,
152 (u64)mem_size << 20, BOOT_MEM_RAM);
153 memblock_add_node(PFN_PHYS(start_pfn),
154 PFN_PHYS(end_pfn - start_pfn), node);
155 break;
156 case SYSTEM_RAM_HIGH:
157 start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT;
158 node_psize = (mem_size << 20) >> PAGE_SHIFT;
159 end_pfn = start_pfn + node_psize;
160 num_physpages += node_psize;
161 pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
162 (u32)node_id, mem_type, mem_start, mem_size);
163 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
164 start_pfn, end_pfn, num_physpages);
165 add_memory_region((node_id << 44) + mem_start,
166 (u64)mem_size << 20, BOOT_MEM_RAM);
167 memblock_add_node(PFN_PHYS(start_pfn),
168 PFN_PHYS(end_pfn - start_pfn), node);
169 break;
170 case MEM_RESERVED:
171 pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
172 (u32)node_id, mem_type, mem_start, mem_size);
173 add_memory_region((node_id << 44) + mem_start,
174 (u64)mem_size << 20, BOOT_MEM_RESERVED);
175 memblock_reserve(((node_id << 44) + mem_start),
176 mem_size << 20);
177 break;
178 }
179 }
180}
181
182static void __init node_mem_init(unsigned int node)
183{
184 unsigned long bootmap_size;
185 unsigned long node_addrspace_offset;
186 unsigned long start_pfn, end_pfn, freepfn;
187
188 node_addrspace_offset = nid_to_addroffset(node);
189 pr_info("Node%d's addrspace_offset is 0x%lx\n",
190 node, node_addrspace_offset);
191
192 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
193 freepfn = start_pfn;
194 if (node == 0)
195 freepfn = PFN_UP(__pa_symbol(&_end)); /* kernel end address */
196 pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx, freepfn=0x%lx\n",
197 node, start_pfn, end_pfn, freepfn);
198
199 __node_data[node] = prealloc__node_data + node;
200
201 NODE_DATA(node)->bdata = &bootmem_node_data[node];
202 NODE_DATA(node)->node_start_pfn = start_pfn;
203 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
204
205 bootmap_size = init_bootmem_node(NODE_DATA(node), freepfn,
206 start_pfn, end_pfn);
207 free_bootmem_with_active_regions(node, end_pfn);
208 if (node == 0) /* used by finalize_initrd() */
209 max_low_pfn = end_pfn;
210
211 /* This is reserved for the kernel and bdata->node_bootmem_map */
212 reserve_bootmem_node(NODE_DATA(node), start_pfn << PAGE_SHIFT,
213 ((freepfn - start_pfn) << PAGE_SHIFT) + bootmap_size,
214 BOOTMEM_DEFAULT);
215
216 if (node == 0 && node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) {
217 /* Reserve 0xff800000~0xffffffff for RS780E integrated GPU */
218 reserve_bootmem_node(NODE_DATA(node),
219 (node_addrspace_offset | 0xff800000),
220 8 << 20, BOOTMEM_DEFAULT);
221 }
222
223 sparse_memory_present_with_active_regions(node);
224}
225
226static __init void prom_meminit(void)
227{
228 unsigned int node, cpu;
229
230 cpu_node_probe();
231 init_topology_matrix();
232
233 for (node = 0; node < loongson_sysconf.nr_nodes; node++) {
234 if (node_online(node)) {
235 szmem(node);
236 node_mem_init(node);
237 cpus_clear(__node_data[(node)]->cpumask);
238 }
239 }
240 for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
241 node = cpu / loongson_sysconf.cores_per_node;
242 if (node >= num_online_nodes())
243 node = 0;
244 pr_info("NUMA: set cpumask cpu %d on node %d\n", cpu, node);
245 cpu_set(cpu, __node_data[(node)]->cpumask);
246 }
247}
248
249void __init paging_init(void)
250{
251 unsigned node;
252 unsigned long zones_size[MAX_NR_ZONES] = {0, };
253
254 pagetable_init();
255
256 for_each_online_node(node) {
257 unsigned long start_pfn, end_pfn;
258
259 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
260
261 if (end_pfn > max_low_pfn)
262 max_low_pfn = end_pfn;
263 }
264#ifdef CONFIG_ZONE_DMA32
265 zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
266#endif
267 zones_size[ZONE_NORMAL] = max_low_pfn;
268 free_area_init_nodes(zones_size);
269}
270
271void __init mem_init(void)
272{
273 high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
274 free_all_bootmem();
275 setup_zero_pages(); /* This comes from node 0 */
276 mem_init_print_info(NULL);
277}
278
279/* All PCI device belongs to logical Node-0 */
280int pcibus_to_node(struct pci_bus *bus)
281{
282 return 0;
283}
284EXPORT_SYMBOL(pcibus_to_node);
285
286void __init prom_init_numa_memory(void)
287{
288 enable_lpa();
289 prom_meminit();
290}
291EXPORT_SYMBOL(prom_init_numa_memory);
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson/loongson-3/smp.c
index 1e8894020ea5..74e827b4ec8f 100644
--- a/arch/mips/loongson/loongson-3/smp.c
+++ b/arch/mips/loongson/loongson-3/smp.c
@@ -31,6 +31,12 @@
31DEFINE_PER_CPU(int, cpu_state); 31DEFINE_PER_CPU(int, cpu_state);
32DEFINE_PER_CPU(uint32_t, core0_c0count); 32DEFINE_PER_CPU(uint32_t, core0_c0count);
33 33
34static void *ipi_set0_regs[16];
35static void *ipi_clear0_regs[16];
36static void *ipi_status0_regs[16];
37static void *ipi_en0_regs[16];
38static void *ipi_mailbox_buf[16];
39
34/* read a 32bit value from ipi register */ 40/* read a 32bit value from ipi register */
35#define loongson3_ipi_read32(addr) readl(addr) 41#define loongson3_ipi_read32(addr) readl(addr)
36/* read a 64bit value from ipi register */ 42/* read a 64bit value from ipi register */
@@ -48,100 +54,185 @@ DEFINE_PER_CPU(uint32_t, core0_c0count);
48 __wbflush(); \ 54 __wbflush(); \
49 } while (0) 55 } while (0)
50 56
51static void *ipi_set0_regs[] = { 57static void ipi_set0_regs_init(void)
52 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + SET0), 58{
53 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + SET0), 59 ipi_set0_regs[0] = (void *)
54 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + SET0), 60 (SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + SET0);
55 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + SET0), 61 ipi_set0_regs[1] = (void *)
56 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + SET0), 62 (SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + SET0);
57 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + SET0), 63 ipi_set0_regs[2] = (void *)
58 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + SET0), 64 (SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + SET0);
59 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + SET0), 65 ipi_set0_regs[3] = (void *)
60 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + SET0), 66 (SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + SET0);
61 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + SET0), 67 ipi_set0_regs[4] = (void *)
62 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + SET0), 68 (SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + SET0);
63 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + SET0), 69 ipi_set0_regs[5] = (void *)
64 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + SET0), 70 (SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + SET0);
65 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + SET0), 71 ipi_set0_regs[6] = (void *)
66 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + SET0), 72 (SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + SET0);
67 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + SET0), 73 ipi_set0_regs[7] = (void *)
68}; 74 (SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + SET0);
75 ipi_set0_regs[8] = (void *)
76 (SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + SET0);
77 ipi_set0_regs[9] = (void *)
78 (SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + SET0);
79 ipi_set0_regs[10] = (void *)
80 (SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + SET0);
81 ipi_set0_regs[11] = (void *)
82 (SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + SET0);
83 ipi_set0_regs[12] = (void *)
84 (SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + SET0);
85 ipi_set0_regs[13] = (void *)
86 (SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + SET0);
87 ipi_set0_regs[14] = (void *)
88 (SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + SET0);
89 ipi_set0_regs[15] = (void *)
90 (SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + SET0);
91}
69 92
70static void *ipi_clear0_regs[] = { 93static void ipi_clear0_regs_init(void)
71 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + CLEAR0), 94{
72 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + CLEAR0), 95 ipi_clear0_regs[0] = (void *)
73 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + CLEAR0), 96 (SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + CLEAR0);
74 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + CLEAR0), 97 ipi_clear0_regs[1] = (void *)
75 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + CLEAR0), 98 (SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + CLEAR0);
76 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + CLEAR0), 99 ipi_clear0_regs[2] = (void *)
77 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + CLEAR0), 100 (SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + CLEAR0);
78 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + CLEAR0), 101 ipi_clear0_regs[3] = (void *)
79 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + CLEAR0), 102 (SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + CLEAR0);
80 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + CLEAR0), 103 ipi_clear0_regs[4] = (void *)
81 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + CLEAR0), 104 (SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + CLEAR0);
82 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + CLEAR0), 105 ipi_clear0_regs[5] = (void *)
83 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + CLEAR0), 106 (SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + CLEAR0);
84 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + CLEAR0), 107 ipi_clear0_regs[6] = (void *)
85 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + CLEAR0), 108 (SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + CLEAR0);
86 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + CLEAR0), 109 ipi_clear0_regs[7] = (void *)
87}; 110 (SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + CLEAR0);
111 ipi_clear0_regs[8] = (void *)
112 (SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + CLEAR0);
113 ipi_clear0_regs[9] = (void *)
114 (SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + CLEAR0);
115 ipi_clear0_regs[10] = (void *)
116 (SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + CLEAR0);
117 ipi_clear0_regs[11] = (void *)
118 (SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + CLEAR0);
119 ipi_clear0_regs[12] = (void *)
120 (SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + CLEAR0);
121 ipi_clear0_regs[13] = (void *)
122 (SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + CLEAR0);
123 ipi_clear0_regs[14] = (void *)
124 (SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + CLEAR0);
125 ipi_clear0_regs[15] = (void *)
126 (SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + CLEAR0);
127}
88 128
89static void *ipi_status0_regs[] = { 129static void ipi_status0_regs_init(void)
90 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + STATUS0), 130{
91 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + STATUS0), 131 ipi_status0_regs[0] = (void *)
92 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + STATUS0), 132 (SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + STATUS0);
93 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + STATUS0), 133 ipi_status0_regs[1] = (void *)
94 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + STATUS0), 134 (SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + STATUS0);
95 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + STATUS0), 135 ipi_status0_regs[2] = (void *)
96 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + STATUS0), 136 (SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + STATUS0);
97 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + STATUS0), 137 ipi_status0_regs[3] = (void *)
98 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + STATUS0), 138 (SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + STATUS0);
99 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + STATUS0), 139 ipi_status0_regs[4] = (void *)
100 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + STATUS0), 140 (SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + STATUS0);
101 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + STATUS0), 141 ipi_status0_regs[5] = (void *)
102 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + STATUS0), 142 (SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + STATUS0);
103 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + STATUS0), 143 ipi_status0_regs[6] = (void *)
104 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + STATUS0), 144 (SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + STATUS0);
105 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + STATUS0), 145 ipi_status0_regs[7] = (void *)
106}; 146 (SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + STATUS0);
147 ipi_status0_regs[8] = (void *)
148 (SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + STATUS0);
149 ipi_status0_regs[9] = (void *)
150 (SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + STATUS0);
151 ipi_status0_regs[10] = (void *)
152 (SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + STATUS0);
153 ipi_status0_regs[11] = (void *)
154 (SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + STATUS0);
155 ipi_status0_regs[12] = (void *)
156 (SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + STATUS0);
157 ipi_status0_regs[13] = (void *)
158 (SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + STATUS0);
159 ipi_status0_regs[14] = (void *)
160 (SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + STATUS0);
161 ipi_status0_regs[15] = (void *)
162 (SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + STATUS0);
163}
107 164
108static void *ipi_en0_regs[] = { 165static void ipi_en0_regs_init(void)
109 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + EN0), 166{
110 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + EN0), 167 ipi_en0_regs[0] = (void *)
111 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + EN0), 168 (SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + EN0);
112 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + EN0), 169 ipi_en0_regs[1] = (void *)
113 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + EN0), 170 (SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + EN0);
114 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + EN0), 171 ipi_en0_regs[2] = (void *)
115 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + EN0), 172 (SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + EN0);
116 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + EN0), 173 ipi_en0_regs[3] = (void *)
117 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + EN0), 174 (SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + EN0);
118 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + EN0), 175 ipi_en0_regs[4] = (void *)
119 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + EN0), 176 (SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + EN0);
120 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + EN0), 177 ipi_en0_regs[5] = (void *)
121 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + EN0), 178 (SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + EN0);
122 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + EN0), 179 ipi_en0_regs[6] = (void *)
123 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + EN0), 180 (SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + EN0);
124 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + EN0), 181 ipi_en0_regs[7] = (void *)
125}; 182 (SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + EN0);
183 ipi_en0_regs[8] = (void *)
184 (SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + EN0);
185 ipi_en0_regs[9] = (void *)
186 (SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + EN0);
187 ipi_en0_regs[10] = (void *)
188 (SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + EN0);
189 ipi_en0_regs[11] = (void *)
190 (SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + EN0);
191 ipi_en0_regs[12] = (void *)
192 (SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + EN0);
193 ipi_en0_regs[13] = (void *)
194 (SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + EN0);
195 ipi_en0_regs[14] = (void *)
196 (SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + EN0);
197 ipi_en0_regs[15] = (void *)
198 (SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + EN0);
199}
126 200
127static void *ipi_mailbox_buf[] = { 201static void ipi_mailbox_buf_init(void)
128 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + BUF), 202{
129 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + BUF), 203 ipi_mailbox_buf[0] = (void *)
130 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + BUF), 204 (SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + BUF);
131 (void *)(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + BUF), 205 ipi_mailbox_buf[1] = (void *)
132 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + BUF), 206 (SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + BUF);
133 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + BUF), 207 ipi_mailbox_buf[2] = (void *)
134 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + BUF), 208 (SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + BUF);
135 (void *)(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + BUF), 209 ipi_mailbox_buf[3] = (void *)
136 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + BUF), 210 (SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + BUF);
137 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + BUF), 211 ipi_mailbox_buf[4] = (void *)
138 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + BUF), 212 (SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + BUF);
139 (void *)(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + BUF), 213 ipi_mailbox_buf[5] = (void *)
140 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + BUF), 214 (SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + BUF);
141 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + BUF), 215 ipi_mailbox_buf[6] = (void *)
142 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + BUF), 216 (SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + BUF);
143 (void *)(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + BUF), 217 ipi_mailbox_buf[7] = (void *)
144}; 218 (SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + BUF);
219 ipi_mailbox_buf[8] = (void *)
220 (SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + BUF);
221 ipi_mailbox_buf[9] = (void *)
222 (SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + BUF);
223 ipi_mailbox_buf[10] = (void *)
224 (SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + BUF);
225 ipi_mailbox_buf[11] = (void *)
226 (SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + BUF);
227 ipi_mailbox_buf[12] = (void *)
228 (SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + BUF);
229 ipi_mailbox_buf[13] = (void *)
230 (SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + BUF);
231 ipi_mailbox_buf[14] = (void *)
232 (SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + BUF);
233 ipi_mailbox_buf[15] = (void *)
234 (SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + BUF);
235}
145 236
146/* 237/*
147 * Simple enough, just poke the appropriate ipi register 238 * Simple enough, just poke the appropriate ipi register
@@ -203,6 +294,8 @@ static void loongson3_init_secondary(void)
203 for (i = 0; i < loongson_sysconf.nr_cpus; i++) 294 for (i = 0; i < loongson_sysconf.nr_cpus; i++)
204 loongson3_ipi_write32(0xffffffff, ipi_en0_regs[i]); 295 loongson3_ipi_write32(0xffffffff, ipi_en0_regs[i]);
205 296
297 cpu_data[cpu].package = cpu / loongson_sysconf.cores_per_package;
298 cpu_data[cpu].core = cpu % loongson_sysconf.cores_per_package;
206 per_cpu(cpu_state, cpu) = CPU_ONLINE; 299 per_cpu(cpu_state, cpu) = CPU_ONLINE;
207 300
208 i = 0; 301 i = 0;
@@ -246,6 +339,11 @@ static void __init loongson3_smp_setup(void)
246 __cpu_number_map[i] = ++num; 339 __cpu_number_map[i] = ++num;
247 __cpu_logical_map[num] = i; 340 __cpu_logical_map[num] = i;
248 } 341 }
342 ipi_set0_regs_init();
343 ipi_clear0_regs_init();
344 ipi_status0_regs_init();
345 ipi_en0_regs_init();
346 ipi_mailbox_buf_init();
249 pr_info("Detected %i available secondary CPU(s)\n", num); 347 pr_info("Detected %i available secondary CPU(s)\n", num);
250} 348}
251 349
@@ -313,7 +411,7 @@ static void loongson3_cpu_die(unsigned int cpu)
313 * flush all L1 entries at first. Then, another core (usually Core 0) can 411 * flush all L1 entries at first. Then, another core (usually Core 0) can
314 * safely disable the clock of the target core. loongson3_play_dead() is 412 * safely disable the clock of the target core. loongson3_play_dead() is
315 * called via CKSEG1 (uncached and unmmaped) */ 413 * called via CKSEG1 (uncached and unmmaped) */
316static void loongson3_play_dead(int *state_addr) 414static void loongson3a_play_dead(int *state_addr)
317{ 415{
318 register int val; 416 register int val;
319 register long cpuid, core, node, count; 417 register long cpuid, core, node, count;
@@ -375,6 +473,70 @@ static void loongson3_play_dead(int *state_addr)
375 : "a1"); 473 : "a1");
376} 474}
377 475
476static void loongson3b_play_dead(int *state_addr)
477{
478 register int val;
479 register long cpuid, core, node, count;
480 register void *addr, *base, *initfunc;
481
482 __asm__ __volatile__(
483 " .set push \n"
484 " .set noreorder \n"
485 " li %[addr], 0x80000000 \n" /* KSEG0 */
486 "1: cache 0, 0(%[addr]) \n" /* flush L1 ICache */
487 " cache 0, 1(%[addr]) \n"
488 " cache 0, 2(%[addr]) \n"
489 " cache 0, 3(%[addr]) \n"
490 " cache 1, 0(%[addr]) \n" /* flush L1 DCache */
491 " cache 1, 1(%[addr]) \n"
492 " cache 1, 2(%[addr]) \n"
493 " cache 1, 3(%[addr]) \n"
494 " addiu %[sets], %[sets], -1 \n"
495 " bnez %[sets], 1b \n"
496 " addiu %[addr], %[addr], 0x20 \n"
497 " li %[val], 0x7 \n" /* *state_addr = CPU_DEAD; */
498 " sw %[val], (%[state_addr]) \n"
499 " sync \n"
500 " cache 21, (%[state_addr]) \n" /* flush entry of *state_addr */
501 " .set pop \n"
502 : [addr] "=&r" (addr), [val] "=&r" (val)
503 : [state_addr] "r" (state_addr),
504 [sets] "r" (cpu_data[smp_processor_id()].dcache.sets));
505
506 __asm__ __volatile__(
507 " .set push \n"
508 " .set noreorder \n"
509 " .set mips64 \n"
510 " mfc0 %[cpuid], $15, 1 \n"
511 " andi %[cpuid], 0x3ff \n"
512 " dli %[base], 0x900000003ff01000 \n"
513 " andi %[core], %[cpuid], 0x3 \n"
514 " sll %[core], 8 \n" /* get core id */
515 " or %[base], %[base], %[core] \n"
516 " andi %[node], %[cpuid], 0xc \n"
517 " dsll %[node], 42 \n" /* get node id */
518 " or %[base], %[base], %[node] \n"
519 " dsrl %[node], 30 \n" /* 15:14 */
520 " or %[base], %[base], %[node] \n"
521 "1: li %[count], 0x100 \n" /* wait for init loop */
522 "2: bnez %[count], 2b \n" /* limit mailbox access */
523 " addiu %[count], -1 \n"
524 " ld %[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */
525 " beqz %[initfunc], 1b \n"
526 " nop \n"
527 " ld $sp, 0x28(%[base]) \n" /* get SP via mailbox */
528 " ld $gp, 0x30(%[base]) \n" /* get GP via mailbox */
529 " ld $a1, 0x38(%[base]) \n"
530 " jr %[initfunc] \n" /* jump to initial PC */
531 " nop \n"
532 " .set pop \n"
533 : [core] "=&r" (core), [node] "=&r" (node),
534 [base] "=&r" (base), [cpuid] "=&r" (cpuid),
535 [count] "=&r" (count), [initfunc] "=&r" (initfunc)
536 : /* No Input */
537 : "a1");
538}
539
378void play_dead(void) 540void play_dead(void)
379{ 541{
380 int *state_addr; 542 int *state_addr;
@@ -382,13 +544,48 @@ void play_dead(void)
382 void (*play_dead_at_ckseg1)(int *); 544 void (*play_dead_at_ckseg1)(int *);
383 545
384 idle_task_exit(); 546 idle_task_exit();
385 play_dead_at_ckseg1 = 547 switch (loongson_sysconf.cputype) {
386 (void *)CKSEG1ADDR((unsigned long)loongson3_play_dead); 548 case Loongson_3A:
549 default:
550 play_dead_at_ckseg1 =
551 (void *)CKSEG1ADDR((unsigned long)loongson3a_play_dead);
552 break;
553 case Loongson_3B:
554 play_dead_at_ckseg1 =
555 (void *)CKSEG1ADDR((unsigned long)loongson3b_play_dead);
556 break;
557 }
387 state_addr = &per_cpu(cpu_state, cpu); 558 state_addr = &per_cpu(cpu_state, cpu);
388 mb(); 559 mb();
389 play_dead_at_ckseg1(state_addr); 560 play_dead_at_ckseg1(state_addr);
390} 561}
391 562
563void loongson3_disable_clock(int cpu)
564{
565 uint64_t core_id = cpu_data[cpu].core;
566 uint64_t package_id = cpu_data[cpu].package;
567
568 if (loongson_sysconf.cputype == Loongson_3A) {
569 LOONGSON_CHIPCFG(package_id) &= ~(1 << (12 + core_id));
570 } else if (loongson_sysconf.cputype == Loongson_3B) {
571 if (!cpuhotplug_workaround)
572 LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3));
573 }
574}
575
576void loongson3_enable_clock(int cpu)
577{
578 uint64_t core_id = cpu_data[cpu].core;
579 uint64_t package_id = cpu_data[cpu].package;
580
581 if (loongson_sysconf.cputype == Loongson_3A) {
582 LOONGSON_CHIPCFG(package_id) |= 1 << (12 + core_id);
583 } else if (loongson_sysconf.cputype == Loongson_3B) {
584 if (!cpuhotplug_workaround)
585 LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3);
586 }
587}
588
392#define CPU_POST_DEAD_FROZEN (CPU_POST_DEAD | CPU_TASKS_FROZEN) 589#define CPU_POST_DEAD_FROZEN (CPU_POST_DEAD | CPU_TASKS_FROZEN)
393static int loongson3_cpu_callback(struct notifier_block *nfb, 590static int loongson3_cpu_callback(struct notifier_block *nfb,
394 unsigned long action, void *hcpu) 591 unsigned long action, void *hcpu)
@@ -399,12 +596,12 @@ static int loongson3_cpu_callback(struct notifier_block *nfb,
399 case CPU_POST_DEAD: 596 case CPU_POST_DEAD:
400 case CPU_POST_DEAD_FROZEN: 597 case CPU_POST_DEAD_FROZEN:
401 pr_info("Disable clock for CPU#%d\n", cpu); 598 pr_info("Disable clock for CPU#%d\n", cpu);
402 LOONGSON_CHIPCFG0 &= ~(1 << (12 + cpu)); 599 loongson3_disable_clock(cpu);
403 break; 600 break;
404 case CPU_UP_PREPARE: 601 case CPU_UP_PREPARE:
405 case CPU_UP_PREPARE_FROZEN: 602 case CPU_UP_PREPARE_FROZEN:
406 pr_info("Enable clock for CPU#%d\n", cpu); 603 pr_info("Enable clock for CPU#%d\n", cpu);
407 LOONGSON_CHIPCFG0 |= 1 << (12 + cpu); 604 loongson3_enable_clock(cpu);
408 break; 605 break;
409 } 606 }
410 607
diff --git a/arch/mips/loongson/loongson-3/smp.h b/arch/mips/loongson/loongson-3/smp.h
index 3453e8c4f2f0..d98ff654b7d7 100644
--- a/arch/mips/loongson/loongson-3/smp.h
+++ b/arch/mips/loongson/loongson-3/smp.h
@@ -1,29 +1,30 @@
1#ifndef __LOONGSON_SMP_H_ 1#ifndef __LOONGSON_SMP_H_
2#define __LOONGSON_SMP_H_ 2#define __LOONGSON_SMP_H_
3 3
4/* for Loongson-3A smp support */ 4/* for Loongson-3 smp support */
5extern unsigned long long smp_group[4];
5 6
6/* 4 groups(nodes) in maximum in numa case */ 7/* 4 groups(nodes) in maximum in numa case */
7#define SMP_CORE_GROUP0_BASE 0x900000003ff01000 8#define SMP_CORE_GROUP0_BASE (smp_group[0])
8#define SMP_CORE_GROUP1_BASE 0x900010003ff01000 9#define SMP_CORE_GROUP1_BASE (smp_group[1])
9#define SMP_CORE_GROUP2_BASE 0x900020003ff01000 10#define SMP_CORE_GROUP2_BASE (smp_group[2])
10#define SMP_CORE_GROUP3_BASE 0x900030003ff01000 11#define SMP_CORE_GROUP3_BASE (smp_group[3])
11 12
12/* 4 cores in each group(node) */ 13/* 4 cores in each group(node) */
13#define SMP_CORE0_OFFSET 0x000 14#define SMP_CORE0_OFFSET 0x000
14#define SMP_CORE1_OFFSET 0x100 15#define SMP_CORE1_OFFSET 0x100
15#define SMP_CORE2_OFFSET 0x200 16#define SMP_CORE2_OFFSET 0x200
16#define SMP_CORE3_OFFSET 0x300 17#define SMP_CORE3_OFFSET 0x300
17 18
18/* ipi registers offsets */ 19/* ipi registers offsets */
19#define STATUS0 0x00 20#define STATUS0 0x00
20#define EN0 0x04 21#define EN0 0x04
21#define SET0 0x08 22#define SET0 0x08
22#define CLEAR0 0x0c 23#define CLEAR0 0x0c
23#define STATUS1 0x10 24#define STATUS1 0x10
24#define MASK1 0x14 25#define MASK1 0x14
25#define SET1 0x18 26#define SET1 0x18
26#define CLEAR1 0x1c 27#define CLEAR1 0x1c
27#define BUF 0x20 28#define BUF 0x20
28 29
29#endif 30#endif
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 736c17a226e9..bf0fc6b16ad9 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1827,7 +1827,7 @@ dcopuop:
1827 case -1: 1827 case -1:
1828 1828
1829 if (cpu_has_mips_4_5_r) 1829 if (cpu_has_mips_4_5_r)
1830 cbit = fpucondbit[MIPSInst_RT(ir) >> 2]; 1830 cbit = fpucondbit[MIPSInst_FD(ir) >> 2];
1831 else 1831 else
1832 cbit = FPU_CSR_COND; 1832 cbit = FPU_CSR_COND;
1833 if (rv.w) 1833 if (rv.w)
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index f2e8302fa70f..fbcd8674ff1d 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1230,19 +1230,19 @@ static void probe_pcache(void)
1230 case CPU_R14000: 1230 case CPU_R14000:
1231 break; 1231 break;
1232 1232
1233 case CPU_74K:
1234 case CPU_1074K:
1235 alias_74k_erratum(c);
1236 /* Fall through. */
1233 case CPU_M14KC: 1237 case CPU_M14KC:
1234 case CPU_M14KEC: 1238 case CPU_M14KEC:
1235 case CPU_24K: 1239 case CPU_24K:
1236 case CPU_34K: 1240 case CPU_34K:
1237 case CPU_74K:
1238 case CPU_1004K: 1241 case CPU_1004K:
1239 case CPU_1074K:
1240 case CPU_INTERAPTIV: 1242 case CPU_INTERAPTIV:
1241 case CPU_P5600: 1243 case CPU_P5600:
1242 case CPU_PROAPTIV: 1244 case CPU_PROAPTIV:
1243 case CPU_M5150: 1245 case CPU_M5150:
1244 if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K))
1245 alias_74k_erratum(c);
1246 if (!(read_c0_config7() & MIPS_CONF7_IAR) && 1246 if (!(read_c0_config7() & MIPS_CONF7_IAR) &&
1247 (c->icache.waysize > PAGE_SIZE)) 1247 (c->icache.waysize > PAGE_SIZE))
1248 c->icache.flags |= MIPS_CACHE_ALIASES; 1248 c->icache.flags |= MIPS_CACHE_ALIASES;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 6e4413330e36..571aab064936 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -325,6 +325,38 @@ static inline void mem_init_free_highmem(void)
325#endif 325#endif
326} 326}
327 327
328unsigned __weak platform_maar_init(unsigned num_maars)
329{
330 return 0;
331}
332
333static void maar_init(void)
334{
335 unsigned num_maars, used, i;
336
337 if (!cpu_has_maar)
338 return;
339
340 /* Detect the number of MAARs */
341 write_c0_maari(~0);
342 back_to_back_c0_hazard();
343 num_maars = read_c0_maari() + 1;
344
345 /* MAARs should be in pairs */
346 WARN_ON(num_maars % 2);
347
348 /* Configure the required MAARs */
349 used = platform_maar_init(num_maars / 2);
350
351 /* Disable any further MAARs */
352 for (i = (used * 2); i < num_maars; i++) {
353 write_c0_maari(i);
354 back_to_back_c0_hazard();
355 write_c0_maar(0);
356 back_to_back_c0_hazard();
357 }
358}
359
328void __init mem_init(void) 360void __init mem_init(void)
329{ 361{
330#ifdef CONFIG_HIGHMEM 362#ifdef CONFIG_HIGHMEM
@@ -337,6 +369,7 @@ void __init mem_init(void)
337#endif 369#endif
338 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 370 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
339 371
372 maar_init();
340 free_all_bootmem(); 373 free_all_bootmem();
341 setup_zero_pages(); /* Setup zeroed pages. */ 374 setup_zero_pages(); /* Setup zeroed pages. */
342 mem_init_free_highmem(); 375 mem_init_free_highmem();
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
index d657493ef561..4094bbd42adf 100644
--- a/arch/mips/mm/tlb-r3k.c
+++ b/arch/mips/mm/tlb-r3k.c
@@ -158,7 +158,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
158{ 158{
159 int cpu = smp_processor_id(); 159 int cpu = smp_processor_id();
160 160
161 if (!vma || cpu_context(cpu, vma->vm_mm) != 0) { 161 if (cpu_context(cpu, vma->vm_mm) != 0) {
162 unsigned long flags; 162 unsigned long flags;
163 int oldpid, newpid, idx; 163 int oldpid, newpid, idx;
164 164
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 3914e27456f2..fa6ebd4bc9e9 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -57,6 +57,7 @@ void local_flush_tlb_all(void)
57 local_irq_save(flags); 57 local_irq_save(flags);
58 /* Save old context and create impossible VPN2 value */ 58 /* Save old context and create impossible VPN2 value */
59 old_ctx = read_c0_entryhi(); 59 old_ctx = read_c0_entryhi();
60 htw_stop();
60 write_c0_entrylo0(0); 61 write_c0_entrylo0(0);
61 write_c0_entrylo1(0); 62 write_c0_entrylo1(0);
62 63
@@ -90,6 +91,7 @@ void local_flush_tlb_all(void)
90 } 91 }
91 tlbw_use_hazard(); 92 tlbw_use_hazard();
92 write_c0_entryhi(old_ctx); 93 write_c0_entryhi(old_ctx);
94 htw_start();
93 flush_itlb(); 95 flush_itlb();
94 local_irq_restore(flags); 96 local_irq_restore(flags);
95} 97}
@@ -131,6 +133,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
131 int oldpid = read_c0_entryhi(); 133 int oldpid = read_c0_entryhi();
132 int newpid = cpu_asid(cpu, mm); 134 int newpid = cpu_asid(cpu, mm);
133 135
136 htw_stop();
134 while (start < end) { 137 while (start < end) {
135 int idx; 138 int idx;
136 139
@@ -151,6 +154,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
151 } 154 }
152 tlbw_use_hazard(); 155 tlbw_use_hazard();
153 write_c0_entryhi(oldpid); 156 write_c0_entryhi(oldpid);
157 htw_start();
154 } else { 158 } else {
155 drop_mmu_context(mm, cpu); 159 drop_mmu_context(mm, cpu);
156 } 160 }
@@ -174,6 +178,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
174 start &= (PAGE_MASK << 1); 178 start &= (PAGE_MASK << 1);
175 end += ((PAGE_SIZE << 1) - 1); 179 end += ((PAGE_SIZE << 1) - 1);
176 end &= (PAGE_MASK << 1); 180 end &= (PAGE_MASK << 1);
181 htw_stop();
177 182
178 while (start < end) { 183 while (start < end) {
179 int idx; 184 int idx;
@@ -195,6 +200,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
195 } 200 }
196 tlbw_use_hazard(); 201 tlbw_use_hazard();
197 write_c0_entryhi(pid); 202 write_c0_entryhi(pid);
203 htw_start();
198 } else { 204 } else {
199 local_flush_tlb_all(); 205 local_flush_tlb_all();
200 } 206 }
@@ -214,6 +220,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
214 page &= (PAGE_MASK << 1); 220 page &= (PAGE_MASK << 1);
215 local_irq_save(flags); 221 local_irq_save(flags);
216 oldpid = read_c0_entryhi(); 222 oldpid = read_c0_entryhi();
223 htw_stop();
217 write_c0_entryhi(page | newpid); 224 write_c0_entryhi(page | newpid);
218 mtc0_tlbw_hazard(); 225 mtc0_tlbw_hazard();
219 tlb_probe(); 226 tlb_probe();
@@ -231,6 +238,7 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
231 238
232 finish: 239 finish:
233 write_c0_entryhi(oldpid); 240 write_c0_entryhi(oldpid);
241 htw_start();
234 flush_itlb_vm(vma); 242 flush_itlb_vm(vma);
235 local_irq_restore(flags); 243 local_irq_restore(flags);
236 } 244 }
@@ -247,6 +255,7 @@ void local_flush_tlb_one(unsigned long page)
247 255
248 local_irq_save(flags); 256 local_irq_save(flags);
249 oldpid = read_c0_entryhi(); 257 oldpid = read_c0_entryhi();
258 htw_stop();
250 page &= (PAGE_MASK << 1); 259 page &= (PAGE_MASK << 1);
251 write_c0_entryhi(page); 260 write_c0_entryhi(page);
252 mtc0_tlbw_hazard(); 261 mtc0_tlbw_hazard();
@@ -263,6 +272,7 @@ void local_flush_tlb_one(unsigned long page)
263 tlbw_use_hazard(); 272 tlbw_use_hazard();
264 } 273 }
265 write_c0_entryhi(oldpid); 274 write_c0_entryhi(oldpid);
275 htw_start();
266 flush_itlb(); 276 flush_itlb();
267 local_irq_restore(flags); 277 local_irq_restore(flags);
268} 278}
@@ -351,6 +361,7 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
351 local_irq_save(flags); 361 local_irq_save(flags);
352 /* Save old context and create impossible VPN2 value */ 362 /* Save old context and create impossible VPN2 value */
353 old_ctx = read_c0_entryhi(); 363 old_ctx = read_c0_entryhi();
364 htw_stop();
354 old_pagemask = read_c0_pagemask(); 365 old_pagemask = read_c0_pagemask();
355 wired = read_c0_wired(); 366 wired = read_c0_wired();
356 write_c0_wired(wired + 1); 367 write_c0_wired(wired + 1);
@@ -366,6 +377,7 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
366 377
367 write_c0_entryhi(old_ctx); 378 write_c0_entryhi(old_ctx);
368 tlbw_use_hazard(); /* What is the hazard here? */ 379 tlbw_use_hazard(); /* What is the hazard here? */
380 htw_start();
369 write_c0_pagemask(old_pagemask); 381 write_c0_pagemask(old_pagemask);
370 local_flush_tlb_all(); 382 local_flush_tlb_all();
371 local_irq_restore(flags); 383 local_irq_restore(flags);
@@ -391,6 +403,51 @@ int __init has_transparent_hugepage(void)
391 403
392#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 404#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
393 405
406/*
407 * Used for loading TLB entries before trap_init() has started, when we
408 * don't actually want to add a wired entry which remains throughout the
409 * lifetime of the system
410 */
411
412int temp_tlb_entry __cpuinitdata;
413
414__init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
415 unsigned long entryhi, unsigned long pagemask)
416{
417 int ret = 0;
418 unsigned long flags;
419 unsigned long wired;
420 unsigned long old_pagemask;
421 unsigned long old_ctx;
422
423 local_irq_save(flags);
424 /* Save old context and create impossible VPN2 value */
425 old_ctx = read_c0_entryhi();
426 old_pagemask = read_c0_pagemask();
427 wired = read_c0_wired();
428 if (--temp_tlb_entry < wired) {
429 printk(KERN_WARNING
430 "No TLB space left for add_temporary_entry\n");
431 ret = -ENOSPC;
432 goto out;
433 }
434
435 write_c0_index(temp_tlb_entry);
436 write_c0_pagemask(pagemask);
437 write_c0_entryhi(entryhi);
438 write_c0_entrylo0(entrylo0);
439 write_c0_entrylo1(entrylo1);
440 mtc0_tlbw_hazard();
441 tlb_write_indexed();
442 tlbw_use_hazard();
443
444 write_c0_entryhi(old_ctx);
445 write_c0_pagemask(old_pagemask);
446out:
447 local_irq_restore(flags);
448 return ret;
449}
450
394static int ntlb; 451static int ntlb;
395static int __init set_ntlb(char *str) 452static int __init set_ntlb(char *str)
396{ 453{
@@ -431,6 +488,8 @@ static void r4k_tlb_configure(void)
431 write_c0_pagegrain(pg); 488 write_c0_pagegrain(pg);
432 } 489 }
433 490
491 temp_tlb_entry = current_cpu_data.tlbsize - 1;
492
434 /* From this point on the ARC firmware is dead. */ 493 /* From this point on the ARC firmware is dead. */
435 local_flush_tlb_all(); 494 local_flush_tlb_all();
436 495
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index e80e10bafc83..a08dd53a1cc5 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -429,6 +429,7 @@ static void build_r3000_tlb_refill_handler(void)
429 (unsigned int)(p - tlb_handler)); 429 (unsigned int)(p - tlb_handler));
430 430
431 memcpy((void *)ebase, tlb_handler, 0x80); 431 memcpy((void *)ebase, tlb_handler, 0x80);
432 local_flush_icache_range(ebase, ebase + 0x80);
432 433
433 dump_handler("r3000_tlb_refill", (u32 *)ebase, 32); 434 dump_handler("r3000_tlb_refill", (u32 *)ebase, 32);
434} 435}
@@ -1299,6 +1300,7 @@ static void build_r4000_tlb_refill_handler(void)
1299 } 1300 }
1300#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 1301#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1301 uasm_l_tlb_huge_update(&l, p); 1302 uasm_l_tlb_huge_update(&l, p);
1303 UASM_i_LW(&p, K0, 0, K1);
1302 build_huge_update_entries(&p, htlb_info.huge_pte, K1); 1304 build_huge_update_entries(&p, htlb_info.huge_pte, K1);
1303 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, 1305 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random,
1304 htlb_info.restore_scratch); 1306 htlb_info.restore_scratch);
@@ -1415,6 +1417,7 @@ static void build_r4000_tlb_refill_handler(void)
1415 final_len); 1417 final_len);
1416 1418
1417 memcpy((void *)ebase, final_handler, 0x100); 1419 memcpy((void *)ebase, final_handler, 0x100);
1420 local_flush_icache_range(ebase, ebase + 0x100);
1418 1421
1419 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64); 1422 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64);
1420} 1423}
@@ -1919,7 +1922,7 @@ static void build_r4000_tlb_load_handler(void)
1919 if (m4kc_tlbp_war()) 1922 if (m4kc_tlbp_war())
1920 build_tlb_probe_entry(&p); 1923 build_tlb_probe_entry(&p);
1921 1924
1922 if (cpu_has_rixi) { 1925 if (cpu_has_rixi && !cpu_has_rixiex) {
1923 /* 1926 /*
1924 * If the page is not _PAGE_VALID, RI or XI could not 1927 * If the page is not _PAGE_VALID, RI or XI could not
1925 * have triggered it. Skip the expensive test.. 1928 * have triggered it. Skip the expensive test..
@@ -1986,7 +1989,7 @@ static void build_r4000_tlb_load_handler(void)
1986 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl); 1989 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl);
1987 build_tlb_probe_entry(&p); 1990 build_tlb_probe_entry(&p);
1988 1991
1989 if (cpu_has_rixi) { 1992 if (cpu_has_rixi && !cpu_has_rixiex) {
1990 /* 1993 /*
1991 * If the page is not _PAGE_VALID, RI or XI could not 1994 * If the page is not _PAGE_VALID, RI or XI could not
1992 * have triggered it. Skip the expensive test.. 1995 * have triggered it. Skip the expensive test..
@@ -2194,6 +2197,94 @@ static void flush_tlb_handlers(void)
2194 (unsigned long)tlbmiss_handler_setup_pgd_end); 2197 (unsigned long)tlbmiss_handler_setup_pgd_end);
2195} 2198}
2196 2199
2200static void print_htw_config(void)
2201{
2202 unsigned long config;
2203 unsigned int pwctl;
2204 const int field = 2 * sizeof(unsigned long);
2205
2206 config = read_c0_pwfield();
2207 pr_debug("PWField (0x%0*lx): GDI: 0x%02lx UDI: 0x%02lx MDI: 0x%02lx PTI: 0x%02lx PTEI: 0x%02lx\n",
2208 field, config,
2209 (config & MIPS_PWFIELD_GDI_MASK) >> MIPS_PWFIELD_GDI_SHIFT,
2210 (config & MIPS_PWFIELD_UDI_MASK) >> MIPS_PWFIELD_UDI_SHIFT,
2211 (config & MIPS_PWFIELD_MDI_MASK) >> MIPS_PWFIELD_MDI_SHIFT,
2212 (config & MIPS_PWFIELD_PTI_MASK) >> MIPS_PWFIELD_PTI_SHIFT,
2213 (config & MIPS_PWFIELD_PTEI_MASK) >> MIPS_PWFIELD_PTEI_SHIFT);
2214
2215 config = read_c0_pwsize();
2216 pr_debug("PWSize (0x%0*lx): GDW: 0x%02lx UDW: 0x%02lx MDW: 0x%02lx PTW: 0x%02lx PTEW: 0x%02lx\n",
2217 field, config,
2218 (config & MIPS_PWSIZE_GDW_MASK) >> MIPS_PWSIZE_GDW_SHIFT,
2219 (config & MIPS_PWSIZE_UDW_MASK) >> MIPS_PWSIZE_UDW_SHIFT,
2220 (config & MIPS_PWSIZE_MDW_MASK) >> MIPS_PWSIZE_MDW_SHIFT,
2221 (config & MIPS_PWSIZE_PTW_MASK) >> MIPS_PWSIZE_PTW_SHIFT,
2222 (config & MIPS_PWSIZE_PTEW_MASK) >> MIPS_PWSIZE_PTEW_SHIFT);
2223
2224 pwctl = read_c0_pwctl();
2225 pr_debug("PWCtl (0x%x): PWEn: 0x%x DPH: 0x%x HugePg: 0x%x Psn: 0x%x\n",
2226 pwctl,
2227 (pwctl & MIPS_PWCTL_PWEN_MASK) >> MIPS_PWCTL_PWEN_SHIFT,
2228 (pwctl & MIPS_PWCTL_DPH_MASK) >> MIPS_PWCTL_DPH_SHIFT,
2229 (pwctl & MIPS_PWCTL_HUGEPG_MASK) >> MIPS_PWCTL_HUGEPG_SHIFT,
2230 (pwctl & MIPS_PWCTL_PSN_MASK) >> MIPS_PWCTL_PSN_SHIFT);
2231}
2232
2233static void config_htw_params(void)
2234{
2235 unsigned long pwfield, pwsize, ptei;
2236 unsigned int config;
2237
2238 /*
2239 * We are using 2-level page tables, so we only need to
2240 * setup GDW and PTW appropriately. UDW and MDW will remain 0.
2241 * The default value of GDI/UDI/MDI/PTI is 0xc. It is illegal to
2242 * write values less than 0xc in these fields because the entire
2243 * write will be dropped. As a result of which, we must preserve
2244 * the original reset values and overwrite only what we really want.
2245 */
2246
2247 pwfield = read_c0_pwfield();
2248 /* re-initialize the GDI field */
2249 pwfield &= ~MIPS_PWFIELD_GDI_MASK;
2250 pwfield |= PGDIR_SHIFT << MIPS_PWFIELD_GDI_SHIFT;
2251 /* re-initialize the PTI field including the even/odd bit */
2252 pwfield &= ~MIPS_PWFIELD_PTI_MASK;
2253 pwfield |= PAGE_SHIFT << MIPS_PWFIELD_PTI_SHIFT;
2254 /* Set the PTEI right shift */
2255 ptei = _PAGE_GLOBAL_SHIFT << MIPS_PWFIELD_PTEI_SHIFT;
2256 pwfield |= ptei;
2257 write_c0_pwfield(pwfield);
2258 /* Check whether the PTEI value is supported */
2259 back_to_back_c0_hazard();
2260 pwfield = read_c0_pwfield();
2261 if (((pwfield & MIPS_PWFIELD_PTEI_MASK) << MIPS_PWFIELD_PTEI_SHIFT)
2262 != ptei) {
2263 pr_warn("Unsupported PTEI field value: 0x%lx. HTW will not be enabled",
2264 ptei);
2265 /*
2266 * Drop option to avoid HTW being enabled via another path
2267 * (eg htw_reset())
2268 */
2269 current_cpu_data.options &= ~MIPS_CPU_HTW;
2270 return;
2271 }
2272
2273 pwsize = ilog2(PTRS_PER_PGD) << MIPS_PWSIZE_GDW_SHIFT;
2274 pwsize |= ilog2(PTRS_PER_PTE) << MIPS_PWSIZE_PTW_SHIFT;
2275 write_c0_pwsize(pwsize);
2276
2277 /* Make sure everything is set before we enable the HTW */
2278 back_to_back_c0_hazard();
2279
2280 /* Enable HTW and disable the rest of the pwctl fields */
2281 config = 1 << MIPS_PWCTL_PWEN_SHIFT;
2282 write_c0_pwctl(config);
2283 pr_info("Hardware Page Table Walker enabled\n");
2284
2285 print_htw_config();
2286}
2287
2197void build_tlb_refill_handler(void) 2288void build_tlb_refill_handler(void)
2198{ 2289{
2199 /* 2290 /*
@@ -2258,5 +2349,8 @@ void build_tlb_refill_handler(void)
2258 } 2349 }
2259 if (cpu_has_local_ebase) 2350 if (cpu_has_local_ebase)
2260 build_r4000_tlb_refill_handler(); 2351 build_r4000_tlb_refill_handler();
2352 if (cpu_has_htw)
2353 config_htw_params();
2354
2261 } 2355 }
2262} 2356}
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index ecc2785f7858..e4f43baa8f67 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -42,6 +42,10 @@ static unsigned int ipi_map[NR_CPUS];
42 42
43static DEFINE_RAW_SPINLOCK(mips_irq_lock); 43static DEFINE_RAW_SPINLOCK(mips_irq_lock);
44 44
45#ifdef CONFIG_MIPS_GIC_IPI
46DECLARE_BITMAP(ipi_ints, GIC_NUM_INTRS);
47#endif
48
45static inline int mips_pcibios_iack(void) 49static inline int mips_pcibios_iack(void)
46{ 50{
47 int irq; 51 int irq;
@@ -125,16 +129,22 @@ static void malta_hw0_irqdispatch(void)
125 129
126static void malta_ipi_irqdispatch(void) 130static void malta_ipi_irqdispatch(void)
127{ 131{
128 int irq; 132#ifdef CONFIG_MIPS_GIC_IPI
133 unsigned long irq;
134 DECLARE_BITMAP(pending, GIC_NUM_INTRS);
129 135
130 if (gic_compare_int()) 136 gic_get_int_mask(pending, ipi_ints);
131 do_IRQ(MIPS_GIC_IRQ_BASE); 137
138 irq = find_first_bit(pending, GIC_NUM_INTRS);
132 139
133 irq = gic_get_int(); 140 while (irq < GIC_NUM_INTRS) {
134 if (irq < 0) 141 do_IRQ(MIPS_GIC_IRQ_BASE + irq);
135 return; /* interrupt has already been cleared */
136 142
137 do_IRQ(MIPS_GIC_IRQ_BASE + irq); 143 irq = find_next_bit(pending, GIC_NUM_INTRS, irq + 1);
144 }
145#endif
146 if (gic_compare_int())
147 do_IRQ(MIPS_GIC_IRQ_BASE);
138} 148}
139 149
140static void corehi_irqdispatch(void) 150static void corehi_irqdispatch(void)
@@ -427,8 +437,9 @@ static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin)
427 gic_intr_map[intr].pin = cpupin; 437 gic_intr_map[intr].pin = cpupin;
428 gic_intr_map[intr].polarity = GIC_POL_POS; 438 gic_intr_map[intr].polarity = GIC_POL_POS;
429 gic_intr_map[intr].trigtype = GIC_TRIG_EDGE; 439 gic_intr_map[intr].trigtype = GIC_TRIG_EDGE;
430 gic_intr_map[intr].flags = GIC_FLAG_IPI; 440 gic_intr_map[intr].flags = 0;
431 ipi_map[cpu] |= (1 << (cpupin + 2)); 441 ipi_map[cpu] |= (1 << (cpupin + 2));
442 bitmap_set(ipi_ints, intr, 1);
432} 443}
433 444
434static void __init fill_ipi_map(void) 445static void __init fill_ipi_map(void)
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 6d9773096750..0c35dee0a215 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17 17
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19#include <asm/maar.h>
19#include <asm/sections.h> 20#include <asm/sections.h>
20#include <asm/fw/fw.h> 21#include <asm/fw/fw.h>
21 22
@@ -164,3 +165,28 @@ void __init prom_free_prom_memory(void)
164 addr, addr + boot_mem_map.map[i].size); 165 addr, addr + boot_mem_map.map[i].size);
165 } 166 }
166} 167}
168
169unsigned platform_maar_init(unsigned num_pairs)
170{
171 phys_addr_t mem_end = (physical_memsize & ~0xffffull) - 1;
172 struct maar_config cfg[] = {
173 /* DRAM preceding I/O */
174 { 0x00000000, 0x0fffffff, MIPS_MAAR_S },
175
176 /* DRAM following I/O */
177 { 0x20000000, mem_end, MIPS_MAAR_S },
178
179 /* DRAM alias in upper half of physical */
180 { 0x80000000, 0x80000000 + mem_end, MIPS_MAAR_S },
181 };
182 unsigned i, num_cfg = ARRAY_SIZE(cfg);
183
184 /* If DRAM fits before I/O, drop the region following it */
185 if (physical_memsize <= 0x10000000) {
186 num_cfg--;
187 for (i = 1; i < num_cfg; i++)
188 cfg[i] = cfg[i + 1];
189 }
190
191 return maar_config(cfg, num_cfg, num_pairs);
192}
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index b87390a56a2f..05a56619ece2 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -131,7 +131,7 @@
131 * @target: Memory location for the compiled filter 131 * @target: Memory location for the compiled filter
132 */ 132 */
133struct jit_ctx { 133struct jit_ctx {
134 const struct sk_filter *skf; 134 const struct bpf_prog *skf;
135 unsigned int prologue_bytes; 135 unsigned int prologue_bytes;
136 u32 idx; 136 u32 idx;
137 u32 flags; 137 u32 flags;
@@ -789,7 +789,7 @@ static int pkt_type_offset(void)
789static int build_body(struct jit_ctx *ctx) 789static int build_body(struct jit_ctx *ctx)
790{ 790{
791 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; 791 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w};
792 const struct sk_filter *prog = ctx->skf; 792 const struct bpf_prog *prog = ctx->skf;
793 const struct sock_filter *inst; 793 const struct sock_filter *inst;
794 unsigned int i, off, load_order, condt; 794 unsigned int i, off, load_order, condt;
795 u32 k, b_off __maybe_unused; 795 u32 k, b_off __maybe_unused;
@@ -1369,7 +1369,7 @@ jmp_cmp:
1369 1369
1370int bpf_jit_enable __read_mostly; 1370int bpf_jit_enable __read_mostly;
1371 1371
1372void bpf_jit_compile(struct sk_filter *fp) 1372void bpf_jit_compile(struct bpf_prog *fp)
1373{ 1373{
1374 struct jit_ctx ctx; 1374 struct jit_ctx ctx;
1375 unsigned int alloc_size, tmp_idx; 1375 unsigned int alloc_size, tmp_idx;
@@ -1423,7 +1423,7 @@ out:
1423 kfree(ctx.offsets); 1423 kfree(ctx.offsets);
1424} 1424}
1425 1425
1426void bpf_jit_free(struct sk_filter *fp) 1426void bpf_jit_free(struct bpf_prog *fp)
1427{ 1427{
1428 if (fp->jited) 1428 if (fp->jited)
1429 module_free(NULL, fp->bpf_func); 1429 module_free(NULL, fp->bpf_func);
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index ff8a5539b363..6523d558ff5a 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_LASAT) += pci-lasat.o
29obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o 29obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
30obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o 30obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o
31obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o 31obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o
32obj-$(CONFIG_LEMOTE_MACH3A) += fixup-loongson3.o ops-loongson3.o 32obj-$(CONFIG_LOONGSON_MACH3X) += fixup-loongson3.o ops-loongson3.o
33obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o pci-malta.o 33obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o pci-malta.o
34obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o 34obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o
35obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o 35obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index 0e046d82e4e3..d54ea93651ac 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -199,8 +199,6 @@ static struct {
199 199
200char *tx4927_pcibios_setup(char *str) 200char *tx4927_pcibios_setup(char *str)
201{ 201{
202 unsigned long val;
203
204 if (!strncmp(str, "trdyto=", 7)) { 202 if (!strncmp(str, "trdyto=", 7)) {
205 u8 val = 0; 203 u8 val = 0;
206 if (kstrtou8(str + 7, 0, &val) == 0) 204 if (kstrtou8(str + 7, 0, &val) == 0)
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index 563d1f61d6ee..c19600a03460 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -7,6 +7,7 @@
7 * Support for all devices (greater than 16) added by David Gathright. 7 * Support for all devices (greater than 16) added by David Gathright.
8 */ 8 */
9 9
10#include <linux/clk.h>
10#include <linux/export.h> 11#include <linux/export.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/pci.h> 13#include <linux/pci.h>
@@ -364,6 +365,7 @@ static int alchemy_pci_probe(struct platform_device *pdev)
364 void __iomem *virt_io; 365 void __iomem *virt_io;
365 unsigned long val; 366 unsigned long val;
366 struct resource *r; 367 struct resource *r;
368 struct clk *c;
367 int ret; 369 int ret;
368 370
369 /* need at least PCI IRQ mapping table */ 371 /* need at least PCI IRQ mapping table */
@@ -393,11 +395,24 @@ static int alchemy_pci_probe(struct platform_device *pdev)
393 goto out1; 395 goto out1;
394 } 396 }
395 397
398 c = clk_get(&pdev->dev, "pci_clko");
399 if (IS_ERR(c)) {
400 dev_err(&pdev->dev, "unable to find PCI clock\n");
401 ret = PTR_ERR(c);
402 goto out2;
403 }
404
405 ret = clk_prepare_enable(c);
406 if (ret) {
407 dev_err(&pdev->dev, "cannot enable PCI clock\n");
408 goto out6;
409 }
410
396 ctx->regs = ioremap_nocache(r->start, resource_size(r)); 411 ctx->regs = ioremap_nocache(r->start, resource_size(r));
397 if (!ctx->regs) { 412 if (!ctx->regs) {
398 dev_err(&pdev->dev, "cannot map pci regs\n"); 413 dev_err(&pdev->dev, "cannot map pci regs\n");
399 ret = -ENODEV; 414 ret = -ENODEV;
400 goto out2; 415 goto out5;
401 } 416 }
402 417
403 /* map parts of the PCI IO area */ 418 /* map parts of the PCI IO area */
@@ -465,12 +480,19 @@ static int alchemy_pci_probe(struct platform_device *pdev)
465 register_syscore_ops(&alchemy_pci_pmops); 480 register_syscore_ops(&alchemy_pci_pmops);
466 register_pci_controller(&ctx->alchemy_pci_ctrl); 481 register_pci_controller(&ctx->alchemy_pci_ctrl);
467 482
483 dev_info(&pdev->dev, "PCI controller at %ld MHz\n",
484 clk_get_rate(c) / 1000000);
485
468 return 0; 486 return 0;
469 487
470out4: 488out4:
471 iounmap(virt_io); 489 iounmap(virt_io);
472out3: 490out3:
473 iounmap(ctx->regs); 491 iounmap(ctx->regs);
492out5:
493 clk_disable_unprepare(c);
494out6:
495 clk_put(c);
474out2: 496out2:
475 release_mem_region(r->start, resource_size(r)); 497 release_mem_region(r->start, resource_size(r));
476out1: 498out1:
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 251395210e23..7c4598cb6de8 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -81,7 +81,7 @@ static int __init plat_of_setup(void)
81 panic("device tree not present"); 81 panic("device tree not present");
82 82
83 strlcpy(of_ids[0].compatible, soc_info.compatible, len); 83 strlcpy(of_ids[0].compatible, soc_info.compatible, len);
84 strncpy(of_ids[1].compatible, "palmbus", len); 84 strlcpy(of_ids[1].compatible, "palmbus", len);
85 85
86 if (of_platform_populate(NULL, of_ids, NULL, NULL)) 86 if (of_platform_populate(NULL, of_ids, NULL, NULL))
87 panic("failed to populate DT"); 87 panic("failed to populate DT");
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 3af00b2a26ee..e31e8cdcb296 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -223,6 +223,7 @@ static struct platform_device rb532_wdt = {
223 223
224static struct plat_serial8250_port rb532_uart_res[] = { 224static struct plat_serial8250_port rb532_uart_res[] = {
225 { 225 {
226 .type = PORT_16550A,
226 .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE), 227 .membase = (char *)KSEG1ADDR(REGBASE + UART0BASE),
227 .irq = UART0_IRQ, 228 .irq = UART0_IRQ,
228 .regshift = 2, 229 .regshift = 2,
@@ -250,28 +251,6 @@ static struct platform_device *rb532_devs[] = {
250 &rb532_wdt 251 &rb532_wdt
251}; 252};
252 253
253static void __init parse_mac_addr(char *macstr)
254{
255 int i, h, l;
256
257 for (i = 0; i < 6; i++) {
258 if (i != 5 && *(macstr + 2) != ':')
259 return;
260
261 h = hex_to_bin(*macstr++);
262 if (h == -1)
263 return;
264
265 l = hex_to_bin(*macstr++);
266 if (l == -1)
267 return;
268
269 macstr++;
270 korina_dev0_data.mac[i] = (h << 4) + l;
271 }
272}
273
274
275/* NAND definitions */ 254/* NAND definitions */
276#define NAND_CHIP_DELAY 25 255#define NAND_CHIP_DELAY 25
277 256
@@ -333,7 +312,10 @@ static int __init plat_setup_devices(void)
333static int __init setup_kmac(char *s) 312static int __init setup_kmac(char *s)
334{ 313{
335 printk(KERN_INFO "korina mac = %s\n", s); 314 printk(KERN_INFO "korina mac = %s\n", s);
336 parse_mac_addr(s); 315 if (!mac_pton(s, korina_dev0_data.mac)) {
316 printk(KERN_ERR "Invalid mac\n");
317 return -EINVAL;
318 }
337 return 0; 319 return 0;
338} 320}
339 321
diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index 8e52446286ca..8f1b86d4da84 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -27,8 +27,14 @@ static struct {
27 { .name = "SGI GR2/GR3", .id = 0x7f }, 27 { .name = "SGI GR2/GR3", .id = 0x7f },
28}; 28};
29 29
30static void gio_bus_release(struct device *dev)
31{
32 kfree(dev);
33}
34
30static struct device gio_bus = { 35static struct device gio_bus = {
31 .init_name = "gio", 36 .init_name = "gio",
37 .release = &gio_bus_release,
32}; 38};
33 39
34/** 40/**
@@ -413,8 +419,10 @@ int __init ip22_gio_init(void)
413 int ret; 419 int ret;
414 420
415 ret = device_register(&gio_bus); 421 ret = device_register(&gio_bus);
416 if (ret) 422 if (ret) {
423 put_device(&gio_bus);
417 return ret; 424 return ret;
425 }
418 426
419 ret = bus_register(&gio_bus_type); 427 ret = bus_register(&gio_bus_type);
420 if (!ret) { 428 if (!ret) {
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c
index 4642f56e70e5..566c58bd44d0 100644
--- a/arch/mips/txx9/generic/7segled.c
+++ b/arch/mips/txx9/generic/7segled.c
@@ -83,6 +83,11 @@ static struct bus_type tx_7segled_subsys = {
83 .dev_name = "7segled", 83 .dev_name = "7segled",
84}; 84};
85 85
86static void tx_7segled_release(struct device *dev)
87{
88 kfree(dev);
89}
90
86static int __init tx_7segled_init_sysfs(void) 91static int __init tx_7segled_init_sysfs(void)
87{ 92{
88 int error, i; 93 int error, i;
@@ -103,11 +108,14 @@ static int __init tx_7segled_init_sysfs(void)
103 } 108 }
104 dev->id = i; 109 dev->id = i;
105 dev->bus = &tx_7segled_subsys; 110 dev->bus = &tx_7segled_subsys;
111 dev->release = &tx_7segled_release;
106 error = device_register(dev); 112 error = device_register(dev);
107 if (!error) { 113 if (error) {
108 device_create_file(dev, &dev_attr_ascii); 114 put_device(dev);
109 device_create_file(dev, &dev_attr_raw); 115 return error;
110 } 116 }
117 device_create_file(dev, &dev_attr_ascii);
118 device_create_file(dev, &dev_attr_raw);
111 } 119 }
112 return error; 120 return error;
113} 121}
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 28713274e0cc..a77698ff2b6f 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -268,7 +268,7 @@ static int txx9_i8259_irq_setup(int irq)
268 return err; 268 return err;
269} 269}
270 270
271static void quirk_slc90e66_bridge(struct pci_dev *dev) 271static void __init_refok quirk_slc90e66_bridge(struct pci_dev *dev)
272{ 272{
273 int irq; /* PCI/ISA Bridge interrupt */ 273 int irq; /* PCI/ISA Bridge interrupt */
274 u8 reg_64; 274 u8 reg_64;
@@ -331,7 +331,7 @@ static void quirk_slc90e66_ide(struct pci_dev *dev)
331 * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!! 331 * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
332 */ 332 */
333 dat |= 0x01; 333 dat |= 0x01;
334 pci_write_config_byte(dev, regs[i], dat); 334 pci_write_config_byte(dev, 0x5c, dat);
335 pci_read_config_byte(dev, 0x5c, &dat); 335 pci_read_config_byte(dev, 0x5c, &dat);
336 printk(KERN_CONT " REG5C %02x", dat); 336 printk(KERN_CONT " REG5C %02x", dat);
337 printk(KERN_CONT "\n"); 337 printk(KERN_CONT "\n");
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index dd2cf25b5ae5..9ff200ae1c9a 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -937,6 +937,14 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj,
937 return size; 937 return size;
938} 938}
939 939
940static void txx9_device_release(struct device *dev)
941{
942 struct txx9_sramc_dev *tdev;
943
944 tdev = container_of(dev, struct txx9_sramc_dev, dev);
945 kfree(tdev);
946}
947
940void __init txx9_sramc_init(struct resource *r) 948void __init txx9_sramc_init(struct resource *r)
941{ 949{
942 struct txx9_sramc_dev *dev; 950 struct txx9_sramc_dev *dev;
@@ -951,8 +959,11 @@ void __init txx9_sramc_init(struct resource *r)
951 return; 959 return;
952 size = resource_size(r); 960 size = resource_size(r);
953 dev->base = ioremap(r->start, size); 961 dev->base = ioremap(r->start, size);
954 if (!dev->base) 962 if (!dev->base) {
955 goto exit; 963 kfree(dev);
964 return;
965 }
966 dev->dev.release = &txx9_device_release;
956 dev->dev.bus = &txx9_sramc_subsys; 967 dev->dev.bus = &txx9_sramc_subsys;
957 sysfs_bin_attr_init(&dev->bindata_attr); 968 sysfs_bin_attr_init(&dev->bindata_attr);
958 dev->bindata_attr.attr.name = "bindata"; 969 dev->bindata_attr.attr.name = "bindata";
@@ -963,17 +974,15 @@ void __init txx9_sramc_init(struct resource *r)
963 dev->bindata_attr.private = dev; 974 dev->bindata_attr.private = dev;
964 err = device_register(&dev->dev); 975 err = device_register(&dev->dev);
965 if (err) 976 if (err)
966 goto exit; 977 goto exit_put;
967 err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); 978 err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
968 if (err) { 979 if (err) {
969 device_unregister(&dev->dev); 980 device_unregister(&dev->dev);
970 goto exit; 981 iounmap(dev->base);
971 }
972 return;
973exit:
974 if (dev) {
975 if (dev->base)
976 iounmap(dev->base);
977 kfree(dev); 982 kfree(dev);
978 } 983 }
984 return;
985exit_put:
986 put_device(&dev->dev);
987 return;
979} 988}
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index 654d5ba6e310..ecbd6676bd33 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -6,4 +6,5 @@ generic-y += exec.h
6generic-y += hash.h 6generic-y += hash.h
7generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
8generic-y += preempt.h 8generic-y += preempt.h
9generic-y += scatterlist.h
9generic-y += trace_clock.h 10generic-y += trace_clock.h
diff --git a/arch/mn10300/include/asm/scatterlist.h b/arch/mn10300/include/asm/scatterlist.h
deleted file mode 100644
index 7baa4006008a..000000000000
--- a/arch/mn10300/include/asm/scatterlist.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* MN10300 Scatterlist definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SCATTERLIST_H
12#define _ASM_SCATTERLIST_H
13
14#include <asm-generic/scatterlist.h>
15
16#endif /* _ASM_SCATTERLIST_H */
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index 9dfac5cd16e6..a6c0858592c3 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -186,20 +186,11 @@ static int setup_sigcontext(struct sigcontext __user *sc,
186/* 186/*
187 * determine which stack to use.. 187 * determine which stack to use..
188 */ 188 */
189static inline void __user *get_sigframe(struct k_sigaction *ka, 189static inline void __user *get_sigframe(struct ksignal *ksig,
190 struct pt_regs *regs, 190 struct pt_regs *regs,
191 size_t frame_size) 191 size_t frame_size)
192{ 192{
193 unsigned long sp; 193 unsigned long sp = sigsp(regs->sp, ksig);
194
195 /* default to using normal stack */
196 sp = regs->sp;
197
198 /* this is the X/Open sanctioned signal stack switching. */
199 if (ka->sa.sa_flags & SA_ONSTACK) {
200 if (sas_ss_flags(sp) == 0)
201 sp = current->sas_ss_sp + current->sas_ss_size;
202 }
203 194
204 return (void __user *) ((sp - frame_size) & ~7UL); 195 return (void __user *) ((sp - frame_size) & ~7UL);
205} 196}
@@ -207,16 +198,16 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
207/* 198/*
208 * set up a normal signal frame 199 * set up a normal signal frame
209 */ 200 */
210static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 201static int setup_frame(struct ksignal *ksig, sigset_t *set,
211 struct pt_regs *regs) 202 struct pt_regs *regs)
212{ 203{
213 struct sigframe __user *frame; 204 struct sigframe __user *frame;
214 int rsig; 205 int rsig, sig = ksig->sig;
215 206
216 frame = get_sigframe(ka, regs, sizeof(*frame)); 207 frame = get_sigframe(ksig, regs, sizeof(*frame));
217 208
218 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 209 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
219 goto give_sigsegv; 210 return -EFAULT;
220 211
221 rsig = sig; 212 rsig = sig;
222 if (sig < 32 && 213 if (sig < 32 &&
@@ -226,40 +217,40 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
226 217
227 if (__put_user(rsig, &frame->sig) < 0 || 218 if (__put_user(rsig, &frame->sig) < 0 ||
228 __put_user(&frame->sc, &frame->psc) < 0) 219 __put_user(&frame->sc, &frame->psc) < 0)
229 goto give_sigsegv; 220 return -EFAULT;
230 221
231 if (setup_sigcontext(&frame->sc, &frame->fpuctx, regs, set->sig[0])) 222 if (setup_sigcontext(&frame->sc, &frame->fpuctx, regs, set->sig[0]))
232 goto give_sigsegv; 223 return -EFAULT;
233 224
234 if (_NSIG_WORDS > 1) { 225 if (_NSIG_WORDS > 1) {
235 if (__copy_to_user(frame->extramask, &set->sig[1], 226 if (__copy_to_user(frame->extramask, &set->sig[1],
236 sizeof(frame->extramask))) 227 sizeof(frame->extramask)))
237 goto give_sigsegv; 228 return -EFAULT;
238 } 229 }
239 230
240 /* set up to return from userspace. If provided, use a stub already in 231 /* set up to return from userspace. If provided, use a stub already in
241 * userspace */ 232 * userspace */
242 if (ka->sa.sa_flags & SA_RESTORER) { 233 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
243 if (__put_user(ka->sa.sa_restorer, &frame->pretcode)) 234 if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode))
244 goto give_sigsegv; 235 return -EFAULT;
245 } else { 236 } else {
246 if (__put_user((void (*)(void))frame->retcode, 237 if (__put_user((void (*)(void))frame->retcode,
247 &frame->pretcode)) 238 &frame->pretcode))
248 goto give_sigsegv; 239 return -EFAULT;
249 /* this is mov $,d0; syscall 0 */ 240 /* this is mov $,d0; syscall 0 */
250 if (__put_user(0x2c, (char *)(frame->retcode + 0)) || 241 if (__put_user(0x2c, (char *)(frame->retcode + 0)) ||
251 __put_user(__NR_sigreturn, (char *)(frame->retcode + 1)) || 242 __put_user(__NR_sigreturn, (char *)(frame->retcode + 1)) ||
252 __put_user(0x00, (char *)(frame->retcode + 2)) || 243 __put_user(0x00, (char *)(frame->retcode + 2)) ||
253 __put_user(0xf0, (char *)(frame->retcode + 3)) || 244 __put_user(0xf0, (char *)(frame->retcode + 3)) ||
254 __put_user(0xe0, (char *)(frame->retcode + 4))) 245 __put_user(0xe0, (char *)(frame->retcode + 4)))
255 goto give_sigsegv; 246 return -EFAULT;
256 flush_icache_range((unsigned long) frame->retcode, 247 flush_icache_range((unsigned long) frame->retcode,
257 (unsigned long) frame->retcode + 5); 248 (unsigned long) frame->retcode + 5);
258 } 249 }
259 250
260 /* set up registers for signal handler */ 251 /* set up registers for signal handler */
261 regs->sp = (unsigned long) frame; 252 regs->sp = (unsigned long) frame;
262 regs->pc = (unsigned long) ka->sa.sa_handler; 253 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
263 regs->d0 = sig; 254 regs->d0 = sig;
264 regs->d1 = (unsigned long) &frame->sc; 255 regs->d1 = (unsigned long) &frame->sc;
265 256
@@ -270,25 +261,21 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
270#endif 261#endif
271 262
272 return 0; 263 return 0;
273
274give_sigsegv:
275 force_sigsegv(sig, current);
276 return -EFAULT;
277} 264}
278 265
279/* 266/*
280 * set up a realtime signal frame 267 * set up a realtime signal frame
281 */ 268 */
282static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 269static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
283 sigset_t *set, struct pt_regs *regs) 270 struct pt_regs *regs)
284{ 271{
285 struct rt_sigframe __user *frame; 272 struct rt_sigframe __user *frame;
286 int rsig; 273 int rsig, sig = ksig->sig;
287 274
288 frame = get_sigframe(ka, regs, sizeof(*frame)); 275 frame = get_sigframe(ksig, regs, sizeof(*frame));
289 276
290 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 277 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
291 goto give_sigsegv; 278 return -EFAULT;
292 279
293 rsig = sig; 280 rsig = sig;
294 if (sig < 32 && 281 if (sig < 32 &&
@@ -299,8 +286,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
299 if (__put_user(rsig, &frame->sig) || 286 if (__put_user(rsig, &frame->sig) ||
300 __put_user(&frame->info, &frame->pinfo) || 287 __put_user(&frame->info, &frame->pinfo) ||
301 __put_user(&frame->uc, &frame->puc) || 288 __put_user(&frame->uc, &frame->puc) ||
302 copy_siginfo_to_user(&frame->info, info)) 289 copy_siginfo_to_user(&frame->info, &ksig->info))
303 goto give_sigsegv; 290 return -EFAULT;
304 291
305 /* create the ucontext. */ 292 /* create the ucontext. */
306 if (__put_user(0, &frame->uc.uc_flags) || 293 if (__put_user(0, &frame->uc.uc_flags) ||
@@ -309,13 +296,14 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
309 setup_sigcontext(&frame->uc.uc_mcontext, 296 setup_sigcontext(&frame->uc.uc_mcontext,
310 &frame->fpuctx, regs, set->sig[0]) || 297 &frame->fpuctx, regs, set->sig[0]) ||
311 __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set))) 298 __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)))
312 goto give_sigsegv; 299 return -EFAULT;
313 300
314 /* set up to return from userspace. If provided, use a stub already in 301 /* set up to return from userspace. If provided, use a stub already in
315 * userspace */ 302 * userspace */
316 if (ka->sa.sa_flags & SA_RESTORER) { 303 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
317 if (__put_user(ka->sa.sa_restorer, &frame->pretcode)) 304 if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode))
318 goto give_sigsegv; 305 return -EFAULT;
306
319 } else { 307 } else {
320 if (__put_user((void(*)(void))frame->retcode, 308 if (__put_user((void(*)(void))frame->retcode,
321 &frame->pretcode) || 309 &frame->pretcode) ||
@@ -326,7 +314,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
326 __put_user(0x00, (char *)(frame->retcode + 2)) || 314 __put_user(0x00, (char *)(frame->retcode + 2)) ||
327 __put_user(0xf0, (char *)(frame->retcode + 3)) || 315 __put_user(0xf0, (char *)(frame->retcode + 3)) ||
328 __put_user(0xe0, (char *)(frame->retcode + 4))) 316 __put_user(0xe0, (char *)(frame->retcode + 4)))
329 goto give_sigsegv; 317 return -EFAULT;
330 318
331 flush_icache_range((u_long) frame->retcode, 319 flush_icache_range((u_long) frame->retcode,
332 (u_long) frame->retcode + 5); 320 (u_long) frame->retcode + 5);
@@ -334,7 +322,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
334 322
335 /* Set up registers for signal handler */ 323 /* Set up registers for signal handler */
336 regs->sp = (unsigned long) frame; 324 regs->sp = (unsigned long) frame;
337 regs->pc = (unsigned long) ka->sa.sa_handler; 325 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
338 regs->d0 = sig; 326 regs->d0 = sig;
339 regs->d1 = (long) &frame->info; 327 regs->d1 = (long) &frame->info;
340 328
@@ -345,10 +333,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
345#endif 333#endif
346 334
347 return 0; 335 return 0;
348
349give_sigsegv:
350 force_sigsegv(sig, current);
351 return -EFAULT;
352} 336}
353 337
354static inline void stepback(struct pt_regs *regs) 338static inline void stepback(struct pt_regs *regs)
@@ -360,9 +344,7 @@ static inline void stepback(struct pt_regs *regs)
360/* 344/*
361 * handle the actual delivery of a signal to userspace 345 * handle the actual delivery of a signal to userspace
362 */ 346 */
363static int handle_signal(int sig, 347static int handle_signal(struct ksignal *ksig, struct pt_regs *regs)
364 siginfo_t *info, struct k_sigaction *ka,
365 struct pt_regs *regs)
366{ 348{
367 sigset_t *oldset = sigmask_to_save(); 349 sigset_t *oldset = sigmask_to_save();
368 int ret; 350 int ret;
@@ -377,7 +359,7 @@ static int handle_signal(int sig,
377 break; 359 break;
378 360
379 case -ERESTARTSYS: 361 case -ERESTARTSYS:
380 if (!(ka->sa.sa_flags & SA_RESTART)) { 362 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
381 regs->d0 = -EINTR; 363 regs->d0 = -EINTR;
382 break; 364 break;
383 } 365 }
@@ -390,15 +372,12 @@ static int handle_signal(int sig,
390 } 372 }
391 373
392 /* Set up the stack frame */ 374 /* Set up the stack frame */
393 if (ka->sa.sa_flags & SA_SIGINFO) 375 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
394 ret = setup_rt_frame(sig, ka, info, oldset, regs); 376 ret = setup_rt_frame(ksig, oldset, regs);
395 else 377 else
396 ret = setup_frame(sig, ka, oldset, regs); 378 ret = setup_frame(ksig, oldset, regs);
397 if (ret)
398 return ret;
399 379
400 signal_delivered(sig, info, ka, regs, 380 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
401 test_thread_flag(TIF_SINGLESTEP));
402 return 0; 381 return 0;
403} 382}
404 383
@@ -407,15 +386,10 @@ static int handle_signal(int sig,
407 */ 386 */
408static void do_signal(struct pt_regs *regs) 387static void do_signal(struct pt_regs *regs)
409{ 388{
410 struct k_sigaction ka; 389 struct ksignal ksig;
411 siginfo_t info;
412 int signr;
413
414 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
415 if (signr > 0) {
416 if (handle_signal(signr, &info, &ka, regs) == 0) {
417 }
418 390
391 if (get_signal(&ksig)) {
392 handle_signal(&ksig, regs);
419 return; 393 return;
420 } 394 }
421 395
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index e71d712afb79..88e83368bbf5 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -22,6 +22,7 @@ config OPENRISC
22 select GENERIC_STRNLEN_USER 22 select GENERIC_STRNLEN_USER
23 select MODULES_USE_ELF_RELA 23 select MODULES_USE_ELF_RELA
24 select HAVE_DEBUG_STACKOVERFLOW 24 select HAVE_DEBUG_STACKOVERFLOW
25 select OR1K_PIC
25 26
26config MMU 27config MMU
27 def_bool y 28 def_bool y
diff --git a/arch/openrisc/include/asm/irq.h b/arch/openrisc/include/asm/irq.h
index eb612b1865d2..b84634cc95eb 100644
--- a/arch/openrisc/include/asm/irq.h
+++ b/arch/openrisc/include/asm/irq.h
@@ -24,4 +24,7 @@
24 24
25#define NO_IRQ (-1) 25#define NO_IRQ (-1)
26 26
27void handle_IRQ(unsigned int, struct pt_regs *);
28extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
29
27#endif /* __ASM_OPENRISC_IRQ_H__ */ 30#endif /* __ASM_OPENRISC_IRQ_H__ */
diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 8ec77bc9f1e7..967eb1430203 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -16,11 +16,10 @@
16 16
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/of.h>
20#include <linux/ftrace.h> 19#include <linux/ftrace.h>
21#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/irqchip.h>
22#include <linux/export.h> 22#include <linux/export.h>
23#include <linux/irqdomain.h>
24#include <linux/irqflags.h> 23#include <linux/irqflags.h>
25 24
26/* read interrupt enabled status */ 25/* read interrupt enabled status */
@@ -37,150 +36,31 @@ void arch_local_irq_restore(unsigned long flags)
37} 36}
38EXPORT_SYMBOL(arch_local_irq_restore); 37EXPORT_SYMBOL(arch_local_irq_restore);
39 38
40 39void __init init_IRQ(void)
41/* OR1K PIC implementation */
42
43/* We're a couple of cycles faster than the generic implementations with
44 * these 'fast' versions.
45 */
46
47static void or1k_pic_mask(struct irq_data *data)
48{
49 mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(1UL << data->hwirq));
50}
51
52static void or1k_pic_unmask(struct irq_data *data)
53{
54 mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (1UL << data->hwirq));
55}
56
57static void or1k_pic_ack(struct irq_data *data)
58{
59 /* EDGE-triggered interrupts need to be ack'ed in order to clear
60 * the latch.
61 * LEVEL-triggered interrupts do not need to be ack'ed; however,
62 * ack'ing the interrupt has no ill-effect and is quicker than
63 * trying to figure out what type it is...
64 */
65
66 /* The OpenRISC 1000 spec says to write a 1 to the bit to ack the
67 * interrupt, but the OR1200 does this backwards and requires a 0
68 * to be written...
69 */
70
71#ifdef CONFIG_OR1K_1200
72 /* There are two oddities with the OR1200 PIC implementation:
73 * i) LEVEL-triggered interrupts are latched and need to be cleared
74 * ii) the interrupt latch is cleared by writing a 0 to the bit,
75 * as opposed to a 1 as mandated by the spec
76 */
77
78 mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->hwirq));
79#else
80 WARN(1, "Interrupt handling possibly broken\n");
81 mtspr(SPR_PICSR, (1UL << data->hwirq));
82#endif
83}
84
85static void or1k_pic_mask_ack(struct irq_data *data)
86{
87 /* Comments for pic_ack apply here, too */
88
89#ifdef CONFIG_OR1K_1200
90 mtspr(SPR_PICMR, mfspr(SPR_PICMR) & ~(1UL << data->hwirq));
91 mtspr(SPR_PICSR, mfspr(SPR_PICSR) & ~(1UL << data->hwirq));
92#else
93 WARN(1, "Interrupt handling possibly broken\n");
94 mtspr(SPR_PICMR, (1UL << data->hwirq));
95 mtspr(SPR_PICSR, (1UL << data->hwirq));
96#endif
97}
98
99#if 0
100static int or1k_pic_set_type(struct irq_data *data, unsigned int flow_type)
101{
102 /* There's nothing to do in the PIC configuration when changing
103 * flow type. Level and edge-triggered interrupts are both
104 * supported, but it's PIC-implementation specific which type
105 * is handled. */
106
107 return irq_setup_alt_chip(data, flow_type);
108}
109#endif
110
111static struct irq_chip or1k_dev = {
112 .name = "or1k-PIC",
113 .irq_unmask = or1k_pic_unmask,
114 .irq_mask = or1k_pic_mask,
115 .irq_ack = or1k_pic_ack,
116 .irq_mask_ack = or1k_pic_mask_ack,
117};
118
119static struct irq_domain *root_domain;
120
121static inline int pic_get_irq(int first)
122{
123 int hwirq;
124
125 hwirq = ffs(mfspr(SPR_PICSR) >> first);
126 if (!hwirq)
127 return NO_IRQ;
128 else
129 hwirq = hwirq + first -1;
130
131 return irq_find_mapping(root_domain, hwirq);
132}
133
134
135static int or1k_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
136{ 40{
137 irq_set_chip_and_handler_name(irq, &or1k_dev, 41 irqchip_init();
138 handle_level_irq, "level");
139 irq_set_status_flags(irq, IRQ_LEVEL | IRQ_NOPROBE);
140
141 return 0;
142} 42}
143 43
144static const struct irq_domain_ops or1k_irq_domain_ops = { 44static void (*handle_arch_irq)(struct pt_regs *);
145 .xlate = irq_domain_xlate_onecell,
146 .map = or1k_map,
147};
148
149/*
150 * This sets up the IRQ domain for the PIC built in to the OpenRISC
151 * 1000 CPU. This is the "root" domain as these are the interrupts
152 * that directly trigger an exception in the CPU.
153 */
154static void __init or1k_irq_init(void)
155{
156 struct device_node *intc = NULL;
157
158 /* The interrupt controller device node is mandatory */
159 intc = of_find_compatible_node(NULL, NULL, "opencores,or1k-pic");
160 BUG_ON(!intc);
161
162 /* Disable all interrupts until explicitly requested */
163 mtspr(SPR_PICMR, (0UL));
164
165 root_domain = irq_domain_add_linear(intc, 32,
166 &or1k_irq_domain_ops, NULL);
167}
168 45
169void __init init_IRQ(void) 46void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
170{ 47{
171 or1k_irq_init(); 48 handle_arch_irq = handle_irq;
172} 49}
173 50
174void __irq_entry do_IRQ(struct pt_regs *regs) 51void handle_IRQ(unsigned int irq, struct pt_regs *regs)
175{ 52{
176 int irq = -1;
177 struct pt_regs *old_regs = set_irq_regs(regs); 53 struct pt_regs *old_regs = set_irq_regs(regs);
178 54
179 irq_enter(); 55 irq_enter();
180 56
181 while ((irq = pic_get_irq(irq + 1)) != NO_IRQ) 57 generic_handle_irq(irq);
182 generic_handle_irq(irq);
183 58
184 irq_exit(); 59 irq_exit();
185 set_irq_regs(old_regs); 60 set_irq_regs(old_regs);
186} 61}
62
63void __irq_entry do_IRQ(struct pt_regs *regs)
64{
65 handle_arch_irq(regs);
66}
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 66775bc07a8e..7d1b8235bf90 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -132,30 +132,16 @@ static inline unsigned long align_sigframe(unsigned long sp)
132 * or the alternate stack. 132 * or the alternate stack.
133 */ 133 */
134 134
135static inline void __user *get_sigframe(struct k_sigaction *ka, 135static inline void __user *get_sigframe(struct ksignal *ksig,
136 struct pt_regs *regs, size_t frame_size) 136 struct pt_regs *regs, size_t frame_size)
137{ 137{
138 unsigned long sp = regs->sp; 138 unsigned long sp = regs->sp;
139 int onsigstack = on_sig_stack(sp);
140 139
141 /* redzone */ 140 /* redzone */
142 sp -= STACK_FRAME_OVERHEAD; 141 sp -= STACK_FRAME_OVERHEAD;
143 142 sp = sigsp(sp, ksig);
144 /* This is the X/Open sanctioned signal stack switching. */
145 if ((ka->sa.sa_flags & SA_ONSTACK) && !onsigstack) {
146 if (current->sas_ss_size)
147 sp = current->sas_ss_sp + current->sas_ss_size;
148 }
149
150 sp = align_sigframe(sp - frame_size); 143 sp = align_sigframe(sp - frame_size);
151 144
152 /*
153 * If we are on the alternate signal stack and would overflow it, don't.
154 * Return an always-bogus address instead so we will die with SIGSEGV.
155 */
156 if (onsigstack && !likely(on_sig_stack(sp)))
157 return (void __user *)-1L;
158
159 return (void __user *)sp; 145 return (void __user *)sp;
160} 146}
161 147
@@ -173,7 +159,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
173 unsigned long return_ip; 159 unsigned long return_ip;
174 int err = 0; 160 int err = 0;
175 161
176 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); 162 frame = get_sigframe(ksig, regs, sizeof(*frame));
177 163
178 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 164 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
179 return -EFAULT; 165 return -EFAULT;
diff --git a/arch/parisc/configs/generic-64bit_defconfig b/arch/parisc/configs/generic-64bit_defconfig
index dc0d7ce71ea7..e945c08892fa 100644
--- a/arch/parisc/configs/generic-64bit_defconfig
+++ b/arch/parisc/configs/generic-64bit_defconfig
@@ -241,7 +241,6 @@ CONFIG_UIO_AEC=m
241CONFIG_UIO_SERCOS3=m 241CONFIG_UIO_SERCOS3=m
242CONFIG_UIO_PCI_GENERIC=m 242CONFIG_UIO_PCI_GENERIC=m
243CONFIG_STAGING=y 243CONFIG_STAGING=y
244# CONFIG_NET_VENDOR_SILICOM is not set
245CONFIG_EXT2_FS=y 244CONFIG_EXT2_FS=y
246CONFIG_EXT2_FS_XATTR=y 245CONFIG_EXT2_FS_XATTR=y
247CONFIG_EXT2_FS_SECURITY=y 246CONFIG_EXT2_FS_SECURITY=y
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 1cba8f29bb49..012d4fa63d97 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -227,8 +227,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_sysc
227} 227}
228 228
229static long 229static long
230setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 230setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
231 sigset_t *set, struct pt_regs *regs, int in_syscall) 231 int in_syscall)
232{ 232{
233 struct rt_sigframe __user *frame; 233 struct rt_sigframe __user *frame;
234 unsigned long rp, usp; 234 unsigned long rp, usp;
@@ -241,10 +241,10 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
241 241
242 usp = (regs->gr[30] & ~(0x01UL)); 242 usp = (regs->gr[30] & ~(0x01UL));
243 /*FIXME: frame_size parameter is unused, remove it. */ 243 /*FIXME: frame_size parameter is unused, remove it. */
244 frame = get_sigframe(ka, usp, sizeof(*frame)); 244 frame = get_sigframe(&ksig->ka, usp, sizeof(*frame));
245 245
246 DBG(1,"SETUP_RT_FRAME: START\n"); 246 DBG(1,"SETUP_RT_FRAME: START\n");
247 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, info); 247 DBG(1,"setup_rt_frame: frame %p info %p\n", frame, ksig->info);
248 248
249 249
250#ifdef CONFIG_64BIT 250#ifdef CONFIG_64BIT
@@ -253,7 +253,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
253 253
254 if (is_compat_task()) { 254 if (is_compat_task()) {
255 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); 255 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
256 err |= copy_siginfo_to_user32(&compat_frame->info, info); 256 err |= copy_siginfo_to_user32(&compat_frame->info, &ksig->info);
257 err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]); 257 err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]);
258 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); 258 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc);
259 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); 259 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext);
@@ -265,7 +265,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
265#endif 265#endif
266 { 266 {
267 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); 267 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info);
268 err |= copy_siginfo_to_user(&frame->info, info); 268 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
269 err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]); 269 err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]);
270 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); 270 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc);
271 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); 271 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext);
@@ -275,7 +275,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
275 } 275 }
276 276
277 if (err) 277 if (err)
278 goto give_sigsegv; 278 return -EFAULT;
279 279
280 /* Set up to return from userspace. If provided, use a stub 280 /* Set up to return from userspace. If provided, use a stub
281 already in userspace. The first words of tramp are used to 281 already in userspace. The first words of tramp are used to
@@ -312,9 +312,9 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
312 rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP]; 312 rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP];
313 313
314 if (err) 314 if (err)
315 goto give_sigsegv; 315 return -EFAULT;
316 316
317 haddr = A(ka->sa.sa_handler); 317 haddr = A(ksig->ka.sa.sa_handler);
318 /* The sa_handler may be a pointer to a function descriptor */ 318 /* The sa_handler may be a pointer to a function descriptor */
319#ifdef CONFIG_64BIT 319#ifdef CONFIG_64BIT
320 if (is_compat_task()) { 320 if (is_compat_task()) {
@@ -326,7 +326,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
326 err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); 326 err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
327 327
328 if (err) 328 if (err)
329 goto give_sigsegv; 329 return -EFAULT;
330 330
331 haddr = fdesc.addr; 331 haddr = fdesc.addr;
332 regs->gr[19] = fdesc.gp; 332 regs->gr[19] = fdesc.gp;
@@ -339,7 +339,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
339 err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc)); 339 err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
340 340
341 if (err) 341 if (err)
342 goto give_sigsegv; 342 return -EFAULT;
343 343
344 haddr = fdesc.addr; 344 haddr = fdesc.addr;
345 regs->gr[19] = fdesc.gp; 345 regs->gr[19] = fdesc.gp;
@@ -386,7 +386,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
386 } 386 }
387 387
388 regs->gr[2] = rp; /* userland return pointer */ 388 regs->gr[2] = rp; /* userland return pointer */
389 regs->gr[26] = sig; /* signal number */ 389 regs->gr[26] = ksig->sig; /* signal number */
390 390
391#ifdef CONFIG_64BIT 391#ifdef CONFIG_64BIT
392 if (is_compat_task()) { 392 if (is_compat_task()) {
@@ -410,11 +410,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
410 current->comm, current->pid, frame, regs->gr[30], 410 current->comm, current->pid, frame, regs->gr[30],
411 regs->iaoq[0], regs->iaoq[1], rp); 411 regs->iaoq[0], regs->iaoq[1], rp);
412 412
413 return 1;
414
415give_sigsegv:
416 DBG(1,"setup_rt_frame: sending SIGSEGV\n");
417 force_sigsegv(sig, current);
418 return 0; 413 return 0;
419} 414}
420 415
@@ -423,20 +418,19 @@ give_sigsegv:
423 */ 418 */
424 419
425static void 420static void
426handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 421handle_signal(struct ksignal *ksig, struct pt_regs *regs, int in_syscall)
427 struct pt_regs *regs, int in_syscall)
428{ 422{
423 int ret;
429 sigset_t *oldset = sigmask_to_save(); 424 sigset_t *oldset = sigmask_to_save();
425
430 DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", 426 DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n",
431 sig, ka, info, oldset, regs); 427 ksig->sig, ksig->ka, ksig->info, oldset, regs);
432 428
433 /* Set up the stack frame */ 429 /* Set up the stack frame */
434 if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) 430 ret = setup_rt_frame(ksig, oldset, regs, in_syscall);
435 return;
436 431
437 signal_delivered(sig, info, ka, regs, 432 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP) ||
438 test_thread_flag(TIF_SINGLESTEP) || 433 test_thread_flag(TIF_BLOCKSTEP));
439 test_thread_flag(TIF_BLOCKSTEP));
440 434
441 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", 435 DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n",
442 regs->gr[28]); 436 regs->gr[28]);
@@ -544,22 +538,18 @@ insert_restart_trampoline(struct pt_regs *regs)
544asmlinkage void 538asmlinkage void
545do_signal(struct pt_regs *regs, long in_syscall) 539do_signal(struct pt_regs *regs, long in_syscall)
546{ 540{
547 siginfo_t info; 541 struct ksignal ksig;
548 struct k_sigaction ka;
549 int signr;
550 542
551 DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", 543 DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n",
552 regs, regs->sr[7], in_syscall); 544 regs, regs->sr[7], in_syscall);
553 545
554 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 546 if (get_signal(&ksig)) {
555 DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); 547 DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]);
556
557 if (signr > 0) {
558 /* Restart a system call if necessary. */ 548 /* Restart a system call if necessary. */
559 if (in_syscall) 549 if (in_syscall)
560 syscall_restart(regs, &ka); 550 syscall_restart(regs, &ksig.ka);
561 551
562 handle_signal(signr, &info, &ka, regs, in_syscall); 552 handle_signal(&ksig, regs, in_syscall);
563 return; 553 return;
564 } 554 }
565 555
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 80b94b0add1f..a577609f8ed6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -111,6 +111,7 @@ config PPC
111 select HAVE_DMA_API_DEBUG 111 select HAVE_DMA_API_DEBUG
112 select HAVE_OPROFILE 112 select HAVE_OPROFILE
113 select HAVE_DEBUG_KMEMLEAK 113 select HAVE_DEBUG_KMEMLEAK
114 select ARCH_HAS_SG_CHAIN
114 select GENERIC_ATOMIC64 if PPC32 115 select GENERIC_ATOMIC64 if PPC32
115 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 116 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
116 select HAVE_PERF_EVENTS 117 select HAVE_PERF_EVENTS
@@ -398,6 +399,8 @@ config PPC64_SUPPORTS_MEMORY_FAILURE
398config KEXEC 399config KEXEC
399 bool "kexec system call" 400 bool "kexec system call"
400 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) 401 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
402 select CRYPTO
403 select CRYPTO_SHA256
401 help 404 help
402 kexec is a system call that implements the ability to shutdown your 405 kexec is a system call that implements the ability to shutdown your
403 current kernel, and to start another kernel. It is like a reboot 406 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 35d16bd2760b..ec2e40f2cc11 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -202,9 +202,7 @@ config PPC_EARLY_DEBUG_BEAT
202 202
203config PPC_EARLY_DEBUG_44x 203config PPC_EARLY_DEBUG_44x
204 bool "Early serial debugging for IBM/AMCC 44x CPUs" 204 bool "Early serial debugging for IBM/AMCC 44x CPUs"
205 # PPC_EARLY_DEBUG on 440 leaves AS=1 mappings above the TLB high water 205 depends on 44x
206 # mark, which doesn't work with current 440 KVM.
207 depends on 44x && !KVM
208 help 206 help
209 Select this to enable early debugging for IBM 44x chips via the 207 Select this to enable early debugging for IBM 44x chips via the
210 inbuilt serial port. If you enable this, ensure you set 208 inbuilt serial port. If you enable this, ensure you set
diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
index 5290df83ff30..69ce1026c948 100644
--- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
@@ -359,6 +359,7 @@
359 compatible = "fsl,qoriq-core-mux-1.0"; 359 compatible = "fsl,qoriq-core-mux-1.0";
360 clocks = <&pll0 0>, <&pll0 1>, <&pll1 0>, <&pll1 1>; 360 clocks = <&pll0 0>, <&pll0 1>, <&pll1 0>, <&pll1 1>;
361 clock-names = "pll0", "pll0-div2", "pll1", "pll1-div2"; 361 clock-names = "pll0", "pll0-div2", "pll1", "pll1-div2";
362 clock-output-names = "cmux2";
362 }; 363 };
363 364
364 mux3: mux3@60 { 365 mux3: mux3@60 {
diff --git a/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
new file mode 100644
index 000000000000..082ec2044060
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
@@ -0,0 +1,69 @@
1/*
2 * T2080 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "t2081si-post.dtsi"
36
37&soc {
38/include/ "qoriq-sata2-0.dtsi"
39 sata@220000 {
40 fsl,iommu-parent = <&pamu1>;
41 fsl,liodn-reg = <&guts 0x550>; /* SATA1LIODNR */
42 };
43
44/include/ "qoriq-sata2-1.dtsi"
45 sata@221000 {
46 fsl,iommu-parent = <&pamu1>;
47 fsl,liodn-reg = <&guts 0x554>; /* SATA2LIODNR */
48 };
49};
50
51&rio {
52 compatible = "fsl,srio";
53 interrupts = <16 2 1 11>;
54 #address-cells = <2>;
55 #size-cells = <2>;
56 ranges;
57
58 port1 {
59 #address-cells = <2>;
60 #size-cells = <2>;
61 cell-index = <1>;
62 };
63
64 port2 {
65 #address-cells = <2>;
66 #size-cells = <2>;
67 cell-index = <2>;
68 };
69};
diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
new file mode 100644
index 000000000000..97479f0ce630
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
@@ -0,0 +1,435 @@
1/*
2 * T2081 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&ifc {
36 #address-cells = <2>;
37 #size-cells = <1>;
38 compatible = "fsl,ifc", "simple-bus";
39 interrupts = <25 2 0 0>;
40};
41
42/* controller at 0x240000 */
43&pci0 {
44 compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie-v3.0", "fsl,qoriq-pcie";
45 device_type = "pci";
46 #size-cells = <2>;
47 #address-cells = <3>;
48 bus-range = <0x0 0xff>;
49 interrupts = <20 2 0 0>;
50 fsl,iommu-parent = <&pamu0>;
51 pcie@0 {
52 reg = <0 0 0 0 0>;
53 #interrupt-cells = <1>;
54 #size-cells = <2>;
55 #address-cells = <3>;
56 device_type = "pci";
57 interrupts = <20 2 0 0>;
58 interrupt-map-mask = <0xf800 0 0 7>;
59 interrupt-map = <
60 /* IDSEL 0x0 */
61 0000 0 0 1 &mpic 40 1 0 0
62 0000 0 0 2 &mpic 1 1 0 0
63 0000 0 0 3 &mpic 2 1 0 0
64 0000 0 0 4 &mpic 3 1 0 0
65 >;
66 };
67};
68
69/* controller at 0x250000 */
70&pci1 {
71 compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie-v3.0", "fsl,qoriq-pcie";
72 device_type = "pci";
73 #size-cells = <2>;
74 #address-cells = <3>;
75 bus-range = <0 0xff>;
76 interrupts = <21 2 0 0>;
77 fsl,iommu-parent = <&pamu0>;
78 pcie@0 {
79 reg = <0 0 0 0 0>;
80 #interrupt-cells = <1>;
81 #size-cells = <2>;
82 #address-cells = <3>;
83 device_type = "pci";
84 interrupts = <21 2 0 0>;
85 interrupt-map-mask = <0xf800 0 0 7>;
86 interrupt-map = <
87 /* IDSEL 0x0 */
88 0000 0 0 1 &mpic 41 1 0 0
89 0000 0 0 2 &mpic 5 1 0 0
90 0000 0 0 3 &mpic 6 1 0 0
91 0000 0 0 4 &mpic 7 1 0 0
92 >;
93 };
94};
95
96/* controller at 0x260000 */
97&pci2 {
98 compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie-v3.0", "fsl,qoriq-pcie";
99 device_type = "pci";
100 #size-cells = <2>;
101 #address-cells = <3>;
102 bus-range = <0x0 0xff>;
103 interrupts = <22 2 0 0>;
104 fsl,iommu-parent = <&pamu0>;
105 pcie@0 {
106 reg = <0 0 0 0 0>;
107 #interrupt-cells = <1>;
108 #size-cells = <2>;
109 #address-cells = <3>;
110 device_type = "pci";
111 interrupts = <22 2 0 0>;
112 interrupt-map-mask = <0xf800 0 0 7>;
113 interrupt-map = <
114 /* IDSEL 0x0 */
115 0000 0 0 1 &mpic 42 1 0 0
116 0000 0 0 2 &mpic 9 1 0 0
117 0000 0 0 3 &mpic 10 1 0 0
118 0000 0 0 4 &mpic 11 1 0 0
119 >;
120 };
121};
122
123/* controller at 0x270000 */
124&pci3 {
125 compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie-v3.0", "fsl,qoriq-pcie";
126 device_type = "pci";
127 #size-cells = <2>;
128 #address-cells = <3>;
129 bus-range = <0x0 0xff>;
130 interrupts = <23 2 0 0>;
131 fsl,iommu-parent = <&pamu0>;
132 pcie@0 {
133 reg = <0 0 0 0 0>;
134 #interrupt-cells = <1>;
135 #size-cells = <2>;
136 #address-cells = <3>;
137 device_type = "pci";
138 interrupts = <23 2 0 0>;
139 interrupt-map-mask = <0xf800 0 0 7>;
140 interrupt-map = <
141 /* IDSEL 0x0 */
142 0000 0 0 1 &mpic 43 1 0 0
143 0000 0 0 2 &mpic 0 1 0 0
144 0000 0 0 3 &mpic 4 1 0 0
145 0000 0 0 4 &mpic 8 1 0 0
146 >;
147 };
148};
149
150&dcsr {
151 #address-cells = <1>;
152 #size-cells = <1>;
153 compatible = "fsl,dcsr", "simple-bus";
154
155 dcsr-epu@0 {
156 compatible = "fsl,t2080-dcsr-epu", "fsl,dcsr-epu";
157 interrupts = <52 2 0 0
158 84 2 0 0
159 85 2 0 0
160 94 2 0 0
161 95 2 0 0>;
162 reg = <0x0 0x1000>;
163 };
164 dcsr-npc {
165 compatible = "fsl,t2080-dcsr-cnpc", "fsl,dcsr-cnpc";
166 reg = <0x1000 0x1000 0x1002000 0x10000>;
167 };
168 dcsr-nxc@2000 {
169 compatible = "fsl,dcsr-nxc";
170 reg = <0x2000 0x1000>;
171 };
172 dcsr-corenet {
173 compatible = "fsl,dcsr-corenet";
174 reg = <0x8000 0x1000 0x1A000 0x1000>;
175 };
176 dcsr-ocn@11000 {
177 compatible = "fsl,t2080-dcsr-ocn", "fsl,dcsr-ocn";
178 reg = <0x11000 0x1000>;
179 };
180 dcsr-ddr@12000 {
181 compatible = "fsl,dcsr-ddr";
182 dev-handle = <&ddr1>;
183 reg = <0x12000 0x1000>;
184 };
185 dcsr-nal@18000 {
186 compatible = "fsl,t2080-dcsr-nal", "fsl,dcsr-nal";
187 reg = <0x18000 0x1000>;
188 };
189 dcsr-rcpm@22000 {
190 compatible = "fsl,t2080-dcsr-rcpm", "fsl,dcsr-rcpm";
191 reg = <0x22000 0x1000>;
192 };
193 dcsr-snpc@30000 {
194 compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
195 reg = <0x30000 0x1000 0x1022000 0x10000>;
196 };
197 dcsr-snpc@31000 {
198 compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
199 reg = <0x31000 0x1000 0x1042000 0x10000>;
200 };
201 dcsr-snpc@32000 {
202 compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
203 reg = <0x32000 0x1000 0x1062000 0x10000>;
204 };
205 dcsr-cpu-sb-proxy@100000 {
206 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
207 cpu-handle = <&cpu0>;
208 reg = <0x100000 0x1000 0x101000 0x1000>;
209 };
210 dcsr-cpu-sb-proxy@108000 {
211 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
212 cpu-handle = <&cpu1>;
213 reg = <0x108000 0x1000 0x109000 0x1000>;
214 };
215 dcsr-cpu-sb-proxy@110000 {
216 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
217 cpu-handle = <&cpu2>;
218 reg = <0x110000 0x1000 0x111000 0x1000>;
219 };
220 dcsr-cpu-sb-proxy@118000 {
221 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
222 cpu-handle = <&cpu3>;
223 reg = <0x118000 0x1000 0x119000 0x1000>;
224 };
225};
226
227&soc {
228 #address-cells = <1>;
229 #size-cells = <1>;
230 device_type = "soc";
231 compatible = "simple-bus";
232
233 soc-sram-error {
234 compatible = "fsl,soc-sram-error";
235 interrupts = <16 2 1 29>;
236 };
237
238 corenet-law@0 {
239 compatible = "fsl,corenet-law";
240 reg = <0x0 0x1000>;
241 fsl,num-laws = <32>;
242 };
243
244 ddr1: memory-controller@8000 {
245 compatible = "fsl,qoriq-memory-controller-v4.7",
246 "fsl,qoriq-memory-controller";
247 reg = <0x8000 0x1000>;
248 interrupts = <16 2 1 23>;
249 };
250
251 cpc: l3-cache-controller@10000 {
252 compatible = "fsl,t2080-l3-cache-controller", "cache";
253 reg = <0x10000 0x1000
254 0x11000 0x1000
255 0x12000 0x1000>;
256 interrupts = <16 2 1 27
257 16 2 1 26
258 16 2 1 25>;
259 };
260
261 corenet-cf@18000 {
262 compatible = "fsl,corenet2-cf", "fsl,corenet-cf";
263 reg = <0x18000 0x1000>;
264 interrupts = <16 2 1 31>;
265 fsl,ccf-num-csdids = <32>;
266 fsl,ccf-num-snoopids = <32>;
267 };
268
269 iommu@20000 {
270 compatible = "fsl,pamu-v1.0", "fsl,pamu";
271 reg = <0x20000 0x3000>;
272 fsl,portid-mapping = <0x8000>;
273 ranges = <0 0x20000 0x3000>;
274 #address-cells = <1>;
275 #size-cells = <1>;
276 interrupts = <
277 24 2 0 0
278 16 2 1 30>;
279
280 pamu0: pamu@0 {
281 reg = <0 0x1000>;
282 fsl,primary-cache-geometry = <32 1>;
283 fsl,secondary-cache-geometry = <128 2>;
284 };
285
286 pamu1: pamu@1000 {
287 reg = <0x1000 0x1000>;
288 fsl,primary-cache-geometry = <32 1>;
289 fsl,secondary-cache-geometry = <128 2>;
290 };
291
292 pamu2: pamu@2000 {
293 reg = <0x2000 0x1000>;
294 fsl,primary-cache-geometry = <32 1>;
295 fsl,secondary-cache-geometry = <128 2>;
296 };
297 };
298
299/include/ "qoriq-mpic4.3.dtsi"
300
301 guts: global-utilities@e0000 {
302 compatible = "fsl,t2080-device-config", "fsl,qoriq-device-config-2.0";
303 reg = <0xe0000 0xe00>;
304 fsl,has-rstcr;
305 fsl,liodn-bits = <12>;
306 };
307
308 clockgen: global-utilities@e1000 {
309 compatible = "fsl,t2080-clockgen", "fsl,qoriq-clockgen-2.0";
310 ranges = <0x0 0xe1000 0x1000>;
311 reg = <0xe1000 0x1000>;
312 #address-cells = <1>;
313 #size-cells = <1>;
314
315 sysclk: sysclk {
316 #clock-cells = <0>;
317 compatible = "fsl,qoriq-sysclk-2.0";
318 clock-output-names = "sysclk", "fixed-clock";
319 };
320
321 pll0: pll0@800 {
322 #clock-cells = <1>;
323 reg = <0x800 4>;
324 compatible = "fsl,qoriq-core-pll-2.0";
325 clocks = <&sysclk>;
326 clock-output-names = "pll0", "pll0-div2", "pll0-div4";
327 };
328
329 pll1: pll1@820 {
330 #clock-cells = <1>;
331 reg = <0x820 4>;
332 compatible = "fsl,qoriq-core-pll-2.0";
333 clocks = <&sysclk>;
334 clock-output-names = "pll1", "pll1-div2", "pll1-div4";
335 };
336
337 mux0: mux0@0 {
338 #clock-cells = <0>;
339 reg = <0x0 4>;
340 compatible = "fsl,qoriq-core-mux-2.0";
341 clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>,
342 <&pll1 0>, <&pll1 1>, <&pll1 2>;
343 clock-names = "pll0", "pll0-div2", "pll1-div4",
344 "pll1", "pll1-div2", "pll1-div4";
345 clock-output-names = "cmux0";
346 };
347
348 mux1: mux1@20 {
349 #clock-cells = <0>;
350 reg = <0x20 4>;
351 compatible = "fsl,qoriq-core-mux-2.0";
352 clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>,
353 <&pll1 0>, <&pll1 1>, <&pll1 2>;
354 clock-names = "pll0", "pll0-div2", "pll1-div4",
355 "pll1", "pll1-div2", "pll1-div4";
356 clock-output-names = "cmux1";
357 };
358 };
359
360 rcpm: global-utilities@e2000 {
361 compatible = "fsl,t2080-rcpm", "fsl,qoriq-rcpm-2.0";
362 reg = <0xe2000 0x1000>;
363 };
364
365 sfp: sfp@e8000 {
366 compatible = "fsl,t2080-sfp";
367 reg = <0xe8000 0x1000>;
368 };
369
370 serdes: serdes@ea000 {
371 compatible = "fsl,t2080-serdes";
372 reg = <0xea000 0x4000>;
373 };
374
375/include/ "elo3-dma-0.dtsi"
376 dma@100300 {
377 fsl,iommu-parent = <&pamu0>;
378 fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
379 };
380/include/ "elo3-dma-1.dtsi"
381 dma@101300 {
382 fsl,iommu-parent = <&pamu0>;
383 fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
384 };
385/include/ "elo3-dma-2.dtsi"
386 dma@102300 {
387 fsl,iommu-parent = <&pamu0>;
388 fsl,liodn-reg = <&guts 0x588>; /* DMA3LIODNR */
389 };
390
391/include/ "qoriq-espi-0.dtsi"
392 spi@110000 {
393 fsl,espi-num-chipselects = <4>;
394 };
395
396/include/ "qoriq-esdhc-0.dtsi"
397 sdhc@114000 {
398 compatible = "fsl,t2080-esdhc", "fsl,esdhc";
399 fsl,iommu-parent = <&pamu1>;
400 fsl,liodn-reg = <&guts 0x530>; /* SDMMCLIODNR */
401 sdhci,auto-cmd12;
402 };
403/include/ "qoriq-i2c-0.dtsi"
404/include/ "qoriq-i2c-1.dtsi"
405/include/ "qoriq-duart-0.dtsi"
406/include/ "qoriq-duart-1.dtsi"
407/include/ "qoriq-gpio-0.dtsi"
408/include/ "qoriq-gpio-1.dtsi"
409/include/ "qoriq-gpio-2.dtsi"
410/include/ "qoriq-gpio-3.dtsi"
411/include/ "qoriq-usb2-mph-0.dtsi"
412 usb0: usb@210000 {
413 compatible = "fsl-usb2-mph-v2.4", "fsl-usb2-mph";
414 fsl,iommu-parent = <&pamu1>;
415 fsl,liodn-reg = <&guts 0x520>; /* USB1LIODNR */
416 phy_type = "utmi";
417 port0;
418 };
419/include/ "qoriq-usb2-dr-0.dtsi"
420 usb1: usb@211000 {
421 compatible = "fsl-usb2-dr-v2.4", "fsl-usb2-dr";
422 fsl,iommu-parent = <&pamu1>;
423 fsl,liodn-reg = <&guts 0x524>; /* USB1LIODNR */
424 dr_mode = "host";
425 phy_type = "utmi";
426 };
427/include/ "qoriq-sec5.2-0.dtsi"
428
429 L2_1: l2-cache-controller@c20000 {
430 /* Cluster 0 L2 cache */
431 compatible = "fsl,t2080-l2-cache-controller";
432 reg = <0xc20000 0x40000>;
433 next-level-cache = <&cpc>;
434 };
435};
diff --git a/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi b/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
new file mode 100644
index 000000000000..e71ceb0e1100
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
@@ -0,0 +1,99 @@
1/*
2 * T2080/T2081 Silicon/SoC Device Tree Source (pre include)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/dts-v1/;
36
37/include/ "e6500_power_isa.dtsi"
38
39/ {
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 aliases {
45 ccsr = &soc;
46 dcsr = &dcsr;
47
48 serial0 = &serial0;
49 serial1 = &serial1;
50 serial2 = &serial2;
51 serial3 = &serial3;
52
53 crypto = &crypto;
54 pci0 = &pci0;
55 pci1 = &pci1;
56 pci2 = &pci2;
57 pci3 = &pci3;
58 usb0 = &usb0;
59 usb1 = &usb1;
60 dma0 = &dma0;
61 dma1 = &dma1;
62 dma2 = &dma2;
63 sdhc = &sdhc;
64 };
65
66 cpus {
67 #address-cells = <1>;
68 #size-cells = <0>;
69
70 cpu0: PowerPC,e6500@0 {
71 device_type = "cpu";
72 reg = <0 1>;
73 clocks = <&mux0>;
74 next-level-cache = <&L2_1>;
75 fsl,portid-mapping = <0x80000000>;
76 };
77 cpu1: PowerPC,e6500@2 {
78 device_type = "cpu";
79 reg = <2 3>;
80 clocks = <&mux0>;
81 next-level-cache = <&L2_1>;
82 fsl,portid-mapping = <0x80000000>;
83 };
84 cpu2: PowerPC,e6500@4 {
85 device_type = "cpu";
86 reg = <4 5>;
87 clocks = <&mux0>;
88 next-level-cache = <&L2_1>;
89 fsl,portid-mapping = <0x80000000>;
90 };
91 cpu3: PowerPC,e6500@6 {
92 device_type = "cpu";
93 reg = <6 7>;
94 clocks = <&mux0>;
95 next-level-cache = <&L2_1>;
96 fsl,portid-mapping = <0x80000000>;
97 };
98 };
99};
diff --git a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
index 793669baa13e..a3d582e0361a 100644
--- a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
@@ -476,6 +476,7 @@
476 476
477/include/ "elo3-dma-0.dtsi" 477/include/ "elo3-dma-0.dtsi"
478/include/ "elo3-dma-1.dtsi" 478/include/ "elo3-dma-1.dtsi"
479/include/ "elo3-dma-2.dtsi"
479 480
480/include/ "qoriq-espi-0.dtsi" 481/include/ "qoriq-espi-0.dtsi"
481 spi@110000 { 482 spi@110000 {
diff --git a/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi
index d2f157edbe81..261a3abb1a55 100644
--- a/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi
@@ -57,6 +57,7 @@
57 pci3 = &pci3; 57 pci3 = &pci3;
58 dma0 = &dma0; 58 dma0 = &dma0;
59 dma1 = &dma1; 59 dma1 = &dma1;
60 dma2 = &dma2;
60 sdhc = &sdhc; 61 sdhc = &sdhc;
61 }; 62 };
62 63
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi
index 2c0e1552d20b..7f9d14f5c4da 100644
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ b/arch/powerpc/boot/dts/mpc5121.dtsi
@@ -498,6 +498,7 @@
498 compatible = "fsl,mpc5121-dma"; 498 compatible = "fsl,mpc5121-dma";
499 reg = <0x14000 0x1800>; 499 reg = <0x14000 0x1800>;
500 interrupts = <65 0x8>; 500 interrupts = <65 0x8>;
501 #dma-cells = <1>;
501 }; 502 };
502 }; 503 };
503 504
diff --git a/arch/powerpc/boot/dts/t2080qds.dts b/arch/powerpc/boot/dts/t2080qds.dts
new file mode 100644
index 000000000000..aa1d6d8c169b
--- /dev/null
+++ b/arch/powerpc/boot/dts/t2080qds.dts
@@ -0,0 +1,57 @@
1/*
2 * T2080QDS Device Tree Source
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/t208xsi-pre.dtsi"
36/include/ "t208xqds.dtsi"
37
38/ {
39 model = "fsl,T2080QDS";
40 compatible = "fsl,T2080QDS";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 rio: rapidio@ffe0c0000 {
46 reg = <0xf 0xfe0c0000 0 0x11000>;
47
48 port1 {
49 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
50 };
51 port2 {
52 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
53 };
54 };
55};
56
57/include/ "fsl/t2080si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/t2080rdb.dts b/arch/powerpc/boot/dts/t2080rdb.dts
new file mode 100644
index 000000000000..e8891047600c
--- /dev/null
+++ b/arch/powerpc/boot/dts/t2080rdb.dts
@@ -0,0 +1,57 @@
1/*
2 * T2080PCIe-RDB Board Device Tree Source
3 *
4 * Copyright 2014 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/t208xsi-pre.dtsi"
36/include/ "t208xrdb.dtsi"
37
38/ {
39 model = "fsl,T2080RDB";
40 compatible = "fsl,T2080RDB";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 rio: rapidio@ffe0c0000 {
46 reg = <0xf 0xfe0c0000 0 0x11000>;
47
48 port1 {
49 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
50 };
51 port2 {
52 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
53 };
54 };
55};
56
57/include/ "fsl/t2080si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/t2081qds.dts b/arch/powerpc/boot/dts/t2081qds.dts
new file mode 100644
index 000000000000..8ec80a71e102
--- /dev/null
+++ b/arch/powerpc/boot/dts/t2081qds.dts
@@ -0,0 +1,46 @@
1/*
2 * T2081QDS Device Tree Source
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/t208xsi-pre.dtsi"
36/include/ "t208xqds.dtsi"
37
38/ {
39 model = "fsl,T2081QDS";
40 compatible = "fsl,T2081QDS";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44};
45
46/include/ "fsl/t2081si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/t208xqds.dtsi b/arch/powerpc/boot/dts/t208xqds.dtsi
new file mode 100644
index 000000000000..555dc6e03d89
--- /dev/null
+++ b/arch/powerpc/boot/dts/t208xqds.dtsi
@@ -0,0 +1,239 @@
1/*
2 * T2080/T2081 QDS Device Tree Source
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/ {
36 model = "fsl,T2080QDS";
37 compatible = "fsl,T2080QDS";
38 #address-cells = <2>;
39 #size-cells = <2>;
40 interrupt-parent = <&mpic>;
41
42 ifc: localbus@ffe124000 {
43 reg = <0xf 0xfe124000 0 0x2000>;
44 ranges = <0 0 0xf 0xe8000000 0x08000000
45 2 0 0xf 0xff800000 0x00010000
46 3 0 0xf 0xffdf0000 0x00008000>;
47
48 nor@0,0 {
49 #address-cells = <1>;
50 #size-cells = <1>;
51 compatible = "cfi-flash";
52 reg = <0x0 0x0 0x8000000>;
53 bank-width = <2>;
54 device-width = <1>;
55 };
56
57 nand@2,0 {
58 #address-cells = <1>;
59 #size-cells = <1>;
60 compatible = "fsl,ifc-nand";
61 reg = <0x2 0x0 0x10000>;
62 };
63
64 boardctrl: board-control@3,0 {
65 #address-cells = <1>;
66 #size-cells = <1>;
67 compatible = "fsl,fpga-qixis";
68 reg = <3 0 0x300>;
69 ranges = <0 3 0 0x300>;
70 };
71 };
72
73 memory {
74 device_type = "memory";
75 };
76
77 dcsr: dcsr@f00000000 {
78 ranges = <0x00000000 0xf 0x00000000 0x01072000>;
79 };
80
81 soc: soc@ffe000000 {
82 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
83 reg = <0xf 0xfe000000 0 0x00001000>;
84 spi@110000 {
85 flash@0 {
86 #address-cells = <1>;
87 #size-cells = <1>;
88 compatible = "micron,n25q128a11"; /* 16MB */
89 reg = <0>;
90 spi-max-frequency = <40000000>; /* input clock */
91 };
92
93 flash@1 {
94 #address-cells = <1>;
95 #size-cells = <1>;
96 compatible = "sst,sst25wf040";
97 reg = <1>;
98 spi-max-frequency = <35000000>;
99 };
100
101 flash@2 {
102 #address-cells = <1>;
103 #size-cells = <1>;
104 compatible = "eon,en25s64";
105 reg = <2>;
106 spi-max-frequency = <35000000>;
107 };
108 };
109
110 i2c@118000 {
111 pca9547@77 {
112 compatible = "nxp,pca9547";
113 reg = <0x77>;
114 #address-cells = <1>;
115 #size-cells = <0>;
116
117 i2c@0 {
118 #address-cells = <1>;
119 #size-cells = <0>;
120 reg = <0x0>;
121
122 eeprom@50 {
123 compatible = "at24,24c512";
124 reg = <0x50>;
125 };
126
127 eeprom@51 {
128 compatible = "at24,24c02";
129 reg = <0x51>;
130 };
131
132 eeprom@57 {
133 compatible = "at24,24c02";
134 reg = <0x57>;
135 };
136
137 rtc@68 {
138 compatible = "dallas,ds3232";
139 reg = <0x68>;
140 interrupts = <0x1 0x1 0 0>;
141 };
142 };
143
144 i2c@1 {
145 #address-cells = <1>;
146 #size-cells = <0>;
147 reg = <0x1>;
148
149 eeprom@55 {
150 compatible = "at24,24c02";
151 reg = <0x55>;
152 };
153 };
154
155 i2c@2 {
156 #address-cells = <1>;
157 #size-cells = <0>;
158 reg = <0x2>;
159
160 ina220@40 {
161 compatible = "ti,ina220";
162 reg = <0x40>;
163 shunt-resistor = <1000>;
164 };
165
166 ina220@41 {
167 compatible = "ti,ina220";
168 reg = <0x41>;
169 shunt-resistor = <1000>;
170 };
171 };
172 };
173 };
174
175 sdhc@114000 {
176 voltage-ranges = <1800 1800 3300 3300>;
177 };
178 };
179
180 pci0: pcie@ffe240000 {
181 reg = <0xf 0xfe240000 0 0x10000>;
182 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
183 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
184 pcie@0 {
185 ranges = <0x02000000 0 0xe0000000
186 0x02000000 0 0xe0000000
187 0 0x20000000
188
189 0x01000000 0 0x00000000
190 0x01000000 0 0x00000000
191 0 0x00010000>;
192 };
193 };
194
195 pci1: pcie@ffe250000 {
196 reg = <0xf 0xfe250000 0 0x10000>;
197 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x10000000
198 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
199 pcie@0 {
200 ranges = <0x02000000 0 0xe0000000
201 0x02000000 0 0xe0000000
202 0 0x20000000
203
204 0x01000000 0 0x00000000
205 0x01000000 0 0x00000000
206 0 0x00010000>;
207 };
208 };
209
210 pci2: pcie@ffe260000 {
211 reg = <0xf 0xfe260000 0 0x1000>;
212 ranges = <0x02000000 0 0xe0000000 0xc 0x30000000 0 0x10000000
213 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
214 pcie@0 {
215 ranges = <0x02000000 0 0xe0000000
216 0x02000000 0 0xe0000000
217 0 0x20000000
218
219 0x01000000 0 0x00000000
220 0x01000000 0 0x00000000
221 0 0x00010000>;
222 };
223 };
224
225 pci3: pcie@ffe270000 {
226 reg = <0xf 0xfe270000 0 0x10000>;
227 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x10000000
228 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>;
229 pcie@0 {
230 ranges = <0x02000000 0 0xe0000000
231 0x02000000 0 0xe0000000
232 0 0x20000000
233
234 0x01000000 0 0x00000000
235 0x01000000 0 0x00000000
236 0 0x00010000>;
237 };
238 };
239};
diff --git a/arch/powerpc/boot/dts/t208xrdb.dtsi b/arch/powerpc/boot/dts/t208xrdb.dtsi
new file mode 100644
index 000000000000..1481e192e783
--- /dev/null
+++ b/arch/powerpc/boot/dts/t208xrdb.dtsi
@@ -0,0 +1,184 @@
1/*
2 * T2080PCIe-RDB Board Device Tree Source
3 *
4 * Copyright 2014 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/ {
36 model = "fsl,T2080RDB";
37 compatible = "fsl,T2080RDB";
38 #address-cells = <2>;
39 #size-cells = <2>;
40 interrupt-parent = <&mpic>;
41
42 ifc: localbus@ffe124000 {
43 reg = <0xf 0xfe124000 0 0x2000>;
44 ranges = <0 0 0xf 0xe8000000 0x08000000
45 2 0 0xf 0xff800000 0x00010000
46 3 0 0xf 0xffdf0000 0x00008000>;
47
48 nor@0,0 {
49 #address-cells = <1>;
50 #size-cells = <1>;
51 compatible = "cfi-flash";
52 reg = <0x0 0x0 0x8000000>;
53
54 bank-width = <2>;
55 device-width = <1>;
56 };
57
58 nand@1,0 {
59 #address-cells = <1>;
60 #size-cells = <1>;
61 compatible = "fsl,ifc-nand";
62 reg = <0x2 0x0 0x10000>;
63 };
64
65 boardctrl: board-control@2,0 {
66 #address-cells = <1>;
67 #size-cells = <1>;
68 compatible = "fsl,t2080-cpld";
69 reg = <3 0 0x300>;
70 ranges = <0 3 0 0x300>;
71 };
72 };
73
74 memory {
75 device_type = "memory";
76 };
77
78 dcsr: dcsr@f00000000 {
79 ranges = <0x00000000 0xf 0x00000000 0x01072000>;
80 };
81
82 soc: soc@ffe000000 {
83 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
84 reg = <0xf 0xfe000000 0 0x00001000>;
85 spi@110000 {
86 flash@0 {
87 #address-cells = <1>;
88 #size-cells = <1>;
89 compatible = "micron,n25q512a";
90 reg = <0>;
91 spi-max-frequency = <10000000>; /* input clock */
92 };
93 };
94
95 i2c@118000 {
96 adt7481@4c {
97 compatible = "adi,adt7481";
98 reg = <0x4c>;
99 };
100
101 rtc@68 {
102 compatible = "dallas,ds1339";
103 reg = <0x68>;
104 interrupts = <0x1 0x1 0 0>;
105 };
106
107 eeprom@50 {
108 compatible = "atmel,24c256";
109 reg = <0x50>;
110 };
111 };
112
113 i2c@118100 {
114 pca9546@77 {
115 compatible = "nxp,pca9546";
116 reg = <0x77>;
117 };
118 };
119
120 sdhc@114000 {
121 voltage-ranges = <1800 1800 3300 3300>;
122 };
123 };
124
125 pci0: pcie@ffe240000 {
126 reg = <0xf 0xfe240000 0 0x10000>;
127 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
128 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
129 pcie@0 {
130 ranges = <0x02000000 0 0xe0000000
131 0x02000000 0 0xe0000000
132 0 0x20000000
133
134 0x01000000 0 0x00000000
135 0x01000000 0 0x00000000
136 0 0x00010000>;
137 };
138 };
139
140 pci1: pcie@ffe250000 {
141 reg = <0xf 0xfe250000 0 0x10000>;
142 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x10000000
143 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
144 pcie@0 {
145 ranges = <0x02000000 0 0xe0000000
146 0x02000000 0 0xe0000000
147 0 0x20000000
148
149 0x01000000 0 0x00000000
150 0x01000000 0 0x00000000
151 0 0x00010000>;
152 };
153 };
154
155 pci2: pcie@ffe260000 {
156 reg = <0xf 0xfe260000 0 0x1000>;
157 ranges = <0x02000000 0 0xe0000000 0xc 0x30000000 0 0x10000000
158 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
159 pcie@0 {
160 ranges = <0x02000000 0 0xe0000000
161 0x02000000 0 0xe0000000
162 0 0x20000000
163
164 0x01000000 0 0x00000000
165 0x01000000 0 0x00000000
166 0 0x00010000>;
167 };
168 };
169
170 pci3: pcie@ffe270000 {
171 reg = <0xf 0xfe270000 0 0x10000>;
172 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x10000000
173 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>;
174 pcie@0 {
175 ranges = <0x02000000 0 0xe0000000
176 0x02000000 0 0xe0000000
177 0 0x20000000
178
179 0x01000000 0 0x00000000
180 0x01000000 0 0x00000000
181 0 0x00010000>;
182 };
183 };
184};
diff --git a/arch/powerpc/boot/dts/t4240rdb.dts b/arch/powerpc/boot/dts/t4240rdb.dts
new file mode 100644
index 000000000000..53761d4e8c51
--- /dev/null
+++ b/arch/powerpc/boot/dts/t4240rdb.dts
@@ -0,0 +1,186 @@
1/*
2 * T4240RDB Device Tree Source
3 *
4 * Copyright 2014 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/t4240si-pre.dtsi"
36
37/ {
38 model = "fsl,T4240RDB";
39 compatible = "fsl,T4240RDB";
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 ifc: localbus@ffe124000 {
45 reg = <0xf 0xfe124000 0 0x2000>;
46 ranges = <0 0 0xf 0xe8000000 0x08000000
47 2 0 0xf 0xff800000 0x00010000
48 3 0 0xf 0xffdf0000 0x00008000>;
49
50 nor@0,0 {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 compatible = "cfi-flash";
54 reg = <0x0 0x0 0x8000000>;
55
56 bank-width = <2>;
57 device-width = <1>;
58 };
59
60 nand@2,0 {
61 #address-cells = <1>;
62 #size-cells = <1>;
63 compatible = "fsl,ifc-nand";
64 reg = <0x2 0x0 0x10000>;
65 };
66 };
67
68 memory {
69 device_type = "memory";
70 };
71
72 dcsr: dcsr@f00000000 {
73 ranges = <0x00000000 0xf 0x00000000 0x01072000>;
74 };
75
76 soc: soc@ffe000000 {
77 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
78 reg = <0xf 0xfe000000 0 0x00001000>;
79 spi@110000 {
80 flash@0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 compatible = "sst,sst25wf040";
84 reg = <0>;
85 spi-max-frequency = <40000000>; /* input clock */
86 };
87 };
88
89 i2c@118000 {
90 eeprom@52 {
91 compatible = "at24,24c256";
92 reg = <0x52>;
93 };
94 eeprom@54 {
95 compatible = "at24,24c256";
96 reg = <0x54>;
97 };
98 eeprom@56 {
99 compatible = "at24,24c256";
100 reg = <0x56>;
101 };
102 rtc@68 {
103 compatible = "dallas,ds1374";
104 reg = <0x68>;
105 interrupts = <0x1 0x1 0 0>;
106 };
107 };
108
109 sdhc@114000 {
110 voltage-ranges = <1800 1800 3300 3300>;
111 };
112 };
113
114 pci0: pcie@ffe240000 {
115 reg = <0xf 0xfe240000 0 0x10000>;
116 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
117 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
118 pcie@0 {
119 ranges = <0x02000000 0 0xe0000000
120 0x02000000 0 0xe0000000
121 0 0x20000000
122
123 0x01000000 0 0x00000000
124 0x01000000 0 0x00000000
125 0 0x00010000>;
126 };
127 };
128
129 pci1: pcie@ffe250000 {
130 reg = <0xf 0xfe250000 0 0x10000>;
131 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
132 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
133 pcie@0 {
134 ranges = <0x02000000 0 0xe0000000
135 0x02000000 0 0xe0000000
136 0 0x20000000
137
138 0x01000000 0 0x00000000
139 0x01000000 0 0x00000000
140 0 0x00010000>;
141 };
142 };
143
144 pci2: pcie@ffe260000 {
145 reg = <0xf 0xfe260000 0 0x1000>;
146 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
147 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
148 pcie@0 {
149 ranges = <0x02000000 0 0xe0000000
150 0x02000000 0 0xe0000000
151 0 0x20000000
152
153 0x01000000 0 0x00000000
154 0x01000000 0 0x00000000
155 0 0x00010000>;
156 };
157 };
158
159 pci3: pcie@ffe270000 {
160 reg = <0xf 0xfe270000 0 0x10000>;
161 ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000
162 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>;
163 pcie@0 {
164 ranges = <0x02000000 0 0xe0000000
165 0x02000000 0 0xe0000000
166 0 0x20000000
167
168 0x01000000 0 0x00000000
169 0x01000000 0 0x00000000
170 0 0x00010000>;
171 };
172 };
173
174 rio: rapidio@ffe0c0000 {
175 reg = <0xf 0xfe0c0000 0 0x11000>;
176
177 port1 {
178 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
179 };
180 port2 {
181 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
182 };
183 };
184};
185
186/include/ "fsl/t4240si-post.dtsi"
diff --git a/arch/powerpc/boot/gunzip_util.c b/arch/powerpc/boot/gunzip_util.c
index ef2aed0f63ca..9dc52501de83 100644
--- a/arch/powerpc/boot/gunzip_util.c
+++ b/arch/powerpc/boot/gunzip_util.c
@@ -112,10 +112,10 @@ int gunzip_partial(struct gunzip_state *state, void *dst, int dstlen)
112 r = zlib_inflate(&state->s, Z_FULL_FLUSH); 112 r = zlib_inflate(&state->s, Z_FULL_FLUSH);
113 if (r != Z_OK && r != Z_STREAM_END) 113 if (r != Z_OK && r != Z_STREAM_END)
114 fatal("inflate returned %d msg: %s\n\r", r, state->s.msg); 114 fatal("inflate returned %d msg: %s\n\r", r, state->s.msg);
115 len = state->s.next_out - (unsigned char *)dst; 115 len = state->s.next_out - (Byte *)dst;
116 } else { 116 } else {
117 /* uncompressed image */ 117 /* uncompressed image */
118 len = min(state->s.avail_in, (unsigned)dstlen); 118 len = min(state->s.avail_in, (uLong)dstlen);
119 memcpy(dst, state->s.next_in, len); 119 memcpy(dst, state->s.next_in, len);
120 state->s.next_in += len; 120 state->s.next_in += len;
121 state->s.avail_in -= len; 121 state->s.avail_in -= len;
diff --git a/arch/powerpc/boot/io.h b/arch/powerpc/boot/io.h
index 7c09f4861fe1..394da5500466 100644
--- a/arch/powerpc/boot/io.h
+++ b/arch/powerpc/boot/io.h
@@ -1,5 +1,5 @@
1#ifndef _IO_H 1#ifndef _IO_H
2#define __IO_H 2#define _IO_H
3 3
4#include "types.h" 4#include "types.h"
5 5
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig
index c05310a913be..c936fab9ec4a 100644
--- a/arch/powerpc/configs/52xx/motionpro_defconfig
+++ b/arch/powerpc/configs/52xx/motionpro_defconfig
@@ -43,7 +43,6 @@ CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=32768 43CONFIG_BLK_DEV_RAM_SIZE=32768
44CONFIG_MISC_DEVICES=y 44CONFIG_MISC_DEVICES=y
45CONFIG_EEPROM_LEGACY=y 45CONFIG_EEPROM_LEGACY=y
46CONFIG_SCSI_TGT=y
47CONFIG_BLK_DEV_SD=y 46CONFIG_BLK_DEV_SD=y
48CONFIG_CHR_DEV_SG=y 47CONFIG_CHR_DEV_SG=y
49CONFIG_ATA=y 48CONFIG_ATA=y
diff --git a/arch/powerpc/configs/85xx/kmp204x_defconfig b/arch/powerpc/configs/85xx/kmp204x_defconfig
index e9a81e5ba273..e362d588dfbf 100644
--- a/arch/powerpc/configs/85xx/kmp204x_defconfig
+++ b/arch/powerpc/configs/85xx/kmp204x_defconfig
@@ -192,7 +192,6 @@ CONFIG_RTC_DRV_DS3232=y
192CONFIG_RTC_DRV_CMOS=y 192CONFIG_RTC_DRV_CMOS=y
193CONFIG_UIO=y 193CONFIG_UIO=y
194CONFIG_STAGING=y 194CONFIG_STAGING=y
195# CONFIG_NET_VENDOR_SILICOM is not set
196CONFIG_CLK_PPC_CORENET=y 195CONFIG_CLK_PPC_CORENET=y
197CONFIG_EXT2_FS=y 196CONFIG_EXT2_FS=y
198CONFIG_NTFS_FS=y 197CONFIG_NTFS_FS=y
diff --git a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
index bcbe74716689..9b192bb6bd3d 100644
--- a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
@@ -54,7 +54,6 @@ CONFIG_BLK_DEV_LOOP=y
54CONFIG_BLK_DEV_RAM=y 54CONFIG_BLK_DEV_RAM=y
55CONFIG_BLK_DEV_RAM_SIZE=131072 55CONFIG_BLK_DEV_RAM_SIZE=131072
56CONFIG_IDE=y 56CONFIG_IDE=y
57CONFIG_SCSI_TGT=y
58CONFIG_BLK_DEV_SD=y 57CONFIG_BLK_DEV_SD=y
59CONFIG_CHR_DEV_SG=y 58CONFIG_CHR_DEV_SG=y
60CONFIG_ATA=y 59CONFIG_ATA=y
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index c19ff057d0f9..6a3c58adf253 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -139,8 +139,9 @@ CONFIG_EDAC=y
139CONFIG_EDAC_MM_EDAC=y 139CONFIG_EDAC_MM_EDAC=y
140CONFIG_EDAC_MPC85XX=y 140CONFIG_EDAC_MPC85XX=y
141CONFIG_RTC_CLASS=y 141CONFIG_RTC_CLASS=y
142CONFIG_RTC_DRV_DS1307=y
143CONFIG_RTC_DRV_DS1374=y
142CONFIG_RTC_DRV_DS3232=y 144CONFIG_RTC_DRV_DS3232=y
143CONFIG_RTC_DRV_CMOS=y
144CONFIG_UIO=y 145CONFIG_UIO=y
145CONFIG_STAGING=y 146CONFIG_STAGING=y
146CONFIG_VIRT_DRIVERS=y 147CONFIG_VIRT_DRIVERS=y
@@ -179,3 +180,4 @@ CONFIG_CRYPTO_SHA512=y
179CONFIG_CRYPTO_AES=y 180CONFIG_CRYPTO_AES=y
180# CONFIG_CRYPTO_ANSI_CPRNG is not set 181# CONFIG_CRYPTO_ANSI_CPRNG is not set
181CONFIG_CRYPTO_DEV_FSL_CAAM=y 182CONFIG_CRYPTO_DEV_FSL_CAAM=y
183CONFIG_FSL_CORENET_CF=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 5c7fa19ae4ef..4b07bade1ba9 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -123,6 +123,10 @@ CONFIG_USB_EHCI_FSL=y
123CONFIG_USB_STORAGE=y 123CONFIG_USB_STORAGE=y
124CONFIG_MMC=y 124CONFIG_MMC=y
125CONFIG_MMC_SDHCI=y 125CONFIG_MMC_SDHCI=y
126CONFIG_RTC_CLASS=y
127CONFIG_RTC_DRV_DS1307=y
128CONFIG_RTC_DRV_DS1374=y
129CONFIG_RTC_DRV_DS3232=y
126CONFIG_EDAC=y 130CONFIG_EDAC=y
127CONFIG_EDAC_MM_EDAC=y 131CONFIG_EDAC_MM_EDAC=y
128CONFIG_DMADEVICES=y 132CONFIG_DMADEVICES=y
@@ -175,3 +179,4 @@ CONFIG_CRYPTO_SHA256=y
175CONFIG_CRYPTO_SHA512=y 179CONFIG_CRYPTO_SHA512=y
176# CONFIG_CRYPTO_ANSI_CPRNG is not set 180# CONFIG_CRYPTO_ANSI_CPRNG is not set
177CONFIG_CRYPTO_DEV_FSL_CAAM=y 181CONFIG_CRYPTO_DEV_FSL_CAAM=y
182CONFIG_FSL_CORENET_CF=y
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig
index 530601e8ccfe..69fd8adf9f5e 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -47,7 +47,6 @@ CONFIG_BLK_DEV_LOOP=y
47CONFIG_BLK_DEV_RAM=y 47CONFIG_BLK_DEV_RAM=y
48CONFIG_BLK_DEV_RAM_SIZE=32768 48CONFIG_BLK_DEV_RAM_SIZE=32768
49CONFIG_EEPROM_AT24=y 49CONFIG_EEPROM_AT24=y
50CONFIG_SCSI_TGT=y
51CONFIG_BLK_DEV_SD=y 50CONFIG_BLK_DEV_SD=y
52CONFIG_CHR_DEV_SG=y 51CONFIG_CHR_DEV_SG=y
53CONFIG_ATA=y 52CONFIG_ATA=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 55765c8cb08f..fa1bfd37f1ec 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -209,6 +209,9 @@ CONFIG_MMC_SDHCI_OF_ESDHC=y
209CONFIG_EDAC=y 209CONFIG_EDAC=y
210CONFIG_EDAC_MM_EDAC=y 210CONFIG_EDAC_MM_EDAC=y
211CONFIG_RTC_CLASS=y 211CONFIG_RTC_CLASS=y
212CONFIG_RTC_DRV_DS1307=y
213CONFIG_RTC_DRV_DS1374=y
214CONFIG_RTC_DRV_DS3232=y
212CONFIG_RTC_DRV_CMOS=y 215CONFIG_RTC_DRV_CMOS=y
213CONFIG_RTC_DRV_DS1307=y 216CONFIG_RTC_DRV_DS1307=y
214CONFIG_DMADEVICES=y 217CONFIG_DMADEVICES=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 5c6ecdc0f70e..0b452ebd8b3d 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -210,6 +210,9 @@ CONFIG_MMC_SDHCI_OF_ESDHC=y
210CONFIG_EDAC=y 210CONFIG_EDAC=y
211CONFIG_EDAC_MM_EDAC=y 211CONFIG_EDAC_MM_EDAC=y
212CONFIG_RTC_CLASS=y 212CONFIG_RTC_CLASS=y
213CONFIG_RTC_DRV_DS1307=y
214CONFIG_RTC_DRV_DS1374=y
215CONFIG_RTC_DRV_DS3232=y
213CONFIG_RTC_DRV_CMOS=y 216CONFIG_RTC_DRV_CMOS=y
214CONFIG_RTC_DRV_DS1307=y 217CONFIG_RTC_DRV_DS1307=y
215CONFIG_DMADEVICES=y 218CONFIG_DMADEVICES=y
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index ccf66b9060a6..924e10df1844 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -127,4 +127,3 @@ CONFIG_CRYPTO_PCBC=y
127# CONFIG_CRYPTO_ANSI_CPRNG is not set 127# CONFIG_CRYPTO_ANSI_CPRNG is not set
128# CONFIG_CRYPTO_HW is not set 128# CONFIG_CRYPTO_HW is not set
129CONFIG_VIRTUALIZATION=y 129CONFIG_VIRTUALIZATION=y
130CONFIG_KVM_440=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index c91066944842..fec5870f1818 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -425,10 +425,8 @@ CONFIG_SCSI_LOGGING=y
425CONFIG_SCSI_SCAN_ASYNC=y 425CONFIG_SCSI_SCAN_ASYNC=y
426CONFIG_SCSI_SPI_ATTRS=m 426CONFIG_SCSI_SPI_ATTRS=m
427CONFIG_SCSI_SRP_ATTRS=m 427CONFIG_SCSI_SRP_ATTRS=m
428CONFIG_SCSI_SRP_TGT_ATTRS=y
429CONFIG_SCSI_MESH=m 428CONFIG_SCSI_MESH=m
430CONFIG_SCSI_MAC53C94=m 429CONFIG_SCSI_MAC53C94=m
431CONFIG_SCSI_SRP=m
432CONFIG_SCSI_LOWLEVEL_PCMCIA=y 430CONFIG_SCSI_LOWLEVEL_PCMCIA=y
433CONFIG_SCSI_DH=y 431CONFIG_SCSI_DH=y
434CONFIG_SCSI_DH_RDAC=m 432CONFIG_SCSI_DH_RDAC=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 3fb1bc432f4f..7f23f162ce9c 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -4,5 +4,6 @@ generic-y += hash.h
4generic-y += mcs_spinlock.h 4generic-y += mcs_spinlock.h
5generic-y += preempt.h 5generic-y += preempt.h
6generic-y += rwsem.h 6generic-y += rwsem.h
7generic-y += scatterlist.h
7generic-y += trace_clock.h 8generic-y += trace_clock.h
8generic-y += vtime.h 9generic-y += vtime.h
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 4b237aa35660..21be8ae8f809 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -34,10 +34,14 @@
34#define PPC_MIN_STKFRM 112 34#define PPC_MIN_STKFRM 112
35 35
36#ifdef __BIG_ENDIAN__ 36#ifdef __BIG_ENDIAN__
37#define LWZX_BE stringify_in_c(lwzx)
37#define LDX_BE stringify_in_c(ldx) 38#define LDX_BE stringify_in_c(ldx)
39#define STWX_BE stringify_in_c(stwx)
38#define STDX_BE stringify_in_c(stdx) 40#define STDX_BE stringify_in_c(stdx)
39#else 41#else
42#define LWZX_BE stringify_in_c(lwbrx)
40#define LDX_BE stringify_in_c(ldbrx) 43#define LDX_BE stringify_in_c(ldbrx)
44#define STWX_BE stringify_in_c(stwbrx)
41#define STDX_BE stringify_in_c(stdbrx) 45#define STDX_BE stringify_in_c(stdbrx)
42#endif 46#endif
43 47
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index ed0afc1e44a4..34a05a1a990b 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/reg.h>
6 7
7/* bytes per L1 cache line */ 8/* bytes per L1 cache line */
8#if defined(CONFIG_8xx) || defined(CONFIG_403GCX) 9#if defined(CONFIG_8xx) || defined(CONFIG_403GCX)
@@ -39,6 +40,12 @@ struct ppc64_caches {
39}; 40};
40 41
41extern struct ppc64_caches ppc64_caches; 42extern struct ppc64_caches ppc64_caches;
43
44static inline void logmpp(u64 x)
45{
46 asm volatile(PPC_LOGMPP(R1) : : "r" (x));
47}
48
42#endif /* __powerpc64__ && ! __ASSEMBLY__ */ 49#endif /* __powerpc64__ && ! __ASSEMBLY__ */
43 50
44#if defined(__ASSEMBLY__) 51#if defined(__ASSEMBLY__)
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 0fdd7eece6d9..daa5af91163c 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -195,8 +195,7 @@ extern const char *powerpc_base_platform;
195 195
196#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN) 196#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN)
197 197
198#define MMU_FTR_PPCAS_ARCH_V2 (MMU_FTR_SLB | MMU_FTR_TLBIEL | \ 198#define MMU_FTR_PPCAS_ARCH_V2 (MMU_FTR_TLBIEL | MMU_FTR_16M_PAGE)
199 MMU_FTR_16M_PAGE)
200 199
201/* We only set the altivec features if the kernel was compiled with altivec 200/* We only set the altivec features if the kernel was compiled with altivec
202 * support 201 * support
@@ -268,10 +267,6 @@ extern const char *powerpc_base_platform;
268#define CPU_FTR_MAYBE_CAN_NAP 0 267#define CPU_FTR_MAYBE_CAN_NAP 0
269#endif 268#endif
270 269
271#define CLASSIC_PPC (!defined(CONFIG_8xx) && !defined(CONFIG_4xx) && \
272 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
273 !defined(CONFIG_BOOKE))
274
275#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | \ 270#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | \
276 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE) 271 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE)
277#define CPU_FTRS_603 (CPU_FTR_COMMON | \ 272#define CPU_FTRS_603 (CPU_FTR_COMMON | \
@@ -396,15 +391,10 @@ extern const char *powerpc_base_platform;
396 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ 391 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \
397 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 392 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
398 CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \ 393 CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \
399 CPU_FTR_CELL_TB_BUG) 394 CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT)
400#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 395#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
401 396
402/* 64-bit CPUs */ 397/* 64-bit CPUs */
403#define CPU_FTRS_POWER3 (CPU_FTR_USE_TB | \
404 CPU_FTR_IABR | CPU_FTR_PPC_LE)
405#define CPU_FTRS_RS64 (CPU_FTR_USE_TB | \
406 CPU_FTR_IABR | \
407 CPU_FTR_MMCRA | CPU_FTR_CTRL)
408#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 398#define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
409 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 399 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
410 CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ | \ 400 CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ | \
@@ -467,15 +457,15 @@ extern const char *powerpc_base_platform;
467#define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500 | CPU_FTRS_A2) 457#define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500 | CPU_FTRS_A2)
468#else 458#else
469#define CPU_FTRS_POSSIBLE \ 459#define CPU_FTRS_POSSIBLE \
470 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 460 (CPU_FTRS_POWER4 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
471 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 461 CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \
472 CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \ 462 CPU_FTRS_POWER8 | CPU_FTRS_POWER8_DD1 | CPU_FTRS_CELL | \
473 CPU_FTRS_CELL | CPU_FTRS_PA6T | CPU_FTR_VSX) 463 CPU_FTRS_PA6T | CPU_FTR_VSX)
474#endif 464#endif
475#else 465#else
476enum { 466enum {
477 CPU_FTRS_POSSIBLE = 467 CPU_FTRS_POSSIBLE =
478#if CLASSIC_PPC 468#ifdef CONFIG_PPC_BOOK3S_32
479 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | 469 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU |
480 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | 470 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 |
481 CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX | 471 CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX |
@@ -518,14 +508,15 @@ enum {
518#define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500 & CPU_FTRS_A2) 508#define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500 & CPU_FTRS_A2)
519#else 509#else
520#define CPU_FTRS_ALWAYS \ 510#define CPU_FTRS_ALWAYS \
521 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 511 (CPU_FTRS_POWER4 & CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \
522 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ 512 CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \
523 CPU_FTRS_POWER7 & CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE) 513 CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \
514 CPU_FTRS_POWER8_DD1 & CPU_FTRS_POSSIBLE)
524#endif 515#endif
525#else 516#else
526enum { 517enum {
527 CPU_FTRS_ALWAYS = 518 CPU_FTRS_ALWAYS =
528#if CLASSIC_PPC 519#ifdef CONFIG_PPC_BOOK3S_32
529 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & 520 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU &
530 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & 521 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 &
531 CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX & 522 CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX &
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index fab7743c2640..9983c3d26bca 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -25,6 +25,7 @@
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/atomic.h>
28 29
29struct pci_dev; 30struct pci_dev;
30struct pci_bus; 31struct pci_bus;
@@ -33,10 +34,11 @@ struct device_node;
33#ifdef CONFIG_EEH 34#ifdef CONFIG_EEH
34 35
35/* EEH subsystem flags */ 36/* EEH subsystem flags */
36#define EEH_ENABLED 0x1 /* EEH enabled */ 37#define EEH_ENABLED 0x01 /* EEH enabled */
37#define EEH_FORCE_DISABLED 0x2 /* EEH disabled */ 38#define EEH_FORCE_DISABLED 0x02 /* EEH disabled */
38#define EEH_PROBE_MODE_DEV 0x4 /* From PCI device */ 39#define EEH_PROBE_MODE_DEV 0x04 /* From PCI device */
39#define EEH_PROBE_MODE_DEVTREE 0x8 /* From device tree */ 40#define EEH_PROBE_MODE_DEVTREE 0x08 /* From device tree */
41#define EEH_ENABLE_IO_FOR_LOG 0x10 /* Enable IO for log */
40 42
41/* 43/*
42 * Delay for PE reset, all in ms 44 * Delay for PE reset, all in ms
@@ -84,7 +86,9 @@ struct eeh_pe {
84 int freeze_count; /* Times of froze up */ 86 int freeze_count; /* Times of froze up */
85 struct timeval tstamp; /* Time on first-time freeze */ 87 struct timeval tstamp; /* Time on first-time freeze */
86 int false_positives; /* Times of reported #ff's */ 88 int false_positives; /* Times of reported #ff's */
89 atomic_t pass_dev_cnt; /* Count of passed through devs */
87 struct eeh_pe *parent; /* Parent PE */ 90 struct eeh_pe *parent; /* Parent PE */
91 void *data; /* PE auxillary data */
88 struct list_head child_list; /* Link PE to the child list */ 92 struct list_head child_list; /* Link PE to the child list */
89 struct list_head edevs; /* Link list of EEH devices */ 93 struct list_head edevs; /* Link list of EEH devices */
90 struct list_head child; /* Child PEs */ 94 struct list_head child; /* Child PEs */
@@ -93,6 +97,11 @@ struct eeh_pe {
93#define eeh_pe_for_each_dev(pe, edev, tmp) \ 97#define eeh_pe_for_each_dev(pe, edev, tmp) \
94 list_for_each_entry_safe(edev, tmp, &pe->edevs, list) 98 list_for_each_entry_safe(edev, tmp, &pe->edevs, list)
95 99
100static inline bool eeh_pe_passed(struct eeh_pe *pe)
101{
102 return pe ? !!atomic_read(&pe->pass_dev_cnt) : false;
103}
104
96/* 105/*
97 * The struct is used to trace EEH state for the associated 106 * The struct is used to trace EEH state for the associated
98 * PCI device node or PCI device. In future, it might 107 * PCI device node or PCI device. In future, it might
@@ -165,6 +174,11 @@ enum {
165#define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */ 174#define EEH_STATE_DMA_ACTIVE (1 << 4) /* Active DMA */
166#define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */ 175#define EEH_STATE_MMIO_ENABLED (1 << 5) /* MMIO enabled */
167#define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */ 176#define EEH_STATE_DMA_ENABLED (1 << 6) /* DMA enabled */
177#define EEH_PE_STATE_NORMAL 0 /* Normal state */
178#define EEH_PE_STATE_RESET 1 /* PE reset asserted */
179#define EEH_PE_STATE_STOPPED_IO_DMA 2 /* Frozen PE */
180#define EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA, Enabled IO */
181#define EEH_PE_STATE_UNAVAIL 5 /* Unavailable */
168#define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */ 182#define EEH_RESET_DEACTIVATE 0 /* Deactivate the PE reset */
169#define EEH_RESET_HOT 1 /* Hot reset */ 183#define EEH_RESET_HOT 1 /* Hot reset */
170#define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */ 184#define EEH_RESET_FUNDAMENTAL 3 /* Fundamental reset */
@@ -194,36 +208,28 @@ extern int eeh_subsystem_flags;
194extern struct eeh_ops *eeh_ops; 208extern struct eeh_ops *eeh_ops;
195extern raw_spinlock_t confirm_error_lock; 209extern raw_spinlock_t confirm_error_lock;
196 210
197static inline bool eeh_enabled(void) 211static inline void eeh_add_flag(int flag)
198{ 212{
199 if ((eeh_subsystem_flags & EEH_FORCE_DISABLED) || 213 eeh_subsystem_flags |= flag;
200 !(eeh_subsystem_flags & EEH_ENABLED))
201 return false;
202
203 return true;
204} 214}
205 215
206static inline void eeh_set_enable(bool mode) 216static inline void eeh_clear_flag(int flag)
207{ 217{
208 if (mode) 218 eeh_subsystem_flags &= ~flag;
209 eeh_subsystem_flags |= EEH_ENABLED;
210 else
211 eeh_subsystem_flags &= ~EEH_ENABLED;
212} 219}
213 220
214static inline void eeh_probe_mode_set(int flag) 221static inline bool eeh_has_flag(int flag)
215{ 222{
216 eeh_subsystem_flags |= flag; 223 return !!(eeh_subsystem_flags & flag);
217} 224}
218 225
219static inline int eeh_probe_mode_devtree(void) 226static inline bool eeh_enabled(void)
220{ 227{
221 return (eeh_subsystem_flags & EEH_PROBE_MODE_DEVTREE); 228 if (eeh_has_flag(EEH_FORCE_DISABLED) ||
222} 229 !eeh_has_flag(EEH_ENABLED))
230 return false;
223 231
224static inline int eeh_probe_mode_dev(void) 232 return true;
225{
226 return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV);
227} 233}
228 234
229static inline void eeh_serialize_lock(unsigned long *flags) 235static inline void eeh_serialize_lock(unsigned long *flags)
@@ -243,6 +249,7 @@ static inline void eeh_serialize_unlock(unsigned long flags)
243#define EEH_MAX_ALLOWED_FREEZES 5 249#define EEH_MAX_ALLOWED_FREEZES 5
244 250
245typedef void *(*eeh_traverse_func)(void *data, void *flag); 251typedef void *(*eeh_traverse_func)(void *data, void *flag);
252void eeh_set_pe_aux_size(int size);
246int eeh_phb_pe_create(struct pci_controller *phb); 253int eeh_phb_pe_create(struct pci_controller *phb);
247struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb); 254struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
248struct eeh_pe *eeh_pe_get(struct eeh_dev *edev); 255struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
@@ -272,6 +279,13 @@ void eeh_add_device_late(struct pci_dev *);
272void eeh_add_device_tree_late(struct pci_bus *); 279void eeh_add_device_tree_late(struct pci_bus *);
273void eeh_add_sysfs_files(struct pci_bus *); 280void eeh_add_sysfs_files(struct pci_bus *);
274void eeh_remove_device(struct pci_dev *); 281void eeh_remove_device(struct pci_dev *);
282int eeh_dev_open(struct pci_dev *pdev);
283void eeh_dev_release(struct pci_dev *pdev);
284struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group);
285int eeh_pe_set_option(struct eeh_pe *pe, int option);
286int eeh_pe_get_state(struct eeh_pe *pe);
287int eeh_pe_reset(struct eeh_pe *pe, int option);
288int eeh_pe_configure(struct eeh_pe *pe);
275 289
276/** 290/**
277 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. 291 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
@@ -295,8 +309,6 @@ static inline bool eeh_enabled(void)
295 return false; 309 return false;
296} 310}
297 311
298static inline void eeh_set_enable(bool mode) { }
299
300static inline int eeh_init(void) 312static inline int eeh_init(void)
301{ 313{
302 return 0; 314 return 0;
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 8f35cd7d59cc..77f52b26dad6 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -425,6 +425,8 @@ label##_relon_hv: \
425#define SOFTEN_VALUE_0xa00 PACA_IRQ_DBELL 425#define SOFTEN_VALUE_0xa00 PACA_IRQ_DBELL
426#define SOFTEN_VALUE_0xe80 PACA_IRQ_DBELL 426#define SOFTEN_VALUE_0xe80 PACA_IRQ_DBELL
427#define SOFTEN_VALUE_0xe82 PACA_IRQ_DBELL 427#define SOFTEN_VALUE_0xe82 PACA_IRQ_DBELL
428#define SOFTEN_VALUE_0xe60 PACA_IRQ_HMI
429#define SOFTEN_VALUE_0xe62 PACA_IRQ_HMI
428 430
429#define __SOFTEN_TEST(h, vec) \ 431#define __SOFTEN_TEST(h, vec) \
430 lbz r10,PACASOFTIRQEN(r13); \ 432 lbz r10,PACASOFTIRQEN(r13); \
@@ -513,8 +515,11 @@ label##_relon_hv: \
513 * runlatch, etc... 515 * runlatch, etc...
514 */ 516 */
515 517
516/* Exception addition: Hard disable interrupts */ 518/*
517#define DISABLE_INTS RECONCILE_IRQ_STATE(r10,r11) 519 * This addition reconciles our actual IRQ state with the various software
520 * flags that track it. This may call C code.
521 */
522#define ADD_RECONCILE RECONCILE_IRQ_STATE(r10,r11)
518 523
519#define ADD_NVGPRS \ 524#define ADD_NVGPRS \
520 bl save_nvgprs 525 bl save_nvgprs
@@ -532,6 +537,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
532 .globl label##_common; \ 537 .globl label##_common; \
533label##_common: \ 538label##_common: \
534 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ 539 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
540 /* Volatile regs are potentially clobbered here */ \
535 additions; \ 541 additions; \
536 addi r3,r1,STACK_FRAME_OVERHEAD; \ 542 addi r3,r1,STACK_FRAME_OVERHEAD; \
537 bl hdlr; \ 543 bl hdlr; \
@@ -539,7 +545,7 @@ label##_common: \
539 545
540#define STD_EXCEPTION_COMMON(trap, label, hdlr) \ 546#define STD_EXCEPTION_COMMON(trap, label, hdlr) \
541 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except, \ 547 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except, \
542 ADD_NVGPRS;DISABLE_INTS) 548 ADD_NVGPRS;ADD_RECONCILE)
543 549
544/* 550/*
545 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur 551 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur
@@ -548,7 +554,7 @@ label##_common: \
548 */ 554 */
549#define STD_EXCEPTION_COMMON_ASYNC(trap, label, hdlr) \ 555#define STD_EXCEPTION_COMMON_ASYNC(trap, label, hdlr) \
550 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except_lite, \ 556 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except_lite, \
551 FINISH_NAP;DISABLE_INTS;RUNLATCH_ON) 557 FINISH_NAP;ADD_RECONCILE;RUNLATCH_ON)
552 558
553/* 559/*
554 * When the idle code in power4_idle puts the CPU into NAP mode, 560 * When the idle code in power4_idle puts the CPU into NAP mode,
diff --git a/arch/powerpc/include/asm/fs_pd.h b/arch/powerpc/include/asm/fs_pd.h
index 9361cd5342cc..f79d6c74eb2a 100644
--- a/arch/powerpc/include/asm/fs_pd.h
+++ b/arch/powerpc/include/asm/fs_pd.h
@@ -28,7 +28,6 @@
28 28
29#ifdef CONFIG_8xx 29#ifdef CONFIG_8xx
30#include <asm/8xx_immap.h> 30#include <asm/8xx_immap.h>
31#include <asm/mpc8xx.h>
32 31
33extern immap_t __iomem *mpc8xx_immr; 32extern immap_t __iomem *mpc8xx_immr;
34 33
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 418fb654370d..1bbb3013d6aa 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -11,6 +11,7 @@ typedef struct {
11 unsigned int pmu_irqs; 11 unsigned int pmu_irqs;
12 unsigned int mce_exceptions; 12 unsigned int mce_exceptions;
13 unsigned int spurious_irqs; 13 unsigned int spurious_irqs;
14 unsigned int hmi_exceptions;
14#ifdef CONFIG_PPC_DOORBELL 15#ifdef CONFIG_PPC_DOORBELL
15 unsigned int doorbell_irqs; 16 unsigned int doorbell_irqs;
16#endif 17#endif
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 5dbbb29f5c3e..85bc8c0d257b 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -279,6 +279,12 @@
279#define H_GET_24X7_DATA 0xF07C 279#define H_GET_24X7_DATA 0xF07C
280#define H_GET_PERF_COUNTER_INFO 0xF080 280#define H_GET_PERF_COUNTER_INFO 0xF080
281 281
282/* Values for 2nd argument to H_SET_MODE */
283#define H_SET_MODE_RESOURCE_SET_CIABR 1
284#define H_SET_MODE_RESOURCE_SET_DAWR 2
285#define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE 3
286#define H_SET_MODE_RESOURCE_LE 4
287
282#ifndef __ASSEMBLY__ 288#ifndef __ASSEMBLY__
283 289
284/** 290/**
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 10be1dd01c6b..b59ac27a6b7d 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -25,6 +25,7 @@
25#define PACA_IRQ_EE 0x04 25#define PACA_IRQ_EE 0x04
26#define PACA_IRQ_DEC 0x08 /* Or FIT */ 26#define PACA_IRQ_DEC 0x08 /* Or FIT */
27#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */ 27#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */
28#define PACA_IRQ_HMI 0x20
28 29
29#endif /* CONFIG_PPC64 */ 30#endif /* CONFIG_PPC64 */
30 31
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
index e20eb95429a8..f2149066fe5d 100644
--- a/arch/powerpc/include/asm/irqflags.h
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -32,9 +32,8 @@
32#endif 32#endif
33 33
34/* 34/*
35 * Most of the CPU's IRQ-state tracing is done from assembly code; we 35 * These are calls to C code, so the caller must be prepared for volatiles to
36 * have to call a C function so call a wrapper that saves all the 36 * be clobbered.
37 * C-clobbered registers.
38 */ 37 */
39#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_on) 38#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_on)
40#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_off) 39#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_off)
@@ -42,6 +41,9 @@
42/* 41/*
43 * This is used by assembly code to soft-disable interrupts first and 42 * This is used by assembly code to soft-disable interrupts first and
44 * reconcile irq state. 43 * reconcile irq state.
44 *
45 * NB: This may call C code, so the caller must be prepared for volatiles to
46 * be clobbered.
45 */ 47 */
46#define RECONCILE_IRQ_STATE(__rA, __rB) \ 48#define RECONCILE_IRQ_STATE(__rA, __rB) \
47 lbz __rA,PACASOFTIRQEN(r13); \ 49 lbz __rA,PACASOFTIRQEN(r13); \
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index f016bb699b5f..efbf9a322a23 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -10,6 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#ifndef __ASSEMBLY__
13#include <linux/types.h> 14#include <linux/types.h>
14 15
15#include <asm/feature-fixups.h> 16#include <asm/feature-fixups.h>
@@ -42,4 +43,12 @@ struct jump_entry {
42 jump_label_t key; 43 jump_label_t key;
43}; 44};
44 45
46#else
47#define ARCH_STATIC_BRANCH(LABEL, KEY) \
481098: nop; \
49 .pushsection __jump_table, "aw"; \
50 FTR_ENTRY_LONG 1098b, LABEL, KEY; \
51 .popsection
52#endif
53
45#endif /* _ASM_POWERPC_JUMP_LABEL_H */ 54#endif /* _ASM_POWERPC_JUMP_LABEL_H */
diff --git a/arch/powerpc/include/asm/kvm_44x.h b/arch/powerpc/include/asm/kvm_44x.h
deleted file mode 100644
index a0e57618ff33..000000000000
--- a/arch/powerpc/include/asm/kvm_44x.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __ASM_44X_H__
21#define __ASM_44X_H__
22
23#include <linux/kvm_host.h>
24
25#define PPC44x_TLB_SIZE 64
26
27/* If the guest is expecting it, this can be as large as we like; we'd just
28 * need to find some way of advertising it. */
29#define KVM44x_GUEST_TLB_SIZE 64
30
31struct kvmppc_44x_tlbe {
32 u32 tid; /* Only the low 8 bits are used. */
33 u32 word0;
34 u32 word1;
35 u32 word2;
36};
37
38struct kvmppc_44x_shadow_ref {
39 struct page *page;
40 u16 gtlb_index;
41 u8 writeable;
42 u8 tid;
43};
44
45struct kvmppc_vcpu_44x {
46 /* Unmodified copy of the guest's TLB. */
47 struct kvmppc_44x_tlbe guest_tlb[KVM44x_GUEST_TLB_SIZE];
48
49 /* References to guest pages in the hardware TLB. */
50 struct kvmppc_44x_shadow_ref shadow_refs[PPC44x_TLB_SIZE];
51
52 /* State of the shadow TLB at guest context switch time. */
53 struct kvmppc_44x_tlbe shadow_tlb[PPC44x_TLB_SIZE];
54 u8 shadow_tlb_mod[PPC44x_TLB_SIZE];
55
56 struct kvm_vcpu vcpu;
57};
58
59static inline struct kvmppc_vcpu_44x *to_44x(struct kvm_vcpu *vcpu)
60{
61 return container_of(vcpu, struct kvmppc_vcpu_44x, vcpu);
62}
63
64void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu);
65void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu);
66
67#endif /* __ASM_44X_H__ */
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 9601741080e5..465dfcb82c92 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -33,7 +33,6 @@
33/* IVPR must be 64KiB-aligned. */ 33/* IVPR must be 64KiB-aligned. */
34#define VCPU_SIZE_ORDER 4 34#define VCPU_SIZE_ORDER 4
35#define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12) 35#define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12)
36#define VCPU_TLB_PGSZ PPC44x_TLB_64K
37#define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG) 36#define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
38 37
39#define BOOKE_INTERRUPT_CRITICAL 0 38#define BOOKE_INTERRUPT_CRITICAL 0
@@ -98,6 +97,7 @@
98#define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00 97#define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00
99#define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20 98#define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20
100#define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40 99#define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40
100#define BOOK3S_INTERRUPT_HMI 0xe60
101#define BOOK3S_INTERRUPT_H_DOORBELL 0xe80 101#define BOOK3S_INTERRUPT_H_DOORBELL 0xe80
102#define BOOK3S_INTERRUPT_PERFMON 0xf00 102#define BOOK3S_INTERRUPT_PERFMON 0xf00
103#define BOOK3S_INTERRUPT_ALTIVEC 0xf20 103#define BOOK3S_INTERRUPT_ALTIVEC 0xf20
@@ -131,6 +131,7 @@
131#define BOOK3S_HFLAG_NATIVE_PS 0x8 131#define BOOK3S_HFLAG_NATIVE_PS 0x8
132#define BOOK3S_HFLAG_MULTI_PGSIZE 0x10 132#define BOOK3S_HFLAG_MULTI_PGSIZE 0x10
133#define BOOK3S_HFLAG_NEW_TLBIE 0x20 133#define BOOK3S_HFLAG_NEW_TLBIE 0x20
134#define BOOK3S_HFLAG_SPLIT_HACK 0x40
134 135
135#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ 136#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
136#define RESUME_FLAG_HOST (1<<1) /* Resume host? */ 137#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index f52f65694527..6acf0c2a0f99 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -83,8 +83,6 @@ struct kvmppc_vcpu_book3s {
83 u64 sdr1; 83 u64 sdr1;
84 u64 hior; 84 u64 hior;
85 u64 msr_mask; 85 u64 msr_mask;
86 u64 purr_offset;
87 u64 spurr_offset;
88#ifdef CONFIG_PPC_BOOK3S_32 86#ifdef CONFIG_PPC_BOOK3S_32
89 u32 vsid_pool[VSID_POOL_SIZE]; 87 u32 vsid_pool[VSID_POOL_SIZE];
90 u32 vsid_next; 88 u32 vsid_next;
@@ -148,9 +146,10 @@ extern void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *
148extern int kvmppc_mmu_hpte_sysinit(void); 146extern int kvmppc_mmu_hpte_sysinit(void);
149extern void kvmppc_mmu_hpte_sysexit(void); 147extern void kvmppc_mmu_hpte_sysexit(void);
150extern int kvmppc_mmu_hv_init(void); 148extern int kvmppc_mmu_hv_init(void);
149extern int kvmppc_book3s_hcall_implemented(struct kvm *kvm, unsigned long hc);
151 150
151/* XXX remove this export when load_last_inst() is generic */
152extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); 152extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
153extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
154extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); 153extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec);
155extern void kvmppc_book3s_dequeue_irqprio(struct kvm_vcpu *vcpu, 154extern void kvmppc_book3s_dequeue_irqprio(struct kvm_vcpu *vcpu,
156 unsigned int vec); 155 unsigned int vec);
@@ -159,13 +158,13 @@ extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
159 bool upper, u32 val); 158 bool upper, u32 val);
160extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr); 159extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr);
161extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu); 160extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu);
162extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing, 161extern pfn_t kvmppc_gpa_to_pfn(struct kvm_vcpu *vcpu, gpa_t gpa, bool writing,
163 bool *writable); 162 bool *writable);
164extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev, 163extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
165 unsigned long *rmap, long pte_index, int realmode); 164 unsigned long *rmap, long pte_index, int realmode);
166extern void kvmppc_invalidate_hpte(struct kvm *kvm, unsigned long *hptep, 165extern void kvmppc_invalidate_hpte(struct kvm *kvm, __be64 *hptep,
167 unsigned long pte_index); 166 unsigned long pte_index);
168void kvmppc_clear_ref_hpte(struct kvm *kvm, unsigned long *hptep, 167void kvmppc_clear_ref_hpte(struct kvm *kvm, __be64 *hptep,
169 unsigned long pte_index); 168 unsigned long pte_index);
170extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr, 169extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr,
171 unsigned long *nb_ret); 170 unsigned long *nb_ret);
@@ -183,12 +182,16 @@ extern long kvmppc_hv_get_dirty_log(struct kvm *kvm,
183 struct kvm_memory_slot *memslot, unsigned long *map); 182 struct kvm_memory_slot *memslot, unsigned long *map);
184extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr, 183extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr,
185 unsigned long mask); 184 unsigned long mask);
185extern void kvmppc_set_fscr(struct kvm_vcpu *vcpu, u64 fscr);
186 186
187extern void kvmppc_entry_trampoline(void); 187extern void kvmppc_entry_trampoline(void);
188extern void kvmppc_hv_entry_trampoline(void); 188extern void kvmppc_hv_entry_trampoline(void);
189extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst); 189extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);
190extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst); 190extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst);
191extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd); 191extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
192extern void kvmppc_pr_init_default_hcalls(struct kvm *kvm);
193extern int kvmppc_hcall_impl_pr(unsigned long cmd);
194extern int kvmppc_hcall_impl_hv_realmode(unsigned long cmd);
192extern void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu, 195extern void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
193 struct kvm_vcpu *vcpu); 196 struct kvm_vcpu *vcpu);
194extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu, 197extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
@@ -274,32 +277,6 @@ static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
274 return (kvmppc_get_msr(vcpu) & MSR_LE) != (MSR_KERNEL & MSR_LE); 277 return (kvmppc_get_msr(vcpu) & MSR_LE) != (MSR_KERNEL & MSR_LE);
275} 278}
276 279
277static inline u32 kvmppc_get_last_inst_internal(struct kvm_vcpu *vcpu, ulong pc)
278{
279 /* Load the instruction manually if it failed to do so in the
280 * exit path */
281 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED)
282 kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false);
283
284 return kvmppc_need_byteswap(vcpu) ? swab32(vcpu->arch.last_inst) :
285 vcpu->arch.last_inst;
286}
287
288static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
289{
290 return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu));
291}
292
293/*
294 * Like kvmppc_get_last_inst(), but for fetching a sc instruction.
295 * Because the sc instruction sets SRR0 to point to the following
296 * instruction, we have to fetch from pc - 4.
297 */
298static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu)
299{
300 return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu) - 4);
301}
302
303static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu) 280static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
304{ 281{
305 return vcpu->arch.fault_dar; 282 return vcpu->arch.fault_dar;
@@ -310,6 +287,13 @@ static inline bool is_kvmppc_resume_guest(int r)
310 return (r == RESUME_GUEST || r == RESUME_GUEST_NV); 287 return (r == RESUME_GUEST || r == RESUME_GUEST_NV);
311} 288}
312 289
290static inline bool is_kvmppc_hv_enabled(struct kvm *kvm);
291static inline bool kvmppc_supports_magic_page(struct kvm_vcpu *vcpu)
292{
293 /* Only PR KVM supports the magic page */
294 return !is_kvmppc_hv_enabled(vcpu->kvm);
295}
296
313/* Magic register values loaded into r3 and r4 before the 'sc' assembly 297/* Magic register values loaded into r3 and r4 before the 'sc' assembly
314 * instruction for the OSI hypercalls */ 298 * instruction for the OSI hypercalls */
315#define OSI_SC_MAGIC_R3 0x113724FA 299#define OSI_SC_MAGIC_R3 0x113724FA
@@ -322,4 +306,7 @@ static inline bool is_kvmppc_resume_guest(int r)
322/* LPIDs we support with this build -- runtime limit may be lower */ 306/* LPIDs we support with this build -- runtime limit may be lower */
323#define KVMPPC_NR_LPIDS (LPID_RSVD + 1) 307#define KVMPPC_NR_LPIDS (LPID_RSVD + 1)
324 308
309#define SPLIT_HACK_MASK 0xff000000
310#define SPLIT_HACK_OFFS 0xfb000000
311
325#endif /* __ASM_KVM_BOOK3S_H__ */ 312#endif /* __ASM_KVM_BOOK3S_H__ */
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index d645428a65a4..0aa817933e6a 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -59,20 +59,29 @@ extern unsigned long kvm_rma_pages;
59/* These bits are reserved in the guest view of the HPTE */ 59/* These bits are reserved in the guest view of the HPTE */
60#define HPTE_GR_RESERVED HPTE_GR_MODIFIED 60#define HPTE_GR_RESERVED HPTE_GR_MODIFIED
61 61
62static inline long try_lock_hpte(unsigned long *hpte, unsigned long bits) 62static inline long try_lock_hpte(__be64 *hpte, unsigned long bits)
63{ 63{
64 unsigned long tmp, old; 64 unsigned long tmp, old;
65 __be64 be_lockbit, be_bits;
66
67 /*
68 * We load/store in native endian, but the HTAB is in big endian. If
69 * we byte swap all data we apply on the PTE we're implicitly correct
70 * again.
71 */
72 be_lockbit = cpu_to_be64(HPTE_V_HVLOCK);
73 be_bits = cpu_to_be64(bits);
65 74
66 asm volatile(" ldarx %0,0,%2\n" 75 asm volatile(" ldarx %0,0,%2\n"
67 " and. %1,%0,%3\n" 76 " and. %1,%0,%3\n"
68 " bne 2f\n" 77 " bne 2f\n"
69 " ori %0,%0,%4\n" 78 " or %0,%0,%4\n"
70 " stdcx. %0,0,%2\n" 79 " stdcx. %0,0,%2\n"
71 " beq+ 2f\n" 80 " beq+ 2f\n"
72 " mr %1,%3\n" 81 " mr %1,%3\n"
73 "2: isync" 82 "2: isync"
74 : "=&r" (tmp), "=&r" (old) 83 : "=&r" (tmp), "=&r" (old)
75 : "r" (hpte), "r" (bits), "i" (HPTE_V_HVLOCK) 84 : "r" (hpte), "r" (be_bits), "r" (be_lockbit)
76 : "cc", "memory"); 85 : "cc", "memory");
77 return old == 0; 86 return old == 0;
78} 87}
@@ -110,16 +119,12 @@ static inline int __hpte_actual_psize(unsigned int lp, int psize)
110static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, 119static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
111 unsigned long pte_index) 120 unsigned long pte_index)
112{ 121{
113 int b_psize, a_psize; 122 int b_psize = MMU_PAGE_4K, a_psize = MMU_PAGE_4K;
114 unsigned int penc; 123 unsigned int penc;
115 unsigned long rb = 0, va_low, sllp; 124 unsigned long rb = 0, va_low, sllp;
116 unsigned int lp = (r >> LP_SHIFT) & ((1 << LP_BITS) - 1); 125 unsigned int lp = (r >> LP_SHIFT) & ((1 << LP_BITS) - 1);
117 126
118 if (!(v & HPTE_V_LARGE)) { 127 if (v & HPTE_V_LARGE) {
119 /* both base and actual psize is 4k */
120 b_psize = MMU_PAGE_4K;
121 a_psize = MMU_PAGE_4K;
122 } else {
123 for (b_psize = 0; b_psize < MMU_PAGE_COUNT; b_psize++) { 128 for (b_psize = 0; b_psize < MMU_PAGE_COUNT; b_psize++) {
124 129
125 /* valid entries have a shift value */ 130 /* valid entries have a shift value */
@@ -142,6 +147,8 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
142 */ 147 */
143 /* This covers 14..54 bits of va*/ 148 /* This covers 14..54 bits of va*/
144 rb = (v & ~0x7fUL) << 16; /* AVA field */ 149 rb = (v & ~0x7fUL) << 16; /* AVA field */
150
151 rb |= v >> (62 - 8); /* B field */
145 /* 152 /*
146 * AVA in v had cleared lower 23 bits. We need to derive 153 * AVA in v had cleared lower 23 bits. We need to derive
147 * that from pteg index 154 * that from pteg index
@@ -172,10 +179,10 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
172 { 179 {
173 int aval_shift; 180 int aval_shift;
174 /* 181 /*
175 * remaining 7bits of AVA/LP fields 182 * remaining bits of AVA/LP fields
176 * Also contain the rr bits of LP 183 * Also contain the rr bits of LP
177 */ 184 */
178 rb |= (va_low & 0x7f) << 16; 185 rb |= (va_low << mmu_psize_defs[b_psize].shift) & 0x7ff000;
179 /* 186 /*
180 * Now clear not needed LP bits based on actual psize 187 * Now clear not needed LP bits based on actual psize
181 */ 188 */
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index c7aed6105ff9..f7aa5cc395c4 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -69,11 +69,6 @@ static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
69 return false; 69 return false;
70} 70}
71 71
72static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
73{
74 return vcpu->arch.last_inst;
75}
76
77static inline void kvmppc_set_ctr(struct kvm_vcpu *vcpu, ulong val) 72static inline void kvmppc_set_ctr(struct kvm_vcpu *vcpu, ulong val)
78{ 73{
79 vcpu->arch.ctr = val; 74 vcpu->arch.ctr = val;
@@ -108,4 +103,14 @@ static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
108{ 103{
109 return vcpu->arch.fault_dear; 104 return vcpu->arch.fault_dear;
110} 105}
106
107static inline bool kvmppc_supports_magic_page(struct kvm_vcpu *vcpu)
108{
109 /* Magic page is only supported on e500v2 */
110#ifdef CONFIG_KVM_E500V2
111 return true;
112#else
113 return false;
114#endif
115}
111#endif /* __ASM_KVM_BOOKE_H__ */ 116#endif /* __ASM_KVM_BOOKE_H__ */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index bb66d8b8efdf..98d9dd50d063 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -34,6 +34,7 @@
34#include <asm/processor.h> 34#include <asm/processor.h>
35#include <asm/page.h> 35#include <asm/page.h>
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/hvcall.h>
37 38
38#define KVM_MAX_VCPUS NR_CPUS 39#define KVM_MAX_VCPUS NR_CPUS
39#define KVM_MAX_VCORES NR_CPUS 40#define KVM_MAX_VCORES NR_CPUS
@@ -48,7 +49,6 @@
48#define KVM_NR_IRQCHIPS 1 49#define KVM_NR_IRQCHIPS 1
49#define KVM_IRQCHIP_NUM_PINS 256 50#define KVM_IRQCHIP_NUM_PINS 256
50 51
51#if !defined(CONFIG_KVM_440)
52#include <linux/mmu_notifier.h> 52#include <linux/mmu_notifier.h>
53 53
54#define KVM_ARCH_WANT_MMU_NOTIFIER 54#define KVM_ARCH_WANT_MMU_NOTIFIER
@@ -61,8 +61,6 @@ extern int kvm_age_hva(struct kvm *kvm, unsigned long hva);
61extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 61extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
62extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 62extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
63 63
64#endif
65
66#define HPTEG_CACHE_NUM (1 << 15) 64#define HPTEG_CACHE_NUM (1 << 15)
67#define HPTEG_HASH_BITS_PTE 13 65#define HPTEG_HASH_BITS_PTE 13
68#define HPTEG_HASH_BITS_PTE_LONG 12 66#define HPTEG_HASH_BITS_PTE_LONG 12
@@ -96,7 +94,6 @@ struct kvm_vm_stat {
96struct kvm_vcpu_stat { 94struct kvm_vcpu_stat {
97 u32 sum_exits; 95 u32 sum_exits;
98 u32 mmio_exits; 96 u32 mmio_exits;
99 u32 dcr_exits;
100 u32 signal_exits; 97 u32 signal_exits;
101 u32 light_exits; 98 u32 light_exits;
102 /* Account for special types of light exits: */ 99 /* Account for special types of light exits: */
@@ -113,22 +110,21 @@ struct kvm_vcpu_stat {
113 u32 halt_wakeup; 110 u32 halt_wakeup;
114 u32 dbell_exits; 111 u32 dbell_exits;
115 u32 gdbell_exits; 112 u32 gdbell_exits;
113 u32 ld;
114 u32 st;
116#ifdef CONFIG_PPC_BOOK3S 115#ifdef CONFIG_PPC_BOOK3S
117 u32 pf_storage; 116 u32 pf_storage;
118 u32 pf_instruc; 117 u32 pf_instruc;
119 u32 sp_storage; 118 u32 sp_storage;
120 u32 sp_instruc; 119 u32 sp_instruc;
121 u32 queue_intr; 120 u32 queue_intr;
122 u32 ld;
123 u32 ld_slow; 121 u32 ld_slow;
124 u32 st;
125 u32 st_slow; 122 u32 st_slow;
126#endif 123#endif
127}; 124};
128 125
129enum kvm_exit_types { 126enum kvm_exit_types {
130 MMIO_EXITS, 127 MMIO_EXITS,
131 DCR_EXITS,
132 SIGNAL_EXITS, 128 SIGNAL_EXITS,
133 ITLB_REAL_MISS_EXITS, 129 ITLB_REAL_MISS_EXITS,
134 ITLB_VIRT_MISS_EXITS, 130 ITLB_VIRT_MISS_EXITS,
@@ -254,7 +250,6 @@ struct kvm_arch {
254 atomic_t hpte_mod_interest; 250 atomic_t hpte_mod_interest;
255 spinlock_t slot_phys_lock; 251 spinlock_t slot_phys_lock;
256 cpumask_t need_tlb_flush; 252 cpumask_t need_tlb_flush;
257 struct kvmppc_vcore *vcores[KVM_MAX_VCORES];
258 int hpt_cma_alloc; 253 int hpt_cma_alloc;
259#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ 254#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
260#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE 255#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
@@ -263,6 +258,7 @@ struct kvm_arch {
263#ifdef CONFIG_PPC_BOOK3S_64 258#ifdef CONFIG_PPC_BOOK3S_64
264 struct list_head spapr_tce_tables; 259 struct list_head spapr_tce_tables;
265 struct list_head rtas_tokens; 260 struct list_head rtas_tokens;
261 DECLARE_BITMAP(enabled_hcalls, MAX_HCALL_OPCODE/4 + 1);
266#endif 262#endif
267#ifdef CONFIG_KVM_MPIC 263#ifdef CONFIG_KVM_MPIC
268 struct openpic *mpic; 264 struct openpic *mpic;
@@ -271,6 +267,10 @@ struct kvm_arch {
271 struct kvmppc_xics *xics; 267 struct kvmppc_xics *xics;
272#endif 268#endif
273 struct kvmppc_ops *kvm_ops; 269 struct kvmppc_ops *kvm_ops;
270#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
271 /* This array can grow quite large, keep it at the end */
272 struct kvmppc_vcore *vcores[KVM_MAX_VCORES];
273#endif
274}; 274};
275 275
276/* 276/*
@@ -305,6 +305,8 @@ struct kvmppc_vcore {
305 u32 arch_compat; 305 u32 arch_compat;
306 ulong pcr; 306 ulong pcr;
307 ulong dpdes; /* doorbell state (POWER8) */ 307 ulong dpdes; /* doorbell state (POWER8) */
308 void *mpp_buffer; /* Micro Partition Prefetch buffer */
309 bool mpp_buffer_is_valid;
308}; 310};
309 311
310#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff) 312#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff)
@@ -503,8 +505,10 @@ struct kvm_vcpu_arch {
503#ifdef CONFIG_BOOKE 505#ifdef CONFIG_BOOKE
504 u32 decar; 506 u32 decar;
505#endif 507#endif
506 u32 tbl; 508 /* Time base value when we entered the guest */
507 u32 tbu; 509 u64 entry_tb;
510 u64 entry_vtb;
511 u64 entry_ic;
508 u32 tcr; 512 u32 tcr;
509 ulong tsr; /* we need to perform set/clr_bits() which requires ulong */ 513 ulong tsr; /* we need to perform set/clr_bits() which requires ulong */
510 u32 ivor[64]; 514 u32 ivor[64];
@@ -580,6 +584,8 @@ struct kvm_vcpu_arch {
580 u32 mmucfg; 584 u32 mmucfg;
581 u32 eptcfg; 585 u32 eptcfg;
582 u32 epr; 586 u32 epr;
587 u64 sprg9;
588 u32 pwrmgtcr0;
583 u32 crit_save; 589 u32 crit_save;
584 /* guest debug registers*/ 590 /* guest debug registers*/
585 struct debug_reg dbg_reg; 591 struct debug_reg dbg_reg;
@@ -593,8 +599,6 @@ struct kvm_vcpu_arch {
593 u8 io_gpr; /* GPR used as IO source/target */ 599 u8 io_gpr; /* GPR used as IO source/target */
594 u8 mmio_is_bigendian; 600 u8 mmio_is_bigendian;
595 u8 mmio_sign_extend; 601 u8 mmio_sign_extend;
596 u8 dcr_needed;
597 u8 dcr_is_write;
598 u8 osi_needed; 602 u8 osi_needed;
599 u8 osi_enabled; 603 u8 osi_enabled;
600 u8 papr_enabled; 604 u8 papr_enabled;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 9c89cdd067a6..fb86a2299d8a 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -41,12 +41,26 @@
41enum emulation_result { 41enum emulation_result {
42 EMULATE_DONE, /* no further processing */ 42 EMULATE_DONE, /* no further processing */
43 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */ 43 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */
44 EMULATE_DO_DCR, /* kvm_run filled with DCR request */
45 EMULATE_FAIL, /* can't emulate this instruction */ 44 EMULATE_FAIL, /* can't emulate this instruction */
46 EMULATE_AGAIN, /* something went wrong. go again */ 45 EMULATE_AGAIN, /* something went wrong. go again */
47 EMULATE_EXIT_USER, /* emulation requires exit to user-space */ 46 EMULATE_EXIT_USER, /* emulation requires exit to user-space */
48}; 47};
49 48
49enum instruction_type {
50 INST_GENERIC,
51 INST_SC, /* system call */
52};
53
54enum xlate_instdata {
55 XLATE_INST, /* translate instruction address */
56 XLATE_DATA /* translate data address */
57};
58
59enum xlate_readwrite {
60 XLATE_READ, /* check for read permissions */
61 XLATE_WRITE /* check for write permissions */
62};
63
50extern int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 64extern int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
51extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 65extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
52extern void kvmppc_handler_highmem(void); 66extern void kvmppc_handler_highmem(void);
@@ -62,8 +76,16 @@ extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
62 u64 val, unsigned int bytes, 76 u64 val, unsigned int bytes,
63 int is_default_endian); 77 int is_default_endian);
64 78
79extern int kvmppc_load_last_inst(struct kvm_vcpu *vcpu,
80 enum instruction_type type, u32 *inst);
81
82extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
83 bool data);
84extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
85 bool data);
65extern int kvmppc_emulate_instruction(struct kvm_run *run, 86extern int kvmppc_emulate_instruction(struct kvm_run *run,
66 struct kvm_vcpu *vcpu); 87 struct kvm_vcpu *vcpu);
88extern int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu);
67extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); 89extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
68extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu); 90extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
69extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb); 91extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb);
@@ -86,6 +108,9 @@ extern gpa_t kvmppc_mmu_xlate(struct kvm_vcpu *vcpu, unsigned int gtlb_index,
86 gva_t eaddr); 108 gva_t eaddr);
87extern void kvmppc_mmu_dtlb_miss(struct kvm_vcpu *vcpu); 109extern void kvmppc_mmu_dtlb_miss(struct kvm_vcpu *vcpu);
88extern void kvmppc_mmu_itlb_miss(struct kvm_vcpu *vcpu); 110extern void kvmppc_mmu_itlb_miss(struct kvm_vcpu *vcpu);
111extern int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr,
112 enum xlate_instdata xlid, enum xlate_readwrite xlrw,
113 struct kvmppc_pte *pte);
89 114
90extern struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, 115extern struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm,
91 unsigned int id); 116 unsigned int id);
@@ -106,6 +131,14 @@ extern void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu);
106extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu, 131extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
107 struct kvm_interrupt *irq); 132 struct kvm_interrupt *irq);
108extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu); 133extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu);
134extern void kvmppc_core_queue_dtlb_miss(struct kvm_vcpu *vcpu, ulong dear_flags,
135 ulong esr_flags);
136extern void kvmppc_core_queue_data_storage(struct kvm_vcpu *vcpu,
137 ulong dear_flags,
138 ulong esr_flags);
139extern void kvmppc_core_queue_itlb_miss(struct kvm_vcpu *vcpu);
140extern void kvmppc_core_queue_inst_storage(struct kvm_vcpu *vcpu,
141 ulong esr_flags);
109extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu); 142extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu);
110extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu); 143extern int kvmppc_core_check_requests(struct kvm_vcpu *vcpu);
111 144
@@ -228,12 +261,35 @@ struct kvmppc_ops {
228 void (*fast_vcpu_kick)(struct kvm_vcpu *vcpu); 261 void (*fast_vcpu_kick)(struct kvm_vcpu *vcpu);
229 long (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl, 262 long (*arch_vm_ioctl)(struct file *filp, unsigned int ioctl,
230 unsigned long arg); 263 unsigned long arg);
231 264 int (*hcall_implemented)(unsigned long hcall);
232}; 265};
233 266
234extern struct kvmppc_ops *kvmppc_hv_ops; 267extern struct kvmppc_ops *kvmppc_hv_ops;
235extern struct kvmppc_ops *kvmppc_pr_ops; 268extern struct kvmppc_ops *kvmppc_pr_ops;
236 269
270static inline int kvmppc_get_last_inst(struct kvm_vcpu *vcpu,
271 enum instruction_type type, u32 *inst)
272{
273 int ret = EMULATE_DONE;
274 u32 fetched_inst;
275
276 /* Load the instruction manually if it failed to do so in the
277 * exit path */
278 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED)
279 ret = kvmppc_load_last_inst(vcpu, type, &vcpu->arch.last_inst);
280
281 /* Write fetch_failed unswapped if the fetch failed */
282 if (ret == EMULATE_DONE)
283 fetched_inst = kvmppc_need_byteswap(vcpu) ?
284 swab32(vcpu->arch.last_inst) :
285 vcpu->arch.last_inst;
286 else
287 fetched_inst = vcpu->arch.last_inst;
288
289 *inst = fetched_inst;
290 return ret;
291}
292
237static inline bool is_kvmppc_hv_enabled(struct kvm *kvm) 293static inline bool is_kvmppc_hv_enabled(struct kvm *kvm)
238{ 294{
239 return kvm->arch.kvm_ops == kvmppc_hv_ops; 295 return kvm->arch.kvm_ops == kvmppc_hv_ops;
@@ -392,6 +448,17 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
392 { return 0; } 448 { return 0; }
393#endif 449#endif
394 450
451static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
452{
453#ifdef CONFIG_KVM_BOOKE_HV
454 return mfspr(SPRN_GEPR);
455#elif defined(CONFIG_BOOKE)
456 return vcpu->arch.epr;
457#else
458 return 0;
459#endif
460}
461
395static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr) 462static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr)
396{ 463{
397#ifdef CONFIG_KVM_BOOKE_HV 464#ifdef CONFIG_KVM_BOOKE_HV
@@ -472,8 +539,20 @@ static inline bool kvmppc_shared_big_endian(struct kvm_vcpu *vcpu)
472#endif 539#endif
473} 540}
474 541
542#define SPRNG_WRAPPER_GET(reg, bookehv_spr) \
543static inline ulong kvmppc_get_##reg(struct kvm_vcpu *vcpu) \
544{ \
545 return mfspr(bookehv_spr); \
546} \
547
548#define SPRNG_WRAPPER_SET(reg, bookehv_spr) \
549static inline void kvmppc_set_##reg(struct kvm_vcpu *vcpu, ulong val) \
550{ \
551 mtspr(bookehv_spr, val); \
552} \
553
475#define SHARED_WRAPPER_GET(reg, size) \ 554#define SHARED_WRAPPER_GET(reg, size) \
476static inline u##size kvmppc_get_##reg(struct kvm_vcpu *vcpu) \ 555static inline u##size kvmppc_get_##reg(struct kvm_vcpu *vcpu) \
477{ \ 556{ \
478 if (kvmppc_shared_big_endian(vcpu)) \ 557 if (kvmppc_shared_big_endian(vcpu)) \
479 return be##size##_to_cpu(vcpu->arch.shared->reg); \ 558 return be##size##_to_cpu(vcpu->arch.shared->reg); \
@@ -494,14 +573,31 @@ static inline void kvmppc_set_##reg(struct kvm_vcpu *vcpu, u##size val) \
494 SHARED_WRAPPER_GET(reg, size) \ 573 SHARED_WRAPPER_GET(reg, size) \
495 SHARED_WRAPPER_SET(reg, size) \ 574 SHARED_WRAPPER_SET(reg, size) \
496 575
576#define SPRNG_WRAPPER(reg, bookehv_spr) \
577 SPRNG_WRAPPER_GET(reg, bookehv_spr) \
578 SPRNG_WRAPPER_SET(reg, bookehv_spr) \
579
580#ifdef CONFIG_KVM_BOOKE_HV
581
582#define SHARED_SPRNG_WRAPPER(reg, size, bookehv_spr) \
583 SPRNG_WRAPPER(reg, bookehv_spr) \
584
585#else
586
587#define SHARED_SPRNG_WRAPPER(reg, size, bookehv_spr) \
588 SHARED_WRAPPER(reg, size) \
589
590#endif
591
497SHARED_WRAPPER(critical, 64) 592SHARED_WRAPPER(critical, 64)
498SHARED_WRAPPER(sprg0, 64) 593SHARED_SPRNG_WRAPPER(sprg0, 64, SPRN_GSPRG0)
499SHARED_WRAPPER(sprg1, 64) 594SHARED_SPRNG_WRAPPER(sprg1, 64, SPRN_GSPRG1)
500SHARED_WRAPPER(sprg2, 64) 595SHARED_SPRNG_WRAPPER(sprg2, 64, SPRN_GSPRG2)
501SHARED_WRAPPER(sprg3, 64) 596SHARED_SPRNG_WRAPPER(sprg3, 64, SPRN_GSPRG3)
502SHARED_WRAPPER(srr0, 64) 597SHARED_SPRNG_WRAPPER(srr0, 64, SPRN_GSRR0)
503SHARED_WRAPPER(srr1, 64) 598SHARED_SPRNG_WRAPPER(srr1, 64, SPRN_GSRR1)
504SHARED_WRAPPER(dar, 64) 599SHARED_SPRNG_WRAPPER(dar, 64, SPRN_GDEAR)
600SHARED_SPRNG_WRAPPER(esr, 64, SPRN_GESR)
505SHARED_WRAPPER_GET(msr, 64) 601SHARED_WRAPPER_GET(msr, 64)
506static inline void kvmppc_set_msr_fast(struct kvm_vcpu *vcpu, u64 val) 602static inline void kvmppc_set_msr_fast(struct kvm_vcpu *vcpu, u64 val)
507{ 603{
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index f92b0b54e921..b125ceab149c 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -57,10 +57,10 @@ struct machdep_calls {
57 void (*hpte_removebolted)(unsigned long ea, 57 void (*hpte_removebolted)(unsigned long ea,
58 int psize, int ssize); 58 int psize, int ssize);
59 void (*flush_hash_range)(unsigned long number, int local); 59 void (*flush_hash_range)(unsigned long number, int local);
60 void (*hugepage_invalidate)(struct mm_struct *mm, 60 void (*hugepage_invalidate)(unsigned long vsid,
61 unsigned long addr,
61 unsigned char *hpte_slot_array, 62 unsigned char *hpte_slot_array,
62 unsigned long addr, int psize); 63 int psize, int ssize);
63
64 /* special for kexec, to be called in real mode, linear mapping is 64 /* special for kexec, to be called in real mode, linear mapping is
65 * destroyed as well */ 65 * destroyed as well */
66 void (*hpte_clear_all)(void); 66 void (*hpte_clear_all)(void);
@@ -174,6 +174,10 @@ struct machdep_calls {
174 /* Exception handlers */ 174 /* Exception handlers */
175 int (*system_reset_exception)(struct pt_regs *regs); 175 int (*system_reset_exception)(struct pt_regs *regs);
176 int (*machine_check_exception)(struct pt_regs *regs); 176 int (*machine_check_exception)(struct pt_regs *regs);
177 int (*handle_hmi_exception)(struct pt_regs *regs);
178
179 /* Early exception handlers called in realmode */
180 int (*hmi_exception_early)(struct pt_regs *regs);
177 181
178 /* Called during machine check exception to retrive fixup address. */ 182 /* Called during machine check exception to retrive fixup address. */
179 bool (*mce_check_early_recovery)(struct pt_regs *regs); 183 bool (*mce_check_early_recovery)(struct pt_regs *regs);
@@ -366,6 +370,7 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
366 } \ 370 } \
367 __define_initcall(__machine_initcall_##mach##_##fn, id); 371 __define_initcall(__machine_initcall_##mach##_##fn, id);
368 372
373#define machine_early_initcall(mach, fn) __define_machine_initcall(mach, fn, early)
369#define machine_core_initcall(mach, fn) __define_machine_initcall(mach, fn, 1) 374#define machine_core_initcall(mach, fn) __define_machine_initcall(mach, fn, 1)
370#define machine_core_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 1s) 375#define machine_core_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 1s)
371#define machine_postcore_initcall(mach, fn) __define_machine_initcall(mach, fn, 2) 376#define machine_postcore_initcall(mach, fn) __define_machine_initcall(mach, fn, 2)
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index d0918e09557f..cd4f04a74802 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -40,7 +40,11 @@
40 40
41/* MAS registers bit definitions */ 41/* MAS registers bit definitions */
42 42
43#define MAS0_TLBSEL(x) (((x) << 28) & 0x30000000) 43#define MAS0_TLBSEL_MASK 0x30000000
44#define MAS0_TLBSEL_SHIFT 28
45#define MAS0_TLBSEL(x) (((x) << MAS0_TLBSEL_SHIFT) & MAS0_TLBSEL_MASK)
46#define MAS0_GET_TLBSEL(mas0) (((mas0) & MAS0_TLBSEL_MASK) >> \
47 MAS0_TLBSEL_SHIFT)
44#define MAS0_ESEL_MASK 0x0FFF0000 48#define MAS0_ESEL_MASK 0x0FFF0000
45#define MAS0_ESEL_SHIFT 16 49#define MAS0_ESEL_SHIFT 16
46#define MAS0_ESEL(x) (((x) << MAS0_ESEL_SHIFT) & MAS0_ESEL_MASK) 50#define MAS0_ESEL(x) (((x) << MAS0_ESEL_SHIFT) & MAS0_ESEL_MASK)
@@ -58,6 +62,7 @@
58#define MAS1_TSIZE_MASK 0x00000f80 62#define MAS1_TSIZE_MASK 0x00000f80
59#define MAS1_TSIZE_SHIFT 7 63#define MAS1_TSIZE_SHIFT 7
60#define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK) 64#define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK)
65#define MAS1_GET_TSIZE(mas1) (((mas1) & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT)
61 66
62#define MAS2_EPN (~0xFFFUL) 67#define MAS2_EPN (~0xFFFUL)
63#define MAS2_X0 0x00000040 68#define MAS2_X0 0x00000040
@@ -86,6 +91,7 @@
86#define MAS3_SPSIZE 0x0000003e 91#define MAS3_SPSIZE 0x0000003e
87#define MAS3_SPSIZE_SHIFT 1 92#define MAS3_SPSIZE_SHIFT 1
88 93
94#define MAS4_TLBSEL_MASK MAS0_TLBSEL_MASK
89#define MAS4_TLBSELD(x) MAS0_TLBSEL(x) 95#define MAS4_TLBSELD(x) MAS0_TLBSEL(x)
90#define MAS4_INDD 0x00008000 /* Default IND */ 96#define MAS4_INDD 0x00008000 /* Default IND */
91#define MAS4_TSIZED(x) MAS1_TSIZE(x) 97#define MAS4_TSIZED(x) MAS1_TSIZE(x)
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index c2b4dcf23d03..d76514487d6f 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -25,26 +25,6 @@
25#include <asm/processor.h> 25#include <asm/processor.h>
26 26
27/* 27/*
28 * Segment table
29 */
30
31#define STE_ESID_V 0x80
32#define STE_ESID_KS 0x20
33#define STE_ESID_KP 0x10
34#define STE_ESID_N 0x08
35
36#define STE_VSID_SHIFT 12
37
38/* Location of cpu0's segment table */
39#define STAB0_PAGE 0x8
40#define STAB0_OFFSET (STAB0_PAGE << 12)
41#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
42
43#ifndef __ASSEMBLY__
44extern char initial_stab[];
45#endif /* ! __ASSEMBLY */
46
47/*
48 * SLB 28 * SLB
49 */ 29 */
50 30
@@ -370,10 +350,8 @@ extern void hpte_init_lpar(void);
370extern void hpte_init_beat(void); 350extern void hpte_init_beat(void);
371extern void hpte_init_beat_v3(void); 351extern void hpte_init_beat_v3(void);
372 352
373extern void stabs_alloc(void);
374extern void slb_initialize(void); 353extern void slb_initialize(void);
375extern void slb_flush_and_rebolt(void); 354extern void slb_flush_and_rebolt(void);
376extern void stab_initialize(unsigned long stab);
377 355
378extern void slb_vmalloc_update(void); 356extern void slb_vmalloc_update(void);
379extern void slb_set_size(u16 size); 357extern void slb_set_size(u16 size);
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index e61f24ed4e65..3d5abfe6ba67 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -64,9 +64,9 @@
64 */ 64 */
65#define MMU_FTR_USE_PAIRED_MAS ASM_CONST(0x01000000) 65#define MMU_FTR_USE_PAIRED_MAS ASM_CONST(0x01000000)
66 66
67/* MMU is SLB-based 67/* Doesn't support the B bit (1T segment) in SLBIE
68 */ 68 */
69#define MMU_FTR_SLB ASM_CONST(0x02000000) 69#define MMU_FTR_NO_SLBIE_B ASM_CONST(0x02000000)
70 70
71/* Support 16M large pages 71/* Support 16M large pages
72 */ 72 */
@@ -88,10 +88,6 @@
88 */ 88 */
89#define MMU_FTR_1T_SEGMENT ASM_CONST(0x40000000) 89#define MMU_FTR_1T_SEGMENT ASM_CONST(0x40000000)
90 90
91/* Doesn't support the B bit (1T segment) in SLBIE
92 */
93#define MMU_FTR_NO_SLBIE_B ASM_CONST(0x80000000)
94
95/* MMU feature bit sets for various CPUs */ 91/* MMU feature bit sets for various CPUs */
96#define MMU_FTRS_DEFAULT_HPTE_ARCH_V2 \ 92#define MMU_FTRS_DEFAULT_HPTE_ARCH_V2 \
97 MMU_FTR_HPTE_TABLE | MMU_FTR_PPCAS_ARCH_V2 93 MMU_FTR_HPTE_TABLE | MMU_FTR_PPCAS_ARCH_V2
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index b467530e2485..73382eba02dc 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -18,7 +18,6 @@ extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
18extern void destroy_context(struct mm_struct *mm); 18extern void destroy_context(struct mm_struct *mm);
19 19
20extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next); 20extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next);
21extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
22extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); 21extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
23extern void set_context(unsigned long id, pgd_t *pgd); 22extern void set_context(unsigned long id, pgd_t *pgd);
24 23
@@ -77,10 +76,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
77 * sub architectures. 76 * sub architectures.
78 */ 77 */
79#ifdef CONFIG_PPC_STD_MMU_64 78#ifdef CONFIG_PPC_STD_MMU_64
80 if (mmu_has_feature(MMU_FTR_SLB)) 79 switch_slb(tsk, next);
81 switch_slb(tsk, next);
82 else
83 switch_stab(tsk, next);
84#else 80#else
85 /* Out of line for now */ 81 /* Out of line for now */
86 switch_mmu_context(prev, next); 82 switch_mmu_context(prev, next);
diff --git a/arch/powerpc/include/asm/mpc85xx.h b/arch/powerpc/include/asm/mpc85xx.h
index 736d4acc05a8..3bef74a9914b 100644
--- a/arch/powerpc/include/asm/mpc85xx.h
+++ b/arch/powerpc/include/asm/mpc85xx.h
@@ -77,6 +77,8 @@
77#define SVR_T1020 0x852100 77#define SVR_T1020 0x852100
78#define SVR_T1021 0x852101 78#define SVR_T1021 0x852101
79#define SVR_T1022 0x852102 79#define SVR_T1022 0x852102
80#define SVR_T2080 0x853000
81#define SVR_T2081 0x853100
80 82
81#define SVR_8610 0x80A000 83#define SVR_8610 0x80A000
82#define SVR_8641 0x809000 84#define SVR_8641 0x809000
diff --git a/arch/powerpc/include/asm/mpc8xx.h b/arch/powerpc/include/asm/mpc8xx.h
deleted file mode 100644
index 98f3c4f17328..000000000000
--- a/arch/powerpc/include/asm/mpc8xx.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* This is the single file included by all MPC8xx build options.
2 * Since there are many different boards and no standard configuration,
3 * we have a unique include file for each. Rather than change every
4 * file that has to include MPC8xx configuration, they all include
5 * this one and the configuration switching is done here.
6 */
7#ifndef __CONFIG_8xx_DEFS
8#define __CONFIG_8xx_DEFS
9
10extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
11
12#endif /* __CONFIG_8xx_DEFS */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 0da1dbd42e02..86055e598269 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -147,6 +147,10 @@ struct opal_sg_list {
147#define OPAL_SET_PARAM 90 147#define OPAL_SET_PARAM 90
148#define OPAL_DUMP_RESEND 91 148#define OPAL_DUMP_RESEND 91
149#define OPAL_DUMP_INFO2 94 149#define OPAL_DUMP_INFO2 94
150#define OPAL_PCI_EEH_FREEZE_SET 97
151#define OPAL_HANDLE_HMI 98
152#define OPAL_REGISTER_DUMP_REGION 101
153#define OPAL_UNREGISTER_DUMP_REGION 102
150 154
151#ifndef __ASSEMBLY__ 155#ifndef __ASSEMBLY__
152 156
@@ -170,7 +174,11 @@ enum OpalFreezeState {
170enum OpalEehFreezeActionToken { 174enum OpalEehFreezeActionToken {
171 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1, 175 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1,
172 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2, 176 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2,
173 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3 177 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3,
178
179 OPAL_EEH_ACTION_SET_FREEZE_MMIO = 1,
180 OPAL_EEH_ACTION_SET_FREEZE_DMA = 2,
181 OPAL_EEH_ACTION_SET_FREEZE_ALL = 3
174}; 182};
175 183
176enum OpalPciStatusToken { 184enum OpalPciStatusToken {
@@ -240,6 +248,7 @@ enum OpalMessageType {
240 OPAL_MSG_MEM_ERR, 248 OPAL_MSG_MEM_ERR,
241 OPAL_MSG_EPOW, 249 OPAL_MSG_EPOW,
242 OPAL_MSG_SHUTDOWN, 250 OPAL_MSG_SHUTDOWN,
251 OPAL_MSG_HMI_EVT,
243 OPAL_MSG_TYPE_MAX, 252 OPAL_MSG_TYPE_MAX,
244}; 253};
245 254
@@ -340,6 +349,12 @@ enum OpalMveEnableAction {
340 OPAL_ENABLE_MVE = 1 349 OPAL_ENABLE_MVE = 1
341}; 350};
342 351
352enum OpalM64EnableAction {
353 OPAL_DISABLE_M64 = 0,
354 OPAL_ENABLE_M64_SPLIT = 1,
355 OPAL_ENABLE_M64_NON_SPLIT = 2
356};
357
343enum OpalPciResetScope { 358enum OpalPciResetScope {
344 OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3, 359 OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3,
345 OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5, 360 OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5,
@@ -502,6 +517,50 @@ struct OpalMemoryErrorData {
502 } u; 517 } u;
503}; 518};
504 519
520/* HMI interrupt event */
521enum OpalHMI_Version {
522 OpalHMIEvt_V1 = 1,
523};
524
525enum OpalHMI_Severity {
526 OpalHMI_SEV_NO_ERROR = 0,
527 OpalHMI_SEV_WARNING = 1,
528 OpalHMI_SEV_ERROR_SYNC = 2,
529 OpalHMI_SEV_FATAL = 3,
530};
531
532enum OpalHMI_Disposition {
533 OpalHMI_DISPOSITION_RECOVERED = 0,
534 OpalHMI_DISPOSITION_NOT_RECOVERED = 1,
535};
536
537enum OpalHMI_ErrType {
538 OpalHMI_ERROR_MALFUNC_ALERT = 0,
539 OpalHMI_ERROR_PROC_RECOV_DONE,
540 OpalHMI_ERROR_PROC_RECOV_DONE_AGAIN,
541 OpalHMI_ERROR_PROC_RECOV_MASKED,
542 OpalHMI_ERROR_TFAC,
543 OpalHMI_ERROR_TFMR_PARITY,
544 OpalHMI_ERROR_HA_OVERFLOW_WARN,
545 OpalHMI_ERROR_XSCOM_FAIL,
546 OpalHMI_ERROR_XSCOM_DONE,
547 OpalHMI_ERROR_SCOM_FIR,
548 OpalHMI_ERROR_DEBUG_TRIG_FIR,
549 OpalHMI_ERROR_HYP_RESOURCE,
550};
551
552struct OpalHMIEvent {
553 uint8_t version; /* 0x00 */
554 uint8_t severity; /* 0x01 */
555 uint8_t type; /* 0x02 */
556 uint8_t disposition; /* 0x03 */
557 uint8_t reserved_1[4]; /* 0x04 */
558
559 __be64 hmer;
560 /* TFMR register. Valid only for TFAC and TFMR_PARITY error type. */
561 __be64 tfmr;
562};
563
505enum { 564enum {
506 OPAL_P7IOC_DIAG_TYPE_NONE = 0, 565 OPAL_P7IOC_DIAG_TYPE_NONE = 0,
507 OPAL_P7IOC_DIAG_TYPE_RGC = 1, 566 OPAL_P7IOC_DIAG_TYPE_RGC = 1,
@@ -513,40 +572,40 @@ enum {
513}; 572};
514 573
515struct OpalIoP7IOCErrorData { 574struct OpalIoP7IOCErrorData {
516 uint16_t type; 575 __be16 type;
517 576
518 /* GEM */ 577 /* GEM */
519 uint64_t gemXfir; 578 __be64 gemXfir;
520 uint64_t gemRfir; 579 __be64 gemRfir;
521 uint64_t gemRirqfir; 580 __be64 gemRirqfir;
522 uint64_t gemMask; 581 __be64 gemMask;
523 uint64_t gemRwof; 582 __be64 gemRwof;
524 583
525 /* LEM */ 584 /* LEM */
526 uint64_t lemFir; 585 __be64 lemFir;
527 uint64_t lemErrMask; 586 __be64 lemErrMask;
528 uint64_t lemAction0; 587 __be64 lemAction0;
529 uint64_t lemAction1; 588 __be64 lemAction1;
530 uint64_t lemWof; 589 __be64 lemWof;
531 590
532 union { 591 union {
533 struct OpalIoP7IOCRgcErrorData { 592 struct OpalIoP7IOCRgcErrorData {
534 uint64_t rgcStatus; /* 3E1C10 */ 593 __be64 rgcStatus; /* 3E1C10 */
535 uint64_t rgcLdcp; /* 3E1C18 */ 594 __be64 rgcLdcp; /* 3E1C18 */
536 }rgc; 595 }rgc;
537 struct OpalIoP7IOCBiErrorData { 596 struct OpalIoP7IOCBiErrorData {
538 uint64_t biLdcp0; /* 3C0100, 3C0118 */ 597 __be64 biLdcp0; /* 3C0100, 3C0118 */
539 uint64_t biLdcp1; /* 3C0108, 3C0120 */ 598 __be64 biLdcp1; /* 3C0108, 3C0120 */
540 uint64_t biLdcp2; /* 3C0110, 3C0128 */ 599 __be64 biLdcp2; /* 3C0110, 3C0128 */
541 uint64_t biFenceStatus; /* 3C0130, 3C0130 */ 600 __be64 biFenceStatus; /* 3C0130, 3C0130 */
542 601
543 uint8_t biDownbound; /* BI Downbound or Upbound */ 602 u8 biDownbound; /* BI Downbound or Upbound */
544 }bi; 603 }bi;
545 struct OpalIoP7IOCCiErrorData { 604 struct OpalIoP7IOCCiErrorData {
546 uint64_t ciPortStatus; /* 3Dn008 */ 605 __be64 ciPortStatus; /* 3Dn008 */
547 uint64_t ciPortLdcp; /* 3Dn010 */ 606 __be64 ciPortLdcp; /* 3Dn010 */
548 607
549 uint8_t ciPort; /* Index of CI port: 0/1 */ 608 u8 ciPort; /* Index of CI port: 0/1 */
550 }ci; 609 }ci;
551 }; 610 };
552}; 611};
@@ -578,60 +637,60 @@ struct OpalIoPhbErrorCommon {
578struct OpalIoP7IOCPhbErrorData { 637struct OpalIoP7IOCPhbErrorData {
579 struct OpalIoPhbErrorCommon common; 638 struct OpalIoPhbErrorCommon common;
580 639
581 uint32_t brdgCtl; 640 __be32 brdgCtl;
582 641
583 // P7IOC utl regs 642 // P7IOC utl regs
584 uint32_t portStatusReg; 643 __be32 portStatusReg;
585 uint32_t rootCmplxStatus; 644 __be32 rootCmplxStatus;
586 uint32_t busAgentStatus; 645 __be32 busAgentStatus;
587 646
588 // P7IOC cfg regs 647 // P7IOC cfg regs
589 uint32_t deviceStatus; 648 __be32 deviceStatus;
590 uint32_t slotStatus; 649 __be32 slotStatus;
591 uint32_t linkStatus; 650 __be32 linkStatus;
592 uint32_t devCmdStatus; 651 __be32 devCmdStatus;
593 uint32_t devSecStatus; 652 __be32 devSecStatus;
594 653
595 // cfg AER regs 654 // cfg AER regs
596 uint32_t rootErrorStatus; 655 __be32 rootErrorStatus;
597 uint32_t uncorrErrorStatus; 656 __be32 uncorrErrorStatus;
598 uint32_t corrErrorStatus; 657 __be32 corrErrorStatus;
599 uint32_t tlpHdr1; 658 __be32 tlpHdr1;
600 uint32_t tlpHdr2; 659 __be32 tlpHdr2;
601 uint32_t tlpHdr3; 660 __be32 tlpHdr3;
602 uint32_t tlpHdr4; 661 __be32 tlpHdr4;
603 uint32_t sourceId; 662 __be32 sourceId;
604 663
605 uint32_t rsv3; 664 __be32 rsv3;
606 665
607 // Record data about the call to allocate a buffer. 666 // Record data about the call to allocate a buffer.
608 uint64_t errorClass; 667 __be64 errorClass;
609 uint64_t correlator; 668 __be64 correlator;
610 669
611 //P7IOC MMIO Error Regs 670 //P7IOC MMIO Error Regs
612 uint64_t p7iocPlssr; // n120 671 __be64 p7iocPlssr; // n120
613 uint64_t p7iocCsr; // n110 672 __be64 p7iocCsr; // n110
614 uint64_t lemFir; // nC00 673 __be64 lemFir; // nC00
615 uint64_t lemErrorMask; // nC18 674 __be64 lemErrorMask; // nC18
616 uint64_t lemWOF; // nC40 675 __be64 lemWOF; // nC40
617 uint64_t phbErrorStatus; // nC80 676 __be64 phbErrorStatus; // nC80
618 uint64_t phbFirstErrorStatus; // nC88 677 __be64 phbFirstErrorStatus; // nC88
619 uint64_t phbErrorLog0; // nCC0 678 __be64 phbErrorLog0; // nCC0
620 uint64_t phbErrorLog1; // nCC8 679 __be64 phbErrorLog1; // nCC8
621 uint64_t mmioErrorStatus; // nD00 680 __be64 mmioErrorStatus; // nD00
622 uint64_t mmioFirstErrorStatus; // nD08 681 __be64 mmioFirstErrorStatus; // nD08
623 uint64_t mmioErrorLog0; // nD40 682 __be64 mmioErrorLog0; // nD40
624 uint64_t mmioErrorLog1; // nD48 683 __be64 mmioErrorLog1; // nD48
625 uint64_t dma0ErrorStatus; // nD80 684 __be64 dma0ErrorStatus; // nD80
626 uint64_t dma0FirstErrorStatus; // nD88 685 __be64 dma0FirstErrorStatus; // nD88
627 uint64_t dma0ErrorLog0; // nDC0 686 __be64 dma0ErrorLog0; // nDC0
628 uint64_t dma0ErrorLog1; // nDC8 687 __be64 dma0ErrorLog1; // nDC8
629 uint64_t dma1ErrorStatus; // nE00 688 __be64 dma1ErrorStatus; // nE00
630 uint64_t dma1FirstErrorStatus; // nE08 689 __be64 dma1FirstErrorStatus; // nE08
631 uint64_t dma1ErrorLog0; // nE40 690 __be64 dma1ErrorLog0; // nE40
632 uint64_t dma1ErrorLog1; // nE48 691 __be64 dma1ErrorLog1; // nE48
633 uint64_t pestA[OPAL_P7IOC_NUM_PEST_REGS]; 692 __be64 pestA[OPAL_P7IOC_NUM_PEST_REGS];
634 uint64_t pestB[OPAL_P7IOC_NUM_PEST_REGS]; 693 __be64 pestB[OPAL_P7IOC_NUM_PEST_REGS];
635}; 694};
636 695
637struct OpalIoPhb3ErrorData { 696struct OpalIoPhb3ErrorData {
@@ -758,6 +817,8 @@ int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number,
758 __be64 *phb_status); 817 __be64 *phb_status);
759int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number, 818int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number,
760 uint64_t eeh_action_token); 819 uint64_t eeh_action_token);
820int64_t opal_pci_eeh_freeze_set(uint64_t phb_id, uint64_t pe_number,
821 uint64_t eeh_action_token);
761int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state); 822int64_t opal_pci_shpc(uint64_t phb_id, uint64_t shpc_action, uint8_t *state);
762 823
763 824
@@ -768,7 +829,7 @@ int64_t opal_pci_set_phb_mem_window(uint64_t phb_id, uint16_t window_type,
768 uint16_t window_num, 829 uint16_t window_num,
769 uint64_t starting_real_address, 830 uint64_t starting_real_address,
770 uint64_t starting_pci_address, 831 uint64_t starting_pci_address,
771 uint16_t segment_size); 832 uint64_t size);
772int64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number, 833int64_t opal_pci_map_pe_mmio_window(uint64_t phb_id, uint16_t pe_number,
773 uint16_t window_type, uint16_t window_num, 834 uint16_t window_type, uint16_t window_num,
774 uint16_t segment_num); 835 uint16_t segment_num);
@@ -860,6 +921,9 @@ int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
860int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer, 921int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
861 uint64_t length); 922 uint64_t length);
862int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data); 923int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data);
924int64_t opal_handle_hmi(void);
925int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
926int64_t opal_unregister_dump_region(uint32_t id);
863 927
864/* Internal functions */ 928/* Internal functions */
865extern int early_init_dt_scan_opal(unsigned long node, const char *uname, 929extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
@@ -902,6 +966,8 @@ extern void opal_msglog_init(void);
902 966
903extern int opal_machine_check(struct pt_regs *regs); 967extern int opal_machine_check(struct pt_regs *regs);
904extern bool opal_mce_check_early_recovery(struct pt_regs *regs); 968extern bool opal_mce_check_early_recovery(struct pt_regs *regs);
969extern int opal_hmi_exception_early(struct pt_regs *regs);
970extern int opal_handle_hmi_exception(struct pt_regs *regs);
905 971
906extern void opal_shutdown(void); 972extern void opal_shutdown(void);
907extern int opal_resync_timebase(void); 973extern int opal_resync_timebase(void);
@@ -912,6 +978,13 @@ struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
912 unsigned long vmalloc_size); 978 unsigned long vmalloc_size);
913void opal_free_sg_list(struct opal_sg_list *sg); 979void opal_free_sg_list(struct opal_sg_list *sg);
914 980
981/*
982 * Dump region ID range usable by the OS
983 */
984#define OPAL_DUMP_REGION_HOST_START 0x80
985#define OPAL_DUMP_REGION_LOG_BUF 0x80
986#define OPAL_DUMP_REGION_HOST_END 0xFF
987
915#endif /* __ASSEMBLY__ */ 988#endif /* __ASSEMBLY__ */
916 989
917#endif /* __OPAL_H */ 990#endif /* __OPAL_H */
diff --git a/arch/powerpc/include/asm/oprofile_impl.h b/arch/powerpc/include/asm/oprofile_impl.h
index d697b08994c9..61fe5d6f18e1 100644
--- a/arch/powerpc/include/asm/oprofile_impl.h
+++ b/arch/powerpc/include/asm/oprofile_impl.h
@@ -61,7 +61,6 @@ struct op_powerpc_model {
61}; 61};
62 62
63extern struct op_powerpc_model op_model_fsl_emb; 63extern struct op_powerpc_model op_model_fsl_emb;
64extern struct op_powerpc_model op_model_rs64;
65extern struct op_powerpc_model op_model_power4; 64extern struct op_powerpc_model op_model_power4;
66extern struct op_powerpc_model op_model_7450; 65extern struct op_powerpc_model op_model_7450;
67extern struct op_powerpc_model op_model_cell; 66extern struct op_powerpc_model op_model_cell;
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index bb0bd25f20d0..a5139ea6910b 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -78,10 +78,6 @@ struct paca_struct {
78 u64 kernel_toc; /* Kernel TOC address */ 78 u64 kernel_toc; /* Kernel TOC address */
79 u64 kernelbase; /* Base address of kernel */ 79 u64 kernelbase; /* Base address of kernel */
80 u64 kernel_msr; /* MSR while running in kernel */ 80 u64 kernel_msr; /* MSR while running in kernel */
81#ifdef CONFIG_PPC_STD_MMU_64
82 u64 stab_real; /* Absolute address of segment table */
83 u64 stab_addr; /* Virtual address of segment table */
84#endif /* CONFIG_PPC_STD_MMU_64 */
85 void *emergency_sp; /* pointer to emergency stack */ 81 void *emergency_sp; /* pointer to emergency stack */
86 u64 data_offset; /* per cpu data offset */ 82 u64 data_offset; /* per cpu data offset */
87 s16 hw_cpu_id; /* Physical processor number */ 83 s16 hw_cpu_id; /* Physical processor number */
@@ -171,6 +167,7 @@ struct paca_struct {
171 * and already using emergency stack. 167 * and already using emergency stack.
172 */ 168 */
173 u16 in_mce; 169 u16 in_mce;
170 u8 hmi_event_available; /* HMI event is available */
174#endif 171#endif
175 172
176 /* Stuff for accurate time accounting */ 173 /* Stuff for accurate time accounting */
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 32e4e212b9c1..26fe1ae15212 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -48,9 +48,6 @@ extern unsigned int HPAGE_SHIFT;
48#define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1) 48#define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1)
49#endif 49#endif
50 50
51/* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
52#define __HAVE_ARCH_GATE_AREA 1
53
54/* 51/*
55 * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we 52 * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
56 * assign PAGE_MASK to a larger type it gets extended the way we want 53 * assign PAGE_MASK to a larger type it gets extended the way we want
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index b3e936027b26..814622146d5a 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -19,6 +19,8 @@
19#define MAX_EVENT_ALTERNATIVES 8 19#define MAX_EVENT_ALTERNATIVES 8
20#define MAX_LIMITED_HWCOUNTERS 2 20#define MAX_LIMITED_HWCOUNTERS 2
21 21
22struct perf_event;
23
22/* 24/*
23 * This struct provides the constants and functions needed to 25 * This struct provides the constants and functions needed to
24 * describe the PMU on a particular POWER-family CPU. 26 * describe the PMU on a particular POWER-family CPU.
@@ -30,7 +32,8 @@ struct power_pmu {
30 unsigned long add_fields; 32 unsigned long add_fields;
31 unsigned long test_adder; 33 unsigned long test_adder;
32 int (*compute_mmcr)(u64 events[], int n_ev, 34 int (*compute_mmcr)(u64 events[], int n_ev,
33 unsigned int hwc[], unsigned long mmcr[]); 35 unsigned int hwc[], unsigned long mmcr[],
36 struct perf_event *pevents[]);
34 int (*get_constraint)(u64 event_id, unsigned long *mskp, 37 int (*get_constraint)(u64 event_id, unsigned long *mskp,
35 unsigned long *valp); 38 unsigned long *valp);
36 int (*get_alternatives)(u64 event_id, unsigned int flags, 39 int (*get_alternatives)(u64 event_id, unsigned int flags,
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index eb9261024f51..7b3d54fae46f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -413,7 +413,7 @@ static inline char *get_hpte_slot_array(pmd_t *pmdp)
413} 413}
414 414
415extern void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, 415extern void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
416 pmd_t *pmdp); 416 pmd_t *pmdp, unsigned long old_pmd);
417#ifdef CONFIG_TRANSPARENT_HUGEPAGE 417#ifdef CONFIG_TRANSPARENT_HUGEPAGE
418extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot); 418extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot);
419extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot); 419extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot);
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 3132bb9365f3..6f8536208049 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -139,6 +139,7 @@
139#define PPC_INST_ISEL 0x7c00001e 139#define PPC_INST_ISEL 0x7c00001e
140#define PPC_INST_ISEL_MASK 0xfc00003e 140#define PPC_INST_ISEL_MASK 0xfc00003e
141#define PPC_INST_LDARX 0x7c0000a8 141#define PPC_INST_LDARX 0x7c0000a8
142#define PPC_INST_LOGMPP 0x7c0007e4
142#define PPC_INST_LSWI 0x7c0004aa 143#define PPC_INST_LSWI 0x7c0004aa
143#define PPC_INST_LSWX 0x7c00042a 144#define PPC_INST_LSWX 0x7c00042a
144#define PPC_INST_LWARX 0x7c000028 145#define PPC_INST_LWARX 0x7c000028
@@ -150,8 +151,10 @@
150#define PPC_INST_MCRXR_MASK 0xfc0007fe 151#define PPC_INST_MCRXR_MASK 0xfc0007fe
151#define PPC_INST_MFSPR_PVR 0x7c1f42a6 152#define PPC_INST_MFSPR_PVR 0x7c1f42a6
152#define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff 153#define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff
154#define PPC_INST_MFTMR 0x7c0002dc
153#define PPC_INST_MSGSND 0x7c00019c 155#define PPC_INST_MSGSND 0x7c00019c
154#define PPC_INST_MSGSNDP 0x7c00011c 156#define PPC_INST_MSGSNDP 0x7c00011c
157#define PPC_INST_MTTMR 0x7c0003dc
155#define PPC_INST_NOP 0x60000000 158#define PPC_INST_NOP 0x60000000
156#define PPC_INST_POPCNTB 0x7c0000f4 159#define PPC_INST_POPCNTB 0x7c0000f4
157#define PPC_INST_POPCNTB_MASK 0xfc0007fe 160#define PPC_INST_POPCNTB_MASK 0xfc0007fe
@@ -275,6 +278,20 @@
275#define __PPC_EH(eh) 0 278#define __PPC_EH(eh) 0
276#endif 279#endif
277 280
281/* POWER8 Micro Partition Prefetch (MPP) parameters */
282/* Address mask is common for LOGMPP instruction and MPPR SPR */
283#define PPC_MPPE_ADDRESS_MASK 0xffffffffc000
284
285/* Bits 60 and 61 of MPP SPR should be set to one of the following */
286/* Aborting the fetch is indeed setting 00 in the table size bits */
287#define PPC_MPPR_FETCH_ABORT (0x0ULL << 60)
288#define PPC_MPPR_FETCH_WHOLE_TABLE (0x2ULL << 60)
289
290/* Bits 54 and 55 of register for LOGMPP instruction should be set to: */
291#define PPC_LOGMPP_LOG_L2 (0x02ULL << 54)
292#define PPC_LOGMPP_LOG_L2L3 (0x01ULL << 54)
293#define PPC_LOGMPP_LOG_ABORT (0x03ULL << 54)
294
278/* Deal with instructions that older assemblers aren't aware of */ 295/* Deal with instructions that older assemblers aren't aware of */
279#define PPC_DCBAL(a, b) stringify_in_c(.long PPC_INST_DCBAL | \ 296#define PPC_DCBAL(a, b) stringify_in_c(.long PPC_INST_DCBAL | \
280 __PPC_RA(a) | __PPC_RB(b)) 297 __PPC_RA(a) | __PPC_RB(b))
@@ -283,6 +300,8 @@
283#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \ 300#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \
284 ___PPC_RT(t) | ___PPC_RA(a) | \ 301 ___PPC_RT(t) | ___PPC_RA(a) | \
285 ___PPC_RB(b) | __PPC_EH(eh)) 302 ___PPC_RB(b) | __PPC_EH(eh))
303#define PPC_LOGMPP(b) stringify_in_c(.long PPC_INST_LOGMPP | \
304 __PPC_RB(b))
286#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \ 305#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \
287 ___PPC_RT(t) | ___PPC_RA(a) | \ 306 ___PPC_RT(t) | ___PPC_RA(a) | \
288 ___PPC_RB(b) | __PPC_EH(eh)) 307 ___PPC_RB(b) | __PPC_EH(eh))
@@ -369,4 +388,11 @@
369#define TABORT(r) stringify_in_c(.long PPC_INST_TABORT \ 388#define TABORT(r) stringify_in_c(.long PPC_INST_TABORT \
370 | __PPC_RA(r)) 389 | __PPC_RA(r))
371 390
391/* book3e thread control instructions */
392#define TMRN(x) ((((x) & 0x1f) << 16) | (((x) & 0x3e0) << 6))
393#define MTTMR(tmr, r) stringify_in_c(.long PPC_INST_MTTMR | \
394 TMRN(tmr) | ___PPC_RS(r))
395#define MFTMR(tmr, r) stringify_in_c(.long PPC_INST_MFTMR | \
396 TMRN(tmr) | ___PPC_RT(r))
397
372#endif /* _ASM_POWERPC_PPC_OPCODE_H */ 398#endif /* _ASM_POWERPC_PPC_OPCODE_H */
diff --git a/arch/powerpc/include/asm/pte-fsl-booke.h b/arch/powerpc/include/asm/pte-fsl-booke.h
index 2c12be5f677a..e84dd7ed505e 100644
--- a/arch/powerpc/include/asm/pte-fsl-booke.h
+++ b/arch/powerpc/include/asm/pte-fsl-booke.h
@@ -37,5 +37,7 @@
37#define _PMD_PRESENT_MASK (PAGE_MASK) 37#define _PMD_PRESENT_MASK (PAGE_MASK)
38#define _PMD_BAD (~PAGE_MASK) 38#define _PMD_BAD (~PAGE_MASK)
39 39
40#define PTE_WIMGE_SHIFT (6)
41
40#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
41#endif /* _ASM_POWERPC_PTE_FSL_BOOKE_H */ 43#endif /* _ASM_POWERPC_PTE_FSL_BOOKE_H */
diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h
index d836d945068d..4f4ec2ab45c9 100644
--- a/arch/powerpc/include/asm/pte-hash64-64k.h
+++ b/arch/powerpc/include/asm/pte-hash64-64k.h
@@ -46,11 +46,31 @@
46 * in order to deal with 64K made of 4K HW pages. Thus we override the 46 * in order to deal with 64K made of 4K HW pages. Thus we override the
47 * generic accessors and iterators here 47 * generic accessors and iterators here
48 */ 48 */
49#define __real_pte(e,p) ((real_pte_t) { \ 49#define __real_pte __real_pte
50 (e), (pte_val(e) & _PAGE_COMBO) ? \ 50static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep)
51 (pte_val(*((p) + PTRS_PER_PTE))) : 0 }) 51{
52#define __rpte_to_hidx(r,index) ((pte_val((r).pte) & _PAGE_COMBO) ? \ 52 real_pte_t rpte;
53 (((r).hidx >> ((index)<<2)) & 0xf) : ((pte_val((r).pte) >> 12) & 0xf)) 53
54 rpte.pte = pte;
55 rpte.hidx = 0;
56 if (pte_val(pte) & _PAGE_COMBO) {
57 /*
58 * Make sure we order the hidx load against the _PAGE_COMBO
59 * check. The store side ordering is done in __hash_page_4K
60 */
61 smp_rmb();
62 rpte.hidx = pte_val(*((ptep) + PTRS_PER_PTE));
63 }
64 return rpte;
65}
66
67static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)
68{
69 if ((pte_val(rpte.pte) & _PAGE_COMBO))
70 return (rpte.hidx >> (index<<2)) & 0xf;
71 return (pte_val(rpte.pte) >> 12) & 0xf;
72}
73
54#define __rpte_to_pte(r) ((r).pte) 74#define __rpte_to_pte(r) ((r).pte)
55#define __rpte_sub_valid(rpte, index) \ 75#define __rpte_sub_valid(rpte, index) \
56 (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) 76 (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index)))
@@ -75,7 +95,8 @@
75 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K) 95 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)
76 96
77#define remap_4k_pfn(vma, addr, pfn, prot) \ 97#define remap_4k_pfn(vma, addr, pfn, prot) \
78 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \ 98 (WARN_ON(((pfn) >= (1UL << (64 - PTE_RPN_SHIFT)))) ? -EINVAL : \
79 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN)) 99 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \
100 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN)))
80 101
81#endif /* __ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index bffd89d27301..0c0505956a29 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -213,9 +213,8 @@
213#define SPRN_ACOP 0x1F /* Available Coprocessor Register */ 213#define SPRN_ACOP 0x1F /* Available Coprocessor Register */
214#define SPRN_TFIAR 0x81 /* Transaction Failure Inst Addr */ 214#define SPRN_TFIAR 0x81 /* Transaction Failure Inst Addr */
215#define SPRN_TEXASR 0x82 /* Transaction EXception & Summary */ 215#define SPRN_TEXASR 0x82 /* Transaction EXception & Summary */
216#define TEXASR_FS __MASK(63-36) /* Transaction Failure Summary */
217#define SPRN_TEXASRU 0x83 /* '' '' '' Upper 32 */ 216#define SPRN_TEXASRU 0x83 /* '' '' '' Upper 32 */
218#define TEXASR_FS __MASK(63-36) /* TEXASR Failure Summary */ 217#define TEXASR_FS __MASK(63-36) /* TEXASR Failure Summary */
219#define SPRN_TFHAR 0x80 /* Transaction Failure Handler Addr */ 218#define SPRN_TFHAR 0x80 /* Transaction Failure Handler Addr */
220#define SPRN_CTRLF 0x088 219#define SPRN_CTRLF 0x088
221#define SPRN_CTRLT 0x098 220#define SPRN_CTRLT 0x098
@@ -225,6 +224,7 @@
225#define CTRL_TE 0x00c00000 /* thread enable */ 224#define CTRL_TE 0x00c00000 /* thread enable */
226#define CTRL_RUNLATCH 0x1 225#define CTRL_RUNLATCH 0x1
227#define SPRN_DAWR 0xB4 226#define SPRN_DAWR 0xB4
227#define SPRN_MPPR 0xB8 /* Micro Partition Prefetch Register */
228#define SPRN_RPR 0xBA /* Relative Priority Register */ 228#define SPRN_RPR 0xBA /* Relative Priority Register */
229#define SPRN_CIABR 0xBB 229#define SPRN_CIABR 0xBB
230#define CIABR_PRIV 0x3 230#define CIABR_PRIV 0x3
@@ -254,7 +254,7 @@
254#define DSISR_PROTFAULT 0x08000000 /* protection fault */ 254#define DSISR_PROTFAULT 0x08000000 /* protection fault */
255#define DSISR_ISSTORE 0x02000000 /* access was a store */ 255#define DSISR_ISSTORE 0x02000000 /* access was a store */
256#define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */ 256#define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */
257#define DSISR_NOSEGMENT 0x00200000 /* STAB/SLB miss */ 257#define DSISR_NOSEGMENT 0x00200000 /* SLB miss */
258#define DSISR_KEYFAULT 0x00200000 /* Key fault */ 258#define DSISR_KEYFAULT 0x00200000 /* Key fault */
259#define SPRN_TBRL 0x10C /* Time Base Read Lower Register (user, R/O) */ 259#define SPRN_TBRL 0x10C /* Time Base Read Lower Register (user, R/O) */
260#define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */ 260#define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */
@@ -944,9 +944,6 @@
944 * readable variant for reads, which can avoid a fault 944 * readable variant for reads, which can avoid a fault
945 * with KVM type virtualization. 945 * with KVM type virtualization.
946 * 946 *
947 * (*) Under KVM, the host SPRG1 is used to point to
948 * the current VCPU data structure
949 *
950 * 32-bit 8xx: 947 * 32-bit 8xx:
951 * - SPRG0 scratch for exception vectors 948 * - SPRG0 scratch for exception vectors
952 * - SPRG1 scratch for exception vectors 949 * - SPRG1 scratch for exception vectors
@@ -1203,6 +1200,15 @@
1203 : "r" ((unsigned long)(v)) \ 1200 : "r" ((unsigned long)(v)) \
1204 : "memory") 1201 : "memory")
1205 1202
1203static inline unsigned long mfvtb (void)
1204{
1205#ifdef CONFIG_PPC_BOOK3S_64
1206 if (cpu_has_feature(CPU_FTR_ARCH_207S))
1207 return mfspr(SPRN_VTB);
1208#endif
1209 return 0;
1210}
1211
1206#ifdef __powerpc64__ 1212#ifdef __powerpc64__
1207#if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E) 1213#if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E)
1208#define mftb() ({unsigned long rval; \ 1214#define mftb() ({unsigned long rval; \
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 464f1089b532..1d653308a33c 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -15,16 +15,28 @@
15#ifndef __ASM_POWERPC_REG_BOOKE_H__ 15#ifndef __ASM_POWERPC_REG_BOOKE_H__
16#define __ASM_POWERPC_REG_BOOKE_H__ 16#define __ASM_POWERPC_REG_BOOKE_H__
17 17
18#include <asm/ppc-opcode.h>
19
18/* Machine State Register (MSR) Fields */ 20/* Machine State Register (MSR) Fields */
19#define MSR_GS (1<<28) /* Guest state */ 21#define MSR_GS_LG 28 /* Guest state */
20#define MSR_UCLE (1<<26) /* User-mode cache lock enable */ 22#define MSR_UCLE_LG 26 /* User-mode cache lock enable */
21#define MSR_SPE (1<<25) /* Enable SPE */ 23#define MSR_SPE_LG 25 /* Enable SPE */
22#define MSR_DWE (1<<10) /* Debug Wait Enable */ 24#define MSR_DWE_LG 10 /* Debug Wait Enable */
23#define MSR_UBLE (1<<10) /* BTB lock enable (e500) */ 25#define MSR_UBLE_LG 10 /* BTB lock enable (e500) */
24#define MSR_IS MSR_IR /* Instruction Space */ 26#define MSR_IS_LG MSR_IR_LG /* Instruction Space */
25#define MSR_DS MSR_DR /* Data Space */ 27#define MSR_DS_LG MSR_DR_LG /* Data Space */
26#define MSR_PMM (1<<2) /* Performance monitor mark bit */ 28#define MSR_PMM_LG 2 /* Performance monitor mark bit */
27#define MSR_CM (1<<31) /* Computation Mode (0=32-bit, 1=64-bit) */ 29#define MSR_CM_LG 31 /* Computation Mode (0=32-bit, 1=64-bit) */
30
31#define MSR_GS __MASK(MSR_GS_LG)
32#define MSR_UCLE __MASK(MSR_UCLE_LG)
33#define MSR_SPE __MASK(MSR_SPE_LG)
34#define MSR_DWE __MASK(MSR_DWE_LG)
35#define MSR_UBLE __MASK(MSR_UBLE_LG)
36#define MSR_IS __MASK(MSR_IS_LG)
37#define MSR_DS __MASK(MSR_DS_LG)
38#define MSR_PMM __MASK(MSR_PMM_LG)
39#define MSR_CM __MASK(MSR_CM_LG)
28 40
29#if defined(CONFIG_PPC_BOOK3E_64) 41#if defined(CONFIG_PPC_BOOK3E_64)
30#define MSR_64BIT MSR_CM 42#define MSR_64BIT MSR_CM
@@ -260,7 +272,7 @@
260 272
261/* e500mc */ 273/* e500mc */
262#define MCSR_DCPERR_MC 0x20000000UL /* D-Cache Parity Error */ 274#define MCSR_DCPERR_MC 0x20000000UL /* D-Cache Parity Error */
263#define MCSR_L2MMU_MHIT 0x04000000UL /* Hit on multiple TLB entries */ 275#define MCSR_L2MMU_MHIT 0x08000000UL /* Hit on multiple TLB entries */
264#define MCSR_NMI 0x00100000UL /* Non-Maskable Interrupt */ 276#define MCSR_NMI 0x00100000UL /* Non-Maskable Interrupt */
265#define MCSR_MAV 0x00080000UL /* MCAR address valid */ 277#define MCSR_MAV 0x00080000UL /* MCAR address valid */
266#define MCSR_MEA 0x00040000UL /* MCAR is effective address */ 278#define MCSR_MEA 0x00040000UL /* MCAR is effective address */
@@ -598,6 +610,13 @@
598/* Bit definitions for L1CSR2. */ 610/* Bit definitions for L1CSR2. */
599#define L1CSR2_DCWS 0x40000000 /* Data Cache write shadow */ 611#define L1CSR2_DCWS 0x40000000 /* Data Cache write shadow */
600 612
613/* Bit definitions for BUCSR. */
614#define BUCSR_STAC_EN 0x01000000 /* Segment Target Address Cache */
615#define BUCSR_LS_EN 0x00400000 /* Link Stack */
616#define BUCSR_BBFI 0x00000200 /* Branch Buffer flash invalidate */
617#define BUCSR_BPEN 0x00000001 /* Branch prediction enable */
618#define BUCSR_INIT (BUCSR_STAC_EN | BUCSR_LS_EN | BUCSR_BBFI | BUCSR_BPEN)
619
601/* Bit definitions for L2CSR0. */ 620/* Bit definitions for L2CSR0. */
602#define L2CSR0_L2E 0x80000000 /* L2 Cache Enable */ 621#define L2CSR0_L2E 0x80000000 /* L2 Cache Enable */
603#define L2CSR0_L2PE 0x40000000 /* L2 Cache Parity/ECC Enable */ 622#define L2CSR0_L2PE 0x40000000 /* L2 Cache Parity/ECC Enable */
@@ -721,5 +740,23 @@
721#define MMUBE1_VBE4 0x00000002 740#define MMUBE1_VBE4 0x00000002
722#define MMUBE1_VBE5 0x00000001 741#define MMUBE1_VBE5 0x00000001
723 742
743#define TMRN_IMSR0 0x120 /* Initial MSR Register 0 (e6500) */
744#define TMRN_IMSR1 0x121 /* Initial MSR Register 1 (e6500) */
745#define TMRN_INIA0 0x140 /* Next Instruction Address Register 0 */
746#define TMRN_INIA1 0x141 /* Next Instruction Address Register 1 */
747#define SPRN_TENSR 0x1b5 /* Thread Enable Status Register */
748#define SPRN_TENS 0x1b6 /* Thread Enable Set Register */
749#define SPRN_TENC 0x1b7 /* Thread Enable Clear Register */
750
751#define TEN_THREAD(x) (1 << (x))
752
753#ifndef __ASSEMBLY__
754#define mftmr(rn) ({unsigned long rval; \
755 asm volatile(MFTMR(rn, %0) : "=r" (rval)); rval;})
756#define mttmr(rn, v) asm volatile(MTTMR(rn, %0) : \
757 : "r" ((unsigned long)(v)) \
758 : "memory")
759#endif /* !__ASSEMBLY__ */
760
724#endif /* __ASM_POWERPC_REG_BOOKE_H__ */ 761#endif /* __ASM_POWERPC_REG_BOOKE_H__ */
725#endif /* __KERNEL__ */ 762#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/scatterlist.h b/arch/powerpc/include/asm/scatterlist.h
deleted file mode 100644
index de1f620bd5c9..000000000000
--- a/arch/powerpc/include/asm/scatterlist.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_POWERPC_SCATTERLIST_H
2#define _ASM_POWERPC_SCATTERLIST_H
3/*
4 * Copyright (C) 2001 PPC64 Team, IBM Corp
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <asm/dma.h>
13#include <asm-generic/scatterlist.h>
14
15#define ARCH_HAS_SG_CHAIN
16
17#endif /* _ASM_POWERPC_SCATTERLIST_H */
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index 35aa339410bd..4dbe072eecbe 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -61,6 +61,7 @@ static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock)
61 61
62static inline int arch_spin_is_locked(arch_spinlock_t *lock) 62static inline int arch_spin_is_locked(arch_spinlock_t *lock)
63{ 63{
64 smp_mb();
64 return !arch_spin_value_unlocked(*lock); 65 return !arch_spin_value_unlocked(*lock);
65} 66}
66 67
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index babbeca6850f..542bc0f0673f 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -77,10 +77,10 @@ SYSCALL_SPU(setreuid)
77SYSCALL_SPU(setregid) 77SYSCALL_SPU(setregid)
78#define compat_sys_sigsuspend sys_sigsuspend 78#define compat_sys_sigsuspend sys_sigsuspend
79SYS32ONLY(sigsuspend) 79SYS32ONLY(sigsuspend)
80COMPAT_SYS(sigpending) 80SYSX(sys_ni_syscall,compat_sys_sigpending,sys_sigpending)
81SYSCALL_SPU(sethostname) 81SYSCALL_SPU(sethostname)
82COMPAT_SYS_SPU(setrlimit) 82COMPAT_SYS_SPU(setrlimit)
83COMPAT_SYS(old_getrlimit) 83SYSX(sys_ni_syscall,compat_sys_old_getrlimit,sys_old_getrlimit)
84COMPAT_SYS_SPU(getrusage) 84COMPAT_SYS_SPU(getrusage)
85COMPAT_SYS_SPU(gettimeofday) 85COMPAT_SYS_SPU(gettimeofday)
86COMPAT_SYS_SPU(settimeofday) 86COMPAT_SYS_SPU(settimeofday)
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 1d428e6007ca..03cbada59d3a 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -102,6 +102,15 @@ static inline u64 get_rtc(void)
102 return (u64)hi * 1000000000 + lo; 102 return (u64)hi * 1000000000 + lo;
103} 103}
104 104
105static inline u64 get_vtb(void)
106{
107#ifdef CONFIG_PPC_BOOK3S_64
108 if (cpu_has_feature(CPU_FTR_ARCH_207S))
109 return mfvtb();
110#endif
111 return 0;
112}
113
105#ifdef CONFIG_PPC64 114#ifdef CONFIG_PPC64
106static inline u64 get_tb(void) 115static inline u64 get_tb(void)
107{ 116{
diff --git a/arch/powerpc/include/asm/trace.h b/arch/powerpc/include/asm/trace.h
index 5712f06905a9..c15da6073cb8 100644
--- a/arch/powerpc/include/asm/trace.h
+++ b/arch/powerpc/include/asm/trace.h
@@ -99,6 +99,51 @@ TRACE_EVENT_FN(hcall_exit,
99); 99);
100#endif 100#endif
101 101
102#ifdef CONFIG_PPC_POWERNV
103extern void opal_tracepoint_regfunc(void);
104extern void opal_tracepoint_unregfunc(void);
105
106TRACE_EVENT_FN(opal_entry,
107
108 TP_PROTO(unsigned long opcode, unsigned long *args),
109
110 TP_ARGS(opcode, args),
111
112 TP_STRUCT__entry(
113 __field(unsigned long, opcode)
114 ),
115
116 TP_fast_assign(
117 __entry->opcode = opcode;
118 ),
119
120 TP_printk("opcode=%lu", __entry->opcode),
121
122 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
123);
124
125TRACE_EVENT_FN(opal_exit,
126
127 TP_PROTO(unsigned long opcode, unsigned long retval),
128
129 TP_ARGS(opcode, retval),
130
131 TP_STRUCT__entry(
132 __field(unsigned long, opcode)
133 __field(unsigned long, retval)
134 ),
135
136 TP_fast_assign(
137 __entry->opcode = opcode;
138 __entry->retval = retval;
139 ),
140
141 TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
142
143 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
144);
145#endif
146
102#endif /* _TRACE_POWERPC_H */ 147#endif /* _TRACE_POWERPC_H */
103 148
104#undef TRACE_INCLUDE_PATH 149#undef TRACE_INCLUDE_PATH
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index 2bc4a9409a93..e0e49dbb145d 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -548,6 +548,7 @@ struct kvm_get_htab_header {
548 548
549#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) 549#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4)
550#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5) 550#define KVM_REG_PPC_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5)
551#define KVM_REG_PPC_LPCR_64 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb5)
551#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6) 552#define KVM_REG_PPC_PPR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb6)
552 553
553/* Architecture compatibility level */ 554/* Architecture compatibility level */
@@ -555,6 +556,7 @@ struct kvm_get_htab_header {
555 556
556#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) 557#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8)
557#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) 558#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9)
559#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba)
558 560
559/* Transactional Memory checkpointed state: 561/* Transactional Memory checkpointed state:
560 * This is all GPRs, all VSX regs and a subset of SPRs 562 * This is all GPRs, all VSX regs and a subset of SPRs
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index f5995a912213..9d7dede2847c 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -216,8 +216,6 @@ int main(void)
216#endif /* CONFIG_PPC_BOOK3E */ 216#endif /* CONFIG_PPC_BOOK3E */
217 217
218#ifdef CONFIG_PPC_STD_MMU_64 218#ifdef CONFIG_PPC_STD_MMU_64
219 DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real));
220 DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr));
221 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); 219 DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
222 DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr)); 220 DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
223 DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp)); 221 DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp));
@@ -493,6 +491,7 @@ int main(void)
493 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1)); 491 DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1));
494 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock)); 492 DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock));
495 DEFINE(KVM_NEED_FLUSH, offsetof(struct kvm, arch.need_tlb_flush.bits)); 493 DEFINE(KVM_NEED_FLUSH, offsetof(struct kvm, arch.need_tlb_flush.bits));
494 DEFINE(KVM_ENABLED_HCALLS, offsetof(struct kvm, arch.enabled_hcalls));
496 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr)); 495 DEFINE(KVM_LPCR, offsetof(struct kvm, arch.lpcr));
497 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor)); 496 DEFINE(KVM_RMOR, offsetof(struct kvm, arch.rmor));
498 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v)); 497 DEFINE(KVM_VRMA_SLB_V, offsetof(struct kvm, arch.vrma_slb_v));
@@ -667,6 +666,7 @@ int main(void)
667 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); 666 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
668 DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr)); 667 DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
669 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc)); 668 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
669 DEFINE(VCPU_SPRG9, offsetof(struct kvm_vcpu, arch.sprg9));
670 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 670 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
671 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); 671 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
672 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); 672 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 0c157642c2a1..9b6dcaaec1a3 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -123,96 +123,6 @@ extern void __restore_cpu_e6500(void);
123 123
124static struct cpu_spec __initdata cpu_specs[] = { 124static struct cpu_spec __initdata cpu_specs[] = {
125#ifdef CONFIG_PPC_BOOK3S_64 125#ifdef CONFIG_PPC_BOOK3S_64
126 { /* Power3 */
127 .pvr_mask = 0xffff0000,
128 .pvr_value = 0x00400000,
129 .cpu_name = "POWER3 (630)",
130 .cpu_features = CPU_FTRS_POWER3,
131 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
132 .mmu_features = MMU_FTR_HPTE_TABLE,
133 .icache_bsize = 128,
134 .dcache_bsize = 128,
135 .num_pmcs = 8,
136 .pmc_type = PPC_PMC_IBM,
137 .oprofile_cpu_type = "ppc64/power3",
138 .oprofile_type = PPC_OPROFILE_RS64,
139 .platform = "power3",
140 },
141 { /* Power3+ */
142 .pvr_mask = 0xffff0000,
143 .pvr_value = 0x00410000,
144 .cpu_name = "POWER3 (630+)",
145 .cpu_features = CPU_FTRS_POWER3,
146 .cpu_user_features = COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,
147 .mmu_features = MMU_FTR_HPTE_TABLE,
148 .icache_bsize = 128,
149 .dcache_bsize = 128,
150 .num_pmcs = 8,
151 .pmc_type = PPC_PMC_IBM,
152 .oprofile_cpu_type = "ppc64/power3",
153 .oprofile_type = PPC_OPROFILE_RS64,
154 .platform = "power3",
155 },
156 { /* Northstar */
157 .pvr_mask = 0xffff0000,
158 .pvr_value = 0x00330000,
159 .cpu_name = "RS64-II (northstar)",
160 .cpu_features = CPU_FTRS_RS64,
161 .cpu_user_features = COMMON_USER_PPC64,
162 .mmu_features = MMU_FTR_HPTE_TABLE,
163 .icache_bsize = 128,
164 .dcache_bsize = 128,
165 .num_pmcs = 8,
166 .pmc_type = PPC_PMC_IBM,
167 .oprofile_cpu_type = "ppc64/rs64",
168 .oprofile_type = PPC_OPROFILE_RS64,
169 .platform = "rs64",
170 },
171 { /* Pulsar */
172 .pvr_mask = 0xffff0000,
173 .pvr_value = 0x00340000,
174 .cpu_name = "RS64-III (pulsar)",
175 .cpu_features = CPU_FTRS_RS64,
176 .cpu_user_features = COMMON_USER_PPC64,
177 .mmu_features = MMU_FTR_HPTE_TABLE,
178 .icache_bsize = 128,
179 .dcache_bsize = 128,
180 .num_pmcs = 8,
181 .pmc_type = PPC_PMC_IBM,
182 .oprofile_cpu_type = "ppc64/rs64",
183 .oprofile_type = PPC_OPROFILE_RS64,
184 .platform = "rs64",
185 },
186 { /* I-star */
187 .pvr_mask = 0xffff0000,
188 .pvr_value = 0x00360000,
189 .cpu_name = "RS64-III (icestar)",
190 .cpu_features = CPU_FTRS_RS64,
191 .cpu_user_features = COMMON_USER_PPC64,
192 .mmu_features = MMU_FTR_HPTE_TABLE,
193 .icache_bsize = 128,
194 .dcache_bsize = 128,
195 .num_pmcs = 8,
196 .pmc_type = PPC_PMC_IBM,
197 .oprofile_cpu_type = "ppc64/rs64",
198 .oprofile_type = PPC_OPROFILE_RS64,
199 .platform = "rs64",
200 },
201 { /* S-star */
202 .pvr_mask = 0xffff0000,
203 .pvr_value = 0x00370000,
204 .cpu_name = "RS64-IV (sstar)",
205 .cpu_features = CPU_FTRS_RS64,
206 .cpu_user_features = COMMON_USER_PPC64,
207 .mmu_features = MMU_FTR_HPTE_TABLE,
208 .icache_bsize = 128,
209 .dcache_bsize = 128,
210 .num_pmcs = 8,
211 .pmc_type = PPC_PMC_IBM,
212 .oprofile_cpu_type = "ppc64/rs64",
213 .oprofile_type = PPC_OPROFILE_RS64,
214 .platform = "rs64",
215 },
216 { /* Power4 */ 126 { /* Power4 */
217 .pvr_mask = 0xffff0000, 127 .pvr_mask = 0xffff0000,
218 .pvr_value = 0x00350000, 128 .pvr_value = 0x00350000,
@@ -617,7 +527,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
617#endif /* CONFIG_PPC_BOOK3S_64 */ 527#endif /* CONFIG_PPC_BOOK3S_64 */
618 528
619#ifdef CONFIG_PPC32 529#ifdef CONFIG_PPC32
620#if CLASSIC_PPC 530#ifdef CONFIG_PPC_BOOK3S_32
621 { /* 601 */ 531 { /* 601 */
622 .pvr_mask = 0xffff0000, 532 .pvr_mask = 0xffff0000,
623 .pvr_value = 0x00010000, 533 .pvr_value = 0x00010000,
@@ -1257,7 +1167,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1257 .machine_check = machine_check_generic, 1167 .machine_check = machine_check_generic,
1258 .platform = "ppc603", 1168 .platform = "ppc603",
1259 }, 1169 },
1260#endif /* CLASSIC_PPC */ 1170#endif /* CONFIG_PPC_BOOK3S_32 */
1261#ifdef CONFIG_8xx 1171#ifdef CONFIG_8xx
1262 { /* 8xx */ 1172 { /* 8xx */
1263 .pvr_mask = 0xffff0000, 1173 .pvr_mask = 0xffff0000,
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 86e25702aaca..59a64f8dc85f 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/iommu.h>
30#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
31#include <linux/rbtree.h> 32#include <linux/rbtree.h>
32#include <linux/reboot.h> 33#include <linux/reboot.h>
@@ -40,6 +41,7 @@
40#include <asm/eeh.h> 41#include <asm/eeh.h>
41#include <asm/eeh_event.h> 42#include <asm/eeh_event.h>
42#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/iommu.h>
43#include <asm/machdep.h> 45#include <asm/machdep.h>
44#include <asm/ppc-pci.h> 46#include <asm/ppc-pci.h>
45#include <asm/rtas.h> 47#include <asm/rtas.h>
@@ -108,6 +110,9 @@ struct eeh_ops *eeh_ops = NULL;
108/* Lock to avoid races due to multiple reports of an error */ 110/* Lock to avoid races due to multiple reports of an error */
109DEFINE_RAW_SPINLOCK(confirm_error_lock); 111DEFINE_RAW_SPINLOCK(confirm_error_lock);
110 112
113/* Lock to protect passed flags */
114static DEFINE_MUTEX(eeh_dev_mutex);
115
111/* Buffer for reporting pci register dumps. Its here in BSS, and 116/* Buffer for reporting pci register dumps. Its here in BSS, and
112 * not dynamically alloced, so that it ends up in RMO where RTAS 117 * not dynamically alloced, so that it ends up in RMO where RTAS
113 * can access it. 118 * can access it.
@@ -137,7 +142,7 @@ static struct eeh_stats eeh_stats;
137static int __init eeh_setup(char *str) 142static int __init eeh_setup(char *str)
138{ 143{
139 if (!strcmp(str, "off")) 144 if (!strcmp(str, "off"))
140 eeh_subsystem_flags |= EEH_FORCE_DISABLED; 145 eeh_add_flag(EEH_FORCE_DISABLED);
141 146
142 return 1; 147 return 1;
143} 148}
@@ -152,12 +157,13 @@ __setup("eeh=", eeh_setup);
152 * This routine captures assorted PCI configuration space data, 157 * This routine captures assorted PCI configuration space data,
153 * and puts them into a buffer for RTAS error logging. 158 * and puts them into a buffer for RTAS error logging.
154 */ 159 */
155static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len) 160static size_t eeh_gather_pci_data(struct eeh_dev *edev, char *buf, size_t len)
156{ 161{
157 struct device_node *dn = eeh_dev_to_of_node(edev); 162 struct device_node *dn = eeh_dev_to_of_node(edev);
158 u32 cfg; 163 u32 cfg;
159 int cap, i; 164 int cap, i;
160 int n = 0; 165 int n = 0, l = 0;
166 char buffer[128];
161 167
162 n += scnprintf(buf+n, len-n, "%s\n", dn->full_name); 168 n += scnprintf(buf+n, len-n, "%s\n", dn->full_name);
163 pr_warn("EEH: of node=%s\n", dn->full_name); 169 pr_warn("EEH: of node=%s\n", dn->full_name);
@@ -202,8 +208,22 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
202 for (i=0; i<=8; i++) { 208 for (i=0; i<=8; i++) {
203 eeh_ops->read_config(dn, cap+4*i, 4, &cfg); 209 eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
204 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); 210 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
205 pr_warn("EEH: PCI-E %02x: %08x\n", i, cfg); 211
212 if ((i % 4) == 0) {
213 if (i != 0)
214 pr_warn("%s\n", buffer);
215
216 l = scnprintf(buffer, sizeof(buffer),
217 "EEH: PCI-E %02x: %08x ",
218 4*i, cfg);
219 } else {
220 l += scnprintf(buffer+l, sizeof(buffer)-l,
221 "%08x ", cfg);
222 }
223
206 } 224 }
225
226 pr_warn("%s\n", buffer);
207 } 227 }
208 228
209 /* If AER capable, dump it */ 229 /* If AER capable, dump it */
@@ -212,11 +232,24 @@ static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
212 n += scnprintf(buf+n, len-n, "pci-e AER:\n"); 232 n += scnprintf(buf+n, len-n, "pci-e AER:\n");
213 pr_warn("EEH: PCI-E AER capability register set follows:\n"); 233 pr_warn("EEH: PCI-E AER capability register set follows:\n");
214 234
215 for (i=0; i<14; i++) { 235 for (i=0; i<=13; i++) {
216 eeh_ops->read_config(dn, cap+4*i, 4, &cfg); 236 eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
217 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); 237 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
218 pr_warn("EEH: PCI-E AER %02x: %08x\n", i, cfg); 238
239 if ((i % 4) == 0) {
240 if (i != 0)
241 pr_warn("%s\n", buffer);
242
243 l = scnprintf(buffer, sizeof(buffer),
244 "EEH: PCI-E AER %02x: %08x ",
245 4*i, cfg);
246 } else {
247 l += scnprintf(buffer+l, sizeof(buffer)-l,
248 "%08x ", cfg);
249 }
219 } 250 }
251
252 pr_warn("%s\n", buffer);
220 } 253 }
221 254
222 return n; 255 return n;
@@ -247,7 +280,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
247 * 0xFF's is always returned from PCI config space. 280 * 0xFF's is always returned from PCI config space.
248 */ 281 */
249 if (!(pe->type & EEH_PE_PHB)) { 282 if (!(pe->type & EEH_PE_PHB)) {
250 if (eeh_probe_mode_devtree()) 283 if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
251 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 284 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
252 eeh_ops->configure_bridge(pe); 285 eeh_ops->configure_bridge(pe);
253 eeh_pe_restore_bars(pe); 286 eeh_pe_restore_bars(pe);
@@ -298,14 +331,14 @@ static int eeh_phb_check_failure(struct eeh_pe *pe)
298 unsigned long flags; 331 unsigned long flags;
299 int ret; 332 int ret;
300 333
301 if (!eeh_probe_mode_dev()) 334 if (!eeh_has_flag(EEH_PROBE_MODE_DEV))
302 return -EPERM; 335 return -EPERM;
303 336
304 /* Find the PHB PE */ 337 /* Find the PHB PE */
305 phb_pe = eeh_phb_pe_get(pe->phb); 338 phb_pe = eeh_phb_pe_get(pe->phb);
306 if (!phb_pe) { 339 if (!phb_pe) {
307 pr_warning("%s Can't find PE for PHB#%d\n", 340 pr_warn("%s Can't find PE for PHB#%d\n",
308 __func__, pe->phb->global_number); 341 __func__, pe->phb->global_number);
309 return -EEXIST; 342 return -EEXIST;
310 } 343 }
311 344
@@ -400,6 +433,14 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
400 if (ret > 0) 433 if (ret > 0)
401 return ret; 434 return ret;
402 435
436 /*
437 * If the PE isn't owned by us, we shouldn't check the
438 * state. Instead, let the owner handle it if the PE has
439 * been frozen.
440 */
441 if (eeh_pe_passed(pe))
442 return 0;
443
403 /* If we already have a pending isolation event for this 444 /* If we already have a pending isolation event for this
404 * slot, we know it's bad already, we don't need to check. 445 * slot, we know it's bad already, we don't need to check.
405 * Do this checking under a lock; as multiple PCI devices 446 * Do this checking under a lock; as multiple PCI devices
@@ -746,13 +787,13 @@ void eeh_save_bars(struct eeh_dev *edev)
746int __init eeh_ops_register(struct eeh_ops *ops) 787int __init eeh_ops_register(struct eeh_ops *ops)
747{ 788{
748 if (!ops->name) { 789 if (!ops->name) {
749 pr_warning("%s: Invalid EEH ops name for %p\n", 790 pr_warn("%s: Invalid EEH ops name for %p\n",
750 __func__, ops); 791 __func__, ops);
751 return -EINVAL; 792 return -EINVAL;
752 } 793 }
753 794
754 if (eeh_ops && eeh_ops != ops) { 795 if (eeh_ops && eeh_ops != ops) {
755 pr_warning("%s: EEH ops of platform %s already existing (%s)\n", 796 pr_warn("%s: EEH ops of platform %s already existing (%s)\n",
756 __func__, eeh_ops->name, ops->name); 797 __func__, eeh_ops->name, ops->name);
757 return -EEXIST; 798 return -EEXIST;
758 } 799 }
@@ -772,7 +813,7 @@ int __init eeh_ops_register(struct eeh_ops *ops)
772int __exit eeh_ops_unregister(const char *name) 813int __exit eeh_ops_unregister(const char *name)
773{ 814{
774 if (!name || !strlen(name)) { 815 if (!name || !strlen(name)) {
775 pr_warning("%s: Invalid EEH ops name\n", 816 pr_warn("%s: Invalid EEH ops name\n",
776 __func__); 817 __func__);
777 return -EINVAL; 818 return -EINVAL;
778 } 819 }
@@ -788,7 +829,7 @@ int __exit eeh_ops_unregister(const char *name)
788static int eeh_reboot_notifier(struct notifier_block *nb, 829static int eeh_reboot_notifier(struct notifier_block *nb,
789 unsigned long action, void *unused) 830 unsigned long action, void *unused)
790{ 831{
791 eeh_set_enable(false); 832 eeh_clear_flag(EEH_ENABLED);
792 return NOTIFY_DONE; 833 return NOTIFY_DONE;
793} 834}
794 835
@@ -837,11 +878,11 @@ int eeh_init(void)
837 878
838 /* call platform initialization function */ 879 /* call platform initialization function */
839 if (!eeh_ops) { 880 if (!eeh_ops) {
840 pr_warning("%s: Platform EEH operation not found\n", 881 pr_warn("%s: Platform EEH operation not found\n",
841 __func__); 882 __func__);
842 return -EEXIST; 883 return -EEXIST;
843 } else if ((ret = eeh_ops->init())) { 884 } else if ((ret = eeh_ops->init())) {
844 pr_warning("%s: Failed to call platform init function (%d)\n", 885 pr_warn("%s: Failed to call platform init function (%d)\n",
845 __func__, ret); 886 __func__, ret);
846 return ret; 887 return ret;
847 } 888 }
@@ -852,13 +893,13 @@ int eeh_init(void)
852 return ret; 893 return ret;
853 894
854 /* Enable EEH for all adapters */ 895 /* Enable EEH for all adapters */
855 if (eeh_probe_mode_devtree()) { 896 if (eeh_has_flag(EEH_PROBE_MODE_DEVTREE)) {
856 list_for_each_entry_safe(hose, tmp, 897 list_for_each_entry_safe(hose, tmp,
857 &hose_list, list_node) { 898 &hose_list, list_node) {
858 phb = hose->dn; 899 phb = hose->dn;
859 traverse_pci_devices(phb, eeh_ops->of_probe, NULL); 900 traverse_pci_devices(phb, eeh_ops->of_probe, NULL);
860 } 901 }
861 } else if (eeh_probe_mode_dev()) { 902 } else if (eeh_has_flag(EEH_PROBE_MODE_DEV)) {
862 list_for_each_entry_safe(hose, tmp, 903 list_for_each_entry_safe(hose, tmp,
863 &hose_list, list_node) 904 &hose_list, list_node)
864 pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL); 905 pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL);
@@ -882,7 +923,7 @@ int eeh_init(void)
882 if (eeh_enabled()) 923 if (eeh_enabled())
883 pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n"); 924 pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");
884 else 925 else
885 pr_warning("EEH: No capable adapters found\n"); 926 pr_warn("EEH: No capable adapters found\n");
886 927
887 return ret; 928 return ret;
888} 929}
@@ -910,7 +951,7 @@ void eeh_add_device_early(struct device_node *dn)
910 * would delay the probe until late stage because 951 * would delay the probe until late stage because
911 * the PCI device isn't available this moment. 952 * the PCI device isn't available this moment.
912 */ 953 */
913 if (!eeh_probe_mode_devtree()) 954 if (!eeh_has_flag(EEH_PROBE_MODE_DEVTREE))
914 return; 955 return;
915 956
916 if (!of_node_to_eeh_dev(dn)) 957 if (!of_node_to_eeh_dev(dn))
@@ -996,7 +1037,7 @@ void eeh_add_device_late(struct pci_dev *dev)
996 * We have to do the EEH probe here because the PCI device 1037 * We have to do the EEH probe here because the PCI device
997 * hasn't been created yet in the early stage. 1038 * hasn't been created yet in the early stage.
998 */ 1039 */
999 if (eeh_probe_mode_dev()) 1040 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1000 eeh_ops->dev_probe(dev, NULL); 1041 eeh_ops->dev_probe(dev, NULL);
1001 1042
1002 eeh_addr_cache_insert_dev(dev); 1043 eeh_addr_cache_insert_dev(dev);
@@ -1100,6 +1141,285 @@ void eeh_remove_device(struct pci_dev *dev)
1100 edev->mode &= ~EEH_DEV_SYSFS; 1141 edev->mode &= ~EEH_DEV_SYSFS;
1101} 1142}
1102 1143
1144/**
1145 * eeh_dev_open - Increase count of pass through devices for PE
1146 * @pdev: PCI device
1147 *
1148 * Increase count of passed through devices for the indicated
1149 * PE. In the result, the EEH errors detected on the PE won't be
1150 * reported. The PE owner will be responsible for detection
1151 * and recovery.
1152 */
1153int eeh_dev_open(struct pci_dev *pdev)
1154{
1155 struct eeh_dev *edev;
1156
1157 mutex_lock(&eeh_dev_mutex);
1158
1159 /* No PCI device ? */
1160 if (!pdev)
1161 goto out;
1162
1163 /* No EEH device or PE ? */
1164 edev = pci_dev_to_eeh_dev(pdev);
1165 if (!edev || !edev->pe)
1166 goto out;
1167
1168 /* Increase PE's pass through count */
1169 atomic_inc(&edev->pe->pass_dev_cnt);
1170 mutex_unlock(&eeh_dev_mutex);
1171
1172 return 0;
1173out:
1174 mutex_unlock(&eeh_dev_mutex);
1175 return -ENODEV;
1176}
1177EXPORT_SYMBOL_GPL(eeh_dev_open);
1178
1179/**
1180 * eeh_dev_release - Decrease count of pass through devices for PE
1181 * @pdev: PCI device
1182 *
1183 * Decrease count of pass through devices for the indicated PE. If
1184 * there is no passed through device in PE, the EEH errors detected
1185 * on the PE will be reported and handled as usual.
1186 */
1187void eeh_dev_release(struct pci_dev *pdev)
1188{
1189 struct eeh_dev *edev;
1190
1191 mutex_lock(&eeh_dev_mutex);
1192
1193 /* No PCI device ? */
1194 if (!pdev)
1195 goto out;
1196
1197 /* No EEH device ? */
1198 edev = pci_dev_to_eeh_dev(pdev);
1199 if (!edev || !edev->pe || !eeh_pe_passed(edev->pe))
1200 goto out;
1201
1202 /* Decrease PE's pass through count */
1203 atomic_dec(&edev->pe->pass_dev_cnt);
1204 WARN_ON(atomic_read(&edev->pe->pass_dev_cnt) < 0);
1205out:
1206 mutex_unlock(&eeh_dev_mutex);
1207}
1208EXPORT_SYMBOL(eeh_dev_release);
1209
1210#ifdef CONFIG_IOMMU_API
1211
1212static int dev_has_iommu_table(struct device *dev, void *data)
1213{
1214 struct pci_dev *pdev = to_pci_dev(dev);
1215 struct pci_dev **ppdev = data;
1216 struct iommu_table *tbl;
1217
1218 if (!dev)
1219 return 0;
1220
1221 tbl = get_iommu_table_base(dev);
1222 if (tbl && tbl->it_group) {
1223 *ppdev = pdev;
1224 return 1;
1225 }
1226
1227 return 0;
1228}
1229
1230/**
1231 * eeh_iommu_group_to_pe - Convert IOMMU group to EEH PE
1232 * @group: IOMMU group
1233 *
1234 * The routine is called to convert IOMMU group to EEH PE.
1235 */
1236struct eeh_pe *eeh_iommu_group_to_pe(struct iommu_group *group)
1237{
1238 struct pci_dev *pdev = NULL;
1239 struct eeh_dev *edev;
1240 int ret;
1241
1242 /* No IOMMU group ? */
1243 if (!group)
1244 return NULL;
1245
1246 ret = iommu_group_for_each_dev(group, &pdev, dev_has_iommu_table);
1247 if (!ret || !pdev)
1248 return NULL;
1249
1250 /* No EEH device or PE ? */
1251 edev = pci_dev_to_eeh_dev(pdev);
1252 if (!edev || !edev->pe)
1253 return NULL;
1254
1255 return edev->pe;
1256}
1257EXPORT_SYMBOL_GPL(eeh_iommu_group_to_pe);
1258
1259#endif /* CONFIG_IOMMU_API */
1260
1261/**
1262 * eeh_pe_set_option - Set options for the indicated PE
1263 * @pe: EEH PE
1264 * @option: requested option
1265 *
1266 * The routine is called to enable or disable EEH functionality
1267 * on the indicated PE, to enable IO or DMA for the frozen PE.
1268 */
1269int eeh_pe_set_option(struct eeh_pe *pe, int option)
1270{
1271 int ret = 0;
1272
1273 /* Invalid PE ? */
1274 if (!pe)
1275 return -ENODEV;
1276
1277 /*
1278 * EEH functionality could possibly be disabled, just
1279 * return error for the case. And the EEH functinality
1280 * isn't expected to be disabled on one specific PE.
1281 */
1282 switch (option) {
1283 case EEH_OPT_ENABLE:
1284 if (eeh_enabled())
1285 break;
1286 ret = -EIO;
1287 break;
1288 case EEH_OPT_DISABLE:
1289 break;
1290 case EEH_OPT_THAW_MMIO:
1291 case EEH_OPT_THAW_DMA:
1292 if (!eeh_ops || !eeh_ops->set_option) {
1293 ret = -ENOENT;
1294 break;
1295 }
1296
1297 ret = eeh_ops->set_option(pe, option);
1298 break;
1299 default:
1300 pr_debug("%s: Option %d out of range (%d, %d)\n",
1301 __func__, option, EEH_OPT_DISABLE, EEH_OPT_THAW_DMA);
1302 ret = -EINVAL;
1303 }
1304
1305 return ret;
1306}
1307EXPORT_SYMBOL_GPL(eeh_pe_set_option);
1308
1309/**
1310 * eeh_pe_get_state - Retrieve PE's state
1311 * @pe: EEH PE
1312 *
1313 * Retrieve the PE's state, which includes 3 aspects: enabled
1314 * DMA, enabled IO and asserted reset.
1315 */
1316int eeh_pe_get_state(struct eeh_pe *pe)
1317{
1318 int result, ret = 0;
1319 bool rst_active, dma_en, mmio_en;
1320
1321 /* Existing PE ? */
1322 if (!pe)
1323 return -ENODEV;
1324
1325 if (!eeh_ops || !eeh_ops->get_state)
1326 return -ENOENT;
1327
1328 result = eeh_ops->get_state(pe, NULL);
1329 rst_active = !!(result & EEH_STATE_RESET_ACTIVE);
1330 dma_en = !!(result & EEH_STATE_DMA_ENABLED);
1331 mmio_en = !!(result & EEH_STATE_MMIO_ENABLED);
1332
1333 if (rst_active)
1334 ret = EEH_PE_STATE_RESET;
1335 else if (dma_en && mmio_en)
1336 ret = EEH_PE_STATE_NORMAL;
1337 else if (!dma_en && !mmio_en)
1338 ret = EEH_PE_STATE_STOPPED_IO_DMA;
1339 else if (!dma_en && mmio_en)
1340 ret = EEH_PE_STATE_STOPPED_DMA;
1341 else
1342 ret = EEH_PE_STATE_UNAVAIL;
1343
1344 return ret;
1345}
1346EXPORT_SYMBOL_GPL(eeh_pe_get_state);
1347
1348/**
1349 * eeh_pe_reset - Issue PE reset according to specified type
1350 * @pe: EEH PE
1351 * @option: reset type
1352 *
1353 * The routine is called to reset the specified PE with the
1354 * indicated type, either fundamental reset or hot reset.
1355 * PE reset is the most important part for error recovery.
1356 */
1357int eeh_pe_reset(struct eeh_pe *pe, int option)
1358{
1359 int ret = 0;
1360
1361 /* Invalid PE ? */
1362 if (!pe)
1363 return -ENODEV;
1364
1365 if (!eeh_ops || !eeh_ops->set_option || !eeh_ops->reset)
1366 return -ENOENT;
1367
1368 switch (option) {
1369 case EEH_RESET_DEACTIVATE:
1370 ret = eeh_ops->reset(pe, option);
1371 if (ret)
1372 break;
1373
1374 /*
1375 * The PE is still in frozen state and we need to clear
1376 * that. It's good to clear frozen state after deassert
1377 * to avoid messy IO access during reset, which might
1378 * cause recursive frozen PE.
1379 */
1380 ret = eeh_ops->set_option(pe, EEH_OPT_THAW_MMIO);
1381 if (!ret)
1382 ret = eeh_ops->set_option(pe, EEH_OPT_THAW_DMA);
1383 if (!ret)
1384 eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
1385 break;
1386 case EEH_RESET_HOT:
1387 case EEH_RESET_FUNDAMENTAL:
1388 ret = eeh_ops->reset(pe, option);
1389 break;
1390 default:
1391 pr_debug("%s: Unsupported option %d\n",
1392 __func__, option);
1393 ret = -EINVAL;
1394 }
1395
1396 return ret;
1397}
1398EXPORT_SYMBOL_GPL(eeh_pe_reset);
1399
1400/**
1401 * eeh_pe_configure - Configure PCI bridges after PE reset
1402 * @pe: EEH PE
1403 *
1404 * The routine is called to restore the PCI config space for
1405 * those PCI devices, especially PCI bridges affected by PE
1406 * reset issued previously.
1407 */
1408int eeh_pe_configure(struct eeh_pe *pe)
1409{
1410 int ret = 0;
1411
1412 /* Invalid PE ? */
1413 if (!pe)
1414 return -ENODEV;
1415
1416 /* Restore config space for the affected devices */
1417 eeh_pe_restore_bars(pe);
1418
1419 return ret;
1420}
1421EXPORT_SYMBOL_GPL(eeh_pe_configure);
1422
1103static int proc_eeh_show(struct seq_file *m, void *v) 1423static int proc_eeh_show(struct seq_file *m, void *v)
1104{ 1424{
1105 if (!eeh_enabled()) { 1425 if (!eeh_enabled()) {
@@ -1143,9 +1463,9 @@ static const struct file_operations proc_eeh_operations = {
1143static int eeh_enable_dbgfs_set(void *data, u64 val) 1463static int eeh_enable_dbgfs_set(void *data, u64 val)
1144{ 1464{
1145 if (val) 1465 if (val)
1146 eeh_subsystem_flags &= ~EEH_FORCE_DISABLED; 1466 eeh_clear_flag(EEH_FORCE_DISABLED);
1147 else 1467 else
1148 eeh_subsystem_flags |= EEH_FORCE_DISABLED; 1468 eeh_add_flag(EEH_FORCE_DISABLED);
1149 1469
1150 /* Notify the backend */ 1470 /* Notify the backend */
1151 if (eeh_ops->post_init) 1471 if (eeh_ops->post_init)
diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c
index e8c9fd546a5c..07d8a2423a61 100644
--- a/arch/powerpc/kernel/eeh_cache.c
+++ b/arch/powerpc/kernel/eeh_cache.c
@@ -143,7 +143,7 @@ eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
143 } else { 143 } else {
144 if (dev != piar->pcidev || 144 if (dev != piar->pcidev ||
145 alo != piar->addr_lo || ahi != piar->addr_hi) { 145 alo != piar->addr_lo || ahi != piar->addr_hi) {
146 pr_warning("PIAR: overlapping address range\n"); 146 pr_warn("PIAR: overlapping address range\n");
147 } 147 }
148 return piar; 148 return piar;
149 } 149 }
@@ -177,19 +177,20 @@ static void __eeh_addr_cache_insert_dev(struct pci_dev *dev)
177 177
178 dn = pci_device_to_OF_node(dev); 178 dn = pci_device_to_OF_node(dev);
179 if (!dn) { 179 if (!dn) {
180 pr_warning("PCI: no pci dn found for dev=%s\n", pci_name(dev)); 180 pr_warn("PCI: no pci dn found for dev=%s\n",
181 pci_name(dev));
181 return; 182 return;
182 } 183 }
183 184
184 edev = of_node_to_eeh_dev(dn); 185 edev = of_node_to_eeh_dev(dn);
185 if (!edev) { 186 if (!edev) {
186 pr_warning("PCI: no EEH dev found for dn=%s\n", 187 pr_warn("PCI: no EEH dev found for dn=%s\n",
187 dn->full_name); 188 dn->full_name);
188 return; 189 return;
189 } 190 }
190 191
191 /* Skip any devices for which EEH is not enabled. */ 192 /* Skip any devices for which EEH is not enabled. */
192 if (!eeh_probe_mode_dev() && !edev->pe) { 193 if (!edev->pe) {
193#ifdef DEBUG 194#ifdef DEBUG
194 pr_info("PCI: skip building address cache for=%s - %s\n", 195 pr_info("PCI: skip building address cache for=%s - %s\n",
195 pci_name(dev), dn->full_name); 196 pci_name(dev), dn->full_name);
diff --git a/arch/powerpc/kernel/eeh_dev.c b/arch/powerpc/kernel/eeh_dev.c
index 1efa28f5fc54..e5274ee9a75f 100644
--- a/arch/powerpc/kernel/eeh_dev.c
+++ b/arch/powerpc/kernel/eeh_dev.c
@@ -57,7 +57,8 @@ void *eeh_dev_init(struct device_node *dn, void *data)
57 /* Allocate EEH device */ 57 /* Allocate EEH device */
58 edev = kzalloc(sizeof(*edev), GFP_KERNEL); 58 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
59 if (!edev) { 59 if (!edev) {
60 pr_warning("%s: out of memory\n", __func__); 60 pr_warn("%s: out of memory\n",
61 __func__);
61 return NULL; 62 return NULL;
62 } 63 }
63 64
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 420da61d4ce0..6a0dcee8e931 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -599,7 +599,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
599 pe->freeze_count++; 599 pe->freeze_count++;
600 if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES) 600 if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES)
601 goto excess_failures; 601 goto excess_failures;
602 pr_warning("EEH: This PCI device has failed %d times in the last hour\n", 602 pr_warn("EEH: This PCI device has failed %d times in the last hour\n",
603 pe->freeze_count); 603 pe->freeze_count);
604 604
605 /* Walk the various device drivers attached to this slot through 605 /* Walk the various device drivers attached to this slot through
@@ -616,7 +616,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
616 */ 616 */
617 rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000); 617 rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000);
618 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) { 618 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) {
619 pr_warning("EEH: Permanent failure\n"); 619 pr_warn("EEH: Permanent failure\n");
620 goto hard_fail; 620 goto hard_fail;
621 } 621 }
622 622
@@ -635,8 +635,8 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
635 pr_info("EEH: Reset with hotplug activity\n"); 635 pr_info("EEH: Reset with hotplug activity\n");
636 rc = eeh_reset_device(pe, frozen_bus); 636 rc = eeh_reset_device(pe, frozen_bus);
637 if (rc) { 637 if (rc) {
638 pr_warning("%s: Unable to reset, err=%d\n", 638 pr_warn("%s: Unable to reset, err=%d\n",
639 __func__, rc); 639 __func__, rc);
640 goto hard_fail; 640 goto hard_fail;
641 } 641 }
642 } 642 }
@@ -678,7 +678,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
678 678
679 /* If any device has a hard failure, then shut off everything. */ 679 /* If any device has a hard failure, then shut off everything. */
680 if (result == PCI_ERS_RESULT_DISCONNECT) { 680 if (result == PCI_ERS_RESULT_DISCONNECT) {
681 pr_warning("EEH: Device driver gave up\n"); 681 pr_warn("EEH: Device driver gave up\n");
682 goto hard_fail; 682 goto hard_fail;
683 } 683 }
684 684
@@ -687,8 +687,8 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
687 pr_info("EEH: Reset without hotplug activity\n"); 687 pr_info("EEH: Reset without hotplug activity\n");
688 rc = eeh_reset_device(pe, NULL); 688 rc = eeh_reset_device(pe, NULL);
689 if (rc) { 689 if (rc) {
690 pr_warning("%s: Cannot reset, err=%d\n", 690 pr_warn("%s: Cannot reset, err=%d\n",
691 __func__, rc); 691 __func__, rc);
692 goto hard_fail; 692 goto hard_fail;
693 } 693 }
694 694
@@ -701,7 +701,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)
701 /* All devices should claim they have recovered by now. */ 701 /* All devices should claim they have recovered by now. */
702 if ((result != PCI_ERS_RESULT_RECOVERED) && 702 if ((result != PCI_ERS_RESULT_RECOVERED) &&
703 (result != PCI_ERS_RESULT_NONE)) { 703 (result != PCI_ERS_RESULT_NONE)) {
704 pr_warning("EEH: Not recovered\n"); 704 pr_warn("EEH: Not recovered\n");
705 goto hard_fail; 705 goto hard_fail;
706 } 706 }
707 707
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index fbd01eba4473..00e3844525a6 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -32,9 +32,24 @@
32#include <asm/pci-bridge.h> 32#include <asm/pci-bridge.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34 34
35static int eeh_pe_aux_size = 0;
35static LIST_HEAD(eeh_phb_pe); 36static LIST_HEAD(eeh_phb_pe);
36 37
37/** 38/**
39 * eeh_set_pe_aux_size - Set PE auxillary data size
40 * @size: PE auxillary data size
41 *
42 * Set PE auxillary data size
43 */
44void eeh_set_pe_aux_size(int size)
45{
46 if (size < 0)
47 return;
48
49 eeh_pe_aux_size = size;
50}
51
52/**
38 * eeh_pe_alloc - Allocate PE 53 * eeh_pe_alloc - Allocate PE
39 * @phb: PCI controller 54 * @phb: PCI controller
40 * @type: PE type 55 * @type: PE type
@@ -44,9 +59,16 @@ static LIST_HEAD(eeh_phb_pe);
44static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type) 59static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
45{ 60{
46 struct eeh_pe *pe; 61 struct eeh_pe *pe;
62 size_t alloc_size;
63
64 alloc_size = sizeof(struct eeh_pe);
65 if (eeh_pe_aux_size) {
66 alloc_size = ALIGN(alloc_size, cache_line_size());
67 alloc_size += eeh_pe_aux_size;
68 }
47 69
48 /* Allocate PHB PE */ 70 /* Allocate PHB PE */
49 pe = kzalloc(sizeof(struct eeh_pe), GFP_KERNEL); 71 pe = kzalloc(alloc_size, GFP_KERNEL);
50 if (!pe) return NULL; 72 if (!pe) return NULL;
51 73
52 /* Initialize PHB PE */ 74 /* Initialize PHB PE */
@@ -56,6 +78,8 @@ static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
56 INIT_LIST_HEAD(&pe->child); 78 INIT_LIST_HEAD(&pe->child);
57 INIT_LIST_HEAD(&pe->edevs); 79 INIT_LIST_HEAD(&pe->edevs);
58 80
81 pe->data = (void *)pe + ALIGN(sizeof(struct eeh_pe),
82 cache_line_size());
59 return pe; 83 return pe;
60} 84}
61 85
@@ -179,7 +203,8 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
179 void *ret; 203 void *ret;
180 204
181 if (!root) { 205 if (!root) {
182 pr_warning("%s: Invalid PE %p\n", __func__, root); 206 pr_warn("%s: Invalid PE %p\n",
207 __func__, root);
183 return NULL; 208 return NULL;
184 } 209 }
185 210
@@ -351,17 +376,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
351 pe->config_addr = edev->config_addr; 376 pe->config_addr = edev->config_addr;
352 377
353 /* 378 /*
354 * While doing PE reset, we probably hot-reset the
355 * upstream bridge. However, the PCI devices including
356 * the associated EEH devices might be removed when EEH
357 * core is doing recovery. So that won't safe to retrieve
358 * the bridge through downstream EEH device. We have to
359 * trace the parent PCI bus, then the upstream bridge.
360 */
361 if (eeh_probe_mode_dev())
362 pe->bus = eeh_dev_to_pci_dev(edev)->bus;
363
364 /*
365 * Put the new EEH PE into hierarchy tree. If the parent 379 * Put the new EEH PE into hierarchy tree. If the parent
366 * can't be found, the newly created PE will be attached 380 * can't be found, the newly created PE will be attached
367 * to PHB directly. Otherwise, we have to associate the 381 * to PHB directly. Otherwise, we have to associate the
@@ -802,53 +816,33 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)
802 */ 816 */
803const char *eeh_pe_loc_get(struct eeh_pe *pe) 817const char *eeh_pe_loc_get(struct eeh_pe *pe)
804{ 818{
805 struct pci_controller *hose;
806 struct pci_bus *bus = eeh_pe_bus_get(pe); 819 struct pci_bus *bus = eeh_pe_bus_get(pe);
807 struct pci_dev *pdev; 820 struct device_node *dn = pci_bus_to_OF_node(bus);
808 struct device_node *dn; 821 const char *loc = NULL;
809 const char *loc;
810 822
811 if (!bus) 823 if (!dn)
812 return "N/A"; 824 goto out;
813 825
814 /* PHB PE or root PE ? */ 826 /* PHB PE or root PE ? */
815 if (pci_is_root_bus(bus)) { 827 if (pci_is_root_bus(bus)) {
816 hose = pci_bus_to_host(bus); 828 loc = of_get_property(dn, "ibm,loc-code", NULL);
817 loc = of_get_property(hose->dn, 829 if (!loc)
818 "ibm,loc-code", NULL); 830 loc = of_get_property(dn, "ibm,io-base-loc-code", NULL);
819 if (loc) 831 if (loc)
820 return loc; 832 goto out;
821 loc = of_get_property(hose->dn,
822 "ibm,io-base-loc-code", NULL);
823 if (loc)
824 return loc;
825
826 pdev = pci_get_slot(bus, 0x0);
827 } else {
828 pdev = bus->self;
829 }
830
831 if (!pdev) {
832 loc = "N/A";
833 goto out;
834 }
835 833
836 dn = pci_device_to_OF_node(pdev); 834 /* Check the root port */
837 if (!dn) { 835 dn = dn->child;
838 loc = "N/A"; 836 if (!dn)
839 goto out; 837 goto out;
840 } 838 }
841 839
842 loc = of_get_property(dn, "ibm,loc-code", NULL); 840 loc = of_get_property(dn, "ibm,loc-code", NULL);
843 if (!loc) 841 if (!loc)
844 loc = of_get_property(dn, "ibm,slot-location-code", NULL); 842 loc = of_get_property(dn, "ibm,slot-location-code", NULL);
845 if (!loc)
846 loc = "N/A";
847 843
848out: 844out:
849 if (pci_is_root_bus(bus) && pdev) 845 return loc ? loc : "N/A";
850 pci_dev_put(pdev);
851 return loc;
852} 846}
853 847
854/** 848/**
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 6528c5e2cc44..5bbd1bc8c3b0 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -482,16 +482,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_STCX_CHECKS_ADDRESS)
482 ld r8,KSP(r4) /* new stack pointer */ 482 ld r8,KSP(r4) /* new stack pointer */
483#ifdef CONFIG_PPC_BOOK3S 483#ifdef CONFIG_PPC_BOOK3S
484BEGIN_FTR_SECTION 484BEGIN_FTR_SECTION
485 BEGIN_FTR_SECTION_NESTED(95)
486 clrrdi r6,r8,28 /* get its ESID */ 485 clrrdi r6,r8,28 /* get its ESID */
487 clrrdi r9,r1,28 /* get current sp ESID */ 486 clrrdi r9,r1,28 /* get current sp ESID */
488 FTR_SECTION_ELSE_NESTED(95) 487FTR_SECTION_ELSE
489 clrrdi r6,r8,40 /* get its 1T ESID */ 488 clrrdi r6,r8,40 /* get its 1T ESID */
490 clrrdi r9,r1,40 /* get current sp 1T ESID */ 489 clrrdi r9,r1,40 /* get current sp 1T ESID */
491 ALT_MMU_FTR_SECTION_END_NESTED_IFCLR(MMU_FTR_1T_SEGMENT, 95) 490ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_1T_SEGMENT)
492FTR_SECTION_ELSE
493 b 2f
494ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_SLB)
495 clrldi. r0,r6,2 /* is new ESID c00000000? */ 491 clrldi. r0,r6,2 /* is new ESID c00000000? */
496 cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */ 492 cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */
497 cror eq,4*cr1+eq,eq 493 cror eq,4*cr1+eq,eq
@@ -919,6 +915,11 @@ restore_check_irq_replay:
919 addi r3,r1,STACK_FRAME_OVERHEAD; 915 addi r3,r1,STACK_FRAME_OVERHEAD;
920 bl do_IRQ 916 bl do_IRQ
921 b ret_from_except 917 b ret_from_except
9181: cmpwi cr0,r3,0xe60
919 bne 1f
920 addi r3,r1,STACK_FRAME_OVERHEAD;
921 bl handle_hmi_exception
922 b ret_from_except
9221: cmpwi cr0,r3,0x900 9231: cmpwi cr0,r3,0x900
923 bne 1f 924 bne 1f
924 addi r3,r1,STACK_FRAME_OVERHEAD; 925 addi r3,r1,STACK_FRAME_OVERHEAD;
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index a7d36b19221d..050f79a4a168 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -188,10 +188,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
188data_access_pSeries: 188data_access_pSeries:
189 HMT_MEDIUM_PPR_DISCARD 189 HMT_MEDIUM_PPR_DISCARD
190 SET_SCRATCH0(r13) 190 SET_SCRATCH0(r13)
191BEGIN_FTR_SECTION
192 b data_access_check_stab
193data_access_not_stab:
194END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
195 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD, 191 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
196 KVMTEST, 0x300) 192 KVMTEST, 0x300)
197 193
@@ -339,7 +335,7 @@ emulation_assist_trampoline:
339hv_exception_trampoline: 335hv_exception_trampoline:
340 SET_SCRATCH0(r13) 336 SET_SCRATCH0(r13)
341 EXCEPTION_PROLOG_0(PACA_EXGEN) 337 EXCEPTION_PROLOG_0(PACA_EXGEN)
342 b hmi_exception_hv 338 b hmi_exception_early
343 339
344 . = 0xe80 340 . = 0xe80
345hv_doorbell_trampoline: 341hv_doorbell_trampoline:
@@ -514,34 +510,6 @@ machine_check_pSeries_0:
514 EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200) 510 EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200)
515 EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD) 511 EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD)
516 KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200) 512 KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200)
517
518 /* moved from 0x300 */
519data_access_check_stab:
520 GET_PACA(r13)
521 std r9,PACA_EXSLB+EX_R9(r13)
522 std r10,PACA_EXSLB+EX_R10(r13)
523 mfspr r10,SPRN_DAR
524 mfspr r9,SPRN_DSISR
525 srdi r10,r10,60
526 rlwimi r10,r9,16,0x20
527#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
528 lbz r9,HSTATE_IN_GUEST(r13)
529 rlwimi r10,r9,8,0x300
530#endif
531 mfcr r9
532 cmpwi r10,0x2c
533 beq do_stab_bolted_pSeries
534 mtcrf 0x80,r9
535 ld r9,PACA_EXSLB+EX_R9(r13)
536 ld r10,PACA_EXSLB+EX_R10(r13)
537 b data_access_not_stab
538do_stab_bolted_pSeries:
539 std r11,PACA_EXSLB+EX_R11(r13)
540 std r12,PACA_EXSLB+EX_R12(r13)
541 GET_SCRATCH0(r10)
542 std r10,PACA_EXSLB+EX_R13(r13)
543 EXCEPTION_PROLOG_PSERIES_1(do_stab_bolted, EXC_STD)
544
545 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300) 513 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
546 KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380) 514 KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
547 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x400) 515 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x400)
@@ -621,8 +589,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
621 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22) 589 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22)
622 STD_EXCEPTION_HV_OOL(0xe42, emulation_assist) 590 STD_EXCEPTION_HV_OOL(0xe42, emulation_assist)
623 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42) 591 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42)
624 STD_EXCEPTION_HV_OOL(0xe62, hmi_exception) /* need to flush cache ? */ 592 MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception)
625 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62) 593 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
594
626 MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell) 595 MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
627 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82) 596 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
628 597
@@ -643,6 +612,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
643 * - If it was a decrementer interrupt, we bump the dec to max and and return. 612 * - If it was a decrementer interrupt, we bump the dec to max and and return.
644 * - If it was a doorbell we return immediately since doorbells are edge 613 * - If it was a doorbell we return immediately since doorbells are edge
645 * triggered and won't automatically refire. 614 * triggered and won't automatically refire.
615 * - If it was a HMI we return immediately since we handled it in realmode
616 * and it won't refire.
646 * - else we hard disable and return. 617 * - else we hard disable and return.
647 * This is called with r10 containing the value to OR to the paca field. 618 * This is called with r10 containing the value to OR to the paca field.
648 */ 619 */
@@ -660,6 +631,8 @@ masked_##_H##interrupt: \
660 b 2f; \ 631 b 2f; \
6611: cmpwi r10,PACA_IRQ_DBELL; \ 6321: cmpwi r10,PACA_IRQ_DBELL; \
662 beq 2f; \ 633 beq 2f; \
634 cmpwi r10,PACA_IRQ_HMI; \
635 beq 2f; \
663 mfspr r10,SPRN_##_H##SRR1; \ 636 mfspr r10,SPRN_##_H##SRR1; \
664 rldicl r10,r10,48,1; /* clear MSR_EE */ \ 637 rldicl r10,r10,48,1; /* clear MSR_EE */ \
665 rotldi r10,r10,16; \ 638 rotldi r10,r10,16; \
@@ -799,7 +772,7 @@ kvmppc_skip_Hinterrupt:
799 STD_EXCEPTION_COMMON(0xd00, single_step, single_step_exception) 772 STD_EXCEPTION_COMMON(0xd00, single_step, single_step_exception)
800 STD_EXCEPTION_COMMON(0xe00, trap_0e, unknown_exception) 773 STD_EXCEPTION_COMMON(0xe00, trap_0e, unknown_exception)
801 STD_EXCEPTION_COMMON(0xe40, emulation_assist, emulation_assist_interrupt) 774 STD_EXCEPTION_COMMON(0xe40, emulation_assist, emulation_assist_interrupt)
802 STD_EXCEPTION_COMMON(0xe60, hmi_exception, unknown_exception) 775 STD_EXCEPTION_COMMON_ASYNC(0xe60, hmi_exception, handle_hmi_exception)
803#ifdef CONFIG_PPC_DOORBELL 776#ifdef CONFIG_PPC_DOORBELL
804 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, doorbell_exception) 777 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, doorbell_exception)
805#else 778#else
@@ -985,66 +958,6 @@ ppc64_runlatch_on_trampoline:
985 b __ppc64_runlatch_on 958 b __ppc64_runlatch_on
986 959
987/* 960/*
988 * Here we have detected that the kernel stack pointer is bad.
989 * R9 contains the saved CR, r13 points to the paca,
990 * r10 contains the (bad) kernel stack pointer,
991 * r11 and r12 contain the saved SRR0 and SRR1.
992 * We switch to using an emergency stack, save the registers there,
993 * and call kernel_bad_stack(), which panics.
994 */
995bad_stack:
996 ld r1,PACAEMERGSP(r13)
997 subi r1,r1,64+INT_FRAME_SIZE
998 std r9,_CCR(r1)
999 std r10,GPR1(r1)
1000 std r11,_NIP(r1)
1001 std r12,_MSR(r1)
1002 mfspr r11,SPRN_DAR
1003 mfspr r12,SPRN_DSISR
1004 std r11,_DAR(r1)
1005 std r12,_DSISR(r1)
1006 mflr r10
1007 mfctr r11
1008 mfxer r12
1009 std r10,_LINK(r1)
1010 std r11,_CTR(r1)
1011 std r12,_XER(r1)
1012 SAVE_GPR(0,r1)
1013 SAVE_GPR(2,r1)
1014 ld r10,EX_R3(r3)
1015 std r10,GPR3(r1)
1016 SAVE_GPR(4,r1)
1017 SAVE_4GPRS(5,r1)
1018 ld r9,EX_R9(r3)
1019 ld r10,EX_R10(r3)
1020 SAVE_2GPRS(9,r1)
1021 ld r9,EX_R11(r3)
1022 ld r10,EX_R12(r3)
1023 ld r11,EX_R13(r3)
1024 std r9,GPR11(r1)
1025 std r10,GPR12(r1)
1026 std r11,GPR13(r1)
1027BEGIN_FTR_SECTION
1028 ld r10,EX_CFAR(r3)
1029 std r10,ORIG_GPR3(r1)
1030END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
1031 SAVE_8GPRS(14,r1)
1032 SAVE_10GPRS(22,r1)
1033 lhz r12,PACA_TRAP_SAVE(r13)
1034 std r12,_TRAP(r1)
1035 addi r11,r1,INT_FRAME_SIZE
1036 std r11,0(r1)
1037 li r12,0
1038 std r12,0(r11)
1039 ld r2,PACATOC(r13)
1040 ld r11,exception_marker@toc(r2)
1041 std r12,RESULT(r1)
1042 std r11,STACK_FRAME_OVERHEAD-16(r1)
10431: addi r3,r1,STACK_FRAME_OVERHEAD
1044 bl kernel_bad_stack
1045 b 1b
1046
1047/*
1048 * Here r13 points to the paca, r9 contains the saved CR, 961 * Here r13 points to the paca, r9 contains the saved CR,
1049 * SRR0 and SRR1 are saved in r11 and r12, 962 * SRR0 and SRR1 are saved in r11 and r12,
1050 * r9 - r13 are saved in paca->exgen. 963 * r9 - r13 are saved in paca->exgen.
@@ -1057,7 +970,7 @@ data_access_common:
1057 mfspr r10,SPRN_DSISR 970 mfspr r10,SPRN_DSISR
1058 stw r10,PACA_EXGEN+EX_DSISR(r13) 971 stw r10,PACA_EXGEN+EX_DSISR(r13)
1059 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN) 972 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
1060 DISABLE_INTS 973 RECONCILE_IRQ_STATE(r10, r11)
1061 ld r12,_MSR(r1) 974 ld r12,_MSR(r1)
1062 ld r3,PACA_EXGEN+EX_DAR(r13) 975 ld r3,PACA_EXGEN+EX_DAR(r13)
1063 lwz r4,PACA_EXGEN+EX_DSISR(r13) 976 lwz r4,PACA_EXGEN+EX_DSISR(r13)
@@ -1073,7 +986,7 @@ h_data_storage_common:
1073 stw r10,PACA_EXGEN+EX_DSISR(r13) 986 stw r10,PACA_EXGEN+EX_DSISR(r13)
1074 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN) 987 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
1075 bl save_nvgprs 988 bl save_nvgprs
1076 DISABLE_INTS 989 RECONCILE_IRQ_STATE(r10, r11)
1077 addi r3,r1,STACK_FRAME_OVERHEAD 990 addi r3,r1,STACK_FRAME_OVERHEAD
1078 bl unknown_exception 991 bl unknown_exception
1079 b ret_from_except 992 b ret_from_except
@@ -1082,7 +995,7 @@ h_data_storage_common:
1082 .globl instruction_access_common 995 .globl instruction_access_common
1083instruction_access_common: 996instruction_access_common:
1084 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) 997 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
1085 DISABLE_INTS 998 RECONCILE_IRQ_STATE(r10, r11)
1086 ld r12,_MSR(r1) 999 ld r12,_MSR(r1)
1087 ld r3,_NIP(r1) 1000 ld r3,_NIP(r1)
1088 andis. r4,r12,0x5820 1001 andis. r4,r12,0x5820
@@ -1146,7 +1059,7 @@ slb_miss_fault:
1146 1059
1147unrecov_user_slb: 1060unrecov_user_slb:
1148 EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN) 1061 EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
1149 DISABLE_INTS 1062 RECONCILE_IRQ_STATE(r10, r11)
1150 bl save_nvgprs 1063 bl save_nvgprs
11511: addi r3,r1,STACK_FRAME_OVERHEAD 10641: addi r3,r1,STACK_FRAME_OVERHEAD
1152 bl unrecoverable_exception 1065 bl unrecoverable_exception
@@ -1169,7 +1082,7 @@ machine_check_common:
1169 stw r10,PACA_EXGEN+EX_DSISR(r13) 1082 stw r10,PACA_EXGEN+EX_DSISR(r13)
1170 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) 1083 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
1171 FINISH_NAP 1084 FINISH_NAP
1172 DISABLE_INTS 1085 RECONCILE_IRQ_STATE(r10, r11)
1173 ld r3,PACA_EXGEN+EX_DAR(r13) 1086 ld r3,PACA_EXGEN+EX_DAR(r13)
1174 lwz r4,PACA_EXGEN+EX_DSISR(r13) 1087 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1175 std r3,_DAR(r1) 1088 std r3,_DAR(r1)
@@ -1192,7 +1105,7 @@ alignment_common:
1192 std r3,_DAR(r1) 1105 std r3,_DAR(r1)
1193 std r4,_DSISR(r1) 1106 std r4,_DSISR(r1)
1194 bl save_nvgprs 1107 bl save_nvgprs
1195 DISABLE_INTS 1108 RECONCILE_IRQ_STATE(r10, r11)
1196 addi r3,r1,STACK_FRAME_OVERHEAD 1109 addi r3,r1,STACK_FRAME_OVERHEAD
1197 bl alignment_exception 1110 bl alignment_exception
1198 b ret_from_except 1111 b ret_from_except
@@ -1202,7 +1115,7 @@ alignment_common:
1202program_check_common: 1115program_check_common:
1203 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) 1116 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
1204 bl save_nvgprs 1117 bl save_nvgprs
1205 DISABLE_INTS 1118 RECONCILE_IRQ_STATE(r10, r11)
1206 addi r3,r1,STACK_FRAME_OVERHEAD 1119 addi r3,r1,STACK_FRAME_OVERHEAD
1207 bl program_check_exception 1120 bl program_check_exception
1208 b ret_from_except 1121 b ret_from_except
@@ -1213,7 +1126,7 @@ fp_unavailable_common:
1213 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN) 1126 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
1214 bne 1f /* if from user, just load it up */ 1127 bne 1f /* if from user, just load it up */
1215 bl save_nvgprs 1128 bl save_nvgprs
1216 DISABLE_INTS 1129 RECONCILE_IRQ_STATE(r10, r11)
1217 addi r3,r1,STACK_FRAME_OVERHEAD 1130 addi r3,r1,STACK_FRAME_OVERHEAD
1218 bl kernel_fp_unavailable_exception 1131 bl kernel_fp_unavailable_exception
1219 BUG_OPCODE 1132 BUG_OPCODE
@@ -1232,7 +1145,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)
1232#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1145#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12332: /* User process was in a transaction */ 11462: /* User process was in a transaction */
1234 bl save_nvgprs 1147 bl save_nvgprs
1235 DISABLE_INTS 1148 RECONCILE_IRQ_STATE(r10, r11)
1236 addi r3,r1,STACK_FRAME_OVERHEAD 1149 addi r3,r1,STACK_FRAME_OVERHEAD
1237 bl fp_unavailable_tm 1150 bl fp_unavailable_tm
1238 b ret_from_except 1151 b ret_from_except
@@ -1258,7 +1171,7 @@ BEGIN_FTR_SECTION
1258#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1171#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12592: /* User process was in a transaction */ 11722: /* User process was in a transaction */
1260 bl save_nvgprs 1173 bl save_nvgprs
1261 DISABLE_INTS 1174 RECONCILE_IRQ_STATE(r10, r11)
1262 addi r3,r1,STACK_FRAME_OVERHEAD 1175 addi r3,r1,STACK_FRAME_OVERHEAD
1263 bl altivec_unavailable_tm 1176 bl altivec_unavailable_tm
1264 b ret_from_except 1177 b ret_from_except
@@ -1267,7 +1180,7 @@ BEGIN_FTR_SECTION
1267END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 1180END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1268#endif 1181#endif
1269 bl save_nvgprs 1182 bl save_nvgprs
1270 DISABLE_INTS 1183 RECONCILE_IRQ_STATE(r10, r11)
1271 addi r3,r1,STACK_FRAME_OVERHEAD 1184 addi r3,r1,STACK_FRAME_OVERHEAD
1272 bl altivec_unavailable_exception 1185 bl altivec_unavailable_exception
1273 b ret_from_except 1186 b ret_from_except
@@ -1292,7 +1205,7 @@ BEGIN_FTR_SECTION
1292#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1205#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12932: /* User process was in a transaction */ 12062: /* User process was in a transaction */
1294 bl save_nvgprs 1207 bl save_nvgprs
1295 DISABLE_INTS 1208 RECONCILE_IRQ_STATE(r10, r11)
1296 addi r3,r1,STACK_FRAME_OVERHEAD 1209 addi r3,r1,STACK_FRAME_OVERHEAD
1297 bl vsx_unavailable_tm 1210 bl vsx_unavailable_tm
1298 b ret_from_except 1211 b ret_from_except
@@ -1301,7 +1214,7 @@ BEGIN_FTR_SECTION
1301END_FTR_SECTION_IFSET(CPU_FTR_VSX) 1214END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1302#endif 1215#endif
1303 bl save_nvgprs 1216 bl save_nvgprs
1304 DISABLE_INTS 1217 RECONCILE_IRQ_STATE(r10, r11)
1305 addi r3,r1,STACK_FRAME_OVERHEAD 1218 addi r3,r1,STACK_FRAME_OVERHEAD
1306 bl vsx_unavailable_exception 1219 bl vsx_unavailable_exception
1307 b ret_from_except 1220 b ret_from_except
@@ -1338,11 +1251,60 @@ fwnmi_data_area:
1338 . = 0x8000 1251 . = 0x8000
1339#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */ 1252#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
1340 1253
1341/* Space for CPU0's segment table */ 1254 .globl hmi_exception_early
1342 .balign 4096 1255hmi_exception_early:
1343 .globl initial_stab 1256 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
1344initial_stab: 1257 mr r10,r1 /* Save r1 */
1345 .space 4096 1258 ld r1,PACAEMERGSP(r13) /* Use emergency stack */
1259 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
1260 std r9,_CCR(r1) /* save CR in stackframe */
1261 mfspr r11,SPRN_HSRR0 /* Save HSRR0 */
1262 std r11,_NIP(r1) /* save HSRR0 in stackframe */
1263 mfspr r12,SPRN_HSRR1 /* Save SRR1 */
1264 std r12,_MSR(r1) /* save SRR1 in stackframe */
1265 std r10,0(r1) /* make stack chain pointer */
1266 std r0,GPR0(r1) /* save r0 in stackframe */
1267 std r10,GPR1(r1) /* save r1 in stackframe */
1268 EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
1269 EXCEPTION_PROLOG_COMMON_3(0xe60)
1270 addi r3,r1,STACK_FRAME_OVERHEAD
1271 bl hmi_exception_realmode
1272 /* Windup the stack. */
1273 /* Clear MSR_RI before setting SRR0 and SRR1. */
1274 li r0,MSR_RI
1275 mfmsr r9 /* get MSR value */
1276 andc r9,r9,r0
1277 mtmsrd r9,1 /* Clear MSR_RI */
1278 /* Move original HSRR0 and HSRR1 into the respective regs */
1279 ld r9,_MSR(r1)
1280 mtspr SPRN_HSRR1,r9
1281 ld r3,_NIP(r1)
1282 mtspr SPRN_HSRR0,r3
1283 ld r9,_CTR(r1)
1284 mtctr r9
1285 ld r9,_XER(r1)
1286 mtxer r9
1287 ld r9,_LINK(r1)
1288 mtlr r9
1289 REST_GPR(0, r1)
1290 REST_8GPRS(2, r1)
1291 REST_GPR(10, r1)
1292 ld r11,_CCR(r1)
1293 mtcr r11
1294 REST_GPR(11, r1)
1295 REST_2GPRS(12, r1)
1296 /* restore original r1. */
1297 ld r1,GPR1(r1)
1298
1299 /*
1300 * Go to virtual mode and pull the HMI event information from
1301 * firmware.
1302 */
1303 .globl hmi_exception_after_realmode
1304hmi_exception_after_realmode:
1305 SET_SCRATCH0(r13)
1306 EXCEPTION_PROLOG_0(PACA_EXGEN)
1307 b hmi_exception_hv
1346 1308
1347#ifdef CONFIG_PPC_POWERNV 1309#ifdef CONFIG_PPC_POWERNV
1348_GLOBAL(opal_mc_secondary_handler) 1310_GLOBAL(opal_mc_secondary_handler)
@@ -1566,7 +1528,7 @@ slb_miss_realmode:
1566 1528
1567unrecov_slb: 1529unrecov_slb:
1568 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB) 1530 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
1569 DISABLE_INTS 1531 RECONCILE_IRQ_STATE(r10, r11)
1570 bl save_nvgprs 1532 bl save_nvgprs
15711: addi r3,r1,STACK_FRAME_OVERHEAD 15331: addi r3,r1,STACK_FRAME_OVERHEAD
1572 bl unrecoverable_exception 1534 bl unrecoverable_exception
@@ -1594,12 +1556,6 @@ do_hash_page:
1594 bne- handle_page_fault /* if not, try to insert a HPTE */ 1556 bne- handle_page_fault /* if not, try to insert a HPTE */
1595 andis. r0,r4,DSISR_DABRMATCH@h 1557 andis. r0,r4,DSISR_DABRMATCH@h
1596 bne- handle_dabr_fault 1558 bne- handle_dabr_fault
1597
1598BEGIN_FTR_SECTION
1599 andis. r0,r4,0x0020 /* Is it a segment table fault? */
1600 bne- do_ste_alloc /* If so handle it */
1601END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
1602
1603 CURRENT_THREAD_INFO(r11, r1) 1559 CURRENT_THREAD_INFO(r11, r1)
1604 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ 1560 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
1605 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ 1561 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
@@ -1681,113 +1637,62 @@ handle_dabr_fault:
1681 bl bad_page_fault 1637 bl bad_page_fault
1682 b ret_from_except 1638 b ret_from_except
1683 1639
1684 /* here we have a segment miss */
1685do_ste_alloc:
1686 bl ste_allocate /* try to insert stab entry */
1687 cmpdi r3,0
1688 bne- handle_page_fault
1689 b fast_exception_return
1690
1691/* 1640/*
1692 * r13 points to the PACA, r9 contains the saved CR, 1641 * Here we have detected that the kernel stack pointer is bad.
1642 * R9 contains the saved CR, r13 points to the paca,
1643 * r10 contains the (bad) kernel stack pointer,
1693 * r11 and r12 contain the saved SRR0 and SRR1. 1644 * r11 and r12 contain the saved SRR0 and SRR1.
1694 * r9 - r13 are saved in paca->exslb. 1645 * We switch to using an emergency stack, save the registers there,
1695 * We assume we aren't going to take any exceptions during this procedure. 1646 * and call kernel_bad_stack(), which panics.
1696 * We assume (DAR >> 60) == 0xc.
1697 */ 1647 */
1698 .align 7 1648bad_stack:
1699do_stab_bolted: 1649 ld r1,PACAEMERGSP(r13)
1700 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ 1650 subi r1,r1,64+INT_FRAME_SIZE
1701 std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ 1651 std r9,_CCR(r1)
1702 mfspr r11,SPRN_DAR /* ea */ 1652 std r10,GPR1(r1)
1703 1653 std r11,_NIP(r1)
1704 /* 1654 std r12,_MSR(r1)
1705 * check for bad kernel/user address 1655 mfspr r11,SPRN_DAR
1706 * (ea & ~REGION_MASK) >= PGTABLE_RANGE 1656 mfspr r12,SPRN_DSISR
1707 */ 1657 std r11,_DAR(r1)
1708 rldicr. r9,r11,4,(63 - 46 - 4) 1658 std r12,_DSISR(r1)
1709 li r9,0 /* VSID = 0 for bad address */ 1659 mflr r10
1710 bne- 0f 1660 mfctr r11
1711 1661 mfxer r12
1712 /* 1662 std r10,_LINK(r1)
1713 * Calculate VSID: 1663 std r11,_CTR(r1)
1714 * This is the kernel vsid, we take the top for context from 1664 std r12,_XER(r1)
1715 * the range. context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1 1665 SAVE_GPR(0,r1)
1716 * Here we know that (ea >> 60) == 0xc 1666 SAVE_GPR(2,r1)
1717 */ 1667 ld r10,EX_R3(r3)
1718 lis r9,(MAX_USER_CONTEXT + 1)@ha 1668 std r10,GPR3(r1)
1719 addi r9,r9,(MAX_USER_CONTEXT + 1)@l 1669 SAVE_GPR(4,r1)
1720 1670 SAVE_4GPRS(5,r1)
1721 srdi r10,r11,SID_SHIFT 1671 ld r9,EX_R9(r3)
1722 rldimi r10,r9,ESID_BITS,0 /* proto vsid */ 1672 ld r10,EX_R10(r3)
1723 ASM_VSID_SCRAMBLE(r10, r9, 256M) 1673 SAVE_2GPRS(9,r1)
1724 rldic r9,r10,12,16 /* r9 = vsid << 12 */ 1674 ld r9,EX_R11(r3)
1725 1675 ld r10,EX_R12(r3)
17260: 1676 ld r11,EX_R13(r3)
1727 /* Hash to the primary group */ 1677 std r9,GPR11(r1)
1728 ld r10,PACASTABVIRT(r13) 1678 std r10,GPR12(r1)
1729 srdi r11,r11,SID_SHIFT 1679 std r11,GPR13(r1)
1730 rldimi r10,r11,7,52 /* r10 = first ste of the group */ 1680BEGIN_FTR_SECTION
1731 1681 ld r10,EX_CFAR(r3)
1732 /* Search the primary group for a free entry */ 1682 std r10,ORIG_GPR3(r1)
17331: ld r11,0(r10) /* Test valid bit of the current ste */ 1683END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
1734 andi. r11,r11,0x80 1684 SAVE_8GPRS(14,r1)
1735 beq 2f 1685 SAVE_10GPRS(22,r1)
1736 addi r10,r10,16 1686 lhz r12,PACA_TRAP_SAVE(r13)
1737 andi. r11,r10,0x70 1687 std r12,_TRAP(r1)
1738 bne 1b 1688 addi r11,r1,INT_FRAME_SIZE
1739 1689 std r11,0(r1)
1740 /* Stick for only searching the primary group for now. */ 1690 li r12,0
1741 /* At least for now, we use a very simple random castout scheme */ 1691 std r12,0(r11)
1742 /* Use the TB as a random number ; OR in 1 to avoid entry 0 */ 1692 ld r2,PACATOC(r13)
1743 mftb r11 1693 ld r11,exception_marker@toc(r2)
1744 rldic r11,r11,4,57 /* r11 = (r11 << 4) & 0x70 */ 1694 std r12,RESULT(r1)
1745 ori r11,r11,0x10 1695 std r11,STACK_FRAME_OVERHEAD-16(r1)
1746 16961: addi r3,r1,STACK_FRAME_OVERHEAD
1747 /* r10 currently points to an ste one past the group of interest */ 1697 bl kernel_bad_stack
1748 /* make it point to the randomly selected entry */ 1698 b 1b
1749 subi r10,r10,128
1750 or r10,r10,r11 /* r10 is the entry to invalidate */
1751
1752 isync /* mark the entry invalid */
1753 ld r11,0(r10)
1754 rldicl r11,r11,56,1 /* clear the valid bit */
1755 rotldi r11,r11,8
1756 std r11,0(r10)
1757 sync
1758
1759 clrrdi r11,r11,28 /* Get the esid part of the ste */
1760 slbie r11
1761
17622: std r9,8(r10) /* Store the vsid part of the ste */
1763 eieio
1764
1765 mfspr r11,SPRN_DAR /* Get the new esid */
1766 clrrdi r11,r11,28 /* Permits a full 32b of ESID */
1767 ori r11,r11,0x90 /* Turn on valid and kp */
1768 std r11,0(r10) /* Put new entry back into the stab */
1769
1770 sync
1771
1772 /* All done -- return from exception. */
1773 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
1774 ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */
1775
1776 andi. r10,r12,MSR_RI
1777 beq- unrecov_slb
1778
1779 mtcrf 0x80,r9 /* restore CR */
1780
1781 mfmsr r10
1782 clrrdi r10,r10,2
1783 mtmsrd r10,1
1784
1785 mtspr SPRN_SRR0,r11
1786 mtspr SPRN_SRR1,r12
1787 ld r9,PACA_EXSLB+EX_R9(r13)
1788 ld r10,PACA_EXSLB+EX_R10(r13)
1789 ld r11,PACA_EXSLB+EX_R11(r13)
1790 ld r12,PACA_EXSLB+EX_R12(r13)
1791 ld r13,PACA_EXSLB+EX_R13(r13)
1792 rfid
1793 b . /* prevent speculative execution */
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index c334f53453f7..b5061abbd2e0 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -1210,10 +1210,12 @@ clear_utlb_entry:
1210 1210
1211 /* We configure icbi to invalidate 128 bytes at a time since the 1211 /* We configure icbi to invalidate 128 bytes at a time since the
1212 * current 32-bit kernel code isn't too happy with icache != dcache 1212 * current 32-bit kernel code isn't too happy with icache != dcache
1213 * block size 1213 * block size. We also disable the BTAC as this can cause errors
1214 * in some circumstances (see IBM Erratum 47).
1214 */ 1215 */
1215 mfspr r3,SPRN_CCR0 1216 mfspr r3,SPRN_CCR0
1216 oris r3,r3,0x0020 1217 oris r3,r3,0x0020
1218 ori r3,r3,0x0040
1217 mtspr SPRN_CCR0,r3 1219 mtspr SPRN_CCR0,r3
1218 isync 1220 isync
1219 1221
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index a95145d7f61b..d48125d0c048 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -180,6 +180,28 @@ exception_marker:
180#include "exceptions-64s.S" 180#include "exceptions-64s.S"
181#endif 181#endif
182 182
183#ifdef CONFIG_PPC_BOOK3E
184_GLOBAL(fsl_secondary_thread_init)
185 /* Enable branch prediction */
186 lis r3,BUCSR_INIT@h
187 ori r3,r3,BUCSR_INIT@l
188 mtspr SPRN_BUCSR,r3
189 isync
190
191 /*
192 * Fix PIR to match the linear numbering in the device tree.
193 *
194 * On e6500, the reset value of PIR uses the low three bits for
195 * the thread within a core, and the upper bits for the core
196 * number. There are two threads per core, so shift everything
197 * but the low bit right by two bits so that the cpu numbering is
198 * continuous.
199 */
200 mfspr r3, SPRN_PIR
201 rlwimi r3, r3, 30, 2, 30
202 mtspr SPRN_PIR, r3
203#endif
204
183_GLOBAL(generic_secondary_thread_init) 205_GLOBAL(generic_secondary_thread_init)
184 mr r24,r3 206 mr r24,r3
185 207
@@ -618,7 +640,7 @@ __secondary_start:
618 addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD 640 addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD
619 std r14,PACAKSAVE(r13) 641 std r14,PACAKSAVE(r13)
620 642
621 /* Do early setup for that CPU (stab, slb, hash table pointer) */ 643 /* Do early setup for that CPU (SLB and hash table pointer) */
622 bl early_setup_secondary 644 bl early_setup_secondary
623 645
624 /* 646 /*
@@ -771,8 +793,10 @@ start_here_multiplatform:
771 li r0,0 793 li r0,0
772 stdu r0,-STACK_FRAME_OVERHEAD(r1) 794 stdu r0,-STACK_FRAME_OVERHEAD(r1)
773 795
774 /* Do very early kernel initializations, including initial hash table, 796 /*
775 * stab and slb setup before we turn on relocation. */ 797 * Do very early kernel initializations, including initial hash table
798 * and SLB setup before we turn on relocation.
799 */
776 800
777 /* Restore parameters passed from prom_init/kexec */ 801 /* Restore parameters passed from prom_init/kexec */
778 mr r3,r31 802 mr r3,r31
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S
index 5cf3d367190d..be05841396cf 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -135,17 +135,68 @@ _GLOBAL(power7_sleep)
135 b power7_powersave_common 135 b power7_powersave_common
136 /* No return */ 136 /* No return */
137 137
138/*
139 * Make opal call in realmode. This is a generic function to be called
140 * from realmode from reset vector. It handles endianess.
141 *
142 * r13 - paca pointer
143 * r1 - stack pointer
144 * r3 - opal token
145 */
146opal_call_realmode:
147 mflr r12
148 std r12,_LINK(r1)
149 ld r2,PACATOC(r13)
150 /* Set opal return address */
151 LOAD_REG_ADDR(r0,return_from_opal_call)
152 mtlr r0
153 /* Handle endian-ness */
154 li r0,MSR_LE
155 mfmsr r12
156 andc r12,r12,r0
157 mtspr SPRN_HSRR1,r12
158 mr r0,r3 /* Move opal token to r0 */
159 LOAD_REG_ADDR(r11,opal)
160 ld r12,8(r11)
161 ld r2,0(r11)
162 mtspr SPRN_HSRR0,r12
163 hrfid
164
165return_from_opal_call:
166 FIXUP_ENDIAN
167 ld r0,_LINK(r1)
168 mtlr r0
169 blr
170
171#define CHECK_HMI_INTERRUPT \
172 mfspr r0,SPRN_SRR1; \
173BEGIN_FTR_SECTION_NESTED(66); \
174 rlwinm r0,r0,45-31,0xf; /* extract wake reason field (P8) */ \
175FTR_SECTION_ELSE_NESTED(66); \
176 rlwinm r0,r0,45-31,0xe; /* P7 wake reason field is 3 bits */ \
177ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66); \
178 cmpwi r0,0xa; /* Hypervisor maintenance ? */ \
179 bne 20f; \
180 /* Invoke opal call to handle hmi */ \
181 ld r2,PACATOC(r13); \
182 ld r1,PACAR1(r13); \
183 std r3,ORIG_GPR3(r1); /* Save original r3 */ \
184 li r3,OPAL_HANDLE_HMI; /* Pass opal token argument*/ \
185 bl opal_call_realmode; \
186 ld r3,ORIG_GPR3(r1); /* Restore original r3 */ \
18720: nop;
188
189
138_GLOBAL(power7_wakeup_tb_loss) 190_GLOBAL(power7_wakeup_tb_loss)
139 ld r2,PACATOC(r13); 191 ld r2,PACATOC(r13);
140 ld r1,PACAR1(r13) 192 ld r1,PACAR1(r13)
141 193
194BEGIN_FTR_SECTION
195 CHECK_HMI_INTERRUPT
196END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
142 /* Time base re-sync */ 197 /* Time base re-sync */
143 li r0,OPAL_RESYNC_TIMEBASE 198 li r3,OPAL_RESYNC_TIMEBASE
144 LOAD_REG_ADDR(r11,opal); 199 bl opal_call_realmode;
145 ld r12,8(r11);
146 ld r2,0(r11);
147 mtctr r12
148 bctrl
149 200
150 /* TODO: Check r3 for failure */ 201 /* TODO: Check r3 for failure */
151 202
@@ -163,6 +214,9 @@ _GLOBAL(power7_wakeup_tb_loss)
163 214
164_GLOBAL(power7_wakeup_loss) 215_GLOBAL(power7_wakeup_loss)
165 ld r1,PACAR1(r13) 216 ld r1,PACAR1(r13)
217BEGIN_FTR_SECTION
218 CHECK_HMI_INTERRUPT
219END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
166 REST_NVGPRS(r1) 220 REST_NVGPRS(r1)
167 REST_GPR(2, r1) 221 REST_GPR(2, r1)
168 ld r3,_CCR(r1) 222 ld r3,_CCR(r1)
@@ -178,6 +232,9 @@ _GLOBAL(power7_wakeup_noloss)
178 lbz r0,PACA_NAPSTATELOST(r13) 232 lbz r0,PACA_NAPSTATELOST(r13)
179 cmpwi r0,0 233 cmpwi r0,0
180 bne power7_wakeup_loss 234 bne power7_wakeup_loss
235BEGIN_FTR_SECTION
236 CHECK_HMI_INTERRUPT
237END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
181 ld r1,PACAR1(r13) 238 ld r1,PACAR1(r13)
182 ld r4,_MSR(r1) 239 ld r4,_MSR(r1)
183 ld r5,_NIP(r1) 240 ld r5,_NIP(r1)
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 88e3ec6e1d96..a10642a0d861 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1037,7 +1037,7 @@ int iommu_tce_build(struct iommu_table *tbl, unsigned long entry,
1037 1037
1038 /* if (unlikely(ret)) 1038 /* if (unlikely(ret))
1039 pr_err("iommu_tce: %s failed on hwaddr=%lx ioba=%lx kva=%lx ret=%d\n", 1039 pr_err("iommu_tce: %s failed on hwaddr=%lx ioba=%lx kva=%lx ret=%d\n",
1040 __func__, hwaddr, entry << IOMMU_PAGE_SHIFT(tbl), 1040 __func__, hwaddr, entry << tbl->it_page_shift,
1041 hwaddr, ret); */ 1041 hwaddr, ret); */
1042 1042
1043 return ret; 1043 return ret;
@@ -1056,7 +1056,7 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
1056 direction != DMA_TO_DEVICE, &page); 1056 direction != DMA_TO_DEVICE, &page);
1057 if (unlikely(ret != 1)) { 1057 if (unlikely(ret != 1)) {
1058 /* pr_err("iommu_tce: get_user_pages_fast failed tce=%lx ioba=%lx ret=%d\n", 1058 /* pr_err("iommu_tce: get_user_pages_fast failed tce=%lx ioba=%lx ret=%d\n",
1059 tce, entry << IOMMU_PAGE_SHIFT(tbl), ret); */ 1059 tce, entry << tbl->it_page_shift, ret); */
1060 return -EFAULT; 1060 return -EFAULT;
1061 } 1061 }
1062 hwaddr = (unsigned long) page_address(page) + offset; 1062 hwaddr = (unsigned long) page_address(page) + offset;
@@ -1120,37 +1120,41 @@ EXPORT_SYMBOL_GPL(iommu_release_ownership);
1120int iommu_add_device(struct device *dev) 1120int iommu_add_device(struct device *dev)
1121{ 1121{
1122 struct iommu_table *tbl; 1122 struct iommu_table *tbl;
1123 int ret = 0;
1124 1123
1125 if (WARN_ON(dev->iommu_group)) { 1124 /*
1126 pr_warn("iommu_tce: device %s is already in iommu group %d, skipping\n", 1125 * The sysfs entries should be populated before
1127 dev_name(dev), 1126 * binding IOMMU group. If sysfs entries isn't
1128 iommu_group_id(dev->iommu_group)); 1127 * ready, we simply bail.
1128 */
1129 if (!device_is_registered(dev))
1130 return -ENOENT;
1131
1132 if (dev->iommu_group) {
1133 pr_debug("%s: Skipping device %s with iommu group %d\n",
1134 __func__, dev_name(dev),
1135 iommu_group_id(dev->iommu_group));
1129 return -EBUSY; 1136 return -EBUSY;
1130 } 1137 }
1131 1138
1132 tbl = get_iommu_table_base(dev); 1139 tbl = get_iommu_table_base(dev);
1133 if (!tbl || !tbl->it_group) { 1140 if (!tbl || !tbl->it_group) {
1134 pr_debug("iommu_tce: skipping device %s with no tbl\n", 1141 pr_debug("%s: Skipping device %s with no tbl\n",
1135 dev_name(dev)); 1142 __func__, dev_name(dev));
1136 return 0; 1143 return 0;
1137 } 1144 }
1138 1145
1139 pr_debug("iommu_tce: adding %s to iommu group %d\n", 1146 pr_debug("%s: Adding %s to iommu group %d\n",
1140 dev_name(dev), iommu_group_id(tbl->it_group)); 1147 __func__, dev_name(dev),
1148 iommu_group_id(tbl->it_group));
1141 1149
1142 if (PAGE_SIZE < IOMMU_PAGE_SIZE(tbl)) { 1150 if (PAGE_SIZE < IOMMU_PAGE_SIZE(tbl)) {
1143 pr_err("iommu_tce: unsupported iommu page size."); 1151 pr_err("%s: Invalid IOMMU page size %lx (%lx) on %s\n",
1144 pr_err("%s has not been added\n", dev_name(dev)); 1152 __func__, IOMMU_PAGE_SIZE(tbl),
1153 PAGE_SIZE, dev_name(dev));
1145 return -EINVAL; 1154 return -EINVAL;
1146 } 1155 }
1147 1156
1148 ret = iommu_group_add_device(tbl->it_group, dev); 1157 return iommu_group_add_device(tbl->it_group, dev);
1149 if (ret < 0)
1150 pr_err("iommu_tce: %s has not been added, ret=%d\n",
1151 dev_name(dev), ret);
1152
1153 return ret;
1154} 1158}
1155EXPORT_SYMBOL_GPL(iommu_add_device); 1159EXPORT_SYMBOL_GPL(iommu_add_device);
1156 1160
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 248ee7e5bebd..4c5891de162e 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -189,6 +189,11 @@ notrace unsigned int __check_irq_replay(void)
189 } 189 }
190#endif /* CONFIG_PPC_BOOK3E */ 190#endif /* CONFIG_PPC_BOOK3E */
191 191
192 /* Check if an hypervisor Maintenance interrupt happened */
193 local_paca->irq_happened &= ~PACA_IRQ_HMI;
194 if (happened & PACA_IRQ_HMI)
195 return 0xe60;
196
192 /* There should be nothing left ! */ 197 /* There should be nothing left ! */
193 BUG_ON(local_paca->irq_happened != 0); 198 BUG_ON(local_paca->irq_happened != 0);
194 199
@@ -377,6 +382,14 @@ int arch_show_interrupts(struct seq_file *p, int prec)
377 seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions); 382 seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
378 seq_printf(p, " Machine check exceptions\n"); 383 seq_printf(p, " Machine check exceptions\n");
379 384
385 if (cpu_has_feature(CPU_FTR_HVMODE)) {
386 seq_printf(p, "%*s: ", prec, "HMI");
387 for_each_online_cpu(j)
388 seq_printf(p, "%10u ",
389 per_cpu(irq_stat, j).hmi_exceptions);
390 seq_printf(p, " Hypervisor Maintenance Interrupts\n");
391 }
392
380#ifdef CONFIG_PPC_DOORBELL 393#ifdef CONFIG_PPC_DOORBELL
381 if (cpu_has_feature(CPU_FTR_DBELL)) { 394 if (cpu_has_feature(CPU_FTR_DBELL)) {
382 seq_printf(p, "%*s: ", prec, "DBL"); 395 seq_printf(p, "%*s: ", prec, "DBL");
@@ -400,6 +413,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
400 sum += per_cpu(irq_stat, cpu).mce_exceptions; 413 sum += per_cpu(irq_stat, cpu).mce_exceptions;
401 sum += per_cpu(irq_stat, cpu).spurious_irqs; 414 sum += per_cpu(irq_stat, cpu).spurious_irqs;
402 sum += per_cpu(irq_stat, cpu).timer_irqs_others; 415 sum += per_cpu(irq_stat, cpu).timer_irqs_others;
416 sum += per_cpu(irq_stat, cpu).hmi_exceptions;
403#ifdef CONFIG_PPC_DOORBELL 417#ifdef CONFIG_PPC_DOORBELL
404 sum += per_cpu(irq_stat, cpu).doorbell_irqs; 418 sum += per_cpu(irq_stat, cpu).doorbell_irqs;
405#endif 419#endif
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index be99774d3f44..bf44ae962ab8 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1095,6 +1095,23 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)
1099{
1100#ifdef CONFIG_PPC_STD_MMU_64
1101 unsigned long sp_vsid;
1102 unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
1103
1104 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
1105 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
1106 << SLB_VSID_SHIFT_1T;
1107 else
1108 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
1109 << SLB_VSID_SHIFT;
1110 sp_vsid |= SLB_VSID_KERNEL | llp;
1111 p->thread.ksp_vsid = sp_vsid;
1112#endif
1113}
1114
1098/* 1115/*
1099 * Copy a thread.. 1116 * Copy a thread..
1100 */ 1117 */
@@ -1174,21 +1191,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
1174 p->thread.vr_save_area = NULL; 1191 p->thread.vr_save_area = NULL;
1175#endif 1192#endif
1176 1193
1177#ifdef CONFIG_PPC_STD_MMU_64 1194 setup_ksp_vsid(p, sp);
1178 if (mmu_has_feature(MMU_FTR_SLB)) {
1179 unsigned long sp_vsid;
1180 unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp;
1181 1195
1182 if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
1183 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_1T)
1184 << SLB_VSID_SHIFT_1T;
1185 else
1186 sp_vsid = get_kernel_vsid(sp, MMU_SEGSIZE_256M)
1187 << SLB_VSID_SHIFT;
1188 sp_vsid |= SLB_VSID_KERNEL | llp;
1189 p->thread.ksp_vsid = sp_vsid;
1190 }
1191#endif /* CONFIG_PPC_STD_MMU_64 */
1192#ifdef CONFIG_PPC64 1196#ifdef CONFIG_PPC64
1193 if (cpu_has_feature(CPU_FTR_DSCR)) { 1197 if (cpu_has_feature(CPU_FTR_DSCR)) {
1194 p->thread.dscr_inherit = current->thread.dscr_inherit; 1198 p->thread.dscr_inherit = current->thread.dscr_inherit;
@@ -1577,7 +1581,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1577 struct pt_regs *regs = (struct pt_regs *) 1581 struct pt_regs *regs = (struct pt_regs *)
1578 (sp + STACK_FRAME_OVERHEAD); 1582 (sp + STACK_FRAME_OVERHEAD);
1579 lr = regs->link; 1583 lr = regs->link;
1580 printk("--- Exception: %lx at %pS\n LR = %pS\n", 1584 printk("--- interrupt: %lx at %pS\n LR = %pS\n",
1581 regs->trap, (void *)regs->nip, (void *)lr); 1585 regs->trap, (void *)regs->nip, (void *)lr);
1582 firstframe = 1; 1586 firstframe = 1;
1583 } 1587 }
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index b694b0730971..4e139f8a69ef 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -155,7 +155,6 @@ static struct ibm_pa_feature {
155} ibm_pa_features[] __initdata = { 155} ibm_pa_features[] __initdata = {
156 {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0}, 156 {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0},
157 {0, 0, PPC_FEATURE_HAS_FPU, 0, 1, 0}, 157 {0, 0, PPC_FEATURE_HAS_FPU, 0, 1, 0},
158 {0, MMU_FTR_SLB, 0, 0, 2, 0},
159 {CPU_FTR_CTRL, 0, 0, 0, 3, 0}, 158 {CPU_FTR_CTRL, 0, 0, 0, 3, 0},
160 {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0}, 159 {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0},
161 {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1}, 160 {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1},
@@ -309,12 +308,10 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
309 308
310 /* Get physical cpuid */ 309 /* Get physical cpuid */
311 intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len); 310 intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len);
312 if (intserv) { 311 if (!intserv)
313 nthreads = len / sizeof(int); 312 intserv = of_get_flat_dt_prop(node, "reg", &len);
314 } else { 313
315 intserv = of_get_flat_dt_prop(node, "reg", NULL); 314 nthreads = len / sizeof(int);
316 nthreads = 1;
317 }
318 315
319 /* 316 /*
320 * Now see if any of these threads match our boot cpu. 317 * Now see if any of these threads match our boot cpu.
@@ -821,76 +818,6 @@ int cpu_to_chip_id(int cpu)
821} 818}
822EXPORT_SYMBOL(cpu_to_chip_id); 819EXPORT_SYMBOL(cpu_to_chip_id);
823 820
824#ifdef CONFIG_PPC_PSERIES
825/*
826 * Fix up the uninitialized fields in a new device node:
827 * name, type and pci-specific fields
828 */
829
830static int of_finish_dynamic_node(struct device_node *node)
831{
832 struct device_node *parent = of_get_parent(node);
833 int err = 0;
834 const phandle *ibm_phandle;
835
836 node->name = of_get_property(node, "name", NULL);
837 node->type = of_get_property(node, "device_type", NULL);
838
839 if (!node->name)
840 node->name = "<NULL>";
841 if (!node->type)
842 node->type = "<NULL>";
843
844 if (!parent) {
845 err = -ENODEV;
846 goto out;
847 }
848
849 /* We don't support that function on PowerMac, at least
850 * not yet
851 */
852 if (machine_is(powermac))
853 return -ENODEV;
854
855 /* fix up new node's phandle field */
856 if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
857 node->phandle = *ibm_phandle;
858
859out:
860 of_node_put(parent);
861 return err;
862}
863
864static int prom_reconfig_notifier(struct notifier_block *nb,
865 unsigned long action, void *node)
866{
867 int err;
868
869 switch (action) {
870 case OF_RECONFIG_ATTACH_NODE:
871 err = of_finish_dynamic_node(node);
872 if (err < 0)
873 printk(KERN_ERR "finish_node returned %d\n", err);
874 break;
875 default:
876 err = 0;
877 break;
878 }
879 return notifier_from_errno(err);
880}
881
882static struct notifier_block prom_reconfig_nb = {
883 .notifier_call = prom_reconfig_notifier,
884 .priority = 10, /* This one needs to run first */
885};
886
887static int __init prom_reconfig_setup(void)
888{
889 return of_reconfig_notifier_register(&prom_reconfig_nb);
890}
891__initcall(prom_reconfig_setup);
892#endif
893
894bool arch_match_cpu_phys_id(int cpu, u64 phys_id) 821bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
895{ 822{
896 return (int)phys_id == get_hard_smp_processor_id(cpu); 823 return (int)phys_id == get_hard_smp_processor_id(cpu);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index e5b022c55ccd..1b0e26013a62 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -456,18 +456,20 @@ void __init smp_setup_cpu_maps(void)
456 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", 456 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
457 &len); 457 &len);
458 if (intserv) { 458 if (intserv) {
459 nthreads = len / sizeof(int);
460 DBG(" ibm,ppc-interrupt-server#s -> %d threads\n", 459 DBG(" ibm,ppc-interrupt-server#s -> %d threads\n",
461 nthreads); 460 nthreads);
462 } else { 461 } else {
463 DBG(" no ibm,ppc-interrupt-server#s -> 1 thread\n"); 462 DBG(" no ibm,ppc-interrupt-server#s -> 1 thread\n");
464 intserv = of_get_property(dn, "reg", NULL); 463 intserv = of_get_property(dn, "reg", &len);
465 if (!intserv) { 464 if (!intserv) {
466 cpu_be = cpu_to_be32(cpu); 465 cpu_be = cpu_to_be32(cpu);
467 intserv = &cpu_be; /* assume logical == phys */ 466 intserv = &cpu_be; /* assume logical == phys */
467 len = 4;
468 } 468 }
469 } 469 }
470 470
471 nthreads = len / sizeof(int);
472
471 for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { 473 for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
472 bool avail; 474 bool avail;
473 475
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index ee082d771178..75d62d63fe68 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -149,13 +149,13 @@ static void check_smt_enabled(void)
149 else if (!strcmp(smt_enabled_cmdline, "off")) 149 else if (!strcmp(smt_enabled_cmdline, "off"))
150 smt_enabled_at_boot = 0; 150 smt_enabled_at_boot = 0;
151 else { 151 else {
152 long smt; 152 int smt;
153 int rc; 153 int rc;
154 154
155 rc = strict_strtol(smt_enabled_cmdline, 10, &smt); 155 rc = kstrtoint(smt_enabled_cmdline, 10, &smt);
156 if (!rc) 156 if (!rc)
157 smt_enabled_at_boot = 157 smt_enabled_at_boot =
158 min(threads_per_core, (int)smt); 158 min(threads_per_core, smt);
159 } 159 }
160 } else { 160 } else {
161 dn = of_find_node_by_path("/options"); 161 dn = of_find_node_by_path("/options");
@@ -201,7 +201,11 @@ static void cpu_ready_for_interrupts(void)
201 /* Set IR and DR in PACA MSR */ 201 /* Set IR and DR in PACA MSR */
202 get_paca()->kernel_msr = MSR_KERNEL; 202 get_paca()->kernel_msr = MSR_KERNEL;
203 203
204 /* Enable AIL if supported */ 204 /*
205 * Enable AIL if supported, and we are in hypervisor mode. If we are
206 * not in hypervisor mode, we enable relocation-on interrupts later
207 * in pSeries_setup_arch() using the H_SET_MODE hcall.
208 */
205 if (cpu_has_feature(CPU_FTR_HVMODE) && 209 if (cpu_has_feature(CPU_FTR_HVMODE) &&
206 cpu_has_feature(CPU_FTR_ARCH_207S)) { 210 cpu_has_feature(CPU_FTR_ARCH_207S)) {
207 unsigned long lpcr = mfspr(SPRN_LPCR); 211 unsigned long lpcr = mfspr(SPRN_LPCR);
@@ -507,7 +511,11 @@ void __init setup_system(void)
507 check_smt_enabled(); 511 check_smt_enabled();
508 setup_tlb_core_data(); 512 setup_tlb_core_data();
509 513
510#ifdef CONFIG_SMP 514 /*
515 * Freescale Book3e parts spin in a loop provided by firmware,
516 * so smp_release_cpus() does nothing for them
517 */
518#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_FSL_BOOK3E)
511 /* Release secondary cpus out of their spinloops at 0x60 now that 519 /* Release secondary cpus out of their spinloops at 0x60 now that
512 * we can map physical -> logical CPU ids 520 * we can map physical -> logical CPU ids
513 */ 521 */
@@ -673,9 +681,6 @@ void __init setup_arch(char **cmdline_p)
673 exc_lvl_early_init(); 681 exc_lvl_early_init();
674 emergency_stack_init(); 682 emergency_stack_init();
675 683
676#ifdef CONFIG_PPC_STD_MMU_64
677 stabs_alloc();
678#endif
679 /* set up the bootmem stuff with available memory */ 684 /* set up the bootmem stuff with available memory */
680 do_init_bootmem(); 685 do_init_bootmem();
681 sparse_init(); 686 sparse_init();
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 1c794cef2883..cf8c7e4e0b21 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -31,20 +31,14 @@ int show_unhandled_signals = 1;
31/* 31/*
32 * Allocate space for the signal frame 32 * Allocate space for the signal frame
33 */ 33 */
34void __user * get_sigframe(struct k_sigaction *ka, unsigned long sp, 34void __user *get_sigframe(struct ksignal *ksig, unsigned long sp,
35 size_t frame_size, int is_32) 35 size_t frame_size, int is_32)
36{ 36{
37 unsigned long oldsp, newsp; 37 unsigned long oldsp, newsp;
38 38
39 /* Default to using normal stack */ 39 /* Default to using normal stack */
40 oldsp = get_clean_sp(sp, is_32); 40 oldsp = get_clean_sp(sp, is_32);
41 41 oldsp = sigsp(oldsp, ksig);
42 /* Check for alt stack */
43 if ((ka->sa.sa_flags & SA_ONSTACK) &&
44 current->sas_ss_size && !on_sig_stack(oldsp))
45 oldsp = (current->sas_ss_sp + current->sas_ss_size);
46
47 /* Get aligned frame */
48 newsp = (oldsp - frame_size) & ~0xFUL; 42 newsp = (oldsp - frame_size) & ~0xFUL;
49 43
50 /* Check access */ 44 /* Check access */
@@ -105,25 +99,23 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
105 } 99 }
106} 100}
107 101
108static int do_signal(struct pt_regs *regs) 102static void do_signal(struct pt_regs *regs)
109{ 103{
110 sigset_t *oldset = sigmask_to_save(); 104 sigset_t *oldset = sigmask_to_save();
111 siginfo_t info; 105 struct ksignal ksig;
112 int signr;
113 struct k_sigaction ka;
114 int ret; 106 int ret;
115 int is32 = is_32bit_task(); 107 int is32 = is_32bit_task();
116 108
117 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 109 get_signal(&ksig);
118 110
119 /* Is there any syscall restart business here ? */ 111 /* Is there any syscall restart business here ? */
120 check_syscall_restart(regs, &ka, signr > 0); 112 check_syscall_restart(regs, &ksig.ka, ksig.sig > 0);
121 113
122 if (signr <= 0) { 114 if (ksig.sig <= 0) {
123 /* No signal to deliver -- put the saved sigmask back */ 115 /* No signal to deliver -- put the saved sigmask back */
124 restore_saved_sigmask(); 116 restore_saved_sigmask();
125 regs->trap = 0; 117 regs->trap = 0;
126 return 0; /* no signals delivered */ 118 return; /* no signals delivered */
127 } 119 }
128 120
129#ifndef CONFIG_PPC_ADV_DEBUG_REGS 121#ifndef CONFIG_PPC_ADV_DEBUG_REGS
@@ -140,23 +132,16 @@ static int do_signal(struct pt_regs *regs)
140 thread_change_pc(current, regs); 132 thread_change_pc(current, regs);
141 133
142 if (is32) { 134 if (is32) {
143 if (ka.sa.sa_flags & SA_SIGINFO) 135 if (ksig.ka.sa.sa_flags & SA_SIGINFO)
144 ret = handle_rt_signal32(signr, &ka, &info, oldset, 136 ret = handle_rt_signal32(&ksig, oldset, regs);
145 regs);
146 else 137 else
147 ret = handle_signal32(signr, &ka, &info, oldset, 138 ret = handle_signal32(&ksig, oldset, regs);
148 regs);
149 } else { 139 } else {
150 ret = handle_rt_signal64(signr, &ka, &info, oldset, regs); 140 ret = handle_rt_signal64(&ksig, oldset, regs);
151 } 141 }
152 142
153 regs->trap = 0; 143 regs->trap = 0;
154 if (ret) { 144 signal_setup_done(ret, &ksig, test_thread_flag(TIF_SINGLESTEP));
155 signal_delivered(signr, &info, &ka, regs,
156 test_thread_flag(TIF_SINGLESTEP));
157 }
158
159 return ret;
160} 145}
161 146
162void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 147void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
diff --git a/arch/powerpc/kernel/signal.h b/arch/powerpc/kernel/signal.h
index c69b9aeb9f23..51b274199dd9 100644
--- a/arch/powerpc/kernel/signal.h
+++ b/arch/powerpc/kernel/signal.h
@@ -12,15 +12,13 @@
12 12
13extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags); 13extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags);
14 14
15extern void __user * get_sigframe(struct k_sigaction *ka, unsigned long sp, 15extern void __user *get_sigframe(struct ksignal *ksig, unsigned long sp,
16 size_t frame_size, int is_32); 16 size_t frame_size, int is_32);
17 17
18extern int handle_signal32(unsigned long sig, struct k_sigaction *ka, 18extern int handle_signal32(struct ksignal *ksig, sigset_t *oldset,
19 siginfo_t *info, sigset_t *oldset,
20 struct pt_regs *regs); 19 struct pt_regs *regs);
21 20
22extern int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, 21extern int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,
23 siginfo_t *info, sigset_t *oldset,
24 struct pt_regs *regs); 22 struct pt_regs *regs);
25 23
26extern unsigned long copy_fpr_to_user(void __user *to, 24extern unsigned long copy_fpr_to_user(void __user *to,
@@ -44,14 +42,12 @@ extern unsigned long copy_transact_vsx_from_user(struct task_struct *task,
44 42
45#ifdef CONFIG_PPC64 43#ifdef CONFIG_PPC64
46 44
47extern int handle_rt_signal64(int signr, struct k_sigaction *ka, 45extern int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
48 siginfo_t *info, sigset_t *set,
49 struct pt_regs *regs); 46 struct pt_regs *regs);
50 47
51#else /* CONFIG_PPC64 */ 48#else /* CONFIG_PPC64 */
52 49
53static inline int handle_rt_signal64(int signr, struct k_sigaction *ka, 50static inline int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
54 siginfo_t *info, sigset_t *set,
55 struct pt_regs *regs) 51 struct pt_regs *regs)
56{ 52{
57 return -EFAULT; 53 return -EFAULT;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 1bc5a1755ed4..b171001698ff 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -981,9 +981,8 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
981 * Set up a signal frame for a "real-time" signal handler 981 * Set up a signal frame for a "real-time" signal handler
982 * (one which gets siginfo). 982 * (one which gets siginfo).
983 */ 983 */
984int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, 984int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,
985 siginfo_t *info, sigset_t *oldset, 985 struct pt_regs *regs)
986 struct pt_regs *regs)
987{ 986{
988 struct rt_sigframe __user *rt_sf; 987 struct rt_sigframe __user *rt_sf;
989 struct mcontext __user *frame; 988 struct mcontext __user *frame;
@@ -995,13 +994,13 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
995 994
996 /* Set up Signal Frame */ 995 /* Set up Signal Frame */
997 /* Put a Real Time Context onto stack */ 996 /* Put a Real Time Context onto stack */
998 rt_sf = get_sigframe(ka, get_tm_stackpointer(regs), sizeof(*rt_sf), 1); 997 rt_sf = get_sigframe(ksig, get_tm_stackpointer(regs), sizeof(*rt_sf), 1);
999 addr = rt_sf; 998 addr = rt_sf;
1000 if (unlikely(rt_sf == NULL)) 999 if (unlikely(rt_sf == NULL))
1001 goto badframe; 1000 goto badframe;
1002 1001
1003 /* Put the siginfo & fill in most of the ucontext */ 1002 /* Put the siginfo & fill in most of the ucontext */
1004 if (copy_siginfo_to_user(&rt_sf->info, info) 1003 if (copy_siginfo_to_user(&rt_sf->info, &ksig->info)
1005 || __put_user(0, &rt_sf->uc.uc_flags) 1004 || __put_user(0, &rt_sf->uc.uc_flags)
1006 || __save_altstack(&rt_sf->uc.uc_stack, regs->gpr[1]) 1005 || __save_altstack(&rt_sf->uc.uc_stack, regs->gpr[1])
1007 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext), 1006 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext),
@@ -1051,15 +1050,15 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1051 1050
1052 /* Fill registers for signal handler */ 1051 /* Fill registers for signal handler */
1053 regs->gpr[1] = newsp; 1052 regs->gpr[1] = newsp;
1054 regs->gpr[3] = sig; 1053 regs->gpr[3] = ksig->sig;
1055 regs->gpr[4] = (unsigned long) &rt_sf->info; 1054 regs->gpr[4] = (unsigned long) &rt_sf->info;
1056 regs->gpr[5] = (unsigned long) &rt_sf->uc; 1055 regs->gpr[5] = (unsigned long) &rt_sf->uc;
1057 regs->gpr[6] = (unsigned long) rt_sf; 1056 regs->gpr[6] = (unsigned long) rt_sf;
1058 regs->nip = (unsigned long) ka->sa.sa_handler; 1057 regs->nip = (unsigned long) ksig->ka.sa.sa_handler;
1059 /* enter the signal handler in native-endian mode */ 1058 /* enter the signal handler in native-endian mode */
1060 regs->msr &= ~MSR_LE; 1059 regs->msr &= ~MSR_LE;
1061 regs->msr |= (MSR_KERNEL & MSR_LE); 1060 regs->msr |= (MSR_KERNEL & MSR_LE);
1062 return 1; 1061 return 0;
1063 1062
1064badframe: 1063badframe:
1065 if (show_unhandled_signals) 1064 if (show_unhandled_signals)
@@ -1069,8 +1068,7 @@ badframe:
1069 current->comm, current->pid, 1068 current->comm, current->pid,
1070 addr, regs->nip, regs->link); 1069 addr, regs->nip, regs->link);
1071 1070
1072 force_sigsegv(sig, current); 1071 return 1;
1073 return 0;
1074} 1072}
1075 1073
1076static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int sig) 1074static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int sig)
@@ -1409,8 +1407,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1409/* 1407/*
1410 * OK, we're invoking a handler 1408 * OK, we're invoking a handler
1411 */ 1409 */
1412int handle_signal32(unsigned long sig, struct k_sigaction *ka, 1410int handle_signal32(struct ksignal *ksig, sigset_t *oldset, struct pt_regs *regs)
1413 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
1414{ 1411{
1415 struct sigcontext __user *sc; 1412 struct sigcontext __user *sc;
1416 struct sigframe __user *frame; 1413 struct sigframe __user *frame;
@@ -1420,7 +1417,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1420 unsigned long tramp; 1417 unsigned long tramp;
1421 1418
1422 /* Set up Signal Frame */ 1419 /* Set up Signal Frame */
1423 frame = get_sigframe(ka, get_tm_stackpointer(regs), sizeof(*frame), 1); 1420 frame = get_sigframe(ksig, get_tm_stackpointer(regs), sizeof(*frame), 1);
1424 if (unlikely(frame == NULL)) 1421 if (unlikely(frame == NULL))
1425 goto badframe; 1422 goto badframe;
1426 sc = (struct sigcontext __user *) &frame->sctx; 1423 sc = (struct sigcontext __user *) &frame->sctx;
@@ -1428,7 +1425,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1428#if _NSIG != 64 1425#if _NSIG != 64
1429#error "Please adjust handle_signal()" 1426#error "Please adjust handle_signal()"
1430#endif 1427#endif
1431 if (__put_user(to_user_ptr(ka->sa.sa_handler), &sc->handler) 1428 if (__put_user(to_user_ptr(ksig->ka.sa.sa_handler), &sc->handler)
1432 || __put_user(oldset->sig[0], &sc->oldmask) 1429 || __put_user(oldset->sig[0], &sc->oldmask)
1433#ifdef CONFIG_PPC64 1430#ifdef CONFIG_PPC64
1434 || __put_user((oldset->sig[0] >> 32), &sc->_unused[3]) 1431 || __put_user((oldset->sig[0] >> 32), &sc->_unused[3])
@@ -1436,7 +1433,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1436 || __put_user(oldset->sig[1], &sc->_unused[3]) 1433 || __put_user(oldset->sig[1], &sc->_unused[3])
1437#endif 1434#endif
1438 || __put_user(to_user_ptr(&frame->mctx), &sc->regs) 1435 || __put_user(to_user_ptr(&frame->mctx), &sc->regs)
1439 || __put_user(sig, &sc->signal)) 1436 || __put_user(ksig->sig, &sc->signal))
1440 goto badframe; 1437 goto badframe;
1441 1438
1442 if (vdso32_sigtramp && current->mm->context.vdso_base) { 1439 if (vdso32_sigtramp && current->mm->context.vdso_base) {
@@ -1471,12 +1468,12 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1471 goto badframe; 1468 goto badframe;
1472 1469
1473 regs->gpr[1] = newsp; 1470 regs->gpr[1] = newsp;
1474 regs->gpr[3] = sig; 1471 regs->gpr[3] = ksig->sig;
1475 regs->gpr[4] = (unsigned long) sc; 1472 regs->gpr[4] = (unsigned long) sc;
1476 regs->nip = (unsigned long) ka->sa.sa_handler; 1473 regs->nip = (unsigned long) (unsigned long)ksig->ka.sa.sa_handler;
1477 /* enter the signal handler in big-endian mode */ 1474 /* enter the signal handler in big-endian mode */
1478 regs->msr &= ~MSR_LE; 1475 regs->msr &= ~MSR_LE;
1479 return 1; 1476 return 0;
1480 1477
1481badframe: 1478badframe:
1482 if (show_unhandled_signals) 1479 if (show_unhandled_signals)
@@ -1486,8 +1483,7 @@ badframe:
1486 current->comm, current->pid, 1483 current->comm, current->pid,
1487 frame, regs->nip, regs->link); 1484 frame, regs->nip, regs->link);
1488 1485
1489 force_sigsegv(sig, current); 1486 return 1;
1490 return 0;
1491} 1487}
1492 1488
1493/* 1489/*
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 97c1e4b683fc..2cb0c94cafa5 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -708,20 +708,19 @@ badframe:
708 return 0; 708 return 0;
709} 709}
710 710
711int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, 711int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
712 sigset_t *set, struct pt_regs *regs)
713{ 712{
714 struct rt_sigframe __user *frame; 713 struct rt_sigframe __user *frame;
715 unsigned long newsp = 0; 714 unsigned long newsp = 0;
716 long err = 0; 715 long err = 0;
717 716
718 frame = get_sigframe(ka, get_tm_stackpointer(regs), sizeof(*frame), 0); 717 frame = get_sigframe(ksig, get_tm_stackpointer(regs), sizeof(*frame), 0);
719 if (unlikely(frame == NULL)) 718 if (unlikely(frame == NULL))
720 goto badframe; 719 goto badframe;
721 720
722 err |= __put_user(&frame->info, &frame->pinfo); 721 err |= __put_user(&frame->info, &frame->pinfo);
723 err |= __put_user(&frame->uc, &frame->puc); 722 err |= __put_user(&frame->uc, &frame->puc);
724 err |= copy_siginfo_to_user(&frame->info, info); 723 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
725 if (err) 724 if (err)
726 goto badframe; 725 goto badframe;
727 726
@@ -736,15 +735,15 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
736 err |= __put_user(&frame->uc_transact, &frame->uc.uc_link); 735 err |= __put_user(&frame->uc_transact, &frame->uc.uc_link);
737 err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext, 736 err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext,
738 &frame->uc_transact.uc_mcontext, 737 &frame->uc_transact.uc_mcontext,
739 regs, signr, 738 regs, ksig->sig,
740 NULL, 739 NULL,
741 (unsigned long)ka->sa.sa_handler); 740 (unsigned long)ksig->ka.sa.sa_handler);
742 } else 741 } else
743#endif 742#endif
744 { 743 {
745 err |= __put_user(0, &frame->uc.uc_link); 744 err |= __put_user(0, &frame->uc.uc_link);
746 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, signr, 745 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, ksig->sig,
747 NULL, (unsigned long)ka->sa.sa_handler, 746 NULL, (unsigned long)ksig->ka.sa.sa_handler,
748 1); 747 1);
749 } 748 }
750 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 749 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
@@ -770,7 +769,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
770 769
771 /* Set up "regs" so we "return" to the signal handler. */ 770 /* Set up "regs" so we "return" to the signal handler. */
772 if (is_elf2_task()) { 771 if (is_elf2_task()) {
773 regs->nip = (unsigned long) ka->sa.sa_handler; 772 regs->nip = (unsigned long) ksig->ka.sa.sa_handler;
774 regs->gpr[12] = regs->nip; 773 regs->gpr[12] = regs->nip;
775 } else { 774 } else {
776 /* Handler is *really* a pointer to the function descriptor for 775 /* Handler is *really* a pointer to the function descriptor for
@@ -779,7 +778,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
779 * entry is the TOC value we need to use. 778 * entry is the TOC value we need to use.
780 */ 779 */
781 func_descr_t __user *funct_desc_ptr = 780 func_descr_t __user *funct_desc_ptr =
782 (func_descr_t __user *) ka->sa.sa_handler; 781 (func_descr_t __user *) ksig->ka.sa.sa_handler;
783 782
784 err |= get_user(regs->nip, &funct_desc_ptr->entry); 783 err |= get_user(regs->nip, &funct_desc_ptr->entry);
785 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc); 784 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
@@ -789,9 +788,9 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
789 regs->msr &= ~MSR_LE; 788 regs->msr &= ~MSR_LE;
790 regs->msr |= (MSR_KERNEL & MSR_LE); 789 regs->msr |= (MSR_KERNEL & MSR_LE);
791 regs->gpr[1] = newsp; 790 regs->gpr[1] = newsp;
792 regs->gpr[3] = signr; 791 regs->gpr[3] = ksig->sig;
793 regs->result = 0; 792 regs->result = 0;
794 if (ka->sa.sa_flags & SA_SIGINFO) { 793 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
795 err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo); 794 err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo);
796 err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc); 795 err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc);
797 regs->gpr[6] = (unsigned long) frame; 796 regs->gpr[6] = (unsigned long) frame;
@@ -801,7 +800,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
801 if (err) 800 if (err)
802 goto badframe; 801 goto badframe;
803 802
804 return 1; 803 return 0;
805 804
806badframe: 805badframe:
807 if (show_unhandled_signals) 806 if (show_unhandled_signals)
@@ -809,6 +808,5 @@ badframe:
809 current->comm, current->pid, "setup_rt_frame", 808 current->comm, current->pid, "setup_rt_frame",
810 (long)frame, regs->nip, regs->link); 809 (long)frame, regs->nip, regs->link);
811 810
812 force_sigsegv(signr, current); 811 return 1;
813 return 0;
814} 812}
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 1007fb802e6b..a0738af4aba6 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -376,6 +376,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
376 GFP_KERNEL, cpu_to_node(cpu)); 376 GFP_KERNEL, cpu_to_node(cpu));
377 zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu), 377 zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu),
378 GFP_KERNEL, cpu_to_node(cpu)); 378 GFP_KERNEL, cpu_to_node(cpu));
379 /*
380 * numa_node_id() works after this.
381 */
382 set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
383 set_cpu_numa_mem(cpu, local_memory_node(numa_cpu_lookup_table[cpu]));
379 } 384 }
380 385
381 cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid)); 386 cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
@@ -723,12 +728,6 @@ void start_secondary(void *unused)
723 } 728 }
724 traverse_core_siblings(cpu, true); 729 traverse_core_siblings(cpu, true);
725 730
726 /*
727 * numa_node_id() works after this.
728 */
729 set_numa_node(numa_cpu_lookup_table[cpu]);
730 set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
731
732 smp_wmb(); 731 smp_wmb();
733 notify_cpu_starting(cpu); 732 notify_cpu_starting(cpu);
734 set_cpu_online(cpu, true); 733 set_cpu_online(cpu, true);
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 895c50ca943c..7ab5d434e2ee 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -39,9 +39,6 @@
39.section .rodata,"a" 39.section .rodata,"a"
40 40
41#ifdef CONFIG_PPC64 41#ifdef CONFIG_PPC64
42#define sys_sigpending sys_ni_syscall
43#define sys_old_getrlimit sys_ni_syscall
44
45 .p2align 3 42 .p2align 3
46#endif 43#endif
47 44
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 9fff9cdcc519..368ab374d33c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -741,7 +741,7 @@ static cycle_t timebase_read(struct clocksource *cs)
741} 741}
742 742
743void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm, 743void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm,
744 struct clocksource *clock, u32 mult) 744 struct clocksource *clock, u32 mult, cycle_t cycle_last)
745{ 745{
746 u64 new_tb_to_xs, new_stamp_xsec; 746 u64 new_tb_to_xs, new_stamp_xsec;
747 u32 frac_sec; 747 u32 frac_sec;
@@ -774,7 +774,7 @@ void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm,
774 * We expect the caller to have done the first increment of 774 * We expect the caller to have done the first increment of
775 * vdso_data->tb_update_count already. 775 * vdso_data->tb_update_count already.
776 */ 776 */
777 vdso_data->tb_orig_stamp = clock->cycle_last; 777 vdso_data->tb_orig_stamp = cycle_last;
778 vdso_data->stamp_xsec = new_stamp_xsec; 778 vdso_data->stamp_xsec = new_stamp_xsec;
779 vdso_data->tb_to_xs = new_tb_to_xs; 779 vdso_data->tb_to_xs = new_tb_to_xs;
780 vdso_data->wtom_clock_sec = wtm->tv_sec; 780 vdso_data->wtom_clock_sec = wtm->tv_sec;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 239f1cde3fff..0dc43f9932cf 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -302,6 +302,16 @@ long machine_check_early(struct pt_regs *regs)
302 return handled; 302 return handled;
303} 303}
304 304
305long hmi_exception_realmode(struct pt_regs *regs)
306{
307 __get_cpu_var(irq_stat).hmi_exceptions++;
308
309 if (ppc_md.hmi_exception_early)
310 ppc_md.hmi_exception_early(regs);
311
312 return 0;
313}
314
305#endif 315#endif
306 316
307/* 317/*
@@ -609,7 +619,7 @@ int machine_check_e500(struct pt_regs *regs)
609 if (reason & MCSR_BUS_RBERR) 619 if (reason & MCSR_BUS_RBERR)
610 printk("Bus - Read Data Bus Error\n"); 620 printk("Bus - Read Data Bus Error\n");
611 if (reason & MCSR_BUS_WBERR) 621 if (reason & MCSR_BUS_WBERR)
612 printk("Bus - Read Data Bus Error\n"); 622 printk("Bus - Write Data Bus Error\n");
613 if (reason & MCSR_BUS_IPERR) 623 if (reason & MCSR_BUS_IPERR)
614 printk("Bus - Instruction Parity Error\n"); 624 printk("Bus - Instruction Parity Error\n");
615 if (reason & MCSR_BUS_RPERR) 625 if (reason & MCSR_BUS_RPERR)
@@ -738,6 +748,20 @@ void SMIException(struct pt_regs *regs)
738 die("System Management Interrupt", regs, SIGABRT); 748 die("System Management Interrupt", regs, SIGABRT);
739} 749}
740 750
751void handle_hmi_exception(struct pt_regs *regs)
752{
753 struct pt_regs *old_regs;
754
755 old_regs = set_irq_regs(regs);
756 irq_enter();
757
758 if (ppc_md.handle_hmi_exception)
759 ppc_md.handle_hmi_exception(regs);
760
761 irq_exit();
762 set_irq_regs(old_regs);
763}
764
741void unknown_exception(struct pt_regs *regs) 765void unknown_exception(struct pt_regs *regs)
742{ 766{
743 enum ctx_state prev_state = exception_enter(); 767 enum ctx_state prev_state = exception_enter();
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index ce74c335a6a4..f174351842cf 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -840,19 +840,3 @@ static int __init vdso_init(void)
840 return 0; 840 return 0;
841} 841}
842arch_initcall(vdso_init); 842arch_initcall(vdso_init);
843
844int in_gate_area_no_mm(unsigned long addr)
845{
846 return 0;
847}
848
849int in_gate_area(struct mm_struct *mm, unsigned long addr)
850{
851 return 0;
852}
853
854struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
855{
856 return NULL;
857}
858
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 904c66128fae..5bfdab9047be 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -977,7 +977,7 @@ static ssize_t viodev_cmo_desired_set(struct device *dev,
977 size_t new_desired; 977 size_t new_desired;
978 int ret; 978 int ret;
979 979
980 ret = strict_strtoul(buf, 10, &new_desired); 980 ret = kstrtoul(buf, 10, &new_desired);
981 if (ret) 981 if (ret)
982 return ret; 982 return ret;
983 983
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
deleted file mode 100644
index 9cb4b0a36031..000000000000
--- a/arch/powerpc/kvm/44x.c
+++ /dev/null
@@ -1,237 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <linux/kvm_host.h>
21#include <linux/slab.h>
22#include <linux/err.h>
23#include <linux/export.h>
24#include <linux/module.h>
25#include <linux/miscdevice.h>
26
27#include <asm/reg.h>
28#include <asm/cputable.h>
29#include <asm/tlbflush.h>
30#include <asm/kvm_44x.h>
31#include <asm/kvm_ppc.h>
32
33#include "44x_tlb.h"
34#include "booke.h"
35
36static void kvmppc_core_vcpu_load_44x(struct kvm_vcpu *vcpu, int cpu)
37{
38 kvmppc_booke_vcpu_load(vcpu, cpu);
39 kvmppc_44x_tlb_load(vcpu);
40}
41
42static void kvmppc_core_vcpu_put_44x(struct kvm_vcpu *vcpu)
43{
44 kvmppc_44x_tlb_put(vcpu);
45 kvmppc_booke_vcpu_put(vcpu);
46}
47
48int kvmppc_core_check_processor_compat(void)
49{
50 int r;
51
52 if (strncmp(cur_cpu_spec->platform, "ppc440", 6) == 0)
53 r = 0;
54 else
55 r = -ENOTSUPP;
56
57 return r;
58}
59
60int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
61{
62 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
63 struct kvmppc_44x_tlbe *tlbe = &vcpu_44x->guest_tlb[0];
64 int i;
65
66 tlbe->tid = 0;
67 tlbe->word0 = PPC44x_TLB_16M | PPC44x_TLB_VALID;
68 tlbe->word1 = 0;
69 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR;
70
71 tlbe++;
72 tlbe->tid = 0;
73 tlbe->word0 = 0xef600000 | PPC44x_TLB_4K | PPC44x_TLB_VALID;
74 tlbe->word1 = 0xef600000;
75 tlbe->word2 = PPC44x_TLB_SX | PPC44x_TLB_SW | PPC44x_TLB_SR
76 | PPC44x_TLB_I | PPC44x_TLB_G;
77
78 /* Since the guest can directly access the timebase, it must know the
79 * real timebase frequency. Accordingly, it must see the state of
80 * CCR1[TCS]. */
81 /* XXX CCR1 doesn't exist on all 440 SoCs. */
82 vcpu->arch.ccr1 = mfspr(SPRN_CCR1);
83
84 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++)
85 vcpu_44x->shadow_refs[i].gtlb_index = -1;
86
87 vcpu->arch.cpu_type = KVM_CPU_440;
88 vcpu->arch.pvr = mfspr(SPRN_PVR);
89
90 return 0;
91}
92
93/* 'linear_address' is actually an encoding of AS|PID|EADDR . */
94int kvmppc_core_vcpu_translate(struct kvm_vcpu *vcpu,
95 struct kvm_translation *tr)
96{
97 int index;
98 gva_t eaddr;
99 u8 pid;
100 u8 as;
101
102 eaddr = tr->linear_address;
103 pid = (tr->linear_address >> 32) & 0xff;
104 as = (tr->linear_address >> 40) & 0x1;
105
106 index = kvmppc_44x_tlb_index(vcpu, eaddr, pid, as);
107 if (index == -1) {
108 tr->valid = 0;
109 return 0;
110 }
111
112 tr->physical_address = kvmppc_mmu_xlate(vcpu, index, eaddr);
113 /* XXX what does "writeable" and "usermode" even mean? */
114 tr->valid = 1;
115
116 return 0;
117}
118
119static int kvmppc_core_get_sregs_44x(struct kvm_vcpu *vcpu,
120 struct kvm_sregs *sregs)
121{
122 return kvmppc_get_sregs_ivor(vcpu, sregs);
123}
124
125static int kvmppc_core_set_sregs_44x(struct kvm_vcpu *vcpu,
126 struct kvm_sregs *sregs)
127{
128 return kvmppc_set_sregs_ivor(vcpu, sregs);
129}
130
131static int kvmppc_get_one_reg_44x(struct kvm_vcpu *vcpu, u64 id,
132 union kvmppc_one_reg *val)
133{
134 return -EINVAL;
135}
136
137static int kvmppc_set_one_reg_44x(struct kvm_vcpu *vcpu, u64 id,
138 union kvmppc_one_reg *val)
139{
140 return -EINVAL;
141}
142
143static struct kvm_vcpu *kvmppc_core_vcpu_create_44x(struct kvm *kvm,
144 unsigned int id)
145{
146 struct kvmppc_vcpu_44x *vcpu_44x;
147 struct kvm_vcpu *vcpu;
148 int err;
149
150 vcpu_44x = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
151 if (!vcpu_44x) {
152 err = -ENOMEM;
153 goto out;
154 }
155
156 vcpu = &vcpu_44x->vcpu;
157 err = kvm_vcpu_init(vcpu, kvm, id);
158 if (err)
159 goto free_vcpu;
160
161 vcpu->arch.shared = (void*)__get_free_page(GFP_KERNEL|__GFP_ZERO);
162 if (!vcpu->arch.shared)
163 goto uninit_vcpu;
164
165 return vcpu;
166
167uninit_vcpu:
168 kvm_vcpu_uninit(vcpu);
169free_vcpu:
170 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
171out:
172 return ERR_PTR(err);
173}
174
175static void kvmppc_core_vcpu_free_44x(struct kvm_vcpu *vcpu)
176{
177 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
178
179 free_page((unsigned long)vcpu->arch.shared);
180 kvm_vcpu_uninit(vcpu);
181 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
182}
183
184static int kvmppc_core_init_vm_44x(struct kvm *kvm)
185{
186 return 0;
187}
188
189static void kvmppc_core_destroy_vm_44x(struct kvm *kvm)
190{
191}
192
193static struct kvmppc_ops kvm_ops_44x = {
194 .get_sregs = kvmppc_core_get_sregs_44x,
195 .set_sregs = kvmppc_core_set_sregs_44x,
196 .get_one_reg = kvmppc_get_one_reg_44x,
197 .set_one_reg = kvmppc_set_one_reg_44x,
198 .vcpu_load = kvmppc_core_vcpu_load_44x,
199 .vcpu_put = kvmppc_core_vcpu_put_44x,
200 .vcpu_create = kvmppc_core_vcpu_create_44x,
201 .vcpu_free = kvmppc_core_vcpu_free_44x,
202 .mmu_destroy = kvmppc_mmu_destroy_44x,
203 .init_vm = kvmppc_core_init_vm_44x,
204 .destroy_vm = kvmppc_core_destroy_vm_44x,
205 .emulate_op = kvmppc_core_emulate_op_44x,
206 .emulate_mtspr = kvmppc_core_emulate_mtspr_44x,
207 .emulate_mfspr = kvmppc_core_emulate_mfspr_44x,
208};
209
210static int __init kvmppc_44x_init(void)
211{
212 int r;
213
214 r = kvmppc_booke_init();
215 if (r)
216 goto err_out;
217
218 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_44x), 0, THIS_MODULE);
219 if (r)
220 goto err_out;
221 kvm_ops_44x.owner = THIS_MODULE;
222 kvmppc_pr_ops = &kvm_ops_44x;
223
224err_out:
225 return r;
226}
227
228static void __exit kvmppc_44x_exit(void)
229{
230 kvmppc_pr_ops = NULL;
231 kvmppc_booke_exit();
232}
233
234module_init(kvmppc_44x_init);
235module_exit(kvmppc_44x_exit);
236MODULE_ALIAS_MISCDEV(KVM_MINOR);
237MODULE_ALIAS("devname:kvm");
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
deleted file mode 100644
index 92c9ab4bcfec..000000000000
--- a/arch/powerpc/kvm/44x_emulate.c
+++ /dev/null
@@ -1,194 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2008
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <asm/kvm_ppc.h>
21#include <asm/dcr.h>
22#include <asm/dcr-regs.h>
23#include <asm/disassemble.h>
24#include <asm/kvm_44x.h>
25#include "timing.h"
26
27#include "booke.h"
28#include "44x_tlb.h"
29
30#define XOP_MFDCRX 259
31#define XOP_MFDCR 323
32#define XOP_MTDCRX 387
33#define XOP_MTDCR 451
34#define XOP_TLBSX 914
35#define XOP_ICCCI 966
36#define XOP_TLBWE 978
37
38static int emulate_mtdcr(struct kvm_vcpu *vcpu, int rs, int dcrn)
39{
40 /* emulate some access in kernel */
41 switch (dcrn) {
42 case DCRN_CPR0_CONFIG_ADDR:
43 vcpu->arch.cpr0_cfgaddr = kvmppc_get_gpr(vcpu, rs);
44 return EMULATE_DONE;
45 default:
46 vcpu->run->dcr.dcrn = dcrn;
47 vcpu->run->dcr.data = kvmppc_get_gpr(vcpu, rs);
48 vcpu->run->dcr.is_write = 1;
49 vcpu->arch.dcr_is_write = 1;
50 vcpu->arch.dcr_needed = 1;
51 kvmppc_account_exit(vcpu, DCR_EXITS);
52 return EMULATE_DO_DCR;
53 }
54}
55
56static int emulate_mfdcr(struct kvm_vcpu *vcpu, int rt, int dcrn)
57{
58 /* The guest may access CPR0 registers to determine the timebase
59 * frequency, and it must know the real host frequency because it
60 * can directly access the timebase registers.
61 *
62 * It would be possible to emulate those accesses in userspace,
63 * but userspace can really only figure out the end frequency.
64 * We could decompose that into the factors that compute it, but
65 * that's tricky math, and it's easier to just report the real
66 * CPR0 values.
67 */
68 switch (dcrn) {
69 case DCRN_CPR0_CONFIG_ADDR:
70 kvmppc_set_gpr(vcpu, rt, vcpu->arch.cpr0_cfgaddr);
71 break;
72 case DCRN_CPR0_CONFIG_DATA:
73 local_irq_disable();
74 mtdcr(DCRN_CPR0_CONFIG_ADDR,
75 vcpu->arch.cpr0_cfgaddr);
76 kvmppc_set_gpr(vcpu, rt,
77 mfdcr(DCRN_CPR0_CONFIG_DATA));
78 local_irq_enable();
79 break;
80 default:
81 vcpu->run->dcr.dcrn = dcrn;
82 vcpu->run->dcr.data = 0;
83 vcpu->run->dcr.is_write = 0;
84 vcpu->arch.dcr_is_write = 0;
85 vcpu->arch.io_gpr = rt;
86 vcpu->arch.dcr_needed = 1;
87 kvmppc_account_exit(vcpu, DCR_EXITS);
88 return EMULATE_DO_DCR;
89 }
90
91 return EMULATE_DONE;
92}
93
94int kvmppc_core_emulate_op_44x(struct kvm_run *run, struct kvm_vcpu *vcpu,
95 unsigned int inst, int *advance)
96{
97 int emulated = EMULATE_DONE;
98 int dcrn = get_dcrn(inst);
99 int ra = get_ra(inst);
100 int rb = get_rb(inst);
101 int rc = get_rc(inst);
102 int rs = get_rs(inst);
103 int rt = get_rt(inst);
104 int ws = get_ws(inst);
105
106 switch (get_op(inst)) {
107 case 31:
108 switch (get_xop(inst)) {
109
110 case XOP_MFDCR:
111 emulated = emulate_mfdcr(vcpu, rt, dcrn);
112 break;
113
114 case XOP_MFDCRX:
115 emulated = emulate_mfdcr(vcpu, rt,
116 kvmppc_get_gpr(vcpu, ra));
117 break;
118
119 case XOP_MTDCR:
120 emulated = emulate_mtdcr(vcpu, rs, dcrn);
121 break;
122
123 case XOP_MTDCRX:
124 emulated = emulate_mtdcr(vcpu, rs,
125 kvmppc_get_gpr(vcpu, ra));
126 break;
127
128 case XOP_TLBWE:
129 emulated = kvmppc_44x_emul_tlbwe(vcpu, ra, rs, ws);
130 break;
131
132 case XOP_TLBSX:
133 emulated = kvmppc_44x_emul_tlbsx(vcpu, rt, ra, rb, rc);
134 break;
135
136 case XOP_ICCCI:
137 break;
138
139 default:
140 emulated = EMULATE_FAIL;
141 }
142
143 break;
144
145 default:
146 emulated = EMULATE_FAIL;
147 }
148
149 if (emulated == EMULATE_FAIL)
150 emulated = kvmppc_booke_emulate_op(run, vcpu, inst, advance);
151
152 return emulated;
153}
154
155int kvmppc_core_emulate_mtspr_44x(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
156{
157 int emulated = EMULATE_DONE;
158
159 switch (sprn) {
160 case SPRN_PID:
161 kvmppc_set_pid(vcpu, spr_val); break;
162 case SPRN_MMUCR:
163 vcpu->arch.mmucr = spr_val; break;
164 case SPRN_CCR0:
165 vcpu->arch.ccr0 = spr_val; break;
166 case SPRN_CCR1:
167 vcpu->arch.ccr1 = spr_val; break;
168 default:
169 emulated = kvmppc_booke_emulate_mtspr(vcpu, sprn, spr_val);
170 }
171
172 return emulated;
173}
174
175int kvmppc_core_emulate_mfspr_44x(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
176{
177 int emulated = EMULATE_DONE;
178
179 switch (sprn) {
180 case SPRN_PID:
181 *spr_val = vcpu->arch.pid; break;
182 case SPRN_MMUCR:
183 *spr_val = vcpu->arch.mmucr; break;
184 case SPRN_CCR0:
185 *spr_val = vcpu->arch.ccr0; break;
186 case SPRN_CCR1:
187 *spr_val = vcpu->arch.ccr1; break;
188 default:
189 emulated = kvmppc_booke_emulate_mfspr(vcpu, sprn, spr_val);
190 }
191
192 return emulated;
193}
194
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
deleted file mode 100644
index 0deef1082e02..000000000000
--- a/arch/powerpc/kvm/44x_tlb.c
+++ /dev/null
@@ -1,528 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#include <linux/types.h>
21#include <linux/string.h>
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
24#include <linux/highmem.h>
25
26#include <asm/tlbflush.h>
27#include <asm/mmu-44x.h>
28#include <asm/kvm_ppc.h>
29#include <asm/kvm_44x.h>
30#include "timing.h"
31
32#include "44x_tlb.h"
33#include "trace.h"
34
35#ifndef PPC44x_TLBE_SIZE
36#define PPC44x_TLBE_SIZE PPC44x_TLB_4K
37#endif
38
39#define PAGE_SIZE_4K (1<<12)
40#define PAGE_MASK_4K (~(PAGE_SIZE_4K - 1))
41
42#define PPC44x_TLB_UATTR_MASK \
43 (PPC44x_TLB_U0|PPC44x_TLB_U1|PPC44x_TLB_U2|PPC44x_TLB_U3)
44#define PPC44x_TLB_USER_PERM_MASK (PPC44x_TLB_UX|PPC44x_TLB_UR|PPC44x_TLB_UW)
45#define PPC44x_TLB_SUPER_PERM_MASK (PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW)
46
47#ifdef DEBUG
48void kvmppc_dump_tlbs(struct kvm_vcpu *vcpu)
49{
50 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
51 struct kvmppc_44x_tlbe *tlbe;
52 int i;
53
54 printk("vcpu %d TLB dump:\n", vcpu->vcpu_id);
55 printk("| %2s | %3s | %8s | %8s | %8s |\n",
56 "nr", "tid", "word0", "word1", "word2");
57
58 for (i = 0; i < ARRAY_SIZE(vcpu_44x->guest_tlb); i++) {
59 tlbe = &vcpu_44x->guest_tlb[i];
60 if (tlbe->word0 & PPC44x_TLB_VALID)
61 printk(" G%2d | %02X | %08X | %08X | %08X |\n",
62 i, tlbe->tid, tlbe->word0, tlbe->word1,
63 tlbe->word2);
64 }
65}
66#endif
67
68static inline void kvmppc_44x_tlbie(unsigned int index)
69{
70 /* 0 <= index < 64, so the V bit is clear and we can use the index as
71 * word0. */
72 asm volatile(
73 "tlbwe %[index], %[index], 0\n"
74 :
75 : [index] "r"(index)
76 );
77}
78
79static inline void kvmppc_44x_tlbre(unsigned int index,
80 struct kvmppc_44x_tlbe *tlbe)
81{
82 asm volatile(
83 "tlbre %[word0], %[index], 0\n"
84 "mfspr %[tid], %[sprn_mmucr]\n"
85 "andi. %[tid], %[tid], 0xff\n"
86 "tlbre %[word1], %[index], 1\n"
87 "tlbre %[word2], %[index], 2\n"
88 : [word0] "=r"(tlbe->word0),
89 [word1] "=r"(tlbe->word1),
90 [word2] "=r"(tlbe->word2),
91 [tid] "=r"(tlbe->tid)
92 : [index] "r"(index),
93 [sprn_mmucr] "i"(SPRN_MMUCR)
94 : "cc"
95 );
96}
97
98static inline void kvmppc_44x_tlbwe(unsigned int index,
99 struct kvmppc_44x_tlbe *stlbe)
100{
101 unsigned long tmp;
102
103 asm volatile(
104 "mfspr %[tmp], %[sprn_mmucr]\n"
105 "rlwimi %[tmp], %[tid], 0, 0xff\n"
106 "mtspr %[sprn_mmucr], %[tmp]\n"
107 "tlbwe %[word0], %[index], 0\n"
108 "tlbwe %[word1], %[index], 1\n"
109 "tlbwe %[word2], %[index], 2\n"
110 : [tmp] "=&r"(tmp)
111 : [word0] "r"(stlbe->word0),
112 [word1] "r"(stlbe->word1),
113 [word2] "r"(stlbe->word2),
114 [tid] "r"(stlbe->tid),
115 [index] "r"(index),
116 [sprn_mmucr] "i"(SPRN_MMUCR)
117 );
118}
119
120static u32 kvmppc_44x_tlb_shadow_attrib(u32 attrib, int usermode)
121{
122 /* We only care about the guest's permission and user bits. */
123 attrib &= PPC44x_TLB_PERM_MASK|PPC44x_TLB_UATTR_MASK;
124
125 if (!usermode) {
126 /* Guest is in supervisor mode, so we need to translate guest
127 * supervisor permissions into user permissions. */
128 attrib &= ~PPC44x_TLB_USER_PERM_MASK;
129 attrib |= (attrib & PPC44x_TLB_SUPER_PERM_MASK) << 3;
130 }
131
132 /* Make sure host can always access this memory. */
133 attrib |= PPC44x_TLB_SX|PPC44x_TLB_SR|PPC44x_TLB_SW;
134
135 /* WIMGE = 0b00100 */
136 attrib |= PPC44x_TLB_M;
137
138 return attrib;
139}
140
141/* Load shadow TLB back into hardware. */
142void kvmppc_44x_tlb_load(struct kvm_vcpu *vcpu)
143{
144 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
145 int i;
146
147 for (i = 0; i <= tlb_44x_hwater; i++) {
148 struct kvmppc_44x_tlbe *stlbe = &vcpu_44x->shadow_tlb[i];
149
150 if (get_tlb_v(stlbe) && get_tlb_ts(stlbe))
151 kvmppc_44x_tlbwe(i, stlbe);
152 }
153}
154
155static void kvmppc_44x_tlbe_set_modified(struct kvmppc_vcpu_44x *vcpu_44x,
156 unsigned int i)
157{
158 vcpu_44x->shadow_tlb_mod[i] = 1;
159}
160
161/* Save hardware TLB to the vcpu, and invalidate all guest mappings. */
162void kvmppc_44x_tlb_put(struct kvm_vcpu *vcpu)
163{
164 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
165 int i;
166
167 for (i = 0; i <= tlb_44x_hwater; i++) {
168 struct kvmppc_44x_tlbe *stlbe = &vcpu_44x->shadow_tlb[i];
169
170 if (vcpu_44x->shadow_tlb_mod[i])
171 kvmppc_44x_tlbre(i, stlbe);
172
173 if (get_tlb_v(stlbe) && get_tlb_ts(stlbe))
174 kvmppc_44x_tlbie(i);
175 }
176}
177
178
179/* Search the guest TLB for a matching entry. */
180int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr, unsigned int pid,
181 unsigned int as)
182{
183 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
184 int i;
185
186 /* XXX Replace loop with fancy data structures. */
187 for (i = 0; i < ARRAY_SIZE(vcpu_44x->guest_tlb); i++) {
188 struct kvmppc_44x_tlbe *tlbe = &vcpu_44x->guest_tlb[i];
189 unsigned int tid;
190
191 if (eaddr < get_tlb_eaddr(tlbe))
192 continue;
193
194 if (eaddr > get_tlb_end(tlbe))
195 continue;
196
197 tid = get_tlb_tid(tlbe);
198 if (tid && (tid != pid))
199 continue;
200
201 if (!get_tlb_v(tlbe))
202 continue;
203
204 if (get_tlb_ts(tlbe) != as)
205 continue;
206
207 return i;
208 }
209
210 return -1;
211}
212
213gpa_t kvmppc_mmu_xlate(struct kvm_vcpu *vcpu, unsigned int gtlb_index,
214 gva_t eaddr)
215{
216 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
217 struct kvmppc_44x_tlbe *gtlbe = &vcpu_44x->guest_tlb[gtlb_index];
218 unsigned int pgmask = get_tlb_bytes(gtlbe) - 1;
219
220 return get_tlb_raddr(gtlbe) | (eaddr & pgmask);
221}
222
223int kvmppc_mmu_itlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
224{
225 unsigned int as = !!(vcpu->arch.shared->msr & MSR_IS);
226
227 return kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as);
228}
229
230int kvmppc_mmu_dtlb_index(struct kvm_vcpu *vcpu, gva_t eaddr)
231{
232 unsigned int as = !!(vcpu->arch.shared->msr & MSR_DS);
233
234 return kvmppc_44x_tlb_index(vcpu, eaddr, vcpu->arch.pid, as);
235}
236
237void kvmppc_mmu_itlb_miss(struct kvm_vcpu *vcpu)
238{
239}
240
241void kvmppc_mmu_dtlb_miss(struct kvm_vcpu *vcpu)
242{
243}
244
245static void kvmppc_44x_shadow_release(struct kvmppc_vcpu_44x *vcpu_44x,
246 unsigned int stlb_index)
247{
248 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[stlb_index];
249
250 if (!ref->page)
251 return;
252
253 /* Discard from the TLB. */
254 /* Note: we could actually invalidate a host mapping, if the host overwrote
255 * this TLB entry since we inserted a guest mapping. */
256 kvmppc_44x_tlbie(stlb_index);
257
258 /* Now release the page. */
259 if (ref->writeable)
260 kvm_release_page_dirty(ref->page);
261 else
262 kvm_release_page_clean(ref->page);
263
264 ref->page = NULL;
265
266 /* XXX set tlb_44x_index to stlb_index? */
267
268 trace_kvm_stlb_inval(stlb_index);
269}
270
271void kvmppc_mmu_destroy_44x(struct kvm_vcpu *vcpu)
272{
273 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
274 int i;
275
276 for (i = 0; i <= tlb_44x_hwater; i++)
277 kvmppc_44x_shadow_release(vcpu_44x, i);
278}
279
280/**
281 * kvmppc_mmu_map -- create a host mapping for guest memory
282 *
283 * If the guest wanted a larger page than the host supports, only the first
284 * host page is mapped here and the rest are demand faulted.
285 *
286 * If the guest wanted a smaller page than the host page size, we map only the
287 * guest-size page (i.e. not a full host page mapping).
288 *
289 * Caller must ensure that the specified guest TLB entry is safe to insert into
290 * the shadow TLB.
291 */
292void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr,
293 unsigned int gtlb_index)
294{
295 struct kvmppc_44x_tlbe stlbe;
296 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
297 struct kvmppc_44x_tlbe *gtlbe = &vcpu_44x->guest_tlb[gtlb_index];
298 struct kvmppc_44x_shadow_ref *ref;
299 struct page *new_page;
300 hpa_t hpaddr;
301 gfn_t gfn;
302 u32 asid = gtlbe->tid;
303 u32 flags = gtlbe->word2;
304 u32 max_bytes = get_tlb_bytes(gtlbe);
305 unsigned int victim;
306
307 /* Select TLB entry to clobber. Indirectly guard against races with the TLB
308 * miss handler by disabling interrupts. */
309 local_irq_disable();
310 victim = ++tlb_44x_index;
311 if (victim > tlb_44x_hwater)
312 victim = 0;
313 tlb_44x_index = victim;
314 local_irq_enable();
315
316 /* Get reference to new page. */
317 gfn = gpaddr >> PAGE_SHIFT;
318 new_page = gfn_to_page(vcpu->kvm, gfn);
319 if (is_error_page(new_page)) {
320 printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n",
321 (unsigned long long)gfn);
322 return;
323 }
324 hpaddr = page_to_phys(new_page);
325
326 /* Invalidate any previous shadow mappings. */
327 kvmppc_44x_shadow_release(vcpu_44x, victim);
328
329 /* XXX Make sure (va, size) doesn't overlap any other
330 * entries. 440x6 user manual says the result would be
331 * "undefined." */
332
333 /* XXX what about AS? */
334
335 /* Force TS=1 for all guest mappings. */
336 stlbe.word0 = PPC44x_TLB_VALID | PPC44x_TLB_TS;
337
338 if (max_bytes >= PAGE_SIZE) {
339 /* Guest mapping is larger than or equal to host page size. We can use
340 * a "native" host mapping. */
341 stlbe.word0 |= (gvaddr & PAGE_MASK) | PPC44x_TLBE_SIZE;
342 } else {
343 /* Guest mapping is smaller than host page size. We must restrict the
344 * size of the mapping to be at most the smaller of the two, but for
345 * simplicity we fall back to a 4K mapping (this is probably what the
346 * guest is using anyways). */
347 stlbe.word0 |= (gvaddr & PAGE_MASK_4K) | PPC44x_TLB_4K;
348
349 /* 'hpaddr' is a host page, which is larger than the mapping we're
350 * inserting here. To compensate, we must add the in-page offset to the
351 * sub-page. */
352 hpaddr |= gpaddr & (PAGE_MASK ^ PAGE_MASK_4K);
353 }
354
355 stlbe.word1 = (hpaddr & 0xfffffc00) | ((hpaddr >> 32) & 0xf);
356 stlbe.word2 = kvmppc_44x_tlb_shadow_attrib(flags,
357 vcpu->arch.shared->msr & MSR_PR);
358 stlbe.tid = !(asid & 0xff);
359
360 /* Keep track of the reference so we can properly release it later. */
361 ref = &vcpu_44x->shadow_refs[victim];
362 ref->page = new_page;
363 ref->gtlb_index = gtlb_index;
364 ref->writeable = !!(stlbe.word2 & PPC44x_TLB_UW);
365 ref->tid = stlbe.tid;
366
367 /* Insert shadow mapping into hardware TLB. */
368 kvmppc_44x_tlbe_set_modified(vcpu_44x, victim);
369 kvmppc_44x_tlbwe(victim, &stlbe);
370 trace_kvm_stlb_write(victim, stlbe.tid, stlbe.word0, stlbe.word1,
371 stlbe.word2);
372}
373
374/* For a particular guest TLB entry, invalidate the corresponding host TLB
375 * mappings and release the host pages. */
376static void kvmppc_44x_invalidate(struct kvm_vcpu *vcpu,
377 unsigned int gtlb_index)
378{
379 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
380 int i;
381
382 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++) {
383 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[i];
384 if (ref->gtlb_index == gtlb_index)
385 kvmppc_44x_shadow_release(vcpu_44x, i);
386 }
387}
388
389void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
390{
391 int usermode = vcpu->arch.shared->msr & MSR_PR;
392
393 vcpu->arch.shadow_pid = !usermode;
394}
395
396void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid)
397{
398 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
399 int i;
400
401 if (unlikely(vcpu->arch.pid == new_pid))
402 return;
403
404 vcpu->arch.pid = new_pid;
405
406 /* Guest userspace runs with TID=0 mappings and PID=0, to make sure it
407 * can't access guest kernel mappings (TID=1). When we switch to a new
408 * guest PID, which will also use host PID=0, we must discard the old guest
409 * userspace mappings. */
410 for (i = 0; i < ARRAY_SIZE(vcpu_44x->shadow_refs); i++) {
411 struct kvmppc_44x_shadow_ref *ref = &vcpu_44x->shadow_refs[i];
412
413 if (ref->tid == 0)
414 kvmppc_44x_shadow_release(vcpu_44x, i);
415 }
416}
417
418static int tlbe_is_host_safe(const struct kvm_vcpu *vcpu,
419 const struct kvmppc_44x_tlbe *tlbe)
420{
421 gpa_t gpa;
422
423 if (!get_tlb_v(tlbe))
424 return 0;
425
426 /* Does it match current guest AS? */
427 /* XXX what about IS != DS? */
428 if (get_tlb_ts(tlbe) != !!(vcpu->arch.shared->msr & MSR_IS))
429 return 0;
430
431 gpa = get_tlb_raddr(tlbe);
432 if (!gfn_to_memslot(vcpu->kvm, gpa >> PAGE_SHIFT))
433 /* Mapping is not for RAM. */
434 return 0;
435
436 return 1;
437}
438
439int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
440{
441 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
442 struct kvmppc_44x_tlbe *tlbe;
443 unsigned int gtlb_index;
444 int idx;
445
446 gtlb_index = kvmppc_get_gpr(vcpu, ra);
447 if (gtlb_index >= KVM44x_GUEST_TLB_SIZE) {
448 printk("%s: index %d\n", __func__, gtlb_index);
449 kvmppc_dump_vcpu(vcpu);
450 return EMULATE_FAIL;
451 }
452
453 tlbe = &vcpu_44x->guest_tlb[gtlb_index];
454
455 /* Invalidate shadow mappings for the about-to-be-clobbered TLB entry. */
456 if (tlbe->word0 & PPC44x_TLB_VALID)
457 kvmppc_44x_invalidate(vcpu, gtlb_index);
458
459 switch (ws) {
460 case PPC44x_TLB_PAGEID:
461 tlbe->tid = get_mmucr_stid(vcpu);
462 tlbe->word0 = kvmppc_get_gpr(vcpu, rs);
463 break;
464
465 case PPC44x_TLB_XLAT:
466 tlbe->word1 = kvmppc_get_gpr(vcpu, rs);
467 break;
468
469 case PPC44x_TLB_ATTRIB:
470 tlbe->word2 = kvmppc_get_gpr(vcpu, rs);
471 break;
472
473 default:
474 return EMULATE_FAIL;
475 }
476
477 idx = srcu_read_lock(&vcpu->kvm->srcu);
478
479 if (tlbe_is_host_safe(vcpu, tlbe)) {
480 gva_t eaddr;
481 gpa_t gpaddr;
482 u32 bytes;
483
484 eaddr = get_tlb_eaddr(tlbe);
485 gpaddr = get_tlb_raddr(tlbe);
486
487 /* Use the advertised page size to mask effective and real addrs. */
488 bytes = get_tlb_bytes(tlbe);
489 eaddr &= ~(bytes - 1);
490 gpaddr &= ~(bytes - 1);
491
492 kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index);
493 }
494
495 srcu_read_unlock(&vcpu->kvm->srcu, idx);
496
497 trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1,
498 tlbe->word2);
499
500 kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS);
501 return EMULATE_DONE;
502}
503
504int kvmppc_44x_emul_tlbsx(struct kvm_vcpu *vcpu, u8 rt, u8 ra, u8 rb, u8 rc)
505{
506 u32 ea;
507 int gtlb_index;
508 unsigned int as = get_mmucr_sts(vcpu);
509 unsigned int pid = get_mmucr_stid(vcpu);
510
511 ea = kvmppc_get_gpr(vcpu, rb);
512 if (ra)
513 ea += kvmppc_get_gpr(vcpu, ra);
514
515 gtlb_index = kvmppc_44x_tlb_index(vcpu, ea, pid, as);
516 if (rc) {
517 u32 cr = kvmppc_get_cr(vcpu);
518
519 if (gtlb_index < 0)
520 kvmppc_set_cr(vcpu, cr & ~0x20000000);
521 else
522 kvmppc_set_cr(vcpu, cr | 0x20000000);
523 }
524 kvmppc_set_gpr(vcpu, rt, gtlb_index);
525
526 kvmppc_set_exit_type(vcpu, EMULATED_TLBSX_EXITS);
527 return EMULATE_DONE;
528}
diff --git a/arch/powerpc/kvm/44x_tlb.h b/arch/powerpc/kvm/44x_tlb.h
deleted file mode 100644
index a9ff80e51526..000000000000
--- a/arch/powerpc/kvm/44x_tlb.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 *
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18 */
19
20#ifndef __KVM_POWERPC_TLB_H__
21#define __KVM_POWERPC_TLB_H__
22
23#include <linux/kvm_host.h>
24#include <asm/mmu-44x.h>
25
26extern int kvmppc_44x_tlb_index(struct kvm_vcpu *vcpu, gva_t eaddr,
27 unsigned int pid, unsigned int as);
28
29extern int kvmppc_44x_emul_tlbsx(struct kvm_vcpu *vcpu, u8 rt, u8 ra, u8 rb,
30 u8 rc);
31extern int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws);
32
33/* TLB helper functions */
34static inline unsigned int get_tlb_size(const struct kvmppc_44x_tlbe *tlbe)
35{
36 return (tlbe->word0 >> 4) & 0xf;
37}
38
39static inline gva_t get_tlb_eaddr(const struct kvmppc_44x_tlbe *tlbe)
40{
41 return tlbe->word0 & 0xfffffc00;
42}
43
44static inline gva_t get_tlb_bytes(const struct kvmppc_44x_tlbe *tlbe)
45{
46 unsigned int pgsize = get_tlb_size(tlbe);
47 return 1 << 10 << (pgsize << 1);
48}
49
50static inline gva_t get_tlb_end(const struct kvmppc_44x_tlbe *tlbe)
51{
52 return get_tlb_eaddr(tlbe) + get_tlb_bytes(tlbe) - 1;
53}
54
55static inline u64 get_tlb_raddr(const struct kvmppc_44x_tlbe *tlbe)
56{
57 u64 word1 = tlbe->word1;
58 return ((word1 & 0xf) << 32) | (word1 & 0xfffffc00);
59}
60
61static inline unsigned int get_tlb_tid(const struct kvmppc_44x_tlbe *tlbe)
62{
63 return tlbe->tid & 0xff;
64}
65
66static inline unsigned int get_tlb_ts(const struct kvmppc_44x_tlbe *tlbe)
67{
68 return (tlbe->word0 >> 8) & 0x1;
69}
70
71static inline unsigned int get_tlb_v(const struct kvmppc_44x_tlbe *tlbe)
72{
73 return (tlbe->word0 >> 9) & 0x1;
74}
75
76static inline unsigned int get_mmucr_stid(const struct kvm_vcpu *vcpu)
77{
78 return vcpu->arch.mmucr & 0xff;
79}
80
81static inline unsigned int get_mmucr_sts(const struct kvm_vcpu *vcpu)
82{
83 return (vcpu->arch.mmucr >> 16) & 0x1;
84}
85
86#endif /* __KVM_POWERPC_TLB_H__ */
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index d6a53b95de94..602eb51d20bc 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -75,7 +75,6 @@ config KVM_BOOK3S_64
75config KVM_BOOK3S_64_HV 75config KVM_BOOK3S_64_HV
76 tristate "KVM support for POWER7 and PPC970 using hypervisor mode in host" 76 tristate "KVM support for POWER7 and PPC970 using hypervisor mode in host"
77 depends on KVM_BOOK3S_64 77 depends on KVM_BOOK3S_64
78 depends on !CPU_LITTLE_ENDIAN
79 select KVM_BOOK3S_HV_POSSIBLE 78 select KVM_BOOK3S_HV_POSSIBLE
80 select MMU_NOTIFIER 79 select MMU_NOTIFIER
81 select CMA 80 select CMA
@@ -113,23 +112,9 @@ config KVM_BOOK3S_64_PR
113config KVM_BOOKE_HV 112config KVM_BOOKE_HV
114 bool 113 bool
115 114
116config KVM_440
117 bool "KVM support for PowerPC 440 processors"
118 depends on 44x
119 select KVM
120 select KVM_MMIO
121 ---help---
122 Support running unmodified 440 guest kernels in virtual machines on
123 440 host processors.
124
125 This module provides access to the hardware capabilities through
126 a character device node named /dev/kvm.
127
128 If unsure, say N.
129
130config KVM_EXIT_TIMING 115config KVM_EXIT_TIMING
131 bool "Detailed exit timing" 116 bool "Detailed exit timing"
132 depends on KVM_440 || KVM_E500V2 || KVM_E500MC 117 depends on KVM_E500V2 || KVM_E500MC
133 ---help--- 118 ---help---
134 Calculate elapsed time for every exit/enter cycle. A per-vcpu 119 Calculate elapsed time for every exit/enter cycle. A per-vcpu
135 report is available in debugfs kvm/vm#_vcpu#_timing. 120 report is available in debugfs kvm/vm#_vcpu#_timing.
@@ -173,6 +158,7 @@ config KVM_MPIC
173 bool "KVM in-kernel MPIC emulation" 158 bool "KVM in-kernel MPIC emulation"
174 depends on KVM && E500 159 depends on KVM && E500
175 select HAVE_KVM_IRQCHIP 160 select HAVE_KVM_IRQCHIP
161 select HAVE_KVM_IRQFD
176 select HAVE_KVM_IRQ_ROUTING 162 select HAVE_KVM_IRQ_ROUTING
177 select HAVE_KVM_MSI 163 select HAVE_KVM_MSI
178 help 164 help
@@ -184,6 +170,8 @@ config KVM_MPIC
184config KVM_XICS 170config KVM_XICS
185 bool "KVM in-kernel XICS emulation" 171 bool "KVM in-kernel XICS emulation"
186 depends on KVM_BOOK3S_64 && !KVM_MPIC 172 depends on KVM_BOOK3S_64 && !KVM_MPIC
173 select HAVE_KVM_IRQCHIP
174 select HAVE_KVM_IRQFD
187 ---help--- 175 ---help---
188 Include support for the XICS (eXternal Interrupt Controller 176 Include support for the XICS (eXternal Interrupt Controller
189 Specification) interrupt controller architecture used on 177 Specification) interrupt controller architecture used on
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index ce569b6bf4d8..0570eef83fba 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -10,27 +10,17 @@ KVM := ../../../virt/kvm
10common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ 10common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
11 $(KVM)/eventfd.o 11 $(KVM)/eventfd.o
12 12
13CFLAGS_44x_tlb.o := -I.
14CFLAGS_e500_mmu.o := -I. 13CFLAGS_e500_mmu.o := -I.
15CFLAGS_e500_mmu_host.o := -I. 14CFLAGS_e500_mmu_host.o := -I.
16CFLAGS_emulate.o := -I. 15CFLAGS_emulate.o := -I.
16CFLAGS_emulate_loadstore.o := -I.
17 17
18common-objs-y += powerpc.o emulate.o 18common-objs-y += powerpc.o emulate.o emulate_loadstore.o
19obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o 19obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
20obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o 20obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o
21 21
22AFLAGS_booke_interrupts.o := -I$(obj) 22AFLAGS_booke_interrupts.o := -I$(obj)
23 23
24kvm-440-objs := \
25 $(common-objs-y) \
26 booke.o \
27 booke_emulate.o \
28 booke_interrupts.o \
29 44x.o \
30 44x_tlb.o \
31 44x_emulate.o
32kvm-objs-$(CONFIG_KVM_440) := $(kvm-440-objs)
33
34kvm-e500-objs := \ 24kvm-e500-objs := \
35 $(common-objs-y) \ 25 $(common-objs-y) \
36 booke.o \ 26 booke.o \
@@ -58,6 +48,7 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) := \
58 48
59kvm-pr-y := \ 49kvm-pr-y := \
60 fpu.o \ 50 fpu.o \
51 emulate.o \
61 book3s_paired_singles.o \ 52 book3s_paired_singles.o \
62 book3s_pr.o \ 53 book3s_pr.o \
63 book3s_pr_papr.o \ 54 book3s_pr_papr.o \
@@ -90,7 +81,6 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \
90 book3s_hv_rm_mmu.o \ 81 book3s_hv_rm_mmu.o \
91 book3s_hv_ras.o \ 82 book3s_hv_ras.o \
92 book3s_hv_builtin.o \ 83 book3s_hv_builtin.o \
93 book3s_hv_cma.o \
94 $(kvm-book3s_64-builtin-xics-objs-y) 84 $(kvm-book3s_64-builtin-xics-objs-y)
95endif 85endif
96 86
@@ -101,7 +91,7 @@ kvm-book3s_64-module-objs += \
101 $(KVM)/kvm_main.o \ 91 $(KVM)/kvm_main.o \
102 $(KVM)/eventfd.o \ 92 $(KVM)/eventfd.o \
103 powerpc.o \ 93 powerpc.o \
104 emulate.o \ 94 emulate_loadstore.o \
105 book3s.o \ 95 book3s.o \
106 book3s_64_vio.o \ 96 book3s_64_vio.o \
107 book3s_rtas.o \ 97 book3s_rtas.o \
@@ -127,7 +117,6 @@ kvm-objs-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(KVM)/irqchip.o
127 117
128kvm-objs := $(kvm-objs-m) $(kvm-objs-y) 118kvm-objs := $(kvm-objs-m) $(kvm-objs-y)
129 119
130obj-$(CONFIG_KVM_440) += kvm.o
131obj-$(CONFIG_KVM_E500V2) += kvm.o 120obj-$(CONFIG_KVM_E500V2) += kvm.o
132obj-$(CONFIG_KVM_E500MC) += kvm.o 121obj-$(CONFIG_KVM_E500MC) += kvm.o
133obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o 122obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index c254c27f240e..dd03f6b299ba 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -72,6 +72,17 @@ void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu)
72{ 72{
73} 73}
74 74
75void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu)
76{
77 if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) {
78 ulong pc = kvmppc_get_pc(vcpu);
79 if ((pc & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS)
80 kvmppc_set_pc(vcpu, pc & ~SPLIT_HACK_MASK);
81 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK;
82 }
83}
84EXPORT_SYMBOL_GPL(kvmppc_unfixup_split_real);
85
75static inline unsigned long kvmppc_interrupt_offset(struct kvm_vcpu *vcpu) 86static inline unsigned long kvmppc_interrupt_offset(struct kvm_vcpu *vcpu)
76{ 87{
77 if (!is_kvmppc_hv_enabled(vcpu->kvm)) 88 if (!is_kvmppc_hv_enabled(vcpu->kvm))
@@ -118,6 +129,7 @@ static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
118 129
119void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags) 130void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
120{ 131{
132 kvmppc_unfixup_split_real(vcpu);
121 kvmppc_set_srr0(vcpu, kvmppc_get_pc(vcpu)); 133 kvmppc_set_srr0(vcpu, kvmppc_get_pc(vcpu));
122 kvmppc_set_srr1(vcpu, kvmppc_get_msr(vcpu) | flags); 134 kvmppc_set_srr1(vcpu, kvmppc_get_msr(vcpu) | flags);
123 kvmppc_set_pc(vcpu, kvmppc_interrupt_offset(vcpu) + vec); 135 kvmppc_set_pc(vcpu, kvmppc_interrupt_offset(vcpu) + vec);
@@ -218,6 +230,23 @@ void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu)
218 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL_LEVEL); 230 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
219} 231}
220 232
233void kvmppc_core_queue_data_storage(struct kvm_vcpu *vcpu, ulong dar,
234 ulong flags)
235{
236 kvmppc_set_dar(vcpu, dar);
237 kvmppc_set_dsisr(vcpu, flags);
238 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DATA_STORAGE);
239}
240
241void kvmppc_core_queue_inst_storage(struct kvm_vcpu *vcpu, ulong flags)
242{
243 u64 msr = kvmppc_get_msr(vcpu);
244 msr &= ~(SRR1_ISI_NOPT | SRR1_ISI_N_OR_G | SRR1_ISI_PROT);
245 msr |= flags & (SRR1_ISI_NOPT | SRR1_ISI_N_OR_G | SRR1_ISI_PROT);
246 kvmppc_set_msr_fast(vcpu, msr);
247 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_INST_STORAGE);
248}
249
221int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority) 250int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
222{ 251{
223 int deliver = 1; 252 int deliver = 1;
@@ -342,18 +371,18 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
342} 371}
343EXPORT_SYMBOL_GPL(kvmppc_core_prepare_to_enter); 372EXPORT_SYMBOL_GPL(kvmppc_core_prepare_to_enter);
344 373
345pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing, 374pfn_t kvmppc_gpa_to_pfn(struct kvm_vcpu *vcpu, gpa_t gpa, bool writing,
346 bool *writable) 375 bool *writable)
347{ 376{
348 ulong mp_pa = vcpu->arch.magic_page_pa; 377 ulong mp_pa = vcpu->arch.magic_page_pa & KVM_PAM;
378 gfn_t gfn = gpa >> PAGE_SHIFT;
349 379
350 if (!(kvmppc_get_msr(vcpu) & MSR_SF)) 380 if (!(kvmppc_get_msr(vcpu) & MSR_SF))
351 mp_pa = (uint32_t)mp_pa; 381 mp_pa = (uint32_t)mp_pa;
352 382
353 /* Magic page override */ 383 /* Magic page override */
354 if (unlikely(mp_pa) && 384 gpa &= ~0xFFFULL;
355 unlikely(((gfn << PAGE_SHIFT) & KVM_PAM) == 385 if (unlikely(mp_pa) && unlikely((gpa & KVM_PAM) == mp_pa)) {
356 ((mp_pa & PAGE_MASK) & KVM_PAM))) {
357 ulong shared_page = ((ulong)vcpu->arch.shared) & PAGE_MASK; 386 ulong shared_page = ((ulong)vcpu->arch.shared) & PAGE_MASK;
358 pfn_t pfn; 387 pfn_t pfn;
359 388
@@ -366,11 +395,13 @@ pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
366 395
367 return gfn_to_pfn_prot(vcpu->kvm, gfn, writing, writable); 396 return gfn_to_pfn_prot(vcpu->kvm, gfn, writing, writable);
368} 397}
369EXPORT_SYMBOL_GPL(kvmppc_gfn_to_pfn); 398EXPORT_SYMBOL_GPL(kvmppc_gpa_to_pfn);
370 399
371static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data, 400int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, enum xlate_instdata xlid,
372 bool iswrite, struct kvmppc_pte *pte) 401 enum xlate_readwrite xlrw, struct kvmppc_pte *pte)
373{ 402{
403 bool data = (xlid == XLATE_DATA);
404 bool iswrite = (xlrw == XLATE_WRITE);
374 int relocated = (kvmppc_get_msr(vcpu) & (data ? MSR_DR : MSR_IR)); 405 int relocated = (kvmppc_get_msr(vcpu) & (data ? MSR_DR : MSR_IR));
375 int r; 406 int r;
376 407
@@ -384,88 +415,34 @@ static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data,
384 pte->may_write = true; 415 pte->may_write = true;
385 pte->may_execute = true; 416 pte->may_execute = true;
386 r = 0; 417 r = 0;
418
419 if ((kvmppc_get_msr(vcpu) & (MSR_IR | MSR_DR)) == MSR_DR &&
420 !data) {
421 if ((vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) &&
422 ((eaddr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS))
423 pte->raddr &= ~SPLIT_HACK_MASK;
424 }
387 } 425 }
388 426
389 return r; 427 return r;
390} 428}
391 429
392static hva_t kvmppc_bad_hva(void) 430int kvmppc_load_last_inst(struct kvm_vcpu *vcpu, enum instruction_type type,
393{ 431 u32 *inst)
394 return PAGE_OFFSET;
395}
396
397static hva_t kvmppc_pte_to_hva(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte,
398 bool read)
399{
400 hva_t hpage;
401
402 if (read && !pte->may_read)
403 goto err;
404
405 if (!read && !pte->may_write)
406 goto err;
407
408 hpage = gfn_to_hva(vcpu->kvm, pte->raddr >> PAGE_SHIFT);
409 if (kvm_is_error_hva(hpage))
410 goto err;
411
412 return hpage | (pte->raddr & ~PAGE_MASK);
413err:
414 return kvmppc_bad_hva();
415}
416
417int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
418 bool data)
419{
420 struct kvmppc_pte pte;
421
422 vcpu->stat.st++;
423
424 if (kvmppc_xlate(vcpu, *eaddr, data, true, &pte))
425 return -ENOENT;
426
427 *eaddr = pte.raddr;
428
429 if (!pte.may_write)
430 return -EPERM;
431
432 if (kvm_write_guest(vcpu->kvm, pte.raddr, ptr, size))
433 return EMULATE_DO_MMIO;
434
435 return EMULATE_DONE;
436}
437EXPORT_SYMBOL_GPL(kvmppc_st);
438
439int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
440 bool data)
441{ 432{
442 struct kvmppc_pte pte; 433 ulong pc = kvmppc_get_pc(vcpu);
443 hva_t hva = *eaddr; 434 int r;
444
445 vcpu->stat.ld++;
446
447 if (kvmppc_xlate(vcpu, *eaddr, data, false, &pte))
448 goto nopte;
449
450 *eaddr = pte.raddr;
451
452 hva = kvmppc_pte_to_hva(vcpu, &pte, true);
453 if (kvm_is_error_hva(hva))
454 goto mmio;
455
456 if (copy_from_user(ptr, (void __user *)hva, size)) {
457 printk(KERN_INFO "kvmppc_ld at 0x%lx failed\n", hva);
458 goto mmio;
459 }
460 435
461 return EMULATE_DONE; 436 if (type == INST_SC)
437 pc -= 4;
462 438
463nopte: 439 r = kvmppc_ld(vcpu, &pc, sizeof(u32), inst, false);
464 return -ENOENT; 440 if (r == EMULATE_DONE)
465mmio: 441 return r;
466 return EMULATE_DO_MMIO; 442 else
443 return EMULATE_AGAIN;
467} 444}
468EXPORT_SYMBOL_GPL(kvmppc_ld); 445EXPORT_SYMBOL_GPL(kvmppc_load_last_inst);
469 446
470int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 447int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
471{ 448{
@@ -646,6 +623,12 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
646 case KVM_REG_PPC_BESCR: 623 case KVM_REG_PPC_BESCR:
647 val = get_reg_val(reg->id, vcpu->arch.bescr); 624 val = get_reg_val(reg->id, vcpu->arch.bescr);
648 break; 625 break;
626 case KVM_REG_PPC_VTB:
627 val = get_reg_val(reg->id, vcpu->arch.vtb);
628 break;
629 case KVM_REG_PPC_IC:
630 val = get_reg_val(reg->id, vcpu->arch.ic);
631 break;
649 default: 632 default:
650 r = -EINVAL; 633 r = -EINVAL;
651 break; 634 break;
@@ -750,6 +733,12 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
750 case KVM_REG_PPC_BESCR: 733 case KVM_REG_PPC_BESCR:
751 vcpu->arch.bescr = set_reg_val(reg->id, val); 734 vcpu->arch.bescr = set_reg_val(reg->id, val);
752 break; 735 break;
736 case KVM_REG_PPC_VTB:
737 vcpu->arch.vtb = set_reg_val(reg->id, val);
738 break;
739 case KVM_REG_PPC_IC:
740 vcpu->arch.ic = set_reg_val(reg->id, val);
741 break;
753 default: 742 default:
754 r = -EINVAL; 743 r = -EINVAL;
755 break; 744 break;
@@ -913,6 +902,11 @@ int kvmppc_core_check_processor_compat(void)
913 return 0; 902 return 0;
914} 903}
915 904
905int kvmppc_book3s_hcall_implemented(struct kvm *kvm, unsigned long hcall)
906{
907 return kvm->arch.kvm_ops->hcall_implemented(hcall);
908}
909
916static int kvmppc_book3s_init(void) 910static int kvmppc_book3s_init(void)
917{ 911{
918 int r; 912 int r;
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c
index 93503bbdae43..cd0b0730e29e 100644
--- a/arch/powerpc/kvm/book3s_32_mmu.c
+++ b/arch/powerpc/kvm/book3s_32_mmu.c
@@ -335,7 +335,7 @@ static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
335 if (r < 0) 335 if (r < 0)
336 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, 336 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
337 data, iswrite, true); 337 data, iswrite, true);
338 if (r < 0) 338 if (r == -ENOENT)
339 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, 339 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
340 data, iswrite, false); 340 data, iswrite, false);
341 341
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 678e75370495..2035d16a9262 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -156,11 +156,10 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte,
156 bool writable; 156 bool writable;
157 157
158 /* Get host physical address for gpa */ 158 /* Get host physical address for gpa */
159 hpaddr = kvmppc_gfn_to_pfn(vcpu, orig_pte->raddr >> PAGE_SHIFT, 159 hpaddr = kvmppc_gpa_to_pfn(vcpu, orig_pte->raddr, iswrite, &writable);
160 iswrite, &writable);
161 if (is_error_noslot_pfn(hpaddr)) { 160 if (is_error_noslot_pfn(hpaddr)) {
162 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", 161 printk(KERN_INFO "Couldn't get guest page for gpa %lx!\n",
163 orig_pte->eaddr); 162 orig_pte->raddr);
164 r = -EINVAL; 163 r = -EINVAL;
165 goto out; 164 goto out;
166 } 165 }
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 0ac98392f363..b982d925c710 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -104,9 +104,10 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte,
104 smp_rmb(); 104 smp_rmb();
105 105
106 /* Get host physical address for gpa */ 106 /* Get host physical address for gpa */
107 pfn = kvmppc_gfn_to_pfn(vcpu, gfn, iswrite, &writable); 107 pfn = kvmppc_gpa_to_pfn(vcpu, orig_pte->raddr, iswrite, &writable);
108 if (is_error_noslot_pfn(pfn)) { 108 if (is_error_noslot_pfn(pfn)) {
109 printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", gfn); 109 printk(KERN_INFO "Couldn't get guest page for gpa %lx!\n",
110 orig_pte->raddr);
110 r = -EINVAL; 111 r = -EINVAL;
111 goto out; 112 goto out;
112 } 113 }
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 68468d695f12..72c20bb16d26 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -37,8 +37,6 @@
37#include <asm/ppc-opcode.h> 37#include <asm/ppc-opcode.h>
38#include <asm/cputable.h> 38#include <asm/cputable.h>
39 39
40#include "book3s_hv_cma.h"
41
42/* POWER7 has 10-bit LPIDs, PPC970 has 6-bit LPIDs */ 40/* POWER7 has 10-bit LPIDs, PPC970 has 6-bit LPIDs */
43#define MAX_LPID_970 63 41#define MAX_LPID_970 63
44 42
@@ -64,10 +62,10 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
64 } 62 }
65 63
66 kvm->arch.hpt_cma_alloc = 0; 64 kvm->arch.hpt_cma_alloc = 0;
67 VM_BUG_ON(order < KVM_CMA_CHUNK_ORDER);
68 page = kvm_alloc_hpt(1 << (order - PAGE_SHIFT)); 65 page = kvm_alloc_hpt(1 << (order - PAGE_SHIFT));
69 if (page) { 66 if (page) {
70 hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page)); 67 hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
68 memset((void *)hpt, 0, (1 << order));
71 kvm->arch.hpt_cma_alloc = 1; 69 kvm->arch.hpt_cma_alloc = 1;
72 } 70 }
73 71
@@ -450,7 +448,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
450 unsigned long slb_v; 448 unsigned long slb_v;
451 unsigned long pp, key; 449 unsigned long pp, key;
452 unsigned long v, gr; 450 unsigned long v, gr;
453 unsigned long *hptep; 451 __be64 *hptep;
454 int index; 452 int index;
455 int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR); 453 int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
456 454
@@ -473,13 +471,13 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
473 preempt_enable(); 471 preempt_enable();
474 return -ENOENT; 472 return -ENOENT;
475 } 473 }
476 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4)); 474 hptep = (__be64 *)(kvm->arch.hpt_virt + (index << 4));
477 v = hptep[0] & ~HPTE_V_HVLOCK; 475 v = be64_to_cpu(hptep[0]) & ~HPTE_V_HVLOCK;
478 gr = kvm->arch.revmap[index].guest_rpte; 476 gr = kvm->arch.revmap[index].guest_rpte;
479 477
480 /* Unlock the HPTE */ 478 /* Unlock the HPTE */
481 asm volatile("lwsync" : : : "memory"); 479 asm volatile("lwsync" : : : "memory");
482 hptep[0] = v; 480 hptep[0] = cpu_to_be64(v);
483 preempt_enable(); 481 preempt_enable();
484 482
485 gpte->eaddr = eaddr; 483 gpte->eaddr = eaddr;
@@ -530,21 +528,14 @@ static int instruction_is_store(unsigned int instr)
530static int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu, 528static int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
531 unsigned long gpa, gva_t ea, int is_store) 529 unsigned long gpa, gva_t ea, int is_store)
532{ 530{
533 int ret;
534 u32 last_inst; 531 u32 last_inst;
535 unsigned long srr0 = kvmppc_get_pc(vcpu);
536 532
537 /* We try to load the last instruction. We don't let 533 /*
538 * emulate_instruction do it as it doesn't check what
539 * kvmppc_ld returns.
540 * If we fail, we just return to the guest and try executing it again. 534 * If we fail, we just return to the guest and try executing it again.
541 */ 535 */
542 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED) { 536 if (kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst) !=
543 ret = kvmppc_ld(vcpu, &srr0, sizeof(u32), &last_inst, false); 537 EMULATE_DONE)
544 if (ret != EMULATE_DONE || last_inst == KVM_INST_FETCH_FAILED) 538 return RESUME_GUEST;
545 return RESUME_GUEST;
546 vcpu->arch.last_inst = last_inst;
547 }
548 539
549 /* 540 /*
550 * WARNING: We do not know for sure whether the instruction we just 541 * WARNING: We do not know for sure whether the instruction we just
@@ -558,7 +549,7 @@ static int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
558 * we just return and retry the instruction. 549 * we just return and retry the instruction.
559 */ 550 */
560 551
561 if (instruction_is_store(kvmppc_get_last_inst(vcpu)) != !!is_store) 552 if (instruction_is_store(last_inst) != !!is_store)
562 return RESUME_GUEST; 553 return RESUME_GUEST;
563 554
564 /* 555 /*
@@ -583,7 +574,8 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
583 unsigned long ea, unsigned long dsisr) 574 unsigned long ea, unsigned long dsisr)
584{ 575{
585 struct kvm *kvm = vcpu->kvm; 576 struct kvm *kvm = vcpu->kvm;
586 unsigned long *hptep, hpte[3], r; 577 unsigned long hpte[3], r;
578 __be64 *hptep;
587 unsigned long mmu_seq, psize, pte_size; 579 unsigned long mmu_seq, psize, pte_size;
588 unsigned long gpa_base, gfn_base; 580 unsigned long gpa_base, gfn_base;
589 unsigned long gpa, gfn, hva, pfn; 581 unsigned long gpa, gfn, hva, pfn;
@@ -606,16 +598,16 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
606 if (ea != vcpu->arch.pgfault_addr) 598 if (ea != vcpu->arch.pgfault_addr)
607 return RESUME_GUEST; 599 return RESUME_GUEST;
608 index = vcpu->arch.pgfault_index; 600 index = vcpu->arch.pgfault_index;
609 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4)); 601 hptep = (__be64 *)(kvm->arch.hpt_virt + (index << 4));
610 rev = &kvm->arch.revmap[index]; 602 rev = &kvm->arch.revmap[index];
611 preempt_disable(); 603 preempt_disable();
612 while (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) 604 while (!try_lock_hpte(hptep, HPTE_V_HVLOCK))
613 cpu_relax(); 605 cpu_relax();
614 hpte[0] = hptep[0] & ~HPTE_V_HVLOCK; 606 hpte[0] = be64_to_cpu(hptep[0]) & ~HPTE_V_HVLOCK;
615 hpte[1] = hptep[1]; 607 hpte[1] = be64_to_cpu(hptep[1]);
616 hpte[2] = r = rev->guest_rpte; 608 hpte[2] = r = rev->guest_rpte;
617 asm volatile("lwsync" : : : "memory"); 609 asm volatile("lwsync" : : : "memory");
618 hptep[0] = hpte[0]; 610 hptep[0] = cpu_to_be64(hpte[0]);
619 preempt_enable(); 611 preempt_enable();
620 612
621 if (hpte[0] != vcpu->arch.pgfault_hpte[0] || 613 if (hpte[0] != vcpu->arch.pgfault_hpte[0] ||
@@ -731,8 +723,9 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
731 preempt_disable(); 723 preempt_disable();
732 while (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) 724 while (!try_lock_hpte(hptep, HPTE_V_HVLOCK))
733 cpu_relax(); 725 cpu_relax();
734 if ((hptep[0] & ~HPTE_V_HVLOCK) != hpte[0] || hptep[1] != hpte[1] || 726 if ((be64_to_cpu(hptep[0]) & ~HPTE_V_HVLOCK) != hpte[0] ||
735 rev->guest_rpte != hpte[2]) 727 be64_to_cpu(hptep[1]) != hpte[1] ||
728 rev->guest_rpte != hpte[2])
736 /* HPTE has been changed under us; let the guest retry */ 729 /* HPTE has been changed under us; let the guest retry */
737 goto out_unlock; 730 goto out_unlock;
738 hpte[0] = (hpte[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID; 731 hpte[0] = (hpte[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID;
@@ -752,20 +745,20 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
752 rcbits = *rmap >> KVMPPC_RMAP_RC_SHIFT; 745 rcbits = *rmap >> KVMPPC_RMAP_RC_SHIFT;
753 r &= rcbits | ~(HPTE_R_R | HPTE_R_C); 746 r &= rcbits | ~(HPTE_R_R | HPTE_R_C);
754 747
755 if (hptep[0] & HPTE_V_VALID) { 748 if (be64_to_cpu(hptep[0]) & HPTE_V_VALID) {
756 /* HPTE was previously valid, so we need to invalidate it */ 749 /* HPTE was previously valid, so we need to invalidate it */
757 unlock_rmap(rmap); 750 unlock_rmap(rmap);
758 hptep[0] |= HPTE_V_ABSENT; 751 hptep[0] |= cpu_to_be64(HPTE_V_ABSENT);
759 kvmppc_invalidate_hpte(kvm, hptep, index); 752 kvmppc_invalidate_hpte(kvm, hptep, index);
760 /* don't lose previous R and C bits */ 753 /* don't lose previous R and C bits */
761 r |= hptep[1] & (HPTE_R_R | HPTE_R_C); 754 r |= be64_to_cpu(hptep[1]) & (HPTE_R_R | HPTE_R_C);
762 } else { 755 } else {
763 kvmppc_add_revmap_chain(kvm, rev, rmap, index, 0); 756 kvmppc_add_revmap_chain(kvm, rev, rmap, index, 0);
764 } 757 }
765 758
766 hptep[1] = r; 759 hptep[1] = cpu_to_be64(r);
767 eieio(); 760 eieio();
768 hptep[0] = hpte[0]; 761 hptep[0] = cpu_to_be64(hpte[0]);
769 asm volatile("ptesync" : : : "memory"); 762 asm volatile("ptesync" : : : "memory");
770 preempt_enable(); 763 preempt_enable();
771 if (page && hpte_is_writable(r)) 764 if (page && hpte_is_writable(r))
@@ -784,7 +777,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
784 return ret; 777 return ret;
785 778
786 out_unlock: 779 out_unlock:
787 hptep[0] &= ~HPTE_V_HVLOCK; 780 hptep[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
788 preempt_enable(); 781 preempt_enable();
789 goto out_put; 782 goto out_put;
790} 783}
@@ -860,7 +853,7 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
860{ 853{
861 struct revmap_entry *rev = kvm->arch.revmap; 854 struct revmap_entry *rev = kvm->arch.revmap;
862 unsigned long h, i, j; 855 unsigned long h, i, j;
863 unsigned long *hptep; 856 __be64 *hptep;
864 unsigned long ptel, psize, rcbits; 857 unsigned long ptel, psize, rcbits;
865 858
866 for (;;) { 859 for (;;) {
@@ -876,11 +869,11 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
876 * rmap chain lock. 869 * rmap chain lock.
877 */ 870 */
878 i = *rmapp & KVMPPC_RMAP_INDEX; 871 i = *rmapp & KVMPPC_RMAP_INDEX;
879 hptep = (unsigned long *) (kvm->arch.hpt_virt + (i << 4)); 872 hptep = (__be64 *) (kvm->arch.hpt_virt + (i << 4));
880 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) { 873 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
881 /* unlock rmap before spinning on the HPTE lock */ 874 /* unlock rmap before spinning on the HPTE lock */
882 unlock_rmap(rmapp); 875 unlock_rmap(rmapp);
883 while (hptep[0] & HPTE_V_HVLOCK) 876 while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
884 cpu_relax(); 877 cpu_relax();
885 continue; 878 continue;
886 } 879 }
@@ -899,14 +892,14 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
899 892
900 /* Now check and modify the HPTE */ 893 /* Now check and modify the HPTE */
901 ptel = rev[i].guest_rpte; 894 ptel = rev[i].guest_rpte;
902 psize = hpte_page_size(hptep[0], ptel); 895 psize = hpte_page_size(be64_to_cpu(hptep[0]), ptel);
903 if ((hptep[0] & HPTE_V_VALID) && 896 if ((be64_to_cpu(hptep[0]) & HPTE_V_VALID) &&
904 hpte_rpn(ptel, psize) == gfn) { 897 hpte_rpn(ptel, psize) == gfn) {
905 if (kvm->arch.using_mmu_notifiers) 898 if (kvm->arch.using_mmu_notifiers)
906 hptep[0] |= HPTE_V_ABSENT; 899 hptep[0] |= cpu_to_be64(HPTE_V_ABSENT);
907 kvmppc_invalidate_hpte(kvm, hptep, i); 900 kvmppc_invalidate_hpte(kvm, hptep, i);
908 /* Harvest R and C */ 901 /* Harvest R and C */
909 rcbits = hptep[1] & (HPTE_R_R | HPTE_R_C); 902 rcbits = be64_to_cpu(hptep[1]) & (HPTE_R_R | HPTE_R_C);
910 *rmapp |= rcbits << KVMPPC_RMAP_RC_SHIFT; 903 *rmapp |= rcbits << KVMPPC_RMAP_RC_SHIFT;
911 if (rcbits & ~rev[i].guest_rpte) { 904 if (rcbits & ~rev[i].guest_rpte) {
912 rev[i].guest_rpte = ptel | rcbits; 905 rev[i].guest_rpte = ptel | rcbits;
@@ -914,7 +907,7 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
914 } 907 }
915 } 908 }
916 unlock_rmap(rmapp); 909 unlock_rmap(rmapp);
917 hptep[0] &= ~HPTE_V_HVLOCK; 910 hptep[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
918 } 911 }
919 return 0; 912 return 0;
920} 913}
@@ -961,7 +954,7 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
961{ 954{
962 struct revmap_entry *rev = kvm->arch.revmap; 955 struct revmap_entry *rev = kvm->arch.revmap;
963 unsigned long head, i, j; 956 unsigned long head, i, j;
964 unsigned long *hptep; 957 __be64 *hptep;
965 int ret = 0; 958 int ret = 0;
966 959
967 retry: 960 retry:
@@ -977,23 +970,24 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
977 970
978 i = head = *rmapp & KVMPPC_RMAP_INDEX; 971 i = head = *rmapp & KVMPPC_RMAP_INDEX;
979 do { 972 do {
980 hptep = (unsigned long *) (kvm->arch.hpt_virt + (i << 4)); 973 hptep = (__be64 *) (kvm->arch.hpt_virt + (i << 4));
981 j = rev[i].forw; 974 j = rev[i].forw;
982 975
983 /* If this HPTE isn't referenced, ignore it */ 976 /* If this HPTE isn't referenced, ignore it */
984 if (!(hptep[1] & HPTE_R_R)) 977 if (!(be64_to_cpu(hptep[1]) & HPTE_R_R))
985 continue; 978 continue;
986 979
987 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) { 980 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
988 /* unlock rmap before spinning on the HPTE lock */ 981 /* unlock rmap before spinning on the HPTE lock */
989 unlock_rmap(rmapp); 982 unlock_rmap(rmapp);
990 while (hptep[0] & HPTE_V_HVLOCK) 983 while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
991 cpu_relax(); 984 cpu_relax();
992 goto retry; 985 goto retry;
993 } 986 }
994 987
995 /* Now check and modify the HPTE */ 988 /* Now check and modify the HPTE */
996 if ((hptep[0] & HPTE_V_VALID) && (hptep[1] & HPTE_R_R)) { 989 if ((be64_to_cpu(hptep[0]) & HPTE_V_VALID) &&
990 (be64_to_cpu(hptep[1]) & HPTE_R_R)) {
997 kvmppc_clear_ref_hpte(kvm, hptep, i); 991 kvmppc_clear_ref_hpte(kvm, hptep, i);
998 if (!(rev[i].guest_rpte & HPTE_R_R)) { 992 if (!(rev[i].guest_rpte & HPTE_R_R)) {
999 rev[i].guest_rpte |= HPTE_R_R; 993 rev[i].guest_rpte |= HPTE_R_R;
@@ -1001,7 +995,7 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1001 } 995 }
1002 ret = 1; 996 ret = 1;
1003 } 997 }
1004 hptep[0] &= ~HPTE_V_HVLOCK; 998 hptep[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
1005 } while ((i = j) != head); 999 } while ((i = j) != head);
1006 1000
1007 unlock_rmap(rmapp); 1001 unlock_rmap(rmapp);
@@ -1035,7 +1029,7 @@ static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1035 do { 1029 do {
1036 hp = (unsigned long *)(kvm->arch.hpt_virt + (i << 4)); 1030 hp = (unsigned long *)(kvm->arch.hpt_virt + (i << 4));
1037 j = rev[i].forw; 1031 j = rev[i].forw;
1038 if (hp[1] & HPTE_R_R) 1032 if (be64_to_cpu(hp[1]) & HPTE_R_R)
1039 goto out; 1033 goto out;
1040 } while ((i = j) != head); 1034 } while ((i = j) != head);
1041 } 1035 }
@@ -1075,7 +1069,7 @@ static int kvm_test_clear_dirty_npages(struct kvm *kvm, unsigned long *rmapp)
1075 unsigned long head, i, j; 1069 unsigned long head, i, j;
1076 unsigned long n; 1070 unsigned long n;
1077 unsigned long v, r; 1071 unsigned long v, r;
1078 unsigned long *hptep; 1072 __be64 *hptep;
1079 int npages_dirty = 0; 1073 int npages_dirty = 0;
1080 1074
1081 retry: 1075 retry:
@@ -1091,7 +1085,8 @@ static int kvm_test_clear_dirty_npages(struct kvm *kvm, unsigned long *rmapp)
1091 1085
1092 i = head = *rmapp & KVMPPC_RMAP_INDEX; 1086 i = head = *rmapp & KVMPPC_RMAP_INDEX;
1093 do { 1087 do {
1094 hptep = (unsigned long *) (kvm->arch.hpt_virt + (i << 4)); 1088 unsigned long hptep1;
1089 hptep = (__be64 *) (kvm->arch.hpt_virt + (i << 4));
1095 j = rev[i].forw; 1090 j = rev[i].forw;
1096 1091
1097 /* 1092 /*
@@ -1108,29 +1103,30 @@ static int kvm_test_clear_dirty_npages(struct kvm *kvm, unsigned long *rmapp)
1108 * Otherwise we need to do the tlbie even if C==0 in 1103 * Otherwise we need to do the tlbie even if C==0 in
1109 * order to pick up any delayed writeback of C. 1104 * order to pick up any delayed writeback of C.
1110 */ 1105 */
1111 if (!(hptep[1] & HPTE_R_C) && 1106 hptep1 = be64_to_cpu(hptep[1]);
1112 (!hpte_is_writable(hptep[1]) || vcpus_running(kvm))) 1107 if (!(hptep1 & HPTE_R_C) &&
1108 (!hpte_is_writable(hptep1) || vcpus_running(kvm)))
1113 continue; 1109 continue;
1114 1110
1115 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) { 1111 if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
1116 /* unlock rmap before spinning on the HPTE lock */ 1112 /* unlock rmap before spinning on the HPTE lock */
1117 unlock_rmap(rmapp); 1113 unlock_rmap(rmapp);
1118 while (hptep[0] & HPTE_V_HVLOCK) 1114 while (hptep[0] & cpu_to_be64(HPTE_V_HVLOCK))
1119 cpu_relax(); 1115 cpu_relax();
1120 goto retry; 1116 goto retry;
1121 } 1117 }
1122 1118
1123 /* Now check and modify the HPTE */ 1119 /* Now check and modify the HPTE */
1124 if (!(hptep[0] & HPTE_V_VALID)) 1120 if (!(hptep[0] & cpu_to_be64(HPTE_V_VALID)))
1125 continue; 1121 continue;
1126 1122
1127 /* need to make it temporarily absent so C is stable */ 1123 /* need to make it temporarily absent so C is stable */
1128 hptep[0] |= HPTE_V_ABSENT; 1124 hptep[0] |= cpu_to_be64(HPTE_V_ABSENT);
1129 kvmppc_invalidate_hpte(kvm, hptep, i); 1125 kvmppc_invalidate_hpte(kvm, hptep, i);
1130 v = hptep[0]; 1126 v = be64_to_cpu(hptep[0]);
1131 r = hptep[1]; 1127 r = be64_to_cpu(hptep[1]);
1132 if (r & HPTE_R_C) { 1128 if (r & HPTE_R_C) {
1133 hptep[1] = r & ~HPTE_R_C; 1129 hptep[1] = cpu_to_be64(r & ~HPTE_R_C);
1134 if (!(rev[i].guest_rpte & HPTE_R_C)) { 1130 if (!(rev[i].guest_rpte & HPTE_R_C)) {
1135 rev[i].guest_rpte |= HPTE_R_C; 1131 rev[i].guest_rpte |= HPTE_R_C;
1136 note_hpte_modification(kvm, &rev[i]); 1132 note_hpte_modification(kvm, &rev[i]);
@@ -1143,7 +1139,7 @@ static int kvm_test_clear_dirty_npages(struct kvm *kvm, unsigned long *rmapp)
1143 } 1139 }
1144 v &= ~(HPTE_V_ABSENT | HPTE_V_HVLOCK); 1140 v &= ~(HPTE_V_ABSENT | HPTE_V_HVLOCK);
1145 v |= HPTE_V_VALID; 1141 v |= HPTE_V_VALID;
1146 hptep[0] = v; 1142 hptep[0] = cpu_to_be64(v);
1147 } while ((i = j) != head); 1143 } while ((i = j) != head);
1148 1144
1149 unlock_rmap(rmapp); 1145 unlock_rmap(rmapp);
@@ -1307,7 +1303,7 @@ struct kvm_htab_ctx {
1307 * Returns 1 if this HPT entry has been modified or has pending 1303 * Returns 1 if this HPT entry has been modified or has pending
1308 * R/C bit changes. 1304 * R/C bit changes.
1309 */ 1305 */
1310static int hpte_dirty(struct revmap_entry *revp, unsigned long *hptp) 1306static int hpte_dirty(struct revmap_entry *revp, __be64 *hptp)
1311{ 1307{
1312 unsigned long rcbits_unset; 1308 unsigned long rcbits_unset;
1313 1309
@@ -1316,13 +1312,14 @@ static int hpte_dirty(struct revmap_entry *revp, unsigned long *hptp)
1316 1312
1317 /* Also need to consider changes in reference and changed bits */ 1313 /* Also need to consider changes in reference and changed bits */
1318 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C); 1314 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C);
1319 if ((hptp[0] & HPTE_V_VALID) && (hptp[1] & rcbits_unset)) 1315 if ((be64_to_cpu(hptp[0]) & HPTE_V_VALID) &&
1316 (be64_to_cpu(hptp[1]) & rcbits_unset))
1320 return 1; 1317 return 1;
1321 1318
1322 return 0; 1319 return 0;
1323} 1320}
1324 1321
1325static long record_hpte(unsigned long flags, unsigned long *hptp, 1322static long record_hpte(unsigned long flags, __be64 *hptp,
1326 unsigned long *hpte, struct revmap_entry *revp, 1323 unsigned long *hpte, struct revmap_entry *revp,
1327 int want_valid, int first_pass) 1324 int want_valid, int first_pass)
1328{ 1325{
@@ -1337,10 +1334,10 @@ static long record_hpte(unsigned long flags, unsigned long *hptp,
1337 return 0; 1334 return 0;
1338 1335
1339 valid = 0; 1336 valid = 0;
1340 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT)) { 1337 if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT)) {
1341 valid = 1; 1338 valid = 1;
1342 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) && 1339 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) &&
1343 !(hptp[0] & HPTE_V_BOLTED)) 1340 !(be64_to_cpu(hptp[0]) & HPTE_V_BOLTED))
1344 valid = 0; 1341 valid = 0;
1345 } 1342 }
1346 if (valid != want_valid) 1343 if (valid != want_valid)
@@ -1352,7 +1349,7 @@ static long record_hpte(unsigned long flags, unsigned long *hptp,
1352 preempt_disable(); 1349 preempt_disable();
1353 while (!try_lock_hpte(hptp, HPTE_V_HVLOCK)) 1350 while (!try_lock_hpte(hptp, HPTE_V_HVLOCK))
1354 cpu_relax(); 1351 cpu_relax();
1355 v = hptp[0]; 1352 v = be64_to_cpu(hptp[0]);
1356 1353
1357 /* re-evaluate valid and dirty from synchronized HPTE value */ 1354 /* re-evaluate valid and dirty from synchronized HPTE value */
1358 valid = !!(v & HPTE_V_VALID); 1355 valid = !!(v & HPTE_V_VALID);
@@ -1360,9 +1357,9 @@ static long record_hpte(unsigned long flags, unsigned long *hptp,
1360 1357
1361 /* Harvest R and C into guest view if necessary */ 1358 /* Harvest R and C into guest view if necessary */
1362 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C); 1359 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C);
1363 if (valid && (rcbits_unset & hptp[1])) { 1360 if (valid && (rcbits_unset & be64_to_cpu(hptp[1]))) {
1364 revp->guest_rpte |= (hptp[1] & (HPTE_R_R | HPTE_R_C)) | 1361 revp->guest_rpte |= (be64_to_cpu(hptp[1]) &
1365 HPTE_GR_MODIFIED; 1362 (HPTE_R_R | HPTE_R_C)) | HPTE_GR_MODIFIED;
1366 dirty = 1; 1363 dirty = 1;
1367 } 1364 }
1368 1365
@@ -1381,13 +1378,13 @@ static long record_hpte(unsigned long flags, unsigned long *hptp,
1381 revp->guest_rpte = r; 1378 revp->guest_rpte = r;
1382 } 1379 }
1383 asm volatile(PPC_RELEASE_BARRIER "" : : : "memory"); 1380 asm volatile(PPC_RELEASE_BARRIER "" : : : "memory");
1384 hptp[0] &= ~HPTE_V_HVLOCK; 1381 hptp[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
1385 preempt_enable(); 1382 preempt_enable();
1386 if (!(valid == want_valid && (first_pass || dirty))) 1383 if (!(valid == want_valid && (first_pass || dirty)))
1387 ok = 0; 1384 ok = 0;
1388 } 1385 }
1389 hpte[0] = v; 1386 hpte[0] = cpu_to_be64(v);
1390 hpte[1] = r; 1387 hpte[1] = cpu_to_be64(r);
1391 return ok; 1388 return ok;
1392} 1389}
1393 1390
@@ -1397,7 +1394,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
1397 struct kvm_htab_ctx *ctx = file->private_data; 1394 struct kvm_htab_ctx *ctx = file->private_data;
1398 struct kvm *kvm = ctx->kvm; 1395 struct kvm *kvm = ctx->kvm;
1399 struct kvm_get_htab_header hdr; 1396 struct kvm_get_htab_header hdr;
1400 unsigned long *hptp; 1397 __be64 *hptp;
1401 struct revmap_entry *revp; 1398 struct revmap_entry *revp;
1402 unsigned long i, nb, nw; 1399 unsigned long i, nb, nw;
1403 unsigned long __user *lbuf; 1400 unsigned long __user *lbuf;
@@ -1413,7 +1410,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
1413 flags = ctx->flags; 1410 flags = ctx->flags;
1414 1411
1415 i = ctx->index; 1412 i = ctx->index;
1416 hptp = (unsigned long *)(kvm->arch.hpt_virt + (i * HPTE_SIZE)); 1413 hptp = (__be64 *)(kvm->arch.hpt_virt + (i * HPTE_SIZE));
1417 revp = kvm->arch.revmap + i; 1414 revp = kvm->arch.revmap + i;
1418 lbuf = (unsigned long __user *)buf; 1415 lbuf = (unsigned long __user *)buf;
1419 1416
@@ -1497,7 +1494,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1497 unsigned long i, j; 1494 unsigned long i, j;
1498 unsigned long v, r; 1495 unsigned long v, r;
1499 unsigned long __user *lbuf; 1496 unsigned long __user *lbuf;
1500 unsigned long *hptp; 1497 __be64 *hptp;
1501 unsigned long tmp[2]; 1498 unsigned long tmp[2];
1502 ssize_t nb; 1499 ssize_t nb;
1503 long int err, ret; 1500 long int err, ret;
@@ -1539,7 +1536,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1539 i + hdr.n_valid + hdr.n_invalid > kvm->arch.hpt_npte) 1536 i + hdr.n_valid + hdr.n_invalid > kvm->arch.hpt_npte)
1540 break; 1537 break;
1541 1538
1542 hptp = (unsigned long *)(kvm->arch.hpt_virt + (i * HPTE_SIZE)); 1539 hptp = (__be64 *)(kvm->arch.hpt_virt + (i * HPTE_SIZE));
1543 lbuf = (unsigned long __user *)buf; 1540 lbuf = (unsigned long __user *)buf;
1544 for (j = 0; j < hdr.n_valid; ++j) { 1541 for (j = 0; j < hdr.n_valid; ++j) {
1545 err = -EFAULT; 1542 err = -EFAULT;
@@ -1551,7 +1548,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1551 lbuf += 2; 1548 lbuf += 2;
1552 nb += HPTE_SIZE; 1549 nb += HPTE_SIZE;
1553 1550
1554 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT)) 1551 if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
1555 kvmppc_do_h_remove(kvm, 0, i, 0, tmp); 1552 kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
1556 err = -EIO; 1553 err = -EIO;
1557 ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, i, v, r, 1554 ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, i, v, r,
@@ -1577,7 +1574,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1577 } 1574 }
1578 1575
1579 for (j = 0; j < hdr.n_invalid; ++j) { 1576 for (j = 0; j < hdr.n_invalid; ++j) {
1580 if (hptp[0] & (HPTE_V_VALID | HPTE_V_ABSENT)) 1577 if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
1581 kvmppc_do_h_remove(kvm, 0, i, 0, tmp); 1578 kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
1582 ++i; 1579 ++i;
1583 hptp += 2; 1580 hptp += 2;
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 3f295269af37..5a2bc4b0dfe5 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -439,12 +439,6 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
439 (mfmsr() & MSR_HV)) 439 (mfmsr() & MSR_HV))
440 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; 440 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
441 break; 441 break;
442 case SPRN_PURR:
443 to_book3s(vcpu)->purr_offset = spr_val - get_tb();
444 break;
445 case SPRN_SPURR:
446 to_book3s(vcpu)->spurr_offset = spr_val - get_tb();
447 break;
448 case SPRN_GQR0: 442 case SPRN_GQR0:
449 case SPRN_GQR1: 443 case SPRN_GQR1:
450 case SPRN_GQR2: 444 case SPRN_GQR2:
@@ -455,10 +449,10 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
455 case SPRN_GQR7: 449 case SPRN_GQR7:
456 to_book3s(vcpu)->gqr[sprn - SPRN_GQR0] = spr_val; 450 to_book3s(vcpu)->gqr[sprn - SPRN_GQR0] = spr_val;
457 break; 451 break;
452#ifdef CONFIG_PPC_BOOK3S_64
458 case SPRN_FSCR: 453 case SPRN_FSCR:
459 vcpu->arch.fscr = spr_val; 454 kvmppc_set_fscr(vcpu, spr_val);
460 break; 455 break;
461#ifdef CONFIG_PPC_BOOK3S_64
462 case SPRN_BESCR: 456 case SPRN_BESCR:
463 vcpu->arch.bescr = spr_val; 457 vcpu->arch.bescr = spr_val;
464 break; 458 break;
@@ -572,10 +566,22 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
572 *spr_val = 0; 566 *spr_val = 0;
573 break; 567 break;
574 case SPRN_PURR: 568 case SPRN_PURR:
575 *spr_val = get_tb() + to_book3s(vcpu)->purr_offset; 569 /*
570 * On exit we would have updated purr
571 */
572 *spr_val = vcpu->arch.purr;
576 break; 573 break;
577 case SPRN_SPURR: 574 case SPRN_SPURR:
578 *spr_val = get_tb() + to_book3s(vcpu)->purr_offset; 575 /*
576 * On exit we would have updated spurr
577 */
578 *spr_val = vcpu->arch.spurr;
579 break;
580 case SPRN_VTB:
581 *spr_val = vcpu->arch.vtb;
582 break;
583 case SPRN_IC:
584 *spr_val = vcpu->arch.ic;
579 break; 585 break;
580 case SPRN_GQR0: 586 case SPRN_GQR0:
581 case SPRN_GQR1: 587 case SPRN_GQR1:
@@ -587,10 +593,10 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val
587 case SPRN_GQR7: 593 case SPRN_GQR7:
588 *spr_val = to_book3s(vcpu)->gqr[sprn - SPRN_GQR0]; 594 *spr_val = to_book3s(vcpu)->gqr[sprn - SPRN_GQR0];
589 break; 595 break;
596#ifdef CONFIG_PPC_BOOK3S_64
590 case SPRN_FSCR: 597 case SPRN_FSCR:
591 *spr_val = vcpu->arch.fscr; 598 *spr_val = vcpu->arch.fscr;
592 break; 599 break;
593#ifdef CONFIG_PPC_BOOK3S_64
594 case SPRN_BESCR: 600 case SPRN_BESCR:
595 *spr_val = vcpu->arch.bescr; 601 *spr_val = vcpu->arch.bescr;
596 break; 602 break;
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 7a12edbb61e7..27cced9c7249 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -35,6 +35,7 @@
35 35
36#include <asm/reg.h> 36#include <asm/reg.h>
37#include <asm/cputable.h> 37#include <asm/cputable.h>
38#include <asm/cache.h>
38#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
39#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
@@ -67,6 +68,15 @@
67/* Used as a "null" value for timebase values */ 68/* Used as a "null" value for timebase values */
68#define TB_NIL (~(u64)0) 69#define TB_NIL (~(u64)0)
69 70
71static DECLARE_BITMAP(default_enabled_hcalls, MAX_HCALL_OPCODE/4 + 1);
72
73#if defined(CONFIG_PPC_64K_PAGES)
74#define MPP_BUFFER_ORDER 0
75#elif defined(CONFIG_PPC_4K_PAGES)
76#define MPP_BUFFER_ORDER 3
77#endif
78
79
70static void kvmppc_end_cede(struct kvm_vcpu *vcpu); 80static void kvmppc_end_cede(struct kvm_vcpu *vcpu);
71static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu); 81static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu);
72 82
@@ -270,7 +280,7 @@ struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id)
270static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa) 280static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa)
271{ 281{
272 vpa->__old_status |= LPPACA_OLD_SHARED_PROC; 282 vpa->__old_status |= LPPACA_OLD_SHARED_PROC;
273 vpa->yield_count = 1; 283 vpa->yield_count = cpu_to_be32(1);
274} 284}
275 285
276static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v, 286static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v,
@@ -293,8 +303,8 @@ static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v,
293struct reg_vpa { 303struct reg_vpa {
294 u32 dummy; 304 u32 dummy;
295 union { 305 union {
296 u16 hword; 306 __be16 hword;
297 u32 word; 307 __be32 word;
298 } length; 308 } length;
299}; 309};
300 310
@@ -333,9 +343,9 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu,
333 if (va == NULL) 343 if (va == NULL)
334 return H_PARAMETER; 344 return H_PARAMETER;
335 if (subfunc == H_VPA_REG_VPA) 345 if (subfunc == H_VPA_REG_VPA)
336 len = ((struct reg_vpa *)va)->length.hword; 346 len = be16_to_cpu(((struct reg_vpa *)va)->length.hword);
337 else 347 else
338 len = ((struct reg_vpa *)va)->length.word; 348 len = be32_to_cpu(((struct reg_vpa *)va)->length.word);
339 kvmppc_unpin_guest_page(kvm, va, vpa, false); 349 kvmppc_unpin_guest_page(kvm, va, vpa, false);
340 350
341 /* Check length */ 351 /* Check length */
@@ -540,21 +550,63 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
540 return; 550 return;
541 memset(dt, 0, sizeof(struct dtl_entry)); 551 memset(dt, 0, sizeof(struct dtl_entry));
542 dt->dispatch_reason = 7; 552 dt->dispatch_reason = 7;
543 dt->processor_id = vc->pcpu + vcpu->arch.ptid; 553 dt->processor_id = cpu_to_be16(vc->pcpu + vcpu->arch.ptid);
544 dt->timebase = now + vc->tb_offset; 554 dt->timebase = cpu_to_be64(now + vc->tb_offset);
545 dt->enqueue_to_dispatch_time = stolen; 555 dt->enqueue_to_dispatch_time = cpu_to_be32(stolen);
546 dt->srr0 = kvmppc_get_pc(vcpu); 556 dt->srr0 = cpu_to_be64(kvmppc_get_pc(vcpu));
547 dt->srr1 = vcpu->arch.shregs.msr; 557 dt->srr1 = cpu_to_be64(vcpu->arch.shregs.msr);
548 ++dt; 558 ++dt;
549 if (dt == vcpu->arch.dtl.pinned_end) 559 if (dt == vcpu->arch.dtl.pinned_end)
550 dt = vcpu->arch.dtl.pinned_addr; 560 dt = vcpu->arch.dtl.pinned_addr;
551 vcpu->arch.dtl_ptr = dt; 561 vcpu->arch.dtl_ptr = dt;
552 /* order writing *dt vs. writing vpa->dtl_idx */ 562 /* order writing *dt vs. writing vpa->dtl_idx */
553 smp_wmb(); 563 smp_wmb();
554 vpa->dtl_idx = ++vcpu->arch.dtl_index; 564 vpa->dtl_idx = cpu_to_be64(++vcpu->arch.dtl_index);
555 vcpu->arch.dtl.dirty = true; 565 vcpu->arch.dtl.dirty = true;
556} 566}
557 567
568static bool kvmppc_power8_compatible(struct kvm_vcpu *vcpu)
569{
570 if (vcpu->arch.vcore->arch_compat >= PVR_ARCH_207)
571 return true;
572 if ((!vcpu->arch.vcore->arch_compat) &&
573 cpu_has_feature(CPU_FTR_ARCH_207S))
574 return true;
575 return false;
576}
577
578static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
579 unsigned long resource, unsigned long value1,
580 unsigned long value2)
581{
582 switch (resource) {
583 case H_SET_MODE_RESOURCE_SET_CIABR:
584 if (!kvmppc_power8_compatible(vcpu))
585 return H_P2;
586 if (value2)
587 return H_P4;
588 if (mflags)
589 return H_UNSUPPORTED_FLAG_START;
590 /* Guests can't breakpoint the hypervisor */
591 if ((value1 & CIABR_PRIV) == CIABR_PRIV_HYPER)
592 return H_P3;
593 vcpu->arch.ciabr = value1;
594 return H_SUCCESS;
595 case H_SET_MODE_RESOURCE_SET_DAWR:
596 if (!kvmppc_power8_compatible(vcpu))
597 return H_P2;
598 if (mflags)
599 return H_UNSUPPORTED_FLAG_START;
600 if (value2 & DABRX_HYP)
601 return H_P4;
602 vcpu->arch.dawr = value1;
603 vcpu->arch.dawrx = value2;
604 return H_SUCCESS;
605 default:
606 return H_TOO_HARD;
607 }
608}
609
558int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) 610int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
559{ 611{
560 unsigned long req = kvmppc_get_gpr(vcpu, 3); 612 unsigned long req = kvmppc_get_gpr(vcpu, 3);
@@ -562,6 +614,10 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
562 struct kvm_vcpu *tvcpu; 614 struct kvm_vcpu *tvcpu;
563 int idx, rc; 615 int idx, rc;
564 616
617 if (req <= MAX_HCALL_OPCODE &&
618 !test_bit(req/4, vcpu->kvm->arch.enabled_hcalls))
619 return RESUME_HOST;
620
565 switch (req) { 621 switch (req) {
566 case H_ENTER: 622 case H_ENTER:
567 idx = srcu_read_lock(&vcpu->kvm->srcu); 623 idx = srcu_read_lock(&vcpu->kvm->srcu);
@@ -620,7 +676,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
620 676
621 /* Send the error out to userspace via KVM_RUN */ 677 /* Send the error out to userspace via KVM_RUN */
622 return rc; 678 return rc;
623 679 case H_SET_MODE:
680 ret = kvmppc_h_set_mode(vcpu, kvmppc_get_gpr(vcpu, 4),
681 kvmppc_get_gpr(vcpu, 5),
682 kvmppc_get_gpr(vcpu, 6),
683 kvmppc_get_gpr(vcpu, 7));
684 if (ret == H_TOO_HARD)
685 return RESUME_HOST;
686 break;
624 case H_XIRR: 687 case H_XIRR:
625 case H_CPPR: 688 case H_CPPR:
626 case H_EOI: 689 case H_EOI:
@@ -639,6 +702,29 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
639 return RESUME_GUEST; 702 return RESUME_GUEST;
640} 703}
641 704
705static int kvmppc_hcall_impl_hv(unsigned long cmd)
706{
707 switch (cmd) {
708 case H_CEDE:
709 case H_PROD:
710 case H_CONFER:
711 case H_REGISTER_VPA:
712 case H_SET_MODE:
713#ifdef CONFIG_KVM_XICS
714 case H_XIRR:
715 case H_CPPR:
716 case H_EOI:
717 case H_IPI:
718 case H_IPOLL:
719 case H_XIRR_X:
720#endif
721 return 1;
722 }
723
724 /* See if it's in the real-mode table */
725 return kvmppc_hcall_impl_hv_realmode(cmd);
726}
727
642static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu, 728static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
643 struct task_struct *tsk) 729 struct task_struct *tsk)
644{ 730{
@@ -785,7 +871,8 @@ static int kvm_arch_vcpu_ioctl_set_sregs_hv(struct kvm_vcpu *vcpu,
785 return 0; 871 return 0;
786} 872}
787 873
788static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr) 874static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr,
875 bool preserve_top32)
789{ 876{
790 struct kvmppc_vcore *vc = vcpu->arch.vcore; 877 struct kvmppc_vcore *vc = vcpu->arch.vcore;
791 u64 mask; 878 u64 mask;
@@ -820,6 +907,10 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr)
820 mask = LPCR_DPFD | LPCR_ILE | LPCR_TC; 907 mask = LPCR_DPFD | LPCR_ILE | LPCR_TC;
821 if (cpu_has_feature(CPU_FTR_ARCH_207S)) 908 if (cpu_has_feature(CPU_FTR_ARCH_207S))
822 mask |= LPCR_AIL; 909 mask |= LPCR_AIL;
910
911 /* Broken 32-bit version of LPCR must not clear top bits */
912 if (preserve_top32)
913 mask &= 0xFFFFFFFF;
823 vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask); 914 vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask);
824 spin_unlock(&vc->lock); 915 spin_unlock(&vc->lock);
825} 916}
@@ -894,12 +985,6 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
894 case KVM_REG_PPC_CIABR: 985 case KVM_REG_PPC_CIABR:
895 *val = get_reg_val(id, vcpu->arch.ciabr); 986 *val = get_reg_val(id, vcpu->arch.ciabr);
896 break; 987 break;
897 case KVM_REG_PPC_IC:
898 *val = get_reg_val(id, vcpu->arch.ic);
899 break;
900 case KVM_REG_PPC_VTB:
901 *val = get_reg_val(id, vcpu->arch.vtb);
902 break;
903 case KVM_REG_PPC_CSIGR: 988 case KVM_REG_PPC_CSIGR:
904 *val = get_reg_val(id, vcpu->arch.csigr); 989 *val = get_reg_val(id, vcpu->arch.csigr);
905 break; 990 break;
@@ -939,6 +1024,7 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
939 *val = get_reg_val(id, vcpu->arch.vcore->tb_offset); 1024 *val = get_reg_val(id, vcpu->arch.vcore->tb_offset);
940 break; 1025 break;
941 case KVM_REG_PPC_LPCR: 1026 case KVM_REG_PPC_LPCR:
1027 case KVM_REG_PPC_LPCR_64:
942 *val = get_reg_val(id, vcpu->arch.vcore->lpcr); 1028 *val = get_reg_val(id, vcpu->arch.vcore->lpcr);
943 break; 1029 break;
944 case KVM_REG_PPC_PPR: 1030 case KVM_REG_PPC_PPR:
@@ -1094,12 +1180,6 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
1094 if ((vcpu->arch.ciabr & CIABR_PRIV) == CIABR_PRIV_HYPER) 1180 if ((vcpu->arch.ciabr & CIABR_PRIV) == CIABR_PRIV_HYPER)
1095 vcpu->arch.ciabr &= ~CIABR_PRIV; /* disable */ 1181 vcpu->arch.ciabr &= ~CIABR_PRIV; /* disable */
1096 break; 1182 break;
1097 case KVM_REG_PPC_IC:
1098 vcpu->arch.ic = set_reg_val(id, *val);
1099 break;
1100 case KVM_REG_PPC_VTB:
1101 vcpu->arch.vtb = set_reg_val(id, *val);
1102 break;
1103 case KVM_REG_PPC_CSIGR: 1183 case KVM_REG_PPC_CSIGR:
1104 vcpu->arch.csigr = set_reg_val(id, *val); 1184 vcpu->arch.csigr = set_reg_val(id, *val);
1105 break; 1185 break;
@@ -1150,7 +1230,10 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
1150 ALIGN(set_reg_val(id, *val), 1UL << 24); 1230 ALIGN(set_reg_val(id, *val), 1UL << 24);
1151 break; 1231 break;
1152 case KVM_REG_PPC_LPCR: 1232 case KVM_REG_PPC_LPCR:
1153 kvmppc_set_lpcr(vcpu, set_reg_val(id, *val)); 1233 kvmppc_set_lpcr(vcpu, set_reg_val(id, *val), true);
1234 break;
1235 case KVM_REG_PPC_LPCR_64:
1236 kvmppc_set_lpcr(vcpu, set_reg_val(id, *val), false);
1154 break; 1237 break;
1155 case KVM_REG_PPC_PPR: 1238 case KVM_REG_PPC_PPR:
1156 vcpu->arch.ppr = set_reg_val(id, *val); 1239 vcpu->arch.ppr = set_reg_val(id, *val);
@@ -1228,6 +1311,33 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
1228 return r; 1311 return r;
1229} 1312}
1230 1313
1314static struct kvmppc_vcore *kvmppc_vcore_create(struct kvm *kvm, int core)
1315{
1316 struct kvmppc_vcore *vcore;
1317
1318 vcore = kzalloc(sizeof(struct kvmppc_vcore), GFP_KERNEL);
1319
1320 if (vcore == NULL)
1321 return NULL;
1322
1323 INIT_LIST_HEAD(&vcore->runnable_threads);
1324 spin_lock_init(&vcore->lock);
1325 init_waitqueue_head(&vcore->wq);
1326 vcore->preempt_tb = TB_NIL;
1327 vcore->lpcr = kvm->arch.lpcr;
1328 vcore->first_vcpuid = core * threads_per_subcore;
1329 vcore->kvm = kvm;
1330
1331 vcore->mpp_buffer_is_valid = false;
1332
1333 if (cpu_has_feature(CPU_FTR_ARCH_207S))
1334 vcore->mpp_buffer = (void *)__get_free_pages(
1335 GFP_KERNEL|__GFP_ZERO,
1336 MPP_BUFFER_ORDER);
1337
1338 return vcore;
1339}
1340
1231static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm, 1341static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
1232 unsigned int id) 1342 unsigned int id)
1233{ 1343{
@@ -1279,16 +1389,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
1279 mutex_lock(&kvm->lock); 1389 mutex_lock(&kvm->lock);
1280 vcore = kvm->arch.vcores[core]; 1390 vcore = kvm->arch.vcores[core];
1281 if (!vcore) { 1391 if (!vcore) {
1282 vcore = kzalloc(sizeof(struct kvmppc_vcore), GFP_KERNEL); 1392 vcore = kvmppc_vcore_create(kvm, core);
1283 if (vcore) {
1284 INIT_LIST_HEAD(&vcore->runnable_threads);
1285 spin_lock_init(&vcore->lock);
1286 init_waitqueue_head(&vcore->wq);
1287 vcore->preempt_tb = TB_NIL;
1288 vcore->lpcr = kvm->arch.lpcr;
1289 vcore->first_vcpuid = core * threads_per_subcore;
1290 vcore->kvm = kvm;
1291 }
1292 kvm->arch.vcores[core] = vcore; 1393 kvm->arch.vcores[core] = vcore;
1293 kvm->arch.online_vcores++; 1394 kvm->arch.online_vcores++;
1294 } 1395 }
@@ -1500,6 +1601,33 @@ static int on_primary_thread(void)
1500 return 1; 1601 return 1;
1501} 1602}
1502 1603
1604static void kvmppc_start_saving_l2_cache(struct kvmppc_vcore *vc)
1605{
1606 phys_addr_t phy_addr, mpp_addr;
1607
1608 phy_addr = (phys_addr_t)virt_to_phys(vc->mpp_buffer);
1609 mpp_addr = phy_addr & PPC_MPPE_ADDRESS_MASK;
1610
1611 mtspr(SPRN_MPPR, mpp_addr | PPC_MPPR_FETCH_ABORT);
1612 logmpp(mpp_addr | PPC_LOGMPP_LOG_L2);
1613
1614 vc->mpp_buffer_is_valid = true;
1615}
1616
1617static void kvmppc_start_restoring_l2_cache(const struct kvmppc_vcore *vc)
1618{
1619 phys_addr_t phy_addr, mpp_addr;
1620
1621 phy_addr = virt_to_phys(vc->mpp_buffer);
1622 mpp_addr = phy_addr & PPC_MPPE_ADDRESS_MASK;
1623
1624 /* We must abort any in-progress save operations to ensure
1625 * the table is valid so that prefetch engine knows when to
1626 * stop prefetching. */
1627 logmpp(mpp_addr | PPC_LOGMPP_LOG_ABORT);
1628 mtspr(SPRN_MPPR, mpp_addr | PPC_MPPR_FETCH_WHOLE_TABLE);
1629}
1630
1503/* 1631/*
1504 * Run a set of guest threads on a physical core. 1632 * Run a set of guest threads on a physical core.
1505 * Called with vc->lock held. 1633 * Called with vc->lock held.
@@ -1577,9 +1705,16 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1577 1705
1578 srcu_idx = srcu_read_lock(&vc->kvm->srcu); 1706 srcu_idx = srcu_read_lock(&vc->kvm->srcu);
1579 1707
1708 if (vc->mpp_buffer_is_valid)
1709 kvmppc_start_restoring_l2_cache(vc);
1710
1580 __kvmppc_vcore_entry(); 1711 __kvmppc_vcore_entry();
1581 1712
1582 spin_lock(&vc->lock); 1713 spin_lock(&vc->lock);
1714
1715 if (vc->mpp_buffer)
1716 kvmppc_start_saving_l2_cache(vc);
1717
1583 /* disable sending of IPIs on virtual external irqs */ 1718 /* disable sending of IPIs on virtual external irqs */
1584 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) 1719 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
1585 vcpu->cpu = -1; 1720 vcpu->cpu = -1;
@@ -1929,12 +2064,6 @@ static void kvmppc_add_seg_page_size(struct kvm_ppc_one_seg_page_size **sps,
1929 (*sps)->page_shift = def->shift; 2064 (*sps)->page_shift = def->shift;
1930 (*sps)->slb_enc = def->sllp; 2065 (*sps)->slb_enc = def->sllp;
1931 (*sps)->enc[0].page_shift = def->shift; 2066 (*sps)->enc[0].page_shift = def->shift;
1932 /*
1933 * Only return base page encoding. We don't want to return
1934 * all the supporting pte_enc, because our H_ENTER doesn't
1935 * support MPSS yet. Once they do, we can start passing all
1936 * support pte_enc here
1937 */
1938 (*sps)->enc[0].pte_enc = def->penc[linux_psize]; 2067 (*sps)->enc[0].pte_enc = def->penc[linux_psize];
1939 /* 2068 /*
1940 * Add 16MB MPSS support if host supports it 2069 * Add 16MB MPSS support if host supports it
@@ -2281,6 +2410,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm)
2281 */ 2410 */
2282 cpumask_setall(&kvm->arch.need_tlb_flush); 2411 cpumask_setall(&kvm->arch.need_tlb_flush);
2283 2412
2413 /* Start out with the default set of hcalls enabled */
2414 memcpy(kvm->arch.enabled_hcalls, default_enabled_hcalls,
2415 sizeof(kvm->arch.enabled_hcalls));
2416
2284 kvm->arch.rma = NULL; 2417 kvm->arch.rma = NULL;
2285 2418
2286 kvm->arch.host_sdr1 = mfspr(SPRN_SDR1); 2419 kvm->arch.host_sdr1 = mfspr(SPRN_SDR1);
@@ -2323,8 +2456,14 @@ static void kvmppc_free_vcores(struct kvm *kvm)
2323{ 2456{
2324 long int i; 2457 long int i;
2325 2458
2326 for (i = 0; i < KVM_MAX_VCORES; ++i) 2459 for (i = 0; i < KVM_MAX_VCORES; ++i) {
2460 if (kvm->arch.vcores[i] && kvm->arch.vcores[i]->mpp_buffer) {
2461 struct kvmppc_vcore *vc = kvm->arch.vcores[i];
2462 free_pages((unsigned long)vc->mpp_buffer,
2463 MPP_BUFFER_ORDER);
2464 }
2327 kfree(kvm->arch.vcores[i]); 2465 kfree(kvm->arch.vcores[i]);
2466 }
2328 kvm->arch.online_vcores = 0; 2467 kvm->arch.online_vcores = 0;
2329} 2468}
2330 2469
@@ -2419,6 +2558,49 @@ static long kvm_arch_vm_ioctl_hv(struct file *filp,
2419 return r; 2558 return r;
2420} 2559}
2421 2560
2561/*
2562 * List of hcall numbers to enable by default.
2563 * For compatibility with old userspace, we enable by default
2564 * all hcalls that were implemented before the hcall-enabling
2565 * facility was added. Note this list should not include H_RTAS.
2566 */
2567static unsigned int default_hcall_list[] = {
2568 H_REMOVE,
2569 H_ENTER,
2570 H_READ,
2571 H_PROTECT,
2572 H_BULK_REMOVE,
2573 H_GET_TCE,
2574 H_PUT_TCE,
2575 H_SET_DABR,
2576 H_SET_XDABR,
2577 H_CEDE,
2578 H_PROD,
2579 H_CONFER,
2580 H_REGISTER_VPA,
2581#ifdef CONFIG_KVM_XICS
2582 H_EOI,
2583 H_CPPR,
2584 H_IPI,
2585 H_IPOLL,
2586 H_XIRR,
2587 H_XIRR_X,
2588#endif
2589 0
2590};
2591
2592static void init_default_hcalls(void)
2593{
2594 int i;
2595 unsigned int hcall;
2596
2597 for (i = 0; default_hcall_list[i]; ++i) {
2598 hcall = default_hcall_list[i];
2599 WARN_ON(!kvmppc_hcall_impl_hv(hcall));
2600 __set_bit(hcall / 4, default_enabled_hcalls);
2601 }
2602}
2603
2422static struct kvmppc_ops kvm_ops_hv = { 2604static struct kvmppc_ops kvm_ops_hv = {
2423 .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv, 2605 .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
2424 .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv, 2606 .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
@@ -2451,6 +2633,7 @@ static struct kvmppc_ops kvm_ops_hv = {
2451 .emulate_mfspr = kvmppc_core_emulate_mfspr_hv, 2633 .emulate_mfspr = kvmppc_core_emulate_mfspr_hv,
2452 .fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv, 2634 .fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv,
2453 .arch_vm_ioctl = kvm_arch_vm_ioctl_hv, 2635 .arch_vm_ioctl = kvm_arch_vm_ioctl_hv,
2636 .hcall_implemented = kvmppc_hcall_impl_hv,
2454}; 2637};
2455 2638
2456static int kvmppc_book3s_init_hv(void) 2639static int kvmppc_book3s_init_hv(void)
@@ -2466,6 +2649,8 @@ static int kvmppc_book3s_init_hv(void)
2466 kvm_ops_hv.owner = THIS_MODULE; 2649 kvm_ops_hv.owner = THIS_MODULE;
2467 kvmppc_hv_ops = &kvm_ops_hv; 2650 kvmppc_hv_ops = &kvm_ops_hv;
2468 2651
2652 init_default_hcalls();
2653
2469 r = kvmppc_mmu_hv_init(); 2654 r = kvmppc_mmu_hv_init();
2470 return r; 2655 return r;
2471} 2656}
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index 7cde8a665205..329d7fdd0a6a 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -16,12 +16,14 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/memblock.h> 17#include <linux/memblock.h>
18#include <linux/sizes.h> 18#include <linux/sizes.h>
19#include <linux/cma.h>
19 20
20#include <asm/cputable.h> 21#include <asm/cputable.h>
21#include <asm/kvm_ppc.h> 22#include <asm/kvm_ppc.h>
22#include <asm/kvm_book3s.h> 23#include <asm/kvm_book3s.h>
23 24
24#include "book3s_hv_cma.h" 25#define KVM_CMA_CHUNK_ORDER 18
26
25/* 27/*
26 * Hash page table alignment on newer cpus(CPU_FTR_ARCH_206) 28 * Hash page table alignment on newer cpus(CPU_FTR_ARCH_206)
27 * should be power of 2. 29 * should be power of 2.
@@ -43,6 +45,8 @@ static unsigned long kvm_cma_resv_ratio = 5;
43unsigned long kvm_rma_pages = (1 << 27) >> PAGE_SHIFT; /* 128MB */ 45unsigned long kvm_rma_pages = (1 << 27) >> PAGE_SHIFT; /* 128MB */
44EXPORT_SYMBOL_GPL(kvm_rma_pages); 46EXPORT_SYMBOL_GPL(kvm_rma_pages);
45 47
48static struct cma *kvm_cma;
49
46/* Work out RMLS (real mode limit selector) field value for a given RMA size. 50/* Work out RMLS (real mode limit selector) field value for a given RMA size.
47 Assumes POWER7 or PPC970. */ 51 Assumes POWER7 or PPC970. */
48static inline int lpcr_rmls(unsigned long rma_size) 52static inline int lpcr_rmls(unsigned long rma_size)
@@ -97,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma()
97 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); 101 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL);
98 if (!ri) 102 if (!ri)
99 return NULL; 103 return NULL;
100 page = kvm_alloc_cma(kvm_rma_pages, kvm_rma_pages); 104 page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages));
101 if (!page) 105 if (!page)
102 goto err_out; 106 goto err_out;
103 atomic_set(&ri->use_count, 1); 107 atomic_set(&ri->use_count, 1);
@@ -112,7 +116,7 @@ EXPORT_SYMBOL_GPL(kvm_alloc_rma);
112void kvm_release_rma(struct kvm_rma_info *ri) 116void kvm_release_rma(struct kvm_rma_info *ri)
113{ 117{
114 if (atomic_dec_and_test(&ri->use_count)) { 118 if (atomic_dec_and_test(&ri->use_count)) {
115 kvm_release_cma(pfn_to_page(ri->base_pfn), kvm_rma_pages); 119 cma_release(kvm_cma, pfn_to_page(ri->base_pfn), kvm_rma_pages);
116 kfree(ri); 120 kfree(ri);
117 } 121 }
118} 122}
@@ -131,16 +135,18 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages)
131{ 135{
132 unsigned long align_pages = HPT_ALIGN_PAGES; 136 unsigned long align_pages = HPT_ALIGN_PAGES;
133 137
138 VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
139
134 /* Old CPUs require HPT aligned on a multiple of its size */ 140 /* Old CPUs require HPT aligned on a multiple of its size */
135 if (!cpu_has_feature(CPU_FTR_ARCH_206)) 141 if (!cpu_has_feature(CPU_FTR_ARCH_206))
136 align_pages = nr_pages; 142 align_pages = nr_pages;
137 return kvm_alloc_cma(nr_pages, align_pages); 143 return cma_alloc(kvm_cma, nr_pages, get_order(align_pages));
138} 144}
139EXPORT_SYMBOL_GPL(kvm_alloc_hpt); 145EXPORT_SYMBOL_GPL(kvm_alloc_hpt);
140 146
141void kvm_release_hpt(struct page *page, unsigned long nr_pages) 147void kvm_release_hpt(struct page *page, unsigned long nr_pages)
142{ 148{
143 kvm_release_cma(page, nr_pages); 149 cma_release(kvm_cma, page, nr_pages);
144} 150}
145EXPORT_SYMBOL_GPL(kvm_release_hpt); 151EXPORT_SYMBOL_GPL(kvm_release_hpt);
146 152
@@ -179,7 +185,8 @@ void __init kvm_cma_reserve(void)
179 align_size = HPT_ALIGN_PAGES << PAGE_SHIFT; 185 align_size = HPT_ALIGN_PAGES << PAGE_SHIFT;
180 186
181 align_size = max(kvm_rma_pages << PAGE_SHIFT, align_size); 187 align_size = max(kvm_rma_pages << PAGE_SHIFT, align_size);
182 kvm_cma_declare_contiguous(selected_size, align_size); 188 cma_declare_contiguous(0, selected_size, 0, align_size,
189 KVM_CMA_CHUNK_ORDER - PAGE_SHIFT, false, &kvm_cma);
183 } 190 }
184} 191}
185 192
@@ -212,3 +219,16 @@ bool kvm_hv_mode_active(void)
212{ 219{
213 return atomic_read(&hv_vm_count) != 0; 220 return atomic_read(&hv_vm_count) != 0;
214} 221}
222
223extern int hcall_real_table[], hcall_real_table_end[];
224
225int kvmppc_hcall_impl_hv_realmode(unsigned long cmd)
226{
227 cmd /= 4;
228 if (cmd < hcall_real_table_end - hcall_real_table &&
229 hcall_real_table[cmd])
230 return 1;
231
232 return 0;
233}
234EXPORT_SYMBOL_GPL(kvmppc_hcall_impl_hv_realmode);
diff --git a/arch/powerpc/kvm/book3s_hv_cma.c b/arch/powerpc/kvm/book3s_hv_cma.c
deleted file mode 100644
index d9d3d8553d51..000000000000
--- a/arch/powerpc/kvm/book3s_hv_cma.c
+++ /dev/null
@@ -1,240 +0,0 @@
1/*
2 * Contiguous Memory Allocator for ppc KVM hash pagetable based on CMA
3 * for DMA mapping framework
4 *
5 * Copyright IBM Corporation, 2013
6 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
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; either version 2 of the
11 * License or (at your optional) any later version of the license.
12 *
13 */
14#define pr_fmt(fmt) "kvm_cma: " fmt
15
16#ifdef CONFIG_CMA_DEBUG
17#ifndef DEBUG
18# define DEBUG
19#endif
20#endif
21
22#include <linux/memblock.h>
23#include <linux/mutex.h>
24#include <linux/sizes.h>
25#include <linux/slab.h>
26
27#include "book3s_hv_cma.h"
28
29struct kvm_cma {
30 unsigned long base_pfn;
31 unsigned long count;
32 unsigned long *bitmap;
33};
34
35static DEFINE_MUTEX(kvm_cma_mutex);
36static struct kvm_cma kvm_cma_area;
37
38/**
39 * kvm_cma_declare_contiguous() - reserve area for contiguous memory handling
40 * for kvm hash pagetable
41 * @size: Size of the reserved memory.
42 * @alignment: Alignment for the contiguous memory area
43 *
44 * This function reserves memory for kvm cma area. It should be
45 * called by arch code when early allocator (memblock or bootmem)
46 * is still activate.
47 */
48long __init kvm_cma_declare_contiguous(phys_addr_t size, phys_addr_t alignment)
49{
50 long base_pfn;
51 phys_addr_t addr;
52 struct kvm_cma *cma = &kvm_cma_area;
53
54 pr_debug("%s(size %lx)\n", __func__, (unsigned long)size);
55
56 if (!size)
57 return -EINVAL;
58 /*
59 * Sanitise input arguments.
60 * We should be pageblock aligned for CMA.
61 */
62 alignment = max(alignment, (phys_addr_t)(PAGE_SIZE << pageblock_order));
63 size = ALIGN(size, alignment);
64 /*
65 * Reserve memory
66 * Use __memblock_alloc_base() since
67 * memblock_alloc_base() panic()s.
68 */
69 addr = __memblock_alloc_base(size, alignment, 0);
70 if (!addr) {
71 base_pfn = -ENOMEM;
72 goto err;
73 } else
74 base_pfn = PFN_DOWN(addr);
75
76 /*
77 * Each reserved area must be initialised later, when more kernel
78 * subsystems (like slab allocator) are available.
79 */
80 cma->base_pfn = base_pfn;
81 cma->count = size >> PAGE_SHIFT;
82 pr_info("CMA: reserved %ld MiB\n", (unsigned long)size / SZ_1M);
83 return 0;
84err:
85 pr_err("CMA: failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
86 return base_pfn;
87}
88
89/**
90 * kvm_alloc_cma() - allocate pages from contiguous area
91 * @nr_pages: Requested number of pages.
92 * @align_pages: Requested alignment in number of pages
93 *
94 * This function allocates memory buffer for hash pagetable.
95 */
96struct page *kvm_alloc_cma(unsigned long nr_pages, unsigned long align_pages)
97{
98 int ret;
99 struct page *page = NULL;
100 struct kvm_cma *cma = &kvm_cma_area;
101 unsigned long chunk_count, nr_chunk;
102 unsigned long mask, pfn, pageno, start = 0;
103
104
105 if (!cma || !cma->count)
106 return NULL;
107
108 pr_debug("%s(cma %p, count %lu, align pages %lu)\n", __func__,
109 (void *)cma, nr_pages, align_pages);
110
111 if (!nr_pages)
112 return NULL;
113 /*
114 * align mask with chunk size. The bit tracks pages in chunk size
115 */
116 VM_BUG_ON(!is_power_of_2(align_pages));
117 mask = (align_pages >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT)) - 1;
118 BUILD_BUG_ON(PAGE_SHIFT > KVM_CMA_CHUNK_ORDER);
119
120 chunk_count = cma->count >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
121 nr_chunk = nr_pages >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
122
123 mutex_lock(&kvm_cma_mutex);
124 for (;;) {
125 pageno = bitmap_find_next_zero_area(cma->bitmap, chunk_count,
126 start, nr_chunk, mask);
127 if (pageno >= chunk_count)
128 break;
129
130 pfn = cma->base_pfn + (pageno << (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT));
131 ret = alloc_contig_range(pfn, pfn + nr_pages, MIGRATE_CMA);
132 if (ret == 0) {
133 bitmap_set(cma->bitmap, pageno, nr_chunk);
134 page = pfn_to_page(pfn);
135 memset(pfn_to_kaddr(pfn), 0, nr_pages << PAGE_SHIFT);
136 break;
137 } else if (ret != -EBUSY) {
138 break;
139 }
140 pr_debug("%s(): memory range at %p is busy, retrying\n",
141 __func__, pfn_to_page(pfn));
142 /* try again with a bit different memory target */
143 start = pageno + mask + 1;
144 }
145 mutex_unlock(&kvm_cma_mutex);
146 pr_debug("%s(): returned %p\n", __func__, page);
147 return page;
148}
149
150/**
151 * kvm_release_cma() - release allocated pages for hash pagetable
152 * @pages: Allocated pages.
153 * @nr_pages: Number of allocated pages.
154 *
155 * This function releases memory allocated by kvm_alloc_cma().
156 * It returns false when provided pages do not belong to contiguous area and
157 * true otherwise.
158 */
159bool kvm_release_cma(struct page *pages, unsigned long nr_pages)
160{
161 unsigned long pfn;
162 unsigned long nr_chunk;
163 struct kvm_cma *cma = &kvm_cma_area;
164
165 if (!cma || !pages)
166 return false;
167
168 pr_debug("%s(page %p count %lu)\n", __func__, (void *)pages, nr_pages);
169
170 pfn = page_to_pfn(pages);
171
172 if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count)
173 return false;
174
175 VM_BUG_ON(pfn + nr_pages > cma->base_pfn + cma->count);
176 nr_chunk = nr_pages >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
177
178 mutex_lock(&kvm_cma_mutex);
179 bitmap_clear(cma->bitmap,
180 (pfn - cma->base_pfn) >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT),
181 nr_chunk);
182 free_contig_range(pfn, nr_pages);
183 mutex_unlock(&kvm_cma_mutex);
184
185 return true;
186}
187
188static int __init kvm_cma_activate_area(unsigned long base_pfn,
189 unsigned long count)
190{
191 unsigned long pfn = base_pfn;
192 unsigned i = count >> pageblock_order;
193 struct zone *zone;
194
195 WARN_ON_ONCE(!pfn_valid(pfn));
196 zone = page_zone(pfn_to_page(pfn));
197 do {
198 unsigned j;
199 base_pfn = pfn;
200 for (j = pageblock_nr_pages; j; --j, pfn++) {
201 WARN_ON_ONCE(!pfn_valid(pfn));
202 /*
203 * alloc_contig_range requires the pfn range
204 * specified to be in the same zone. Make this
205 * simple by forcing the entire CMA resv range
206 * to be in the same zone.
207 */
208 if (page_zone(pfn_to_page(pfn)) != zone)
209 return -EINVAL;
210 }
211 init_cma_reserved_pageblock(pfn_to_page(base_pfn));
212 } while (--i);
213 return 0;
214}
215
216static int __init kvm_cma_init_reserved_areas(void)
217{
218 int bitmap_size, ret;
219 unsigned long chunk_count;
220 struct kvm_cma *cma = &kvm_cma_area;
221
222 pr_debug("%s()\n", __func__);
223 if (!cma->count)
224 return 0;
225 chunk_count = cma->count >> (KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
226 bitmap_size = BITS_TO_LONGS(chunk_count) * sizeof(long);
227 cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
228 if (!cma->bitmap)
229 return -ENOMEM;
230
231 ret = kvm_cma_activate_area(cma->base_pfn, cma->count);
232 if (ret)
233 goto error;
234 return 0;
235
236error:
237 kfree(cma->bitmap);
238 return ret;
239}
240core_initcall(kvm_cma_init_reserved_areas);
diff --git a/arch/powerpc/kvm/book3s_hv_cma.h b/arch/powerpc/kvm/book3s_hv_cma.h
deleted file mode 100644
index 655144f75fa5..000000000000
--- a/arch/powerpc/kvm/book3s_hv_cma.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Contiguous Memory Allocator for ppc KVM hash pagetable based on CMA
3 * for DMA mapping framework
4 *
5 * Copyright IBM Corporation, 2013
6 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
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; either version 2 of the
11 * License or (at your optional) any later version of the license.
12 *
13 */
14
15#ifndef __POWERPC_KVM_CMA_ALLOC_H__
16#define __POWERPC_KVM_CMA_ALLOC_H__
17/*
18 * Both RMA and Hash page allocation will be multiple of 256K.
19 */
20#define KVM_CMA_CHUNK_ORDER 18
21
22extern struct page *kvm_alloc_cma(unsigned long nr_pages,
23 unsigned long align_pages);
24extern bool kvm_release_cma(struct page *pages, unsigned long nr_pages);
25extern long kvm_cma_declare_contiguous(phys_addr_t size,
26 phys_addr_t alignment) __init;
27#endif
diff --git a/arch/powerpc/kvm/book3s_hv_ras.c b/arch/powerpc/kvm/book3s_hv_ras.c
index 3a5c568b1e89..d562c8e2bc30 100644
--- a/arch/powerpc/kvm/book3s_hv_ras.c
+++ b/arch/powerpc/kvm/book3s_hv_ras.c
@@ -45,14 +45,14 @@ static void reload_slb(struct kvm_vcpu *vcpu)
45 return; 45 return;
46 46
47 /* Sanity check */ 47 /* Sanity check */
48 n = min_t(u32, slb->persistent, SLB_MIN_SIZE); 48 n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE);
49 if ((void *) &slb->save_area[n] > vcpu->arch.slb_shadow.pinned_end) 49 if ((void *) &slb->save_area[n] > vcpu->arch.slb_shadow.pinned_end)
50 return; 50 return;
51 51
52 /* Load up the SLB from that */ 52 /* Load up the SLB from that */
53 for (i = 0; i < n; ++i) { 53 for (i = 0; i < n; ++i) {
54 unsigned long rb = slb->save_area[i].esid; 54 unsigned long rb = be64_to_cpu(slb->save_area[i].esid);
55 unsigned long rs = slb->save_area[i].vsid; 55 unsigned long rs = be64_to_cpu(slb->save_area[i].vsid);
56 56
57 rb = (rb & ~0xFFFul) | i; /* insert entry number */ 57 rb = (rb & ~0xFFFul) | i; /* insert entry number */
58 asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb)); 58 asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 5a24d3c2b6b8..084ad54c73cd 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -154,10 +154,10 @@ static pte_t lookup_linux_pte_and_update(pgd_t *pgdir, unsigned long hva,
154 return kvmppc_read_update_linux_pte(ptep, writing, hugepage_shift); 154 return kvmppc_read_update_linux_pte(ptep, writing, hugepage_shift);
155} 155}
156 156
157static inline void unlock_hpte(unsigned long *hpte, unsigned long hpte_v) 157static inline void unlock_hpte(__be64 *hpte, unsigned long hpte_v)
158{ 158{
159 asm volatile(PPC_RELEASE_BARRIER "" : : : "memory"); 159 asm volatile(PPC_RELEASE_BARRIER "" : : : "memory");
160 hpte[0] = hpte_v; 160 hpte[0] = cpu_to_be64(hpte_v);
161} 161}
162 162
163long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, 163long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
@@ -166,7 +166,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
166{ 166{
167 unsigned long i, pa, gpa, gfn, psize; 167 unsigned long i, pa, gpa, gfn, psize;
168 unsigned long slot_fn, hva; 168 unsigned long slot_fn, hva;
169 unsigned long *hpte; 169 __be64 *hpte;
170 struct revmap_entry *rev; 170 struct revmap_entry *rev;
171 unsigned long g_ptel; 171 unsigned long g_ptel;
172 struct kvm_memory_slot *memslot; 172 struct kvm_memory_slot *memslot;
@@ -275,9 +275,9 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
275 return H_PARAMETER; 275 return H_PARAMETER;
276 if (likely((flags & H_EXACT) == 0)) { 276 if (likely((flags & H_EXACT) == 0)) {
277 pte_index &= ~7UL; 277 pte_index &= ~7UL;
278 hpte = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4)); 278 hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
279 for (i = 0; i < 8; ++i) { 279 for (i = 0; i < 8; ++i) {
280 if ((*hpte & HPTE_V_VALID) == 0 && 280 if ((be64_to_cpu(*hpte) & HPTE_V_VALID) == 0 &&
281 try_lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID | 281 try_lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID |
282 HPTE_V_ABSENT)) 282 HPTE_V_ABSENT))
283 break; 283 break;
@@ -292,11 +292,13 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
292 */ 292 */
293 hpte -= 16; 293 hpte -= 16;
294 for (i = 0; i < 8; ++i) { 294 for (i = 0; i < 8; ++i) {
295 u64 pte;
295 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK)) 296 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK))
296 cpu_relax(); 297 cpu_relax();
297 if (!(*hpte & (HPTE_V_VALID | HPTE_V_ABSENT))) 298 pte = be64_to_cpu(*hpte);
299 if (!(pte & (HPTE_V_VALID | HPTE_V_ABSENT)))
298 break; 300 break;
299 *hpte &= ~HPTE_V_HVLOCK; 301 *hpte &= ~cpu_to_be64(HPTE_V_HVLOCK);
300 hpte += 2; 302 hpte += 2;
301 } 303 }
302 if (i == 8) 304 if (i == 8)
@@ -304,14 +306,17 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
304 } 306 }
305 pte_index += i; 307 pte_index += i;
306 } else { 308 } else {
307 hpte = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4)); 309 hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
308 if (!try_lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID | 310 if (!try_lock_hpte(hpte, HPTE_V_HVLOCK | HPTE_V_VALID |
309 HPTE_V_ABSENT)) { 311 HPTE_V_ABSENT)) {
310 /* Lock the slot and check again */ 312 /* Lock the slot and check again */
313 u64 pte;
314
311 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK)) 315 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK))
312 cpu_relax(); 316 cpu_relax();
313 if (*hpte & (HPTE_V_VALID | HPTE_V_ABSENT)) { 317 pte = be64_to_cpu(*hpte);
314 *hpte &= ~HPTE_V_HVLOCK; 318 if (pte & (HPTE_V_VALID | HPTE_V_ABSENT)) {
319 *hpte &= ~cpu_to_be64(HPTE_V_HVLOCK);
315 return H_PTEG_FULL; 320 return H_PTEG_FULL;
316 } 321 }
317 } 322 }
@@ -347,11 +352,11 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
347 } 352 }
348 } 353 }
349 354
350 hpte[1] = ptel; 355 hpte[1] = cpu_to_be64(ptel);
351 356
352 /* Write the first HPTE dword, unlocking the HPTE and making it valid */ 357 /* Write the first HPTE dword, unlocking the HPTE and making it valid */
353 eieio(); 358 eieio();
354 hpte[0] = pteh; 359 hpte[0] = cpu_to_be64(pteh);
355 asm volatile("ptesync" : : : "memory"); 360 asm volatile("ptesync" : : : "memory");
356 361
357 *pte_idx_ret = pte_index; 362 *pte_idx_ret = pte_index;
@@ -468,30 +473,35 @@ long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
468 unsigned long pte_index, unsigned long avpn, 473 unsigned long pte_index, unsigned long avpn,
469 unsigned long *hpret) 474 unsigned long *hpret)
470{ 475{
471 unsigned long *hpte; 476 __be64 *hpte;
472 unsigned long v, r, rb; 477 unsigned long v, r, rb;
473 struct revmap_entry *rev; 478 struct revmap_entry *rev;
479 u64 pte;
474 480
475 if (pte_index >= kvm->arch.hpt_npte) 481 if (pte_index >= kvm->arch.hpt_npte)
476 return H_PARAMETER; 482 return H_PARAMETER;
477 hpte = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4)); 483 hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
478 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK)) 484 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK))
479 cpu_relax(); 485 cpu_relax();
480 if ((hpte[0] & (HPTE_V_ABSENT | HPTE_V_VALID)) == 0 || 486 pte = be64_to_cpu(hpte[0]);
481 ((flags & H_AVPN) && (hpte[0] & ~0x7fUL) != avpn) || 487 if ((pte & (HPTE_V_ABSENT | HPTE_V_VALID)) == 0 ||
482 ((flags & H_ANDCOND) && (hpte[0] & avpn) != 0)) { 488 ((flags & H_AVPN) && (pte & ~0x7fUL) != avpn) ||
483 hpte[0] &= ~HPTE_V_HVLOCK; 489 ((flags & H_ANDCOND) && (pte & avpn) != 0)) {
490 hpte[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
484 return H_NOT_FOUND; 491 return H_NOT_FOUND;
485 } 492 }
486 493
487 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]); 494 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
488 v = hpte[0] & ~HPTE_V_HVLOCK; 495 v = pte & ~HPTE_V_HVLOCK;
489 if (v & HPTE_V_VALID) { 496 if (v & HPTE_V_VALID) {
490 hpte[0] &= ~HPTE_V_VALID; 497 u64 pte1;
491 rb = compute_tlbie_rb(v, hpte[1], pte_index); 498
499 pte1 = be64_to_cpu(hpte[1]);
500 hpte[0] &= ~cpu_to_be64(HPTE_V_VALID);
501 rb = compute_tlbie_rb(v, pte1, pte_index);
492 do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags), true); 502 do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags), true);
493 /* Read PTE low word after tlbie to get final R/C values */ 503 /* Read PTE low word after tlbie to get final R/C values */
494 remove_revmap_chain(kvm, pte_index, rev, v, hpte[1]); 504 remove_revmap_chain(kvm, pte_index, rev, v, pte1);
495 } 505 }
496 r = rev->guest_rpte & ~HPTE_GR_RESERVED; 506 r = rev->guest_rpte & ~HPTE_GR_RESERVED;
497 note_hpte_modification(kvm, rev); 507 note_hpte_modification(kvm, rev);
@@ -514,12 +524,14 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
514{ 524{
515 struct kvm *kvm = vcpu->kvm; 525 struct kvm *kvm = vcpu->kvm;
516 unsigned long *args = &vcpu->arch.gpr[4]; 526 unsigned long *args = &vcpu->arch.gpr[4];
517 unsigned long *hp, *hptes[4], tlbrb[4]; 527 __be64 *hp, *hptes[4];
528 unsigned long tlbrb[4];
518 long int i, j, k, n, found, indexes[4]; 529 long int i, j, k, n, found, indexes[4];
519 unsigned long flags, req, pte_index, rcbits; 530 unsigned long flags, req, pte_index, rcbits;
520 int global; 531 int global;
521 long int ret = H_SUCCESS; 532 long int ret = H_SUCCESS;
522 struct revmap_entry *rev, *revs[4]; 533 struct revmap_entry *rev, *revs[4];
534 u64 hp0;
523 535
524 global = global_invalidates(kvm, 0); 536 global = global_invalidates(kvm, 0);
525 for (i = 0; i < 4 && ret == H_SUCCESS; ) { 537 for (i = 0; i < 4 && ret == H_SUCCESS; ) {
@@ -542,8 +554,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
542 ret = H_PARAMETER; 554 ret = H_PARAMETER;
543 break; 555 break;
544 } 556 }
545 hp = (unsigned long *) 557 hp = (__be64 *) (kvm->arch.hpt_virt + (pte_index << 4));
546 (kvm->arch.hpt_virt + (pte_index << 4));
547 /* to avoid deadlock, don't spin except for first */ 558 /* to avoid deadlock, don't spin except for first */
548 if (!try_lock_hpte(hp, HPTE_V_HVLOCK)) { 559 if (!try_lock_hpte(hp, HPTE_V_HVLOCK)) {
549 if (n) 560 if (n)
@@ -552,23 +563,24 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
552 cpu_relax(); 563 cpu_relax();
553 } 564 }
554 found = 0; 565 found = 0;
555 if (hp[0] & (HPTE_V_ABSENT | HPTE_V_VALID)) { 566 hp0 = be64_to_cpu(hp[0]);
567 if (hp0 & (HPTE_V_ABSENT | HPTE_V_VALID)) {
556 switch (flags & 3) { 568 switch (flags & 3) {
557 case 0: /* absolute */ 569 case 0: /* absolute */
558 found = 1; 570 found = 1;
559 break; 571 break;
560 case 1: /* andcond */ 572 case 1: /* andcond */
561 if (!(hp[0] & args[j + 1])) 573 if (!(hp0 & args[j + 1]))
562 found = 1; 574 found = 1;
563 break; 575 break;
564 case 2: /* AVPN */ 576 case 2: /* AVPN */
565 if ((hp[0] & ~0x7fUL) == args[j + 1]) 577 if ((hp0 & ~0x7fUL) == args[j + 1])
566 found = 1; 578 found = 1;
567 break; 579 break;
568 } 580 }
569 } 581 }
570 if (!found) { 582 if (!found) {
571 hp[0] &= ~HPTE_V_HVLOCK; 583 hp[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
572 args[j] = ((0x90 | flags) << 56) + pte_index; 584 args[j] = ((0x90 | flags) << 56) + pte_index;
573 continue; 585 continue;
574 } 586 }
@@ -577,7 +589,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
577 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]); 589 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
578 note_hpte_modification(kvm, rev); 590 note_hpte_modification(kvm, rev);
579 591
580 if (!(hp[0] & HPTE_V_VALID)) { 592 if (!(hp0 & HPTE_V_VALID)) {
581 /* insert R and C bits from PTE */ 593 /* insert R and C bits from PTE */
582 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C); 594 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C);
583 args[j] |= rcbits << (56 - 5); 595 args[j] |= rcbits << (56 - 5);
@@ -585,8 +597,10 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
585 continue; 597 continue;
586 } 598 }
587 599
588 hp[0] &= ~HPTE_V_VALID; /* leave it locked */ 600 /* leave it locked */
589 tlbrb[n] = compute_tlbie_rb(hp[0], hp[1], pte_index); 601 hp[0] &= ~cpu_to_be64(HPTE_V_VALID);
602 tlbrb[n] = compute_tlbie_rb(be64_to_cpu(hp[0]),
603 be64_to_cpu(hp[1]), pte_index);
590 indexes[n] = j; 604 indexes[n] = j;
591 hptes[n] = hp; 605 hptes[n] = hp;
592 revs[n] = rev; 606 revs[n] = rev;
@@ -605,7 +619,8 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
605 pte_index = args[j] & ((1ul << 56) - 1); 619 pte_index = args[j] & ((1ul << 56) - 1);
606 hp = hptes[k]; 620 hp = hptes[k];
607 rev = revs[k]; 621 rev = revs[k];
608 remove_revmap_chain(kvm, pte_index, rev, hp[0], hp[1]); 622 remove_revmap_chain(kvm, pte_index, rev,
623 be64_to_cpu(hp[0]), be64_to_cpu(hp[1]));
609 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C); 624 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C);
610 args[j] |= rcbits << (56 - 5); 625 args[j] |= rcbits << (56 - 5);
611 hp[0] = 0; 626 hp[0] = 0;
@@ -620,23 +635,25 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
620 unsigned long va) 635 unsigned long va)
621{ 636{
622 struct kvm *kvm = vcpu->kvm; 637 struct kvm *kvm = vcpu->kvm;
623 unsigned long *hpte; 638 __be64 *hpte;
624 struct revmap_entry *rev; 639 struct revmap_entry *rev;
625 unsigned long v, r, rb, mask, bits; 640 unsigned long v, r, rb, mask, bits;
641 u64 pte;
626 642
627 if (pte_index >= kvm->arch.hpt_npte) 643 if (pte_index >= kvm->arch.hpt_npte)
628 return H_PARAMETER; 644 return H_PARAMETER;
629 645
630 hpte = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4)); 646 hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
631 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK)) 647 while (!try_lock_hpte(hpte, HPTE_V_HVLOCK))
632 cpu_relax(); 648 cpu_relax();
633 if ((hpte[0] & (HPTE_V_ABSENT | HPTE_V_VALID)) == 0 || 649 pte = be64_to_cpu(hpte[0]);
634 ((flags & H_AVPN) && (hpte[0] & ~0x7fUL) != avpn)) { 650 if ((pte & (HPTE_V_ABSENT | HPTE_V_VALID)) == 0 ||
635 hpte[0] &= ~HPTE_V_HVLOCK; 651 ((flags & H_AVPN) && (pte & ~0x7fUL) != avpn)) {
652 hpte[0] &= ~cpu_to_be64(HPTE_V_HVLOCK);
636 return H_NOT_FOUND; 653 return H_NOT_FOUND;
637 } 654 }
638 655
639 v = hpte[0]; 656 v = pte;
640 bits = (flags << 55) & HPTE_R_PP0; 657 bits = (flags << 55) & HPTE_R_PP0;
641 bits |= (flags << 48) & HPTE_R_KEY_HI; 658 bits |= (flags << 48) & HPTE_R_KEY_HI;
642 bits |= flags & (HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_LO); 659 bits |= flags & (HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_LO);
@@ -650,12 +667,12 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
650 rev->guest_rpte = r; 667 rev->guest_rpte = r;
651 note_hpte_modification(kvm, rev); 668 note_hpte_modification(kvm, rev);
652 } 669 }
653 r = (hpte[1] & ~mask) | bits; 670 r = (be64_to_cpu(hpte[1]) & ~mask) | bits;
654 671
655 /* Update HPTE */ 672 /* Update HPTE */
656 if (v & HPTE_V_VALID) { 673 if (v & HPTE_V_VALID) {
657 rb = compute_tlbie_rb(v, r, pte_index); 674 rb = compute_tlbie_rb(v, r, pte_index);
658 hpte[0] = v & ~HPTE_V_VALID; 675 hpte[0] = cpu_to_be64(v & ~HPTE_V_VALID);
659 do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags), true); 676 do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags), true);
660 /* 677 /*
661 * If the host has this page as readonly but the guest 678 * If the host has this page as readonly but the guest
@@ -681,9 +698,9 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
681 } 698 }
682 } 699 }
683 } 700 }
684 hpte[1] = r; 701 hpte[1] = cpu_to_be64(r);
685 eieio(); 702 eieio();
686 hpte[0] = v & ~HPTE_V_HVLOCK; 703 hpte[0] = cpu_to_be64(v & ~HPTE_V_HVLOCK);
687 asm volatile("ptesync" : : : "memory"); 704 asm volatile("ptesync" : : : "memory");
688 return H_SUCCESS; 705 return H_SUCCESS;
689} 706}
@@ -692,7 +709,8 @@ long kvmppc_h_read(struct kvm_vcpu *vcpu, unsigned long flags,
692 unsigned long pte_index) 709 unsigned long pte_index)
693{ 710{
694 struct kvm *kvm = vcpu->kvm; 711 struct kvm *kvm = vcpu->kvm;
695 unsigned long *hpte, v, r; 712 __be64 *hpte;
713 unsigned long v, r;
696 int i, n = 1; 714 int i, n = 1;
697 struct revmap_entry *rev = NULL; 715 struct revmap_entry *rev = NULL;
698 716
@@ -704,9 +722,9 @@ long kvmppc_h_read(struct kvm_vcpu *vcpu, unsigned long flags,
704 } 722 }
705 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]); 723 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
706 for (i = 0; i < n; ++i, ++pte_index) { 724 for (i = 0; i < n; ++i, ++pte_index) {
707 hpte = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4)); 725 hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
708 v = hpte[0] & ~HPTE_V_HVLOCK; 726 v = be64_to_cpu(hpte[0]) & ~HPTE_V_HVLOCK;
709 r = hpte[1]; 727 r = be64_to_cpu(hpte[1]);
710 if (v & HPTE_V_ABSENT) { 728 if (v & HPTE_V_ABSENT) {
711 v &= ~HPTE_V_ABSENT; 729 v &= ~HPTE_V_ABSENT;
712 v |= HPTE_V_VALID; 730 v |= HPTE_V_VALID;
@@ -721,25 +739,27 @@ long kvmppc_h_read(struct kvm_vcpu *vcpu, unsigned long flags,
721 return H_SUCCESS; 739 return H_SUCCESS;
722} 740}
723 741
724void kvmppc_invalidate_hpte(struct kvm *kvm, unsigned long *hptep, 742void kvmppc_invalidate_hpte(struct kvm *kvm, __be64 *hptep,
725 unsigned long pte_index) 743 unsigned long pte_index)
726{ 744{
727 unsigned long rb; 745 unsigned long rb;
728 746
729 hptep[0] &= ~HPTE_V_VALID; 747 hptep[0] &= ~cpu_to_be64(HPTE_V_VALID);
730 rb = compute_tlbie_rb(hptep[0], hptep[1], pte_index); 748 rb = compute_tlbie_rb(be64_to_cpu(hptep[0]), be64_to_cpu(hptep[1]),
749 pte_index);
731 do_tlbies(kvm, &rb, 1, 1, true); 750 do_tlbies(kvm, &rb, 1, 1, true);
732} 751}
733EXPORT_SYMBOL_GPL(kvmppc_invalidate_hpte); 752EXPORT_SYMBOL_GPL(kvmppc_invalidate_hpte);
734 753
735void kvmppc_clear_ref_hpte(struct kvm *kvm, unsigned long *hptep, 754void kvmppc_clear_ref_hpte(struct kvm *kvm, __be64 *hptep,
736 unsigned long pte_index) 755 unsigned long pte_index)
737{ 756{
738 unsigned long rb; 757 unsigned long rb;
739 unsigned char rbyte; 758 unsigned char rbyte;
740 759
741 rb = compute_tlbie_rb(hptep[0], hptep[1], pte_index); 760 rb = compute_tlbie_rb(be64_to_cpu(hptep[0]), be64_to_cpu(hptep[1]),
742 rbyte = (hptep[1] & ~HPTE_R_R) >> 8; 761 pte_index);
762 rbyte = (be64_to_cpu(hptep[1]) & ~HPTE_R_R) >> 8;
743 /* modify only the second-last byte, which contains the ref bit */ 763 /* modify only the second-last byte, which contains the ref bit */
744 *((char *)hptep + 14) = rbyte; 764 *((char *)hptep + 14) = rbyte;
745 do_tlbies(kvm, &rb, 1, 1, false); 765 do_tlbies(kvm, &rb, 1, 1, false);
@@ -765,7 +785,7 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
765 unsigned long somask; 785 unsigned long somask;
766 unsigned long vsid, hash; 786 unsigned long vsid, hash;
767 unsigned long avpn; 787 unsigned long avpn;
768 unsigned long *hpte; 788 __be64 *hpte;
769 unsigned long mask, val; 789 unsigned long mask, val;
770 unsigned long v, r; 790 unsigned long v, r;
771 791
@@ -797,11 +817,11 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
797 val |= avpn; 817 val |= avpn;
798 818
799 for (;;) { 819 for (;;) {
800 hpte = (unsigned long *)(kvm->arch.hpt_virt + (hash << 7)); 820 hpte = (__be64 *)(kvm->arch.hpt_virt + (hash << 7));
801 821
802 for (i = 0; i < 16; i += 2) { 822 for (i = 0; i < 16; i += 2) {
803 /* Read the PTE racily */ 823 /* Read the PTE racily */
804 v = hpte[i] & ~HPTE_V_HVLOCK; 824 v = be64_to_cpu(hpte[i]) & ~HPTE_V_HVLOCK;
805 825
806 /* Check valid/absent, hash, segment size and AVPN */ 826 /* Check valid/absent, hash, segment size and AVPN */
807 if (!(v & valid) || (v & mask) != val) 827 if (!(v & valid) || (v & mask) != val)
@@ -810,8 +830,8 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
810 /* Lock the PTE and read it under the lock */ 830 /* Lock the PTE and read it under the lock */
811 while (!try_lock_hpte(&hpte[i], HPTE_V_HVLOCK)) 831 while (!try_lock_hpte(&hpte[i], HPTE_V_HVLOCK))
812 cpu_relax(); 832 cpu_relax();
813 v = hpte[i] & ~HPTE_V_HVLOCK; 833 v = be64_to_cpu(hpte[i]) & ~HPTE_V_HVLOCK;
814 r = hpte[i+1]; 834 r = be64_to_cpu(hpte[i+1]);
815 835
816 /* 836 /*
817 * Check the HPTE again, including base page size 837 * Check the HPTE again, including base page size
@@ -822,7 +842,7 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
822 return (hash << 3) + (i >> 1); 842 return (hash << 3) + (i >> 1);
823 843
824 /* Unlock and move on */ 844 /* Unlock and move on */
825 hpte[i] = v; 845 hpte[i] = cpu_to_be64(v);
826 } 846 }
827 847
828 if (val & HPTE_V_SECONDARY) 848 if (val & HPTE_V_SECONDARY)
@@ -851,7 +871,7 @@ long kvmppc_hpte_hv_fault(struct kvm_vcpu *vcpu, unsigned long addr,
851 struct kvm *kvm = vcpu->kvm; 871 struct kvm *kvm = vcpu->kvm;
852 long int index; 872 long int index;
853 unsigned long v, r, gr; 873 unsigned long v, r, gr;
854 unsigned long *hpte; 874 __be64 *hpte;
855 unsigned long valid; 875 unsigned long valid;
856 struct revmap_entry *rev; 876 struct revmap_entry *rev;
857 unsigned long pp, key; 877 unsigned long pp, key;
@@ -867,9 +887,9 @@ long kvmppc_hpte_hv_fault(struct kvm_vcpu *vcpu, unsigned long addr,
867 return status; /* there really was no HPTE */ 887 return status; /* there really was no HPTE */
868 return 0; /* for prot fault, HPTE disappeared */ 888 return 0; /* for prot fault, HPTE disappeared */
869 } 889 }
870 hpte = (unsigned long *)(kvm->arch.hpt_virt + (index << 4)); 890 hpte = (__be64 *)(kvm->arch.hpt_virt + (index << 4));
871 v = hpte[0] & ~HPTE_V_HVLOCK; 891 v = be64_to_cpu(hpte[0]) & ~HPTE_V_HVLOCK;
872 r = hpte[1]; 892 r = be64_to_cpu(hpte[1]);
873 rev = real_vmalloc_addr(&kvm->arch.revmap[index]); 893 rev = real_vmalloc_addr(&kvm->arch.revmap[index]);
874 gr = rev->guest_rpte; 894 gr = rev->guest_rpte;
875 895
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index b4b0082f761c..3ee38e6e884f 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -401,6 +401,11 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
401 icp->rm_action |= XICS_RM_REJECT; 401 icp->rm_action |= XICS_RM_REJECT;
402 icp->rm_reject = irq; 402 icp->rm_reject = irq;
403 } 403 }
404
405 if (!hlist_empty(&vcpu->kvm->irq_ack_notifier_list)) {
406 icp->rm_action |= XICS_RM_NOTIFY_EOI;
407 icp->rm_eoied_irq = irq;
408 }
404 bail: 409 bail:
405 return check_too_hard(xics, icp); 410 return check_too_hard(xics, icp);
406} 411}
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 558a67df8126..f0c4db7704c3 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -32,10 +32,6 @@
32 32
33#define VCPU_GPRS_TM(reg) (((reg) * ULONG_SIZE) + VCPU_GPR_TM) 33#define VCPU_GPRS_TM(reg) (((reg) * ULONG_SIZE) + VCPU_GPR_TM)
34 34
35#ifdef __LITTLE_ENDIAN__
36#error Need to fix lppaca and SLB shadow accesses in little endian mode
37#endif
38
39/* Values in HSTATE_NAPPING(r13) */ 35/* Values in HSTATE_NAPPING(r13) */
40#define NAPPING_CEDE 1 36#define NAPPING_CEDE 1
41#define NAPPING_NOVCPU 2 37#define NAPPING_NOVCPU 2
@@ -159,6 +155,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
159 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL 155 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
160BEGIN_FTR_SECTION 156BEGIN_FTR_SECTION
161 beq 11f 157 beq 11f
158 cmpwi cr2, r12, BOOK3S_INTERRUPT_HMI
159 beq cr2, 14f /* HMI check */
162END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 160END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
163 161
164 /* RFI into the highmem handler, or branch to interrupt handler */ 162 /* RFI into the highmem handler, or branch to interrupt handler */
@@ -179,6 +177,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
179 177
18013: b machine_check_fwnmi 17813: b machine_check_fwnmi
181 179
18014: mtspr SPRN_HSRR0, r8
181 mtspr SPRN_HSRR1, r7
182 b hmi_exception_after_realmode
183
182kvmppc_primary_no_guest: 184kvmppc_primary_no_guest:
183 /* We handle this much like a ceded vcpu */ 185 /* We handle this much like a ceded vcpu */
184 /* set our bit in napping_threads */ 186 /* set our bit in napping_threads */
@@ -595,9 +597,10 @@ kvmppc_got_guest:
595 ld r3, VCPU_VPA(r4) 597 ld r3, VCPU_VPA(r4)
596 cmpdi r3, 0 598 cmpdi r3, 0
597 beq 25f 599 beq 25f
598 lwz r5, LPPACA_YIELDCOUNT(r3) 600 li r6, LPPACA_YIELDCOUNT
601 LWZX_BE r5, r3, r6
599 addi r5, r5, 1 602 addi r5, r5, 1
600 stw r5, LPPACA_YIELDCOUNT(r3) 603 STWX_BE r5, r3, r6
601 li r6, 1 604 li r6, 1
602 stb r6, VCPU_VPA_DIRTY(r4) 605 stb r6, VCPU_VPA_DIRTY(r4)
60325: 60625:
@@ -671,9 +674,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
671 674
672 mr r31, r4 675 mr r31, r4
673 addi r3, r31, VCPU_FPRS_TM 676 addi r3, r31, VCPU_FPRS_TM
674 bl .load_fp_state 677 bl load_fp_state
675 addi r3, r31, VCPU_VRS_TM 678 addi r3, r31, VCPU_VRS_TM
676 bl .load_vr_state 679 bl load_vr_state
677 mr r4, r31 680 mr r4, r31
678 lwz r7, VCPU_VRSAVE_TM(r4) 681 lwz r7, VCPU_VRSAVE_TM(r4)
679 mtspr SPRN_VRSAVE, r7 682 mtspr SPRN_VRSAVE, r7
@@ -1417,9 +1420,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
1417 1420
1418 /* Save FP/VSX. */ 1421 /* Save FP/VSX. */
1419 addi r3, r9, VCPU_FPRS_TM 1422 addi r3, r9, VCPU_FPRS_TM
1420 bl .store_fp_state 1423 bl store_fp_state
1421 addi r3, r9, VCPU_VRS_TM 1424 addi r3, r9, VCPU_VRS_TM
1422 bl .store_vr_state 1425 bl store_vr_state
1423 mfspr r6, SPRN_VRSAVE 1426 mfspr r6, SPRN_VRSAVE
1424 stw r6, VCPU_VRSAVE_TM(r9) 1427 stw r6, VCPU_VRSAVE_TM(r9)
14251: 14281:
@@ -1442,9 +1445,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
1442 ld r8, VCPU_VPA(r9) /* do they have a VPA? */ 1445 ld r8, VCPU_VPA(r9) /* do they have a VPA? */
1443 cmpdi r8, 0 1446 cmpdi r8, 0
1444 beq 25f 1447 beq 25f
1445 lwz r3, LPPACA_YIELDCOUNT(r8) 1448 li r4, LPPACA_YIELDCOUNT
1449 LWZX_BE r3, r8, r4
1446 addi r3, r3, 1 1450 addi r3, r3, 1
1447 stw r3, LPPACA_YIELDCOUNT(r8) 1451 STWX_BE r3, r8, r4
1448 li r3, 1 1452 li r3, 1
1449 stb r3, VCPU_VPA_DIRTY(r9) 1453 stb r3, VCPU_VPA_DIRTY(r9)
145025: 145425:
@@ -1757,8 +1761,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
175733: ld r8,PACA_SLBSHADOWPTR(r13) 176133: ld r8,PACA_SLBSHADOWPTR(r13)
1758 1762
1759 .rept SLB_NUM_BOLTED 1763 .rept SLB_NUM_BOLTED
1760 ld r5,SLBSHADOW_SAVEAREA(r8) 1764 li r3, SLBSHADOW_SAVEAREA
1761 ld r6,SLBSHADOW_SAVEAREA+8(r8) 1765 LDX_BE r5, r8, r3
1766 addi r3, r3, 8
1767 LDX_BE r6, r8, r3
1762 andis. r7,r5,SLB_ESID_V@h 1768 andis. r7,r5,SLB_ESID_V@h
1763 beq 1f 1769 beq 1f
1764 slbmte r6,r5 1770 slbmte r6,r5
@@ -1909,12 +1915,23 @@ hcall_try_real_mode:
1909 clrrdi r3,r3,2 1915 clrrdi r3,r3,2
1910 cmpldi r3,hcall_real_table_end - hcall_real_table 1916 cmpldi r3,hcall_real_table_end - hcall_real_table
1911 bge guest_exit_cont 1917 bge guest_exit_cont
1918 /* See if this hcall is enabled for in-kernel handling */
1919 ld r4, VCPU_KVM(r9)
1920 srdi r0, r3, 8 /* r0 = (r3 / 4) >> 6 */
1921 sldi r0, r0, 3 /* index into kvm->arch.enabled_hcalls[] */
1922 add r4, r4, r0
1923 ld r0, KVM_ENABLED_HCALLS(r4)
1924 rlwinm r4, r3, 32-2, 0x3f /* r4 = (r3 / 4) & 0x3f */
1925 srd r0, r0, r4
1926 andi. r0, r0, 1
1927 beq guest_exit_cont
1928 /* Get pointer to handler, if any, and call it */
1912 LOAD_REG_ADDR(r4, hcall_real_table) 1929 LOAD_REG_ADDR(r4, hcall_real_table)
1913 lwax r3,r3,r4 1930 lwax r3,r3,r4
1914 cmpwi r3,0 1931 cmpwi r3,0
1915 beq guest_exit_cont 1932 beq guest_exit_cont
1916 add r3,r3,r4 1933 add r12,r3,r4
1917 mtctr r3 1934 mtctr r12
1918 mr r3,r9 /* get vcpu pointer */ 1935 mr r3,r9 /* get vcpu pointer */
1919 ld r4,VCPU_GPR(R4)(r9) 1936 ld r4,VCPU_GPR(R4)(r9)
1920 bctrl 1937 bctrl
@@ -2031,6 +2048,7 @@ hcall_real_table:
2031 .long 0 /* 0x12c */ 2048 .long 0 /* 0x12c */
2032 .long 0 /* 0x130 */ 2049 .long 0 /* 0x130 */
2033 .long DOTSYM(kvmppc_h_set_xdabr) - hcall_real_table 2050 .long DOTSYM(kvmppc_h_set_xdabr) - hcall_real_table
2051 .globl hcall_real_table_end
2034hcall_real_table_end: 2052hcall_real_table_end:
2035 2053
2036ignore_hdec: 2054ignore_hdec:
@@ -2338,7 +2356,18 @@ kvmppc_read_intr:
2338 cmpdi r6, 0 2356 cmpdi r6, 0
2339 beq- 1f 2357 beq- 1f
2340 lwzcix r0, r6, r7 2358 lwzcix r0, r6, r7
2341 rlwinm. r3, r0, 0, 0xffffff 2359 /*
2360 * Save XIRR for later. Since we get in in reverse endian on LE
2361 * systems, save it byte reversed and fetch it back in host endian.
2362 */
2363 li r3, HSTATE_SAVED_XIRR
2364 STWX_BE r0, r3, r13
2365#ifdef __LITTLE_ENDIAN__
2366 lwz r3, HSTATE_SAVED_XIRR(r13)
2367#else
2368 mr r3, r0
2369#endif
2370 rlwinm. r3, r3, 0, 0xffffff
2342 sync 2371 sync
2343 beq 1f /* if nothing pending in the ICP */ 2372 beq 1f /* if nothing pending in the ICP */
2344 2373
@@ -2370,10 +2399,9 @@ kvmppc_read_intr:
2370 li r3, -1 2399 li r3, -1
23711: blr 24001: blr
2372 2401
237342: /* It's not an IPI and it's for the host, stash it in the PACA 240242: /* It's not an IPI and it's for the host. We saved a copy of XIRR in
2374 * before exit, it will be picked up by the host ICP driver 2403 * the PACA earlier, it will be picked up by the host ICP driver
2375 */ 2404 */
2376 stw r0, HSTATE_SAVED_XIRR(r13)
2377 li r3, 1 2405 li r3, 1
2378 b 1b 2406 b 1b
2379 2407
@@ -2408,11 +2436,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
2408 mtmsrd r8 2436 mtmsrd r8
2409 isync 2437 isync
2410 addi r3,r3,VCPU_FPRS 2438 addi r3,r3,VCPU_FPRS
2411 bl .store_fp_state 2439 bl store_fp_state
2412#ifdef CONFIG_ALTIVEC 2440#ifdef CONFIG_ALTIVEC
2413BEGIN_FTR_SECTION 2441BEGIN_FTR_SECTION
2414 addi r3,r31,VCPU_VRS 2442 addi r3,r31,VCPU_VRS
2415 bl .store_vr_state 2443 bl store_vr_state
2416END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2444END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2417#endif 2445#endif
2418 mfspr r6,SPRN_VRSAVE 2446 mfspr r6,SPRN_VRSAVE
@@ -2444,11 +2472,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
2444 mtmsrd r8 2472 mtmsrd r8
2445 isync 2473 isync
2446 addi r3,r4,VCPU_FPRS 2474 addi r3,r4,VCPU_FPRS
2447 bl .load_fp_state 2475 bl load_fp_state
2448#ifdef CONFIG_ALTIVEC 2476#ifdef CONFIG_ALTIVEC
2449BEGIN_FTR_SECTION 2477BEGIN_FTR_SECTION
2450 addi r3,r31,VCPU_VRS 2478 addi r3,r31,VCPU_VRS
2451 bl .load_vr_state 2479 bl load_vr_state
2452END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2480END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2453#endif 2481#endif
2454 lwz r7,VCPU_VRSAVE(r31) 2482 lwz r7,VCPU_VRSAVE(r31)
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
index 6c8011fd57e6..bfb8035314e3 100644
--- a/arch/powerpc/kvm/book3s_paired_singles.c
+++ b/arch/powerpc/kvm/book3s_paired_singles.c
@@ -639,26 +639,36 @@ static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
639 639
640int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu) 640int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
641{ 641{
642 u32 inst = kvmppc_get_last_inst(vcpu); 642 u32 inst;
643 enum emulation_result emulated = EMULATE_DONE; 643 enum emulation_result emulated = EMULATE_DONE;
644 int ax_rd, ax_ra, ax_rb, ax_rc;
645 short full_d;
646 u64 *fpr_d, *fpr_a, *fpr_b, *fpr_c;
644 647
645 int ax_rd = inst_get_field(inst, 6, 10); 648 bool rcomp;
646 int ax_ra = inst_get_field(inst, 11, 15); 649 u32 cr;
647 int ax_rb = inst_get_field(inst, 16, 20);
648 int ax_rc = inst_get_field(inst, 21, 25);
649 short full_d = inst_get_field(inst, 16, 31);
650
651 u64 *fpr_d = &VCPU_FPR(vcpu, ax_rd);
652 u64 *fpr_a = &VCPU_FPR(vcpu, ax_ra);
653 u64 *fpr_b = &VCPU_FPR(vcpu, ax_rb);
654 u64 *fpr_c = &VCPU_FPR(vcpu, ax_rc);
655
656 bool rcomp = (inst & 1) ? true : false;
657 u32 cr = kvmppc_get_cr(vcpu);
658#ifdef DEBUG 650#ifdef DEBUG
659 int i; 651 int i;
660#endif 652#endif
661 653
654 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &inst);
655 if (emulated != EMULATE_DONE)
656 return emulated;
657
658 ax_rd = inst_get_field(inst, 6, 10);
659 ax_ra = inst_get_field(inst, 11, 15);
660 ax_rb = inst_get_field(inst, 16, 20);
661 ax_rc = inst_get_field(inst, 21, 25);
662 full_d = inst_get_field(inst, 16, 31);
663
664 fpr_d = &VCPU_FPR(vcpu, ax_rd);
665 fpr_a = &VCPU_FPR(vcpu, ax_ra);
666 fpr_b = &VCPU_FPR(vcpu, ax_rb);
667 fpr_c = &VCPU_FPR(vcpu, ax_rc);
668
669 rcomp = (inst & 1) ? true : false;
670 cr = kvmppc_get_cr(vcpu);
671
662 if (!kvmppc_inst_is_paired_single(vcpu, inst)) 672 if (!kvmppc_inst_is_paired_single(vcpu, inst))
663 return EMULATE_FAIL; 673 return EMULATE_FAIL;
664 674
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 8eef1e519077..faffb27badd9 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -62,6 +62,35 @@ static void kvmppc_giveup_fac(struct kvm_vcpu *vcpu, ulong fac);
62#define HW_PAGE_SIZE PAGE_SIZE 62#define HW_PAGE_SIZE PAGE_SIZE
63#endif 63#endif
64 64
65static bool kvmppc_is_split_real(struct kvm_vcpu *vcpu)
66{
67 ulong msr = kvmppc_get_msr(vcpu);
68 return (msr & (MSR_IR|MSR_DR)) == MSR_DR;
69}
70
71static void kvmppc_fixup_split_real(struct kvm_vcpu *vcpu)
72{
73 ulong msr = kvmppc_get_msr(vcpu);
74 ulong pc = kvmppc_get_pc(vcpu);
75
76 /* We are in DR only split real mode */
77 if ((msr & (MSR_IR|MSR_DR)) != MSR_DR)
78 return;
79
80 /* We have not fixed up the guest already */
81 if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK)
82 return;
83
84 /* The code is in fixupable address space */
85 if (pc & SPLIT_HACK_MASK)
86 return;
87
88 vcpu->arch.hflags |= BOOK3S_HFLAG_SPLIT_HACK;
89 kvmppc_set_pc(vcpu, pc | SPLIT_HACK_OFFS);
90}
91
92void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu);
93
65static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu) 94static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu)
66{ 95{
67#ifdef CONFIG_PPC_BOOK3S_64 96#ifdef CONFIG_PPC_BOOK3S_64
@@ -71,10 +100,19 @@ static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu)
71 svcpu->in_use = 0; 100 svcpu->in_use = 0;
72 svcpu_put(svcpu); 101 svcpu_put(svcpu);
73#endif 102#endif
103
104 /* Disable AIL if supported */
105 if (cpu_has_feature(CPU_FTR_HVMODE) &&
106 cpu_has_feature(CPU_FTR_ARCH_207S))
107 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~LPCR_AIL);
108
74 vcpu->cpu = smp_processor_id(); 109 vcpu->cpu = smp_processor_id();
75#ifdef CONFIG_PPC_BOOK3S_32 110#ifdef CONFIG_PPC_BOOK3S_32
76 current->thread.kvm_shadow_vcpu = vcpu->arch.shadow_vcpu; 111 current->thread.kvm_shadow_vcpu = vcpu->arch.shadow_vcpu;
77#endif 112#endif
113
114 if (kvmppc_is_split_real(vcpu))
115 kvmppc_fixup_split_real(vcpu);
78} 116}
79 117
80static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu) 118static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu)
@@ -89,8 +127,17 @@ static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu)
89 svcpu_put(svcpu); 127 svcpu_put(svcpu);
90#endif 128#endif
91 129
130 if (kvmppc_is_split_real(vcpu))
131 kvmppc_unfixup_split_real(vcpu);
132
92 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX); 133 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX);
93 kvmppc_giveup_fac(vcpu, FSCR_TAR_LG); 134 kvmppc_giveup_fac(vcpu, FSCR_TAR_LG);
135
136 /* Enable AIL if supported */
137 if (cpu_has_feature(CPU_FTR_HVMODE) &&
138 cpu_has_feature(CPU_FTR_ARCH_207S))
139 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) | LPCR_AIL_3);
140
94 vcpu->cpu = -1; 141 vcpu->cpu = -1;
95} 142}
96 143
@@ -120,6 +167,14 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
120#ifdef CONFIG_PPC_BOOK3S_64 167#ifdef CONFIG_PPC_BOOK3S_64
121 svcpu->shadow_fscr = vcpu->arch.shadow_fscr; 168 svcpu->shadow_fscr = vcpu->arch.shadow_fscr;
122#endif 169#endif
170 /*
171 * Now also save the current time base value. We use this
172 * to find the guest purr and spurr value.
173 */
174 vcpu->arch.entry_tb = get_tb();
175 vcpu->arch.entry_vtb = get_vtb();
176 if (cpu_has_feature(CPU_FTR_ARCH_207S))
177 vcpu->arch.entry_ic = mfspr(SPRN_IC);
123 svcpu->in_use = true; 178 svcpu->in_use = true;
124} 179}
125 180
@@ -166,6 +221,14 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
166#ifdef CONFIG_PPC_BOOK3S_64 221#ifdef CONFIG_PPC_BOOK3S_64
167 vcpu->arch.shadow_fscr = svcpu->shadow_fscr; 222 vcpu->arch.shadow_fscr = svcpu->shadow_fscr;
168#endif 223#endif
224 /*
225 * Update purr and spurr using time base on exit.
226 */
227 vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb;
228 vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb;
229 vcpu->arch.vtb += get_vtb() - vcpu->arch.entry_vtb;
230 if (cpu_has_feature(CPU_FTR_ARCH_207S))
231 vcpu->arch.ic += mfspr(SPRN_IC) - vcpu->arch.entry_ic;
169 svcpu->in_use = false; 232 svcpu->in_use = false;
170 233
171out: 234out:
@@ -294,6 +357,11 @@ static void kvmppc_set_msr_pr(struct kvm_vcpu *vcpu, u64 msr)
294 } 357 }
295 } 358 }
296 359
360 if (kvmppc_is_split_real(vcpu))
361 kvmppc_fixup_split_real(vcpu);
362 else
363 kvmppc_unfixup_split_real(vcpu);
364
297 if ((kvmppc_get_msr(vcpu) & (MSR_PR|MSR_IR|MSR_DR)) != 365 if ((kvmppc_get_msr(vcpu) & (MSR_PR|MSR_IR|MSR_DR)) !=
298 (old_msr & (MSR_PR|MSR_IR|MSR_DR))) { 366 (old_msr & (MSR_PR|MSR_IR|MSR_DR))) {
299 kvmppc_mmu_flush_segments(vcpu); 367 kvmppc_mmu_flush_segments(vcpu);
@@ -443,19 +511,19 @@ static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
443 put_page(hpage); 511 put_page(hpage);
444} 512}
445 513
446static int kvmppc_visible_gfn(struct kvm_vcpu *vcpu, gfn_t gfn) 514static int kvmppc_visible_gpa(struct kvm_vcpu *vcpu, gpa_t gpa)
447{ 515{
448 ulong mp_pa = vcpu->arch.magic_page_pa; 516 ulong mp_pa = vcpu->arch.magic_page_pa;
449 517
450 if (!(kvmppc_get_msr(vcpu) & MSR_SF)) 518 if (!(kvmppc_get_msr(vcpu) & MSR_SF))
451 mp_pa = (uint32_t)mp_pa; 519 mp_pa = (uint32_t)mp_pa;
452 520
453 if (unlikely(mp_pa) && 521 gpa &= ~0xFFFULL;
454 unlikely((mp_pa & KVM_PAM) >> PAGE_SHIFT == gfn)) { 522 if (unlikely(mp_pa) && unlikely((mp_pa & KVM_PAM) == (gpa & KVM_PAM))) {
455 return 1; 523 return 1;
456 } 524 }
457 525
458 return kvm_is_visible_gfn(vcpu->kvm, gfn); 526 return kvm_is_visible_gfn(vcpu->kvm, gpa >> PAGE_SHIFT);
459} 527}
460 528
461int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu, 529int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -494,6 +562,11 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
494 pte.vpage |= ((u64)VSID_REAL << (SID_SHIFT - 12)); 562 pte.vpage |= ((u64)VSID_REAL << (SID_SHIFT - 12));
495 break; 563 break;
496 case MSR_DR: 564 case MSR_DR:
565 if (!data &&
566 (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) &&
567 ((pte.raddr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS))
568 pte.raddr &= ~SPLIT_HACK_MASK;
569 /* fall through */
497 case MSR_IR: 570 case MSR_IR:
498 vcpu->arch.mmu.esid_to_vsid(vcpu, eaddr >> SID_SHIFT, &vsid); 571 vcpu->arch.mmu.esid_to_vsid(vcpu, eaddr >> SID_SHIFT, &vsid);
499 572
@@ -541,7 +614,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
541 kvmppc_set_dar(vcpu, kvmppc_get_fault_dar(vcpu)); 614 kvmppc_set_dar(vcpu, kvmppc_get_fault_dar(vcpu));
542 kvmppc_book3s_queue_irqprio(vcpu, vec + 0x80); 615 kvmppc_book3s_queue_irqprio(vcpu, vec + 0x80);
543 } else if (!is_mmio && 616 } else if (!is_mmio &&
544 kvmppc_visible_gfn(vcpu, pte.raddr >> PAGE_SHIFT)) { 617 kvmppc_visible_gpa(vcpu, pte.raddr)) {
545 if (data && !(vcpu->arch.fault_dsisr & DSISR_NOHPTE)) { 618 if (data && !(vcpu->arch.fault_dsisr & DSISR_NOHPTE)) {
546 /* 619 /*
547 * There is already a host HPTE there, presumably 620 * There is already a host HPTE there, presumably
@@ -637,42 +710,6 @@ static void kvmppc_giveup_fac(struct kvm_vcpu *vcpu, ulong fac)
637#endif 710#endif
638} 711}
639 712
640static int kvmppc_read_inst(struct kvm_vcpu *vcpu)
641{
642 ulong srr0 = kvmppc_get_pc(vcpu);
643 u32 last_inst = kvmppc_get_last_inst(vcpu);
644 int ret;
645
646 ret = kvmppc_ld(vcpu, &srr0, sizeof(u32), &last_inst, false);
647 if (ret == -ENOENT) {
648 ulong msr = kvmppc_get_msr(vcpu);
649
650 msr = kvmppc_set_field(msr, 33, 33, 1);
651 msr = kvmppc_set_field(msr, 34, 36, 0);
652 msr = kvmppc_set_field(msr, 42, 47, 0);
653 kvmppc_set_msr_fast(vcpu, msr);
654 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_INST_STORAGE);
655 return EMULATE_AGAIN;
656 }
657
658 return EMULATE_DONE;
659}
660
661static int kvmppc_check_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr)
662{
663
664 /* Need to do paired single emulation? */
665 if (!(vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE))
666 return EMULATE_DONE;
667
668 /* Read out the instruction */
669 if (kvmppc_read_inst(vcpu) == EMULATE_DONE)
670 /* Need to emulate */
671 return EMULATE_FAIL;
672
673 return EMULATE_AGAIN;
674}
675
676/* Handle external providers (FPU, Altivec, VSX) */ 713/* Handle external providers (FPU, Altivec, VSX) */
677static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr, 714static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
678 ulong msr) 715 ulong msr)
@@ -834,6 +871,15 @@ static int kvmppc_handle_fac(struct kvm_vcpu *vcpu, ulong fac)
834 871
835 return RESUME_GUEST; 872 return RESUME_GUEST;
836} 873}
874
875void kvmppc_set_fscr(struct kvm_vcpu *vcpu, u64 fscr)
876{
877 if ((vcpu->arch.fscr & FSCR_TAR) && !(fscr & FSCR_TAR)) {
878 /* TAR got dropped, drop it in shadow too */
879 kvmppc_giveup_fac(vcpu, FSCR_TAR_LG);
880 }
881 vcpu->arch.fscr = fscr;
882}
837#endif 883#endif
838 884
839int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu, 885int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -858,6 +904,9 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
858 ulong shadow_srr1 = vcpu->arch.shadow_srr1; 904 ulong shadow_srr1 = vcpu->arch.shadow_srr1;
859 vcpu->stat.pf_instruc++; 905 vcpu->stat.pf_instruc++;
860 906
907 if (kvmppc_is_split_real(vcpu))
908 kvmppc_fixup_split_real(vcpu);
909
861#ifdef CONFIG_PPC_BOOK3S_32 910#ifdef CONFIG_PPC_BOOK3S_32
862 /* We set segments as unused segments when invalidating them. So 911 /* We set segments as unused segments when invalidating them. So
863 * treat the respective fault as segment fault. */ 912 * treat the respective fault as segment fault. */
@@ -960,6 +1009,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
960 case BOOK3S_INTERRUPT_DECREMENTER: 1009 case BOOK3S_INTERRUPT_DECREMENTER:
961 case BOOK3S_INTERRUPT_HV_DECREMENTER: 1010 case BOOK3S_INTERRUPT_HV_DECREMENTER:
962 case BOOK3S_INTERRUPT_DOORBELL: 1011 case BOOK3S_INTERRUPT_DOORBELL:
1012 case BOOK3S_INTERRUPT_H_DOORBELL:
963 vcpu->stat.dec_exits++; 1013 vcpu->stat.dec_exits++;
964 r = RESUME_GUEST; 1014 r = RESUME_GUEST;
965 break; 1015 break;
@@ -977,15 +1027,24 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
977 { 1027 {
978 enum emulation_result er; 1028 enum emulation_result er;
979 ulong flags; 1029 ulong flags;
1030 u32 last_inst;
1031 int emul;
980 1032
981program_interrupt: 1033program_interrupt:
982 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull; 1034 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
983 1035
1036 emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
1037 if (emul != EMULATE_DONE) {
1038 r = RESUME_GUEST;
1039 break;
1040 }
1041
984 if (kvmppc_get_msr(vcpu) & MSR_PR) { 1042 if (kvmppc_get_msr(vcpu) & MSR_PR) {
985#ifdef EXIT_DEBUG 1043#ifdef EXIT_DEBUG
986 printk(KERN_INFO "Userspace triggered 0x700 exception at 0x%lx (0x%x)\n", kvmppc_get_pc(vcpu), kvmppc_get_last_inst(vcpu)); 1044 pr_info("Userspace triggered 0x700 exception at\n 0x%lx (0x%x)\n",
1045 kvmppc_get_pc(vcpu), last_inst);
987#endif 1046#endif
988 if ((kvmppc_get_last_inst(vcpu) & 0xff0007ff) != 1047 if ((last_inst & 0xff0007ff) !=
989 (INS_DCBZ & 0xfffffff7)) { 1048 (INS_DCBZ & 0xfffffff7)) {
990 kvmppc_core_queue_program(vcpu, flags); 1049 kvmppc_core_queue_program(vcpu, flags);
991 r = RESUME_GUEST; 1050 r = RESUME_GUEST;
@@ -1004,7 +1063,7 @@ program_interrupt:
1004 break; 1063 break;
1005 case EMULATE_FAIL: 1064 case EMULATE_FAIL:
1006 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n", 1065 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
1007 __func__, kvmppc_get_pc(vcpu), kvmppc_get_last_inst(vcpu)); 1066 __func__, kvmppc_get_pc(vcpu), last_inst);
1008 kvmppc_core_queue_program(vcpu, flags); 1067 kvmppc_core_queue_program(vcpu, flags);
1009 r = RESUME_GUEST; 1068 r = RESUME_GUEST;
1010 break; 1069 break;
@@ -1021,8 +1080,23 @@ program_interrupt:
1021 break; 1080 break;
1022 } 1081 }
1023 case BOOK3S_INTERRUPT_SYSCALL: 1082 case BOOK3S_INTERRUPT_SYSCALL:
1083 {
1084 u32 last_sc;
1085 int emul;
1086
1087 /* Get last sc for papr */
1088 if (vcpu->arch.papr_enabled) {
1089 /* The sc instuction points SRR0 to the next inst */
1090 emul = kvmppc_get_last_inst(vcpu, INST_SC, &last_sc);
1091 if (emul != EMULATE_DONE) {
1092 kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) - 4);
1093 r = RESUME_GUEST;
1094 break;
1095 }
1096 }
1097
1024 if (vcpu->arch.papr_enabled && 1098 if (vcpu->arch.papr_enabled &&
1025 (kvmppc_get_last_sc(vcpu) == 0x44000022) && 1099 (last_sc == 0x44000022) &&
1026 !(kvmppc_get_msr(vcpu) & MSR_PR)) { 1100 !(kvmppc_get_msr(vcpu) & MSR_PR)) {
1027 /* SC 1 papr hypercalls */ 1101 /* SC 1 papr hypercalls */
1028 ulong cmd = kvmppc_get_gpr(vcpu, 3); 1102 ulong cmd = kvmppc_get_gpr(vcpu, 3);
@@ -1067,36 +1141,51 @@ program_interrupt:
1067 r = RESUME_GUEST; 1141 r = RESUME_GUEST;
1068 } 1142 }
1069 break; 1143 break;
1144 }
1070 case BOOK3S_INTERRUPT_FP_UNAVAIL: 1145 case BOOK3S_INTERRUPT_FP_UNAVAIL:
1071 case BOOK3S_INTERRUPT_ALTIVEC: 1146 case BOOK3S_INTERRUPT_ALTIVEC:
1072 case BOOK3S_INTERRUPT_VSX: 1147 case BOOK3S_INTERRUPT_VSX:
1073 { 1148 {
1074 int ext_msr = 0; 1149 int ext_msr = 0;
1150 int emul;
1151 u32 last_inst;
1152
1153 if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE) {
1154 /* Do paired single instruction emulation */
1155 emul = kvmppc_get_last_inst(vcpu, INST_GENERIC,
1156 &last_inst);
1157 if (emul == EMULATE_DONE)
1158 goto program_interrupt;
1159 else
1160 r = RESUME_GUEST;
1075 1161
1076 switch (exit_nr) { 1162 break;
1077 case BOOK3S_INTERRUPT_FP_UNAVAIL: ext_msr = MSR_FP; break;
1078 case BOOK3S_INTERRUPT_ALTIVEC: ext_msr = MSR_VEC; break;
1079 case BOOK3S_INTERRUPT_VSX: ext_msr = MSR_VSX; break;
1080 } 1163 }
1081 1164
1082 switch (kvmppc_check_ext(vcpu, exit_nr)) { 1165 /* Enable external provider */
1083 case EMULATE_DONE: 1166 switch (exit_nr) {
1084 /* everything ok - let's enable the ext */ 1167 case BOOK3S_INTERRUPT_FP_UNAVAIL:
1085 r = kvmppc_handle_ext(vcpu, exit_nr, ext_msr); 1168 ext_msr = MSR_FP;
1086 break; 1169 break;
1087 case EMULATE_FAIL: 1170
1088 /* we need to emulate this instruction */ 1171 case BOOK3S_INTERRUPT_ALTIVEC:
1089 goto program_interrupt; 1172 ext_msr = MSR_VEC;
1090 break; 1173 break;
1091 default: 1174
1092 /* nothing to worry about - go again */ 1175 case BOOK3S_INTERRUPT_VSX:
1176 ext_msr = MSR_VSX;
1093 break; 1177 break;
1094 } 1178 }
1179
1180 r = kvmppc_handle_ext(vcpu, exit_nr, ext_msr);
1095 break; 1181 break;
1096 } 1182 }
1097 case BOOK3S_INTERRUPT_ALIGNMENT: 1183 case BOOK3S_INTERRUPT_ALIGNMENT:
1098 if (kvmppc_read_inst(vcpu) == EMULATE_DONE) { 1184 {
1099 u32 last_inst = kvmppc_get_last_inst(vcpu); 1185 u32 last_inst;
1186 int emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
1187
1188 if (emul == EMULATE_DONE) {
1100 u32 dsisr; 1189 u32 dsisr;
1101 u64 dar; 1190 u64 dar;
1102 1191
@@ -1110,6 +1199,7 @@ program_interrupt:
1110 } 1199 }
1111 r = RESUME_GUEST; 1200 r = RESUME_GUEST;
1112 break; 1201 break;
1202 }
1113#ifdef CONFIG_PPC_BOOK3S_64 1203#ifdef CONFIG_PPC_BOOK3S_64
1114 case BOOK3S_INTERRUPT_FAC_UNAVAIL: 1204 case BOOK3S_INTERRUPT_FAC_UNAVAIL:
1115 kvmppc_handle_fac(vcpu, vcpu->arch.shadow_fscr >> 56); 1205 kvmppc_handle_fac(vcpu, vcpu->arch.shadow_fscr >> 56);
@@ -1233,6 +1323,7 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1233 *val = get_reg_val(id, to_book3s(vcpu)->hior); 1323 *val = get_reg_val(id, to_book3s(vcpu)->hior);
1234 break; 1324 break;
1235 case KVM_REG_PPC_LPCR: 1325 case KVM_REG_PPC_LPCR:
1326 case KVM_REG_PPC_LPCR_64:
1236 /* 1327 /*
1237 * We are only interested in the LPCR_ILE bit 1328 * We are only interested in the LPCR_ILE bit
1238 */ 1329 */
@@ -1268,6 +1359,7 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1268 to_book3s(vcpu)->hior_explicit = true; 1359 to_book3s(vcpu)->hior_explicit = true;
1269 break; 1360 break;
1270 case KVM_REG_PPC_LPCR: 1361 case KVM_REG_PPC_LPCR:
1362 case KVM_REG_PPC_LPCR_64:
1271 kvmppc_set_lpcr_pr(vcpu, set_reg_val(id, *val)); 1363 kvmppc_set_lpcr_pr(vcpu, set_reg_val(id, *val));
1272 break; 1364 break;
1273 default: 1365 default:
@@ -1310,8 +1402,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
1310 p = __get_free_page(GFP_KERNEL|__GFP_ZERO); 1402 p = __get_free_page(GFP_KERNEL|__GFP_ZERO);
1311 if (!p) 1403 if (!p)
1312 goto uninit_vcpu; 1404 goto uninit_vcpu;
1313 /* the real shared page fills the last 4k of our page */ 1405 vcpu->arch.shared = (void *)p;
1314 vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);
1315#ifdef CONFIG_PPC_BOOK3S_64 1406#ifdef CONFIG_PPC_BOOK3S_64
1316 /* Always start the shared struct in native endian mode */ 1407 /* Always start the shared struct in native endian mode */
1317#ifdef __BIG_ENDIAN__ 1408#ifdef __BIG_ENDIAN__
@@ -1568,6 +1659,11 @@ static int kvmppc_core_init_vm_pr(struct kvm *kvm)
1568{ 1659{
1569 mutex_init(&kvm->arch.hpt_mutex); 1660 mutex_init(&kvm->arch.hpt_mutex);
1570 1661
1662#ifdef CONFIG_PPC_BOOK3S_64
1663 /* Start out with the default set of hcalls enabled */
1664 kvmppc_pr_init_default_hcalls(kvm);
1665#endif
1666
1571 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 1667 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
1572 spin_lock(&kvm_global_user_count_lock); 1668 spin_lock(&kvm_global_user_count_lock);
1573 if (++kvm_global_user_count == 1) 1669 if (++kvm_global_user_count == 1)
@@ -1636,6 +1732,9 @@ static struct kvmppc_ops kvm_ops_pr = {
1636 .emulate_mfspr = kvmppc_core_emulate_mfspr_pr, 1732 .emulate_mfspr = kvmppc_core_emulate_mfspr_pr,
1637 .fast_vcpu_kick = kvm_vcpu_kick, 1733 .fast_vcpu_kick = kvm_vcpu_kick,
1638 .arch_vm_ioctl = kvm_arch_vm_ioctl_pr, 1734 .arch_vm_ioctl = kvm_arch_vm_ioctl_pr,
1735#ifdef CONFIG_PPC_BOOK3S_64
1736 .hcall_implemented = kvmppc_hcall_impl_pr,
1737#endif
1639}; 1738};
1640 1739
1641 1740
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index 52a63bfe3f07..ce3c893d509b 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -40,8 +40,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu)
40{ 40{
41 long flags = kvmppc_get_gpr(vcpu, 4); 41 long flags = kvmppc_get_gpr(vcpu, 4);
42 long pte_index = kvmppc_get_gpr(vcpu, 5); 42 long pte_index = kvmppc_get_gpr(vcpu, 5);
43 unsigned long pteg[2 * 8]; 43 __be64 pteg[2 * 8];
44 unsigned long pteg_addr, i, *hpte; 44 __be64 *hpte;
45 unsigned long pteg_addr, i;
45 long int ret; 46 long int ret;
46 47
47 i = pte_index & 7; 48 i = pte_index & 7;
@@ -93,8 +94,8 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu)
93 pteg = get_pteg_addr(vcpu, pte_index); 94 pteg = get_pteg_addr(vcpu, pte_index);
94 mutex_lock(&vcpu->kvm->arch.hpt_mutex); 95 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
95 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 96 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
96 pte[0] = be64_to_cpu(pte[0]); 97 pte[0] = be64_to_cpu((__force __be64)pte[0]);
97 pte[1] = be64_to_cpu(pte[1]); 98 pte[1] = be64_to_cpu((__force __be64)pte[1]);
98 99
99 ret = H_NOT_FOUND; 100 ret = H_NOT_FOUND;
100 if ((pte[0] & HPTE_V_VALID) == 0 || 101 if ((pte[0] & HPTE_V_VALID) == 0 ||
@@ -171,8 +172,8 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu)
171 172
172 pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); 173 pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX);
173 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 174 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
174 pte[0] = be64_to_cpu(pte[0]); 175 pte[0] = be64_to_cpu((__force __be64)pte[0]);
175 pte[1] = be64_to_cpu(pte[1]); 176 pte[1] = be64_to_cpu((__force __be64)pte[1]);
176 177
177 /* tsl = AVPN */ 178 /* tsl = AVPN */
178 flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26; 179 flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26;
@@ -211,8 +212,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
211 pteg = get_pteg_addr(vcpu, pte_index); 212 pteg = get_pteg_addr(vcpu, pte_index);
212 mutex_lock(&vcpu->kvm->arch.hpt_mutex); 213 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
213 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 214 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
214 pte[0] = be64_to_cpu(pte[0]); 215 pte[0] = be64_to_cpu((__force __be64)pte[0]);
215 pte[1] = be64_to_cpu(pte[1]); 216 pte[1] = be64_to_cpu((__force __be64)pte[1]);
216 217
217 ret = H_NOT_FOUND; 218 ret = H_NOT_FOUND;
218 if ((pte[0] & HPTE_V_VALID) == 0 || 219 if ((pte[0] & HPTE_V_VALID) == 0 ||
@@ -231,8 +232,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
231 232
232 rb = compute_tlbie_rb(v, r, pte_index); 233 rb = compute_tlbie_rb(v, r, pte_index);
233 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); 234 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false);
234 pte[0] = cpu_to_be64(pte[0]); 235 pte[0] = (__force u64)cpu_to_be64(pte[0]);
235 pte[1] = cpu_to_be64(pte[1]); 236 pte[1] = (__force u64)cpu_to_be64(pte[1]);
236 copy_to_user((void __user *)pteg, pte, sizeof(pte)); 237 copy_to_user((void __user *)pteg, pte, sizeof(pte));
237 ret = H_SUCCESS; 238 ret = H_SUCCESS;
238 239
@@ -266,6 +267,12 @@ static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
266 267
267int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) 268int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
268{ 269{
270 int rc, idx;
271
272 if (cmd <= MAX_HCALL_OPCODE &&
273 !test_bit(cmd/4, vcpu->kvm->arch.enabled_hcalls))
274 return EMULATE_FAIL;
275
269 switch (cmd) { 276 switch (cmd) {
270 case H_ENTER: 277 case H_ENTER:
271 return kvmppc_h_pr_enter(vcpu); 278 return kvmppc_h_pr_enter(vcpu);
@@ -294,8 +301,11 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
294 break; 301 break;
295 case H_RTAS: 302 case H_RTAS:
296 if (list_empty(&vcpu->kvm->arch.rtas_tokens)) 303 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
297 return RESUME_HOST; 304 break;
298 if (kvmppc_rtas_hcall(vcpu)) 305 idx = srcu_read_lock(&vcpu->kvm->srcu);
306 rc = kvmppc_rtas_hcall(vcpu);
307 srcu_read_unlock(&vcpu->kvm->srcu, idx);
308 if (rc)
299 break; 309 break;
300 kvmppc_set_gpr(vcpu, 3, 0); 310 kvmppc_set_gpr(vcpu, 3, 0);
301 return EMULATE_DONE; 311 return EMULATE_DONE;
@@ -303,3 +313,61 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
303 313
304 return EMULATE_FAIL; 314 return EMULATE_FAIL;
305} 315}
316
317int kvmppc_hcall_impl_pr(unsigned long cmd)
318{
319 switch (cmd) {
320 case H_ENTER:
321 case H_REMOVE:
322 case H_PROTECT:
323 case H_BULK_REMOVE:
324 case H_PUT_TCE:
325 case H_CEDE:
326#ifdef CONFIG_KVM_XICS
327 case H_XIRR:
328 case H_CPPR:
329 case H_EOI:
330 case H_IPI:
331 case H_IPOLL:
332 case H_XIRR_X:
333#endif
334 return 1;
335 }
336 return 0;
337}
338
339/*
340 * List of hcall numbers to enable by default.
341 * For compatibility with old userspace, we enable by default
342 * all hcalls that were implemented before the hcall-enabling
343 * facility was added. Note this list should not include H_RTAS.
344 */
345static unsigned int default_hcall_list[] = {
346 H_ENTER,
347 H_REMOVE,
348 H_PROTECT,
349 H_BULK_REMOVE,
350 H_PUT_TCE,
351 H_CEDE,
352#ifdef CONFIG_KVM_XICS
353 H_XIRR,
354 H_CPPR,
355 H_EOI,
356 H_IPI,
357 H_IPOLL,
358 H_XIRR_X,
359#endif
360 0
361};
362
363void kvmppc_pr_init_default_hcalls(struct kvm *kvm)
364{
365 int i;
366 unsigned int hcall;
367
368 for (i = 0; default_hcall_list[i]; ++i) {
369 hcall = default_hcall_list[i];
370 WARN_ON(!kvmppc_hcall_impl_pr(hcall));
371 __set_bit(hcall / 4, kvm->arch.enabled_hcalls);
372 }
373}
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index d1acd32a64c0..eaeb78047fb8 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -64,8 +64,12 @@
64static void icp_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp, 64static void icp_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
65 u32 new_irq); 65 u32 new_irq);
66 66
67static int ics_deliver_irq(struct kvmppc_xics *xics, u32 irq, u32 level, 67/*
68 bool report_status) 68 * Return value ideally indicates how the interrupt was handled, but no
69 * callers look at it (given that we don't implement KVM_IRQ_LINE_STATUS),
70 * so just return 0.
71 */
72static int ics_deliver_irq(struct kvmppc_xics *xics, u32 irq, u32 level)
69{ 73{
70 struct ics_irq_state *state; 74 struct ics_irq_state *state;
71 struct kvmppc_ics *ics; 75 struct kvmppc_ics *ics;
@@ -82,17 +86,14 @@ static int ics_deliver_irq(struct kvmppc_xics *xics, u32 irq, u32 level,
82 if (!state->exists) 86 if (!state->exists)
83 return -EINVAL; 87 return -EINVAL;
84 88
85 if (report_status)
86 return state->asserted;
87
88 /* 89 /*
89 * We set state->asserted locklessly. This should be fine as 90 * We set state->asserted locklessly. This should be fine as
90 * we are the only setter, thus concurrent access is undefined 91 * we are the only setter, thus concurrent access is undefined
91 * to begin with. 92 * to begin with.
92 */ 93 */
93 if (level == KVM_INTERRUPT_SET_LEVEL) 94 if (level == 1 || level == KVM_INTERRUPT_SET_LEVEL)
94 state->asserted = 1; 95 state->asserted = 1;
95 else if (level == KVM_INTERRUPT_UNSET) { 96 else if (level == 0 || level == KVM_INTERRUPT_UNSET) {
96 state->asserted = 0; 97 state->asserted = 0;
97 return 0; 98 return 0;
98 } 99 }
@@ -100,7 +101,7 @@ static int ics_deliver_irq(struct kvmppc_xics *xics, u32 irq, u32 level,
100 /* Attempt delivery */ 101 /* Attempt delivery */
101 icp_deliver_irq(xics, NULL, irq); 102 icp_deliver_irq(xics, NULL, irq);
102 103
103 return state->asserted; 104 return 0;
104} 105}
105 106
106static void ics_check_resend(struct kvmppc_xics *xics, struct kvmppc_ics *ics, 107static void ics_check_resend(struct kvmppc_xics *xics, struct kvmppc_ics *ics,
@@ -772,6 +773,8 @@ static noinline int kvmppc_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
772 if (state->asserted) 773 if (state->asserted)
773 icp_deliver_irq(xics, icp, irq); 774 icp_deliver_irq(xics, icp, irq);
774 775
776 kvm_notify_acked_irq(vcpu->kvm, 0, irq);
777
775 return H_SUCCESS; 778 return H_SUCCESS;
776} 779}
777 780
@@ -789,6 +792,8 @@ static noinline int kvmppc_xics_rm_complete(struct kvm_vcpu *vcpu, u32 hcall)
789 icp_check_resend(xics, icp); 792 icp_check_resend(xics, icp);
790 if (icp->rm_action & XICS_RM_REJECT) 793 if (icp->rm_action & XICS_RM_REJECT)
791 icp_deliver_irq(xics, icp, icp->rm_reject); 794 icp_deliver_irq(xics, icp, icp->rm_reject);
795 if (icp->rm_action & XICS_RM_NOTIFY_EOI)
796 kvm_notify_acked_irq(vcpu->kvm, 0, icp->rm_eoied_irq);
792 797
793 icp->rm_action = 0; 798 icp->rm_action = 0;
794 799
@@ -1170,7 +1175,16 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
1170{ 1175{
1171 struct kvmppc_xics *xics = kvm->arch.xics; 1176 struct kvmppc_xics *xics = kvm->arch.xics;
1172 1177
1173 return ics_deliver_irq(xics, irq, level, line_status); 1178 return ics_deliver_irq(xics, irq, level);
1179}
1180
1181int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
1182 int irq_source_id, int level, bool line_status)
1183{
1184 if (!level)
1185 return -1;
1186 return kvm_set_irq(kvm, irq_source_id, irq_entry->gsi,
1187 level, line_status);
1174} 1188}
1175 1189
1176static int xics_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr) 1190static int xics_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
@@ -1301,3 +1315,26 @@ void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu)
1301 vcpu->arch.icp = NULL; 1315 vcpu->arch.icp = NULL;
1302 vcpu->arch.irq_type = KVMPPC_IRQ_DEFAULT; 1316 vcpu->arch.irq_type = KVMPPC_IRQ_DEFAULT;
1303} 1317}
1318
1319static int xics_set_irq(struct kvm_kernel_irq_routing_entry *e,
1320 struct kvm *kvm, int irq_source_id, int level,
1321 bool line_status)
1322{
1323 return kvm_set_irq(kvm, irq_source_id, e->gsi, level, line_status);
1324}
1325
1326int kvm_irq_map_gsi(struct kvm *kvm,
1327 struct kvm_kernel_irq_routing_entry *entries, int gsi)
1328{
1329 entries->gsi = gsi;
1330 entries->type = KVM_IRQ_ROUTING_IRQCHIP;
1331 entries->set = xics_set_irq;
1332 entries->irqchip.irqchip = 0;
1333 entries->irqchip.pin = gsi;
1334 return 1;
1335}
1336
1337int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin)
1338{
1339 return pin;
1340}
diff --git a/arch/powerpc/kvm/book3s_xics.h b/arch/powerpc/kvm/book3s_xics.h
index dd9326c5c19b..e8aaa7a3f209 100644
--- a/arch/powerpc/kvm/book3s_xics.h
+++ b/arch/powerpc/kvm/book3s_xics.h
@@ -71,9 +71,11 @@ struct kvmppc_icp {
71#define XICS_RM_KICK_VCPU 0x1 71#define XICS_RM_KICK_VCPU 0x1
72#define XICS_RM_CHECK_RESEND 0x2 72#define XICS_RM_CHECK_RESEND 0x2
73#define XICS_RM_REJECT 0x4 73#define XICS_RM_REJECT 0x4
74#define XICS_RM_NOTIFY_EOI 0x8
74 u32 rm_action; 75 u32 rm_action;
75 struct kvm_vcpu *rm_kick_target; 76 struct kvm_vcpu *rm_kick_target;
76 u32 rm_reject; 77 u32 rm_reject;
78 u32 rm_eoied_irq;
77 79
78 /* Debug stuff for real mode */ 80 /* Debug stuff for real mode */
79 union kvmppc_icp_state rm_dbgstate; 81 union kvmppc_icp_state rm_dbgstate;
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index ab62109fdfa3..b4c89fa6f109 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -51,7 +51,6 @@ unsigned long kvmppc_booke_handlers;
51 51
52struct kvm_stats_debugfs_item debugfs_entries[] = { 52struct kvm_stats_debugfs_item debugfs_entries[] = {
53 { "mmio", VCPU_STAT(mmio_exits) }, 53 { "mmio", VCPU_STAT(mmio_exits) },
54 { "dcr", VCPU_STAT(dcr_exits) },
55 { "sig", VCPU_STAT(signal_exits) }, 54 { "sig", VCPU_STAT(signal_exits) },
56 { "itlb_r", VCPU_STAT(itlb_real_miss_exits) }, 55 { "itlb_r", VCPU_STAT(itlb_real_miss_exits) },
57 { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) }, 56 { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) },
@@ -185,24 +184,28 @@ static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,
185 set_bit(priority, &vcpu->arch.pending_exceptions); 184 set_bit(priority, &vcpu->arch.pending_exceptions);
186} 185}
187 186
188static void kvmppc_core_queue_dtlb_miss(struct kvm_vcpu *vcpu, 187void kvmppc_core_queue_dtlb_miss(struct kvm_vcpu *vcpu,
189 ulong dear_flags, ulong esr_flags) 188 ulong dear_flags, ulong esr_flags)
190{ 189{
191 vcpu->arch.queued_dear = dear_flags; 190 vcpu->arch.queued_dear = dear_flags;
192 vcpu->arch.queued_esr = esr_flags; 191 vcpu->arch.queued_esr = esr_flags;
193 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DTLB_MISS); 192 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DTLB_MISS);
194} 193}
195 194
196static void kvmppc_core_queue_data_storage(struct kvm_vcpu *vcpu, 195void kvmppc_core_queue_data_storage(struct kvm_vcpu *vcpu,
197 ulong dear_flags, ulong esr_flags) 196 ulong dear_flags, ulong esr_flags)
198{ 197{
199 vcpu->arch.queued_dear = dear_flags; 198 vcpu->arch.queued_dear = dear_flags;
200 vcpu->arch.queued_esr = esr_flags; 199 vcpu->arch.queued_esr = esr_flags;
201 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DATA_STORAGE); 200 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DATA_STORAGE);
202} 201}
203 202
204static void kvmppc_core_queue_inst_storage(struct kvm_vcpu *vcpu, 203void kvmppc_core_queue_itlb_miss(struct kvm_vcpu *vcpu)
205 ulong esr_flags) 204{
205 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ITLB_MISS);
206}
207
208void kvmppc_core_queue_inst_storage(struct kvm_vcpu *vcpu, ulong esr_flags)
206{ 209{
207 vcpu->arch.queued_esr = esr_flags; 210 vcpu->arch.queued_esr = esr_flags;
208 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE); 211 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);
@@ -266,13 +269,8 @@ static void kvmppc_core_dequeue_watchdog(struct kvm_vcpu *vcpu)
266 269
267static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1) 270static void set_guest_srr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
268{ 271{
269#ifdef CONFIG_KVM_BOOKE_HV 272 kvmppc_set_srr0(vcpu, srr0);
270 mtspr(SPRN_GSRR0, srr0); 273 kvmppc_set_srr1(vcpu, srr1);
271 mtspr(SPRN_GSRR1, srr1);
272#else
273 vcpu->arch.shared->srr0 = srr0;
274 vcpu->arch.shared->srr1 = srr1;
275#endif
276} 274}
277 275
278static void set_guest_csrr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1) 276static void set_guest_csrr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
@@ -297,51 +295,6 @@ static void set_guest_mcsrr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
297 vcpu->arch.mcsrr1 = srr1; 295 vcpu->arch.mcsrr1 = srr1;
298} 296}
299 297
300static unsigned long get_guest_dear(struct kvm_vcpu *vcpu)
301{
302#ifdef CONFIG_KVM_BOOKE_HV
303 return mfspr(SPRN_GDEAR);
304#else
305 return vcpu->arch.shared->dar;
306#endif
307}
308
309static void set_guest_dear(struct kvm_vcpu *vcpu, unsigned long dear)
310{
311#ifdef CONFIG_KVM_BOOKE_HV
312 mtspr(SPRN_GDEAR, dear);
313#else
314 vcpu->arch.shared->dar = dear;
315#endif
316}
317
318static unsigned long get_guest_esr(struct kvm_vcpu *vcpu)
319{
320#ifdef CONFIG_KVM_BOOKE_HV
321 return mfspr(SPRN_GESR);
322#else
323 return vcpu->arch.shared->esr;
324#endif
325}
326
327static void set_guest_esr(struct kvm_vcpu *vcpu, u32 esr)
328{
329#ifdef CONFIG_KVM_BOOKE_HV
330 mtspr(SPRN_GESR, esr);
331#else
332 vcpu->arch.shared->esr = esr;
333#endif
334}
335
336static unsigned long get_guest_epr(struct kvm_vcpu *vcpu)
337{
338#ifdef CONFIG_KVM_BOOKE_HV
339 return mfspr(SPRN_GEPR);
340#else
341 return vcpu->arch.epr;
342#endif
343}
344
345/* Deliver the interrupt of the corresponding priority, if possible. */ 298/* Deliver the interrupt of the corresponding priority, if possible. */
346static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, 299static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
347 unsigned int priority) 300 unsigned int priority)
@@ -450,9 +403,9 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
450 403
451 vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[priority]; 404 vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[priority];
452 if (update_esr == true) 405 if (update_esr == true)
453 set_guest_esr(vcpu, vcpu->arch.queued_esr); 406 kvmppc_set_esr(vcpu, vcpu->arch.queued_esr);
454 if (update_dear == true) 407 if (update_dear == true)
455 set_guest_dear(vcpu, vcpu->arch.queued_dear); 408 kvmppc_set_dar(vcpu, vcpu->arch.queued_dear);
456 if (update_epr == true) { 409 if (update_epr == true) {
457 if (vcpu->arch.epr_flags & KVMPPC_EPR_USER) 410 if (vcpu->arch.epr_flags & KVMPPC_EPR_USER)
458 kvm_make_request(KVM_REQ_EPR_EXIT, vcpu); 411 kvm_make_request(KVM_REQ_EPR_EXIT, vcpu);
@@ -752,9 +705,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
752 * they were actually modified by emulation. */ 705 * they were actually modified by emulation. */
753 return RESUME_GUEST_NV; 706 return RESUME_GUEST_NV;
754 707
755 case EMULATE_DO_DCR: 708 case EMULATE_AGAIN:
756 run->exit_reason = KVM_EXIT_DCR; 709 return RESUME_GUEST;
757 return RESUME_HOST;
758 710
759 case EMULATE_FAIL: 711 case EMULATE_FAIL:
760 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n", 712 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
@@ -866,6 +818,28 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
866 } 818 }
867} 819}
868 820
821static int kvmppc_resume_inst_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
822 enum emulation_result emulated, u32 last_inst)
823{
824 switch (emulated) {
825 case EMULATE_AGAIN:
826 return RESUME_GUEST;
827
828 case EMULATE_FAIL:
829 pr_debug("%s: load instruction from guest address %lx failed\n",
830 __func__, vcpu->arch.pc);
831 /* For debugging, encode the failing instruction and
832 * report it to userspace. */
833 run->hw.hardware_exit_reason = ~0ULL << 32;
834 run->hw.hardware_exit_reason |= last_inst;
835 kvmppc_core_queue_program(vcpu, ESR_PIL);
836 return RESUME_HOST;
837
838 default:
839 BUG();
840 }
841}
842
869/** 843/**
870 * kvmppc_handle_exit 844 * kvmppc_handle_exit
871 * 845 *
@@ -877,6 +851,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
877 int r = RESUME_HOST; 851 int r = RESUME_HOST;
878 int s; 852 int s;
879 int idx; 853 int idx;
854 u32 last_inst = KVM_INST_FETCH_FAILED;
855 enum emulation_result emulated = EMULATE_DONE;
880 856
881 /* update before a new last_exit_type is rewritten */ 857 /* update before a new last_exit_type is rewritten */
882 kvmppc_update_timing_stats(vcpu); 858 kvmppc_update_timing_stats(vcpu);
@@ -884,6 +860,20 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
884 /* restart interrupts if they were meant for the host */ 860 /* restart interrupts if they were meant for the host */
885 kvmppc_restart_interrupt(vcpu, exit_nr); 861 kvmppc_restart_interrupt(vcpu, exit_nr);
886 862
863 /*
864 * get last instruction before beeing preempted
865 * TODO: for e6500 check also BOOKE_INTERRUPT_LRAT_ERROR & ESR_DATA
866 */
867 switch (exit_nr) {
868 case BOOKE_INTERRUPT_DATA_STORAGE:
869 case BOOKE_INTERRUPT_DTLB_MISS:
870 case BOOKE_INTERRUPT_HV_PRIV:
871 emulated = kvmppc_get_last_inst(vcpu, false, &last_inst);
872 break;
873 default:
874 break;
875 }
876
887 local_irq_enable(); 877 local_irq_enable();
888 878
889 trace_kvm_exit(exit_nr, vcpu); 879 trace_kvm_exit(exit_nr, vcpu);
@@ -892,6 +882,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
892 run->exit_reason = KVM_EXIT_UNKNOWN; 882 run->exit_reason = KVM_EXIT_UNKNOWN;
893 run->ready_for_interrupt_injection = 1; 883 run->ready_for_interrupt_injection = 1;
894 884
885 if (emulated != EMULATE_DONE) {
886 r = kvmppc_resume_inst_load(run, vcpu, emulated, last_inst);
887 goto out;
888 }
889
895 switch (exit_nr) { 890 switch (exit_nr) {
896 case BOOKE_INTERRUPT_MACHINE_CHECK: 891 case BOOKE_INTERRUPT_MACHINE_CHECK:
897 printk("MACHINE CHECK: %lx\n", mfspr(SPRN_MCSR)); 892 printk("MACHINE CHECK: %lx\n", mfspr(SPRN_MCSR));
@@ -1181,6 +1176,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1181 BUG(); 1176 BUG();
1182 } 1177 }
1183 1178
1179out:
1184 /* 1180 /*
1185 * To avoid clobbering exit_reason, only check for signals if we 1181 * To avoid clobbering exit_reason, only check for signals if we
1186 * aren't already exiting to userspace for some other reason. 1182 * aren't already exiting to userspace for some other reason.
@@ -1265,17 +1261,17 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1265 regs->lr = vcpu->arch.lr; 1261 regs->lr = vcpu->arch.lr;
1266 regs->xer = kvmppc_get_xer(vcpu); 1262 regs->xer = kvmppc_get_xer(vcpu);
1267 regs->msr = vcpu->arch.shared->msr; 1263 regs->msr = vcpu->arch.shared->msr;
1268 regs->srr0 = vcpu->arch.shared->srr0; 1264 regs->srr0 = kvmppc_get_srr0(vcpu);
1269 regs->srr1 = vcpu->arch.shared->srr1; 1265 regs->srr1 = kvmppc_get_srr1(vcpu);
1270 regs->pid = vcpu->arch.pid; 1266 regs->pid = vcpu->arch.pid;
1271 regs->sprg0 = vcpu->arch.shared->sprg0; 1267 regs->sprg0 = kvmppc_get_sprg0(vcpu);
1272 regs->sprg1 = vcpu->arch.shared->sprg1; 1268 regs->sprg1 = kvmppc_get_sprg1(vcpu);
1273 regs->sprg2 = vcpu->arch.shared->sprg2; 1269 regs->sprg2 = kvmppc_get_sprg2(vcpu);
1274 regs->sprg3 = vcpu->arch.shared->sprg3; 1270 regs->sprg3 = kvmppc_get_sprg3(vcpu);
1275 regs->sprg4 = vcpu->arch.shared->sprg4; 1271 regs->sprg4 = kvmppc_get_sprg4(vcpu);
1276 regs->sprg5 = vcpu->arch.shared->sprg5; 1272 regs->sprg5 = kvmppc_get_sprg5(vcpu);
1277 regs->sprg6 = vcpu->arch.shared->sprg6; 1273 regs->sprg6 = kvmppc_get_sprg6(vcpu);
1278 regs->sprg7 = vcpu->arch.shared->sprg7; 1274 regs->sprg7 = kvmppc_get_sprg7(vcpu);
1279 1275
1280 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1276 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1281 regs->gpr[i] = kvmppc_get_gpr(vcpu, i); 1277 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
@@ -1293,17 +1289,17 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1293 vcpu->arch.lr = regs->lr; 1289 vcpu->arch.lr = regs->lr;
1294 kvmppc_set_xer(vcpu, regs->xer); 1290 kvmppc_set_xer(vcpu, regs->xer);
1295 kvmppc_set_msr(vcpu, regs->msr); 1291 kvmppc_set_msr(vcpu, regs->msr);
1296 vcpu->arch.shared->srr0 = regs->srr0; 1292 kvmppc_set_srr0(vcpu, regs->srr0);
1297 vcpu->arch.shared->srr1 = regs->srr1; 1293 kvmppc_set_srr1(vcpu, regs->srr1);
1298 kvmppc_set_pid(vcpu, regs->pid); 1294 kvmppc_set_pid(vcpu, regs->pid);
1299 vcpu->arch.shared->sprg0 = regs->sprg0; 1295 kvmppc_set_sprg0(vcpu, regs->sprg0);
1300 vcpu->arch.shared->sprg1 = regs->sprg1; 1296 kvmppc_set_sprg1(vcpu, regs->sprg1);
1301 vcpu->arch.shared->sprg2 = regs->sprg2; 1297 kvmppc_set_sprg2(vcpu, regs->sprg2);
1302 vcpu->arch.shared->sprg3 = regs->sprg3; 1298 kvmppc_set_sprg3(vcpu, regs->sprg3);
1303 vcpu->arch.shared->sprg4 = regs->sprg4; 1299 kvmppc_set_sprg4(vcpu, regs->sprg4);
1304 vcpu->arch.shared->sprg5 = regs->sprg5; 1300 kvmppc_set_sprg5(vcpu, regs->sprg5);
1305 vcpu->arch.shared->sprg6 = regs->sprg6; 1301 kvmppc_set_sprg6(vcpu, regs->sprg6);
1306 vcpu->arch.shared->sprg7 = regs->sprg7; 1302 kvmppc_set_sprg7(vcpu, regs->sprg7);
1307 1303
1308 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1304 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1309 kvmppc_set_gpr(vcpu, i, regs->gpr[i]); 1305 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
@@ -1321,8 +1317,8 @@ static void get_sregs_base(struct kvm_vcpu *vcpu,
1321 sregs->u.e.csrr0 = vcpu->arch.csrr0; 1317 sregs->u.e.csrr0 = vcpu->arch.csrr0;
1322 sregs->u.e.csrr1 = vcpu->arch.csrr1; 1318 sregs->u.e.csrr1 = vcpu->arch.csrr1;
1323 sregs->u.e.mcsr = vcpu->arch.mcsr; 1319 sregs->u.e.mcsr = vcpu->arch.mcsr;
1324 sregs->u.e.esr = get_guest_esr(vcpu); 1320 sregs->u.e.esr = kvmppc_get_esr(vcpu);
1325 sregs->u.e.dear = get_guest_dear(vcpu); 1321 sregs->u.e.dear = kvmppc_get_dar(vcpu);
1326 sregs->u.e.tsr = vcpu->arch.tsr; 1322 sregs->u.e.tsr = vcpu->arch.tsr;
1327 sregs->u.e.tcr = vcpu->arch.tcr; 1323 sregs->u.e.tcr = vcpu->arch.tcr;
1328 sregs->u.e.dec = kvmppc_get_dec(vcpu, tb); 1324 sregs->u.e.dec = kvmppc_get_dec(vcpu, tb);
@@ -1339,8 +1335,8 @@ static int set_sregs_base(struct kvm_vcpu *vcpu,
1339 vcpu->arch.csrr0 = sregs->u.e.csrr0; 1335 vcpu->arch.csrr0 = sregs->u.e.csrr0;
1340 vcpu->arch.csrr1 = sregs->u.e.csrr1; 1336 vcpu->arch.csrr1 = sregs->u.e.csrr1;
1341 vcpu->arch.mcsr = sregs->u.e.mcsr; 1337 vcpu->arch.mcsr = sregs->u.e.mcsr;
1342 set_guest_esr(vcpu, sregs->u.e.esr); 1338 kvmppc_set_esr(vcpu, sregs->u.e.esr);
1343 set_guest_dear(vcpu, sregs->u.e.dear); 1339 kvmppc_set_dar(vcpu, sregs->u.e.dear);
1344 vcpu->arch.vrsave = sregs->u.e.vrsave; 1340 vcpu->arch.vrsave = sregs->u.e.vrsave;
1345 kvmppc_set_tcr(vcpu, sregs->u.e.tcr); 1341 kvmppc_set_tcr(vcpu, sregs->u.e.tcr);
1346 1342
@@ -1493,7 +1489,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1493 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2); 1489 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2);
1494 break; 1490 break;
1495 case KVM_REG_PPC_EPR: { 1491 case KVM_REG_PPC_EPR: {
1496 u32 epr = get_guest_epr(vcpu); 1492 u32 epr = kvmppc_get_epr(vcpu);
1497 val = get_reg_val(reg->id, epr); 1493 val = get_reg_val(reg->id, epr);
1498 break; 1494 break;
1499 } 1495 }
@@ -1788,6 +1784,57 @@ void kvm_guest_protect_msr(struct kvm_vcpu *vcpu, ulong prot_bitmap, bool set)
1788#endif 1784#endif
1789} 1785}
1790 1786
1787int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, enum xlate_instdata xlid,
1788 enum xlate_readwrite xlrw, struct kvmppc_pte *pte)
1789{
1790 int gtlb_index;
1791 gpa_t gpaddr;
1792
1793#ifdef CONFIG_KVM_E500V2
1794 if (!(vcpu->arch.shared->msr & MSR_PR) &&
1795 (eaddr & PAGE_MASK) == vcpu->arch.magic_page_ea) {
1796 pte->eaddr = eaddr;
1797 pte->raddr = (vcpu->arch.magic_page_pa & PAGE_MASK) |
1798 (eaddr & ~PAGE_MASK);
1799 pte->vpage = eaddr >> PAGE_SHIFT;
1800 pte->may_read = true;
1801 pte->may_write = true;
1802 pte->may_execute = true;
1803
1804 return 0;
1805 }
1806#endif
1807
1808 /* Check the guest TLB. */
1809 switch (xlid) {
1810 case XLATE_INST:
1811 gtlb_index = kvmppc_mmu_itlb_index(vcpu, eaddr);
1812 break;
1813 case XLATE_DATA:
1814 gtlb_index = kvmppc_mmu_dtlb_index(vcpu, eaddr);
1815 break;
1816 default:
1817 BUG();
1818 }
1819
1820 /* Do we have a TLB entry at all? */
1821 if (gtlb_index < 0)
1822 return -ENOENT;
1823
1824 gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr);
1825
1826 pte->eaddr = eaddr;
1827 pte->raddr = (gpaddr & PAGE_MASK) | (eaddr & ~PAGE_MASK);
1828 pte->vpage = eaddr >> PAGE_SHIFT;
1829
1830 /* XXX read permissions from the guest TLB */
1831 pte->may_read = true;
1832 pte->may_write = true;
1833 pte->may_execute = true;
1834
1835 return 0;
1836}
1837
1791int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, 1838int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1792 struct kvm_guest_debug *dbg) 1839 struct kvm_guest_debug *dbg)
1793{ 1840{
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index b632cd35919b..f753543c56fa 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -99,13 +99,6 @@ enum int_class {
99 99
100void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type); 100void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type);
101 101
102extern void kvmppc_mmu_destroy_44x(struct kvm_vcpu *vcpu);
103extern int kvmppc_core_emulate_op_44x(struct kvm_run *run, struct kvm_vcpu *vcpu,
104 unsigned int inst, int *advance);
105extern int kvmppc_core_emulate_mtspr_44x(struct kvm_vcpu *vcpu, int sprn,
106 ulong spr_val);
107extern int kvmppc_core_emulate_mfspr_44x(struct kvm_vcpu *vcpu, int sprn,
108 ulong *spr_val);
109extern void kvmppc_mmu_destroy_e500(struct kvm_vcpu *vcpu); 102extern void kvmppc_mmu_destroy_e500(struct kvm_vcpu *vcpu);
110extern int kvmppc_core_emulate_op_e500(struct kvm_run *run, 103extern int kvmppc_core_emulate_op_e500(struct kvm_run *run,
111 struct kvm_vcpu *vcpu, 104 struct kvm_vcpu *vcpu,
diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
index 27a4b2877c10..28c158881d23 100644
--- a/arch/powerpc/kvm/booke_emulate.c
+++ b/arch/powerpc/kvm/booke_emulate.c
@@ -165,16 +165,16 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
165 * guest (PR-mode only). 165 * guest (PR-mode only).
166 */ 166 */
167 case SPRN_SPRG4: 167 case SPRN_SPRG4:
168 vcpu->arch.shared->sprg4 = spr_val; 168 kvmppc_set_sprg4(vcpu, spr_val);
169 break; 169 break;
170 case SPRN_SPRG5: 170 case SPRN_SPRG5:
171 vcpu->arch.shared->sprg5 = spr_val; 171 kvmppc_set_sprg5(vcpu, spr_val);
172 break; 172 break;
173 case SPRN_SPRG6: 173 case SPRN_SPRG6:
174 vcpu->arch.shared->sprg6 = spr_val; 174 kvmppc_set_sprg6(vcpu, spr_val);
175 break; 175 break;
176 case SPRN_SPRG7: 176 case SPRN_SPRG7:
177 vcpu->arch.shared->sprg7 = spr_val; 177 kvmppc_set_sprg7(vcpu, spr_val);
178 break; 178 break;
179 179
180 case SPRN_IVPR: 180 case SPRN_IVPR:
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index 2c6deb5ef2fe..84c308a9a371 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -21,7 +21,6 @@
21#include <asm/ppc_asm.h> 21#include <asm/ppc_asm.h>
22#include <asm/kvm_asm.h> 22#include <asm/kvm_asm.h>
23#include <asm/reg.h> 23#include <asm/reg.h>
24#include <asm/mmu-44x.h>
25#include <asm/page.h> 24#include <asm/page.h>
26#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
27 26
@@ -424,10 +423,6 @@ lightweight_exit:
424 mtspr SPRN_PID1, r3 423 mtspr SPRN_PID1, r3
425#endif 424#endif
426 425
427#ifdef CONFIG_44x
428 iccci 0, 0 /* XXX hack */
429#endif
430
431 /* Load some guest volatiles. */ 426 /* Load some guest volatiles. */
432 lwz r0, VCPU_GPR(R0)(r4) 427 lwz r0, VCPU_GPR(R0)(r4)
433 lwz r2, VCPU_GPR(R2)(r4) 428 lwz r2, VCPU_GPR(R2)(r4)
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index a1712b818a5f..e9fa56a911fd 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -24,12 +24,10 @@
24#include <asm/ppc_asm.h> 24#include <asm/ppc_asm.h>
25#include <asm/kvm_asm.h> 25#include <asm/kvm_asm.h>
26#include <asm/reg.h> 26#include <asm/reg.h>
27#include <asm/mmu-44x.h>
28#include <asm/page.h> 27#include <asm/page.h>
29#include <asm/asm-compat.h> 28#include <asm/asm-compat.h>
30#include <asm/asm-offsets.h> 29#include <asm/asm-offsets.h>
31#include <asm/bitsperlong.h> 30#include <asm/bitsperlong.h>
32#include <asm/thread_info.h>
33 31
34#ifdef CONFIG_64BIT 32#ifdef CONFIG_64BIT
35#include <asm/exception-64e.h> 33#include <asm/exception-64e.h>
@@ -122,38 +120,14 @@
1221: 1201:
123 121
124 .if \flags & NEED_EMU 122 .if \flags & NEED_EMU
125 /*
126 * This assumes you have external PID support.
127 * To support a bookehv CPU without external PID, you'll
128 * need to look up the TLB entry and create a temporary mapping.
129 *
130 * FIXME: we don't currently handle if the lwepx faults. PR-mode
131 * booke doesn't handle it either. Since Linux doesn't use
132 * broadcast tlbivax anymore, the only way this should happen is
133 * if the guest maps its memory execute-but-not-read, or if we
134 * somehow take a TLB miss in the middle of this entry code and
135 * evict the relevant entry. On e500mc, all kernel lowmem is
136 * bolted into TLB1 large page mappings, and we don't use
137 * broadcast invalidates, so we should not take a TLB miss here.
138 *
139 * Later we'll need to deal with faults here. Disallowing guest
140 * mappings that are execute-but-not-read could be an option on
141 * e500mc, but not on chips with an LRAT if it is used.
142 */
143
144 mfspr r3, SPRN_EPLC /* will already have correct ELPID and EGS */
145 PPC_STL r15, VCPU_GPR(R15)(r4) 123 PPC_STL r15, VCPU_GPR(R15)(r4)
146 PPC_STL r16, VCPU_GPR(R16)(r4) 124 PPC_STL r16, VCPU_GPR(R16)(r4)
147 PPC_STL r17, VCPU_GPR(R17)(r4) 125 PPC_STL r17, VCPU_GPR(R17)(r4)
148 PPC_STL r18, VCPU_GPR(R18)(r4) 126 PPC_STL r18, VCPU_GPR(R18)(r4)
149 PPC_STL r19, VCPU_GPR(R19)(r4) 127 PPC_STL r19, VCPU_GPR(R19)(r4)
150 mr r8, r3
151 PPC_STL r20, VCPU_GPR(R20)(r4) 128 PPC_STL r20, VCPU_GPR(R20)(r4)
152 rlwimi r8, r6, EPC_EAS_SHIFT - MSR_IR_LG, EPC_EAS
153 PPC_STL r21, VCPU_GPR(R21)(r4) 129 PPC_STL r21, VCPU_GPR(R21)(r4)
154 rlwimi r8, r6, EPC_EPR_SHIFT - MSR_PR_LG, EPC_EPR
155 PPC_STL r22, VCPU_GPR(R22)(r4) 130 PPC_STL r22, VCPU_GPR(R22)(r4)
156 rlwimi r8, r10, EPC_EPID_SHIFT, EPC_EPID
157 PPC_STL r23, VCPU_GPR(R23)(r4) 131 PPC_STL r23, VCPU_GPR(R23)(r4)
158 PPC_STL r24, VCPU_GPR(R24)(r4) 132 PPC_STL r24, VCPU_GPR(R24)(r4)
159 PPC_STL r25, VCPU_GPR(R25)(r4) 133 PPC_STL r25, VCPU_GPR(R25)(r4)
@@ -163,33 +137,15 @@
163 PPC_STL r29, VCPU_GPR(R29)(r4) 137 PPC_STL r29, VCPU_GPR(R29)(r4)
164 PPC_STL r30, VCPU_GPR(R30)(r4) 138 PPC_STL r30, VCPU_GPR(R30)(r4)
165 PPC_STL r31, VCPU_GPR(R31)(r4) 139 PPC_STL r31, VCPU_GPR(R31)(r4)
166 mtspr SPRN_EPLC, r8
167
168 /* disable preemption, so we are sure we hit the fixup handler */
169 CURRENT_THREAD_INFO(r8, r1)
170 li r7, 1
171 stw r7, TI_PREEMPT(r8)
172
173 isync
174 140
175 /* 141 /*
176 * In case the read goes wrong, we catch it and write an invalid value 142 * We don't use external PID support. lwepx faults would need to be
177 * in LAST_INST instead. 143 * handled by KVM and this implies aditional code in DO_KVM (for
144 * DTB_MISS, DSI and LRAT) to check ESR[EPID] and EPLC[EGS] which
145 * is too intrusive for the host. Get last instuction in
146 * kvmppc_get_last_inst().
178 */ 147 */
1791: lwepx r9, 0, r5 148 li r9, KVM_INST_FETCH_FAILED
1802:
181.section .fixup, "ax"
1823: li r9, KVM_INST_FETCH_FAILED
183 b 2b
184.previous
185.section __ex_table,"a"
186 PPC_LONG_ALIGN
187 PPC_LONG 1b,3b
188.previous
189
190 mtspr SPRN_EPLC, r3
191 li r7, 0
192 stw r7, TI_PREEMPT(r8)
193 stw r9, VCPU_LAST_INST(r4) 149 stw r9, VCPU_LAST_INST(r4)
194 .endif 150 .endif
195 151
@@ -441,6 +397,7 @@ _GLOBAL(kvmppc_resume_host)
441#ifdef CONFIG_64BIT 397#ifdef CONFIG_64BIT
442 PPC_LL r3, PACA_SPRG_VDSO(r13) 398 PPC_LL r3, PACA_SPRG_VDSO(r13)
443#endif 399#endif
400 mfspr r5, SPRN_SPRG9
444 PPC_STD(r6, VCPU_SHARED_SPRG4, r11) 401 PPC_STD(r6, VCPU_SHARED_SPRG4, r11)
445 mfspr r8, SPRN_SPRG6 402 mfspr r8, SPRN_SPRG6
446 PPC_STD(r7, VCPU_SHARED_SPRG5, r11) 403 PPC_STD(r7, VCPU_SHARED_SPRG5, r11)
@@ -448,6 +405,7 @@ _GLOBAL(kvmppc_resume_host)
448#ifdef CONFIG_64BIT 405#ifdef CONFIG_64BIT
449 mtspr SPRN_SPRG_VDSO_WRITE, r3 406 mtspr SPRN_SPRG_VDSO_WRITE, r3
450#endif 407#endif
408 PPC_STD(r5, VCPU_SPRG9, r4)
451 PPC_STD(r8, VCPU_SHARED_SPRG6, r11) 409 PPC_STD(r8, VCPU_SHARED_SPRG6, r11)
452 mfxer r3 410 mfxer r3
453 PPC_STD(r9, VCPU_SHARED_SPRG7, r11) 411 PPC_STD(r9, VCPU_SHARED_SPRG7, r11)
@@ -682,7 +640,9 @@ lightweight_exit:
682 mtspr SPRN_SPRG5W, r6 640 mtspr SPRN_SPRG5W, r6
683 PPC_LD(r8, VCPU_SHARED_SPRG7, r11) 641 PPC_LD(r8, VCPU_SHARED_SPRG7, r11)
684 mtspr SPRN_SPRG6W, r7 642 mtspr SPRN_SPRG6W, r7
643 PPC_LD(r5, VCPU_SPRG9, r4)
685 mtspr SPRN_SPRG7W, r8 644 mtspr SPRN_SPRG7W, r8
645 mtspr SPRN_SPRG9, r5
686 646
687 /* Load some guest volatiles. */ 647 /* Load some guest volatiles. */
688 PPC_LL r3, VCPU_LR(r4) 648 PPC_LL r3, VCPU_LR(r4)
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index 002d51764143..c99c40e9182a 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -250,6 +250,14 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
250 spr_val); 250 spr_val);
251 break; 251 break;
252 252
253 case SPRN_PWRMGTCR0:
254 /*
255 * Guest relies on host power management configurations
256 * Treat the request as a general store
257 */
258 vcpu->arch.pwrmgtcr0 = spr_val;
259 break;
260
253 /* extra exceptions */ 261 /* extra exceptions */
254 case SPRN_IVOR32: 262 case SPRN_IVOR32:
255 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val; 263 vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
@@ -368,6 +376,10 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
368 *spr_val = vcpu->arch.eptcfg; 376 *spr_val = vcpu->arch.eptcfg;
369 break; 377 break;
370 378
379 case SPRN_PWRMGTCR0:
380 *spr_val = vcpu->arch.pwrmgtcr0;
381 break;
382
371 /* extra exceptions */ 383 /* extra exceptions */
372 case SPRN_IVOR32: 384 case SPRN_IVOR32:
373 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL]; 385 *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 86903d3f5a03..08f14bb57897 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -107,11 +107,15 @@ static u32 get_host_mas0(unsigned long eaddr)
107{ 107{
108 unsigned long flags; 108 unsigned long flags;
109 u32 mas0; 109 u32 mas0;
110 u32 mas4;
110 111
111 local_irq_save(flags); 112 local_irq_save(flags);
112 mtspr(SPRN_MAS6, 0); 113 mtspr(SPRN_MAS6, 0);
114 mas4 = mfspr(SPRN_MAS4);
115 mtspr(SPRN_MAS4, mas4 & ~MAS4_TLBSEL_MASK);
113 asm volatile("tlbsx 0, %0" : : "b" (eaddr & ~CONFIG_PAGE_OFFSET)); 116 asm volatile("tlbsx 0, %0" : : "b" (eaddr & ~CONFIG_PAGE_OFFSET));
114 mas0 = mfspr(SPRN_MAS0); 117 mas0 = mfspr(SPRN_MAS0);
118 mtspr(SPRN_MAS4, mas4);
115 local_irq_restore(flags); 119 local_irq_restore(flags);
116 120
117 return mas0; 121 return mas0;
@@ -607,6 +611,104 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr,
607 } 611 }
608} 612}
609 613
614#ifdef CONFIG_KVM_BOOKE_HV
615int kvmppc_load_last_inst(struct kvm_vcpu *vcpu, enum instruction_type type,
616 u32 *instr)
617{
618 gva_t geaddr;
619 hpa_t addr;
620 hfn_t pfn;
621 hva_t eaddr;
622 u32 mas1, mas2, mas3;
623 u64 mas7_mas3;
624 struct page *page;
625 unsigned int addr_space, psize_shift;
626 bool pr;
627 unsigned long flags;
628
629 /* Search TLB for guest pc to get the real address */
630 geaddr = kvmppc_get_pc(vcpu);
631
632 addr_space = (vcpu->arch.shared->msr & MSR_IS) >> MSR_IR_LG;
633
634 local_irq_save(flags);
635 mtspr(SPRN_MAS6, (vcpu->arch.pid << MAS6_SPID_SHIFT) | addr_space);
636 mtspr(SPRN_MAS5, MAS5_SGS | vcpu->kvm->arch.lpid);
637 asm volatile("tlbsx 0, %[geaddr]\n" : :
638 [geaddr] "r" (geaddr));
639 mtspr(SPRN_MAS5, 0);
640 mtspr(SPRN_MAS8, 0);
641 mas1 = mfspr(SPRN_MAS1);
642 mas2 = mfspr(SPRN_MAS2);
643 mas3 = mfspr(SPRN_MAS3);
644#ifdef CONFIG_64BIT
645 mas7_mas3 = mfspr(SPRN_MAS7_MAS3);
646#else
647 mas7_mas3 = ((u64)mfspr(SPRN_MAS7) << 32) | mas3;
648#endif
649 local_irq_restore(flags);
650
651 /*
652 * If the TLB entry for guest pc was evicted, return to the guest.
653 * There are high chances to find a valid TLB entry next time.
654 */
655 if (!(mas1 & MAS1_VALID))
656 return EMULATE_AGAIN;
657
658 /*
659 * Another thread may rewrite the TLB entry in parallel, don't
660 * execute from the address if the execute permission is not set
661 */
662 pr = vcpu->arch.shared->msr & MSR_PR;
663 if (unlikely((pr && !(mas3 & MAS3_UX)) ||
664 (!pr && !(mas3 & MAS3_SX)))) {
665 pr_err_ratelimited(
666 "%s: Instuction emulation from guest addres %08lx without execute permission\n",
667 __func__, geaddr);
668 return EMULATE_AGAIN;
669 }
670
671 /*
672 * The real address will be mapped by a cacheable, memory coherent,
673 * write-back page. Check for mismatches when LRAT is used.
674 */
675 if (has_feature(vcpu, VCPU_FTR_MMU_V2) &&
676 unlikely((mas2 & MAS2_I) || (mas2 & MAS2_W) || !(mas2 & MAS2_M))) {
677 pr_err_ratelimited(
678 "%s: Instuction emulation from guest addres %08lx mismatches storage attributes\n",
679 __func__, geaddr);
680 return EMULATE_AGAIN;
681 }
682
683 /* Get pfn */
684 psize_shift = MAS1_GET_TSIZE(mas1) + 10;
685 addr = (mas7_mas3 & (~0ULL << psize_shift)) |
686 (geaddr & ((1ULL << psize_shift) - 1ULL));
687 pfn = addr >> PAGE_SHIFT;
688
689 /* Guard against emulation from devices area */
690 if (unlikely(!page_is_ram(pfn))) {
691 pr_err_ratelimited("%s: Instruction emulation from non-RAM host addres %08llx is not supported\n",
692 __func__, addr);
693 return EMULATE_AGAIN;
694 }
695
696 /* Map a page and get guest's instruction */
697 page = pfn_to_page(pfn);
698 eaddr = (unsigned long)kmap_atomic(page);
699 *instr = *(u32 *)(eaddr | (unsigned long)(addr & ~PAGE_MASK));
700 kunmap_atomic((u32 *)eaddr);
701
702 return EMULATE_DONE;
703}
704#else
705int kvmppc_load_last_inst(struct kvm_vcpu *vcpu, enum instruction_type type,
706 u32 *instr)
707{
708 return EMULATE_AGAIN;
709}
710#endif
711
610/************* MMU Notifiers *************/ 712/************* MMU Notifiers *************/
611 713
612int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) 714int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 17e456279224..164bad2a19bf 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -110,7 +110,7 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
110{ 110{
111} 111}
112 112
113static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu); 113static DEFINE_PER_CPU(struct kvm_vcpu *[KVMPPC_NR_LPIDS], last_vcpu_of_lpid);
114 114
115static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu) 115static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
116{ 116{
@@ -141,9 +141,9 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
141 mtspr(SPRN_GESR, vcpu->arch.shared->esr); 141 mtspr(SPRN_GESR, vcpu->arch.shared->esr);
142 142
143 if (vcpu->arch.oldpir != mfspr(SPRN_PIR) || 143 if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
144 __get_cpu_var(last_vcpu_on_cpu) != vcpu) { 144 __get_cpu_var(last_vcpu_of_lpid)[vcpu->kvm->arch.lpid] != vcpu) {
145 kvmppc_e500_tlbil_all(vcpu_e500); 145 kvmppc_e500_tlbil_all(vcpu_e500);
146 __get_cpu_var(last_vcpu_on_cpu) = vcpu; 146 __get_cpu_var(last_vcpu_of_lpid)[vcpu->kvm->arch.lpid] = vcpu;
147 } 147 }
148 148
149 kvmppc_load_guest_fp(vcpu); 149 kvmppc_load_guest_fp(vcpu);
@@ -267,14 +267,32 @@ static int kvmppc_core_set_sregs_e500mc(struct kvm_vcpu *vcpu,
267static int kvmppc_get_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id, 267static int kvmppc_get_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
268 union kvmppc_one_reg *val) 268 union kvmppc_one_reg *val)
269{ 269{
270 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); 270 int r = 0;
271
272 switch (id) {
273 case KVM_REG_PPC_SPRG9:
274 *val = get_reg_val(id, vcpu->arch.sprg9);
275 break;
276 default:
277 r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
278 }
279
271 return r; 280 return r;
272} 281}
273 282
274static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id, 283static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
275 union kvmppc_one_reg *val) 284 union kvmppc_one_reg *val)
276{ 285{
277 int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val); 286 int r = 0;
287
288 switch (id) {
289 case KVM_REG_PPC_SPRG9:
290 vcpu->arch.sprg9 = set_reg_val(id, *val);
291 break;
292 default:
293 r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val);
294 }
295
278 return r; 296 return r;
279} 297}
280 298
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index da86d9ba3476..e96b50d0bdab 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -207,36 +207,28 @@ static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
207 return emulated; 207 return emulated;
208} 208}
209 209
210/* XXX to do:
211 * lhax
212 * lhaux
213 * lswx
214 * lswi
215 * stswx
216 * stswi
217 * lha
218 * lhau
219 * lmw
220 * stmw
221 *
222 */
223/* XXX Should probably auto-generate instruction decoding for a particular core 210/* XXX Should probably auto-generate instruction decoding for a particular core
224 * from opcode tables in the future. */ 211 * from opcode tables in the future. */
225int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) 212int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
226{ 213{
227 u32 inst = kvmppc_get_last_inst(vcpu); 214 u32 inst;
228 int ra = get_ra(inst); 215 int rs, rt, sprn;
229 int rs = get_rs(inst); 216 enum emulation_result emulated;
230 int rt = get_rt(inst);
231 int sprn = get_sprn(inst);
232 enum emulation_result emulated = EMULATE_DONE;
233 int advance = 1; 217 int advance = 1;
234 218
235 /* this default type might be overwritten by subcategories */ 219 /* this default type might be overwritten by subcategories */
236 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); 220 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
237 221
222 emulated = kvmppc_get_last_inst(vcpu, false, &inst);
223 if (emulated != EMULATE_DONE)
224 return emulated;
225
238 pr_debug("Emulating opcode %d / %d\n", get_op(inst), get_xop(inst)); 226 pr_debug("Emulating opcode %d / %d\n", get_op(inst), get_xop(inst));
239 227
228 rs = get_rs(inst);
229 rt = get_rt(inst);
230 sprn = get_sprn(inst);
231
240 switch (get_op(inst)) { 232 switch (get_op(inst)) {
241 case OP_TRAP: 233 case OP_TRAP:
242#ifdef CONFIG_PPC_BOOK3S 234#ifdef CONFIG_PPC_BOOK3S
@@ -264,200 +256,24 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
264#endif 256#endif
265 advance = 0; 257 advance = 0;
266 break; 258 break;
267 case OP_31_XOP_LWZX:
268 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
269 break;
270
271 case OP_31_XOP_LBZX:
272 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
273 break;
274
275 case OP_31_XOP_LBZUX:
276 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
277 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
278 break;
279
280 case OP_31_XOP_STWX:
281 emulated = kvmppc_handle_store(run, vcpu,
282 kvmppc_get_gpr(vcpu, rs),
283 4, 1);
284 break;
285
286 case OP_31_XOP_STBX:
287 emulated = kvmppc_handle_store(run, vcpu,
288 kvmppc_get_gpr(vcpu, rs),
289 1, 1);
290 break;
291
292 case OP_31_XOP_STBUX:
293 emulated = kvmppc_handle_store(run, vcpu,
294 kvmppc_get_gpr(vcpu, rs),
295 1, 1);
296 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
297 break;
298
299 case OP_31_XOP_LHAX:
300 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
301 break;
302
303 case OP_31_XOP_LHZX:
304 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
305 break;
306
307 case OP_31_XOP_LHZUX:
308 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
309 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
310 break;
311 259
312 case OP_31_XOP_MFSPR: 260 case OP_31_XOP_MFSPR:
313 emulated = kvmppc_emulate_mfspr(vcpu, sprn, rt); 261 emulated = kvmppc_emulate_mfspr(vcpu, sprn, rt);
314 break; 262 break;
315 263
316 case OP_31_XOP_STHX:
317 emulated = kvmppc_handle_store(run, vcpu,
318 kvmppc_get_gpr(vcpu, rs),
319 2, 1);
320 break;
321
322 case OP_31_XOP_STHUX:
323 emulated = kvmppc_handle_store(run, vcpu,
324 kvmppc_get_gpr(vcpu, rs),
325 2, 1);
326 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
327 break;
328
329 case OP_31_XOP_MTSPR: 264 case OP_31_XOP_MTSPR:
330 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs); 265 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs);
331 break; 266 break;
332 267
333 case OP_31_XOP_DCBST:
334 case OP_31_XOP_DCBF:
335 case OP_31_XOP_DCBI:
336 /* Do nothing. The guest is performing dcbi because
337 * hardware DMA is not snooped by the dcache, but
338 * emulated DMA either goes through the dcache as
339 * normal writes, or the host kernel has handled dcache
340 * coherence. */
341 break;
342
343 case OP_31_XOP_LWBRX:
344 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 0);
345 break;
346
347 case OP_31_XOP_TLBSYNC: 268 case OP_31_XOP_TLBSYNC:
348 break; 269 break;
349 270
350 case OP_31_XOP_STWBRX:
351 emulated = kvmppc_handle_store(run, vcpu,
352 kvmppc_get_gpr(vcpu, rs),
353 4, 0);
354 break;
355
356 case OP_31_XOP_LHBRX:
357 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 0);
358 break;
359
360 case OP_31_XOP_STHBRX:
361 emulated = kvmppc_handle_store(run, vcpu,
362 kvmppc_get_gpr(vcpu, rs),
363 2, 0);
364 break;
365
366 default: 271 default:
367 /* Attempt core-specific emulation below. */ 272 /* Attempt core-specific emulation below. */
368 emulated = EMULATE_FAIL; 273 emulated = EMULATE_FAIL;
369 } 274 }
370 break; 275 break;
371 276
372 case OP_LWZ:
373 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
374 break;
375
376 /* TBD: Add support for other 64 bit load variants like ldu, ldux, ldx etc. */
377 case OP_LD:
378 rt = get_rt(inst);
379 emulated = kvmppc_handle_load(run, vcpu, rt, 8, 1);
380 break;
381
382 case OP_LWZU:
383 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
384 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
385 break;
386
387 case OP_LBZ:
388 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
389 break;
390
391 case OP_LBZU:
392 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
393 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
394 break;
395
396 case OP_STW:
397 emulated = kvmppc_handle_store(run, vcpu,
398 kvmppc_get_gpr(vcpu, rs),
399 4, 1);
400 break;
401
402 /* TBD: Add support for other 64 bit store variants like stdu, stdux, stdx etc. */
403 case OP_STD:
404 rs = get_rs(inst);
405 emulated = kvmppc_handle_store(run, vcpu,
406 kvmppc_get_gpr(vcpu, rs),
407 8, 1);
408 break;
409
410 case OP_STWU:
411 emulated = kvmppc_handle_store(run, vcpu,
412 kvmppc_get_gpr(vcpu, rs),
413 4, 1);
414 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
415 break;
416
417 case OP_STB:
418 emulated = kvmppc_handle_store(run, vcpu,
419 kvmppc_get_gpr(vcpu, rs),
420 1, 1);
421 break;
422
423 case OP_STBU:
424 emulated = kvmppc_handle_store(run, vcpu,
425 kvmppc_get_gpr(vcpu, rs),
426 1, 1);
427 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
428 break;
429
430 case OP_LHZ:
431 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
432 break;
433
434 case OP_LHZU:
435 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
436 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
437 break;
438
439 case OP_LHA:
440 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
441 break;
442
443 case OP_LHAU:
444 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
445 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
446 break;
447
448 case OP_STH:
449 emulated = kvmppc_handle_store(run, vcpu,
450 kvmppc_get_gpr(vcpu, rs),
451 2, 1);
452 break;
453
454 case OP_STHU:
455 emulated = kvmppc_handle_store(run, vcpu,
456 kvmppc_get_gpr(vcpu, rs),
457 2, 1);
458 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
459 break;
460
461 default: 277 default:
462 emulated = EMULATE_FAIL; 278 emulated = EMULATE_FAIL;
463 } 279 }
diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
new file mode 100644
index 000000000000..0de4ffa175a9
--- /dev/null
+++ b/arch/powerpc/kvm/emulate_loadstore.c
@@ -0,0 +1,272 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright IBM Corp. 2007
16 * Copyright 2011 Freescale Semiconductor, Inc.
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 */
20
21#include <linux/jiffies.h>
22#include <linux/hrtimer.h>
23#include <linux/types.h>
24#include <linux/string.h>
25#include <linux/kvm_host.h>
26#include <linux/clockchips.h>
27
28#include <asm/reg.h>
29#include <asm/time.h>
30#include <asm/byteorder.h>
31#include <asm/kvm_ppc.h>
32#include <asm/disassemble.h>
33#include <asm/ppc-opcode.h>
34#include "timing.h"
35#include "trace.h"
36
37/* XXX to do:
38 * lhax
39 * lhaux
40 * lswx
41 * lswi
42 * stswx
43 * stswi
44 * lha
45 * lhau
46 * lmw
47 * stmw
48 *
49 */
50int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
51{
52 struct kvm_run *run = vcpu->run;
53 u32 inst;
54 int ra, rs, rt;
55 enum emulation_result emulated;
56 int advance = 1;
57
58 /* this default type might be overwritten by subcategories */
59 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
60
61 emulated = kvmppc_get_last_inst(vcpu, false, &inst);
62 if (emulated != EMULATE_DONE)
63 return emulated;
64
65 ra = get_ra(inst);
66 rs = get_rs(inst);
67 rt = get_rt(inst);
68
69 switch (get_op(inst)) {
70 case 31:
71 switch (get_xop(inst)) {
72 case OP_31_XOP_LWZX:
73 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
74 break;
75
76 case OP_31_XOP_LBZX:
77 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
78 break;
79
80 case OP_31_XOP_LBZUX:
81 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
82 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
83 break;
84
85 case OP_31_XOP_STWX:
86 emulated = kvmppc_handle_store(run, vcpu,
87 kvmppc_get_gpr(vcpu, rs),
88 4, 1);
89 break;
90
91 case OP_31_XOP_STBX:
92 emulated = kvmppc_handle_store(run, vcpu,
93 kvmppc_get_gpr(vcpu, rs),
94 1, 1);
95 break;
96
97 case OP_31_XOP_STBUX:
98 emulated = kvmppc_handle_store(run, vcpu,
99 kvmppc_get_gpr(vcpu, rs),
100 1, 1);
101 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
102 break;
103
104 case OP_31_XOP_LHAX:
105 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
106 break;
107
108 case OP_31_XOP_LHZX:
109 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
110 break;
111
112 case OP_31_XOP_LHZUX:
113 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
114 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
115 break;
116
117 case OP_31_XOP_STHX:
118 emulated = kvmppc_handle_store(run, vcpu,
119 kvmppc_get_gpr(vcpu, rs),
120 2, 1);
121 break;
122
123 case OP_31_XOP_STHUX:
124 emulated = kvmppc_handle_store(run, vcpu,
125 kvmppc_get_gpr(vcpu, rs),
126 2, 1);
127 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
128 break;
129
130 case OP_31_XOP_DCBST:
131 case OP_31_XOP_DCBF:
132 case OP_31_XOP_DCBI:
133 /* Do nothing. The guest is performing dcbi because
134 * hardware DMA is not snooped by the dcache, but
135 * emulated DMA either goes through the dcache as
136 * normal writes, or the host kernel has handled dcache
137 * coherence. */
138 break;
139
140 case OP_31_XOP_LWBRX:
141 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 0);
142 break;
143
144 case OP_31_XOP_STWBRX:
145 emulated = kvmppc_handle_store(run, vcpu,
146 kvmppc_get_gpr(vcpu, rs),
147 4, 0);
148 break;
149
150 case OP_31_XOP_LHBRX:
151 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 0);
152 break;
153
154 case OP_31_XOP_STHBRX:
155 emulated = kvmppc_handle_store(run, vcpu,
156 kvmppc_get_gpr(vcpu, rs),
157 2, 0);
158 break;
159
160 default:
161 emulated = EMULATE_FAIL;
162 break;
163 }
164 break;
165
166 case OP_LWZ:
167 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
168 break;
169
170 /* TBD: Add support for other 64 bit load variants like ldu, ldux, ldx etc. */
171 case OP_LD:
172 rt = get_rt(inst);
173 emulated = kvmppc_handle_load(run, vcpu, rt, 8, 1);
174 break;
175
176 case OP_LWZU:
177 emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1);
178 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
179 break;
180
181 case OP_LBZ:
182 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
183 break;
184
185 case OP_LBZU:
186 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
187 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
188 break;
189
190 case OP_STW:
191 emulated = kvmppc_handle_store(run, vcpu,
192 kvmppc_get_gpr(vcpu, rs),
193 4, 1);
194 break;
195
196 /* TBD: Add support for other 64 bit store variants like stdu, stdux, stdx etc. */
197 case OP_STD:
198 rs = get_rs(inst);
199 emulated = kvmppc_handle_store(run, vcpu,
200 kvmppc_get_gpr(vcpu, rs),
201 8, 1);
202 break;
203
204 case OP_STWU:
205 emulated = kvmppc_handle_store(run, vcpu,
206 kvmppc_get_gpr(vcpu, rs),
207 4, 1);
208 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
209 break;
210
211 case OP_STB:
212 emulated = kvmppc_handle_store(run, vcpu,
213 kvmppc_get_gpr(vcpu, rs),
214 1, 1);
215 break;
216
217 case OP_STBU:
218 emulated = kvmppc_handle_store(run, vcpu,
219 kvmppc_get_gpr(vcpu, rs),
220 1, 1);
221 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
222 break;
223
224 case OP_LHZ:
225 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
226 break;
227
228 case OP_LHZU:
229 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);
230 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
231 break;
232
233 case OP_LHA:
234 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
235 break;
236
237 case OP_LHAU:
238 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
239 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
240 break;
241
242 case OP_STH:
243 emulated = kvmppc_handle_store(run, vcpu,
244 kvmppc_get_gpr(vcpu, rs),
245 2, 1);
246 break;
247
248 case OP_STHU:
249 emulated = kvmppc_handle_store(run, vcpu,
250 kvmppc_get_gpr(vcpu, rs),
251 2, 1);
252 kvmppc_set_gpr(vcpu, ra, vcpu->arch.vaddr_accessed);
253 break;
254
255 default:
256 emulated = EMULATE_FAIL;
257 break;
258 }
259
260 if (emulated == EMULATE_FAIL) {
261 advance = 0;
262 kvmppc_core_queue_program(vcpu, 0);
263 }
264
265 trace_kvm_ppc_instr(inst, kvmppc_get_pc(vcpu), emulated);
266
267 /* Advance past emulated instruction. */
268 if (advance)
269 kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) + 4);
270
271 return emulated;
272}
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index b68d0dc9479a..39b3a8f816f2 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -1826,8 +1826,7 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
1826 return 0; 1826 return 0;
1827} 1827}
1828 1828
1829int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 1829int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
1830 struct kvm_kernel_irq_routing_entry *e,
1831 const struct kvm_irq_routing_entry *ue) 1830 const struct kvm_irq_routing_entry *ue)
1832{ 1831{
1833 int r = -EINVAL; 1832 int r = -EINVAL;
@@ -1839,7 +1838,6 @@ int kvm_set_routing_entry(struct kvm_irq_routing_table *rt,
1839 e->irqchip.pin = ue->u.irqchip.pin; 1838 e->irqchip.pin = ue->u.irqchip.pin;
1840 if (e->irqchip.pin >= KVM_IRQCHIP_NUM_PINS) 1839 if (e->irqchip.pin >= KVM_IRQCHIP_NUM_PINS)
1841 goto out; 1840 goto out;
1842 rt->chip[ue->u.irqchip.irqchip][e->irqchip.pin] = ue->gsi;
1843 break; 1841 break;
1844 case KVM_IRQ_ROUTING_MSI: 1842 case KVM_IRQ_ROUTING_MSI:
1845 e->set = kvm_set_msi; 1843 e->set = kvm_set_msi;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 61c738ab1283..4c79284b58be 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -190,6 +190,25 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
190 vcpu->arch.magic_page_pa = param1 & ~0xfffULL; 190 vcpu->arch.magic_page_pa = param1 & ~0xfffULL;
191 vcpu->arch.magic_page_ea = param2 & ~0xfffULL; 191 vcpu->arch.magic_page_ea = param2 & ~0xfffULL;
192 192
193#ifdef CONFIG_PPC_64K_PAGES
194 /*
195 * Make sure our 4k magic page is in the same window of a 64k
196 * page within the guest and within the host's page.
197 */
198 if ((vcpu->arch.magic_page_pa & 0xf000) !=
199 ((ulong)vcpu->arch.shared & 0xf000)) {
200 void *old_shared = vcpu->arch.shared;
201 ulong shared = (ulong)vcpu->arch.shared;
202 void *new_shared;
203
204 shared &= PAGE_MASK;
205 shared |= vcpu->arch.magic_page_pa & 0xf000;
206 new_shared = (void*)shared;
207 memcpy(new_shared, old_shared, 0x1000);
208 vcpu->arch.shared = new_shared;
209 }
210#endif
211
193 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7; 212 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
194 213
195 r = EV_SUCCESS; 214 r = EV_SUCCESS;
@@ -198,7 +217,6 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
198 case KVM_HCALL_TOKEN(KVM_HC_FEATURES): 217 case KVM_HCALL_TOKEN(KVM_HC_FEATURES):
199 r = EV_SUCCESS; 218 r = EV_SUCCESS;
200#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2) 219#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2)
201 /* XXX Missing magic page on 44x */
202 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE); 220 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
203#endif 221#endif
204 222
@@ -254,13 +272,16 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
254 enum emulation_result er; 272 enum emulation_result er;
255 int r; 273 int r;
256 274
257 er = kvmppc_emulate_instruction(run, vcpu); 275 er = kvmppc_emulate_loadstore(vcpu);
258 switch (er) { 276 switch (er) {
259 case EMULATE_DONE: 277 case EMULATE_DONE:
260 /* Future optimization: only reload non-volatiles if they were 278 /* Future optimization: only reload non-volatiles if they were
261 * actually modified. */ 279 * actually modified. */
262 r = RESUME_GUEST_NV; 280 r = RESUME_GUEST_NV;
263 break; 281 break;
282 case EMULATE_AGAIN:
283 r = RESUME_GUEST;
284 break;
264 case EMULATE_DO_MMIO: 285 case EMULATE_DO_MMIO:
265 run->exit_reason = KVM_EXIT_MMIO; 286 run->exit_reason = KVM_EXIT_MMIO;
266 /* We must reload nonvolatiles because "update" load/store 287 /* We must reload nonvolatiles because "update" load/store
@@ -270,11 +291,15 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
270 r = RESUME_HOST_NV; 291 r = RESUME_HOST_NV;
271 break; 292 break;
272 case EMULATE_FAIL: 293 case EMULATE_FAIL:
294 {
295 u32 last_inst;
296
297 kvmppc_get_last_inst(vcpu, false, &last_inst);
273 /* XXX Deliver Program interrupt to guest. */ 298 /* XXX Deliver Program interrupt to guest. */
274 printk(KERN_EMERG "%s: emulation failed (%08x)\n", __func__, 299 pr_emerg("%s: emulation failed (%08x)\n", __func__, last_inst);
275 kvmppc_get_last_inst(vcpu));
276 r = RESUME_HOST; 300 r = RESUME_HOST;
277 break; 301 break;
302 }
278 default: 303 default:
279 WARN_ON(1); 304 WARN_ON(1);
280 r = RESUME_GUEST; 305 r = RESUME_GUEST;
@@ -284,6 +309,81 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
284} 309}
285EXPORT_SYMBOL_GPL(kvmppc_emulate_mmio); 310EXPORT_SYMBOL_GPL(kvmppc_emulate_mmio);
286 311
312int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
313 bool data)
314{
315 ulong mp_pa = vcpu->arch.magic_page_pa & KVM_PAM & PAGE_MASK;
316 struct kvmppc_pte pte;
317 int r;
318
319 vcpu->stat.st++;
320
321 r = kvmppc_xlate(vcpu, *eaddr, data ? XLATE_DATA : XLATE_INST,
322 XLATE_WRITE, &pte);
323 if (r < 0)
324 return r;
325
326 *eaddr = pte.raddr;
327
328 if (!pte.may_write)
329 return -EPERM;
330
331 /* Magic page override */
332 if (kvmppc_supports_magic_page(vcpu) && mp_pa &&
333 ((pte.raddr & KVM_PAM & PAGE_MASK) == mp_pa) &&
334 !(kvmppc_get_msr(vcpu) & MSR_PR)) {
335 void *magic = vcpu->arch.shared;
336 magic += pte.eaddr & 0xfff;
337 memcpy(magic, ptr, size);
338 return EMULATE_DONE;
339 }
340
341 if (kvm_write_guest(vcpu->kvm, pte.raddr, ptr, size))
342 return EMULATE_DO_MMIO;
343
344 return EMULATE_DONE;
345}
346EXPORT_SYMBOL_GPL(kvmppc_st);
347
348int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
349 bool data)
350{
351 ulong mp_pa = vcpu->arch.magic_page_pa & KVM_PAM & PAGE_MASK;
352 struct kvmppc_pte pte;
353 int rc;
354
355 vcpu->stat.ld++;
356
357 rc = kvmppc_xlate(vcpu, *eaddr, data ? XLATE_DATA : XLATE_INST,
358 XLATE_READ, &pte);
359 if (rc)
360 return rc;
361
362 *eaddr = pte.raddr;
363
364 if (!pte.may_read)
365 return -EPERM;
366
367 if (!data && !pte.may_execute)
368 return -ENOEXEC;
369
370 /* Magic page override */
371 if (kvmppc_supports_magic_page(vcpu) && mp_pa &&
372 ((pte.raddr & KVM_PAM & PAGE_MASK) == mp_pa) &&
373 !(kvmppc_get_msr(vcpu) & MSR_PR)) {
374 void *magic = vcpu->arch.shared;
375 magic += pte.eaddr & 0xfff;
376 memcpy(ptr, magic, size);
377 return EMULATE_DONE;
378 }
379
380 if (kvm_read_guest(vcpu->kvm, pte.raddr, ptr, size))
381 return EMULATE_DO_MMIO;
382
383 return EMULATE_DONE;
384}
385EXPORT_SYMBOL_GPL(kvmppc_ld);
386
287int kvm_arch_hardware_enable(void *garbage) 387int kvm_arch_hardware_enable(void *garbage)
288{ 388{
289 return 0; 389 return 0;
@@ -366,14 +466,20 @@ void kvm_arch_sync_events(struct kvm *kvm)
366{ 466{
367} 467}
368 468
369int kvm_dev_ioctl_check_extension(long ext) 469int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
370{ 470{
371 int r; 471 int r;
372 /* FIXME!! 472 /* Assume we're using HV mode when the HV module is loaded */
373 * Should some of this be vm ioctl ? is it possible now ?
374 */
375 int hv_enabled = kvmppc_hv_ops ? 1 : 0; 473 int hv_enabled = kvmppc_hv_ops ? 1 : 0;
376 474
475 if (kvm) {
476 /*
477 * Hooray - we know which VM type we're running on. Depend on
478 * that rather than the guess above.
479 */
480 hv_enabled = is_kvmppc_hv_enabled(kvm);
481 }
482
377 switch (ext) { 483 switch (ext) {
378#ifdef CONFIG_BOOKE 484#ifdef CONFIG_BOOKE
379 case KVM_CAP_PPC_BOOKE_SREGS: 485 case KVM_CAP_PPC_BOOKE_SREGS:
@@ -387,6 +493,7 @@ int kvm_dev_ioctl_check_extension(long ext)
387 case KVM_CAP_PPC_UNSET_IRQ: 493 case KVM_CAP_PPC_UNSET_IRQ:
388 case KVM_CAP_PPC_IRQ_LEVEL: 494 case KVM_CAP_PPC_IRQ_LEVEL:
389 case KVM_CAP_ENABLE_CAP: 495 case KVM_CAP_ENABLE_CAP:
496 case KVM_CAP_ENABLE_CAP_VM:
390 case KVM_CAP_ONE_REG: 497 case KVM_CAP_ONE_REG:
391 case KVM_CAP_IOEVENTFD: 498 case KVM_CAP_IOEVENTFD:
392 case KVM_CAP_DEVICE_CTRL: 499 case KVM_CAP_DEVICE_CTRL:
@@ -417,6 +524,7 @@ int kvm_dev_ioctl_check_extension(long ext)
417 case KVM_CAP_PPC_ALLOC_HTAB: 524 case KVM_CAP_PPC_ALLOC_HTAB:
418 case KVM_CAP_PPC_RTAS: 525 case KVM_CAP_PPC_RTAS:
419 case KVM_CAP_PPC_FIXUP_HCALL: 526 case KVM_CAP_PPC_FIXUP_HCALL:
527 case KVM_CAP_PPC_ENABLE_HCALL:
420#ifdef CONFIG_KVM_XICS 528#ifdef CONFIG_KVM_XICS
421 case KVM_CAP_IRQ_XICS: 529 case KVM_CAP_IRQ_XICS:
422#endif 530#endif
@@ -635,12 +743,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
635#endif 743#endif
636} 744}
637 745
638static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
639 struct kvm_run *run)
640{
641 kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, run->dcr.data);
642}
643
644static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu, 746static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
645 struct kvm_run *run) 747 struct kvm_run *run)
646{ 748{
@@ -837,10 +939,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
837 if (!vcpu->mmio_is_write) 939 if (!vcpu->mmio_is_write)
838 kvmppc_complete_mmio_load(vcpu, run); 940 kvmppc_complete_mmio_load(vcpu, run);
839 vcpu->mmio_needed = 0; 941 vcpu->mmio_needed = 0;
840 } else if (vcpu->arch.dcr_needed) {
841 if (!vcpu->arch.dcr_is_write)
842 kvmppc_complete_dcr_load(vcpu, run);
843 vcpu->arch.dcr_needed = 0;
844 } else if (vcpu->arch.osi_needed) { 942 } else if (vcpu->arch.osi_needed) {
845 u64 *gprs = run->osi.gprs; 943 u64 *gprs = run->osi.gprs;
846 int i; 944 int i;
@@ -1099,6 +1197,42 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event,
1099 return 0; 1197 return 0;
1100} 1198}
1101 1199
1200
1201static int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
1202 struct kvm_enable_cap *cap)
1203{
1204 int r;
1205
1206 if (cap->flags)
1207 return -EINVAL;
1208
1209 switch (cap->cap) {
1210#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
1211 case KVM_CAP_PPC_ENABLE_HCALL: {
1212 unsigned long hcall = cap->args[0];
1213
1214 r = -EINVAL;
1215 if (hcall > MAX_HCALL_OPCODE || (hcall & 3) ||
1216 cap->args[1] > 1)
1217 break;
1218 if (!kvmppc_book3s_hcall_implemented(kvm, hcall))
1219 break;
1220 if (cap->args[1])
1221 set_bit(hcall / 4, kvm->arch.enabled_hcalls);
1222 else
1223 clear_bit(hcall / 4, kvm->arch.enabled_hcalls);
1224 r = 0;
1225 break;
1226 }
1227#endif
1228 default:
1229 r = -EINVAL;
1230 break;
1231 }
1232
1233 return r;
1234}
1235
1102long kvm_arch_vm_ioctl(struct file *filp, 1236long kvm_arch_vm_ioctl(struct file *filp,
1103 unsigned int ioctl, unsigned long arg) 1237 unsigned int ioctl, unsigned long arg)
1104{ 1238{
@@ -1118,6 +1252,15 @@ long kvm_arch_vm_ioctl(struct file *filp,
1118 1252
1119 break; 1253 break;
1120 } 1254 }
1255 case KVM_ENABLE_CAP:
1256 {
1257 struct kvm_enable_cap cap;
1258 r = -EFAULT;
1259 if (copy_from_user(&cap, argp, sizeof(cap)))
1260 goto out;
1261 r = kvm_vm_ioctl_enable_cap(kvm, &cap);
1262 break;
1263 }
1121#ifdef CONFIG_PPC_BOOK3S_64 1264#ifdef CONFIG_PPC_BOOK3S_64
1122 case KVM_CREATE_SPAPR_TCE: { 1265 case KVM_CREATE_SPAPR_TCE: {
1123 struct kvm_create_spapr_tce create_tce; 1266 struct kvm_create_spapr_tce create_tce;
@@ -1204,3 +1347,5 @@ void kvm_arch_exit(void)
1204{ 1347{
1205 1348
1206} 1349}
1350
1351EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ppc_instr);
diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 07b6110a4bb7..e44d2b2ea97e 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -110,7 +110,6 @@ void kvmppc_update_timing_stats(struct kvm_vcpu *vcpu)
110 110
111static const char *kvm_exit_names[__NUMBER_OF_KVM_EXIT_TYPES] = { 111static const char *kvm_exit_names[__NUMBER_OF_KVM_EXIT_TYPES] = {
112 [MMIO_EXITS] = "MMIO", 112 [MMIO_EXITS] = "MMIO",
113 [DCR_EXITS] = "DCR",
114 [SIGNAL_EXITS] = "SIGNAL", 113 [SIGNAL_EXITS] = "SIGNAL",
115 [ITLB_REAL_MISS_EXITS] = "ITLBREAL", 114 [ITLB_REAL_MISS_EXITS] = "ITLBREAL",
116 [ITLB_VIRT_MISS_EXITS] = "ITLBVIRT", 115 [ITLB_VIRT_MISS_EXITS] = "ITLBVIRT",
diff --git a/arch/powerpc/kvm/timing.h b/arch/powerpc/kvm/timing.h
index bf191e72b2d8..3123690c82dc 100644
--- a/arch/powerpc/kvm/timing.h
+++ b/arch/powerpc/kvm/timing.h
@@ -63,9 +63,6 @@ static inline void kvmppc_account_exit_stat(struct kvm_vcpu *vcpu, int type)
63 case EMULATED_INST_EXITS: 63 case EMULATED_INST_EXITS:
64 vcpu->stat.emulated_inst_exits++; 64 vcpu->stat.emulated_inst_exits++;
65 break; 65 break;
66 case DCR_EXITS:
67 vcpu->stat.dcr_exits++;
68 break;
69 case DSI_EXITS: 66 case DSI_EXITS:
70 vcpu->stat.dsi_exits++; 67 vcpu->stat.dsi_exits++;
71 break; 68 break;
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 0860ee46013c..f09899e35991 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -461,8 +461,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
461/* 461/*
462 * Routine to copy a whole page of data, optimized for POWER4. 462 * Routine to copy a whole page of data, optimized for POWER4.
463 * On POWER4 it is more than 50% faster than the simple loop 463 * On POWER4 it is more than 50% faster than the simple loop
464 * above (following the .Ldst_aligned label) but it runs slightly 464 * above (following the .Ldst_aligned label).
465 * slower on POWER3.
466 */ 465 */
467.Lcopy_page_4K: 466.Lcopy_page_4K:
468 std r31,-32(1) 467 std r31,-32(1)
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 0c9c8d7d0734..170a0346f756 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -70,12 +70,16 @@ void __rw_yield(arch_rwlock_t *rw)
70 70
71void arch_spin_unlock_wait(arch_spinlock_t *lock) 71void arch_spin_unlock_wait(arch_spinlock_t *lock)
72{ 72{
73 smp_mb();
74
73 while (lock->slock) { 75 while (lock->slock) {
74 HMT_low(); 76 HMT_low();
75 if (SHARED_PROCESSOR) 77 if (SHARED_PROCESSOR)
76 __spin_yield(lock); 78 __spin_yield(lock);
77 } 79 }
78 HMT_medium(); 80 HMT_medium();
81
82 smp_mb();
79} 83}
80 84
81EXPORT_SYMBOL(arch_spin_unlock_wait); 85EXPORT_SYMBOL(arch_spin_unlock_wait);
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 51230ee6a407..d0130fff20e5 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -13,9 +13,7 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \
13 tlb_nohash_low.o 13 tlb_nohash_low.o
14obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o 14obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o
15hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o 15hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o
16obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o \ 16obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o slb_low.o slb.o $(hash64-y)
17 slb_low.o slb.o stab.o \
18 $(hash64-y)
19obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o 17obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o
20obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ 18obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \
21 tlb_hash$(CONFIG_WORD_SIZE).o \ 19 tlb_hash$(CONFIG_WORD_SIZE).o \
diff --git a/arch/powerpc/mm/dma-noncoherent.c b/arch/powerpc/mm/dma-noncoherent.c
index 7b6c10750179..d85e86aac7fb 100644
--- a/arch/powerpc/mm/dma-noncoherent.c
+++ b/arch/powerpc/mm/dma-noncoherent.c
@@ -33,6 +33,7 @@
33#include <linux/export.h> 33#include <linux/export.h>
34 34
35#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
36#include <asm/dma.h>
36 37
37#include "mmu_decl.h" 38#include "mmu_decl.h"
38 39
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index cf1d325eae8b..afc0a8295f84 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -412,18 +412,18 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
412 local_irq_restore(flags); 412 local_irq_restore(flags);
413} 413}
414 414
415static void native_hugepage_invalidate(struct mm_struct *mm, 415static void native_hugepage_invalidate(unsigned long vsid,
416 unsigned long addr,
416 unsigned char *hpte_slot_array, 417 unsigned char *hpte_slot_array,
417 unsigned long addr, int psize) 418 int psize, int ssize)
418{ 419{
419 int ssize = 0, i; 420 int i;
420 int lock_tlbie;
421 struct hash_pte *hptep; 421 struct hash_pte *hptep;
422 int actual_psize = MMU_PAGE_16M; 422 int actual_psize = MMU_PAGE_16M;
423 unsigned int max_hpte_count, valid; 423 unsigned int max_hpte_count, valid;
424 unsigned long flags, s_addr = addr; 424 unsigned long flags, s_addr = addr;
425 unsigned long hpte_v, want_v, shift; 425 unsigned long hpte_v, want_v, shift;
426 unsigned long hidx, vpn = 0, vsid, hash, slot; 426 unsigned long hidx, vpn = 0, hash, slot;
427 427
428 shift = mmu_psize_defs[psize].shift; 428 shift = mmu_psize_defs[psize].shift;
429 max_hpte_count = 1U << (PMD_SHIFT - shift); 429 max_hpte_count = 1U << (PMD_SHIFT - shift);
@@ -437,15 +437,6 @@ static void native_hugepage_invalidate(struct mm_struct *mm,
437 437
438 /* get the vpn */ 438 /* get the vpn */
439 addr = s_addr + (i * (1ul << shift)); 439 addr = s_addr + (i * (1ul << shift));
440 if (!is_kernel_addr(addr)) {
441 ssize = user_segment_size(addr);
442 vsid = get_vsid(mm->context.id, addr, ssize);
443 WARN_ON(vsid == 0);
444 } else {
445 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
446 ssize = mmu_kernel_ssize;
447 }
448
449 vpn = hpt_vpn(addr, vsid, ssize); 440 vpn = hpt_vpn(addr, vsid, ssize);
450 hash = hpt_hash(vpn, shift, ssize); 441 hash = hpt_hash(vpn, shift, ssize);
451 if (hidx & _PTEIDX_SECONDARY) 442 if (hidx & _PTEIDX_SECONDARY)
@@ -465,22 +456,13 @@ static void native_hugepage_invalidate(struct mm_struct *mm,
465 else 456 else
466 /* Invalidate the hpte. NOTE: this also unlocks it */ 457 /* Invalidate the hpte. NOTE: this also unlocks it */
467 hptep->v = 0; 458 hptep->v = 0;
459 /*
460 * We need to do tlb invalidate for all the address, tlbie
461 * instruction compares entry_VA in tlb with the VA specified
462 * here
463 */
464 tlbie(vpn, psize, actual_psize, ssize, 0);
468 } 465 }
469 /*
470 * Since this is a hugepage, we just need a single tlbie.
471 * use the last vpn.
472 */
473 lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
474 if (lock_tlbie)
475 raw_spin_lock(&native_tlbie_lock);
476
477 asm volatile("ptesync":::"memory");
478 __tlbie(vpn, psize, actual_psize, ssize);
479 asm volatile("eieio; tlbsync; ptesync":::"memory");
480
481 if (lock_tlbie)
482 raw_spin_unlock(&native_tlbie_lock);
483
484 local_irq_restore(flags); 466 local_irq_restore(flags);
485} 467}
486 468
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 88fdd9d25077..daee7f4e5a14 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -243,7 +243,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
243} 243}
244 244
245#ifdef CONFIG_MEMORY_HOTPLUG 245#ifdef CONFIG_MEMORY_HOTPLUG
246static int htab_remove_mapping(unsigned long vstart, unsigned long vend, 246int htab_remove_mapping(unsigned long vstart, unsigned long vend,
247 int psize, int ssize) 247 int psize, int ssize)
248{ 248{
249 unsigned long vaddr; 249 unsigned long vaddr;
@@ -821,21 +821,14 @@ static void __init htab_initialize(void)
821 821
822void __init early_init_mmu(void) 822void __init early_init_mmu(void)
823{ 823{
824 /* Setup initial STAB address in the PACA */
825 get_paca()->stab_real = __pa((u64)&initial_stab);
826 get_paca()->stab_addr = (u64)&initial_stab;
827
828 /* Initialize the MMU Hash table and create the linear mapping 824 /* Initialize the MMU Hash table and create the linear mapping
829 * of memory. Has to be done before stab/slb initialization as 825 * of memory. Has to be done before SLB initialization as this is
830 * this is currently where the page size encoding is obtained 826 * currently where the page size encoding is obtained.
831 */ 827 */
832 htab_initialize(); 828 htab_initialize();
833 829
834 /* Initialize stab / SLB management */ 830 /* Initialize SLB management */
835 if (mmu_has_feature(MMU_FTR_SLB)) 831 slb_initialize();
836 slb_initialize();
837 else
838 stab_initialize(get_paca()->stab_real);
839} 832}
840 833
841#ifdef CONFIG_SMP 834#ifdef CONFIG_SMP
@@ -845,13 +838,8 @@ void early_init_mmu_secondary(void)
845 if (!firmware_has_feature(FW_FEATURE_LPAR)) 838 if (!firmware_has_feature(FW_FEATURE_LPAR))
846 mtspr(SPRN_SDR1, _SDR1); 839 mtspr(SPRN_SDR1, _SDR1);
847 840
848 /* Initialize STAB/SLB. We use a virtual address as it works 841 /* Initialize SLB */
849 * in real mode on pSeries. 842 slb_initialize();
850 */
851 if (mmu_has_feature(MMU_FTR_SLB))
852 slb_initialize();
853 else
854 stab_initialize(get_paca()->stab_addr);
855} 843}
856#endif /* CONFIG_SMP */ 844#endif /* CONFIG_SMP */
857 845
diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c
index 826893fcb3a7..5f5e6328c21c 100644
--- a/arch/powerpc/mm/hugepage-hash64.c
+++ b/arch/powerpc/mm/hugepage-hash64.c
@@ -18,6 +18,57 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <asm/machdep.h> 19#include <asm/machdep.h>
20 20
21static void invalidate_old_hpte(unsigned long vsid, unsigned long addr,
22 pmd_t *pmdp, unsigned int psize, int ssize)
23{
24 int i, max_hpte_count, valid;
25 unsigned long s_addr;
26 unsigned char *hpte_slot_array;
27 unsigned long hidx, shift, vpn, hash, slot;
28
29 s_addr = addr & HPAGE_PMD_MASK;
30 hpte_slot_array = get_hpte_slot_array(pmdp);
31 /*
32 * IF we try to do a HUGE PTE update after a withdraw is done.
33 * we will find the below NULL. This happens when we do
34 * split_huge_page_pmd
35 */
36 if (!hpte_slot_array)
37 return;
38
39 if (ppc_md.hugepage_invalidate)
40 return ppc_md.hugepage_invalidate(vsid, s_addr, hpte_slot_array,
41 psize, ssize);
42 /*
43 * No bluk hpte removal support, invalidate each entry
44 */
45 shift = mmu_psize_defs[psize].shift;
46 max_hpte_count = HPAGE_PMD_SIZE >> shift;
47 for (i = 0; i < max_hpte_count; i++) {
48 /*
49 * 8 bits per each hpte entries
50 * 000| [ secondary group (one bit) | hidx (3 bits) | valid bit]
51 */
52 valid = hpte_valid(hpte_slot_array, i);
53 if (!valid)
54 continue;
55 hidx = hpte_hash_index(hpte_slot_array, i);
56
57 /* get the vpn */
58 addr = s_addr + (i * (1ul << shift));
59 vpn = hpt_vpn(addr, vsid, ssize);
60 hash = hpt_hash(vpn, shift, ssize);
61 if (hidx & _PTEIDX_SECONDARY)
62 hash = ~hash;
63
64 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
65 slot += hidx & _PTEIDX_GROUP_IX;
66 ppc_md.hpte_invalidate(slot, vpn, psize,
67 MMU_PAGE_16M, ssize, 0);
68 }
69}
70
71
21int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, 72int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
22 pmd_t *pmdp, unsigned long trap, int local, int ssize, 73 pmd_t *pmdp, unsigned long trap, int local, int ssize,
23 unsigned int psize) 74 unsigned int psize)
@@ -33,7 +84,9 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
33 * atomically mark the linux large page PMD busy and dirty 84 * atomically mark the linux large page PMD busy and dirty
34 */ 85 */
35 do { 86 do {
36 old_pmd = pmd_val(*pmdp); 87 pmd_t pmd = ACCESS_ONCE(*pmdp);
88
89 old_pmd = pmd_val(pmd);
37 /* If PMD busy, retry the access */ 90 /* If PMD busy, retry the access */
38 if (unlikely(old_pmd & _PAGE_BUSY)) 91 if (unlikely(old_pmd & _PAGE_BUSY))
39 return 0; 92 return 0;
@@ -85,6 +138,15 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
85 vpn = hpt_vpn(ea, vsid, ssize); 138 vpn = hpt_vpn(ea, vsid, ssize);
86 hash = hpt_hash(vpn, shift, ssize); 139 hash = hpt_hash(vpn, shift, ssize);
87 hpte_slot_array = get_hpte_slot_array(pmdp); 140 hpte_slot_array = get_hpte_slot_array(pmdp);
141 if (psize == MMU_PAGE_4K) {
142 /*
143 * invalidate the old hpte entry if we have that mapped via 64K
144 * base page size. This is because demote_segment won't flush
145 * hash page table entries.
146 */
147 if ((old_pmd & _PAGE_HASHPTE) && !(old_pmd & _PAGE_COMBO))
148 invalidate_old_hpte(vsid, ea, pmdp, MMU_PAGE_64K, ssize);
149 }
88 150
89 valid = hpte_valid(hpte_slot_array, index); 151 valid = hpte_valid(hpte_slot_array, index);
90 if (valid) { 152 if (valid) {
@@ -107,11 +169,8 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
107 * safely update this here. 169 * safely update this here.
108 */ 170 */
109 valid = 0; 171 valid = 0;
110 new_pmd &= ~_PAGE_HPTEFLAGS;
111 hpte_slot_array[index] = 0; 172 hpte_slot_array[index] = 0;
112 } else 173 }
113 /* clear the busy bits and set the hash pte bits */
114 new_pmd = (new_pmd & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE;
115 } 174 }
116 175
117 if (!valid) { 176 if (!valid) {
@@ -119,11 +178,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
119 178
120 /* insert new entry */ 179 /* insert new entry */
121 pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT; 180 pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT;
122repeat: 181 new_pmd |= _PAGE_HASHPTE;
123 hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL;
124
125 /* clear the busy bits and set the hash pte bits */
126 new_pmd = (new_pmd & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE;
127 182
128 /* Add in WIMG bits */ 183 /* Add in WIMG bits */
129 rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | 184 rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
@@ -132,6 +187,8 @@ repeat:
132 * enable the memory coherence always 187 * enable the memory coherence always
133 */ 188 */
134 rflags |= HPTE_R_M; 189 rflags |= HPTE_R_M;
190repeat:
191 hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL;
135 192
136 /* Insert into the hash table, primary slot */ 193 /* Insert into the hash table, primary slot */
137 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0, 194 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
@@ -172,8 +229,17 @@ repeat:
172 mark_hpte_slot_valid(hpte_slot_array, index, slot); 229 mark_hpte_slot_valid(hpte_slot_array, index, slot);
173 } 230 }
174 /* 231 /*
175 * No need to use ldarx/stdcx here 232 * Mark the pte with _PAGE_COMBO, if we are trying to hash it with
233 * base page size 4k.
234 */
235 if (psize == MMU_PAGE_4K)
236 new_pmd |= _PAGE_COMBO;
237 /*
238 * The hpte valid is stored in the pgtable whose address is in the
239 * second half of the PMD. Order this against clearing of the busy bit in
240 * huge pmd.
176 */ 241 */
242 smp_wmb();
177 *pmdp = __pmd(new_pmd & ~_PAGE_BUSY); 243 *pmdp = __pmd(new_pmd & ~_PAGE_BUSY);
178 return 0; 244 return 0;
179} 245}
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index e3734edffa69..253b4b971c8a 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -175,9 +175,10 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page)
175static int __meminit vmemmap_populated(unsigned long start, int page_size) 175static int __meminit vmemmap_populated(unsigned long start, int page_size)
176{ 176{
177 unsigned long end = start + page_size; 177 unsigned long end = start + page_size;
178 start = (unsigned long)(pfn_to_page(vmemmap_section_start(start)));
178 179
179 for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page))) 180 for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page)))
180 if (pfn_valid(vmemmap_section_start(start))) 181 if (pfn_valid(page_to_pfn((struct page *)start)))
181 return 1; 182 return 1;
182 183
183 return 0; 184 return 0;
@@ -212,6 +213,13 @@ static void __meminit vmemmap_create_mapping(unsigned long start,
212 for (i = 0; i < page_size; i += PAGE_SIZE) 213 for (i = 0; i < page_size; i += PAGE_SIZE)
213 BUG_ON(map_kernel_page(start + i, phys, flags)); 214 BUG_ON(map_kernel_page(start + i, phys, flags));
214} 215}
216
217#ifdef CONFIG_MEMORY_HOTPLUG
218static void vmemmap_remove_mapping(unsigned long start,
219 unsigned long page_size)
220{
221}
222#endif
215#else /* CONFIG_PPC_BOOK3E */ 223#else /* CONFIG_PPC_BOOK3E */
216static void __meminit vmemmap_create_mapping(unsigned long start, 224static void __meminit vmemmap_create_mapping(unsigned long start,
217 unsigned long page_size, 225 unsigned long page_size,
@@ -223,17 +231,42 @@ static void __meminit vmemmap_create_mapping(unsigned long start,
223 mmu_kernel_ssize); 231 mmu_kernel_ssize);
224 BUG_ON(mapped < 0); 232 BUG_ON(mapped < 0);
225} 233}
234
235#ifdef CONFIG_MEMORY_HOTPLUG
236extern int htab_remove_mapping(unsigned long vstart, unsigned long vend,
237 int psize, int ssize);
238
239static void vmemmap_remove_mapping(unsigned long start,
240 unsigned long page_size)
241{
242 int mapped = htab_remove_mapping(start, start + page_size,
243 mmu_vmemmap_psize,
244 mmu_kernel_ssize);
245 BUG_ON(mapped < 0);
246}
247#endif
248
226#endif /* CONFIG_PPC_BOOK3E */ 249#endif /* CONFIG_PPC_BOOK3E */
227 250
228struct vmemmap_backing *vmemmap_list; 251struct vmemmap_backing *vmemmap_list;
252static struct vmemmap_backing *next;
253static int num_left;
254static int num_freed;
229 255
230static __meminit struct vmemmap_backing * vmemmap_list_alloc(int node) 256static __meminit struct vmemmap_backing * vmemmap_list_alloc(int node)
231{ 257{
232 static struct vmemmap_backing *next; 258 struct vmemmap_backing *vmem_back;
233 static int num_left; 259 /* get from freed entries first */
260 if (num_freed) {
261 num_freed--;
262 vmem_back = next;
263 next = next->list;
264
265 return vmem_back;
266 }
234 267
235 /* allocate a page when required and hand out chunks */ 268 /* allocate a page when required and hand out chunks */
236 if (!next || !num_left) { 269 if (!num_left) {
237 next = vmemmap_alloc_block(PAGE_SIZE, node); 270 next = vmemmap_alloc_block(PAGE_SIZE, node);
238 if (unlikely(!next)) { 271 if (unlikely(!next)) {
239 WARN_ON(1); 272 WARN_ON(1);
@@ -296,10 +329,85 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
296 return 0; 329 return 0;
297} 330}
298 331
299void vmemmap_free(unsigned long start, unsigned long end) 332#ifdef CONFIG_MEMORY_HOTPLUG
333static unsigned long vmemmap_list_free(unsigned long start)
300{ 334{
335 struct vmemmap_backing *vmem_back, *vmem_back_prev;
336
337 vmem_back_prev = vmem_back = vmemmap_list;
338
339 /* look for it with prev pointer recorded */
340 for (; vmem_back; vmem_back = vmem_back->list) {
341 if (vmem_back->virt_addr == start)
342 break;
343 vmem_back_prev = vmem_back;
344 }
345
346 if (unlikely(!vmem_back)) {
347 WARN_ON(1);
348 return 0;
349 }
350
351 /* remove it from vmemmap_list */
352 if (vmem_back == vmemmap_list) /* remove head */
353 vmemmap_list = vmem_back->list;
354 else
355 vmem_back_prev->list = vmem_back->list;
356
357 /* next point to this freed entry */
358 vmem_back->list = next;
359 next = vmem_back;
360 num_freed++;
361
362 return vmem_back->phys;
301} 363}
302 364
365void __ref vmemmap_free(unsigned long start, unsigned long end)
366{
367 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
368
369 start = _ALIGN_DOWN(start, page_size);
370
371 pr_debug("vmemmap_free %lx...%lx\n", start, end);
372
373 for (; start < end; start += page_size) {
374 unsigned long addr;
375
376 /*
377 * the section has already be marked as invalid, so
378 * vmemmap_populated() true means some other sections still
379 * in this page, so skip it.
380 */
381 if (vmemmap_populated(start, page_size))
382 continue;
383
384 addr = vmemmap_list_free(start);
385 if (addr) {
386 struct page *page = pfn_to_page(addr >> PAGE_SHIFT);
387
388 if (PageReserved(page)) {
389 /* allocated from bootmem */
390 if (page_size < PAGE_SIZE) {
391 /*
392 * this shouldn't happen, but if it is
393 * the case, leave the memory there
394 */
395 WARN_ON_ONCE(1);
396 } else {
397 unsigned int nr_pages =
398 1 << get_order(page_size);
399 while (nr_pages--)
400 free_reserved_page(page++);
401 }
402 } else
403 free_pages((unsigned long)(__va(addr)),
404 get_order(page_size));
405
406 vmemmap_remove_mapping(start, page_size);
407 }
408 }
409}
410#endif
303void register_page_bootmem_memmap(unsigned long section_nr, 411void register_page_bootmem_memmap(unsigned long section_nr,
304 struct page *start_page, unsigned long size) 412 struct page *start_page, unsigned long size)
305{ 413{
@@ -331,16 +439,16 @@ struct page *realmode_pfn_to_page(unsigned long pfn)
331 if (pg_va < vmem_back->virt_addr) 439 if (pg_va < vmem_back->virt_addr)
332 continue; 440 continue;
333 441
334 /* Check that page struct is not split between real pages */ 442 /* After vmemmap_list entry free is possible, need check all */
335 if ((pg_va + sizeof(struct page)) > 443 if ((pg_va + sizeof(struct page)) <=
336 (vmem_back->virt_addr + page_size)) 444 (vmem_back->virt_addr + page_size)) {
337 return NULL; 445 page = (struct page *) (vmem_back->phys + pg_va -
338
339 page = (struct page *) (vmem_back->phys + pg_va -
340 vmem_back->virt_addr); 446 vmem_back->virt_addr);
341 return page; 447 return page;
448 }
342 } 449 }
343 450
451 /* Probably that page struct is split between real pages */
344 return NULL; 452 return NULL;
345} 453}
346EXPORT_SYMBOL_GPL(realmode_pfn_to_page); 454EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 2c8e90f5789e..e0f7a189c48e 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -128,7 +128,8 @@ int arch_add_memory(int nid, u64 start, u64 size)
128 return -EINVAL; 128 return -EINVAL;
129 129
130 /* this should work for most non-highmem platforms */ 130 /* this should work for most non-highmem platforms */
131 zone = pgdata->node_zones; 131 zone = pgdata->node_zones +
132 zone_for_memory(nid, start, size, 0);
132 133
133 return __add_pages(nid, zone, start_pfn, nr_pages); 134 return __add_pages(nid, zone, start_pfn, nr_pages);
134} 135}
diff --git a/arch/powerpc/mm/mmu_context_hash32.c b/arch/powerpc/mm/mmu_context_hash32.c
index 78fef6726e10..aa5a7fd89461 100644
--- a/arch/powerpc/mm/mmu_context_hash32.c
+++ b/arch/powerpc/mm/mmu_context_hash32.c
@@ -2,7 +2,7 @@
2 * This file contains the routines for handling the MMU on those 2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the 3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx, 4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx. 5 * and 8260 implementations but excludes the 8xx and 4xx.
6 * -- paulus 6 * -- paulus
7 * 7 *
8 * Derived from arch/ppc/mm/init.c: 8 * Derived from arch/ppc/mm/init.c:
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 3b181b22cd46..d7737a542fd7 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -611,8 +611,8 @@ static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action,
611 case CPU_UP_CANCELED: 611 case CPU_UP_CANCELED:
612 case CPU_UP_CANCELED_FROZEN: 612 case CPU_UP_CANCELED_FROZEN:
613 unmap_cpu_from_node(lcpu); 613 unmap_cpu_from_node(lcpu);
614 break;
615 ret = NOTIFY_OK; 614 ret = NOTIFY_OK;
615 break;
616#endif 616#endif
617 } 617 }
618 return ret; 618 return ret;
@@ -1049,7 +1049,7 @@ static void __init mark_reserved_regions_for_nid(int nid)
1049 1049
1050void __init do_init_bootmem(void) 1050void __init do_init_bootmem(void)
1051{ 1051{
1052 int nid; 1052 int nid, cpu;
1053 1053
1054 min_low_pfn = 0; 1054 min_low_pfn = 0;
1055 max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; 1055 max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
@@ -1122,8 +1122,15 @@ void __init do_init_bootmem(void)
1122 1122
1123 reset_numa_cpu_lookup_table(); 1123 reset_numa_cpu_lookup_table();
1124 register_cpu_notifier(&ppc64_numa_nb); 1124 register_cpu_notifier(&ppc64_numa_nb);
1125 cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE, 1125 /*
1126 (void *)(unsigned long)boot_cpuid); 1126 * We need the numa_cpu_lookup_table to be accurate for all CPUs,
1127 * even before we online them, so that we can use cpu_to_{node,mem}
1128 * early in boot, cf. smp_prepare_cpus().
1129 */
1130 for_each_possible_cpu(cpu) {
1131 cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
1132 (void *)(unsigned long)cpu);
1133 }
1127} 1134}
1128 1135
1129void __init paging_init(void) 1136void __init paging_init(void)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 343a87fa78b5..cf11342bf519 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -41,7 +41,7 @@ unsigned long ioremap_base;
41unsigned long ioremap_bot; 41unsigned long ioremap_bot;
42EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */ 42EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */
43 43
44#if defined(CONFIG_6xx) || defined(CONFIG_POWER3) 44#ifdef CONFIG_6xx
45#define HAVE_BATS 1 45#define HAVE_BATS 1
46#endif 46#endif
47 47
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index f6ce1f111f5b..c8d709ab489d 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -54,6 +54,9 @@
54 54
55#include "mmu_decl.h" 55#include "mmu_decl.h"
56 56
57#define CREATE_TRACE_POINTS
58#include <trace/events/thp.h>
59
57/* Some sanity checking */ 60/* Some sanity checking */
58#if TASK_SIZE_USER64 > PGTABLE_RANGE 61#if TASK_SIZE_USER64 > PGTABLE_RANGE
59#error TASK_SIZE_USER64 exceeds pagetable range 62#error TASK_SIZE_USER64 exceeds pagetable range
@@ -68,7 +71,7 @@
68unsigned long ioremap_bot = IOREMAP_BASE; 71unsigned long ioremap_bot = IOREMAP_BASE;
69 72
70#ifdef CONFIG_PPC_MMU_NOHASH 73#ifdef CONFIG_PPC_MMU_NOHASH
71static void *early_alloc_pgtable(unsigned long size) 74static __ref void *early_alloc_pgtable(unsigned long size)
72{ 75{
73 void *pt; 76 void *pt;
74 77
@@ -537,8 +540,9 @@ unsigned long pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,
537 old = pmd_val(*pmdp); 540 old = pmd_val(*pmdp);
538 *pmdp = __pmd((old & ~clr) | set); 541 *pmdp = __pmd((old & ~clr) | set);
539#endif 542#endif
543 trace_hugepage_update(addr, old, clr, set);
540 if (old & _PAGE_HASHPTE) 544 if (old & _PAGE_HASHPTE)
541 hpte_do_hugepage_flush(mm, addr, pmdp); 545 hpte_do_hugepage_flush(mm, addr, pmdp, old);
542 return old; 546 return old;
543} 547}
544 548
@@ -642,10 +646,11 @@ void pmdp_splitting_flush(struct vm_area_struct *vma,
642 * If we didn't had the splitting flag set, go and flush the 646 * If we didn't had the splitting flag set, go and flush the
643 * HPTE entries. 647 * HPTE entries.
644 */ 648 */
649 trace_hugepage_splitting(address, old);
645 if (!(old & _PAGE_SPLITTING)) { 650 if (!(old & _PAGE_SPLITTING)) {
646 /* We need to flush the hpte */ 651 /* We need to flush the hpte */
647 if (old & _PAGE_HASHPTE) 652 if (old & _PAGE_HASHPTE)
648 hpte_do_hugepage_flush(vma->vm_mm, address, pmdp); 653 hpte_do_hugepage_flush(vma->vm_mm, address, pmdp, old);
649 } 654 }
650 /* 655 /*
651 * This ensures that generic code that rely on IRQ disabling 656 * This ensures that generic code that rely on IRQ disabling
@@ -709,6 +714,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
709 assert_spin_locked(&mm->page_table_lock); 714 assert_spin_locked(&mm->page_table_lock);
710 WARN_ON(!pmd_trans_huge(pmd)); 715 WARN_ON(!pmd_trans_huge(pmd));
711#endif 716#endif
717 trace_hugepage_set_pmd(addr, pmd);
712 return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); 718 return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));
713} 719}
714 720
@@ -723,7 +729,7 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
723 * neesd to be flushed. 729 * neesd to be flushed.
724 */ 730 */
725void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, 731void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
726 pmd_t *pmdp) 732 pmd_t *pmdp, unsigned long old_pmd)
727{ 733{
728 int ssize, i; 734 int ssize, i;
729 unsigned long s_addr; 735 unsigned long s_addr;
@@ -745,12 +751,29 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
745 if (!hpte_slot_array) 751 if (!hpte_slot_array)
746 return; 752 return;
747 753
748 /* get the base page size */ 754 /* get the base page size,vsid and segment size */
755#ifdef CONFIG_DEBUG_VM
749 psize = get_slice_psize(mm, s_addr); 756 psize = get_slice_psize(mm, s_addr);
757 BUG_ON(psize == MMU_PAGE_16M);
758#endif
759 if (old_pmd & _PAGE_COMBO)
760 psize = MMU_PAGE_4K;
761 else
762 psize = MMU_PAGE_64K;
763
764 if (!is_kernel_addr(s_addr)) {
765 ssize = user_segment_size(s_addr);
766 vsid = get_vsid(mm->context.id, s_addr, ssize);
767 WARN_ON(vsid == 0);
768 } else {
769 vsid = get_kernel_vsid(s_addr, mmu_kernel_ssize);
770 ssize = mmu_kernel_ssize;
771 }
750 772
751 if (ppc_md.hugepage_invalidate) 773 if (ppc_md.hugepage_invalidate)
752 return ppc_md.hugepage_invalidate(mm, hpte_slot_array, 774 return ppc_md.hugepage_invalidate(vsid, s_addr,
753 s_addr, psize); 775 hpte_slot_array,
776 psize, ssize);
754 /* 777 /*
755 * No bluk hpte removal support, invalidate each entry 778 * No bluk hpte removal support, invalidate each entry
756 */ 779 */
@@ -768,15 +791,6 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
768 791
769 /* get the vpn */ 792 /* get the vpn */
770 addr = s_addr + (i * (1ul << shift)); 793 addr = s_addr + (i * (1ul << shift));
771 if (!is_kernel_addr(addr)) {
772 ssize = user_segment_size(addr);
773 vsid = get_vsid(mm->context.id, addr, ssize);
774 WARN_ON(vsid == 0);
775 } else {
776 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
777 ssize = mmu_kernel_ssize;
778 }
779
780 vpn = hpt_vpn(addr, vsid, ssize); 794 vpn = hpt_vpn(addr, vsid, ssize);
781 hash = hpt_hash(vpn, shift, ssize); 795 hash = hpt_hash(vpn, shift, ssize);
782 if (hidx & _PTEIDX_SECONDARY) 796 if (hidx & _PTEIDX_SECONDARY)
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 11571e118831..5029dc19b517 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -2,7 +2,7 @@
2 * This file contains the routines for handling the MMU on those 2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the 3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx, 4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx. 5 * and 8260 implementations but excludes the 8xx and 4xx.
6 * -- paulus 6 * -- paulus
7 * 7 *
8 * Derived from arch/ppc/mm/init.c: 8 * Derived from arch/ppc/mm/init.c:
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
deleted file mode 100644
index 3f8efa6f2997..000000000000
--- a/arch/powerpc/mm/stab.c
+++ /dev/null
@@ -1,286 +0,0 @@
1/*
2 * PowerPC64 Segment Translation Support.
3 *
4 * Dave Engebretsen and Mike Corrigan {engebret|mikejc}@us.ibm.com
5 * Copyright (c) 2001 Dave Engebretsen
6 *
7 * Copyright (C) 2002 Anton Blanchard <anton@au.ibm.com>, IBM
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/memblock.h>
16
17#include <asm/pgtable.h>
18#include <asm/mmu.h>
19#include <asm/mmu_context.h>
20#include <asm/paca.h>
21#include <asm/cputable.h>
22#include <asm/prom.h>
23
24struct stab_entry {
25 unsigned long esid_data;
26 unsigned long vsid_data;
27};
28
29#define NR_STAB_CACHE_ENTRIES 8
30static DEFINE_PER_CPU(long, stab_cache_ptr);
31static DEFINE_PER_CPU(long [NR_STAB_CACHE_ENTRIES], stab_cache);
32
33/*
34 * Create a segment table entry for the given esid/vsid pair.
35 */
36static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid)
37{
38 unsigned long esid_data, vsid_data;
39 unsigned long entry, group, old_esid, castout_entry, i;
40 unsigned int global_entry;
41 struct stab_entry *ste, *castout_ste;
42 unsigned long kernel_segment = (esid << SID_SHIFT) >= PAGE_OFFSET;
43
44 vsid_data = vsid << STE_VSID_SHIFT;
45 esid_data = esid << SID_SHIFT | STE_ESID_KP | STE_ESID_V;
46 if (! kernel_segment)
47 esid_data |= STE_ESID_KS;
48
49 /* Search the primary group first. */
50 global_entry = (esid & 0x1f) << 3;
51 ste = (struct stab_entry *)(stab | ((esid & 0x1f) << 7));
52
53 /* Find an empty entry, if one exists. */
54 for (group = 0; group < 2; group++) {
55 for (entry = 0; entry < 8; entry++, ste++) {
56 if (!(ste->esid_data & STE_ESID_V)) {
57 ste->vsid_data = vsid_data;
58 eieio();
59 ste->esid_data = esid_data;
60 return (global_entry | entry);
61 }
62 }
63 /* Now search the secondary group. */
64 global_entry = ((~esid) & 0x1f) << 3;
65 ste = (struct stab_entry *)(stab | (((~esid) & 0x1f) << 7));
66 }
67
68 /*
69 * Could not find empty entry, pick one with a round robin selection.
70 * Search all entries in the two groups.
71 */
72 castout_entry = get_paca()->stab_rr;
73 for (i = 0; i < 16; i++) {
74 if (castout_entry < 8) {
75 global_entry = (esid & 0x1f) << 3;
76 ste = (struct stab_entry *)(stab | ((esid & 0x1f) << 7));
77 castout_ste = ste + castout_entry;
78 } else {
79 global_entry = ((~esid) & 0x1f) << 3;
80 ste = (struct stab_entry *)(stab | (((~esid) & 0x1f) << 7));
81 castout_ste = ste + (castout_entry - 8);
82 }
83
84 /* Dont cast out the first kernel segment */
85 if ((castout_ste->esid_data & ESID_MASK) != PAGE_OFFSET)
86 break;
87
88 castout_entry = (castout_entry + 1) & 0xf;
89 }
90
91 get_paca()->stab_rr = (castout_entry + 1) & 0xf;
92
93 /* Modify the old entry to the new value. */
94
95 /* Force previous translations to complete. DRENG */
96 asm volatile("isync" : : : "memory");
97
98 old_esid = castout_ste->esid_data >> SID_SHIFT;
99 castout_ste->esid_data = 0; /* Invalidate old entry */
100
101 asm volatile("sync" : : : "memory"); /* Order update */
102
103 castout_ste->vsid_data = vsid_data;
104 eieio(); /* Order update */
105 castout_ste->esid_data = esid_data;
106
107 asm volatile("slbie %0" : : "r" (old_esid << SID_SHIFT));
108 /* Ensure completion of slbie */
109 asm volatile("sync" : : : "memory");
110
111 return (global_entry | (castout_entry & 0x7));
112}
113
114/*
115 * Allocate a segment table entry for the given ea and mm
116 */
117static int __ste_allocate(unsigned long ea, struct mm_struct *mm)
118{
119 unsigned long vsid;
120 unsigned char stab_entry;
121 unsigned long offset;
122
123 /* Kernel or user address? */
124 if (is_kernel_addr(ea)) {
125 vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M);
126 } else {
127 if ((ea >= TASK_SIZE_USER64) || (! mm))
128 return 1;
129
130 vsid = get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M);
131 }
132
133 stab_entry = make_ste(get_paca()->stab_addr, GET_ESID(ea), vsid);
134
135 if (!is_kernel_addr(ea)) {
136 offset = __get_cpu_var(stab_cache_ptr);
137 if (offset < NR_STAB_CACHE_ENTRIES)
138 __get_cpu_var(stab_cache[offset++]) = stab_entry;
139 else
140 offset = NR_STAB_CACHE_ENTRIES+1;
141 __get_cpu_var(stab_cache_ptr) = offset;
142
143 /* Order update */
144 asm volatile("sync":::"memory");
145 }
146
147 return 0;
148}
149
150int ste_allocate(unsigned long ea)
151{
152 return __ste_allocate(ea, current->mm);
153}
154
155/*
156 * Do the segment table work for a context switch: flush all user
157 * entries from the table, then preload some probably useful entries
158 * for the new task
159 */
160void switch_stab(struct task_struct *tsk, struct mm_struct *mm)
161{
162 struct stab_entry *stab = (struct stab_entry *) get_paca()->stab_addr;
163 struct stab_entry *ste;
164 unsigned long offset;
165 unsigned long pc = KSTK_EIP(tsk);
166 unsigned long stack = KSTK_ESP(tsk);
167 unsigned long unmapped_base;
168
169 /* Force previous translations to complete. DRENG */
170 asm volatile("isync" : : : "memory");
171
172 /*
173 * We need interrupts hard-disabled here, not just soft-disabled,
174 * so that a PMU interrupt can't occur, which might try to access
175 * user memory (to get a stack trace) and possible cause an STAB miss
176 * which would update the stab_cache/stab_cache_ptr per-cpu variables.
177 */
178 hard_irq_disable();
179
180 offset = __get_cpu_var(stab_cache_ptr);
181 if (offset <= NR_STAB_CACHE_ENTRIES) {
182 int i;
183
184 for (i = 0; i < offset; i++) {
185 ste = stab + __get_cpu_var(stab_cache[i]);
186 ste->esid_data = 0; /* invalidate entry */
187 }
188 } else {
189 unsigned long entry;
190
191 /* Invalidate all entries. */
192 ste = stab;
193
194 /* Never flush the first entry. */
195 ste += 1;
196 for (entry = 1;
197 entry < (HW_PAGE_SIZE / sizeof(struct stab_entry));
198 entry++, ste++) {
199 unsigned long ea;
200 ea = ste->esid_data & ESID_MASK;
201 if (!is_kernel_addr(ea)) {
202 ste->esid_data = 0;
203 }
204 }
205 }
206
207 asm volatile("sync; slbia; sync":::"memory");
208
209 __get_cpu_var(stab_cache_ptr) = 0;
210
211 /* Now preload some entries for the new task */
212 if (test_tsk_thread_flag(tsk, TIF_32BIT))
213 unmapped_base = TASK_UNMAPPED_BASE_USER32;
214 else
215 unmapped_base = TASK_UNMAPPED_BASE_USER64;
216
217 __ste_allocate(pc, mm);
218
219 if (GET_ESID(pc) == GET_ESID(stack))
220 return;
221
222 __ste_allocate(stack, mm);
223
224 if ((GET_ESID(pc) == GET_ESID(unmapped_base))
225 || (GET_ESID(stack) == GET_ESID(unmapped_base)))
226 return;
227
228 __ste_allocate(unmapped_base, mm);
229
230 /* Order update */
231 asm volatile("sync" : : : "memory");
232}
233
234/*
235 * Allocate segment tables for secondary CPUs. These must all go in
236 * the first (bolted) segment, so that do_stab_bolted won't get a
237 * recursive segment miss on the segment table itself.
238 */
239void __init stabs_alloc(void)
240{
241 int cpu;
242
243 if (mmu_has_feature(MMU_FTR_SLB))
244 return;
245
246 for_each_possible_cpu(cpu) {
247 unsigned long newstab;
248
249 if (cpu == 0)
250 continue; /* stab for CPU 0 is statically allocated */
251
252 newstab = memblock_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE,
253 1<<SID_SHIFT);
254 newstab = (unsigned long)__va(newstab);
255
256 memset((void *)newstab, 0, HW_PAGE_SIZE);
257
258 paca[cpu].stab_addr = newstab;
259 paca[cpu].stab_real = __pa(newstab);
260 printk(KERN_INFO "Segment table for CPU %d at 0x%llx "
261 "virtual, 0x%llx absolute\n",
262 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
263 }
264}
265
266/*
267 * Build an entry for the base kernel segment and put it into
268 * the segment table or SLB. All other segment table or SLB
269 * entries are faulted in.
270 */
271void stab_initialize(unsigned long stab)
272{
273 unsigned long vsid = get_kernel_vsid(PAGE_OFFSET, MMU_SEGSIZE_256M);
274 unsigned long stabreal;
275
276 asm volatile("isync; slbia; isync":::"memory");
277 make_ste(stab, GET_ESID(PAGE_OFFSET), vsid);
278
279 /* Order update */
280 asm volatile("sync":::"memory");
281
282 /* Set ASR */
283 stabreal = get_paca()->stab_real | 0x1ul;
284
285 mtspr(SPRN_ASR, stabreal);
286}
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index c99f6510a0b2..d2a94b85dbc2 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -30,6 +30,8 @@
30#include <asm/tlb.h> 30#include <asm/tlb.h>
31#include <asm/bug.h> 31#include <asm/bug.h>
32 32
33#include <trace/events/thp.h>
34
33DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 35DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
34 36
35/* 37/*
@@ -213,10 +215,12 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
213 if (ptep == NULL) 215 if (ptep == NULL)
214 continue; 216 continue;
215 pte = pte_val(*ptep); 217 pte = pte_val(*ptep);
218 if (hugepage_shift)
219 trace_hugepage_invalidate(start, pte_val(pte));
216 if (!(pte & _PAGE_HASHPTE)) 220 if (!(pte & _PAGE_HASHPTE))
217 continue; 221 continue;
218 if (unlikely(hugepage_shift && pmd_trans_huge(*(pmd_t *)pte))) 222 if (unlikely(hugepage_shift && pmd_trans_huge(*(pmd_t *)pte)))
219 hpte_do_hugepage_flush(mm, start, (pmd_t *)pte); 223 hpte_do_hugepage_flush(mm, start, (pmd_t *)ptep, pte);
220 else 224 else
221 hpte_need_flush(mm, start, ptep, pte, 0); 225 hpte_need_flush(mm, start, ptep, pte, 0);
222 } 226 }
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 356e8b41fb09..89bf95bd63b1 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -296,9 +296,12 @@ itlb_miss_fault_bolted:
296 * r14 = page table base 296 * r14 = page table base
297 * r13 = PACA 297 * r13 = PACA
298 * r11 = tlb_per_core ptr 298 * r11 = tlb_per_core ptr
299 * r10 = cpu number 299 * r10 = crap (free to use)
300 */ 300 */
301tlb_miss_common_e6500: 301tlb_miss_common_e6500:
302 crmove cr2*4+2,cr0*4+2 /* cr2.eq != 0 if kernel address */
303
304BEGIN_FTR_SECTION /* CPU_FTR_SMT */
302 /* 305 /*
303 * Search if we already have an indirect entry for that virtual 306 * Search if we already have an indirect entry for that virtual
304 * address, and if we do, bail out. 307 * address, and if we do, bail out.
@@ -309,6 +312,7 @@ tlb_miss_common_e6500:
309 lhz r10,PACAPACAINDEX(r13) 312 lhz r10,PACAPACAINDEX(r13)
310 cmpdi r15,0 313 cmpdi r15,0
311 cmpdi cr1,r15,1 /* set cr1.eq = 0 for non-recursive */ 314 cmpdi cr1,r15,1 /* set cr1.eq = 0 for non-recursive */
315 addi r10,r10,1
312 bne 2f 316 bne 2f
313 stbcx. r10,0,r11 317 stbcx. r10,0,r11
314 bne 1b 318 bne 1b
@@ -322,18 +326,62 @@ tlb_miss_common_e6500:
322 b 1b 326 b 1b
323 .previous 327 .previous
324 328
329 /*
330 * Erratum A-008139 says that we can't use tlbwe to change
331 * an indirect entry in any way (including replacing or
332 * invalidating) if the other thread could be in the process
333 * of a lookup. The workaround is to invalidate the entry
334 * with tlbilx before overwriting.
335 */
336
337 lbz r15,TCD_ESEL_NEXT(r11)
338 rlwinm r10,r15,16,0xff0000
339 oris r10,r10,MAS0_TLBSEL(1)@h
340 mtspr SPRN_MAS0,r10
341 isync
342 tlbre
343 mfspr r15,SPRN_MAS1
344 andis. r15,r15,MAS1_VALID@h
345 beq 5f
346
347BEGIN_FTR_SECTION_NESTED(532)
348 mfspr r10,SPRN_MAS8
349 rlwinm r10,r10,0,0x80000fff /* tgs,tlpid -> sgs,slpid */
350 mtspr SPRN_MAS5,r10
351END_FTR_SECTION_NESTED(CPU_FTR_EMB_HV,CPU_FTR_EMB_HV,532)
352
353 mfspr r10,SPRN_MAS1
354 rlwinm r15,r10,0,0x3fff0000 /* tid -> spid */
355 rlwimi r15,r10,20,0x00000003 /* ind,ts -> sind,sas */
356 mfspr r10,SPRN_MAS6
357 mtspr SPRN_MAS6,r15
358
325 mfspr r15,SPRN_MAS2 359 mfspr r15,SPRN_MAS2
360 isync
361 tlbilxva 0,r15
362 isync
363
364 mtspr SPRN_MAS6,r10
365
3665:
367BEGIN_FTR_SECTION_NESTED(532)
368 li r10,0
369 mtspr SPRN_MAS8,r10
370 mtspr SPRN_MAS5,r10
371END_FTR_SECTION_NESTED(CPU_FTR_EMB_HV,CPU_FTR_EMB_HV,532)
326 372
327 tlbsx 0,r16 373 tlbsx 0,r16
328 mfspr r10,SPRN_MAS1 374 mfspr r10,SPRN_MAS1
329 andis. r10,r10,MAS1_VALID@h 375 andis. r15,r10,MAS1_VALID@h
330 bne tlb_miss_done_e6500 376 bne tlb_miss_done_e6500
331 377FTR_SECTION_ELSE
332 /* Undo MAS-damage from the tlbsx */
333 mfspr r10,SPRN_MAS1 378 mfspr r10,SPRN_MAS1
379ALT_FTR_SECTION_END_IFSET(CPU_FTR_SMT)
380
334 oris r10,r10,MAS1_VALID@h 381 oris r10,r10,MAS1_VALID@h
335 mtspr SPRN_MAS1,r10 382 beq cr2,4f
336 mtspr SPRN_MAS2,r15 383 rlwinm r10,r10,0,16,1 /* Clear TID */
3844: mtspr SPRN_MAS1,r10
337 385
338 /* Now, we need to walk the page tables. First check if we are in 386 /* Now, we need to walk the page tables. First check if we are in
339 * range. 387 * range.
@@ -394,11 +442,13 @@ tlb_miss_common_e6500:
394 442
395tlb_miss_done_e6500: 443tlb_miss_done_e6500:
396 .macro tlb_unlock_e6500 444 .macro tlb_unlock_e6500
445BEGIN_FTR_SECTION
397 beq cr1,1f /* no unlock if lock was recursively grabbed */ 446 beq cr1,1f /* no unlock if lock was recursively grabbed */
398 li r15,0 447 li r15,0
399 isync 448 isync
400 stb r15,0(r11) 449 stb r15,0(r11)
4011: 4501:
451END_FTR_SECTION_IFSET(CPU_FTR_SMT)
402 .endm 452 .endm
403 453
404 tlb_unlock_e6500 454 tlb_unlock_e6500
@@ -407,12 +457,9 @@ tlb_miss_done_e6500:
407 rfi 457 rfi
408 458
409tlb_miss_kernel_e6500: 459tlb_miss_kernel_e6500:
410 mfspr r10,SPRN_MAS1
411 ld r14,PACA_KERNELPGD(r13) 460 ld r14,PACA_KERNELPGD(r13)
412 cmpldi cr0,r15,8 /* Check for vmalloc region */ 461 cmpldi cr1,r15,8 /* Check for vmalloc region */
413 rlwinm r10,r10,0,16,1 /* Clear TID */ 462 beq+ cr1,tlb_miss_common_e6500
414 mtspr SPRN_MAS1,r10
415 beq+ tlb_miss_common_e6500
416 463
417tlb_miss_fault_e6500: 464tlb_miss_fault_e6500:
418 tlb_unlock_e6500 465 tlb_unlock_e6500
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 92cb18d52ea8..f38ea4df6a85 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -581,42 +581,10 @@ static void setup_mmu_htw(void)
581/* 581/*
582 * Early initialization of the MMU TLB code 582 * Early initialization of the MMU TLB code
583 */ 583 */
584static void __early_init_mmu(int boot_cpu) 584static void early_init_this_mmu(void)
585{ 585{
586 unsigned int mas4; 586 unsigned int mas4;
587 587
588 /* XXX This will have to be decided at runtime, but right
589 * now our boot and TLB miss code hard wires it. Ideally
590 * we should find out a suitable page size and patch the
591 * TLB miss code (either that or use the PACA to store
592 * the value we want)
593 */
594 mmu_linear_psize = MMU_PAGE_1G;
595
596 /* XXX This should be decided at runtime based on supported
597 * page sizes in the TLB, but for now let's assume 16M is
598 * always there and a good fit (which it probably is)
599 *
600 * Freescale booke only supports 4K pages in TLB0, so use that.
601 */
602 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
603 mmu_vmemmap_psize = MMU_PAGE_4K;
604 else
605 mmu_vmemmap_psize = MMU_PAGE_16M;
606
607 /* XXX This code only checks for TLB 0 capabilities and doesn't
608 * check what page size combos are supported by the HW. It
609 * also doesn't handle the case where a separate array holds
610 * the IND entries from the array loaded by the PT.
611 */
612 if (boot_cpu) {
613 /* Look for supported page sizes */
614 setup_page_sizes();
615
616 /* Look for HW tablewalk support */
617 setup_mmu_htw();
618 }
619
620 /* Set MAS4 based on page table setting */ 588 /* Set MAS4 based on page table setting */
621 589
622 mas4 = 0x4 << MAS4_WIMGED_SHIFT; 590 mas4 = 0x4 << MAS4_WIMGED_SHIFT;
@@ -650,11 +618,6 @@ static void __early_init_mmu(int boot_cpu)
650 } 618 }
651 mtspr(SPRN_MAS4, mas4); 619 mtspr(SPRN_MAS4, mas4);
652 620
653 /* Set the global containing the top of the linear mapping
654 * for use by the TLB miss code
655 */
656 linear_map_top = memblock_end_of_DRAM();
657
658#ifdef CONFIG_PPC_FSL_BOOK3E 621#ifdef CONFIG_PPC_FSL_BOOK3E
659 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) { 622 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
660 unsigned int num_cams; 623 unsigned int num_cams;
@@ -662,10 +625,49 @@ static void __early_init_mmu(int boot_cpu)
662 /* use a quarter of the TLBCAM for bolted linear map */ 625 /* use a quarter of the TLBCAM for bolted linear map */
663 num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4; 626 num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
664 linear_map_top = map_mem_in_cams(linear_map_top, num_cams); 627 linear_map_top = map_mem_in_cams(linear_map_top, num_cams);
628 }
629#endif
665 630
666 /* limit memory so we dont have linear faults */ 631 /* A sync won't hurt us after mucking around with
667 memblock_enforce_memory_limit(linear_map_top); 632 * the MMU configuration
633 */
634 mb();
635}
668 636
637static void __init early_init_mmu_global(void)
638{
639 /* XXX This will have to be decided at runtime, but right
640 * now our boot and TLB miss code hard wires it. Ideally
641 * we should find out a suitable page size and patch the
642 * TLB miss code (either that or use the PACA to store
643 * the value we want)
644 */
645 mmu_linear_psize = MMU_PAGE_1G;
646
647 /* XXX This should be decided at runtime based on supported
648 * page sizes in the TLB, but for now let's assume 16M is
649 * always there and a good fit (which it probably is)
650 *
651 * Freescale booke only supports 4K pages in TLB0, so use that.
652 */
653 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
654 mmu_vmemmap_psize = MMU_PAGE_4K;
655 else
656 mmu_vmemmap_psize = MMU_PAGE_16M;
657
658 /* XXX This code only checks for TLB 0 capabilities and doesn't
659 * check what page size combos are supported by the HW. It
660 * also doesn't handle the case where a separate array holds
661 * the IND entries from the array loaded by the PT.
662 */
663 /* Look for supported page sizes */
664 setup_page_sizes();
665
666 /* Look for HW tablewalk support */
667 setup_mmu_htw();
668
669#ifdef CONFIG_PPC_FSL_BOOK3E
670 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
669 if (book3e_htw_mode == PPC_HTW_NONE) { 671 if (book3e_htw_mode == PPC_HTW_NONE) {
670 extlb_level_exc = EX_TLB_SIZE; 672 extlb_level_exc = EX_TLB_SIZE;
671 patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e); 673 patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
@@ -675,22 +677,41 @@ static void __early_init_mmu(int boot_cpu)
675 } 677 }
676#endif 678#endif
677 679
678 /* A sync won't hurt us after mucking around with 680 /* Set the global containing the top of the linear mapping
679 * the MMU configuration 681 * for use by the TLB miss code
680 */ 682 */
681 mb(); 683 linear_map_top = memblock_end_of_DRAM();
684}
685
686static void __init early_mmu_set_memory_limit(void)
687{
688#ifdef CONFIG_PPC_FSL_BOOK3E
689 if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
690 /*
691 * Limit memory so we dont have linear faults.
692 * Unlike memblock_set_current_limit, which limits
693 * memory available during early boot, this permanently
694 * reduces the memory available to Linux. We need to
695 * do this because highmem is not supported on 64-bit.
696 */
697 memblock_enforce_memory_limit(linear_map_top);
698 }
699#endif
682 700
683 memblock_set_current_limit(linear_map_top); 701 memblock_set_current_limit(linear_map_top);
684} 702}
685 703
704/* boot cpu only */
686void __init early_init_mmu(void) 705void __init early_init_mmu(void)
687{ 706{
688 __early_init_mmu(1); 707 early_init_mmu_global();
708 early_init_this_mmu();
709 early_mmu_set_memory_limit();
689} 710}
690 711
691void early_init_mmu_secondary(void) 712void early_init_mmu_secondary(void)
692{ 713{
693 __early_init_mmu(0); 714 early_init_this_mmu();
694} 715}
695 716
696void setup_initial_memory_limit(phys_addr_t first_memblock_base, 717void setup_initial_memory_limit(phys_addr_t first_memblock_base,
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 82e82cadcde5..3afa6f4c1957 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -25,7 +25,7 @@ static inline void bpf_flush_icache(void *start, void *end)
25 flush_icache_range((unsigned long)start, (unsigned long)end); 25 flush_icache_range((unsigned long)start, (unsigned long)end);
26} 26}
27 27
28static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image, 28static void bpf_jit_build_prologue(struct bpf_prog *fp, u32 *image,
29 struct codegen_context *ctx) 29 struct codegen_context *ctx)
30{ 30{
31 int i; 31 int i;
@@ -121,7 +121,7 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
121 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) 121 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
122 122
123/* Assemble the body code between the prologue & epilogue. */ 123/* Assemble the body code between the prologue & epilogue. */
124static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, 124static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
125 struct codegen_context *ctx, 125 struct codegen_context *ctx,
126 unsigned int *addrs) 126 unsigned int *addrs)
127{ 127{
@@ -569,7 +569,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
569 return 0; 569 return 0;
570} 570}
571 571
572void bpf_jit_compile(struct sk_filter *fp) 572void bpf_jit_compile(struct bpf_prog *fp)
573{ 573{
574 unsigned int proglen; 574 unsigned int proglen;
575 unsigned int alloclen; 575 unsigned int alloclen;
@@ -693,7 +693,7 @@ out:
693 return; 693 return;
694} 694}
695 695
696void bpf_jit_free(struct sk_filter *fp) 696void bpf_jit_free(struct bpf_prog *fp)
697{ 697{
698 if (fp->jited) 698 if (fp->jited)
699 module_free(NULL, fp->bpf_func); 699 module_free(NULL, fp->bpf_func);
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 751ec7bd5018..cedbbeced632 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -14,6 +14,6 @@ oprofile-y := $(DRIVER_OBJS) common.o backtrace.o
14oprofile-$(CONFIG_OPROFILE_CELL) += op_model_cell.o \ 14oprofile-$(CONFIG_OPROFILE_CELL) += op_model_cell.o \
15 cell/spu_profiler.o cell/vma_map.o \ 15 cell/spu_profiler.o cell/vma_map.o \
16 cell/spu_task_sync.o 16 cell/spu_task_sync.o
17oprofile-$(CONFIG_PPC_BOOK3S_64) += op_model_rs64.o op_model_power4.o op_model_pa6t.o 17oprofile-$(CONFIG_PPC_BOOK3S_64) += op_model_power4.o op_model_pa6t.o
18oprofile-$(CONFIG_FSL_EMB_PERFMON) += op_model_fsl_emb.o 18oprofile-$(CONFIG_FSL_EMB_PERFMON) += op_model_fsl_emb.o
19oprofile-$(CONFIG_6xx) += op_model_7450.o 19oprofile-$(CONFIG_6xx) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index c77348c5d463..bf094c5a4bd9 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -205,9 +205,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
205 ops->sync_stop = model->sync_stop; 205 ops->sync_stop = model->sync_stop;
206 break; 206 break;
207#endif 207#endif
208 case PPC_OPROFILE_RS64:
209 model = &op_model_rs64;
210 break;
211 case PPC_OPROFILE_POWER4: 208 case PPC_OPROFILE_POWER4:
212 model = &op_model_power4; 209 model = &op_model_power4;
213 break; 210 break;
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
deleted file mode 100644
index 7e5b8ed3a1b7..000000000000
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/oprofile.h>
11#include <linux/smp.h>
12#include <asm/ptrace.h>
13#include <asm/processor.h>
14#include <asm/cputable.h>
15#include <asm/oprofile_impl.h>
16
17#define dbg(args...)
18
19static void ctrl_write(unsigned int i, unsigned int val)
20{
21 unsigned int tmp = 0;
22 unsigned long shift = 0, mask = 0;
23
24 dbg("ctrl_write %d %x\n", i, val);
25
26 switch(i) {
27 case 0:
28 tmp = mfspr(SPRN_MMCR0);
29 shift = 6;
30 mask = 0x7F;
31 break;
32 case 1:
33 tmp = mfspr(SPRN_MMCR0);
34 shift = 0;
35 mask = 0x3F;
36 break;
37 case 2:
38 tmp = mfspr(SPRN_MMCR1);
39 shift = 31 - 4;
40 mask = 0x1F;
41 break;
42 case 3:
43 tmp = mfspr(SPRN_MMCR1);
44 shift = 31 - 9;
45 mask = 0x1F;
46 break;
47 case 4:
48 tmp = mfspr(SPRN_MMCR1);
49 shift = 31 - 14;
50 mask = 0x1F;
51 break;
52 case 5:
53 tmp = mfspr(SPRN_MMCR1);
54 shift = 31 - 19;
55 mask = 0x1F;
56 break;
57 case 6:
58 tmp = mfspr(SPRN_MMCR1);
59 shift = 31 - 24;
60 mask = 0x1F;
61 break;
62 case 7:
63 tmp = mfspr(SPRN_MMCR1);
64 shift = 31 - 28;
65 mask = 0xF;
66 break;
67 }
68
69 tmp = tmp & ~(mask << shift);
70 tmp |= val << shift;
71
72 switch(i) {
73 case 0:
74 case 1:
75 mtspr(SPRN_MMCR0, tmp);
76 break;
77 default:
78 mtspr(SPRN_MMCR1, tmp);
79 }
80
81 dbg("ctrl_write mmcr0 %lx mmcr1 %lx\n", mfspr(SPRN_MMCR0),
82 mfspr(SPRN_MMCR1));
83}
84
85static unsigned long reset_value[OP_MAX_COUNTER];
86
87static int num_counters;
88
89static int rs64_reg_setup(struct op_counter_config *ctr,
90 struct op_system_config *sys,
91 int num_ctrs)
92{
93 int i;
94
95 num_counters = num_ctrs;
96
97 for (i = 0; i < num_counters; ++i)
98 reset_value[i] = 0x80000000UL - ctr[i].count;
99
100 /* XXX setup user and kernel profiling */
101 return 0;
102}
103
104static int rs64_cpu_setup(struct op_counter_config *ctr)
105{
106 unsigned int mmcr0;
107
108 /* reset MMCR0 and set the freeze bit */
109 mmcr0 = MMCR0_FC;
110 mtspr(SPRN_MMCR0, mmcr0);
111
112 /* reset MMCR1, MMCRA */
113 mtspr(SPRN_MMCR1, 0);
114
115 if (cpu_has_feature(CPU_FTR_MMCRA))
116 mtspr(SPRN_MMCRA, 0);
117
118 mmcr0 |= MMCR0_FCM1|MMCR0_PMXE|MMCR0_FCECE;
119 /* Only applies to POWER3, but should be safe on RS64 */
120 mmcr0 |= MMCR0_PMC1CE|MMCR0_PMCjCE;
121 mtspr(SPRN_MMCR0, mmcr0);
122
123 dbg("setup on cpu %d, mmcr0 %lx\n", smp_processor_id(),
124 mfspr(SPRN_MMCR0));
125 dbg("setup on cpu %d, mmcr1 %lx\n", smp_processor_id(),
126 mfspr(SPRN_MMCR1));
127
128 return 0;
129}
130
131static int rs64_start(struct op_counter_config *ctr)
132{
133 int i;
134 unsigned int mmcr0;
135
136 /* set the PMM bit (see comment below) */
137 mtmsrd(mfmsr() | MSR_PMM);
138
139 for (i = 0; i < num_counters; ++i) {
140 if (ctr[i].enabled) {
141 classic_ctr_write(i, reset_value[i]);
142 ctrl_write(i, ctr[i].event);
143 } else {
144 classic_ctr_write(i, 0);
145 }
146 }
147
148 mmcr0 = mfspr(SPRN_MMCR0);
149
150 /*
151 * now clear the freeze bit, counting will not start until we
152 * rfid from this excetion, because only at that point will
153 * the PMM bit be cleared
154 */
155 mmcr0 &= ~MMCR0_FC;
156 mtspr(SPRN_MMCR0, mmcr0);
157
158 dbg("start on cpu %d, mmcr0 %x\n", smp_processor_id(), mmcr0);
159 return 0;
160}
161
162static void rs64_stop(void)
163{
164 unsigned int mmcr0;
165
166 /* freeze counters */
167 mmcr0 = mfspr(SPRN_MMCR0);
168 mmcr0 |= MMCR0_FC;
169 mtspr(SPRN_MMCR0, mmcr0);
170
171 dbg("stop on cpu %d, mmcr0 %x\n", smp_processor_id(), mmcr0);
172
173 mb();
174}
175
176static void rs64_handle_interrupt(struct pt_regs *regs,
177 struct op_counter_config *ctr)
178{
179 unsigned int mmcr0;
180 int is_kernel;
181 int val;
182 int i;
183 unsigned long pc = mfspr(SPRN_SIAR);
184
185 is_kernel = is_kernel_addr(pc);
186
187 /* set the PMM bit (see comment below) */
188 mtmsrd(mfmsr() | MSR_PMM);
189
190 for (i = 0; i < num_counters; ++i) {
191 val = classic_ctr_read(i);
192 if (val < 0) {
193 if (ctr[i].enabled) {
194 oprofile_add_ext_sample(pc, regs, i, is_kernel);
195 classic_ctr_write(i, reset_value[i]);
196 } else {
197 classic_ctr_write(i, 0);
198 }
199 }
200 }
201
202 mmcr0 = mfspr(SPRN_MMCR0);
203
204 /* reset the perfmon trigger */
205 mmcr0 |= MMCR0_PMXE;
206
207 /*
208 * now clear the freeze bit, counting will not start until we
209 * rfid from this exception, because only at that point will
210 * the PMM bit be cleared
211 */
212 mmcr0 &= ~MMCR0_FC;
213 mtspr(SPRN_MMCR0, mmcr0);
214}
215
216struct op_powerpc_model op_model_rs64 = {
217 .reg_setup = rs64_reg_setup,
218 .cpu_setup = rs64_cpu_setup,
219 .start = rs64_start,
220 .stop = rs64_stop,
221 .handle_interrupt = rs64_handle_interrupt,
222};
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index fe52db2eea6a..b7cd00b0171e 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -36,7 +36,12 @@ struct cpu_hw_events {
36 struct perf_event *event[MAX_HWEVENTS]; 36 struct perf_event *event[MAX_HWEVENTS];
37 u64 events[MAX_HWEVENTS]; 37 u64 events[MAX_HWEVENTS];
38 unsigned int flags[MAX_HWEVENTS]; 38 unsigned int flags[MAX_HWEVENTS];
39 unsigned long mmcr[3]; 39 /*
40 * The order of the MMCR array is:
41 * - 64-bit, MMCR0, MMCR1, MMCRA, MMCR2
42 * - 32-bit, MMCR0, MMCR1, MMCR2
43 */
44 unsigned long mmcr[4];
40 struct perf_event *limited_counter[MAX_LIMITED_HWCOUNTERS]; 45 struct perf_event *limited_counter[MAX_LIMITED_HWCOUNTERS];
41 u8 limited_hwidx[MAX_LIMITED_HWCOUNTERS]; 46 u8 limited_hwidx[MAX_LIMITED_HWCOUNTERS];
42 u64 alternatives[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES]; 47 u64 alternatives[MAX_HWEVENTS][MAX_EVENT_ALTERNATIVES];
@@ -112,9 +117,9 @@ static bool is_ebb_event(struct perf_event *event) { return false; }
112static int ebb_event_check(struct perf_event *event) { return 0; } 117static int ebb_event_check(struct perf_event *event) { return 0; }
113static void ebb_event_add(struct perf_event *event) { } 118static void ebb_event_add(struct perf_event *event) { }
114static void ebb_switch_out(unsigned long mmcr0) { } 119static void ebb_switch_out(unsigned long mmcr0) { }
115static unsigned long ebb_switch_in(bool ebb, unsigned long mmcr0) 120static unsigned long ebb_switch_in(bool ebb, struct cpu_hw_events *cpuhw)
116{ 121{
117 return mmcr0; 122 return cpuhw->mmcr[0];
118} 123}
119 124
120static inline void power_pmu_bhrb_enable(struct perf_event *event) {} 125static inline void power_pmu_bhrb_enable(struct perf_event *event) {}
@@ -542,8 +547,10 @@ static void ebb_switch_out(unsigned long mmcr0)
542 current->thread.mmcr2 = mfspr(SPRN_MMCR2) & MMCR2_USER_MASK; 547 current->thread.mmcr2 = mfspr(SPRN_MMCR2) & MMCR2_USER_MASK;
543} 548}
544 549
545static unsigned long ebb_switch_in(bool ebb, unsigned long mmcr0) 550static unsigned long ebb_switch_in(bool ebb, struct cpu_hw_events *cpuhw)
546{ 551{
552 unsigned long mmcr0 = cpuhw->mmcr[0];
553
547 if (!ebb) 554 if (!ebb)
548 goto out; 555 goto out;
549 556
@@ -568,7 +575,15 @@ static unsigned long ebb_switch_in(bool ebb, unsigned long mmcr0)
568 mtspr(SPRN_SIAR, current->thread.siar); 575 mtspr(SPRN_SIAR, current->thread.siar);
569 mtspr(SPRN_SIER, current->thread.sier); 576 mtspr(SPRN_SIER, current->thread.sier);
570 mtspr(SPRN_SDAR, current->thread.sdar); 577 mtspr(SPRN_SDAR, current->thread.sdar);
571 mtspr(SPRN_MMCR2, current->thread.mmcr2); 578
579 /*
580 * Merge the kernel & user values of MMCR2. The semantics we implement
581 * are that the user MMCR2 can set bits, ie. cause counters to freeze,
582 * but not clear bits. If a task wants to be able to clear bits, ie.
583 * unfreeze counters, it should not set exclude_xxx in its events and
584 * instead manage the MMCR2 entirely by itself.
585 */
586 mtspr(SPRN_MMCR2, cpuhw->mmcr[3] | current->thread.mmcr2);
572out: 587out:
573 return mmcr0; 588 return mmcr0;
574} 589}
@@ -915,6 +930,14 @@ static int check_excludes(struct perf_event **ctrs, unsigned int cflags[],
915 int i, n, first; 930 int i, n, first;
916 struct perf_event *event; 931 struct perf_event *event;
917 932
933 /*
934 * If the PMU we're on supports per event exclude settings then we
935 * don't need to do any of this logic. NB. This assumes no PMU has both
936 * per event exclude and limited PMCs.
937 */
938 if (ppmu->flags & PPMU_ARCH_207S)
939 return 0;
940
918 n = n_prev + n_new; 941 n = n_prev + n_new;
919 if (n <= 1) 942 if (n <= 1)
920 return 0; 943 return 0;
@@ -1219,28 +1242,31 @@ static void power_pmu_enable(struct pmu *pmu)
1219 } 1242 }
1220 1243
1221 /* 1244 /*
1222 * Compute MMCR* values for the new set of events 1245 * Clear all MMCR settings and recompute them for the new set of events.
1223 */ 1246 */
1247 memset(cpuhw->mmcr, 0, sizeof(cpuhw->mmcr));
1248
1224 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index, 1249 if (ppmu->compute_mmcr(cpuhw->events, cpuhw->n_events, hwc_index,
1225 cpuhw->mmcr)) { 1250 cpuhw->mmcr, cpuhw->event)) {
1226 /* shouldn't ever get here */ 1251 /* shouldn't ever get here */
1227 printk(KERN_ERR "oops compute_mmcr failed\n"); 1252 printk(KERN_ERR "oops compute_mmcr failed\n");
1228 goto out; 1253 goto out;
1229 } 1254 }
1230 1255
1231 /* 1256 if (!(ppmu->flags & PPMU_ARCH_207S)) {
1232 * Add in MMCR0 freeze bits corresponding to the 1257 /*
1233 * attr.exclude_* bits for the first event. 1258 * Add in MMCR0 freeze bits corresponding to the attr.exclude_*
1234 * We have already checked that all events have the 1259 * bits for the first event. We have already checked that all
1235 * same values for these bits as the first event. 1260 * events have the same value for these bits as the first event.
1236 */ 1261 */
1237 event = cpuhw->event[0]; 1262 event = cpuhw->event[0];
1238 if (event->attr.exclude_user) 1263 if (event->attr.exclude_user)
1239 cpuhw->mmcr[0] |= MMCR0_FCP; 1264 cpuhw->mmcr[0] |= MMCR0_FCP;
1240 if (event->attr.exclude_kernel) 1265 if (event->attr.exclude_kernel)
1241 cpuhw->mmcr[0] |= freeze_events_kernel; 1266 cpuhw->mmcr[0] |= freeze_events_kernel;
1242 if (event->attr.exclude_hv) 1267 if (event->attr.exclude_hv)
1243 cpuhw->mmcr[0] |= MMCR0_FCHV; 1268 cpuhw->mmcr[0] |= MMCR0_FCHV;
1269 }
1244 1270
1245 /* 1271 /*
1246 * Write the new configuration to MMCR* with the freeze 1272 * Write the new configuration to MMCR* with the freeze
@@ -1252,6 +1278,8 @@ static void power_pmu_enable(struct pmu *pmu)
1252 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]); 1278 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]);
1253 mtspr(SPRN_MMCR0, (cpuhw->mmcr[0] & ~(MMCR0_PMC1CE | MMCR0_PMCjCE)) 1279 mtspr(SPRN_MMCR0, (cpuhw->mmcr[0] & ~(MMCR0_PMC1CE | MMCR0_PMCjCE))
1254 | MMCR0_FC); 1280 | MMCR0_FC);
1281 if (ppmu->flags & PPMU_ARCH_207S)
1282 mtspr(SPRN_MMCR2, cpuhw->mmcr[3]);
1255 1283
1256 /* 1284 /*
1257 * Read off any pre-existing events that need to move 1285 * Read off any pre-existing events that need to move
@@ -1307,10 +1335,7 @@ static void power_pmu_enable(struct pmu *pmu)
1307 out_enable: 1335 out_enable:
1308 pmao_restore_workaround(ebb); 1336 pmao_restore_workaround(ebb);
1309 1337
1310 if (ppmu->flags & PPMU_ARCH_207S) 1338 mmcr0 = ebb_switch_in(ebb, cpuhw);
1311 mtspr(SPRN_MMCR2, 0);
1312
1313 mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]);
1314 1339
1315 mb(); 1340 mb();
1316 if (cpuhw->bhrb_users) 1341 if (cpuhw->bhrb_users)
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 66d0f179650f..70d4f748b54b 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -223,7 +223,7 @@ e_free:
223 pr_err("h_get_24x7_catalog_page(ver=%lld, page=%lld) failed:" 223 pr_err("h_get_24x7_catalog_page(ver=%lld, page=%lld) failed:"
224 " rc=%ld\n", 224 " rc=%ld\n",
225 catalog_version_num, page_offset, hret); 225 catalog_version_num, page_offset, hret);
226 kfree(page); 226 kmem_cache_free(hv_page_cache, page);
227 227
228 pr_devel("catalog_read: offset=%lld(%lld) count=%zu(%zu) catalog_len=%zu(%zu) => %zd\n", 228 pr_devel("catalog_read: offset=%lld(%lld) count=%zu(%zu) catalog_len=%zu(%zu) => %zd\n",
229 offset, page_offset, count, page_count, catalog_len, 229 offset, page_offset, count, page_count, catalog_len,
diff --git a/arch/powerpc/perf/mpc7450-pmu.c b/arch/powerpc/perf/mpc7450-pmu.c
index fe21b515ca44..d115c5635bf3 100644
--- a/arch/powerpc/perf/mpc7450-pmu.c
+++ b/arch/powerpc/perf/mpc7450-pmu.c
@@ -260,8 +260,9 @@ static const u32 pmcsel_mask[N_COUNTER] = {
260/* 260/*
261 * Compute MMCR0/1/2 values for a set of events. 261 * Compute MMCR0/1/2 values for a set of events.
262 */ 262 */
263static int mpc7450_compute_mmcr(u64 event[], int n_ev, 263static int mpc7450_compute_mmcr(u64 event[], int n_ev, unsigned int hwc[],
264 unsigned int hwc[], unsigned long mmcr[]) 264 unsigned long mmcr[],
265 struct perf_event *pevents[])
265{ 266{
266 u8 event_index[N_CLASSES][N_COUNTER]; 267 u8 event_index[N_CLASSES][N_COUNTER];
267 int n_classevent[N_CLASSES]; 268 int n_classevent[N_CLASSES];
diff --git a/arch/powerpc/perf/power4-pmu.c b/arch/powerpc/perf/power4-pmu.c
index 9103a1de864d..ce6072fa481b 100644
--- a/arch/powerpc/perf/power4-pmu.c
+++ b/arch/powerpc/perf/power4-pmu.c
@@ -356,7 +356,7 @@ static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[])
356} 356}
357 357
358static int p4_compute_mmcr(u64 event[], int n_ev, 358static int p4_compute_mmcr(u64 event[], int n_ev,
359 unsigned int hwc[], unsigned long mmcr[]) 359 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
360{ 360{
361 unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; 361 unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0;
362 unsigned int pmc, unit, byte, psel, lower; 362 unsigned int pmc, unit, byte, psel, lower;
diff --git a/arch/powerpc/perf/power5+-pmu.c b/arch/powerpc/perf/power5+-pmu.c
index b03b6dc0172d..0526dac66007 100644
--- a/arch/powerpc/perf/power5+-pmu.c
+++ b/arch/powerpc/perf/power5+-pmu.c
@@ -452,7 +452,7 @@ static int power5p_marked_instr_event(u64 event)
452} 452}
453 453
454static int power5p_compute_mmcr(u64 event[], int n_ev, 454static int power5p_compute_mmcr(u64 event[], int n_ev,
455 unsigned int hwc[], unsigned long mmcr[]) 455 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
456{ 456{
457 unsigned long mmcr1 = 0; 457 unsigned long mmcr1 = 0;
458 unsigned long mmcra = 0; 458 unsigned long mmcra = 0;
diff --git a/arch/powerpc/perf/power5-pmu.c b/arch/powerpc/perf/power5-pmu.c
index 1e8ce423c3af..4dc99f9f7962 100644
--- a/arch/powerpc/perf/power5-pmu.c
+++ b/arch/powerpc/perf/power5-pmu.c
@@ -383,7 +383,7 @@ static int power5_marked_instr_event(u64 event)
383} 383}
384 384
385static int power5_compute_mmcr(u64 event[], int n_ev, 385static int power5_compute_mmcr(u64 event[], int n_ev,
386 unsigned int hwc[], unsigned long mmcr[]) 386 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
387{ 387{
388 unsigned long mmcr1 = 0; 388 unsigned long mmcr1 = 0;
389 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; 389 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
diff --git a/arch/powerpc/perf/power6-pmu.c b/arch/powerpc/perf/power6-pmu.c
index 31128e086fed..9c9d646b68a1 100644
--- a/arch/powerpc/perf/power6-pmu.c
+++ b/arch/powerpc/perf/power6-pmu.c
@@ -175,7 +175,7 @@ static int power6_marked_instr_event(u64 event)
175 * Assign PMC numbers and compute MMCR1 value for a set of events 175 * Assign PMC numbers and compute MMCR1 value for a set of events
176 */ 176 */
177static int p6_compute_mmcr(u64 event[], int n_ev, 177static int p6_compute_mmcr(u64 event[], int n_ev,
178 unsigned int hwc[], unsigned long mmcr[]) 178 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
179{ 179{
180 unsigned long mmcr1 = 0; 180 unsigned long mmcr1 = 0;
181 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; 181 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 56c67bca2f75..5b62f2389290 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -245,7 +245,7 @@ static int power7_marked_instr_event(u64 event)
245} 245}
246 246
247static int power7_compute_mmcr(u64 event[], int n_ev, 247static int power7_compute_mmcr(u64 event[], int n_ev,
248 unsigned int hwc[], unsigned long mmcr[]) 248 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
249{ 249{
250 unsigned long mmcr1 = 0; 250 unsigned long mmcr1 = 0;
251 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS; 251 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index 639cd9156585..396351db601b 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/perf_event.h> 16#include <linux/perf_event.h>
17#include <asm/firmware.h> 17#include <asm/firmware.h>
18#include <asm/cputable.h>
18 19
19 20
20/* 21/*
@@ -266,6 +267,11 @@
266#define MMCRA_SDAR_MODE_TLB (1ull << 42) 267#define MMCRA_SDAR_MODE_TLB (1ull << 42)
267#define MMCRA_IFM_SHIFT 30 268#define MMCRA_IFM_SHIFT 30
268 269
270/* Bits in MMCR2 for POWER8 */
271#define MMCR2_FCS(pmc) (1ull << (63 - (((pmc) - 1) * 9)))
272#define MMCR2_FCP(pmc) (1ull << (62 - (((pmc) - 1) * 9)))
273#define MMCR2_FCH(pmc) (1ull << (57 - (((pmc) - 1) * 9)))
274
269 275
270static inline bool event_is_fab_match(u64 event) 276static inline bool event_is_fab_match(u64 event)
271{ 277{
@@ -393,9 +399,10 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long
393} 399}
394 400
395static int power8_compute_mmcr(u64 event[], int n_ev, 401static int power8_compute_mmcr(u64 event[], int n_ev,
396 unsigned int hwc[], unsigned long mmcr[]) 402 unsigned int hwc[], unsigned long mmcr[],
403 struct perf_event *pevents[])
397{ 404{
398 unsigned long mmcra, mmcr1, unit, combine, psel, cache, val; 405 unsigned long mmcra, mmcr1, mmcr2, unit, combine, psel, cache, val;
399 unsigned int pmc, pmc_inuse; 406 unsigned int pmc, pmc_inuse;
400 int i; 407 int i;
401 408
@@ -410,7 +417,7 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
410 417
411 /* In continous sampling mode, update SDAR on TLB miss */ 418 /* In continous sampling mode, update SDAR on TLB miss */
412 mmcra = MMCRA_SDAR_MODE_TLB; 419 mmcra = MMCRA_SDAR_MODE_TLB;
413 mmcr1 = 0; 420 mmcr1 = mmcr2 = 0;
414 421
415 /* Second pass: assign PMCs, set all MMCR1 fields */ 422 /* Second pass: assign PMCs, set all MMCR1 fields */
416 for (i = 0; i < n_ev; ++i) { 423 for (i = 0; i < n_ev; ++i) {
@@ -472,6 +479,19 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
472 mmcra |= val << MMCRA_IFM_SHIFT; 479 mmcra |= val << MMCRA_IFM_SHIFT;
473 } 480 }
474 481
482 if (pevents[i]->attr.exclude_user)
483 mmcr2 |= MMCR2_FCP(pmc);
484
485 if (pevents[i]->attr.exclude_hv)
486 mmcr2 |= MMCR2_FCH(pmc);
487
488 if (pevents[i]->attr.exclude_kernel) {
489 if (cpu_has_feature(CPU_FTR_HVMODE))
490 mmcr2 |= MMCR2_FCH(pmc);
491 else
492 mmcr2 |= MMCR2_FCS(pmc);
493 }
494
475 hwc[i] = pmc - 1; 495 hwc[i] = pmc - 1;
476 } 496 }
477 497
@@ -491,6 +511,7 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
491 511
492 mmcr[1] = mmcr1; 512 mmcr[1] = mmcr1;
493 mmcr[2] = mmcra; 513 mmcr[2] = mmcra;
514 mmcr[3] = mmcr2;
494 515
495 return 0; 516 return 0;
496} 517}
diff --git a/arch/powerpc/perf/ppc970-pmu.c b/arch/powerpc/perf/ppc970-pmu.c
index 20139ceeacf6..8b6a8a36fa38 100644
--- a/arch/powerpc/perf/ppc970-pmu.c
+++ b/arch/powerpc/perf/ppc970-pmu.c
@@ -257,7 +257,7 @@ static int p970_get_alternatives(u64 event, unsigned int flags, u64 alt[])
257} 257}
258 258
259static int p970_compute_mmcr(u64 event[], int n_ev, 259static int p970_compute_mmcr(u64 event[], int n_ev,
260 unsigned int hwc[], unsigned long mmcr[]) 260 unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
261{ 261{
262 unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0; 262 unsigned long mmcr0 = 0, mmcr1 = 0, mmcra = 0;
263 unsigned int pmc, unit, byte, psel; 263 unsigned int pmc, unit, byte, psel;
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index 534574a97ec9..3a104284b338 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -25,6 +25,7 @@
25#include <asm/time.h> 25#include <asm/time.h>
26#include <asm/uic.h> 26#include <asm/uic.h>
27#include <asm/ppc4xx.h> 27#include <asm/ppc4xx.h>
28#include <asm/dma.h>
28 29
29 30
30static __initdata struct of_device_id warp_of_bus[] = { 31static __initdata struct of_device_id warp_of_bus[] = {
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 6e19b0ad5d26..3feffde9128d 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -13,6 +13,7 @@
13#include <generated/utsrelease.h> 13#include <generated/utsrelease.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <asm/dma.h>
16#include <asm/prom.h> 17#include <asm/prom.h>
17#include <asm/time.h> 18#include <asm/time.h>
18#include <asm/machdep.h> 19#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index f442120e0033..0c1e6903597e 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -274,7 +274,7 @@ config CORENET_GENERIC
274 For 32bit kernel, the following boards are supported: 274 For 32bit kernel, the following boards are supported:
275 P2041 RDB, P3041 DS, P4080 DS, kmcoge4, and OCA4080 275 P2041 RDB, P3041 DS, P4080 DS, kmcoge4, and OCA4080
276 For 64bit kernel, the following boards are supported: 276 For 64bit kernel, the following boards are supported:
277 T4240 QDS and B4 QDS 277 T208x QDS/RDB, T4240 QDS/RDB and B4 QDS
278 The following boards are supported for both 32bit and 64bit kernel: 278 The following boards are supported for both 32bit and 64bit kernel:
279 P5020 DS, P5040 DS and T104xQDS 279 P5020 DS, P5040 DS and T104xQDS
280 280
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index 5db1e117fdde..d22dd85e50bf 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -119,7 +119,11 @@ static const char * const boards[] __initconst = {
119 "fsl,P4080DS", 119 "fsl,P4080DS",
120 "fsl,P5020DS", 120 "fsl,P5020DS",
121 "fsl,P5040DS", 121 "fsl,P5040DS",
122 "fsl,T2080QDS",
123 "fsl,T2080RDB",
124 "fsl,T2081QDS",
122 "fsl,T4240QDS", 125 "fsl,T4240QDS",
126 "fsl,T4240RDB",
123 "fsl,B4860QDS", 127 "fsl,B4860QDS",
124 "fsl,B4420QDS", 128 "fsl,B4420QDS",
125 "fsl,B4220QDS", 129 "fsl,B4220QDS",
@@ -129,28 +133,14 @@ static const char * const boards[] __initconst = {
129 NULL 133 NULL
130}; 134};
131 135
132static const char * const hv_boards[] __initconst = {
133 "fsl,P2041RDB-hv",
134 "fsl,P3041DS-hv",
135 "fsl,OCA4080-hv",
136 "fsl,P4080DS-hv",
137 "fsl,P5020DS-hv",
138 "fsl,P5040DS-hv",
139 "fsl,T4240QDS-hv",
140 "fsl,B4860QDS-hv",
141 "fsl,B4420QDS-hv",
142 "fsl,B4220QDS-hv",
143 "fsl,T1040QDS-hv",
144 "fsl,T1042QDS-hv",
145 NULL
146};
147
148/* 136/*
149 * Called very early, device-tree isn't unflattened 137 * Called very early, device-tree isn't unflattened
150 */ 138 */
151static int __init corenet_generic_probe(void) 139static int __init corenet_generic_probe(void)
152{ 140{
153 unsigned long root = of_get_flat_dt_root(); 141 unsigned long root = of_get_flat_dt_root();
142 char hv_compat[24];
143 int i;
154#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
155 extern struct smp_ops_t smp_85xx_ops; 145 extern struct smp_ops_t smp_85xx_ops;
156#endif 146#endif
@@ -159,21 +149,26 @@ static int __init corenet_generic_probe(void)
159 return 1; 149 return 1;
160 150
161 /* Check if we're running under the Freescale hypervisor */ 151 /* Check if we're running under the Freescale hypervisor */
162 if (of_flat_dt_match(root, hv_boards)) { 152 for (i = 0; boards[i]; i++) {
163 ppc_md.init_IRQ = ehv_pic_init; 153 snprintf(hv_compat, sizeof(hv_compat), "%s-hv", boards[i]);
164 ppc_md.get_irq = ehv_pic_get_irq; 154 if (of_flat_dt_is_compatible(root, hv_compat)) {
165 ppc_md.restart = fsl_hv_restart; 155 ppc_md.init_IRQ = ehv_pic_init;
166 ppc_md.power_off = fsl_hv_halt; 156
167 ppc_md.halt = fsl_hv_halt; 157 ppc_md.get_irq = ehv_pic_get_irq;
158 ppc_md.restart = fsl_hv_restart;
159 ppc_md.power_off = fsl_hv_halt;
160 ppc_md.halt = fsl_hv_halt;
168#ifdef CONFIG_SMP 161#ifdef CONFIG_SMP
169 /* 162 /*
170 * Disable the timebase sync operations because we can't write 163 * Disable the timebase sync operations because we
171 * to the timebase registers under the hypervisor. 164 * can't write to the timebase registers under the
172 */ 165 * hypervisor.
173 smp_85xx_ops.give_timebase = NULL; 166 */
174 smp_85xx_ops.take_timebase = NULL; 167 smp_85xx_ops.give_timebase = NULL;
168 smp_85xx_ops.take_timebase = NULL;
175#endif 169#endif
176 return 1; 170 return 1;
171 }
177 } 172 }
178 173
179 return 0; 174 return 0;
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index ba093f553678..d7c1e69f3070 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -28,6 +28,7 @@
28#include <asm/dbell.h> 28#include <asm/dbell.h>
29#include <asm/fsl_guts.h> 29#include <asm/fsl_guts.h>
30#include <asm/code-patching.h> 30#include <asm/code-patching.h>
31#include <asm/cputhreads.h>
31 32
32#include <sysdev/fsl_soc.h> 33#include <sysdev/fsl_soc.h>
33#include <sysdev/mpic.h> 34#include <sysdev/mpic.h>
@@ -168,6 +169,24 @@ static inline u32 read_spin_table_addr_l(void *spin_table)
168 return in_be32(&((struct epapr_spin_table *)spin_table)->addr_l); 169 return in_be32(&((struct epapr_spin_table *)spin_table)->addr_l);
169} 170}
170 171
172#ifdef CONFIG_PPC64
173static void wake_hw_thread(void *info)
174{
175 void fsl_secondary_thread_init(void);
176 unsigned long imsr1, inia1;
177 int nr = *(const int *)info;
178
179 imsr1 = MSR_KERNEL;
180 inia1 = *(unsigned long *)fsl_secondary_thread_init;
181
182 mttmr(TMRN_IMSR1, imsr1);
183 mttmr(TMRN_INIA1, inia1);
184 mtspr(SPRN_TENS, TEN_THREAD(1));
185
186 smp_generic_kick_cpu(nr);
187}
188#endif
189
171static int smp_85xx_kick_cpu(int nr) 190static int smp_85xx_kick_cpu(int nr)
172{ 191{
173 unsigned long flags; 192 unsigned long flags;
@@ -183,6 +202,31 @@ static int smp_85xx_kick_cpu(int nr)
183 202
184 pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr); 203 pr_debug("smp_85xx_kick_cpu: kick CPU #%d\n", nr);
185 204
205#ifdef CONFIG_PPC64
206 /* Threads don't use the spin table */
207 if (cpu_thread_in_core(nr) != 0) {
208 int primary = cpu_first_thread_sibling(nr);
209
210 if (WARN_ON_ONCE(!cpu_has_feature(CPU_FTR_SMT)))
211 return -ENOENT;
212
213 if (cpu_thread_in_core(nr) != 1) {
214 pr_err("%s: cpu %d: invalid hw thread %d\n",
215 __func__, nr, cpu_thread_in_core(nr));
216 return -ENOENT;
217 }
218
219 if (!cpu_online(primary)) {
220 pr_err("%s: cpu %d: primary %d not online\n",
221 __func__, nr, primary);
222 return -ENOENT;
223 }
224
225 smp_call_function_single(primary, wake_hw_thread, &nr, 0);
226 return 0;
227 }
228#endif
229
186 np = of_get_cpu_node(nr, NULL); 230 np = of_get_cpu_node(nr, NULL);
187 cpu_rel_addr = of_get_property(np, "cpu-release-addr", NULL); 231 cpu_rel_addr = of_get_property(np, "cpu-release-addr", NULL);
188 232
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 587a2828b06c..d3037747031d 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -18,7 +18,6 @@
18#include <linux/fsl_devices.h> 18#include <linux/fsl_devices.h>
19 19
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/mpc8xx.h>
22#include <asm/8xx_immap.h> 21#include <asm/8xx_immap.h>
23#include <asm/prom.h> 22#include <asm/prom.h>
24#include <asm/fs_pd.h> 23#include <asm/fs_pd.h>
@@ -28,8 +27,6 @@
28 27
29#include "mpc8xx.h" 28#include "mpc8xx.h"
30 29
31struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
32
33extern int cpm_pic_init(void); 30extern int cpm_pic_init(void);
34extern int cpm_get_irq(void); 31extern int cpm_get_irq(void);
35 32
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index c1262581b63c..5921dcb498fd 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -35,7 +35,6 @@
35#include <asm/page.h> 35#include <asm/page.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/time.h> 37#include <asm/time.h>
38#include <asm/mpc8xx.h>
39#include <asm/8xx_immap.h> 38#include <asm/8xx_immap.h>
40#include <asm/cpm1.h> 39#include <asm/cpm1.h>
41#include <asm/fs_pd.h> 40#include <asm/fs_pd.h>
@@ -46,61 +45,6 @@
46 45
47static u32 __iomem *bcsr, *bcsr5; 46static u32 __iomem *bcsr, *bcsr5;
48 47
49#ifdef CONFIG_PCMCIA_M8XX
50static void pcmcia_hw_setup(int slot, int enable)
51{
52 if (enable)
53 clrbits32(&bcsr[1], BCSR1_PCCEN);
54 else
55 setbits32(&bcsr[1], BCSR1_PCCEN);
56}
57
58static int pcmcia_set_voltage(int slot, int vcc, int vpp)
59{
60 u32 reg = 0;
61
62 switch (vcc) {
63 case 0:
64 break;
65 case 33:
66 reg |= BCSR1_PCCVCC0;
67 break;
68 case 50:
69 reg |= BCSR1_PCCVCC1;
70 break;
71 default:
72 return 1;
73 }
74
75 switch (vpp) {
76 case 0:
77 break;
78 case 33:
79 case 50:
80 if (vcc == vpp)
81 reg |= BCSR1_PCCVPP1;
82 else
83 return 1;
84 break;
85 case 120:
86 if ((vcc == 33) || (vcc == 50))
87 reg |= BCSR1_PCCVPP0;
88 else
89 return 1;
90 default:
91 return 1;
92 }
93
94 /* first, turn off all power */
95 clrbits32(&bcsr[1], 0x00610000);
96
97 /* enable new powersettings */
98 setbits32(&bcsr[1], reg);
99
100 return 0;
101}
102#endif
103
104struct cpm_pin { 48struct cpm_pin {
105 int port, pin, flags; 49 int port, pin, flags;
106}; 50};
@@ -245,12 +189,6 @@ static void __init mpc885ads_setup_arch(void)
245 of_detach_node(np); 189 of_detach_node(np);
246 of_node_put(np); 190 of_node_put(np);
247 } 191 }
248
249#ifdef CONFIG_PCMCIA_M8XX
250 /* Set up board specific hook-ups.*/
251 m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup;
252 m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage;
253#endif
254} 192}
255 193
256static int __init mpc885ads_probe(void) 194static int __init mpc885ads_probe(void)
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index 251aba8759e4..dda607807def 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -37,7 +37,6 @@
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/processor.h> 38#include <asm/processor.h>
39#include <asm/time.h> 39#include <asm/time.h>
40#include <asm/mpc8xx.h>
41#include <asm/8xx_immap.h> 40#include <asm/8xx_immap.h>
42#include <asm/cpm1.h> 41#include <asm/cpm1.h>
43#include <asm/fs_pd.h> 42#include <asm/fs_pd.h>
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index a41bd023647a..e8bc40869cbd 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -61,7 +61,7 @@ choice
61 help 61 help
62 There are two families of 64 bit PowerPC chips supported. 62 There are two families of 64 bit PowerPC chips supported.
63 The most common ones are the desktop and server CPUs 63 The most common ones are the desktop and server CPUs
64 (POWER3, RS64, POWER4, POWER5, POWER5+, POWER6, ...) 64 (POWER4, POWER5, 970, POWER5+, POWER6, POWER7, POWER8 ...)
65 65
66 The other are the "embedded" processors compliant with the 66 The other are the "embedded" processors compliant with the
67 "Book 3E" variant of the architecture 67 "Book 3E" variant of the architecture
@@ -140,14 +140,6 @@ config 6xx
140 depends on PPC32 && PPC_BOOK3S 140 depends on PPC32 && PPC_BOOK3S
141 select PPC_HAVE_PMU_SUPPORT 141 select PPC_HAVE_PMU_SUPPORT
142 142
143config POWER3
144 depends on PPC64 && PPC_BOOK3S
145 def_bool y
146
147config POWER4
148 depends on PPC64 && PPC_BOOK3S
149 def_bool y
150
151config TUNE_CELL 143config TUNE_CELL
152 bool "Optimize for Cell Broadband Engine" 144 bool "Optimize for Cell Broadband Engine"
153 depends on PPC64 && PPC_BOOK3S 145 depends on PPC64 && PPC_BOOK3S
@@ -244,7 +236,7 @@ config PHYS_64BIT
244 236
245config ALTIVEC 237config ALTIVEC
246 bool "AltiVec Support" 238 bool "AltiVec Support"
247 depends on 6xx || POWER4 || (PPC_E500MC && PPC64) 239 depends on 6xx || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
248 ---help--- 240 ---help---
249 This option enables kernel support for the Altivec extensions to the 241 This option enables kernel support for the Altivec extensions to the
250 PowerPC processor. The kernel currently supports saving and restoring 242 PowerPC processor. The kernel currently supports saving and restoring
@@ -260,7 +252,7 @@ config ALTIVEC
260 252
261config VSX 253config VSX
262 bool "VSX Support" 254 bool "VSX Support"
263 depends on POWER4 && ALTIVEC && PPC_FPU 255 depends on PPC_BOOK3S_64 && ALTIVEC && PPC_FPU
264 ---help--- 256 ---help---
265 257
266 This option enables kernel support for the Vector Scaler extensions 258 This option enables kernel support for the Vector Scaler extensions
@@ -276,7 +268,7 @@ config VSX
276 268
277config PPC_ICSWX 269config PPC_ICSWX
278 bool "Support for PowerPC icswx coprocessor instruction" 270 bool "Support for PowerPC icswx coprocessor instruction"
279 depends on POWER4 271 depends on PPC_BOOK3S_64
280 default n 272 default n
281 ---help--- 273 ---help---
282 274
@@ -294,7 +286,7 @@ config PPC_ICSWX
294 286
295config PPC_ICSWX_PID 287config PPC_ICSWX_PID
296 bool "icswx requires direct PID management" 288 bool "icswx requires direct PID management"
297 depends on PPC_ICSWX && POWER4 289 depends on PPC_ICSWX
298 default y 290 default y
299 ---help--- 291 ---help---
300 The PID register in server is used explicitly for ICSWX. In 292 The PID register in server is used explicitly for ICSWX. In
diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c
index 03aabc0e16ac..2fe12046279e 100644
--- a/arch/powerpc/platforms/amigaone/setup.c
+++ b/arch/powerpc/platforms/amigaone/setup.c
@@ -24,6 +24,7 @@
24#include <asm/i8259.h> 24#include <asm/i8259.h>
25#include <asm/time.h> 25#include <asm/time.h>
26#include <asm/udbg.h> 26#include <asm/udbg.h>
27#include <asm/dma.h>
27 28
28extern void __flush_disable_L1(void); 29extern void __flush_disable_L1(void);
29 30
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index f85db3a69b4a..2930d1e81a05 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -611,7 +611,6 @@ static int __init create_spu(void *data)
611 int ret; 611 int ret;
612 static int number; 612 static int number;
613 unsigned long flags; 613 unsigned long flags;
614 struct timespec ts;
615 614
616 ret = -ENOMEM; 615 ret = -ENOMEM;
617 spu = kzalloc(sizeof (*spu), GFP_KERNEL); 616 spu = kzalloc(sizeof (*spu), GFP_KERNEL);
@@ -652,8 +651,7 @@ static int __init create_spu(void *data)
652 mutex_unlock(&spu_full_list_mutex); 651 mutex_unlock(&spu_full_list_mutex);
653 652
654 spu->stats.util_state = SPU_UTIL_IDLE_LOADED; 653 spu->stats.util_state = SPU_UTIL_IDLE_LOADED;
655 ktime_get_ts(&ts); 654 spu->stats.tstamp = ktime_get_ns();
656 spu->stats.tstamp = timespec_to_ns(&ts);
657 655
658 INIT_LIST_HEAD(&spu->aff_list); 656 INIT_LIST_HEAD(&spu->aff_list);
659 657
@@ -676,7 +674,6 @@ static const char *spu_state_names[] = {
676static unsigned long long spu_acct_time(struct spu *spu, 674static unsigned long long spu_acct_time(struct spu *spu,
677 enum spu_utilization_state state) 675 enum spu_utilization_state state)
678{ 676{
679 struct timespec ts;
680 unsigned long long time = spu->stats.times[state]; 677 unsigned long long time = spu->stats.times[state];
681 678
682 /* 679 /*
@@ -684,10 +681,8 @@ static unsigned long long spu_acct_time(struct spu *spu,
684 * statistics are not updated. Apply the time delta from the 681 * statistics are not updated. Apply the time delta from the
685 * last recorded state of the spu. 682 * last recorded state of the spu.
686 */ 683 */
687 if (spu->stats.util_state == state) { 684 if (spu->stats.util_state == state)
688 ktime_get_ts(&ts); 685 time += ktime_get_ns() - spu->stats.tstamp;
689 time += timespec_to_ns(&ts) - spu->stats.tstamp;
690 }
691 686
692 return time / NSEC_PER_MSEC; 687 return time / NSEC_PER_MSEC;
693} 688}
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 9c6790d17eda..3b4152faeb1f 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -36,7 +36,6 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0);
36struct spu_context *alloc_spu_context(struct spu_gang *gang) 36struct spu_context *alloc_spu_context(struct spu_gang *gang)
37{ 37{
38 struct spu_context *ctx; 38 struct spu_context *ctx;
39 struct timespec ts;
40 39
41 ctx = kzalloc(sizeof *ctx, GFP_KERNEL); 40 ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
42 if (!ctx) 41 if (!ctx)
@@ -67,8 +66,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
67 __spu_update_sched_info(ctx); 66 __spu_update_sched_info(ctx);
68 spu_set_timeslice(ctx); 67 spu_set_timeslice(ctx);
69 ctx->stats.util_state = SPU_UTIL_IDLE_LOADED; 68 ctx->stats.util_state = SPU_UTIL_IDLE_LOADED;
70 ktime_get_ts(&ts); 69 ctx->stats.tstamp = ktime_get_ns();
71 ctx->stats.tstamp = timespec_to_ns(&ts);
72 70
73 atomic_inc(&nr_spu_contexts); 71 atomic_inc(&nr_spu_contexts);
74 goto out; 72 goto out;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 90986923a53a..d966bbe58b8f 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2338,7 +2338,6 @@ static const char *ctx_state_names[] = {
2338static unsigned long long spufs_acct_time(struct spu_context *ctx, 2338static unsigned long long spufs_acct_time(struct spu_context *ctx,
2339 enum spu_utilization_state state) 2339 enum spu_utilization_state state)
2340{ 2340{
2341 struct timespec ts;
2342 unsigned long long time = ctx->stats.times[state]; 2341 unsigned long long time = ctx->stats.times[state];
2343 2342
2344 /* 2343 /*
@@ -2351,8 +2350,7 @@ static unsigned long long spufs_acct_time(struct spu_context *ctx,
2351 * of the spu context. 2350 * of the spu context.
2352 */ 2351 */
2353 if (ctx->spu && ctx->stats.util_state == state) { 2352 if (ctx->spu && ctx->stats.util_state == state) {
2354 ktime_get_ts(&ts); 2353 time += ktime_get_ns() - ctx->stats.tstamp;
2355 time += timespec_to_ns(&ts) - ctx->stats.tstamp;
2356 } 2354 }
2357 2355
2358 return time / NSEC_PER_MSEC; 2356 return time / NSEC_PER_MSEC;
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 4a0a64fe25df..998f632e7cce 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -1039,13 +1039,11 @@ void spuctx_switch_state(struct spu_context *ctx,
1039{ 1039{
1040 unsigned long long curtime; 1040 unsigned long long curtime;
1041 signed long long delta; 1041 signed long long delta;
1042 struct timespec ts;
1043 struct spu *spu; 1042 struct spu *spu;
1044 enum spu_utilization_state old_state; 1043 enum spu_utilization_state old_state;
1045 int node; 1044 int node;
1046 1045
1047 ktime_get_ts(&ts); 1046 curtime = ktime_get_ns();
1048 curtime = timespec_to_ns(&ts);
1049 delta = curtime - ctx->stats.tstamp; 1047 delta = curtime - ctx->stats.tstamp;
1050 1048
1051 WARN_ON(!mutex_is_locked(&ctx->state_mutex)); 1049 WARN_ON(!mutex_is_locked(&ctx->state_mutex));
diff --git a/arch/powerpc/platforms/powermac/Kconfig b/arch/powerpc/platforms/powermac/Kconfig
index 1afd10f67858..607124bae2e7 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -10,7 +10,7 @@ config PPC_PMAC
10 10
11config PPC_PMAC64 11config PPC_PMAC64
12 bool 12 bool
13 depends on PPC_PMAC && POWER4 13 depends on PPC_PMAC && PPC64
14 select MPIC 14 select MPIC
15 select U3_DART 15 select U3_DART
16 select MPIC_U3_HT_IRQS 16 select MPIC_U3_HT_IRQS
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 63d82bbc05e9..4882bfd90e27 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -158,7 +158,7 @@ static inline int simple_feature_tweak(struct device_node *node, int type,
158 return 0; 158 return 0;
159} 159}
160 160
161#ifndef CONFIG_POWER4 161#ifndef CONFIG_PPC64
162 162
163static long ohare_htw_scc_enable(struct device_node *node, long param, 163static long ohare_htw_scc_enable(struct device_node *node, long param,
164 long value) 164 long value)
@@ -1318,7 +1318,7 @@ intrepid_aack_delay_enable(struct device_node *node, long param, long value)
1318} 1318}
1319 1319
1320 1320
1321#endif /* CONFIG_POWER4 */ 1321#endif /* CONFIG_PPC64 */
1322 1322
1323static long 1323static long
1324core99_read_gpio(struct device_node *node, long param, long value) 1324core99_read_gpio(struct device_node *node, long param, long value)
@@ -1338,7 +1338,7 @@ core99_write_gpio(struct device_node *node, long param, long value)
1338 return 0; 1338 return 0;
1339} 1339}
1340 1340
1341#ifdef CONFIG_POWER4 1341#ifdef CONFIG_PPC64
1342static long g5_gmac_enable(struct device_node *node, long param, long value) 1342static long g5_gmac_enable(struct device_node *node, long param, long value)
1343{ 1343{
1344 struct macio_chip *macio = &macio_chips[0]; 1344 struct macio_chip *macio = &macio_chips[0];
@@ -1550,9 +1550,9 @@ void g5_phy_disable_cpu1(void)
1550 if (uninorth_maj == 3) 1550 if (uninorth_maj == 3)
1551 UN_OUT(U3_API_PHY_CONFIG_1, 0); 1551 UN_OUT(U3_API_PHY_CONFIG_1, 0);
1552} 1552}
1553#endif /* CONFIG_POWER4 */ 1553#endif /* CONFIG_PPC64 */
1554 1554
1555#ifndef CONFIG_POWER4 1555#ifndef CONFIG_PPC64
1556 1556
1557 1557
1558#ifdef CONFIG_PM 1558#ifdef CONFIG_PM
@@ -1864,7 +1864,7 @@ core99_sleep_state(struct device_node *node, long param, long value)
1864 return 0; 1864 return 0;
1865} 1865}
1866 1866
1867#endif /* CONFIG_POWER4 */ 1867#endif /* CONFIG_PPC64 */
1868 1868
1869static long 1869static long
1870generic_dev_can_wake(struct device_node *node, long param, long value) 1870generic_dev_can_wake(struct device_node *node, long param, long value)
@@ -1906,7 +1906,7 @@ static struct feature_table_entry any_features[] = {
1906 { 0, NULL } 1906 { 0, NULL }
1907}; 1907};
1908 1908
1909#ifndef CONFIG_POWER4 1909#ifndef CONFIG_PPC64
1910 1910
1911/* OHare based motherboards. Currently, we only use these on the 1911/* OHare based motherboards. Currently, we only use these on the
1912 * 2400,3400 and 3500 series powerbooks. Some older desktops seem 1912 * 2400,3400 and 3500 series powerbooks. Some older desktops seem
@@ -2056,7 +2056,7 @@ static struct feature_table_entry intrepid_features[] = {
2056 { 0, NULL } 2056 { 0, NULL }
2057}; 2057};
2058 2058
2059#else /* CONFIG_POWER4 */ 2059#else /* CONFIG_PPC64 */
2060 2060
2061/* G5 features 2061/* G5 features
2062 */ 2062 */
@@ -2074,10 +2074,10 @@ static struct feature_table_entry g5_features[] = {
2074 { 0, NULL } 2074 { 0, NULL }
2075}; 2075};
2076 2076
2077#endif /* CONFIG_POWER4 */ 2077#endif /* CONFIG_PPC64 */
2078 2078
2079static struct pmac_mb_def pmac_mb_defs[] = { 2079static struct pmac_mb_def pmac_mb_defs[] = {
2080#ifndef CONFIG_POWER4 2080#ifndef CONFIG_PPC64
2081 /* 2081 /*
2082 * Desktops 2082 * Desktops
2083 */ 2083 */
@@ -2342,7 +2342,7 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2342 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2342 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2343 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2343 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2344 }, 2344 },
2345#else /* CONFIG_POWER4 */ 2345#else /* CONFIG_PPC64 */
2346 { "PowerMac7,2", "PowerMac G5", 2346 { "PowerMac7,2", "PowerMac G5",
2347 PMAC_TYPE_POWERMAC_G5, g5_features, 2347 PMAC_TYPE_POWERMAC_G5, g5_features,
2348 0, 2348 0,
@@ -2373,7 +2373,7 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2373 0, 2373 0,
2374 }, 2374 },
2375#endif /* CONFIG_PPC64 */ 2375#endif /* CONFIG_PPC64 */
2376#endif /* CONFIG_POWER4 */ 2376#endif /* CONFIG_PPC64 */
2377}; 2377};
2378 2378
2379/* 2379/*
@@ -2441,7 +2441,7 @@ static int __init probe_motherboard(void)
2441 2441
2442 /* Fallback to selection depending on mac-io chip type */ 2442 /* Fallback to selection depending on mac-io chip type */
2443 switch(macio->type) { 2443 switch(macio->type) {
2444#ifndef CONFIG_POWER4 2444#ifndef CONFIG_PPC64
2445 case macio_grand_central: 2445 case macio_grand_central:
2446 pmac_mb.model_id = PMAC_TYPE_PSURGE; 2446 pmac_mb.model_id = PMAC_TYPE_PSURGE;
2447 pmac_mb.model_name = "Unknown PowerSurge"; 2447 pmac_mb.model_name = "Unknown PowerSurge";
@@ -2475,7 +2475,7 @@ static int __init probe_motherboard(void)
2475 pmac_mb.model_name = "Unknown Intrepid-based"; 2475 pmac_mb.model_name = "Unknown Intrepid-based";
2476 pmac_mb.features = intrepid_features; 2476 pmac_mb.features = intrepid_features;
2477 break; 2477 break;
2478#else /* CONFIG_POWER4 */ 2478#else /* CONFIG_PPC64 */
2479 case macio_keylargo2: 2479 case macio_keylargo2:
2480 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_K2; 2480 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_K2;
2481 pmac_mb.model_name = "Unknown K2-based"; 2481 pmac_mb.model_name = "Unknown K2-based";
@@ -2486,13 +2486,13 @@ static int __init probe_motherboard(void)
2486 pmac_mb.model_name = "Unknown Shasta-based"; 2486 pmac_mb.model_name = "Unknown Shasta-based";
2487 pmac_mb.features = g5_features; 2487 pmac_mb.features = g5_features;
2488 break; 2488 break;
2489#endif /* CONFIG_POWER4 */ 2489#endif /* CONFIG_PPC64 */
2490 default: 2490 default:
2491 ret = -ENODEV; 2491 ret = -ENODEV;
2492 goto done; 2492 goto done;
2493 } 2493 }
2494found: 2494found:
2495#ifndef CONFIG_POWER4 2495#ifndef CONFIG_PPC64
2496 /* Fixup Hooper vs. Comet */ 2496 /* Fixup Hooper vs. Comet */
2497 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { 2497 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) {
2498 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); 2498 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4);
@@ -2546,9 +2546,9 @@ found:
2546 */ 2546 */
2547 powersave_lowspeed = 1; 2547 powersave_lowspeed = 1;
2548 2548
2549#else /* CONFIG_POWER4 */ 2549#else /* CONFIG_PPC64 */
2550 powersave_nap = 1; 2550 powersave_nap = 1;
2551#endif /* CONFIG_POWER4 */ 2551#endif /* CONFIG_PPC64 */
2552 2552
2553 /* Check for "mobile" machine */ 2553 /* Check for "mobile" machine */
2554 if (model && (strncmp(model, "PowerBook", 9) == 0 2554 if (model && (strncmp(model, "PowerBook", 9) == 0
@@ -2786,7 +2786,7 @@ set_initial_features(void)
2786 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); 2786 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2787 } 2787 }
2788 2788
2789#ifdef CONFIG_POWER4 2789#ifdef CONFIG_PPC64
2790 if (macio_chips[0].type == macio_keylargo2 || 2790 if (macio_chips[0].type == macio_keylargo2 ||
2791 macio_chips[0].type == macio_shasta) { 2791 macio_chips[0].type == macio_shasta) {
2792#ifndef CONFIG_SMP 2792#ifndef CONFIG_SMP
@@ -2805,28 +2805,23 @@ set_initial_features(void)
2805 /* Enable GMAC for now for PCI probing. It will be disabled 2805 /* Enable GMAC for now for PCI probing. It will be disabled
2806 * later on after PCI probe 2806 * later on after PCI probe
2807 */ 2807 */
2808 np = of_find_node_by_name(NULL, "ethernet"); 2808 for_each_node_by_name(np, "ethernet")
2809 while(np) {
2810 if (of_device_is_compatible(np, "K2-GMAC")) 2809 if (of_device_is_compatible(np, "K2-GMAC"))
2811 g5_gmac_enable(np, 0, 1); 2810 g5_gmac_enable(np, 0, 1);
2812 np = of_find_node_by_name(np, "ethernet");
2813 }
2814 2811
2815 /* Enable FW before PCI probe. Will be disabled later on 2812 /* Enable FW before PCI probe. Will be disabled later on
2816 * Note: We should have a batter way to check that we are 2813 * Note: We should have a batter way to check that we are
2817 * dealing with uninorth internal cell and not a PCI cell 2814 * dealing with uninorth internal cell and not a PCI cell
2818 * on the external PCI. The code below works though. 2815 * on the external PCI. The code below works though.
2819 */ 2816 */
2820 np = of_find_node_by_name(NULL, "firewire"); 2817 for_each_node_by_name(np, "firewire") {
2821 while(np) {
2822 if (of_device_is_compatible(np, "pci106b,5811")) { 2818 if (of_device_is_compatible(np, "pci106b,5811")) {
2823 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; 2819 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2824 g5_fw_enable(np, 0, 1); 2820 g5_fw_enable(np, 0, 1);
2825 } 2821 }
2826 np = of_find_node_by_name(np, "firewire");
2827 } 2822 }
2828 } 2823 }
2829#else /* CONFIG_POWER4 */ 2824#else /* CONFIG_PPC64 */
2830 2825
2831 if (macio_chips[0].type == macio_keylargo || 2826 if (macio_chips[0].type == macio_keylargo ||
2832 macio_chips[0].type == macio_pangea || 2827 macio_chips[0].type == macio_pangea ||
@@ -2834,13 +2829,11 @@ set_initial_features(void)
2834 /* Enable GMAC for now for PCI probing. It will be disabled 2829 /* Enable GMAC for now for PCI probing. It will be disabled
2835 * later on after PCI probe 2830 * later on after PCI probe
2836 */ 2831 */
2837 np = of_find_node_by_name(NULL, "ethernet"); 2832 for_each_node_by_name(np, "ethernet") {
2838 while(np) {
2839 if (np->parent 2833 if (np->parent
2840 && of_device_is_compatible(np->parent, "uni-north") 2834 && of_device_is_compatible(np->parent, "uni-north")
2841 && of_device_is_compatible(np, "gmac")) 2835 && of_device_is_compatible(np, "gmac"))
2842 core99_gmac_enable(np, 0, 1); 2836 core99_gmac_enable(np, 0, 1);
2843 np = of_find_node_by_name(np, "ethernet");
2844 } 2837 }
2845 2838
2846 /* Enable FW before PCI probe. Will be disabled later on 2839 /* Enable FW before PCI probe. Will be disabled later on
@@ -2848,8 +2841,7 @@ set_initial_features(void)
2848 * dealing with uninorth internal cell and not a PCI cell 2841 * dealing with uninorth internal cell and not a PCI cell
2849 * on the external PCI. The code below works though. 2842 * on the external PCI. The code below works though.
2850 */ 2843 */
2851 np = of_find_node_by_name(NULL, "firewire"); 2844 for_each_node_by_name(np, "firewire") {
2852 while(np) {
2853 if (np->parent 2845 if (np->parent
2854 && of_device_is_compatible(np->parent, "uni-north") 2846 && of_device_is_compatible(np->parent, "uni-north")
2855 && (of_device_is_compatible(np, "pci106b,18") || 2847 && (of_device_is_compatible(np, "pci106b,18") ||
@@ -2858,18 +2850,16 @@ set_initial_features(void)
2858 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED; 2850 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2859 core99_firewire_enable(np, 0, 1); 2851 core99_firewire_enable(np, 0, 1);
2860 } 2852 }
2861 np = of_find_node_by_name(np, "firewire");
2862 } 2853 }
2863 2854
2864 /* Enable ATA-100 before PCI probe. */ 2855 /* Enable ATA-100 before PCI probe. */
2865 np = of_find_node_by_name(NULL, "ata-6"); 2856 np = of_find_node_by_name(NULL, "ata-6");
2866 while(np) { 2857 for_each_node_by_name(np, "ata-6") {
2867 if (np->parent 2858 if (np->parent
2868 && of_device_is_compatible(np->parent, "uni-north") 2859 && of_device_is_compatible(np->parent, "uni-north")
2869 && of_device_is_compatible(np, "kauai-ata")) { 2860 && of_device_is_compatible(np, "kauai-ata")) {
2870 core99_ata100_enable(np, 1); 2861 core99_ata100_enable(np, 1);
2871 } 2862 }
2872 np = of_find_node_by_name(np, "ata-6");
2873 } 2863 }
2874 2864
2875 /* Switch airport off */ 2865 /* Switch airport off */
@@ -2895,7 +2885,7 @@ set_initial_features(void)
2895 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N); 2885 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
2896 } 2886 }
2897 2887
2898#endif /* CONFIG_POWER4 */ 2888#endif /* CONFIG_PPC64 */
2899 2889
2900 /* On all machines, switch modem & serial ports off */ 2890 /* On all machines, switch modem & serial ports off */
2901 for_each_node_by_name(np, "ch-a") 2891 for_each_node_by_name(np, "ch-a")
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index cf7009b8c7b6..7e868ccf3b0d 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -698,7 +698,7 @@ static void __init fixup_nec_usb2(void)
698{ 698{
699 struct device_node *nec; 699 struct device_node *nec;
700 700
701 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { 701 for_each_node_by_name(nec, "usb") {
702 struct pci_controller *hose; 702 struct pci_controller *hose;
703 u32 data; 703 u32 data;
704 const u32 *prop; 704 const u32 *prop;
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 5cbd4d67d5c4..af094ae03dbb 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -577,7 +577,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
577 int ok; 577 int ok;
578 578
579 /* Look for the clock chip */ 579 /* Look for the clock chip */
580 while ((cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL) { 580 for_each_node_by_name(cc, "i2c-hwclock") {
581 p = of_get_parent(cc); 581 p = of_get_parent(cc);
582 ok = p && of_device_is_compatible(p, "uni-n-i2c"); 582 ok = p && of_device_is_compatible(p, "uni-n-i2c");
583 of_node_put(p); 583 of_node_put(p);
diff --git a/arch/powerpc/platforms/powermac/udbg_adb.c b/arch/powerpc/platforms/powermac/udbg_adb.c
index 44e0b55a2a02..366bd221edec 100644
--- a/arch/powerpc/platforms/powermac/udbg_adb.c
+++ b/arch/powerpc/platforms/powermac/udbg_adb.c
@@ -191,7 +191,7 @@ int __init udbg_adb_init(int force_btext)
191 * of type "adb". If not, we return a failure, but we keep the 191 * of type "adb". If not, we return a failure, but we keep the
192 * bext output set for now 192 * bext output set for now
193 */ 193 */
194 for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) { 194 for_each_node_by_name(np, "keyboard") {
195 struct device_node *parent = of_get_parent(np); 195 struct device_node *parent = of_get_parent(np);
196 int found = (parent && strcmp(parent->type, "adb") == 0); 196 int found = (parent && strcmp(parent->type, "adb") == 0);
197 of_node_put(parent); 197 of_node_put(parent);
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index 4ad227d04c1a..f241accc053d 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -1,10 +1,11 @@
1obj-y += setup.o opal-wrappers.o opal.o opal-async.o 1obj-y += setup.o opal-wrappers.o opal.o opal-async.o
2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o 2obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
3obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o 3obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
4obj-y += opal-msglog.o 4obj-y += opal-msglog.o opal-hmi.o
5 5
6obj-$(CONFIG_SMP) += smp.o subcore.o subcore-asm.o 6obj-$(CONFIG_SMP) += smp.o subcore.o subcore-asm.o
7obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o 7obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
8obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o 8obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o
9obj-$(CONFIG_PPC_SCOM) += opal-xscom.o 9obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
10obj-$(CONFIG_MEMORY_FAILURE) += opal-memory-errors.o 10obj-$(CONFIG_MEMORY_FAILURE) += opal-memory-errors.o
11obj-$(CONFIG_TRACEPOINTS) += opal-tracepoints.o
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 8ad0c5b891f4..c945bed4dc9e 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -187,10 +187,10 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
187 */ 187 */
188static int ioda_eeh_set_option(struct eeh_pe *pe, int option) 188static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
189{ 189{
190 s64 ret;
191 u32 pe_no;
192 struct pci_controller *hose = pe->phb; 190 struct pci_controller *hose = pe->phb;
193 struct pnv_phb *phb = hose->private_data; 191 struct pnv_phb *phb = hose->private_data;
192 int enable, ret = 0;
193 s64 rc;
194 194
195 /* Check on PE number */ 195 /* Check on PE number */
196 if (pe->addr < 0 || pe->addr >= phb->ioda.total_pe) { 196 if (pe->addr < 0 || pe->addr >= phb->ioda.total_pe) {
@@ -201,184 +201,214 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
201 return -EINVAL; 201 return -EINVAL;
202 } 202 }
203 203
204 pe_no = pe->addr;
205 switch (option) { 204 switch (option) {
206 case EEH_OPT_DISABLE: 205 case EEH_OPT_DISABLE:
207 ret = -EEXIST; 206 return -EPERM;
208 break;
209 case EEH_OPT_ENABLE: 207 case EEH_OPT_ENABLE:
210 ret = 0; 208 return 0;
211 break;
212 case EEH_OPT_THAW_MMIO: 209 case EEH_OPT_THAW_MMIO:
213 ret = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no, 210 enable = OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO;
214 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO);
215 if (ret) {
216 pr_warning("%s: Failed to enable MMIO for "
217 "PHB#%x-PE#%x, err=%lld\n",
218 __func__, hose->global_number, pe_no, ret);
219 return -EIO;
220 }
221
222 break; 211 break;
223 case EEH_OPT_THAW_DMA: 212 case EEH_OPT_THAW_DMA:
224 ret = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no, 213 enable = OPAL_EEH_ACTION_CLEAR_FREEZE_DMA;
225 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA);
226 if (ret) {
227 pr_warning("%s: Failed to enable DMA for "
228 "PHB#%x-PE#%x, err=%lld\n",
229 __func__, hose->global_number, pe_no, ret);
230 return -EIO;
231 }
232
233 break; 214 break;
234 default: 215 default:
235 pr_warning("%s: Invalid option %d\n", __func__, option); 216 pr_warn("%s: Invalid option %d\n",
217 __func__, option);
236 return -EINVAL; 218 return -EINVAL;
237 } 219 }
238 220
221 /* If PHB supports compound PE, to handle it */
222 if (phb->unfreeze_pe) {
223 ret = phb->unfreeze_pe(phb, pe->addr, enable);
224 } else {
225 rc = opal_pci_eeh_freeze_clear(phb->opal_id,
226 pe->addr,
227 enable);
228 if (rc != OPAL_SUCCESS) {
229 pr_warn("%s: Failure %lld enable %d for PHB#%x-PE#%x\n",
230 __func__, rc, option, phb->hose->global_number,
231 pe->addr);
232 ret = -EIO;
233 }
234 }
235
239 return ret; 236 return ret;
240} 237}
241 238
242static void ioda_eeh_phb_diag(struct pci_controller *hose) 239static void ioda_eeh_phb_diag(struct eeh_pe *pe)
243{ 240{
244 struct pnv_phb *phb = hose->private_data; 241 struct pnv_phb *phb = pe->phb->private_data;
245 long rc; 242 long rc;
246 243
247 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, 244 rc = opal_pci_get_phb_diag_data2(phb->opal_id, pe->data,
248 PNV_PCI_DIAG_BUF_SIZE); 245 PNV_PCI_DIAG_BUF_SIZE);
249 if (rc != OPAL_SUCCESS) { 246 if (rc != OPAL_SUCCESS)
250 pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", 247 pr_warn("%s: Failed to get diag-data for PHB#%x (%ld)\n",
251 __func__, hose->global_number, rc); 248 __func__, pe->phb->global_number, rc);
252 return;
253 }
254
255 pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);
256} 249}
257 250
258/** 251static int ioda_eeh_get_phb_state(struct eeh_pe *pe)
259 * ioda_eeh_get_state - Retrieve the state of PE
260 * @pe: EEH PE
261 *
262 * The PE's state should be retrieved from the PEEV, PEST
263 * IODA tables. Since the OPAL has exported the function
264 * to do it, it'd better to use that.
265 */
266static int ioda_eeh_get_state(struct eeh_pe *pe)
267{ 252{
268 s64 ret = 0; 253 struct pnv_phb *phb = pe->phb->private_data;
269 u8 fstate; 254 u8 fstate;
270 __be16 pcierr; 255 __be16 pcierr;
271 u32 pe_no; 256 s64 rc;
272 int result; 257 int result = 0;
273 struct pci_controller *hose = pe->phb; 258
274 struct pnv_phb *phb = hose->private_data; 259 rc = opal_pci_eeh_freeze_status(phb->opal_id,
260 pe->addr,
261 &fstate,
262 &pcierr,
263 NULL);
264 if (rc != OPAL_SUCCESS) {
265 pr_warn("%s: Failure %lld getting PHB#%x state\n",
266 __func__, rc, phb->hose->global_number);
267 return EEH_STATE_NOT_SUPPORT;
268 }
275 269
276 /* 270 /*
277 * Sanity check on PE address. The PHB PE address should 271 * Check PHB state. If the PHB is frozen for the
278 * be zero. 272 * first time, to dump the PHB diag-data.
279 */ 273 */
280 if (pe->addr < 0 || pe->addr >= phb->ioda.total_pe) { 274 if (be16_to_cpu(pcierr) != OPAL_EEH_PHB_ERROR) {
281 pr_err("%s: PE address %x out of range [0, %x] " 275 result = (EEH_STATE_MMIO_ACTIVE |
282 "on PHB#%x\n", 276 EEH_STATE_DMA_ACTIVE |
283 __func__, pe->addr, phb->ioda.total_pe, 277 EEH_STATE_MMIO_ENABLED |
284 hose->global_number); 278 EEH_STATE_DMA_ENABLED);
285 return EEH_STATE_NOT_SUPPORT; 279 } else if (!(pe->state & EEH_PE_ISOLATED)) {
280 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
281 ioda_eeh_phb_diag(pe);
286 } 282 }
287 283
284 return result;
285}
286
287static int ioda_eeh_get_pe_state(struct eeh_pe *pe)
288{
289 struct pnv_phb *phb = pe->phb->private_data;
290 u8 fstate;
291 __be16 pcierr;
292 s64 rc;
293 int result;
294
288 /* 295 /*
289 * If we're in middle of PE reset, return normal 296 * We don't clobber hardware frozen state until PE
290 * state to keep EEH core going. For PHB reset, we 297 * reset is completed. In order to keep EEH core
291 * still expect to have fenced PHB cleared with 298 * moving forward, we have to return operational
292 * PHB reset. 299 * state during PE reset.
293 */ 300 */
294 if (!(pe->type & EEH_PE_PHB) && 301 if (pe->state & EEH_PE_RESET) {
295 (pe->state & EEH_PE_RESET)) { 302 result = (EEH_STATE_MMIO_ACTIVE |
296 result = (EEH_STATE_MMIO_ACTIVE | 303 EEH_STATE_DMA_ACTIVE |
297 EEH_STATE_DMA_ACTIVE |
298 EEH_STATE_MMIO_ENABLED | 304 EEH_STATE_MMIO_ENABLED |
299 EEH_STATE_DMA_ENABLED); 305 EEH_STATE_DMA_ENABLED);
300 return result; 306 return result;
301 } 307 }
302 308
303 /* Retrieve PE status through OPAL */ 309 /*
304 pe_no = pe->addr; 310 * Fetch PE state from hardware. If the PHB
305 ret = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, 311 * supports compound PE, let it handle that.
306 &fstate, &pcierr, NULL); 312 */
307 if (ret) { 313 if (phb->get_pe_state) {
308 pr_err("%s: Failed to get EEH status on " 314 fstate = phb->get_pe_state(phb, pe->addr);
309 "PHB#%x-PE#%x\n, err=%lld\n", 315 } else {
310 __func__, hose->global_number, pe_no, ret); 316 rc = opal_pci_eeh_freeze_status(phb->opal_id,
311 return EEH_STATE_NOT_SUPPORT; 317 pe->addr,
312 } 318 &fstate,
313 319 &pcierr,
314 /* Check PHB status */ 320 NULL);
315 if (pe->type & EEH_PE_PHB) { 321 if (rc != OPAL_SUCCESS) {
316 result = 0; 322 pr_warn("%s: Failure %lld getting PHB#%x-PE%x state\n",
317 result &= ~EEH_STATE_RESET_ACTIVE; 323 __func__, rc, phb->hose->global_number, pe->addr);
318 324 return EEH_STATE_NOT_SUPPORT;
319 if (be16_to_cpu(pcierr) != OPAL_EEH_PHB_ERROR) {
320 result |= EEH_STATE_MMIO_ACTIVE;
321 result |= EEH_STATE_DMA_ACTIVE;
322 result |= EEH_STATE_MMIO_ENABLED;
323 result |= EEH_STATE_DMA_ENABLED;
324 } else if (!(pe->state & EEH_PE_ISOLATED)) {
325 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
326 ioda_eeh_phb_diag(hose);
327 } 325 }
328
329 return result;
330 } 326 }
331 327
332 /* Parse result out */ 328 /* Figure out state */
333 result = 0;
334 switch (fstate) { 329 switch (fstate) {
335 case OPAL_EEH_STOPPED_NOT_FROZEN: 330 case OPAL_EEH_STOPPED_NOT_FROZEN:
336 result &= ~EEH_STATE_RESET_ACTIVE; 331 result = (EEH_STATE_MMIO_ACTIVE |
337 result |= EEH_STATE_MMIO_ACTIVE; 332 EEH_STATE_DMA_ACTIVE |
338 result |= EEH_STATE_DMA_ACTIVE; 333 EEH_STATE_MMIO_ENABLED |
339 result |= EEH_STATE_MMIO_ENABLED; 334 EEH_STATE_DMA_ENABLED);
340 result |= EEH_STATE_DMA_ENABLED;
341 break; 335 break;
342 case OPAL_EEH_STOPPED_MMIO_FREEZE: 336 case OPAL_EEH_STOPPED_MMIO_FREEZE:
343 result &= ~EEH_STATE_RESET_ACTIVE; 337 result = (EEH_STATE_DMA_ACTIVE |
344 result |= EEH_STATE_DMA_ACTIVE; 338 EEH_STATE_DMA_ENABLED);
345 result |= EEH_STATE_DMA_ENABLED;
346 break; 339 break;
347 case OPAL_EEH_STOPPED_DMA_FREEZE: 340 case OPAL_EEH_STOPPED_DMA_FREEZE:
348 result &= ~EEH_STATE_RESET_ACTIVE; 341 result = (EEH_STATE_MMIO_ACTIVE |
349 result |= EEH_STATE_MMIO_ACTIVE; 342 EEH_STATE_MMIO_ENABLED);
350 result |= EEH_STATE_MMIO_ENABLED;
351 break; 343 break;
352 case OPAL_EEH_STOPPED_MMIO_DMA_FREEZE: 344 case OPAL_EEH_STOPPED_MMIO_DMA_FREEZE:
353 result &= ~EEH_STATE_RESET_ACTIVE; 345 result = 0;
354 break; 346 break;
355 case OPAL_EEH_STOPPED_RESET: 347 case OPAL_EEH_STOPPED_RESET:
356 result |= EEH_STATE_RESET_ACTIVE; 348 result = EEH_STATE_RESET_ACTIVE;
357 break; 349 break;
358 case OPAL_EEH_STOPPED_TEMP_UNAVAIL: 350 case OPAL_EEH_STOPPED_TEMP_UNAVAIL:
359 result |= EEH_STATE_UNAVAILABLE; 351 result = EEH_STATE_UNAVAILABLE;
360 break; 352 break;
361 case OPAL_EEH_STOPPED_PERM_UNAVAIL: 353 case OPAL_EEH_STOPPED_PERM_UNAVAIL:
362 result |= EEH_STATE_NOT_SUPPORT; 354 result = EEH_STATE_NOT_SUPPORT;
363 break; 355 break;
364 default: 356 default:
365 pr_warning("%s: Unexpected EEH status 0x%x " 357 result = EEH_STATE_NOT_SUPPORT;
366 "on PHB#%x-PE#%x\n", 358 pr_warn("%s: Invalid PHB#%x-PE#%x state %x\n",
367 __func__, fstate, hose->global_number, pe_no); 359 __func__, phb->hose->global_number,
360 pe->addr, fstate);
368 } 361 }
369 362
370 /* Dump PHB diag-data for frozen PE */ 363 /*
371 if (result != EEH_STATE_NOT_SUPPORT && 364 * If PHB supports compound PE, to freeze all
372 (result & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) != 365 * slave PEs for consistency.
373 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE) && 366 *
367 * If the PE is switching to frozen state for the
368 * first time, to dump the PHB diag-data.
369 */
370 if (!(result & EEH_STATE_NOT_SUPPORT) &&
371 !(result & EEH_STATE_UNAVAILABLE) &&
372 !(result & EEH_STATE_MMIO_ACTIVE) &&
373 !(result & EEH_STATE_DMA_ACTIVE) &&
374 !(pe->state & EEH_PE_ISOLATED)) { 374 !(pe->state & EEH_PE_ISOLATED)) {
375 if (phb->freeze_pe)
376 phb->freeze_pe(phb, pe->addr);
377
375 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 378 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
376 ioda_eeh_phb_diag(hose); 379 ioda_eeh_phb_diag(pe);
377 } 380 }
378 381
379 return result; 382 return result;
380} 383}
381 384
385/**
386 * ioda_eeh_get_state - Retrieve the state of PE
387 * @pe: EEH PE
388 *
389 * The PE's state should be retrieved from the PEEV, PEST
390 * IODA tables. Since the OPAL has exported the function
391 * to do it, it'd better to use that.
392 */
393static int ioda_eeh_get_state(struct eeh_pe *pe)
394{
395 struct pnv_phb *phb = pe->phb->private_data;
396
397 /* Sanity check on PE number. PHB PE should have 0 */
398 if (pe->addr < 0 ||
399 pe->addr >= phb->ioda.total_pe) {
400 pr_warn("%s: PHB#%x-PE#%x out of range [0, %x]\n",
401 __func__, phb->hose->global_number,
402 pe->addr, phb->ioda.total_pe);
403 return EEH_STATE_NOT_SUPPORT;
404 }
405
406 if (pe->type & EEH_PE_PHB)
407 return ioda_eeh_get_phb_state(pe);
408
409 return ioda_eeh_get_pe_state(pe);
410}
411
382static s64 ioda_eeh_phb_poll(struct pnv_phb *phb) 412static s64 ioda_eeh_phb_poll(struct pnv_phb *phb)
383{ 413{
384 s64 rc = OPAL_HARDWARE; 414 s64 rc = OPAL_HARDWARE;
@@ -589,6 +619,24 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
589} 619}
590 620
591/** 621/**
622 * ioda_eeh_get_log - Retrieve error log
623 * @pe: frozen PE
624 * @severity: permanent or temporary error
625 * @drv_log: device driver log
626 * @len: length of device driver log
627 *
628 * Retrieve error log, which contains log from device driver
629 * and firmware.
630 */
631int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
632 char *drv_log, unsigned long len)
633{
634 pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
635
636 return 0;
637}
638
639/**
592 * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE 640 * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE
593 * @pe: EEH PE 641 * @pe: EEH PE
594 * 642 *
@@ -605,18 +653,24 @@ static int ioda_eeh_configure_bridge(struct eeh_pe *pe)
605static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data) 653static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
606{ 654{
607 /* GEM */ 655 /* GEM */
608 pr_info(" GEM XFIR: %016llx\n", data->gemXfir); 656 if (data->gemXfir || data->gemRfir ||
609 pr_info(" GEM RFIR: %016llx\n", data->gemRfir); 657 data->gemRirqfir || data->gemMask || data->gemRwof)
610 pr_info(" GEM RIRQFIR: %016llx\n", data->gemRirqfir); 658 pr_info(" GEM: %016llx %016llx %016llx %016llx %016llx\n",
611 pr_info(" GEM Mask: %016llx\n", data->gemMask); 659 be64_to_cpu(data->gemXfir),
612 pr_info(" GEM RWOF: %016llx\n", data->gemRwof); 660 be64_to_cpu(data->gemRfir),
661 be64_to_cpu(data->gemRirqfir),
662 be64_to_cpu(data->gemMask),
663 be64_to_cpu(data->gemRwof));
613 664
614 /* LEM */ 665 /* LEM */
615 pr_info(" LEM FIR: %016llx\n", data->lemFir); 666 if (data->lemFir || data->lemErrMask ||
616 pr_info(" LEM Error Mask: %016llx\n", data->lemErrMask); 667 data->lemAction0 || data->lemAction1 || data->lemWof)
617 pr_info(" LEM Action 0: %016llx\n", data->lemAction0); 668 pr_info(" LEM: %016llx %016llx %016llx %016llx %016llx\n",
618 pr_info(" LEM Action 1: %016llx\n", data->lemAction1); 669 be64_to_cpu(data->lemFir),
619 pr_info(" LEM WOF: %016llx\n", data->lemWof); 670 be64_to_cpu(data->lemErrMask),
671 be64_to_cpu(data->lemAction0),
672 be64_to_cpu(data->lemAction1),
673 be64_to_cpu(data->lemWof));
620} 674}
621 675
622static void ioda_eeh_hub_diag(struct pci_controller *hose) 676static void ioda_eeh_hub_diag(struct pci_controller *hose)
@@ -627,8 +681,8 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose)
627 681
628 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data)); 682 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data));
629 if (rc != OPAL_SUCCESS) { 683 if (rc != OPAL_SUCCESS) {
630 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n", 684 pr_warn("%s: Failed to get HUB#%llx diag-data (%ld)\n",
631 __func__, phb->hub_id, rc); 685 __func__, phb->hub_id, rc);
632 return; 686 return;
633 } 687 }
634 688
@@ -636,24 +690,31 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose)
636 case OPAL_P7IOC_DIAG_TYPE_RGC: 690 case OPAL_P7IOC_DIAG_TYPE_RGC:
637 pr_info("P7IOC diag-data for RGC\n\n"); 691 pr_info("P7IOC diag-data for RGC\n\n");
638 ioda_eeh_hub_diag_common(data); 692 ioda_eeh_hub_diag_common(data);
639 pr_info(" RGC Status: %016llx\n", data->rgc.rgcStatus); 693 if (data->rgc.rgcStatus || data->rgc.rgcLdcp)
640 pr_info(" RGC LDCP: %016llx\n", data->rgc.rgcLdcp); 694 pr_info(" RGC: %016llx %016llx\n",
695 be64_to_cpu(data->rgc.rgcStatus),
696 be64_to_cpu(data->rgc.rgcLdcp));
641 break; 697 break;
642 case OPAL_P7IOC_DIAG_TYPE_BI: 698 case OPAL_P7IOC_DIAG_TYPE_BI:
643 pr_info("P7IOC diag-data for BI %s\n\n", 699 pr_info("P7IOC diag-data for BI %s\n\n",
644 data->bi.biDownbound ? "Downbound" : "Upbound"); 700 data->bi.biDownbound ? "Downbound" : "Upbound");
645 ioda_eeh_hub_diag_common(data); 701 ioda_eeh_hub_diag_common(data);
646 pr_info(" BI LDCP 0: %016llx\n", data->bi.biLdcp0); 702 if (data->bi.biLdcp0 || data->bi.biLdcp1 ||
647 pr_info(" BI LDCP 1: %016llx\n", data->bi.biLdcp1); 703 data->bi.biLdcp2 || data->bi.biFenceStatus)
648 pr_info(" BI LDCP 2: %016llx\n", data->bi.biLdcp2); 704 pr_info(" BI: %016llx %016llx %016llx %016llx\n",
649 pr_info(" BI Fence Status: %016llx\n", data->bi.biFenceStatus); 705 be64_to_cpu(data->bi.biLdcp0),
706 be64_to_cpu(data->bi.biLdcp1),
707 be64_to_cpu(data->bi.biLdcp2),
708 be64_to_cpu(data->bi.biFenceStatus));
650 break; 709 break;
651 case OPAL_P7IOC_DIAG_TYPE_CI: 710 case OPAL_P7IOC_DIAG_TYPE_CI:
652 pr_info("P7IOC diag-data for CI Port %d\\nn", 711 pr_info("P7IOC diag-data for CI Port %d\n\n",
653 data->ci.ciPort); 712 data->ci.ciPort);
654 ioda_eeh_hub_diag_common(data); 713 ioda_eeh_hub_diag_common(data);
655 pr_info(" CI Port Status: %016llx\n", data->ci.ciPortStatus); 714 if (data->ci.ciPortStatus || data->ci.ciPortLdcp)
656 pr_info(" CI Port LDCP: %016llx\n", data->ci.ciPortLdcp); 715 pr_info(" CI: %016llx %016llx\n",
716 be64_to_cpu(data->ci.ciPortStatus),
717 be64_to_cpu(data->ci.ciPortLdcp));
657 break; 718 break;
658 case OPAL_P7IOC_DIAG_TYPE_MISC: 719 case OPAL_P7IOC_DIAG_TYPE_MISC:
659 pr_info("P7IOC diag-data for MISC\n\n"); 720 pr_info("P7IOC diag-data for MISC\n\n");
@@ -664,30 +725,51 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose)
664 ioda_eeh_hub_diag_common(data); 725 ioda_eeh_hub_diag_common(data);
665 break; 726 break;
666 default: 727 default:
667 pr_warning("%s: Invalid type of HUB#%llx diag-data (%d)\n", 728 pr_warn("%s: Invalid type of HUB#%llx diag-data (%d)\n",
668 __func__, phb->hub_id, data->type); 729 __func__, phb->hub_id, data->type);
669 } 730 }
670} 731}
671 732
672static int ioda_eeh_get_pe(struct pci_controller *hose, 733static int ioda_eeh_get_pe(struct pci_controller *hose,
673 u16 pe_no, struct eeh_pe **pe) 734 u16 pe_no, struct eeh_pe **pe)
674{ 735{
675 struct eeh_pe *phb_pe, *dev_pe; 736 struct pnv_phb *phb = hose->private_data;
676 struct eeh_dev dev; 737 struct pnv_ioda_pe *pnv_pe;
738 struct eeh_pe *dev_pe;
739 struct eeh_dev edev;
677 740
678 /* Find the PHB PE */ 741 /*
679 phb_pe = eeh_phb_pe_get(hose); 742 * If PHB supports compound PE, to fetch
680 if (!phb_pe) 743 * the master PE because slave PE is invisible
681 return -EEXIST; 744 * to EEH core.
745 */
746 if (phb->get_pe_state) {
747 pnv_pe = &phb->ioda.pe_array[pe_no];
748 if (pnv_pe->flags & PNV_IODA_PE_SLAVE) {
749 pnv_pe = pnv_pe->master;
750 WARN_ON(!pnv_pe ||
751 !(pnv_pe->flags & PNV_IODA_PE_MASTER));
752 pe_no = pnv_pe->pe_number;
753 }
754 }
682 755
683 /* Find the PE according to PE# */ 756 /* Find the PE according to PE# */
684 memset(&dev, 0, sizeof(struct eeh_dev)); 757 memset(&edev, 0, sizeof(struct eeh_dev));
685 dev.phb = hose; 758 edev.phb = hose;
686 dev.pe_config_addr = pe_no; 759 edev.pe_config_addr = pe_no;
687 dev_pe = eeh_pe_get(&dev); 760 dev_pe = eeh_pe_get(&edev);
688 if (!dev_pe) return -EEXIST; 761 if (!dev_pe)
762 return -EEXIST;
689 763
764 /*
765 * At this point, we're sure the compound PE should
766 * be put into frozen state.
767 */
690 *pe = dev_pe; 768 *pe = dev_pe;
769 if (phb->freeze_pe &&
770 !(dev_pe->state & EEH_PE_ISOLATED))
771 phb->freeze_pe(phb, pe_no);
772
691 return 0; 773 return 0;
692} 774}
693 775
@@ -792,7 +874,8 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
792 "detected, location: %s\n", 874 "detected, location: %s\n",
793 hose->global_number, 875 hose->global_number,
794 eeh_pe_loc_get(phb_pe)); 876 eeh_pe_loc_get(phb_pe));
795 ioda_eeh_phb_diag(hose); 877 ioda_eeh_phb_diag(phb_pe);
878 pnv_pci_dump_phb_diag_data(hose, phb_pe->data);
796 ret = EEH_NEXT_ERR_NONE; 879 ret = EEH_NEXT_ERR_NONE;
797 } 880 }
798 881
@@ -812,7 +895,8 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
812 opal_pci_eeh_freeze_clear(phb->opal_id, frozen_pe_no, 895 opal_pci_eeh_freeze_clear(phb->opal_id, frozen_pe_no,
813 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); 896 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
814 ret = EEH_NEXT_ERR_NONE; 897 ret = EEH_NEXT_ERR_NONE;
815 } else if ((*pe)->state & EEH_PE_ISOLATED) { 898 } else if ((*pe)->state & EEH_PE_ISOLATED ||
899 eeh_pe_passed(*pe)) {
816 ret = EEH_NEXT_ERR_NONE; 900 ret = EEH_NEXT_ERR_NONE;
817 } else { 901 } else {
818 pr_err("EEH: Frozen PE#%x on PHB#%x detected\n", 902 pr_err("EEH: Frozen PE#%x on PHB#%x detected\n",
@@ -839,7 +923,7 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
839 ret == EEH_NEXT_ERR_FENCED_PHB) && 923 ret == EEH_NEXT_ERR_FENCED_PHB) &&
840 !((*pe)->state & EEH_PE_ISOLATED)) { 924 !((*pe)->state & EEH_PE_ISOLATED)) {
841 eeh_pe_state_mark(*pe, EEH_PE_ISOLATED); 925 eeh_pe_state_mark(*pe, EEH_PE_ISOLATED);
842 ioda_eeh_phb_diag(hose); 926 ioda_eeh_phb_diag(*pe);
843 } 927 }
844 928
845 /* 929 /*
@@ -885,6 +969,7 @@ struct pnv_eeh_ops ioda_eeh_ops = {
885 .set_option = ioda_eeh_set_option, 969 .set_option = ioda_eeh_set_option,
886 .get_state = ioda_eeh_get_state, 970 .get_state = ioda_eeh_get_state,
887 .reset = ioda_eeh_reset, 971 .reset = ioda_eeh_reset,
972 .get_log = ioda_eeh_get_log,
888 .configure_bridge = ioda_eeh_configure_bridge, 973 .configure_bridge = ioda_eeh_configure_bridge,
889 .next_error = ioda_eeh_next_error 974 .next_error = ioda_eeh_next_error
890}; 975};
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 56a206f32f77..fd7a16f855ed 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -45,14 +45,31 @@
45 */ 45 */
46static int powernv_eeh_init(void) 46static int powernv_eeh_init(void)
47{ 47{
48 struct pci_controller *hose;
49 struct pnv_phb *phb;
50
48 /* We require OPALv3 */ 51 /* We require OPALv3 */
49 if (!firmware_has_feature(FW_FEATURE_OPALv3)) { 52 if (!firmware_has_feature(FW_FEATURE_OPALv3)) {
50 pr_warning("%s: OPALv3 is required !\n", __func__); 53 pr_warn("%s: OPALv3 is required !\n",
54 __func__);
51 return -EINVAL; 55 return -EINVAL;
52 } 56 }
53 57
54 /* Set EEH probe mode */ 58 /* Set probe mode */
55 eeh_probe_mode_set(EEH_PROBE_MODE_DEV); 59 eeh_add_flag(EEH_PROBE_MODE_DEV);
60
61 /*
62 * P7IOC blocks PCI config access to frozen PE, but PHB3
63 * doesn't do that. So we have to selectively enable I/O
64 * prior to collecting error log.
65 */
66 list_for_each_entry(hose, &hose_list, list_node) {
67 phb = hose->private_data;
68
69 if (phb->model == PNV_PHB_MODEL_P7IOC)
70 eeh_add_flag(EEH_ENABLE_IO_FOR_LOG);
71 break;
72 }
56 73
57 return 0; 74 return 0;
58} 75}
@@ -107,6 +124,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
107 struct pnv_phb *phb = hose->private_data; 124 struct pnv_phb *phb = hose->private_data;
108 struct device_node *dn = pci_device_to_OF_node(dev); 125 struct device_node *dn = pci_device_to_OF_node(dev);
109 struct eeh_dev *edev = of_node_to_eeh_dev(dn); 126 struct eeh_dev *edev = of_node_to_eeh_dev(dn);
127 int ret;
110 128
111 /* 129 /*
112 * When probing the root bridge, which doesn't have any 130 * When probing the root bridge, which doesn't have any
@@ -143,13 +161,27 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
143 edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff); 161 edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff);
144 162
145 /* Create PE */ 163 /* Create PE */
146 eeh_add_to_parent_pe(edev); 164 ret = eeh_add_to_parent_pe(edev);
165 if (ret) {
166 pr_warn("%s: Can't add PCI dev %s to parent PE (%d)\n",
167 __func__, pci_name(dev), ret);
168 return ret;
169 }
170
171 /*
172 * Cache the PE primary bus, which can't be fetched when
173 * full hotplug is in progress. In that case, all child
174 * PCI devices of the PE are expected to be removed prior
175 * to PE reset.
176 */
177 if (!edev->pe->bus)
178 edev->pe->bus = dev->bus;
147 179
148 /* 180 /*
149 * Enable EEH explicitly so that we will do EEH check 181 * Enable EEH explicitly so that we will do EEH check
150 * while accessing I/O stuff 182 * while accessing I/O stuff
151 */ 183 */
152 eeh_set_enable(true); 184 eeh_add_flag(EEH_ENABLED);
153 185
154 /* Save memory bars */ 186 /* Save memory bars */
155 eeh_save_bars(edev); 187 eeh_save_bars(edev);
@@ -273,8 +305,8 @@ static int powernv_eeh_wait_state(struct eeh_pe *pe, int max_wait)
273 305
274 max_wait -= mwait; 306 max_wait -= mwait;
275 if (max_wait <= 0) { 307 if (max_wait <= 0) {
276 pr_warning("%s: Timeout getting PE#%x's state (%d)\n", 308 pr_warn("%s: Timeout getting PE#%x's state (%d)\n",
277 __func__, pe->addr, max_wait); 309 __func__, pe->addr, max_wait);
278 return EEH_STATE_NOT_SUPPORT; 310 return EEH_STATE_NOT_SUPPORT;
279 } 311 }
280 312
@@ -294,7 +326,7 @@ static int powernv_eeh_wait_state(struct eeh_pe *pe, int max_wait)
294 * Retrieve the temporary or permanent error from the PE. 326 * Retrieve the temporary or permanent error from the PE.
295 */ 327 */
296static int powernv_eeh_get_log(struct eeh_pe *pe, int severity, 328static int powernv_eeh_get_log(struct eeh_pe *pe, int severity,
297 char *drv_log, unsigned long len) 329 char *drv_log, unsigned long len)
298{ 330{
299 struct pci_controller *hose = pe->phb; 331 struct pci_controller *hose = pe->phb;
300 struct pnv_phb *phb = hose->private_data; 332 struct pnv_phb *phb = hose->private_data;
@@ -398,9 +430,7 @@ static int __init eeh_powernv_init(void)
398{ 430{
399 int ret = -EINVAL; 431 int ret = -EINVAL;
400 432
401 if (!machine_is(powernv)) 433 eeh_set_pe_aux_size(PNV_PCI_DIAG_BUF_SIZE);
402 return ret;
403
404 ret = eeh_ops_register(&powernv_eeh_ops); 434 ret = eeh_ops_register(&powernv_eeh_ops);
405 if (!ret) 435 if (!ret)
406 pr_info("EEH: PowerNV platform initialized\n"); 436 pr_info("EEH: PowerNV platform initialized\n");
@@ -409,5 +439,4 @@ static int __init eeh_powernv_init(void)
409 439
410 return ret; 440 return ret;
411} 441}
412 442machine_early_initcall(powernv, eeh_powernv_init);
413early_initcall(eeh_powernv_init);
diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c
index 32e2adfa5320..e462ab947d16 100644
--- a/arch/powerpc/platforms/powernv/opal-async.c
+++ b/arch/powerpc/platforms/powernv/opal-async.c
@@ -20,6 +20,7 @@
20#include <linux/wait.h> 20#include <linux/wait.h>
21#include <linux/gfp.h> 21#include <linux/gfp.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <asm/machdep.h>
23#include <asm/opal.h> 24#include <asm/opal.h>
24 25
25#define N_ASYNC_COMPLETIONS 64 26#define N_ASYNC_COMPLETIONS 64
@@ -201,4 +202,4 @@ out_opal_node:
201out: 202out:
202 return err; 203 return err;
203} 204}
204subsys_initcall(opal_async_comp_init); 205machine_subsys_initcall(powernv, opal_async_comp_init);
diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 788a1977b9a5..85bb8fff7947 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -102,9 +102,9 @@ static ssize_t dump_ack_store(struct dump_obj *dump_obj,
102 * due to the dynamic size of the dump 102 * due to the dynamic size of the dump
103 */ 103 */
104static struct dump_attribute id_attribute = 104static struct dump_attribute id_attribute =
105 __ATTR(id, 0666, dump_id_show, NULL); 105 __ATTR(id, S_IRUGO, dump_id_show, NULL);
106static struct dump_attribute type_attribute = 106static struct dump_attribute type_attribute =
107 __ATTR(type, 0666, dump_type_show, NULL); 107 __ATTR(type, S_IRUGO, dump_type_show, NULL);
108static struct dump_attribute ack_attribute = 108static struct dump_attribute ack_attribute =
109 __ATTR(acknowledge, 0660, dump_ack_show, dump_ack_store); 109 __ATTR(acknowledge, 0660, dump_ack_show, dump_ack_store);
110 110
diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index 0ad533b617f7..bbdb3ffaab98 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -82,9 +82,9 @@ static ssize_t elog_ack_store(struct elog_obj *elog_obj,
82} 82}
83 83
84static struct elog_attribute id_attribute = 84static struct elog_attribute id_attribute =
85 __ATTR(id, 0666, elog_id_show, NULL); 85 __ATTR(id, S_IRUGO, elog_id_show, NULL);
86static struct elog_attribute type_attribute = 86static struct elog_attribute type_attribute =
87 __ATTR(type, 0666, elog_type_show, NULL); 87 __ATTR(type, S_IRUGO, elog_type_show, NULL);
88static struct elog_attribute ack_attribute = 88static struct elog_attribute ack_attribute =
89 __ATTR(acknowledge, 0660, elog_ack_show, elog_ack_store); 89 __ATTR(acknowledge, 0660, elog_ack_show, elog_ack_store);
90 90
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c
new file mode 100644
index 000000000000..97ac8dc33667
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-hmi.c
@@ -0,0 +1,188 @@
1/*
2 * OPAL hypervisor Maintenance interrupt handling support in PowreNV.
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 * Copyright 2014 IBM Corporation
18 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
19 */
20
21#undef DEBUG
22
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/of.h>
26#include <linux/mm.h>
27#include <linux/slab.h>
28
29#include <asm/opal.h>
30#include <asm/cputable.h>
31
32static int opal_hmi_handler_nb_init;
33struct OpalHmiEvtNode {
34 struct list_head list;
35 struct OpalHMIEvent hmi_evt;
36};
37static LIST_HEAD(opal_hmi_evt_list);
38static DEFINE_SPINLOCK(opal_hmi_evt_lock);
39
40static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt)
41{
42 const char *level, *sevstr, *error_info;
43 static const char *hmi_error_types[] = {
44 "Malfunction Alert",
45 "Processor Recovery done",
46 "Processor recovery occurred again",
47 "Processor recovery occurred for masked error",
48 "Timer facility experienced an error",
49 "TFMR SPR is corrupted",
50 "UPS (Uniterrupted Power System) Overflow indication",
51 "An XSCOM operation failure",
52 "An XSCOM operation completed",
53 "SCOM has set a reserved FIR bit to cause recovery",
54 "Debug trigger has set a reserved FIR bit to cause recovery",
55 "A hypervisor resource error occurred"
56 };
57
58 /* Print things out */
59 if (hmi_evt->version != OpalHMIEvt_V1) {
60 pr_err("HMI Interrupt, Unknown event version %d !\n",
61 hmi_evt->version);
62 return;
63 }
64 switch (hmi_evt->severity) {
65 case OpalHMI_SEV_NO_ERROR:
66 level = KERN_INFO;
67 sevstr = "Harmless";
68 break;
69 case OpalHMI_SEV_WARNING:
70 level = KERN_WARNING;
71 sevstr = "";
72 break;
73 case OpalHMI_SEV_ERROR_SYNC:
74 level = KERN_ERR;
75 sevstr = "Severe";
76 break;
77 case OpalHMI_SEV_FATAL:
78 default:
79 level = KERN_ERR;
80 sevstr = "Fatal";
81 break;
82 }
83
84 printk("%s%s Hypervisor Maintenance interrupt [%s]\n",
85 level, sevstr,
86 hmi_evt->disposition == OpalHMI_DISPOSITION_RECOVERED ?
87 "Recovered" : "Not recovered");
88 error_info = hmi_evt->type < ARRAY_SIZE(hmi_error_types) ?
89 hmi_error_types[hmi_evt->type]
90 : "Unknown";
91 printk("%s Error detail: %s\n", level, error_info);
92 printk("%s HMER: %016llx\n", level, be64_to_cpu(hmi_evt->hmer));
93 if ((hmi_evt->type == OpalHMI_ERROR_TFAC) ||
94 (hmi_evt->type == OpalHMI_ERROR_TFMR_PARITY))
95 printk("%s TFMR: %016llx\n", level,
96 be64_to_cpu(hmi_evt->tfmr));
97}
98
99static void hmi_event_handler(struct work_struct *work)
100{
101 unsigned long flags;
102 struct OpalHMIEvent *hmi_evt;
103 struct OpalHmiEvtNode *msg_node;
104 uint8_t disposition;
105
106 spin_lock_irqsave(&opal_hmi_evt_lock, flags);
107 while (!list_empty(&opal_hmi_evt_list)) {
108 msg_node = list_entry(opal_hmi_evt_list.next,
109 struct OpalHmiEvtNode, list);
110 list_del(&msg_node->list);
111 spin_unlock_irqrestore(&opal_hmi_evt_lock, flags);
112
113 hmi_evt = (struct OpalHMIEvent *) &msg_node->hmi_evt;
114 print_hmi_event_info(hmi_evt);
115 disposition = hmi_evt->disposition;
116 kfree(msg_node);
117
118 /*
119 * Check if HMI event has been recovered or not. If not
120 * then we can't continue, invoke panic.
121 */
122 if (disposition != OpalHMI_DISPOSITION_RECOVERED)
123 panic("Unrecoverable HMI exception");
124
125 spin_lock_irqsave(&opal_hmi_evt_lock, flags);
126 }
127 spin_unlock_irqrestore(&opal_hmi_evt_lock, flags);
128}
129
130static DECLARE_WORK(hmi_event_work, hmi_event_handler);
131/*
132 * opal_handle_hmi_event - notifier handler that queues up HMI events
133 * to be preocessed later.
134 */
135static int opal_handle_hmi_event(struct notifier_block *nb,
136 unsigned long msg_type, void *msg)
137{
138 unsigned long flags;
139 struct OpalHMIEvent *hmi_evt;
140 struct opal_msg *hmi_msg = msg;
141 struct OpalHmiEvtNode *msg_node;
142
143 /* Sanity Checks */
144 if (msg_type != OPAL_MSG_HMI_EVT)
145 return 0;
146
147 /* HMI event info starts from param[0] */
148 hmi_evt = (struct OpalHMIEvent *)&hmi_msg->params[0];
149
150 /* Delay the logging of HMI events to workqueue. */
151 msg_node = kzalloc(sizeof(*msg_node), GFP_ATOMIC);
152 if (!msg_node) {
153 pr_err("HMI: out of memory, Opal message event not handled\n");
154 return -ENOMEM;
155 }
156 memcpy(&msg_node->hmi_evt, hmi_evt, sizeof(struct OpalHMIEvent));
157
158 spin_lock_irqsave(&opal_hmi_evt_lock, flags);
159 list_add(&msg_node->list, &opal_hmi_evt_list);
160 spin_unlock_irqrestore(&opal_hmi_evt_lock, flags);
161
162 schedule_work(&hmi_event_work);
163 return 0;
164}
165
166static struct notifier_block opal_hmi_handler_nb = {
167 .notifier_call = opal_handle_hmi_event,
168 .next = NULL,
169 .priority = 0,
170};
171
172static int __init opal_hmi_handler_init(void)
173{
174 int ret;
175
176 if (!opal_hmi_handler_nb_init) {
177 ret = opal_message_notifier_register(
178 OPAL_MSG_HMI_EVT, &opal_hmi_handler_nb);
179 if (ret) {
180 pr_err("%s: Can't register OPAL event notifier (%d)\n",
181 __func__, ret);
182 return ret;
183 }
184 opal_hmi_handler_nb_init = 1;
185 }
186 return 0;
187}
188subsys_initcall(opal_hmi_handler_init);
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index f04b4d8aca5a..ad4b31df779a 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -324,7 +324,7 @@ static int opal_lpc_init_debugfs(void)
324 rc |= opal_lpc_debugfs_create_type(root, "fw", OPAL_LPC_FW); 324 rc |= opal_lpc_debugfs_create_type(root, "fw", OPAL_LPC_FW);
325 return rc; 325 return rc;
326} 326}
327device_initcall(opal_lpc_init_debugfs); 327machine_device_initcall(powernv, opal_lpc_init_debugfs);
328#endif /* CONFIG_DEBUG_FS */ 328#endif /* CONFIG_DEBUG_FS */
329 329
330void opal_lpc_init(void) 330void opal_lpc_init(void)
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
index b17a34b695ef..43db2136dbff 100644
--- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
+++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
@@ -27,6 +27,7 @@
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <asm/machdep.h>
30#include <asm/opal.h> 31#include <asm/opal.h>
31#include <asm/cputable.h> 32#include <asm/cputable.h>
32 33
@@ -143,4 +144,4 @@ static int __init opal_mem_err_init(void)
143 } 144 }
144 return 0; 145 return 0;
145} 146}
146subsys_initcall(opal_mem_err_init); 147machine_subsys_initcall(powernv, opal_mem_err_init);
diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
new file mode 100644
index 000000000000..d8a000a9988b
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
@@ -0,0 +1,84 @@
1#include <linux/percpu.h>
2#include <linux/jump_label.h>
3#include <asm/trace.h>
4
5#ifdef CONFIG_JUMP_LABEL
6struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
7
8void opal_tracepoint_regfunc(void)
9{
10 static_key_slow_inc(&opal_tracepoint_key);
11}
12
13void opal_tracepoint_unregfunc(void)
14{
15 static_key_slow_dec(&opal_tracepoint_key);
16}
17#else
18/*
19 * We optimise OPAL calls by placing opal_tracepoint_refcount
20 * directly in the TOC so we can check if the opal tracepoints are
21 * enabled via a single load.
22 */
23
24/* NB: reg/unreg are called while guarded with the tracepoints_mutex */
25extern long opal_tracepoint_refcount;
26
27void opal_tracepoint_regfunc(void)
28{
29 opal_tracepoint_refcount++;
30}
31
32void opal_tracepoint_unregfunc(void)
33{
34 opal_tracepoint_refcount--;
35}
36#endif
37
38/*
39 * Since the tracing code might execute OPAL calls we need to guard against
40 * recursion.
41 */
42static DEFINE_PER_CPU(unsigned int, opal_trace_depth);
43
44void __trace_opal_entry(unsigned long opcode, unsigned long *args)
45{
46 unsigned long flags;
47 unsigned int *depth;
48
49 local_irq_save(flags);
50
51 depth = &__get_cpu_var(opal_trace_depth);
52
53 if (*depth)
54 goto out;
55
56 (*depth)++;
57 preempt_disable();
58 trace_opal_entry(opcode, args);
59 (*depth)--;
60
61out:
62 local_irq_restore(flags);
63}
64
65void __trace_opal_exit(long opcode, unsigned long retval)
66{
67 unsigned long flags;
68 unsigned int *depth;
69
70 local_irq_save(flags);
71
72 depth = &__get_cpu_var(opal_trace_depth);
73
74 if (*depth)
75 goto out;
76
77 (*depth)++;
78 trace_opal_exit(opcode, retval);
79 preempt_enable();
80 (*depth)--;
81
82out:
83 local_irq_restore(flags);
84}
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 4abbff22a61f..2e6ce1b8dc8f 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -13,30 +13,69 @@
13#include <asm/hvcall.h> 13#include <asm/hvcall.h>
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/opal.h> 15#include <asm/opal.h>
16#include <asm/jump_label.h>
17
18 .section ".text"
19
20#ifdef CONFIG_TRACEPOINTS
21#ifdef CONFIG_JUMP_LABEL
22#define OPAL_BRANCH(LABEL) \
23 ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key)
24#else
25
26 .section ".toc","aw"
27
28 .globl opal_tracepoint_refcount
29opal_tracepoint_refcount:
30 .llong 0
31
32 .section ".text"
33
34/*
35 * We branch around this in early init by using an unconditional cpu
36 * feature.
37 */
38#define OPAL_BRANCH(LABEL) \
39BEGIN_FTR_SECTION; \
40 b 1f; \
41END_FTR_SECTION(0, 1); \
42 ld r12,opal_tracepoint_refcount@toc(r2); \
43 std r12,32(r1); \
44 cmpdi r12,0; \
45 bne- LABEL; \
461:
47
48#endif
49
50#else
51#define OPAL_BRANCH(LABEL)
52#endif
16 53
17/* TODO: 54/* TODO:
18 * 55 *
19 * - Trace irqs in/off (needs saving/restoring all args, argh...) 56 * - Trace irqs in/off (needs saving/restoring all args, argh...)
20 * - Get r11 feed up by Dave so I can have better register usage 57 * - Get r11 feed up by Dave so I can have better register usage
21 */ 58 */
59
22#define OPAL_CALL(name, token) \ 60#define OPAL_CALL(name, token) \
23 _GLOBAL(name); \ 61 _GLOBAL(name); \
24 mflr r0; \ 62 mflr r0; \
25 mfcr r12; \
26 std r0,16(r1); \ 63 std r0,16(r1); \
64 li r0,token; \
65 OPAL_BRANCH(opal_tracepoint_entry) \
66 mfcr r12; \
27 stw r12,8(r1); \ 67 stw r12,8(r1); \
28 std r1,PACAR1(r13); \ 68 std r1,PACAR1(r13); \
29 li r0,0; \ 69 li r11,0; \
30 mfmsr r12; \ 70 mfmsr r12; \
31 ori r0,r0,MSR_EE; \ 71 ori r11,r11,MSR_EE; \
32 std r12,PACASAVEDMSR(r13); \ 72 std r12,PACASAVEDMSR(r13); \
33 andc r12,r12,r0; \ 73 andc r12,r12,r11; \
34 mtmsrd r12,1; \ 74 mtmsrd r12,1; \
35 LOAD_REG_ADDR(r0,opal_return); \ 75 LOAD_REG_ADDR(r11,opal_return); \
36 mtlr r0; \ 76 mtlr r11; \
37 li r0,MSR_DR|MSR_IR|MSR_LE;\ 77 li r11,MSR_DR|MSR_IR|MSR_LE;\
38 andc r12,r12,r0; \ 78 andc r12,r12,r11; \
39 li r0,token; \
40 mtspr SPRN_HSRR1,r12; \ 79 mtspr SPRN_HSRR1,r12; \
41 LOAD_REG_ADDR(r11,opal); \ 80 LOAD_REG_ADDR(r11,opal); \
42 ld r12,8(r11); \ 81 ld r12,8(r11); \
@@ -61,6 +100,64 @@ opal_return:
61 mtcr r4; 100 mtcr r4;
62 rfid 101 rfid
63 102
103#ifdef CONFIG_TRACEPOINTS
104opal_tracepoint_entry:
105 stdu r1,-STACKFRAMESIZE(r1)
106 std r0,STK_REG(R23)(r1)
107 std r3,STK_REG(R24)(r1)
108 std r4,STK_REG(R25)(r1)
109 std r5,STK_REG(R26)(r1)
110 std r6,STK_REG(R27)(r1)
111 std r7,STK_REG(R28)(r1)
112 std r8,STK_REG(R29)(r1)
113 std r9,STK_REG(R30)(r1)
114 std r10,STK_REG(R31)(r1)
115 mr r3,r0
116 addi r4,r1,STK_REG(R24)
117 bl __trace_opal_entry
118 ld r0,STK_REG(R23)(r1)
119 ld r3,STK_REG(R24)(r1)
120 ld r4,STK_REG(R25)(r1)
121 ld r5,STK_REG(R26)(r1)
122 ld r6,STK_REG(R27)(r1)
123 ld r7,STK_REG(R28)(r1)
124 ld r8,STK_REG(R29)(r1)
125 ld r9,STK_REG(R30)(r1)
126 ld r10,STK_REG(R31)(r1)
127 LOAD_REG_ADDR(r11,opal_tracepoint_return)
128 mfcr r12
129 std r11,16(r1)
130 stw r12,8(r1)
131 std r1,PACAR1(r13)
132 li r11,0
133 mfmsr r12
134 ori r11,r11,MSR_EE
135 std r12,PACASAVEDMSR(r13)
136 andc r12,r12,r11
137 mtmsrd r12,1
138 LOAD_REG_ADDR(r11,opal_return)
139 mtlr r11
140 li r11,MSR_DR|MSR_IR|MSR_LE
141 andc r12,r12,r11
142 mtspr SPRN_HSRR1,r12
143 LOAD_REG_ADDR(r11,opal)
144 ld r12,8(r11)
145 ld r2,0(r11)
146 mtspr SPRN_HSRR0,r12
147 hrfid
148
149opal_tracepoint_return:
150 std r3,STK_REG(R31)(r1)
151 mr r4,r3
152 ld r0,STK_REG(R23)(r1)
153 bl __trace_opal_exit
154 ld r3,STK_REG(R31)(r1)
155 addi r1,r1,STACKFRAMESIZE
156 ld r0,16(r1)
157 mtlr r0
158 blr
159#endif
160
64OPAL_CALL(opal_invalid_call, OPAL_INVALID_CALL); 161OPAL_CALL(opal_invalid_call, OPAL_INVALID_CALL);
65OPAL_CALL(opal_console_write, OPAL_CONSOLE_WRITE); 162OPAL_CALL(opal_console_write, OPAL_CONSOLE_WRITE);
66OPAL_CALL(opal_console_read, OPAL_CONSOLE_READ); 163OPAL_CALL(opal_console_read, OPAL_CONSOLE_READ);
@@ -86,6 +183,7 @@ OPAL_CALL(opal_get_xive, OPAL_GET_XIVE);
86OPAL_CALL(opal_register_exception_handler, OPAL_REGISTER_OPAL_EXCEPTION_HANDLER); 183OPAL_CALL(opal_register_exception_handler, OPAL_REGISTER_OPAL_EXCEPTION_HANDLER);
87OPAL_CALL(opal_pci_eeh_freeze_status, OPAL_PCI_EEH_FREEZE_STATUS); 184OPAL_CALL(opal_pci_eeh_freeze_status, OPAL_PCI_EEH_FREEZE_STATUS);
88OPAL_CALL(opal_pci_eeh_freeze_clear, OPAL_PCI_EEH_FREEZE_CLEAR); 185OPAL_CALL(opal_pci_eeh_freeze_clear, OPAL_PCI_EEH_FREEZE_CLEAR);
186OPAL_CALL(opal_pci_eeh_freeze_set, OPAL_PCI_EEH_FREEZE_SET);
89OPAL_CALL(opal_pci_shpc, OPAL_PCI_SHPC); 187OPAL_CALL(opal_pci_shpc, OPAL_PCI_SHPC);
90OPAL_CALL(opal_pci_phb_mmio_enable, OPAL_PCI_PHB_MMIO_ENABLE); 188OPAL_CALL(opal_pci_phb_mmio_enable, OPAL_PCI_PHB_MMIO_ENABLE);
91OPAL_CALL(opal_pci_set_phb_mem_window, OPAL_PCI_SET_PHB_MEM_WINDOW); 189OPAL_CALL(opal_pci_set_phb_mem_window, OPAL_PCI_SET_PHB_MEM_WINDOW);
@@ -146,3 +244,6 @@ OPAL_CALL(opal_sync_host_reboot, OPAL_SYNC_HOST_REBOOT);
146OPAL_CALL(opal_sensor_read, OPAL_SENSOR_READ); 244OPAL_CALL(opal_sensor_read, OPAL_SENSOR_READ);
147OPAL_CALL(opal_get_param, OPAL_GET_PARAM); 245OPAL_CALL(opal_get_param, OPAL_GET_PARAM);
148OPAL_CALL(opal_set_param, OPAL_SET_PARAM); 246OPAL_CALL(opal_set_param, OPAL_SET_PARAM);
247OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI);
248OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION);
249OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION);
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
index 4cd2ea6c0dbe..7634d1c62299 100644
--- a/arch/powerpc/platforms/powernv/opal-xscom.c
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -130,4 +130,4 @@ static int opal_xscom_init(void)
130 scom_init(&opal_scom_controller); 130 scom_init(&opal_scom_controller);
131 return 0; 131 return 0;
132} 132}
133arch_initcall(opal_xscom_init); 133machine_arch_initcall(powernv, opal_xscom_init);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 199975613fe9..b44eec3e8dbd 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -22,6 +22,8 @@
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/memblock.h> 24#include <linux/memblock.h>
25
26#include <asm/machdep.h>
25#include <asm/opal.h> 27#include <asm/opal.h>
26#include <asm/firmware.h> 28#include <asm/firmware.h>
27#include <asm/mce.h> 29#include <asm/mce.h>
@@ -192,16 +194,12 @@ static int __init opal_register_exception_handlers(void)
192 * fwnmi area at 0x7000 to provide the glue space to OPAL 194 * fwnmi area at 0x7000 to provide the glue space to OPAL
193 */ 195 */
194 glue = 0x7000; 196 glue = 0x7000;
195 opal_register_exception_handler(OPAL_HYPERVISOR_MAINTENANCE_HANDLER,
196 0, glue);
197 glue += 128;
198 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); 197 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue);
199#endif 198#endif
200 199
201 return 0; 200 return 0;
202} 201}
203 202machine_early_initcall(powernv, opal_register_exception_handlers);
204early_initcall(opal_register_exception_handlers);
205 203
206int opal_notifier_register(struct notifier_block *nb) 204int opal_notifier_register(struct notifier_block *nb)
207{ 205{
@@ -368,7 +366,7 @@ static int __init opal_message_init(void)
368 } 366 }
369 return 0; 367 return 0;
370} 368}
371early_initcall(opal_message_init); 369machine_early_initcall(powernv, opal_message_init);
372 370
373int opal_get_chars(uint32_t vtermno, char *buf, int count) 371int opal_get_chars(uint32_t vtermno, char *buf, int count)
374{ 372{
@@ -513,6 +511,46 @@ int opal_machine_check(struct pt_regs *regs)
513 return 0; 511 return 0;
514} 512}
515 513
514/* Early hmi handler called in real mode. */
515int opal_hmi_exception_early(struct pt_regs *regs)
516{
517 s64 rc;
518
519 /*
520 * call opal hmi handler. Pass paca address as token.
521 * The return value OPAL_SUCCESS is an indication that there is
522 * an HMI event generated waiting to pull by Linux.
523 */
524 rc = opal_handle_hmi();
525 if (rc == OPAL_SUCCESS) {
526 local_paca->hmi_event_available = 1;
527 return 1;
528 }
529 return 0;
530}
531
532/* HMI exception handler called in virtual mode during check_irq_replay. */
533int opal_handle_hmi_exception(struct pt_regs *regs)
534{
535 s64 rc;
536 __be64 evt = 0;
537
538 /*
539 * Check if HMI event is available.
540 * if Yes, then call opal_poll_events to pull opal messages and
541 * process them.
542 */
543 if (!local_paca->hmi_event_available)
544 return 0;
545
546 local_paca->hmi_event_available = 0;
547 rc = opal_poll_events(&evt);
548 if (rc == OPAL_SUCCESS && evt)
549 opal_do_notifier(be64_to_cpu(evt));
550
551 return 1;
552}
553
516static uint64_t find_recovery_address(uint64_t nip) 554static uint64_t find_recovery_address(uint64_t nip)
517{ 555{
518 int i; 556 int i;
@@ -567,6 +605,24 @@ static int opal_sysfs_init(void)
567 return 0; 605 return 0;
568} 606}
569 607
608static void __init opal_dump_region_init(void)
609{
610 void *addr;
611 uint64_t size;
612 int rc;
613
614 /* Register kernel log buffer */
615 addr = log_buf_addr_get();
616 size = log_buf_len_get();
617 rc = opal_register_dump_region(OPAL_DUMP_REGION_LOG_BUF,
618 __pa(addr), size);
619 /* Don't warn if this is just an older OPAL that doesn't
620 * know about that call
621 */
622 if (rc && rc != OPAL_UNSUPPORTED)
623 pr_warn("DUMP: Failed to register kernel log buffer. "
624 "rc = %d\n", rc);
625}
570static int __init opal_init(void) 626static int __init opal_init(void)
571{ 627{
572 struct device_node *np, *consoles; 628 struct device_node *np, *consoles;
@@ -616,6 +672,8 @@ static int __init opal_init(void)
616 /* Create "opal" kobject under /sys/firmware */ 672 /* Create "opal" kobject under /sys/firmware */
617 rc = opal_sysfs_init(); 673 rc = opal_sysfs_init();
618 if (rc == 0) { 674 if (rc == 0) {
675 /* Setup dump region interface */
676 opal_dump_region_init();
619 /* Setup error log interface */ 677 /* Setup error log interface */
620 rc = opal_elog_init(); 678 rc = opal_elog_init();
621 /* Setup code update interface */ 679 /* Setup code update interface */
@@ -630,7 +688,7 @@ static int __init opal_init(void)
630 688
631 return 0; 689 return 0;
632} 690}
633subsys_initcall(opal_init); 691machine_subsys_initcall(powernv, opal_init);
634 692
635void opal_shutdown(void) 693void opal_shutdown(void)
636{ 694{
@@ -656,6 +714,9 @@ void opal_shutdown(void)
656 else 714 else
657 mdelay(10); 715 mdelay(10);
658 } 716 }
717
718 /* Unregister memory dump region */
719 opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
659} 720}
660 721
661/* Export this so that test modules can use it */ 722/* Export this so that test modules can use it */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index de19edeaa7a7..df241b11d4f7 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -36,6 +36,7 @@
36#include <asm/tce.h> 36#include <asm/tce.h>
37#include <asm/xics.h> 37#include <asm/xics.h>
38#include <asm/debug.h> 38#include <asm/debug.h>
39#include <asm/firmware.h>
39 40
40#include "powernv.h" 41#include "powernv.h"
41#include "pci.h" 42#include "pci.h"
@@ -82,6 +83,12 @@ static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr)
82 : : "r" (val), "r" (paddr) : "memory"); 83 : : "r" (val), "r" (paddr) : "memory");
83} 84}
84 85
86static inline bool pnv_pci_is_mem_pref_64(unsigned long flags)
87{
88 return ((flags & (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH)) ==
89 (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH));
90}
91
85static int pnv_ioda_alloc_pe(struct pnv_phb *phb) 92static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
86{ 93{
87 unsigned long pe; 94 unsigned long pe;
@@ -106,6 +113,380 @@ static void pnv_ioda_free_pe(struct pnv_phb *phb, int pe)
106 clear_bit(pe, phb->ioda.pe_alloc); 113 clear_bit(pe, phb->ioda.pe_alloc);
107} 114}
108 115
116/* The default M64 BAR is shared by all PEs */
117static int pnv_ioda2_init_m64(struct pnv_phb *phb)
118{
119 const char *desc;
120 struct resource *r;
121 s64 rc;
122
123 /* Configure the default M64 BAR */
124 rc = opal_pci_set_phb_mem_window(phb->opal_id,
125 OPAL_M64_WINDOW_TYPE,
126 phb->ioda.m64_bar_idx,
127 phb->ioda.m64_base,
128 0, /* unused */
129 phb->ioda.m64_size);
130 if (rc != OPAL_SUCCESS) {
131 desc = "configuring";
132 goto fail;
133 }
134
135 /* Enable the default M64 BAR */
136 rc = opal_pci_phb_mmio_enable(phb->opal_id,
137 OPAL_M64_WINDOW_TYPE,
138 phb->ioda.m64_bar_idx,
139 OPAL_ENABLE_M64_SPLIT);
140 if (rc != OPAL_SUCCESS) {
141 desc = "enabling";
142 goto fail;
143 }
144
145 /* Mark the M64 BAR assigned */
146 set_bit(phb->ioda.m64_bar_idx, &phb->ioda.m64_bar_alloc);
147
148 /*
149 * Strip off the segment used by the reserved PE, which is
150 * expected to be 0 or last one of PE capabicity.
151 */
152 r = &phb->hose->mem_resources[1];
153 if (phb->ioda.reserved_pe == 0)
154 r->start += phb->ioda.m64_segsize;
155 else if (phb->ioda.reserved_pe == (phb->ioda.total_pe - 1))
156 r->end -= phb->ioda.m64_segsize;
157 else
158 pr_warn(" Cannot strip M64 segment for reserved PE#%d\n",
159 phb->ioda.reserved_pe);
160
161 return 0;
162
163fail:
164 pr_warn(" Failure %lld %s M64 BAR#%d\n",
165 rc, desc, phb->ioda.m64_bar_idx);
166 opal_pci_phb_mmio_enable(phb->opal_id,
167 OPAL_M64_WINDOW_TYPE,
168 phb->ioda.m64_bar_idx,
169 OPAL_DISABLE_M64);
170 return -EIO;
171}
172
173static void pnv_ioda2_alloc_m64_pe(struct pnv_phb *phb)
174{
175 resource_size_t sgsz = phb->ioda.m64_segsize;
176 struct pci_dev *pdev;
177 struct resource *r;
178 int base, step, i;
179
180 /*
181 * Root bus always has full M64 range and root port has
182 * M64 range used in reality. So we're checking root port
183 * instead of root bus.
184 */
185 list_for_each_entry(pdev, &phb->hose->bus->devices, bus_list) {
186 for (i = PCI_BRIDGE_RESOURCES;
187 i <= PCI_BRIDGE_RESOURCE_END; i++) {
188 r = &pdev->resource[i];
189 if (!r->parent ||
190 !pnv_pci_is_mem_pref_64(r->flags))
191 continue;
192
193 base = (r->start - phb->ioda.m64_base) / sgsz;
194 for (step = 0; step < resource_size(r) / sgsz; step++)
195 set_bit(base + step, phb->ioda.pe_alloc);
196 }
197 }
198}
199
200static int pnv_ioda2_pick_m64_pe(struct pnv_phb *phb,
201 struct pci_bus *bus, int all)
202{
203 resource_size_t segsz = phb->ioda.m64_segsize;
204 struct pci_dev *pdev;
205 struct resource *r;
206 struct pnv_ioda_pe *master_pe, *pe;
207 unsigned long size, *pe_alloc;
208 bool found;
209 int start, i, j;
210
211 /* Root bus shouldn't use M64 */
212 if (pci_is_root_bus(bus))
213 return IODA_INVALID_PE;
214
215 /* We support only one M64 window on each bus */
216 found = false;
217 pci_bus_for_each_resource(bus, r, i) {
218 if (r && r->parent &&
219 pnv_pci_is_mem_pref_64(r->flags)) {
220 found = true;
221 break;
222 }
223 }
224
225 /* No M64 window found ? */
226 if (!found)
227 return IODA_INVALID_PE;
228
229 /* Allocate bitmap */
230 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
231 pe_alloc = kzalloc(size, GFP_KERNEL);
232 if (!pe_alloc) {
233 pr_warn("%s: Out of memory !\n",
234 __func__);
235 return IODA_INVALID_PE;
236 }
237
238 /*
239 * Figure out reserved PE numbers by the PE
240 * the its child PEs.
241 */
242 start = (r->start - phb->ioda.m64_base) / segsz;
243 for (i = 0; i < resource_size(r) / segsz; i++)
244 set_bit(start + i, pe_alloc);
245
246 if (all)
247 goto done;
248
249 /*
250 * If the PE doesn't cover all subordinate buses,
251 * we need subtract from reserved PEs for children.
252 */
253 list_for_each_entry(pdev, &bus->devices, bus_list) {
254 if (!pdev->subordinate)
255 continue;
256
257 pci_bus_for_each_resource(pdev->subordinate, r, i) {
258 if (!r || !r->parent ||
259 !pnv_pci_is_mem_pref_64(r->flags))
260 continue;
261
262 start = (r->start - phb->ioda.m64_base) / segsz;
263 for (j = 0; j < resource_size(r) / segsz ; j++)
264 clear_bit(start + j, pe_alloc);
265 }
266 }
267
268 /*
269 * the current bus might not own M64 window and that's all
270 * contributed by its child buses. For the case, we needn't
271 * pick M64 dependent PE#.
272 */
273 if (bitmap_empty(pe_alloc, phb->ioda.total_pe)) {
274 kfree(pe_alloc);
275 return IODA_INVALID_PE;
276 }
277
278 /*
279 * Figure out the master PE and put all slave PEs to master
280 * PE's list to form compound PE.
281 */
282done:
283 master_pe = NULL;
284 i = -1;
285 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe, i + 1)) <
286 phb->ioda.total_pe) {
287 pe = &phb->ioda.pe_array[i];
288 pe->phb = phb;
289 pe->pe_number = i;
290
291 if (!master_pe) {
292 pe->flags |= PNV_IODA_PE_MASTER;
293 INIT_LIST_HEAD(&pe->slaves);
294 master_pe = pe;
295 } else {
296 pe->flags |= PNV_IODA_PE_SLAVE;
297 pe->master = master_pe;
298 list_add_tail(&pe->list, &master_pe->slaves);
299 }
300 }
301
302 kfree(pe_alloc);
303 return master_pe->pe_number;
304}
305
306static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
307{
308 struct pci_controller *hose = phb->hose;
309 struct device_node *dn = hose->dn;
310 struct resource *res;
311 const u32 *r;
312 u64 pci_addr;
313
314 if (!firmware_has_feature(FW_FEATURE_OPALv3)) {
315 pr_info(" Firmware too old to support M64 window\n");
316 return;
317 }
318
319 r = of_get_property(dn, "ibm,opal-m64-window", NULL);
320 if (!r) {
321 pr_info(" No <ibm,opal-m64-window> on %s\n",
322 dn->full_name);
323 return;
324 }
325
326 /* FIXME: Support M64 for P7IOC */
327 if (phb->type != PNV_PHB_IODA2) {
328 pr_info(" Not support M64 window\n");
329 return;
330 }
331
332 res = &hose->mem_resources[1];
333 res->start = of_translate_address(dn, r + 2);
334 res->end = res->start + of_read_number(r + 4, 2) - 1;
335 res->flags = (IORESOURCE_MEM | IORESOURCE_MEM_64 | IORESOURCE_PREFETCH);
336 pci_addr = of_read_number(r, 2);
337 hose->mem_offset[1] = res->start - pci_addr;
338
339 phb->ioda.m64_size = resource_size(res);
340 phb->ioda.m64_segsize = phb->ioda.m64_size / phb->ioda.total_pe;
341 phb->ioda.m64_base = pci_addr;
342
343 /* Use last M64 BAR to cover M64 window */
344 phb->ioda.m64_bar_idx = 15;
345 phb->init_m64 = pnv_ioda2_init_m64;
346 phb->alloc_m64_pe = pnv_ioda2_alloc_m64_pe;
347 phb->pick_m64_pe = pnv_ioda2_pick_m64_pe;
348}
349
350static void pnv_ioda_freeze_pe(struct pnv_phb *phb, int pe_no)
351{
352 struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_no];
353 struct pnv_ioda_pe *slave;
354 s64 rc;
355
356 /* Fetch master PE */
357 if (pe->flags & PNV_IODA_PE_SLAVE) {
358 pe = pe->master;
359 WARN_ON(!pe || !(pe->flags & PNV_IODA_PE_MASTER));
360 pe_no = pe->pe_number;
361 }
362
363 /* Freeze master PE */
364 rc = opal_pci_eeh_freeze_set(phb->opal_id,
365 pe_no,
366 OPAL_EEH_ACTION_SET_FREEZE_ALL);
367 if (rc != OPAL_SUCCESS) {
368 pr_warn("%s: Failure %lld freezing PHB#%x-PE#%x\n",
369 __func__, rc, phb->hose->global_number, pe_no);
370 return;
371 }
372
373 /* Freeze slave PEs */
374 if (!(pe->flags & PNV_IODA_PE_MASTER))
375 return;
376
377 list_for_each_entry(slave, &pe->slaves, list) {
378 rc = opal_pci_eeh_freeze_set(phb->opal_id,
379 slave->pe_number,
380 OPAL_EEH_ACTION_SET_FREEZE_ALL);
381 if (rc != OPAL_SUCCESS)
382 pr_warn("%s: Failure %lld freezing PHB#%x-PE#%x\n",
383 __func__, rc, phb->hose->global_number,
384 slave->pe_number);
385 }
386}
387
388int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt)
389{
390 struct pnv_ioda_pe *pe, *slave;
391 s64 rc;
392
393 /* Find master PE */
394 pe = &phb->ioda.pe_array[pe_no];
395 if (pe->flags & PNV_IODA_PE_SLAVE) {
396 pe = pe->master;
397 WARN_ON(!pe || !(pe->flags & PNV_IODA_PE_MASTER));
398 pe_no = pe->pe_number;
399 }
400
401 /* Clear frozen state for master PE */
402 rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no, opt);
403 if (rc != OPAL_SUCCESS) {
404 pr_warn("%s: Failure %lld clear %d on PHB#%x-PE#%x\n",
405 __func__, rc, opt, phb->hose->global_number, pe_no);
406 return -EIO;
407 }
408
409 if (!(pe->flags & PNV_IODA_PE_MASTER))
410 return 0;
411
412 /* Clear frozen state for slave PEs */
413 list_for_each_entry(slave, &pe->slaves, list) {
414 rc = opal_pci_eeh_freeze_clear(phb->opal_id,
415 slave->pe_number,
416 opt);
417 if (rc != OPAL_SUCCESS) {
418 pr_warn("%s: Failure %lld clear %d on PHB#%x-PE#%x\n",
419 __func__, rc, opt, phb->hose->global_number,
420 slave->pe_number);
421 return -EIO;
422 }
423 }
424
425 return 0;
426}
427
428static int pnv_ioda_get_pe_state(struct pnv_phb *phb, int pe_no)
429{
430 struct pnv_ioda_pe *slave, *pe;
431 u8 fstate, state;
432 __be16 pcierr;
433 s64 rc;
434
435 /* Sanity check on PE number */
436 if (pe_no < 0 || pe_no >= phb->ioda.total_pe)
437 return OPAL_EEH_STOPPED_PERM_UNAVAIL;
438
439 /*
440 * Fetch the master PE and the PE instance might be
441 * not initialized yet.
442 */
443 pe = &phb->ioda.pe_array[pe_no];
444 if (pe->flags & PNV_IODA_PE_SLAVE) {
445 pe = pe->master;
446 WARN_ON(!pe || !(pe->flags & PNV_IODA_PE_MASTER));
447 pe_no = pe->pe_number;
448 }
449
450 /* Check the master PE */
451 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no,
452 &state, &pcierr, NULL);
453 if (rc != OPAL_SUCCESS) {
454 pr_warn("%s: Failure %lld getting "
455 "PHB#%x-PE#%x state\n",
456 __func__, rc,
457 phb->hose->global_number, pe_no);
458 return OPAL_EEH_STOPPED_TEMP_UNAVAIL;
459 }
460
461 /* Check the slave PE */
462 if (!(pe->flags & PNV_IODA_PE_MASTER))
463 return state;
464
465 list_for_each_entry(slave, &pe->slaves, list) {
466 rc = opal_pci_eeh_freeze_status(phb->opal_id,
467 slave->pe_number,
468 &fstate,
469 &pcierr,
470 NULL);
471 if (rc != OPAL_SUCCESS) {
472 pr_warn("%s: Failure %lld getting "
473 "PHB#%x-PE#%x state\n",
474 __func__, rc,
475 phb->hose->global_number, slave->pe_number);
476 return OPAL_EEH_STOPPED_TEMP_UNAVAIL;
477 }
478
479 /*
480 * Override the result based on the ascending
481 * priority.
482 */
483 if (fstate > state)
484 state = fstate;
485 }
486
487 return state;
488}
489
109/* Currently those 2 are only used when MSIs are enabled, this will change 490/* Currently those 2 are only used when MSIs are enabled, this will change
110 * but in the meantime, we need to protect them to avoid warnings 491 * but in the meantime, we need to protect them to avoid warnings
111 */ 492 */
@@ -363,9 +744,16 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
363 struct pci_controller *hose = pci_bus_to_host(bus); 744 struct pci_controller *hose = pci_bus_to_host(bus);
364 struct pnv_phb *phb = hose->private_data; 745 struct pnv_phb *phb = hose->private_data;
365 struct pnv_ioda_pe *pe; 746 struct pnv_ioda_pe *pe;
366 int pe_num; 747 int pe_num = IODA_INVALID_PE;
748
749 /* Check if PE is determined by M64 */
750 if (phb->pick_m64_pe)
751 pe_num = phb->pick_m64_pe(phb, bus, all);
752
753 /* The PE number isn't pinned by M64 */
754 if (pe_num == IODA_INVALID_PE)
755 pe_num = pnv_ioda_alloc_pe(phb);
367 756
368 pe_num = pnv_ioda_alloc_pe(phb);
369 if (pe_num == IODA_INVALID_PE) { 757 if (pe_num == IODA_INVALID_PE) {
370 pr_warning("%s: Not enough PE# available for PCI bus %04x:%02x\n", 758 pr_warning("%s: Not enough PE# available for PCI bus %04x:%02x\n",
371 __func__, pci_domain_nr(bus), bus->number); 759 __func__, pci_domain_nr(bus), bus->number);
@@ -373,7 +761,7 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
373 } 761 }
374 762
375 pe = &phb->ioda.pe_array[pe_num]; 763 pe = &phb->ioda.pe_array[pe_num];
376 pe->flags = (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); 764 pe->flags |= (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS);
377 pe->pbus = bus; 765 pe->pbus = bus;
378 pe->pdev = NULL; 766 pe->pdev = NULL;
379 pe->tce32_seg = -1; 767 pe->tce32_seg = -1;
@@ -441,8 +829,15 @@ static void pnv_ioda_setup_PEs(struct pci_bus *bus)
441static void pnv_pci_ioda_setup_PEs(void) 829static void pnv_pci_ioda_setup_PEs(void)
442{ 830{
443 struct pci_controller *hose, *tmp; 831 struct pci_controller *hose, *tmp;
832 struct pnv_phb *phb;
444 833
445 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 834 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
835 phb = hose->private_data;
836
837 /* M64 layout might affect PE allocation */
838 if (phb->alloc_m64_pe)
839 phb->alloc_m64_pe(phb);
840
446 pnv_ioda_setup_PEs(hose->bus); 841 pnv_ioda_setup_PEs(hose->bus);
447 } 842 }
448} 843}
@@ -462,7 +857,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
462 857
463 pe = &phb->ioda.pe_array[pdn->pe_number]; 858 pe = &phb->ioda.pe_array[pdn->pe_number];
464 WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops); 859 WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops);
465 set_iommu_table_base(&pdev->dev, &pe->tce32_table); 860 set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
466} 861}
467 862
468static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb, 863static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
@@ -491,17 +886,26 @@ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
491 set_dma_ops(&pdev->dev, &dma_iommu_ops); 886 set_dma_ops(&pdev->dev, &dma_iommu_ops);
492 set_iommu_table_base(&pdev->dev, &pe->tce32_table); 887 set_iommu_table_base(&pdev->dev, &pe->tce32_table);
493 } 888 }
889 *pdev->dev.dma_mask = dma_mask;
494 return 0; 890 return 0;
495} 891}
496 892
497static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) 893static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
894 struct pci_bus *bus,
895 bool add_to_iommu_group)
498{ 896{
499 struct pci_dev *dev; 897 struct pci_dev *dev;
500 898
501 list_for_each_entry(dev, &bus->devices, bus_list) { 899 list_for_each_entry(dev, &bus->devices, bus_list) {
502 set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table); 900 if (add_to_iommu_group)
901 set_iommu_table_base_and_group(&dev->dev,
902 &pe->tce32_table);
903 else
904 set_iommu_table_base(&dev->dev, &pe->tce32_table);
905
503 if (dev->subordinate) 906 if (dev->subordinate)
504 pnv_ioda_setup_bus_dma(pe, dev->subordinate); 907 pnv_ioda_setup_bus_dma(pe, dev->subordinate,
908 add_to_iommu_group);
505 } 909 }
506} 910}
507 911
@@ -513,15 +917,16 @@ static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe,
513 (__be64 __iomem *)pe->tce_inval_reg_phys : 917 (__be64 __iomem *)pe->tce_inval_reg_phys :
514 (__be64 __iomem *)tbl->it_index; 918 (__be64 __iomem *)tbl->it_index;
515 unsigned long start, end, inc; 919 unsigned long start, end, inc;
920 const unsigned shift = tbl->it_page_shift;
516 921
517 start = __pa(startp); 922 start = __pa(startp);
518 end = __pa(endp); 923 end = __pa(endp);
519 924
520 /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */ 925 /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */
521 if (tbl->it_busno) { 926 if (tbl->it_busno) {
522 start <<= 12; 927 start <<= shift;
523 end <<= 12; 928 end <<= shift;
524 inc = 128 << 12; 929 inc = 128ull << shift;
525 start |= tbl->it_busno; 930 start |= tbl->it_busno;
526 end |= tbl->it_busno; 931 end |= tbl->it_busno;
527 } else if (tbl->it_type & TCE_PCI_SWINV_PAIR) { 932 } else if (tbl->it_type & TCE_PCI_SWINV_PAIR) {
@@ -559,18 +964,19 @@ static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
559 __be64 __iomem *invalidate = rm ? 964 __be64 __iomem *invalidate = rm ?
560 (__be64 __iomem *)pe->tce_inval_reg_phys : 965 (__be64 __iomem *)pe->tce_inval_reg_phys :
561 (__be64 __iomem *)tbl->it_index; 966 (__be64 __iomem *)tbl->it_index;
967 const unsigned shift = tbl->it_page_shift;
562 968
563 /* We'll invalidate DMA address in PE scope */ 969 /* We'll invalidate DMA address in PE scope */
564 start = 0x2ul << 60; 970 start = 0x2ull << 60;
565 start |= (pe->pe_number & 0xFF); 971 start |= (pe->pe_number & 0xFF);
566 end = start; 972 end = start;
567 973
568 /* Figure out the start, end and step */ 974 /* Figure out the start, end and step */
569 inc = tbl->it_offset + (((u64)startp - tbl->it_base) / sizeof(u64)); 975 inc = tbl->it_offset + (((u64)startp - tbl->it_base) / sizeof(u64));
570 start |= (inc << 12); 976 start |= (inc << shift);
571 inc = tbl->it_offset + (((u64)endp - tbl->it_base) / sizeof(u64)); 977 inc = tbl->it_offset + (((u64)endp - tbl->it_base) / sizeof(u64));
572 end |= (inc << 12); 978 end |= (inc << shift);
573 inc = (0x1ul << 12); 979 inc = (0x1ull << shift);
574 mb(); 980 mb();
575 981
576 while (start <= end) { 982 while (start <= end) {
@@ -654,7 +1060,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
654 /* Setup linux iommu table */ 1060 /* Setup linux iommu table */
655 tbl = &pe->tce32_table; 1061 tbl = &pe->tce32_table;
656 pnv_pci_setup_iommu_table(tbl, addr, TCE32_TABLE_SIZE * segs, 1062 pnv_pci_setup_iommu_table(tbl, addr, TCE32_TABLE_SIZE * segs,
657 base << 28); 1063 base << 28, IOMMU_PAGE_SHIFT_4K);
658 1064
659 /* OPAL variant of P7IOC SW invalidated TCEs */ 1065 /* OPAL variant of P7IOC SW invalidated TCEs */
660 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL); 1066 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL);
@@ -677,7 +1083,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
677 if (pe->pdev) 1083 if (pe->pdev)
678 set_iommu_table_base_and_group(&pe->pdev->dev, tbl); 1084 set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
679 else 1085 else
680 pnv_ioda_setup_bus_dma(pe, pe->pbus); 1086 pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
681 1087
682 return; 1088 return;
683 fail: 1089 fail:
@@ -713,11 +1119,15 @@ static void pnv_pci_ioda2_set_bypass(struct iommu_table *tbl, bool enable)
713 0); 1119 0);
714 1120
715 /* 1121 /*
716 * We might want to reset the DMA ops of all devices on 1122 * EEH needs the mapping between IOMMU table and group
717 * this PE. However in theory, that shouldn't be necessary 1123 * of those VFIO/KVM pass-through devices. We can postpone
718 * as this is used for VFIO/KVM pass-through and the device 1124 * resetting DMA ops until the DMA mask is configured in
719 * hasn't yet been returned to its kernel driver 1125 * host side.
720 */ 1126 */
1127 if (pe->pdev)
1128 set_iommu_table_base(&pe->pdev->dev, tbl);
1129 else
1130 pnv_ioda_setup_bus_dma(pe, pe->pbus, false);
721 } 1131 }
722 if (rc) 1132 if (rc)
723 pe_err(pe, "OPAL error %lld configuring bypass window\n", rc); 1133 pe_err(pe, "OPAL error %lld configuring bypass window\n", rc);
@@ -784,7 +1194,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
784 1194
785 /* Setup linux iommu table */ 1195 /* Setup linux iommu table */
786 tbl = &pe->tce32_table; 1196 tbl = &pe->tce32_table;
787 pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0); 1197 pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0,
1198 IOMMU_PAGE_SHIFT_4K);
788 1199
789 /* OPAL variant of PHB3 invalidated TCEs */ 1200 /* OPAL variant of PHB3 invalidated TCEs */
790 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL); 1201 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL);
@@ -805,7 +1216,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
805 if (pe->pdev) 1216 if (pe->pdev)
806 set_iommu_table_base_and_group(&pe->pdev->dev, tbl); 1217 set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
807 else 1218 else
808 pnv_ioda_setup_bus_dma(pe, pe->pbus); 1219 pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
809 1220
810 /* Also create a bypass window */ 1221 /* Also create a bypass window */
811 pnv_pci_ioda2_setup_bypass_pe(phb, pe); 1222 pnv_pci_ioda2_setup_bypass_pe(phb, pe);
@@ -1055,9 +1466,6 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
1055 index++; 1466 index++;
1056 } 1467 }
1057 } else if (res->flags & IORESOURCE_MEM) { 1468 } else if (res->flags & IORESOURCE_MEM) {
1058 /* WARNING: Assumes M32 is mem region 0 in PHB. We need to
1059 * harden that algorithm when we start supporting M64
1060 */
1061 region.start = res->start - 1469 region.start = res->start -
1062 hose->mem_offset[0] - 1470 hose->mem_offset[0] -
1063 phb->ioda.m32_pci_base; 1471 phb->ioda.m32_pci_base;
@@ -1141,9 +1549,8 @@ static void pnv_pci_ioda_fixup(void)
1141 pnv_pci_ioda_create_dbgfs(); 1549 pnv_pci_ioda_create_dbgfs();
1142 1550
1143#ifdef CONFIG_EEH 1551#ifdef CONFIG_EEH
1144 eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
1145 eeh_addr_cache_build();
1146 eeh_init(); 1552 eeh_init();
1553 eeh_addr_cache_build();
1147#endif 1554#endif
1148} 1555}
1149 1556
@@ -1178,7 +1585,10 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
1178 bridge = bridge->bus->self; 1585 bridge = bridge->bus->self;
1179 } 1586 }
1180 1587
1181 /* We need support prefetchable memory window later */ 1588 /* We fail back to M32 if M64 isn't supported */
1589 if (phb->ioda.m64_segsize &&
1590 pnv_pci_is_mem_pref_64(type))
1591 return phb->ioda.m64_segsize;
1182 if (type & IORESOURCE_MEM) 1592 if (type & IORESOURCE_MEM)
1183 return phb->ioda.m32_segsize; 1593 return phb->ioda.m32_segsize;
1184 1594
@@ -1299,6 +1709,10 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1299 prop32 = of_get_property(np, "ibm,opal-reserved-pe", NULL); 1709 prop32 = of_get_property(np, "ibm,opal-reserved-pe", NULL);
1300 if (prop32) 1710 if (prop32)
1301 phb->ioda.reserved_pe = be32_to_cpup(prop32); 1711 phb->ioda.reserved_pe = be32_to_cpup(prop32);
1712
1713 /* Parse 64-bit MMIO range */
1714 pnv_ioda_parse_m64_window(phb);
1715
1302 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); 1716 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]);
1303 /* FW Has already off top 64k of M32 space (MSI space) */ 1717 /* FW Has already off top 64k of M32 space (MSI space) */
1304 phb->ioda.m32_size += 0x10000; 1718 phb->ioda.m32_size += 0x10000;
@@ -1334,14 +1748,6 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1334 /* Calculate how many 32-bit TCE segments we have */ 1748 /* Calculate how many 32-bit TCE segments we have */
1335 phb->ioda.tce32_count = phb->ioda.m32_pci_base >> 28; 1749 phb->ioda.tce32_count = phb->ioda.m32_pci_base >> 28;
1336 1750
1337 /* Clear unusable m64 */
1338 hose->mem_resources[1].flags = 0;
1339 hose->mem_resources[1].start = 0;
1340 hose->mem_resources[1].end = 0;
1341 hose->mem_resources[2].flags = 0;
1342 hose->mem_resources[2].start = 0;
1343 hose->mem_resources[2].end = 0;
1344
1345#if 0 /* We should really do that ... */ 1751#if 0 /* We should really do that ... */
1346 rc = opal_pci_set_phb_mem_window(opal->phb_id, 1752 rc = opal_pci_set_phb_mem_window(opal->phb_id,
1347 window_type, 1753 window_type,
@@ -1351,14 +1757,21 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1351 segment_size); 1757 segment_size);
1352#endif 1758#endif
1353 1759
1354 pr_info(" %d (%d) PE's M32: 0x%x [segment=0x%x]" 1760 pr_info(" %03d (%03d) PE's M32: 0x%x [segment=0x%x]\n",
1355 " IO: 0x%x [segment=0x%x]\n", 1761 phb->ioda.total_pe, phb->ioda.reserved_pe,
1356 phb->ioda.total_pe, 1762 phb->ioda.m32_size, phb->ioda.m32_segsize);
1357 phb->ioda.reserved_pe, 1763 if (phb->ioda.m64_size)
1358 phb->ioda.m32_size, phb->ioda.m32_segsize, 1764 pr_info(" M64: 0x%lx [segment=0x%lx]\n",
1359 phb->ioda.io_size, phb->ioda.io_segsize); 1765 phb->ioda.m64_size, phb->ioda.m64_segsize);
1766 if (phb->ioda.io_size)
1767 pr_info(" IO: 0x%x [segment=0x%x]\n",
1768 phb->ioda.io_size, phb->ioda.io_segsize);
1769
1360 1770
1361 phb->hose->ops = &pnv_pci_ops; 1771 phb->hose->ops = &pnv_pci_ops;
1772 phb->get_pe_state = pnv_ioda_get_pe_state;
1773 phb->freeze_pe = pnv_ioda_freeze_pe;
1774 phb->unfreeze_pe = pnv_ioda_unfreeze_pe;
1362#ifdef CONFIG_EEH 1775#ifdef CONFIG_EEH
1363 phb->eeh_ops = &ioda_eeh_ops; 1776 phb->eeh_ops = &ioda_eeh_ops;
1364#endif 1777#endif
@@ -1404,6 +1817,10 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1404 ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); 1817 ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL);
1405 ioda_eeh_phb_reset(hose, OPAL_DEASSERT_RESET); 1818 ioda_eeh_phb_reset(hose, OPAL_DEASSERT_RESET);
1406 } 1819 }
1820
1821 /* Configure M64 window */
1822 if (phb->init_m64 && phb->init_m64(phb))
1823 hose->mem_resources[1].flags = 0;
1407} 1824}
1408 1825
1409void __init pnv_pci_init_ioda2_phb(struct device_node *np) 1826void __init pnv_pci_init_ioda2_phb(struct device_node *np)
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index e3807d69393e..94ce3481490b 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -172,7 +172,8 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
172 /* Setup TCEs */ 172 /* Setup TCEs */
173 phb->dma_dev_setup = pnv_pci_p5ioc2_dma_dev_setup; 173 phb->dma_dev_setup = pnv_pci_p5ioc2_dma_dev_setup;
174 pnv_pci_setup_iommu_table(&phb->p5ioc2.iommu_table, 174 pnv_pci_setup_iommu_table(&phb->p5ioc2.iommu_table,
175 tce_mem, tce_size, 0); 175 tce_mem, tce_size, 0,
176 IOMMU_PAGE_SHIFT_4K);
176} 177}
177 178
178void __init pnv_pci_init_p5ioc2_hub(struct device_node *np) 179void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index f91a4e5d872e..b854b57ed5e1 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -132,61 +132,78 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose,
132 132
133 data = (struct OpalIoP7IOCPhbErrorData *)common; 133 data = (struct OpalIoP7IOCPhbErrorData *)common;
134 pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n", 134 pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n",
135 hose->global_number, common->version); 135 hose->global_number, be32_to_cpu(common->version));
136 136
137 if (data->brdgCtl) 137 if (data->brdgCtl)
138 pr_info("brdgCtl: %08x\n", 138 pr_info("brdgCtl: %08x\n",
139 data->brdgCtl); 139 be32_to_cpu(data->brdgCtl));
140 if (data->portStatusReg || data->rootCmplxStatus || 140 if (data->portStatusReg || data->rootCmplxStatus ||
141 data->busAgentStatus) 141 data->busAgentStatus)
142 pr_info("UtlSts: %08x %08x %08x\n", 142 pr_info("UtlSts: %08x %08x %08x\n",
143 data->portStatusReg, data->rootCmplxStatus, 143 be32_to_cpu(data->portStatusReg),
144 data->busAgentStatus); 144 be32_to_cpu(data->rootCmplxStatus),
145 be32_to_cpu(data->busAgentStatus));
145 if (data->deviceStatus || data->slotStatus || 146 if (data->deviceStatus || data->slotStatus ||
146 data->linkStatus || data->devCmdStatus || 147 data->linkStatus || data->devCmdStatus ||
147 data->devSecStatus) 148 data->devSecStatus)
148 pr_info("RootSts: %08x %08x %08x %08x %08x\n", 149 pr_info("RootSts: %08x %08x %08x %08x %08x\n",
149 data->deviceStatus, data->slotStatus, 150 be32_to_cpu(data->deviceStatus),
150 data->linkStatus, data->devCmdStatus, 151 be32_to_cpu(data->slotStatus),
151 data->devSecStatus); 152 be32_to_cpu(data->linkStatus),
153 be32_to_cpu(data->devCmdStatus),
154 be32_to_cpu(data->devSecStatus));
152 if (data->rootErrorStatus || data->uncorrErrorStatus || 155 if (data->rootErrorStatus || data->uncorrErrorStatus ||
153 data->corrErrorStatus) 156 data->corrErrorStatus)
154 pr_info("RootErrSts: %08x %08x %08x\n", 157 pr_info("RootErrSts: %08x %08x %08x\n",
155 data->rootErrorStatus, data->uncorrErrorStatus, 158 be32_to_cpu(data->rootErrorStatus),
156 data->corrErrorStatus); 159 be32_to_cpu(data->uncorrErrorStatus),
160 be32_to_cpu(data->corrErrorStatus));
157 if (data->tlpHdr1 || data->tlpHdr2 || 161 if (data->tlpHdr1 || data->tlpHdr2 ||
158 data->tlpHdr3 || data->tlpHdr4) 162 data->tlpHdr3 || data->tlpHdr4)
159 pr_info("RootErrLog: %08x %08x %08x %08x\n", 163 pr_info("RootErrLog: %08x %08x %08x %08x\n",
160 data->tlpHdr1, data->tlpHdr2, 164 be32_to_cpu(data->tlpHdr1),
161 data->tlpHdr3, data->tlpHdr4); 165 be32_to_cpu(data->tlpHdr2),
166 be32_to_cpu(data->tlpHdr3),
167 be32_to_cpu(data->tlpHdr4));
162 if (data->sourceId || data->errorClass || 168 if (data->sourceId || data->errorClass ||
163 data->correlator) 169 data->correlator)
164 pr_info("RootErrLog1: %08x %016llx %016llx\n", 170 pr_info("RootErrLog1: %08x %016llx %016llx\n",
165 data->sourceId, data->errorClass, 171 be32_to_cpu(data->sourceId),
166 data->correlator); 172 be64_to_cpu(data->errorClass),
173 be64_to_cpu(data->correlator));
167 if (data->p7iocPlssr || data->p7iocCsr) 174 if (data->p7iocPlssr || data->p7iocCsr)
168 pr_info("PhbSts: %016llx %016llx\n", 175 pr_info("PhbSts: %016llx %016llx\n",
169 data->p7iocPlssr, data->p7iocCsr); 176 be64_to_cpu(data->p7iocPlssr),
177 be64_to_cpu(data->p7iocCsr));
170 if (data->lemFir) 178 if (data->lemFir)
171 pr_info("Lem: %016llx %016llx %016llx\n", 179 pr_info("Lem: %016llx %016llx %016llx\n",
172 data->lemFir, data->lemErrorMask, 180 be64_to_cpu(data->lemFir),
173 data->lemWOF); 181 be64_to_cpu(data->lemErrorMask),
182 be64_to_cpu(data->lemWOF));
174 if (data->phbErrorStatus) 183 if (data->phbErrorStatus)
175 pr_info("PhbErr: %016llx %016llx %016llx %016llx\n", 184 pr_info("PhbErr: %016llx %016llx %016llx %016llx\n",
176 data->phbErrorStatus, data->phbFirstErrorStatus, 185 be64_to_cpu(data->phbErrorStatus),
177 data->phbErrorLog0, data->phbErrorLog1); 186 be64_to_cpu(data->phbFirstErrorStatus),
187 be64_to_cpu(data->phbErrorLog0),
188 be64_to_cpu(data->phbErrorLog1));
178 if (data->mmioErrorStatus) 189 if (data->mmioErrorStatus)
179 pr_info("OutErr: %016llx %016llx %016llx %016llx\n", 190 pr_info("OutErr: %016llx %016llx %016llx %016llx\n",
180 data->mmioErrorStatus, data->mmioFirstErrorStatus, 191 be64_to_cpu(data->mmioErrorStatus),
181 data->mmioErrorLog0, data->mmioErrorLog1); 192 be64_to_cpu(data->mmioFirstErrorStatus),
193 be64_to_cpu(data->mmioErrorLog0),
194 be64_to_cpu(data->mmioErrorLog1));
182 if (data->dma0ErrorStatus) 195 if (data->dma0ErrorStatus)
183 pr_info("InAErr: %016llx %016llx %016llx %016llx\n", 196 pr_info("InAErr: %016llx %016llx %016llx %016llx\n",
184 data->dma0ErrorStatus, data->dma0FirstErrorStatus, 197 be64_to_cpu(data->dma0ErrorStatus),
185 data->dma0ErrorLog0, data->dma0ErrorLog1); 198 be64_to_cpu(data->dma0FirstErrorStatus),
199 be64_to_cpu(data->dma0ErrorLog0),
200 be64_to_cpu(data->dma0ErrorLog1));
186 if (data->dma1ErrorStatus) 201 if (data->dma1ErrorStatus)
187 pr_info("InBErr: %016llx %016llx %016llx %016llx\n", 202 pr_info("InBErr: %016llx %016llx %016llx %016llx\n",
188 data->dma1ErrorStatus, data->dma1FirstErrorStatus, 203 be64_to_cpu(data->dma1ErrorStatus),
189 data->dma1ErrorLog0, data->dma1ErrorLog1); 204 be64_to_cpu(data->dma1FirstErrorStatus),
205 be64_to_cpu(data->dma1ErrorLog0),
206 be64_to_cpu(data->dma1ErrorLog1));
190 207
191 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { 208 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
192 if ((data->pestA[i] >> 63) == 0 && 209 if ((data->pestA[i] >> 63) == 0 &&
@@ -194,7 +211,8 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose,
194 continue; 211 continue;
195 212
196 pr_info("PE[%3d] A/B: %016llx %016llx\n", 213 pr_info("PE[%3d] A/B: %016llx %016llx\n",
197 i, data->pestA[i], data->pestB[i]); 214 i, be64_to_cpu(data->pestA[i]),
215 be64_to_cpu(data->pestB[i]));
198 } 216 }
199} 217}
200 218
@@ -319,43 +337,52 @@ void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
319static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no) 337static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
320{ 338{
321 unsigned long flags, rc; 339 unsigned long flags, rc;
322 int has_diag; 340 int has_diag, ret = 0;
323 341
324 spin_lock_irqsave(&phb->lock, flags); 342 spin_lock_irqsave(&phb->lock, flags);
325 343
344 /* Fetch PHB diag-data */
326 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, 345 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
327 PNV_PCI_DIAG_BUF_SIZE); 346 PNV_PCI_DIAG_BUF_SIZE);
328 has_diag = (rc == OPAL_SUCCESS); 347 has_diag = (rc == OPAL_SUCCESS);
329 348
330 rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no, 349 /* If PHB supports compound PE, to handle it */
350 if (phb->unfreeze_pe) {
351 ret = phb->unfreeze_pe(phb,
352 pe_no,
331 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); 353 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
332 if (rc) { 354 } else {
333 pr_warning("PCI %d: Failed to clear EEH freeze state" 355 rc = opal_pci_eeh_freeze_clear(phb->opal_id,
334 " for PE#%d, err %ld\n", 356 pe_no,
335 phb->hose->global_number, pe_no, rc); 357 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
336 358 if (rc) {
337 /* For now, let's only display the diag buffer when we fail to clear 359 pr_warn("%s: Failure %ld clearing frozen "
338 * the EEH status. We'll do more sensible things later when we have 360 "PHB#%x-PE#%x\n",
339 * proper EEH support. We need to make sure we don't pollute ourselves 361 __func__, rc, phb->hose->global_number,
340 * with the normal errors generated when probing empty slots 362 pe_no);
341 */ 363 ret = -EIO;
342 if (has_diag) 364 }
343 pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
344 else
345 pr_warning("PCI %d: No diag data available\n",
346 phb->hose->global_number);
347 } 365 }
348 366
367 /*
368 * For now, let's only display the diag buffer when we fail to clear
369 * the EEH status. We'll do more sensible things later when we have
370 * proper EEH support. We need to make sure we don't pollute ourselves
371 * with the normal errors generated when probing empty slots
372 */
373 if (has_diag && ret)
374 pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
375
349 spin_unlock_irqrestore(&phb->lock, flags); 376 spin_unlock_irqrestore(&phb->lock, flags);
350} 377}
351 378
352static void pnv_pci_config_check_eeh(struct pnv_phb *phb, 379static void pnv_pci_config_check_eeh(struct pnv_phb *phb,
353 struct device_node *dn) 380 struct device_node *dn)
354{ 381{
355 s64 rc;
356 u8 fstate; 382 u8 fstate;
357 __be16 pcierr; 383 __be16 pcierr;
358 u32 pe_no; 384 int pe_no;
385 s64 rc;
359 386
360 /* 387 /*
361 * Get the PE#. During the PCI probe stage, we might not 388 * Get the PE#. During the PCI probe stage, we might not
@@ -370,20 +397,42 @@ static void pnv_pci_config_check_eeh(struct pnv_phb *phb,
370 pe_no = phb->ioda.reserved_pe; 397 pe_no = phb->ioda.reserved_pe;
371 } 398 }
372 399
373 /* Read freeze status */ 400 /*
374 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr, 401 * Fetch frozen state. If the PHB support compound PE,
375 NULL); 402 * we need handle that case.
376 if (rc) { 403 */
377 pr_warning("%s: Can't read EEH status (PE#%d) for " 404 if (phb->get_pe_state) {
378 "%s, err %lld\n", 405 fstate = phb->get_pe_state(phb, pe_no);
379 __func__, pe_no, dn->full_name, rc); 406 } else {
380 return; 407 rc = opal_pci_eeh_freeze_status(phb->opal_id,
408 pe_no,
409 &fstate,
410 &pcierr,
411 NULL);
412 if (rc) {
413 pr_warn("%s: Failure %lld getting PHB#%x-PE#%x state\n",
414 __func__, rc, phb->hose->global_number, pe_no);
415 return;
416 }
381 } 417 }
418
382 cfg_dbg(" -> EEH check, bdfn=%04x PE#%d fstate=%x\n", 419 cfg_dbg(" -> EEH check, bdfn=%04x PE#%d fstate=%x\n",
383 (PCI_DN(dn)->busno << 8) | (PCI_DN(dn)->devfn), 420 (PCI_DN(dn)->busno << 8) | (PCI_DN(dn)->devfn),
384 pe_no, fstate); 421 pe_no, fstate);
385 if (fstate != 0) 422
423 /* Clear the frozen state if applicable */
424 if (fstate == OPAL_EEH_STOPPED_MMIO_FREEZE ||
425 fstate == OPAL_EEH_STOPPED_DMA_FREEZE ||
426 fstate == OPAL_EEH_STOPPED_MMIO_DMA_FREEZE) {
427 /*
428 * If PHB supports compound PE, freeze it for
429 * consistency.
430 */
431 if (phb->freeze_pe)
432 phb->freeze_pe(phb, pe_no);
433
386 pnv_pci_handle_eeh_config(phb, pe_no); 434 pnv_pci_handle_eeh_config(phb, pe_no);
435 }
387} 436}
388 437
389int pnv_pci_cfg_read(struct device_node *dn, 438int pnv_pci_cfg_read(struct device_node *dn,
@@ -564,10 +613,11 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
564 proto_tce |= TCE_PCI_WRITE; 613 proto_tce |= TCE_PCI_WRITE;
565 614
566 tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset; 615 tces = tcep = ((__be64 *)tbl->it_base) + index - tbl->it_offset;
567 rpn = __pa(uaddr) >> TCE_SHIFT; 616 rpn = __pa(uaddr) >> tbl->it_page_shift;
568 617
569 while (npages--) 618 while (npages--)
570 *(tcep++) = cpu_to_be64(proto_tce | (rpn++ << TCE_RPN_SHIFT)); 619 *(tcep++) = cpu_to_be64(proto_tce |
620 (rpn++ << tbl->it_page_shift));
571 621
572 /* Some implementations won't cache invalid TCEs and thus may not 622 /* Some implementations won't cache invalid TCEs and thus may not
573 * need that flush. We'll probably turn it_type into a bit mask 623 * need that flush. We'll probably turn it_type into a bit mask
@@ -627,11 +677,11 @@ static void pnv_tce_free_rm(struct iommu_table *tbl, long index, long npages)
627 677
628void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 678void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
629 void *tce_mem, u64 tce_size, 679 void *tce_mem, u64 tce_size,
630 u64 dma_offset) 680 u64 dma_offset, unsigned page_shift)
631{ 681{
632 tbl->it_blocksize = 16; 682 tbl->it_blocksize = 16;
633 tbl->it_base = (unsigned long)tce_mem; 683 tbl->it_base = (unsigned long)tce_mem;
634 tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K; 684 tbl->it_page_shift = page_shift;
635 tbl->it_offset = dma_offset >> tbl->it_page_shift; 685 tbl->it_offset = dma_offset >> tbl->it_page_shift;
636 tbl->it_index = 0; 686 tbl->it_index = 0;
637 tbl->it_size = tce_size >> 3; 687 tbl->it_size = tce_size >> 3;
@@ -656,7 +706,7 @@ static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
656 if (WARN_ON(!tbl)) 706 if (WARN_ON(!tbl))
657 return NULL; 707 return NULL;
658 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)), 708 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)),
659 be32_to_cpup(sizep), 0); 709 be32_to_cpup(sizep), 0, IOMMU_PAGE_SHIFT_4K);
660 iommu_init_table(tbl, hose->node); 710 iommu_init_table(tbl, hose->node);
661 iommu_register_group(tbl, pci_domain_nr(hose->bus), 0); 711 iommu_register_group(tbl, pci_domain_nr(hose->bus), 0);
662 712
@@ -842,5 +892,4 @@ static int __init tce_iommu_bus_notifier_init(void)
842 bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb); 892 bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
843 return 0; 893 return 0;
844} 894}
845 895machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init);
846subsys_initcall_sync(tce_iommu_bus_notifier_init);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 676232c34328..48494d4b6058 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -21,6 +21,8 @@ enum pnv_phb_model {
21#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */ 21#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */
22#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */ 22#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */
23#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */ 23#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
24#define PNV_IODA_PE_MASTER (1 << 3) /* Master PE in compound case */
25#define PNV_IODA_PE_SLAVE (1 << 4) /* Slave PE in compound case */
24 26
25/* Data associated with a PE, including IOMMU tracking etc.. */ 27/* Data associated with a PE, including IOMMU tracking etc.. */
26struct pnv_phb; 28struct pnv_phb;
@@ -64,6 +66,10 @@ struct pnv_ioda_pe {
64 */ 66 */
65 int mve_number; 67 int mve_number;
66 68
69 /* PEs in compound case */
70 struct pnv_ioda_pe *master;
71 struct list_head slaves;
72
67 /* Link in list of PE#s */ 73 /* Link in list of PE#s */
68 struct list_head dma_link; 74 struct list_head dma_link;
69 struct list_head list; 75 struct list_head list;
@@ -119,6 +125,12 @@ struct pnv_phb {
119 void (*fixup_phb)(struct pci_controller *hose); 125 void (*fixup_phb)(struct pci_controller *hose);
120 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 126 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
121 void (*shutdown)(struct pnv_phb *phb); 127 void (*shutdown)(struct pnv_phb *phb);
128 int (*init_m64)(struct pnv_phb *phb);
129 void (*alloc_m64_pe)(struct pnv_phb *phb);
130 int (*pick_m64_pe)(struct pnv_phb *phb, struct pci_bus *bus, int all);
131 int (*get_pe_state)(struct pnv_phb *phb, int pe_no);
132 void (*freeze_pe)(struct pnv_phb *phb, int pe_no);
133 int (*unfreeze_pe)(struct pnv_phb *phb, int pe_no, int opt);
122 134
123 union { 135 union {
124 struct { 136 struct {
@@ -129,9 +141,20 @@ struct pnv_phb {
129 /* Global bridge info */ 141 /* Global bridge info */
130 unsigned int total_pe; 142 unsigned int total_pe;
131 unsigned int reserved_pe; 143 unsigned int reserved_pe;
144
145 /* 32-bit MMIO window */
132 unsigned int m32_size; 146 unsigned int m32_size;
133 unsigned int m32_segsize; 147 unsigned int m32_segsize;
134 unsigned int m32_pci_base; 148 unsigned int m32_pci_base;
149
150 /* 64-bit MMIO window */
151 unsigned int m64_bar_idx;
152 unsigned long m64_size;
153 unsigned long m64_segsize;
154 unsigned long m64_base;
155 unsigned long m64_bar_alloc;
156
157 /* IO ports */
135 unsigned int io_size; 158 unsigned int io_size;
136 unsigned int io_segsize; 159 unsigned int io_segsize;
137 unsigned int io_pci_base; 160 unsigned int io_pci_base;
@@ -198,7 +221,7 @@ int pnv_pci_cfg_write(struct device_node *dn,
198 int where, int size, u32 val); 221 int where, int size, u32 val);
199extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 222extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
200 void *tce_mem, u64 tce_size, 223 void *tce_mem, u64 tce_size,
201 u64 dma_offset); 224 u64 dma_offset, unsigned page_shift);
202extern void pnv_pci_init_p5ioc2_hub(struct device_node *np); 225extern void pnv_pci_init_p5ioc2_hub(struct device_node *np);
203extern void pnv_pci_init_ioda_hub(struct device_node *np); 226extern void pnv_pci_init_ioda_hub(struct device_node *np);
204extern void pnv_pci_init_ioda2_phb(struct device_node *np); 227extern void pnv_pci_init_ioda2_phb(struct device_node *np);
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index 1cb160dc1609..80db43944afe 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -123,4 +123,4 @@ static __init int rng_init(void)
123 123
124 return 0; 124 return 0;
125} 125}
126subsys_initcall(rng_init); 126machine_subsys_initcall(powernv, rng_init);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index d9b88fa7c5a3..5a0e2dc6de5f 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -264,6 +264,8 @@ static void __init pnv_setup_machdep_opal(void)
264 ppc_md.halt = pnv_halt; 264 ppc_md.halt = pnv_halt;
265 ppc_md.machine_check_exception = opal_machine_check; 265 ppc_md.machine_check_exception = opal_machine_check;
266 ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery; 266 ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery;
267 ppc_md.hmi_exception_early = opal_hmi_exception_early;
268 ppc_md.handle_hmi_exception = opal_handle_hmi_exception;
267} 269}
268 270
269#ifdef CONFIG_PPC_POWERNV_RTAS 271#ifdef CONFIG_PPC_POWERNV_RTAS
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 2d0b4d68a40a..a2450b8a50a5 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -400,10 +400,10 @@ out:
400static ssize_t dlpar_cpu_probe(const char *buf, size_t count) 400static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
401{ 401{
402 struct device_node *dn, *parent; 402 struct device_node *dn, *parent;
403 unsigned long drc_index; 403 u32 drc_index;
404 int rc; 404 int rc;
405 405
406 rc = strict_strtoul(buf, 0, &drc_index); 406 rc = kstrtou32(buf, 0, &drc_index);
407 if (rc) 407 if (rc)
408 return -EINVAL; 408 return -EINVAL;
409 409
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 7d61498e45c0..1062f71f5a85 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -29,6 +29,7 @@
29#include <asm/lppaca.h> 29#include <asm/lppaca.h>
30#include <asm/debug.h> 30#include <asm/debug.h>
31#include <asm/plpar_wrappers.h> 31#include <asm/plpar_wrappers.h>
32#include <asm/machdep.h>
32 33
33struct dtl { 34struct dtl {
34 struct dtl_entry *buf; 35 struct dtl_entry *buf;
@@ -391,4 +392,4 @@ err_remove_dir:
391err: 392err:
392 return rc; 393 return rc;
393} 394}
394arch_initcall(dtl_init); 395machine_arch_initcall(pseries, dtl_init);
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 0bec0c02c5e7..b08053819d99 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -89,26 +89,26 @@ static int pseries_eeh_init(void)
89 * of domain/bus/slot/function for EEH RTAS operations. 89 * of domain/bus/slot/function for EEH RTAS operations.
90 */ 90 */
91 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) { 91 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
92 pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n", 92 pr_warn("%s: RTAS service <ibm,set-eeh-option> invalid\n",
93 __func__); 93 __func__);
94 return -EINVAL; 94 return -EINVAL;
95 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) { 95 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) {
96 pr_warning("%s: RTAS service <ibm,set-slot-reset> invalid\n", 96 pr_warn("%s: RTAS service <ibm,set-slot-reset> invalid\n",
97 __func__); 97 __func__);
98 return -EINVAL; 98 return -EINVAL;
99 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE && 99 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
100 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) { 100 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) {
101 pr_warning("%s: RTAS service <ibm,read-slot-reset-state2> and " 101 pr_warn("%s: RTAS service <ibm,read-slot-reset-state2> and "
102 "<ibm,read-slot-reset-state> invalid\n", 102 "<ibm,read-slot-reset-state> invalid\n",
103 __func__); 103 __func__);
104 return -EINVAL; 104 return -EINVAL;
105 } else if (ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE) { 105 } else if (ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE) {
106 pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n", 106 pr_warn("%s: RTAS service <ibm,slot-error-detail> invalid\n",
107 __func__); 107 __func__);
108 return -EINVAL; 108 return -EINVAL;
109 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE && 109 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
110 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) { 110 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
111 pr_warning("%s: RTAS service <ibm,configure-pe> and " 111 pr_warn("%s: RTAS service <ibm,configure-pe> and "
112 "<ibm,configure-bridge> invalid\n", 112 "<ibm,configure-bridge> invalid\n",
113 __func__); 113 __func__);
114 return -EINVAL; 114 return -EINVAL;
@@ -118,17 +118,17 @@ static int pseries_eeh_init(void)
118 spin_lock_init(&slot_errbuf_lock); 118 spin_lock_init(&slot_errbuf_lock);
119 eeh_error_buf_size = rtas_token("rtas-error-log-max"); 119 eeh_error_buf_size = rtas_token("rtas-error-log-max");
120 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) { 120 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) {
121 pr_warning("%s: unknown EEH error log size\n", 121 pr_warn("%s: unknown EEH error log size\n",
122 __func__); 122 __func__);
123 eeh_error_buf_size = 1024; 123 eeh_error_buf_size = 1024;
124 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) { 124 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) {
125 pr_warning("%s: EEH error log size %d exceeds the maximal %d\n", 125 pr_warn("%s: EEH error log size %d exceeds the maximal %d\n",
126 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX); 126 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX);
127 eeh_error_buf_size = RTAS_ERROR_LOG_MAX; 127 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
128 } 128 }
129 129
130 /* Set EEH probe mode */ 130 /* Set EEH probe mode */
131 eeh_probe_mode_set(EEH_PROBE_MODE_DEVTREE); 131 eeh_add_flag(EEH_PROBE_MODE_DEVTREE | EEH_ENABLE_IO_FOR_LOG);
132 132
133 return 0; 133 return 0;
134} 134}
@@ -270,7 +270,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
270 /* Retrieve the device address */ 270 /* Retrieve the device address */
271 regs = of_get_property(dn, "reg", NULL); 271 regs = of_get_property(dn, "reg", NULL);
272 if (!regs) { 272 if (!regs) {
273 pr_warning("%s: OF node property %s::reg not found\n", 273 pr_warn("%s: OF node property %s::reg not found\n",
274 __func__, dn->full_name); 274 __func__, dn->full_name);
275 return NULL; 275 return NULL;
276 } 276 }
@@ -297,7 +297,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
297 enable = 1; 297 enable = 1;
298 298
299 if (enable) { 299 if (enable) {
300 eeh_set_enable(true); 300 eeh_add_flag(EEH_ENABLED);
301 eeh_add_to_parent_pe(edev); 301 eeh_add_to_parent_pe(edev);
302 302
303 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n", 303 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n",
@@ -398,7 +398,7 @@ static int pseries_eeh_get_pe_addr(struct eeh_pe *pe)
398 pe->config_addr, BUID_HI(pe->phb->buid), 398 pe->config_addr, BUID_HI(pe->phb->buid),
399 BUID_LO(pe->phb->buid), 0); 399 BUID_LO(pe->phb->buid), 0);
400 if (ret) { 400 if (ret) {
401 pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n", 401 pr_warn("%s: Failed to get address for PHB#%d-PE#%x\n",
402 __func__, pe->phb->global_number, pe->config_addr); 402 __func__, pe->phb->global_number, pe->config_addr);
403 return 0; 403 return 0;
404 } 404 }
@@ -411,7 +411,7 @@ static int pseries_eeh_get_pe_addr(struct eeh_pe *pe)
411 pe->config_addr, BUID_HI(pe->phb->buid), 411 pe->config_addr, BUID_HI(pe->phb->buid),
412 BUID_LO(pe->phb->buid), 0); 412 BUID_LO(pe->phb->buid), 0);
413 if (ret) { 413 if (ret) {
414 pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n", 414 pr_warn("%s: Failed to get address for PHB#%d-PE#%x\n",
415 __func__, pe->phb->global_number, pe->config_addr); 415 __func__, pe->phb->global_number, pe->config_addr);
416 return 0; 416 return 0;
417 } 417 }
@@ -584,17 +584,17 @@ static int pseries_eeh_wait_state(struct eeh_pe *pe, int max_wait)
584 return ret; 584 return ret;
585 585
586 if (max_wait <= 0) { 586 if (max_wait <= 0) {
587 pr_warning("%s: Timeout when getting PE's state (%d)\n", 587 pr_warn("%s: Timeout when getting PE's state (%d)\n",
588 __func__, max_wait); 588 __func__, max_wait);
589 return EEH_STATE_NOT_SUPPORT; 589 return EEH_STATE_NOT_SUPPORT;
590 } 590 }
591 591
592 if (mwait <= 0) { 592 if (mwait <= 0) {
593 pr_warning("%s: Firmware returned bad wait value %d\n", 593 pr_warn("%s: Firmware returned bad wait value %d\n",
594 __func__, mwait); 594 __func__, mwait);
595 mwait = EEH_STATE_MIN_WAIT_TIME; 595 mwait = EEH_STATE_MIN_WAIT_TIME;
596 } else if (mwait > EEH_STATE_MAX_WAIT_TIME) { 596 } else if (mwait > EEH_STATE_MAX_WAIT_TIME) {
597 pr_warning("%s: Firmware returned too long wait value %d\n", 597 pr_warn("%s: Firmware returned too long wait value %d\n",
598 __func__, mwait); 598 __func__, mwait);
599 mwait = EEH_STATE_MAX_WAIT_TIME; 599 mwait = EEH_STATE_MAX_WAIT_TIME;
600 } 600 }
@@ -675,7 +675,7 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
675 } 675 }
676 676
677 if (ret) 677 if (ret)
678 pr_warning("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n", 678 pr_warn("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n",
679 __func__, pe->phb->global_number, pe->addr, ret); 679 __func__, pe->phb->global_number, pe->addr, ret);
680 680
681 return ret; 681 return ret;
@@ -743,10 +743,7 @@ static struct eeh_ops pseries_eeh_ops = {
743 */ 743 */
744static int __init eeh_pseries_init(void) 744static int __init eeh_pseries_init(void)
745{ 745{
746 int ret = -EINVAL; 746 int ret;
747
748 if (!machine_is(pseries))
749 return ret;
750 747
751 ret = eeh_ops_register(&pseries_eeh_ops); 748 ret = eeh_ops_register(&pseries_eeh_ops);
752 if (!ret) 749 if (!ret)
@@ -757,5 +754,4 @@ static int __init eeh_pseries_init(void)
757 754
758 return ret; 755 return ret;
759} 756}
760 757machine_early_initcall(pseries, eeh_pseries_init);
761early_initcall(eeh_pseries_init);
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 7995135170a3..c904583baf4b 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -146,7 +146,7 @@ static inline int pseries_remove_memblock(unsigned long base,
146} 146}
147static inline int pseries_remove_mem_node(struct device_node *np) 147static inline int pseries_remove_mem_node(struct device_node *np)
148{ 148{
149 return -EOPNOTSUPP; 149 return 0;
150} 150}
151#endif /* CONFIG_MEMORY_HOTREMOVE */ 151#endif /* CONFIG_MEMORY_HOTREMOVE */
152 152
@@ -194,7 +194,7 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
194 if (!memblock_size) 194 if (!memblock_size)
195 return -EINVAL; 195 return -EINVAL;
196 196
197 p = (u32 *)of_get_property(pr->dn, "ibm,dynamic-memory", NULL); 197 p = (u32 *) pr->old_prop->value;
198 if (!p) 198 if (!p)
199 return -EINVAL; 199 return -EINVAL;
200 200
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 99ecf0a5a929..3fda3f17b84e 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -12,9 +12,13 @@
12#include <asm/ppc_asm.h> 12#include <asm/ppc_asm.h>
13#include <asm/asm-offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/jump_label.h>
16
17 .section ".text"
15 18
16#ifdef CONFIG_TRACEPOINTS 19#ifdef CONFIG_TRACEPOINTS
17 20
21#ifndef CONFIG_JUMP_LABEL
18 .section ".toc","aw" 22 .section ".toc","aw"
19 23
20 .globl hcall_tracepoint_refcount 24 .globl hcall_tracepoint_refcount
@@ -22,21 +26,13 @@ hcall_tracepoint_refcount:
22 .llong 0 26 .llong 0
23 27
24 .section ".text" 28 .section ".text"
29#endif
25 30
26/* 31/*
27 * precall must preserve all registers. use unused STK_PARAM() 32 * precall must preserve all registers. use unused STK_PARAM()
28 * areas to save snapshots and opcode. We branch around this 33 * areas to save snapshots and opcode.
29 * in early init (eg when populating the MMU hashtable) by using an
30 * unconditional cpu feature.
31 */ 34 */
32#define HCALL_INST_PRECALL(FIRST_REG) \ 35#define HCALL_INST_PRECALL(FIRST_REG) \
33BEGIN_FTR_SECTION; \
34 b 1f; \
35END_FTR_SECTION(0, 1); \
36 ld r12,hcall_tracepoint_refcount@toc(r2); \
37 std r12,32(r1); \
38 cmpdi r12,0; \
39 beq+ 1f; \
40 mflr r0; \ 36 mflr r0; \
41 std r3,STK_PARAM(R3)(r1); \ 37 std r3,STK_PARAM(R3)(r1); \
42 std r4,STK_PARAM(R4)(r1); \ 38 std r4,STK_PARAM(R4)(r1); \
@@ -50,45 +46,29 @@ END_FTR_SECTION(0, 1); \
50 addi r4,r1,STK_PARAM(FIRST_REG); \ 46 addi r4,r1,STK_PARAM(FIRST_REG); \
51 stdu r1,-STACK_FRAME_OVERHEAD(r1); \ 47 stdu r1,-STACK_FRAME_OVERHEAD(r1); \
52 bl __trace_hcall_entry; \ 48 bl __trace_hcall_entry; \
53 addi r1,r1,STACK_FRAME_OVERHEAD; \ 49 ld r3,STACK_FRAME_OVERHEAD+STK_PARAM(R3)(r1); \
54 ld r0,16(r1); \ 50 ld r4,STACK_FRAME_OVERHEAD+STK_PARAM(R4)(r1); \
55 ld r3,STK_PARAM(R3)(r1); \ 51 ld r5,STACK_FRAME_OVERHEAD+STK_PARAM(R5)(r1); \
56 ld r4,STK_PARAM(R4)(r1); \ 52 ld r6,STACK_FRAME_OVERHEAD+STK_PARAM(R6)(r1); \
57 ld r5,STK_PARAM(R5)(r1); \ 53 ld r7,STACK_FRAME_OVERHEAD+STK_PARAM(R7)(r1); \
58 ld r6,STK_PARAM(R6)(r1); \ 54 ld r8,STACK_FRAME_OVERHEAD+STK_PARAM(R8)(r1); \
59 ld r7,STK_PARAM(R7)(r1); \ 55 ld r9,STACK_FRAME_OVERHEAD+STK_PARAM(R9)(r1); \
60 ld r8,STK_PARAM(R8)(r1); \ 56 ld r10,STACK_FRAME_OVERHEAD+STK_PARAM(R10)(r1)
61 ld r9,STK_PARAM(R9)(r1); \
62 ld r10,STK_PARAM(R10)(r1); \
63 mtlr r0; \
641:
65 57
66/* 58/*
67 * postcall is performed immediately before function return which 59 * postcall is performed immediately before function return which
68 * allows liberal use of volatile registers. We branch around this 60 * allows liberal use of volatile registers.
69 * in early init (eg when populating the MMU hashtable) by using an
70 * unconditional cpu feature.
71 */ 61 */
72#define __HCALL_INST_POSTCALL \ 62#define __HCALL_INST_POSTCALL \
73BEGIN_FTR_SECTION; \ 63 ld r0,STACK_FRAME_OVERHEAD+STK_PARAM(R3)(r1); \
74 b 1f; \ 64 std r3,STACK_FRAME_OVERHEAD+STK_PARAM(R3)(r1); \
75END_FTR_SECTION(0, 1); \
76 ld r12,32(r1); \
77 cmpdi r12,0; \
78 beq+ 1f; \
79 mflr r0; \
80 ld r6,STK_PARAM(R3)(r1); \
81 std r3,STK_PARAM(R3)(r1); \
82 mr r4,r3; \ 65 mr r4,r3; \
83 mr r3,r6; \ 66 mr r3,r0; \
84 std r0,16(r1); \
85 stdu r1,-STACK_FRAME_OVERHEAD(r1); \
86 bl __trace_hcall_exit; \ 67 bl __trace_hcall_exit; \
68 ld r0,STACK_FRAME_OVERHEAD+16(r1); \
87 addi r1,r1,STACK_FRAME_OVERHEAD; \ 69 addi r1,r1,STACK_FRAME_OVERHEAD; \
88 ld r0,16(r1); \
89 ld r3,STK_PARAM(R3)(r1); \ 70 ld r3,STK_PARAM(R3)(r1); \
90 mtlr r0; \ 71 mtlr r0
911:
92 72
93#define HCALL_INST_POSTCALL_NORETS \ 73#define HCALL_INST_POSTCALL_NORETS \
94 li r5,0; \ 74 li r5,0; \
@@ -98,37 +78,62 @@ END_FTR_SECTION(0, 1); \
98 mr r5,BUFREG; \ 78 mr r5,BUFREG; \
99 __HCALL_INST_POSTCALL 79 __HCALL_INST_POSTCALL
100 80
81#ifdef CONFIG_JUMP_LABEL
82#define HCALL_BRANCH(LABEL) \
83 ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key)
84#else
85
86/*
87 * We branch around this in early init (eg when populating the MMU
88 * hashtable) by using an unconditional cpu feature.
89 */
90#define HCALL_BRANCH(LABEL) \
91BEGIN_FTR_SECTION; \
92 b 1f; \
93END_FTR_SECTION(0, 1); \
94 ld r12,hcall_tracepoint_refcount@toc(r2); \
95 std r12,32(r1); \
96 cmpdi r12,0; \
97 bne- LABEL; \
981:
99#endif
100
101#else 101#else
102#define HCALL_INST_PRECALL(FIRST_ARG) 102#define HCALL_INST_PRECALL(FIRST_ARG)
103#define HCALL_INST_POSTCALL_NORETS 103#define HCALL_INST_POSTCALL_NORETS
104#define HCALL_INST_POSTCALL(BUFREG) 104#define HCALL_INST_POSTCALL(BUFREG)
105#define HCALL_BRANCH(LABEL)
105#endif 106#endif
106 107
107 .text
108
109_GLOBAL_TOC(plpar_hcall_norets) 108_GLOBAL_TOC(plpar_hcall_norets)
110 HMT_MEDIUM 109 HMT_MEDIUM
111 110
112 mfcr r0 111 mfcr r0
113 stw r0,8(r1) 112 stw r0,8(r1)
114 113 HCALL_BRANCH(plpar_hcall_norets_trace)
115 HCALL_INST_PRECALL(R4)
116
117 HVSC /* invoke the hypervisor */ 114 HVSC /* invoke the hypervisor */
118 115
119 HCALL_INST_POSTCALL_NORETS
120
121 lwz r0,8(r1) 116 lwz r0,8(r1)
122 mtcrf 0xff,r0 117 mtcrf 0xff,r0
123 blr /* return r3 = status */ 118 blr /* return r3 = status */
124 119
120#ifdef CONFIG_TRACEPOINTS
121plpar_hcall_norets_trace:
122 HCALL_INST_PRECALL(R4)
123 HVSC
124 HCALL_INST_POSTCALL_NORETS
125 lwz r0,8(r1)
126 mtcrf 0xff,r0
127 blr
128#endif
129
125_GLOBAL_TOC(plpar_hcall) 130_GLOBAL_TOC(plpar_hcall)
126 HMT_MEDIUM 131 HMT_MEDIUM
127 132
128 mfcr r0 133 mfcr r0
129 stw r0,8(r1) 134 stw r0,8(r1)
130 135
131 HCALL_INST_PRECALL(R5) 136 HCALL_BRANCH(plpar_hcall_trace)
132 137
133 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */ 138 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
134 139
@@ -147,12 +152,40 @@ _GLOBAL_TOC(plpar_hcall)
147 std r6, 16(r12) 152 std r6, 16(r12)
148 std r7, 24(r12) 153 std r7, 24(r12)
149 154
155 lwz r0,8(r1)
156 mtcrf 0xff,r0
157
158 blr /* return r3 = status */
159
160#ifdef CONFIG_TRACEPOINTS
161plpar_hcall_trace:
162 HCALL_INST_PRECALL(R5)
163
164 std r4,STK_PARAM(R4)(r1)
165 mr r0,r4
166
167 mr r4,r5
168 mr r5,r6
169 mr r6,r7
170 mr r7,r8
171 mr r8,r9
172 mr r9,r10
173
174 HVSC
175
176 ld r12,STK_PARAM(R4)(r1)
177 std r4,0(r12)
178 std r5,8(r12)
179 std r6,16(r12)
180 std r7,24(r12)
181
150 HCALL_INST_POSTCALL(r12) 182 HCALL_INST_POSTCALL(r12)
151 183
152 lwz r0,8(r1) 184 lwz r0,8(r1)
153 mtcrf 0xff,r0 185 mtcrf 0xff,r0
154 186
155 blr /* return r3 = status */ 187 blr
188#endif
156 189
157/* 190/*
158 * plpar_hcall_raw can be called in real mode. kexec/kdump need some 191 * plpar_hcall_raw can be called in real mode. kexec/kdump need some
@@ -194,7 +227,7 @@ _GLOBAL_TOC(plpar_hcall9)
194 mfcr r0 227 mfcr r0
195 stw r0,8(r1) 228 stw r0,8(r1)
196 229
197 HCALL_INST_PRECALL(R5) 230 HCALL_BRANCH(plpar_hcall9_trace)
198 231
199 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */ 232 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
200 233
@@ -222,12 +255,49 @@ _GLOBAL_TOC(plpar_hcall9)
222 std r11,56(r12) 255 std r11,56(r12)
223 std r0, 64(r12) 256 std r0, 64(r12)
224 257
258 lwz r0,8(r1)
259 mtcrf 0xff,r0
260
261 blr /* return r3 = status */
262
263#ifdef CONFIG_TRACEPOINTS
264plpar_hcall9_trace:
265 HCALL_INST_PRECALL(R5)
266
267 std r4,STK_PARAM(R4)(r1)
268 mr r0,r4
269
270 mr r4,r5
271 mr r5,r6
272 mr r6,r7
273 mr r7,r8
274 mr r8,r9
275 mr r9,r10
276 ld r10,STACK_FRAME_OVERHEAD+STK_PARAM(R11)(r1)
277 ld r11,STACK_FRAME_OVERHEAD+STK_PARAM(R12)(r1)
278 ld r12,STACK_FRAME_OVERHEAD+STK_PARAM(R13)(r1)
279
280 HVSC
281
282 mr r0,r12
283 ld r12,STACK_FRAME_OVERHEAD+STK_PARAM(R4)(r1)
284 std r4,0(r12)
285 std r5,8(r12)
286 std r6,16(r12)
287 std r7,24(r12)
288 std r8,32(r12)
289 std r9,40(r12)
290 std r10,48(r12)
291 std r11,56(r12)
292 std r0,64(r12)
293
225 HCALL_INST_POSTCALL(r12) 294 HCALL_INST_POSTCALL(r12)
226 295
227 lwz r0,8(r1) 296 lwz r0,8(r1)
228 mtcrf 0xff,r0 297 mtcrf 0xff,r0
229 298
230 blr /* return r3 = status */ 299 blr
300#endif
231 301
232/* See plpar_hcall_raw to see why this is needed */ 302/* See plpar_hcall_raw to see why this is needed */
233_GLOBAL(plpar_hcall9_raw) 303_GLOBAL(plpar_hcall9_raw)
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index cf4e7736e4f1..4575f0c9e521 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -27,6 +27,7 @@
27#include <asm/firmware.h> 27#include <asm/firmware.h>
28#include <asm/cputable.h> 28#include <asm/cputable.h>
29#include <asm/trace.h> 29#include <asm/trace.h>
30#include <asm/machdep.h>
30 31
31DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats); 32DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
32 33
@@ -162,4 +163,4 @@ static int __init hcall_inst_init(void)
162 163
163 return 0; 164 return 0;
164} 165}
165__initcall(hcall_inst_init); 166machine_device_initcall(pseries, hcall_inst_init);
diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c
index 4557e91626c4..eedb64594dc5 100644
--- a/arch/powerpc/platforms/pseries/hvcserver.c
+++ b/arch/powerpc/platforms/pseries/hvcserver.c
@@ -163,8 +163,8 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
163 return retval; 163 return retval;
164 } 164 }
165 165
166 last_p_partition_ID = pi_buff[0]; 166 last_p_partition_ID = be64_to_cpu(pi_buff[0]);
167 last_p_unit_address = pi_buff[1]; 167 last_p_unit_address = be64_to_cpu(pi_buff[1]);
168 168
169 /* This indicates that there are no further partners */ 169 /* This indicates that there are no further partners */
170 if (last_p_partition_ID == ~0UL 170 if (last_p_partition_ID == ~0UL
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 33b552ffbe57..4642d6a4d356 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -721,13 +721,13 @@ static int __init disable_ddw_setup(char *str)
721 721
722early_param("disable_ddw", disable_ddw_setup); 722early_param("disable_ddw", disable_ddw_setup);
723 723
724static void remove_ddw(struct device_node *np) 724static void remove_ddw(struct device_node *np, bool remove_prop)
725{ 725{
726 struct dynamic_dma_window_prop *dwp; 726 struct dynamic_dma_window_prop *dwp;
727 struct property *win64; 727 struct property *win64;
728 const u32 *ddw_avail; 728 const u32 *ddw_avail;
729 u64 liobn; 729 u64 liobn;
730 int len, ret; 730 int len, ret = 0;
731 731
732 ddw_avail = of_get_property(np, "ibm,ddw-applicable", &len); 732 ddw_avail = of_get_property(np, "ibm,ddw-applicable", &len);
733 win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); 733 win64 = of_find_property(np, DIRECT64_PROPNAME, NULL);
@@ -761,7 +761,8 @@ static void remove_ddw(struct device_node *np)
761 np->full_name, ret, ddw_avail[2], liobn); 761 np->full_name, ret, ddw_avail[2], liobn);
762 762
763delprop: 763delprop:
764 ret = of_remove_property(np, win64); 764 if (remove_prop)
765 ret = of_remove_property(np, win64);
765 if (ret) 766 if (ret)
766 pr_warning("%s: failed to remove direct window property: %d\n", 767 pr_warning("%s: failed to remove direct window property: %d\n",
767 np->full_name, ret); 768 np->full_name, ret);
@@ -805,7 +806,7 @@ static int find_existing_ddw_windows(void)
805 window = kzalloc(sizeof(*window), GFP_KERNEL); 806 window = kzalloc(sizeof(*window), GFP_KERNEL);
806 if (!window || len < sizeof(struct dynamic_dma_window_prop)) { 807 if (!window || len < sizeof(struct dynamic_dma_window_prop)) {
807 kfree(window); 808 kfree(window);
808 remove_ddw(pdn); 809 remove_ddw(pdn, true);
809 continue; 810 continue;
810 } 811 }
811 812
@@ -1045,7 +1046,7 @@ out_free_window:
1045 kfree(window); 1046 kfree(window);
1046 1047
1047out_clear_window: 1048out_clear_window:
1048 remove_ddw(pdn); 1049 remove_ddw(pdn, true);
1049 1050
1050out_free_prop: 1051out_free_prop:
1051 kfree(win64->name); 1052 kfree(win64->name);
@@ -1255,7 +1256,14 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
1255 1256
1256 switch (action) { 1257 switch (action) {
1257 case OF_RECONFIG_DETACH_NODE: 1258 case OF_RECONFIG_DETACH_NODE:
1258 remove_ddw(np); 1259 /*
1260 * Removing the property will invoke the reconfig
1261 * notifier again, which causes dead-lock on the
1262 * read-write semaphore of the notifier chain. So
1263 * we have to remove the property when releasing
1264 * the device node.
1265 */
1266 remove_ddw(np, false);
1259 if (pci && pci->iommu_table) 1267 if (pci && pci->iommu_table)
1260 iommu_free_table(pci->iommu_table, np->full_name); 1268 iommu_free_table(pci->iommu_table, np->full_name);
1261 1269
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index b02af9ef3ff6..34e64237fff9 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -26,6 +26,7 @@
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/export.h> 28#include <linux/export.h>
29#include <linux/static_key.h>
29#include <asm/processor.h> 30#include <asm/processor.h>
30#include <asm/mmu.h> 31#include <asm/mmu.h>
31#include <asm/page.h> 32#include <asm/page.h>
@@ -430,16 +431,17 @@ static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
430 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); 431 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
431} 432}
432 433
433static void pSeries_lpar_hugepage_invalidate(struct mm_struct *mm, 434static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,
434 unsigned char *hpte_slot_array, 435 unsigned long addr,
435 unsigned long addr, int psize) 436 unsigned char *hpte_slot_array,
437 int psize, int ssize)
436{ 438{
437 int ssize = 0, i, index = 0; 439 int i, index = 0;
438 unsigned long s_addr = addr; 440 unsigned long s_addr = addr;
439 unsigned int max_hpte_count, valid; 441 unsigned int max_hpte_count, valid;
440 unsigned long vpn_array[PPC64_HUGE_HPTE_BATCH]; 442 unsigned long vpn_array[PPC64_HUGE_HPTE_BATCH];
441 unsigned long slot_array[PPC64_HUGE_HPTE_BATCH]; 443 unsigned long slot_array[PPC64_HUGE_HPTE_BATCH];
442 unsigned long shift, hidx, vpn = 0, vsid, hash, slot; 444 unsigned long shift, hidx, vpn = 0, hash, slot;
443 445
444 shift = mmu_psize_defs[psize].shift; 446 shift = mmu_psize_defs[psize].shift;
445 max_hpte_count = 1U << (PMD_SHIFT - shift); 447 max_hpte_count = 1U << (PMD_SHIFT - shift);
@@ -452,15 +454,6 @@ static void pSeries_lpar_hugepage_invalidate(struct mm_struct *mm,
452 454
453 /* get the vpn */ 455 /* get the vpn */
454 addr = s_addr + (i * (1ul << shift)); 456 addr = s_addr + (i * (1ul << shift));
455 if (!is_kernel_addr(addr)) {
456 ssize = user_segment_size(addr);
457 vsid = get_vsid(mm->context.id, addr, ssize);
458 WARN_ON(vsid == 0);
459 } else {
460 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
461 ssize = mmu_kernel_ssize;
462 }
463
464 vpn = hpt_vpn(addr, vsid, ssize); 457 vpn = hpt_vpn(addr, vsid, ssize);
465 hash = hpt_hash(vpn, shift, ssize); 458 hash = hpt_hash(vpn, shift, ssize);
466 if (hidx & _PTEIDX_SECONDARY) 459 if (hidx & _PTEIDX_SECONDARY)
@@ -649,6 +642,19 @@ EXPORT_SYMBOL(arch_free_page);
649#endif 642#endif
650 643
651#ifdef CONFIG_TRACEPOINTS 644#ifdef CONFIG_TRACEPOINTS
645#ifdef CONFIG_JUMP_LABEL
646struct static_key hcall_tracepoint_key = STATIC_KEY_INIT;
647
648void hcall_tracepoint_regfunc(void)
649{
650 static_key_slow_inc(&hcall_tracepoint_key);
651}
652
653void hcall_tracepoint_unregfunc(void)
654{
655 static_key_slow_dec(&hcall_tracepoint_key);
656}
657#else
652/* 658/*
653 * We optimise our hcall path by placing hcall_tracepoint_refcount 659 * We optimise our hcall path by placing hcall_tracepoint_refcount
654 * directly in the TOC so we can check if the hcall tracepoints are 660 * directly in the TOC so we can check if the hcall tracepoints are
@@ -658,13 +664,6 @@ EXPORT_SYMBOL(arch_free_page);
658/* NB: reg/unreg are called while guarded with the tracepoints_mutex */ 664/* NB: reg/unreg are called while guarded with the tracepoints_mutex */
659extern long hcall_tracepoint_refcount; 665extern long hcall_tracepoint_refcount;
660 666
661/*
662 * Since the tracing code might execute hcalls we need to guard against
663 * recursion. One example of this are spinlocks calling H_YIELD on
664 * shared processor partitions.
665 */
666static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
667
668void hcall_tracepoint_regfunc(void) 667void hcall_tracepoint_regfunc(void)
669{ 668{
670 hcall_tracepoint_refcount++; 669 hcall_tracepoint_refcount++;
@@ -674,6 +673,15 @@ void hcall_tracepoint_unregfunc(void)
674{ 673{
675 hcall_tracepoint_refcount--; 674 hcall_tracepoint_refcount--;
676} 675}
676#endif
677
678/*
679 * Since the tracing code might execute hcalls we need to guard against
680 * recursion. One example of this are spinlocks calling H_YIELD on
681 * shared processor partitions.
682 */
683static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
684
677 685
678void __trace_hcall_entry(unsigned long opcode, unsigned long *args) 686void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
679{ 687{
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index bde7ebad3949..e7cb6d4a871a 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20 20
21#include <asm/machdep.h>
21#include <asm/rtas.h> 22#include <asm/rtas.h>
22#include "pseries.h" 23#include "pseries.h"
23 24
@@ -319,7 +320,7 @@ static ssize_t migrate_store(struct class *class, struct class_attribute *attr,
319 u64 streamid; 320 u64 streamid;
320 int rc; 321 int rc;
321 322
322 rc = strict_strtoull(buf, 0, &streamid); 323 rc = kstrtou64(buf, 0, &streamid);
323 if (rc) 324 if (rc)
324 return rc; 325 return rc;
325 326
@@ -362,4 +363,4 @@ static int __init mobility_sysfs_init(void)
362 363
363 return rc; 364 return rc;
364} 365}
365device_initcall(mobility_sysfs_init); 366machine_device_initcall(pseries, mobility_sysfs_init);
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 0c882e83c4ce..18ff4626d74e 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -16,6 +16,7 @@
16#include <asm/rtas.h> 16#include <asm/rtas.h>
17#include <asm/hw_irq.h> 17#include <asm/hw_irq.h>
18#include <asm/ppc-pci.h> 18#include <asm/ppc-pci.h>
19#include <asm/machdep.h>
19 20
20static int query_token, change_token; 21static int query_token, change_token;
21 22
@@ -532,5 +533,4 @@ static int rtas_msi_init(void)
532 533
533 return 0; 534 return 0;
534} 535}
535arch_initcall(rtas_msi_init); 536machine_arch_initcall(pseries, rtas_msi_init);
536
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 203cbf0dc101..89e23811199c 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_controller *phb)
118 } 118 }
119 } 119 }
120 120
121 /* Unregister the bridge device from sysfs and remove the PCI bus */ 121 /* Remove the PCI bus and unregister the bridge device from sysfs */
122 device_unregister(b->bridge);
123 phb->bus = NULL; 122 phb->bus = NULL;
124 pci_remove_bus(b); 123 pci_remove_bus(b);
124 device_unregister(b->bridge);
125 125
126 /* Now release the IO resource */ 126 /* Now release the IO resource */
127 if (res->flags & IORESOURCE_IO) 127 if (res->flags & IORESOURCE_IO)
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index 6d6266236446..c26eadde434c 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -25,6 +25,7 @@
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <asm/machdep.h>
28 29
29unsigned long rtas_poweron_auto; /* default and normal state is 0 */ 30unsigned long rtas_poweron_auto; /* default and normal state is 0 */
30 31
@@ -71,11 +72,11 @@ static int __init pm_init(void)
71 return -ENOMEM; 72 return -ENOMEM;
72 return sysfs_create_group(power_kobj, &attr_group); 73 return sysfs_create_group(power_kobj, &attr_group);
73} 74}
74core_initcall(pm_init); 75machine_core_initcall(pseries, pm_init);
75#else 76#else
76static int __init apo_pm_init(void) 77static int __init apo_pm_init(void)
77{ 78{
78 return (sysfs_create_file(power_kobj, &auto_poweron_attr.attr)); 79 return (sysfs_create_file(power_kobj, &auto_poweron_attr.attr));
79} 80}
80__initcall(apo_pm_init); 81machine_device_initcall(pseries, apo_pm_init);
81#endif 82#endif
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 9c5778e6ed4b..dff05b9eb946 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -71,7 +71,7 @@ static int __init init_ras_IRQ(void)
71 71
72 return 0; 72 return 0;
73} 73}
74subsys_initcall(init_ras_IRQ); 74machine_subsys_initcall(pseries, init_ras_IRQ);
75 75
76#define EPOW_SHUTDOWN_NORMAL 1 76#define EPOW_SHUTDOWN_NORMAL 1
77#define EPOW_SHUTDOWN_ON_UPS 2 77#define EPOW_SHUTDOWN_ON_UPS 2
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1c0a60d98867..0f319521e002 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -446,13 +446,10 @@ static int proc_ppc64_create_ofdt(void)
446{ 446{
447 struct proc_dir_entry *ent; 447 struct proc_dir_entry *ent;
448 448
449 if (!machine_is(pseries))
450 return 0;
451
452 ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops); 449 ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
453 if (ent) 450 if (ent)
454 proc_set_size(ent, 0); 451 proc_set_size(ent, 0);
455 452
456 return 0; 453 return 0;
457} 454}
458__initcall(proc_ppc64_create_ofdt); 455machine_device_initcall(pseries, proc_ppc64_create_ofdt);
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
index 72a102758d4e..e09608770909 100644
--- a/arch/powerpc/platforms/pseries/rng.c
+++ b/arch/powerpc/platforms/pseries/rng.c
@@ -42,4 +42,4 @@ static __init int rng_init(void)
42 42
43 return 0; 43 return 0;
44} 44}
45subsys_initcall(rng_init); 45machine_subsys_initcall(pseries, rng_init);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f2f40e64658f..e724d3186e73 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -232,8 +232,7 @@ static void __init pseries_discover_pic(void)
232 struct device_node *np; 232 struct device_node *np;
233 const char *typep; 233 const char *typep;
234 234
235 for (np = NULL; (np = of_find_node_by_name(np, 235 for_each_node_by_name(np, "interrupt-controller") {
236 "interrupt-controller"));) {
237 typep = of_get_property(np, "compatible", NULL); 236 typep = of_get_property(np, "compatible", NULL);
238 if (strstr(typep, "open-pic")) { 237 if (strstr(typep, "open-pic")) {
239 pSeries_mpic_node = of_node_get(np); 238 pSeries_mpic_node = of_node_get(np);
@@ -351,7 +350,7 @@ static int alloc_dispatch_log_kmem_cache(void)
351 350
352 return alloc_dispatch_logs(); 351 return alloc_dispatch_logs();
353} 352}
354early_initcall(alloc_dispatch_log_kmem_cache); 353machine_early_initcall(pseries, alloc_dispatch_log_kmem_cache);
355 354
356static void pseries_lpar_idle(void) 355static void pseries_lpar_idle(void)
357{ 356{
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index b87b97849d4c..e76aefae2aa2 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -265,7 +265,7 @@ static int __init pseries_suspend_init(void)
265{ 265{
266 int rc; 266 int rc;
267 267
268 if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR)) 268 if (!firmware_has_feature(FW_FEATURE_LPAR))
269 return 0; 269 return 0;
270 270
271 suspend_data.token = rtas_token("ibm,suspend-me"); 271 suspend_data.token = rtas_token("ibm,suspend-me");
@@ -280,5 +280,4 @@ static int __init pseries_suspend_init(void)
280 suspend_set_ops(&pseries_suspend_ops); 280 suspend_set_ops(&pseries_suspend_ops);
281 return 0; 281 return 0;
282} 282}
283 283machine_device_initcall(pseries, pseries_suspend_init);
284__initcall(pseries_suspend_init);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4bd091a05583..c5077673bd94 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -853,8 +853,8 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
853 in = pcie->cfg_type0 + PEX_RC_INWIN_BASE; 853 in = pcie->cfg_type0 + PEX_RC_INWIN_BASE;
854 for (i = 0; i < 4; i++) { 854 for (i = 0; i < 4; i++) {
855 /* not enabled, skip */ 855 /* not enabled, skip */
856 if (!in_le32(&in[i].ar) & PEX_RCIWARn_EN) 856 if (!(in_le32(&in[i].ar) & PEX_RCIWARn_EN))
857 continue; 857 continue;
858 858
859 if (get_immrbase() == in_le32(&in[i].tar)) 859 if (get_immrbase() == in_le32(&in[i].tar))
860 return (u64)in_le32(&in[i].barh) << 32 | 860 return (u64)in_le32(&in[i].barh) << 32 |
diff --git a/arch/powerpc/sysdev/micropatch.c b/arch/powerpc/sysdev/micropatch.c
index c0bb76ef7242..6727dc54d549 100644
--- a/arch/powerpc/sysdev/micropatch.c
+++ b/arch/powerpc/sysdev/micropatch.c
@@ -13,7 +13,6 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/mpc8xx.h>
17#include <asm/page.h> 16#include <asm/page.h>
18#include <asm/pgtable.h> 17#include <asm/pgtable.h>
19#include <asm/8xx_immap.h> 18#include <asm/8xx_immap.h>
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index 2c9b52aa266c..7bdf3cc741e4 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -184,7 +184,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
184 dev_info(&dev->dev, "Found %d message registers\n", 184 dev_info(&dev->dev, "Found %d message registers\n",
185 mpic_msgr_count); 185 mpic_msgr_count);
186 186
187 mpic_msgrs = kzalloc(sizeof(struct mpic_msgr) * mpic_msgr_count, 187 mpic_msgrs = kcalloc(mpic_msgr_count, sizeof(*mpic_msgrs),
188 GFP_KERNEL); 188 GFP_KERNEL);
189 if (!mpic_msgrs) { 189 if (!mpic_msgrs) {
190 dev_err(&dev->dev, 190 dev_err(&dev->dev,
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index d199bfa2f1fa..b988b5addf86 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/bug.h> 26#include <linux/bug.h>
27#include <linux/nmi.h>
27 28
28#include <asm/ptrace.h> 29#include <asm/ptrace.h>
29#include <asm/string.h> 30#include <asm/string.h>
@@ -374,6 +375,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
374#endif 375#endif
375 376
376 local_irq_save(flags); 377 local_irq_save(flags);
378 hard_irq_disable();
377 379
378 bp = in_breakpoint_table(regs->nip, &offset); 380 bp = in_breakpoint_table(regs->nip, &offset);
379 if (bp != NULL) { 381 if (bp != NULL) {
@@ -558,6 +560,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
558#endif 560#endif
559 insert_cpu_bpts(); 561 insert_cpu_bpts();
560 562
563 touch_nmi_watchdog();
561 local_irq_restore(flags); 564 local_irq_restore(flags);
562 565
563 return cmd != 'X' && cmd != EOF; 566 return cmd != 'X' && cmd != EOF;
@@ -2058,10 +2061,6 @@ static void dump_one_paca(int cpu)
2058 DUMP(p, kernel_toc, "lx"); 2061 DUMP(p, kernel_toc, "lx");
2059 DUMP(p, kernelbase, "lx"); 2062 DUMP(p, kernelbase, "lx");
2060 DUMP(p, kernel_msr, "lx"); 2063 DUMP(p, kernel_msr, "lx");
2061#ifdef CONFIG_PPC_STD_MMU_64
2062 DUMP(p, stab_real, "lx");
2063 DUMP(p, stab_addr, "lx");
2064#endif
2065 DUMP(p, emergency_sp, "p"); 2064 DUMP(p, emergency_sp, "p");
2066#ifdef CONFIG_PPC_BOOK3S_64 2065#ifdef CONFIG_PPC_BOOK3S_64
2067 DUMP(p, mc_emergency_sp, "p"); 2066 DUMP(p, mc_emergency_sp, "p");
@@ -2694,7 +2693,7 @@ static void xmon_print_symbol(unsigned long address, const char *mid,
2694} 2693}
2695 2694
2696#ifdef CONFIG_PPC_BOOK3S_64 2695#ifdef CONFIG_PPC_BOOK3S_64
2697static void dump_slb(void) 2696void dump_segments(void)
2698{ 2697{
2699 int i; 2698 int i;
2700 unsigned long esid,vsid,valid; 2699 unsigned long esid,vsid,valid;
@@ -2726,34 +2725,6 @@ static void dump_slb(void)
2726 } 2725 }
2727 } 2726 }
2728} 2727}
2729
2730static void dump_stab(void)
2731{
2732 int i;
2733 unsigned long *tmp = (unsigned long *)local_paca->stab_addr;
2734
2735 printf("Segment table contents of cpu 0x%x\n", smp_processor_id());
2736
2737 for (i = 0; i < PAGE_SIZE/16; i++) {
2738 unsigned long a, b;
2739
2740 a = *tmp++;
2741 b = *tmp++;
2742
2743 if (a || b) {
2744 printf("%03d %016lx ", i, a);
2745 printf("%016lx\n", b);
2746 }
2747 }
2748}
2749
2750void dump_segments(void)
2751{
2752 if (mmu_has_feature(MMU_FTR_SLB))
2753 dump_slb();
2754 else
2755 dump_stab();
2756}
2757#endif 2728#endif
2758 2729
2759#ifdef CONFIG_PPC_STD_MMU_32 2730#ifdef CONFIG_PPC_STD_MMU_32
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f5af5f6ef0f4..ab39ceb89ecf 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -48,6 +48,8 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC
48 48
49config KEXEC 49config KEXEC
50 def_bool y 50 def_bool y
51 select CRYPTO
52 select CRYPTO_SHA256
51 53
52config AUDIT_ARCH 54config AUDIT_ARCH
53 def_bool y 55 def_bool y
@@ -92,6 +94,7 @@ config S390
92 select ARCH_INLINE_WRITE_UNLOCK_IRQ 94 select ARCH_INLINE_WRITE_UNLOCK_IRQ
93 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 95 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 96 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
97 select ARCH_SUPPORTS_ATOMIC_RMW
95 select ARCH_USE_CMPXCHG_LOCKREF 98 select ARCH_USE_CMPXCHG_LOCKREF
96 select ARCH_WANT_IPC_PARSE_VERSION 99 select ARCH_WANT_IPC_PARSE_VERSION
97 select BUILDTIME_EXTABLE_SORT 100 select BUILDTIME_EXTABLE_SORT
@@ -136,7 +139,6 @@ config S390
136 select HAVE_SYSCALL_TRACEPOINTS 139 select HAVE_SYSCALL_TRACEPOINTS
137 select HAVE_UID16 if 32BIT 140 select HAVE_UID16 if 32BIT
138 select HAVE_VIRT_CPU_ACCOUNTING 141 select HAVE_VIRT_CPU_ACCOUNTING
139 select KTIME_SCALAR if 32BIT
140 select MODULES_USE_ELF_RELA 142 select MODULES_USE_ELF_RELA
141 select NO_BOOTMEM 143 select NO_BOOTMEM
142 select OLD_SIGACTION 144 select OLD_SIGACTION
@@ -145,6 +147,7 @@ config S390
145 select TTY 147 select TTY
146 select VIRT_CPU_ACCOUNTING 148 select VIRT_CPU_ACCOUNTING
147 select VIRT_TO_BUS 149 select VIRT_TO_BUS
150 select ARCH_HAS_SG_CHAIN
148 151
149config SCHED_OMIT_FRAME_POINTER 152config SCHED_OMIT_FRAME_POINTER
150 def_bool y 153 def_bool y
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index fd09a10a2b53..3ca1894ade09 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -366,7 +366,6 @@ CONFIG_VIRTIO_BLK=y
366CONFIG_ENCLOSURE_SERVICES=m 366CONFIG_ENCLOSURE_SERVICES=m
367CONFIG_RAID_ATTRS=m 367CONFIG_RAID_ATTRS=m
368CONFIG_SCSI=y 368CONFIG_SCSI=y
369CONFIG_SCSI_TGT=m
370CONFIG_BLK_DEV_SD=y 369CONFIG_BLK_DEV_SD=y
371CONFIG_CHR_DEV_ST=m 370CONFIG_CHR_DEV_ST=m
372CONFIG_CHR_DEV_OSST=m 371CONFIG_CHR_DEV_OSST=m
@@ -380,7 +379,6 @@ CONFIG_SCSI_LOGGING=y
380CONFIG_SCSI_SPI_ATTRS=m 379CONFIG_SCSI_SPI_ATTRS=m
381CONFIG_SCSI_SAS_LIBSAS=m 380CONFIG_SCSI_SAS_LIBSAS=m
382CONFIG_SCSI_SRP_ATTRS=m 381CONFIG_SCSI_SRP_ATTRS=m
383CONFIG_SCSI_SRP_TGT_ATTRS=y
384CONFIG_ISCSI_TCP=m 382CONFIG_ISCSI_TCP=m
385CONFIG_LIBFCOE=m 383CONFIG_LIBFCOE=m
386CONFIG_SCSI_DEBUG=m 384CONFIG_SCSI_DEBUG=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index b061180d3544..4830aa6e6f53 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -363,7 +363,6 @@ CONFIG_VIRTIO_BLK=y
363CONFIG_ENCLOSURE_SERVICES=m 363CONFIG_ENCLOSURE_SERVICES=m
364CONFIG_RAID_ATTRS=m 364CONFIG_RAID_ATTRS=m
365CONFIG_SCSI=y 365CONFIG_SCSI=y
366CONFIG_SCSI_TGT=m
367CONFIG_BLK_DEV_SD=y 366CONFIG_BLK_DEV_SD=y
368CONFIG_CHR_DEV_ST=m 367CONFIG_CHR_DEV_ST=m
369CONFIG_CHR_DEV_OSST=m 368CONFIG_CHR_DEV_OSST=m
@@ -377,7 +376,6 @@ CONFIG_SCSI_LOGGING=y
377CONFIG_SCSI_SPI_ATTRS=m 376CONFIG_SCSI_SPI_ATTRS=m
378CONFIG_SCSI_SAS_LIBSAS=m 377CONFIG_SCSI_SAS_LIBSAS=m
379CONFIG_SCSI_SRP_ATTRS=m 378CONFIG_SCSI_SRP_ATTRS=m
380CONFIG_SCSI_SRP_TGT_ATTRS=y
381CONFIG_ISCSI_TCP=m 379CONFIG_ISCSI_TCP=m
382CONFIG_LIBFCOE=m 380CONFIG_LIBFCOE=m
383CONFIG_SCSI_DEBUG=m 381CONFIG_SCSI_DEBUG=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index d279baa08014..61db449bf309 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -361,7 +361,6 @@ CONFIG_VIRTIO_BLK=y
361CONFIG_ENCLOSURE_SERVICES=m 361CONFIG_ENCLOSURE_SERVICES=m
362CONFIG_RAID_ATTRS=m 362CONFIG_RAID_ATTRS=m
363CONFIG_SCSI=y 363CONFIG_SCSI=y
364CONFIG_SCSI_TGT=m
365CONFIG_BLK_DEV_SD=y 364CONFIG_BLK_DEV_SD=y
366CONFIG_CHR_DEV_ST=m 365CONFIG_CHR_DEV_ST=m
367CONFIG_CHR_DEV_OSST=m 366CONFIG_CHR_DEV_OSST=m
@@ -375,7 +374,6 @@ CONFIG_SCSI_LOGGING=y
375CONFIG_SCSI_SPI_ATTRS=m 374CONFIG_SCSI_SPI_ATTRS=m
376CONFIG_SCSI_SAS_LIBSAS=m 375CONFIG_SCSI_SAS_LIBSAS=m
377CONFIG_SCSI_SRP_ATTRS=m 376CONFIG_SCSI_SRP_ATTRS=m
378CONFIG_SCSI_SRP_TGT_ATTRS=y
379CONFIG_ISCSI_TCP=m 377CONFIG_ISCSI_TCP=m
380CONFIG_LIBFCOE=m 378CONFIG_LIBFCOE=m
381CONFIG_SCSI_DEBUG=m 379CONFIG_SCSI_DEBUG=m
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index 57892a8a9055..b3fea0722ff1 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -4,4 +4,5 @@ generic-y += clkdev.h
4generic-y += hash.h 4generic-y += hash.h
5generic-y += mcs_spinlock.h 5generic-y += mcs_spinlock.h
6generic-y += preempt.h 6generic-y += preempt.h
7generic-y += scatterlist.h
7generic-y += trace_clock.h 8generic-y += trace_clock.h
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 114258eeaacd..7b2ac6e44166 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -162,6 +162,4 @@ static inline int devmem_is_allowed(unsigned long pfn)
162#include <asm-generic/memory_model.h> 162#include <asm-generic/memory_model.h>
163#include <asm-generic/getorder.h> 163#include <asm-generic/getorder.h>
164 164
165#define __HAVE_ARCH_GATE_AREA 1
166
167#endif /* _S390_PAGE_H */ 165#endif /* _S390_PAGE_H */
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index fcba5e03839f..b76317c1f3eb 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -287,7 +287,14 @@ extern unsigned long MODULES_END;
287#define _SEGMENT_ENTRY_INVALID 0x20 /* invalid segment table entry */ 287#define _SEGMENT_ENTRY_INVALID 0x20 /* invalid segment table entry */
288#define _SEGMENT_ENTRY_COMMON 0x10 /* common segment bit */ 288#define _SEGMENT_ENTRY_COMMON 0x10 /* common segment bit */
289#define _SEGMENT_ENTRY_PTL 0x0f /* page table length */ 289#define _SEGMENT_ENTRY_PTL 0x0f /* page table length */
290#define _SEGMENT_ENTRY_NONE _SEGMENT_ENTRY_PROTECT 290
291#define _SEGMENT_ENTRY_DIRTY 0 /* No sw dirty bit for 31-bit */
292#define _SEGMENT_ENTRY_YOUNG 0 /* No sw young bit for 31-bit */
293#define _SEGMENT_ENTRY_READ 0 /* No sw read bit for 31-bit */
294#define _SEGMENT_ENTRY_WRITE 0 /* No sw write bit for 31-bit */
295#define _SEGMENT_ENTRY_LARGE 0 /* No large pages for 31-bit */
296#define _SEGMENT_ENTRY_BITS_LARGE 0
297#define _SEGMENT_ENTRY_ORIGIN_LARGE 0
291 298
292#define _SEGMENT_ENTRY (_SEGMENT_ENTRY_PTL) 299#define _SEGMENT_ENTRY (_SEGMENT_ENTRY_PTL)
293#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID) 300#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID)
@@ -350,7 +357,7 @@ extern unsigned long MODULES_END;
350 357
351/* Bits in the segment table entry */ 358/* Bits in the segment table entry */
352#define _SEGMENT_ENTRY_BITS 0xfffffffffffffe33UL 359#define _SEGMENT_ENTRY_BITS 0xfffffffffffffe33UL
353#define _SEGMENT_ENTRY_BITS_LARGE 0xfffffffffff1ff33UL 360#define _SEGMENT_ENTRY_BITS_LARGE 0xfffffffffff0ff33UL
354#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */ 361#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */
355#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ 362#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
356#define _SEGMENT_ENTRY_PROTECT 0x200 /* page protection bit */ 363#define _SEGMENT_ENTRY_PROTECT 0x200 /* page protection bit */
@@ -359,30 +366,34 @@ extern unsigned long MODULES_END;
359#define _SEGMENT_ENTRY (0) 366#define _SEGMENT_ENTRY (0)
360#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID) 367#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID)
361 368
362#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */ 369#define _SEGMENT_ENTRY_DIRTY 0x2000 /* SW segment dirty bit */
363#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */ 370#define _SEGMENT_ENTRY_YOUNG 0x1000 /* SW segment young bit */
364#define _SEGMENT_ENTRY_SPLIT 0x001 /* THP splitting bit */ 371#define _SEGMENT_ENTRY_SPLIT 0x0800 /* THP splitting bit */
365#define _SEGMENT_ENTRY_YOUNG 0x002 /* SW segment young bit */ 372#define _SEGMENT_ENTRY_LARGE 0x0400 /* STE-format control, large page */
366#define _SEGMENT_ENTRY_NONE _SEGMENT_ENTRY_YOUNG 373#define _SEGMENT_ENTRY_CO 0x0100 /* change-recording override */
374#define _SEGMENT_ENTRY_READ 0x0002 /* SW segment read bit */
375#define _SEGMENT_ENTRY_WRITE 0x0001 /* SW segment write bit */
367 376
368/* 377/*
369 * Segment table entry encoding (R = read-only, I = invalid, y = young bit): 378 * Segment table entry encoding (R = read-only, I = invalid, y = young bit):
370 * ..R...I...y. 379 * dy..R...I...wr
371 * prot-none, old ..0...1...1. 380 * prot-none, clean, old 00..1...1...00
372 * prot-none, young ..1...1...1. 381 * prot-none, clean, young 01..1...1...00
373 * read-only, old ..1...1...0. 382 * prot-none, dirty, old 10..1...1...00
374 * read-only, young ..1...0...1. 383 * prot-none, dirty, young 11..1...1...00
375 * read-write, old ..0...1...0. 384 * read-only, clean, old 00..1...1...01
376 * read-write, young ..0...0...1. 385 * read-only, clean, young 01..1...0...01
386 * read-only, dirty, old 10..1...1...01
387 * read-only, dirty, young 11..1...0...01
388 * read-write, clean, old 00..1...1...11
389 * read-write, clean, young 01..1...0...11
390 * read-write, dirty, old 10..0...1...11
391 * read-write, dirty, young 11..0...0...11
377 * The segment table origin is used to distinguish empty (origin==0) from 392 * The segment table origin is used to distinguish empty (origin==0) from
378 * read-write, old segment table entries (origin!=0) 393 * read-write, old segment table entries (origin!=0)
379 */ 394 */
380 395
381#define _SEGMENT_ENTRY_SPLIT_BIT 0 /* THP splitting bit number */ 396#define _SEGMENT_ENTRY_SPLIT_BIT 11 /* THP splitting bit number */
382
383/* Set of bits not changed in pmd_modify */
384#define _SEGMENT_CHG_MASK (_SEGMENT_ENTRY_ORIGIN | _SEGMENT_ENTRY_LARGE \
385 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO)
386 397
387/* Page status table bits for virtualization */ 398/* Page status table bits for virtualization */
388#define PGSTE_ACC_BITS 0xf000000000000000UL 399#define PGSTE_ACC_BITS 0xf000000000000000UL
@@ -455,10 +466,11 @@ extern unsigned long MODULES_END;
455 * Segment entry (large page) protection definitions. 466 * Segment entry (large page) protection definitions.
456 */ 467 */
457#define SEGMENT_NONE __pgprot(_SEGMENT_ENTRY_INVALID | \ 468#define SEGMENT_NONE __pgprot(_SEGMENT_ENTRY_INVALID | \
458 _SEGMENT_ENTRY_NONE)
459#define SEGMENT_READ __pgprot(_SEGMENT_ENTRY_INVALID | \
460 _SEGMENT_ENTRY_PROTECT) 469 _SEGMENT_ENTRY_PROTECT)
461#define SEGMENT_WRITE __pgprot(_SEGMENT_ENTRY_INVALID) 470#define SEGMENT_READ __pgprot(_SEGMENT_ENTRY_PROTECT | \
471 _SEGMENT_ENTRY_READ)
472#define SEGMENT_WRITE __pgprot(_SEGMENT_ENTRY_READ | \
473 _SEGMENT_ENTRY_WRITE)
462 474
463static inline int mm_has_pgste(struct mm_struct *mm) 475static inline int mm_has_pgste(struct mm_struct *mm)
464{ 476{
@@ -569,25 +581,23 @@ static inline int pmd_none(pmd_t pmd)
569 581
570static inline int pmd_large(pmd_t pmd) 582static inline int pmd_large(pmd_t pmd)
571{ 583{
572#ifdef CONFIG_64BIT
573 return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; 584 return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0;
574#else
575 return 0;
576#endif
577} 585}
578 586
579static inline int pmd_prot_none(pmd_t pmd) 587static inline int pmd_pfn(pmd_t pmd)
580{ 588{
581 return (pmd_val(pmd) & _SEGMENT_ENTRY_INVALID) && 589 unsigned long origin_mask;
582 (pmd_val(pmd) & _SEGMENT_ENTRY_NONE); 590
591 origin_mask = _SEGMENT_ENTRY_ORIGIN;
592 if (pmd_large(pmd))
593 origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
594 return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT;
583} 595}
584 596
585static inline int pmd_bad(pmd_t pmd) 597static inline int pmd_bad(pmd_t pmd)
586{ 598{
587#ifdef CONFIG_64BIT
588 if (pmd_large(pmd)) 599 if (pmd_large(pmd))
589 return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS_LARGE) != 0; 600 return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS_LARGE) != 0;
590#endif
591 return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS) != 0; 601 return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS) != 0;
592} 602}
593 603
@@ -607,20 +617,22 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
607#define __HAVE_ARCH_PMD_WRITE 617#define __HAVE_ARCH_PMD_WRITE
608static inline int pmd_write(pmd_t pmd) 618static inline int pmd_write(pmd_t pmd)
609{ 619{
610 if (pmd_prot_none(pmd)) 620 return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0;
611 return 0; 621}
612 return (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT) == 0; 622
623static inline int pmd_dirty(pmd_t pmd)
624{
625 int dirty = 1;
626 if (pmd_large(pmd))
627 dirty = (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
628 return dirty;
613} 629}
614 630
615static inline int pmd_young(pmd_t pmd) 631static inline int pmd_young(pmd_t pmd)
616{ 632{
617 int young = 0; 633 int young = 1;
618#ifdef CONFIG_64BIT 634 if (pmd_large(pmd))
619 if (pmd_prot_none(pmd))
620 young = (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT) != 0;
621 else
622 young = (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0; 635 young = (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0;
623#endif
624 return young; 636 return young;
625} 637}
626 638
@@ -1391,7 +1403,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
1391#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) 1403#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
1392#define pte_page(x) pfn_to_page(pte_pfn(x)) 1404#define pte_page(x) pfn_to_page(pte_pfn(x))
1393 1405
1394#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT) 1406#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd))
1395 1407
1396/* Find an entry in the lowest level page table.. */ 1408/* Find an entry in the lowest level page table.. */
1397#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr)) 1409#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))
@@ -1413,41 +1425,75 @@ static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
1413 return pgprot_val(SEGMENT_WRITE); 1425 return pgprot_val(SEGMENT_WRITE);
1414} 1426}
1415 1427
1416static inline pmd_t pmd_mkyoung(pmd_t pmd) 1428static inline pmd_t pmd_wrprotect(pmd_t pmd)
1417{ 1429{
1418#ifdef CONFIG_64BIT 1430 pmd_val(pmd) &= ~_SEGMENT_ENTRY_WRITE;
1419 if (pmd_prot_none(pmd)) { 1431 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1432 return pmd;
1433}
1434
1435static inline pmd_t pmd_mkwrite(pmd_t pmd)
1436{
1437 pmd_val(pmd) |= _SEGMENT_ENTRY_WRITE;
1438 if (pmd_large(pmd) && !(pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY))
1439 return pmd;
1440 pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1441 return pmd;
1442}
1443
1444static inline pmd_t pmd_mkclean(pmd_t pmd)
1445{
1446 if (pmd_large(pmd)) {
1447 pmd_val(pmd) &= ~_SEGMENT_ENTRY_DIRTY;
1420 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT; 1448 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1421 } else { 1449 }
1450 return pmd;
1451}
1452
1453static inline pmd_t pmd_mkdirty(pmd_t pmd)
1454{
1455 if (pmd_large(pmd)) {
1456 pmd_val(pmd) |= _SEGMENT_ENTRY_DIRTY;
1457 if (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE)
1458 pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1459 }
1460 return pmd;
1461}
1462
1463static inline pmd_t pmd_mkyoung(pmd_t pmd)
1464{
1465 if (pmd_large(pmd)) {
1422 pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG; 1466 pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG;
1423 pmd_val(pmd) &= ~_SEGMENT_ENTRY_INVALID; 1467 if (pmd_val(pmd) & _SEGMENT_ENTRY_READ)
1468 pmd_val(pmd) &= ~_SEGMENT_ENTRY_INVALID;
1424 } 1469 }
1425#endif
1426 return pmd; 1470 return pmd;
1427} 1471}
1428 1472
1429static inline pmd_t pmd_mkold(pmd_t pmd) 1473static inline pmd_t pmd_mkold(pmd_t pmd)
1430{ 1474{
1431#ifdef CONFIG_64BIT 1475 if (pmd_large(pmd)) {
1432 if (pmd_prot_none(pmd)) {
1433 pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1434 } else {
1435 pmd_val(pmd) &= ~_SEGMENT_ENTRY_YOUNG; 1476 pmd_val(pmd) &= ~_SEGMENT_ENTRY_YOUNG;
1436 pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID; 1477 pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID;
1437 } 1478 }
1438#endif
1439 return pmd; 1479 return pmd;
1440} 1480}
1441 1481
1442static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) 1482static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
1443{ 1483{
1444 int young; 1484 if (pmd_large(pmd)) {
1445 1485 pmd_val(pmd) &= _SEGMENT_ENTRY_ORIGIN_LARGE |
1446 young = pmd_young(pmd); 1486 _SEGMENT_ENTRY_DIRTY | _SEGMENT_ENTRY_YOUNG |
1447 pmd_val(pmd) &= _SEGMENT_CHG_MASK; 1487 _SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_SPLIT;
1488 pmd_val(pmd) |= massage_pgprot_pmd(newprot);
1489 if (!(pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY))
1490 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1491 if (!(pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG))
1492 pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID;
1493 return pmd;
1494 }
1495 pmd_val(pmd) &= _SEGMENT_ENTRY_ORIGIN;
1448 pmd_val(pmd) |= massage_pgprot_pmd(newprot); 1496 pmd_val(pmd) |= massage_pgprot_pmd(newprot);
1449 if (young)
1450 pmd = pmd_mkyoung(pmd);
1451 return pmd; 1497 return pmd;
1452} 1498}
1453 1499
@@ -1455,16 +1501,9 @@ static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
1455{ 1501{
1456 pmd_t __pmd; 1502 pmd_t __pmd;
1457 pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot); 1503 pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot);
1458 return pmd_mkyoung(__pmd); 1504 return __pmd;
1459} 1505}
1460 1506
1461static inline pmd_t pmd_mkwrite(pmd_t pmd)
1462{
1463 /* Do not clobber PROT_NONE segments! */
1464 if (!pmd_prot_none(pmd))
1465 pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1466 return pmd;
1467}
1468#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */ 1507#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */
1469 1508
1470static inline void __pmdp_csp(pmd_t *pmdp) 1509static inline void __pmdp_csp(pmd_t *pmdp)
@@ -1555,34 +1594,21 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
1555 1594
1556static inline int pmd_trans_splitting(pmd_t pmd) 1595static inline int pmd_trans_splitting(pmd_t pmd)
1557{ 1596{
1558 return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT; 1597 return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) &&
1598 (pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT);
1559} 1599}
1560 1600
1561static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, 1601static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1562 pmd_t *pmdp, pmd_t entry) 1602 pmd_t *pmdp, pmd_t entry)
1563{ 1603{
1564 if (!(pmd_val(entry) & _SEGMENT_ENTRY_INVALID) && MACHINE_HAS_EDAT1)
1565 pmd_val(entry) |= _SEGMENT_ENTRY_CO;
1566 *pmdp = entry; 1604 *pmdp = entry;
1567} 1605}
1568 1606
1569static inline pmd_t pmd_mkhuge(pmd_t pmd) 1607static inline pmd_t pmd_mkhuge(pmd_t pmd)
1570{ 1608{
1571 pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE; 1609 pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE;
1572 return pmd; 1610 pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG;
1573} 1611 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1574
1575static inline pmd_t pmd_wrprotect(pmd_t pmd)
1576{
1577 /* Do not clobber PROT_NONE segments! */
1578 if (!pmd_prot_none(pmd))
1579 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1580 return pmd;
1581}
1582
1583static inline pmd_t pmd_mkdirty(pmd_t pmd)
1584{
1585 /* No dirty bit in the segment table entry. */
1586 return pmd; 1612 return pmd;
1587} 1613}
1588 1614
@@ -1647,11 +1673,6 @@ static inline int has_transparent_hugepage(void)
1647{ 1673{
1648 return MACHINE_HAS_HPAGE ? 1 : 0; 1674 return MACHINE_HAS_HPAGE ? 1 : 0;
1649} 1675}
1650
1651static inline unsigned long pmd_pfn(pmd_t pmd)
1652{
1653 return pmd_val(pmd) >> PAGE_SHIFT;
1654}
1655#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 1676#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1656 1677
1657/* 1678/*
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index d786c634e052..06f3034605a1 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -415,6 +415,10 @@ struct qdio_brinfo_entry_l2 {
415#define QDIO_FLAG_SYNC_OUTPUT 0x02 415#define QDIO_FLAG_SYNC_OUTPUT 0x02
416#define QDIO_FLAG_PCI_OUT 0x10 416#define QDIO_FLAG_PCI_OUT 0x10
417 417
418int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count);
419void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count);
420void qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count);
421
418extern int qdio_allocate(struct qdio_initialize *); 422extern int qdio_allocate(struct qdio_initialize *);
419extern int qdio_establish(struct qdio_initialize *); 423extern int qdio_establish(struct qdio_initialize *);
420extern int qdio_activate(struct ccw_device *); 424extern int qdio_activate(struct ccw_device *);
diff --git a/arch/s390/include/asm/scatterlist.h b/arch/s390/include/asm/scatterlist.h
deleted file mode 100644
index 6d45ef6c12a7..000000000000
--- a/arch/s390/include/asm/scatterlist.h
+++ /dev/null
@@ -1,3 +0,0 @@
1#include <asm-generic/scatterlist.h>
2
3#define ARCH_HAS_SG_CHAIN
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index abad78d5b10c..5bc12598ae9e 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -54,7 +54,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
54 struct pt_regs *regs, 54 struct pt_regs *regs,
55 int error, long val) 55 int error, long val)
56{ 56{
57 regs->gprs[2] = error ? -error : val; 57 regs->gprs[2] = error ? error : val;
58} 58}
59 59
60static inline void syscall_get_arguments(struct task_struct *task, 60static inline void syscall_get_arguments(struct task_struct *task,
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index f204d6920368..598b0b42668b 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -320,38 +320,39 @@ static inline int map_signal(int sig)
320 return sig; 320 return sig;
321} 321}
322 322
323static int setup_frame32(int sig, struct k_sigaction *ka, 323static int setup_frame32(struct ksignal *ksig, sigset_t *set,
324 sigset_t *set, struct pt_regs * regs) 324 struct pt_regs *regs)
325{ 325{
326 sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); 326 int sig = ksig->sig;
327 sigframe32 __user *frame = get_sigframe(&ksig->ka, regs, sizeof(sigframe32));
327 328
328 if (frame == (void __user *) -1UL) 329 if (frame == (void __user *) -1UL)
329 goto give_sigsegv; 330 return -EFAULT;
330 331
331 if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32)) 332 if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32))
332 goto give_sigsegv; 333 return -EFAULT;
333 334
334 if (save_sigregs32(regs, &frame->sregs)) 335 if (save_sigregs32(regs, &frame->sregs))
335 goto give_sigsegv; 336 return -EFAULT;
336 if (save_sigregs_gprs_high(regs, frame->gprs_high)) 337 if (save_sigregs_gprs_high(regs, frame->gprs_high))
337 goto give_sigsegv; 338 return -EFAULT;
338 if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs)) 339 if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs))
339 goto give_sigsegv; 340 return -EFAULT;
340 341
341 /* Set up to return from userspace. If provided, use a stub 342 /* Set up to return from userspace. If provided, use a stub
342 already in userspace. */ 343 already in userspace. */
343 if (ka->sa.sa_flags & SA_RESTORER) { 344 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
344 regs->gprs[14] = (__u64 __force) ka->sa.sa_restorer | PSW32_ADDR_AMODE; 345 regs->gprs[14] = (__u64 __force) ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE;
345 } else { 346 } else {
346 regs->gprs[14] = (__u64 __force) frame->retcode | PSW32_ADDR_AMODE; 347 regs->gprs[14] = (__u64 __force) frame->retcode | PSW32_ADDR_AMODE;
347 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 348 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
348 (u16 __force __user *)(frame->retcode))) 349 (u16 __force __user *)(frame->retcode)))
349 goto give_sigsegv; 350 return -EFAULT;
350 } 351 }
351 352
352 /* Set up backchain. */ 353 /* Set up backchain. */
353 if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) 354 if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
354 goto give_sigsegv; 355 return -EFAULT;
355 356
356 /* Set up registers for signal handler */ 357 /* Set up registers for signal handler */
357 regs->gprs[15] = (__force __u64) frame; 358 regs->gprs[15] = (__force __u64) frame;
@@ -359,7 +360,7 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
359 regs->psw.mask = PSW_MASK_BA | 360 regs->psw.mask = PSW_MASK_BA |
360 (PSW_USER_BITS & PSW_MASK_ASC) | 361 (PSW_USER_BITS & PSW_MASK_ASC) |
361 (regs->psw.mask & ~PSW_MASK_ASC); 362 (regs->psw.mask & ~PSW_MASK_ASC);
362 regs->psw.addr = (__force __u64) ka->sa.sa_handler; 363 regs->psw.addr = (__force __u64) ksig->ka.sa.sa_handler;
363 364
364 regs->gprs[2] = map_signal(sig); 365 regs->gprs[2] = map_signal(sig);
365 regs->gprs[3] = (__force __u64) &frame->sc; 366 regs->gprs[3] = (__force __u64) &frame->sc;
@@ -376,25 +377,21 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
376 377
377 /* Place signal number on stack to allow backtrace from handler. */ 378 /* Place signal number on stack to allow backtrace from handler. */
378 if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) 379 if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo))
379 goto give_sigsegv; 380 return -EFAULT;
380 return 0; 381 return 0;
381
382give_sigsegv:
383 force_sigsegv(sig, current);
384 return -EFAULT;
385} 382}
386 383
387static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, 384static int setup_rt_frame32(struct ksignal *ksig, sigset_t *set,
388 sigset_t *set, struct pt_regs * regs) 385 struct pt_regs *regs)
389{ 386{
390 int err = 0; 387 int err = 0;
391 rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); 388 rt_sigframe32 __user *frame = get_sigframe(&ksig->ka, regs, sizeof(rt_sigframe32));
392 389
393 if (frame == (void __user *) -1UL) 390 if (frame == (void __user *) -1UL)
394 goto give_sigsegv; 391 return -EFAULT;
395 392
396 if (copy_siginfo_to_user32(&frame->info, info)) 393 if (copy_siginfo_to_user32(&frame->info, &ksig->info))
397 goto give_sigsegv; 394 return -EFAULT;
398 395
399 /* Create the ucontext. */ 396 /* Create the ucontext. */
400 err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags); 397 err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags);
@@ -404,22 +401,22 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
404 err |= save_sigregs_gprs_high(regs, frame->gprs_high); 401 err |= save_sigregs_gprs_high(regs, frame->gprs_high);
405 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 402 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
406 if (err) 403 if (err)
407 goto give_sigsegv; 404 return -EFAULT;
408 405
409 /* Set up to return from userspace. If provided, use a stub 406 /* Set up to return from userspace. If provided, use a stub
410 already in userspace. */ 407 already in userspace. */
411 if (ka->sa.sa_flags & SA_RESTORER) { 408 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
412 regs->gprs[14] = (__u64 __force) ka->sa.sa_restorer | PSW32_ADDR_AMODE; 409 regs->gprs[14] = (__u64 __force) ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE;
413 } else { 410 } else {
414 regs->gprs[14] = (__u64 __force) frame->retcode | PSW32_ADDR_AMODE; 411 regs->gprs[14] = (__u64 __force) frame->retcode | PSW32_ADDR_AMODE;
415 if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 412 if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
416 (u16 __force __user *)(frame->retcode))) 413 (u16 __force __user *)(frame->retcode)))
417 goto give_sigsegv; 414 return -EFAULT;
418 } 415 }
419 416
420 /* Set up backchain. */ 417 /* Set up backchain. */
421 if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame)) 418 if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame))
422 goto give_sigsegv; 419 return -EFAULT;
423 420
424 /* Set up registers for signal handler */ 421 /* Set up registers for signal handler */
425 regs->gprs[15] = (__force __u64) frame; 422 regs->gprs[15] = (__force __u64) frame;
@@ -427,36 +424,30 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
427 regs->psw.mask = PSW_MASK_BA | 424 regs->psw.mask = PSW_MASK_BA |
428 (PSW_USER_BITS & PSW_MASK_ASC) | 425 (PSW_USER_BITS & PSW_MASK_ASC) |
429 (regs->psw.mask & ~PSW_MASK_ASC); 426 (regs->psw.mask & ~PSW_MASK_ASC);
430 regs->psw.addr = (__u64 __force) ka->sa.sa_handler; 427 regs->psw.addr = (__u64 __force) ksig->ka.sa.sa_handler;
431 428
432 regs->gprs[2] = map_signal(sig); 429 regs->gprs[2] = map_signal(ksig->sig);
433 regs->gprs[3] = (__force __u64) &frame->info; 430 regs->gprs[3] = (__force __u64) &frame->info;
434 regs->gprs[4] = (__force __u64) &frame->uc; 431 regs->gprs[4] = (__force __u64) &frame->uc;
435 regs->gprs[5] = task_thread_info(current)->last_break; 432 regs->gprs[5] = task_thread_info(current)->last_break;
436 return 0; 433 return 0;
437
438give_sigsegv:
439 force_sigsegv(sig, current);
440 return -EFAULT;
441} 434}
442 435
443/* 436/*
444 * OK, we're invoking a handler 437 * OK, we're invoking a handler
445 */ 438 */
446 439
447void handle_signal32(unsigned long sig, struct k_sigaction *ka, 440void handle_signal32(struct ksignal *ksig, sigset_t *oldset,
448 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) 441 struct pt_regs *regs)
449{ 442{
450 int ret; 443 int ret;
451 444
452 /* Set up the stack frame */ 445 /* Set up the stack frame */
453 if (ka->sa.sa_flags & SA_SIGINFO) 446 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
454 ret = setup_rt_frame32(sig, ka, info, oldset, regs); 447 ret = setup_rt_frame32(ksig, oldset, regs);
455 else 448 else
456 ret = setup_frame32(sig, ka, oldset, regs); 449 ret = setup_frame32(ksig, oldset, regs);
457 if (ret) 450
458 return; 451 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLE_STEP));
459 signal_delivered(sig, info, ka, regs,
460 test_thread_flag(TIF_SINGLE_STEP));
461} 452}
462 453
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index 6ac78192455f..1aad48398d06 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -48,8 +48,8 @@ void do_per_trap(struct pt_regs *regs);
48void syscall_trace(struct pt_regs *regs, int entryexit); 48void syscall_trace(struct pt_regs *regs, int entryexit);
49void kernel_stack_overflow(struct pt_regs * regs); 49void kernel_stack_overflow(struct pt_regs * regs);
50void do_signal(struct pt_regs *regs); 50void do_signal(struct pt_regs *regs);
51void handle_signal32(unsigned long sig, struct k_sigaction *ka, 51void handle_signal32(struct ksignal *ksig, sigset_t *oldset,
52 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); 52 struct pt_regs *regs);
53void do_notify_resume(struct pt_regs *regs); 53void do_notify_resume(struct pt_regs *regs);
54 54
55void __init init_IRQ(void); 55void __init init_IRQ(void);
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 99b0b09646ca..8eb82443cfbd 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -30,6 +30,7 @@ DEFINE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
30EXPORT_PER_CPU_SYMBOL_GPL(irq_stat); 30EXPORT_PER_CPU_SYMBOL_GPL(irq_stat);
31 31
32struct irq_class { 32struct irq_class {
33 int irq;
33 char *name; 34 char *name;
34 char *desc; 35 char *desc;
35}; 36};
@@ -45,9 +46,9 @@ struct irq_class {
45 * up with having a sum which accounts each interrupt twice. 46 * up with having a sum which accounts each interrupt twice.
46 */ 47 */
47static const struct irq_class irqclass_main_desc[NR_IRQS_BASE] = { 48static const struct irq_class irqclass_main_desc[NR_IRQS_BASE] = {
48 [EXT_INTERRUPT] = {.name = "EXT"}, 49 {.irq = EXT_INTERRUPT, .name = "EXT"},
49 [IO_INTERRUPT] = {.name = "I/O"}, 50 {.irq = IO_INTERRUPT, .name = "I/O"},
50 [THIN_INTERRUPT] = {.name = "AIO"}, 51 {.irq = THIN_INTERRUPT, .name = "AIO"},
51}; 52};
52 53
53/* 54/*
@@ -56,38 +57,38 @@ static const struct irq_class irqclass_main_desc[NR_IRQS_BASE] = {
56 * In addition this list contains non external / I/O events like NMIs. 57 * In addition this list contains non external / I/O events like NMIs.
57 */ 58 */
58static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = { 59static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = {
59 [IRQEXT_CLK] = {.name = "CLK", .desc = "[EXT] Clock Comparator"}, 60 {.irq = IRQEXT_CLK, .name = "CLK", .desc = "[EXT] Clock Comparator"},
60 [IRQEXT_EXC] = {.name = "EXC", .desc = "[EXT] External Call"}, 61 {.irq = IRQEXT_EXC, .name = "EXC", .desc = "[EXT] External Call"},
61 [IRQEXT_EMS] = {.name = "EMS", .desc = "[EXT] Emergency Signal"}, 62 {.irq = IRQEXT_EMS, .name = "EMS", .desc = "[EXT] Emergency Signal"},
62 [IRQEXT_TMR] = {.name = "TMR", .desc = "[EXT] CPU Timer"}, 63 {.irq = IRQEXT_TMR, .name = "TMR", .desc = "[EXT] CPU Timer"},
63 [IRQEXT_TLA] = {.name = "TAL", .desc = "[EXT] Timing Alert"}, 64 {.irq = IRQEXT_TLA, .name = "TAL", .desc = "[EXT] Timing Alert"},
64 [IRQEXT_PFL] = {.name = "PFL", .desc = "[EXT] Pseudo Page Fault"}, 65 {.irq = IRQEXT_PFL, .name = "PFL", .desc = "[EXT] Pseudo Page Fault"},
65 [IRQEXT_DSD] = {.name = "DSD", .desc = "[EXT] DASD Diag"}, 66 {.irq = IRQEXT_DSD, .name = "DSD", .desc = "[EXT] DASD Diag"},
66 [IRQEXT_VRT] = {.name = "VRT", .desc = "[EXT] Virtio"}, 67 {.irq = IRQEXT_VRT, .name = "VRT", .desc = "[EXT] Virtio"},
67 [IRQEXT_SCP] = {.name = "SCP", .desc = "[EXT] Service Call"}, 68 {.irq = IRQEXT_SCP, .name = "SCP", .desc = "[EXT] Service Call"},
68 [IRQEXT_IUC] = {.name = "IUC", .desc = "[EXT] IUCV"}, 69 {.irq = IRQEXT_IUC, .name = "IUC", .desc = "[EXT] IUCV"},
69 [IRQEXT_CMS] = {.name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"}, 70 {.irq = IRQEXT_CMS, .name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"},
70 [IRQEXT_CMC] = {.name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"}, 71 {.irq = IRQEXT_CMC, .name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"},
71 [IRQEXT_CMR] = {.name = "CMR", .desc = "[EXT] CPU-Measurement: RI"}, 72 {.irq = IRQEXT_CMR, .name = "CMR", .desc = "[EXT] CPU-Measurement: RI"},
72 [IRQIO_CIO] = {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"}, 73 {.irq = IRQIO_CIO, .name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"},
73 [IRQIO_QAI] = {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"}, 74 {.irq = IRQIO_QAI, .name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"},
74 [IRQIO_DAS] = {.name = "DAS", .desc = "[I/O] DASD"}, 75 {.irq = IRQIO_DAS, .name = "DAS", .desc = "[I/O] DASD"},
75 [IRQIO_C15] = {.name = "C15", .desc = "[I/O] 3215"}, 76 {.irq = IRQIO_C15, .name = "C15", .desc = "[I/O] 3215"},
76 [IRQIO_C70] = {.name = "C70", .desc = "[I/O] 3270"}, 77 {.irq = IRQIO_C70, .name = "C70", .desc = "[I/O] 3270"},
77 [IRQIO_TAP] = {.name = "TAP", .desc = "[I/O] Tape"}, 78 {.irq = IRQIO_TAP, .name = "TAP", .desc = "[I/O] Tape"},
78 [IRQIO_VMR] = {.name = "VMR", .desc = "[I/O] Unit Record Devices"}, 79 {.irq = IRQIO_VMR, .name = "VMR", .desc = "[I/O] Unit Record Devices"},
79 [IRQIO_LCS] = {.name = "LCS", .desc = "[I/O] LCS"}, 80 {.irq = IRQIO_LCS, .name = "LCS", .desc = "[I/O] LCS"},
80 [IRQIO_CLW] = {.name = "CLW", .desc = "[I/O] CLAW"}, 81 {.irq = IRQIO_CLW, .name = "CLW", .desc = "[I/O] CLAW"},
81 [IRQIO_CTC] = {.name = "CTC", .desc = "[I/O] CTC"}, 82 {.irq = IRQIO_CTC, .name = "CTC", .desc = "[I/O] CTC"},
82 [IRQIO_APB] = {.name = "APB", .desc = "[I/O] AP Bus"}, 83 {.irq = IRQIO_APB, .name = "APB", .desc = "[I/O] AP Bus"},
83 [IRQIO_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"}, 84 {.irq = IRQIO_ADM, .name = "ADM", .desc = "[I/O] EADM Subchannel"},
84 [IRQIO_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"}, 85 {.irq = IRQIO_CSC, .name = "CSC", .desc = "[I/O] CHSC Subchannel"},
85 [IRQIO_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" }, 86 {.irq = IRQIO_PCI, .name = "PCI", .desc = "[I/O] PCI Interrupt" },
86 [IRQIO_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" }, 87 {.irq = IRQIO_MSI, .name = "MSI", .desc = "[I/O] MSI Interrupt" },
87 [IRQIO_VIR] = {.name = "VIR", .desc = "[I/O] Virtual I/O Devices"}, 88 {.irq = IRQIO_VIR, .name = "VIR", .desc = "[I/O] Virtual I/O Devices"},
88 [IRQIO_VAI] = {.name = "VAI", .desc = "[I/O] Virtual I/O Devices AI"}, 89 {.irq = IRQIO_VAI, .name = "VAI", .desc = "[I/O] Virtual I/O Devices AI"},
89 [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"}, 90 {.irq = NMI_NMI, .name = "NMI", .desc = "[NMI] Machine Check"},
90 [CPU_RST] = {.name = "RST", .desc = "[CPU] CPU Restart"}, 91 {.irq = CPU_RST, .name = "RST", .desc = "[CPU] CPU Restart"},
91}; 92};
92 93
93void __init init_IRQ(void) 94void __init init_IRQ(void)
@@ -116,33 +117,37 @@ void do_IRQ(struct pt_regs *regs, int irq)
116 */ 117 */
117int show_interrupts(struct seq_file *p, void *v) 118int show_interrupts(struct seq_file *p, void *v)
118{ 119{
119 int irq = *(loff_t *) v; 120 int index = *(loff_t *) v;
120 int cpu; 121 int cpu, irq;
121 122
122 get_online_cpus(); 123 get_online_cpus();
123 if (irq == 0) { 124 if (index == 0) {
124 seq_puts(p, " "); 125 seq_puts(p, " ");
125 for_each_online_cpu(cpu) 126 for_each_online_cpu(cpu)
126 seq_printf(p, "CPU%d ", cpu); 127 seq_printf(p, "CPU%d ", cpu);
127 seq_putc(p, '\n'); 128 seq_putc(p, '\n');
128 goto out; 129 goto out;
129 } 130 }
130 if (irq < NR_IRQS) { 131 if (index < NR_IRQS) {
131 if (irq >= NR_IRQS_BASE) 132 if (index >= NR_IRQS_BASE)
132 goto out; 133 goto out;
133 seq_printf(p, "%s: ", irqclass_main_desc[irq].name); 134 /* Adjust index to process irqclass_main_desc array entries */
135 index--;
136 seq_printf(p, "%s: ", irqclass_main_desc[index].name);
137 irq = irqclass_main_desc[index].irq;
134 for_each_online_cpu(cpu) 138 for_each_online_cpu(cpu)
135 seq_printf(p, "%10u ", kstat_irqs_cpu(irq, cpu)); 139 seq_printf(p, "%10u ", kstat_irqs_cpu(irq, cpu));
136 seq_putc(p, '\n'); 140 seq_putc(p, '\n');
137 goto out; 141 goto out;
138 } 142 }
139 for (irq = 0; irq < NR_ARCH_IRQS; irq++) { 143 for (index = 0; index < NR_ARCH_IRQS; index++) {
140 seq_printf(p, "%s: ", irqclass_sub_desc[irq].name); 144 seq_printf(p, "%s: ", irqclass_sub_desc[index].name);
145 irq = irqclass_sub_desc[index].irq;
141 for_each_online_cpu(cpu) 146 for_each_online_cpu(cpu)
142 seq_printf(p, "%10u ", 147 seq_printf(p, "%10u ",
143 per_cpu(irq_stat, cpu).irqs[irq]); 148 per_cpu(irq_stat, cpu).irqs[irq]);
144 if (irqclass_sub_desc[irq].desc) 149 if (irqclass_sub_desc[index].desc)
145 seq_printf(p, " %s", irqclass_sub_desc[irq].desc); 150 seq_printf(p, " %s", irqclass_sub_desc[index].desc);
146 seq_putc(p, '\n'); 151 seq_putc(p, '\n');
147 } 152 }
148out: 153out:
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 1e2264b46e4c..ae1d5be7dd88 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -501,6 +501,8 @@ static int kdump_mem_notifier(struct notifier_block *nb,
501{ 501{
502 struct memory_notify *arg = data; 502 struct memory_notify *arg = data;
503 503
504 if (action != MEM_GOING_OFFLINE)
505 return NOTIFY_OK;
504 if (arg->start_pfn < PFN_DOWN(resource_size(&crashk_res))) 506 if (arg->start_pfn < PFN_DOWN(resource_size(&crashk_res)))
505 return NOTIFY_BAD; 507 return NOTIFY_BAD;
506 if (arg->start_pfn > PFN_DOWN(crashk_res.end)) 508 if (arg->start_pfn > PFN_DOWN(crashk_res.end))
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 42b49f9e19bf..469c4c6d9182 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -200,15 +200,15 @@ static int setup_frame(int sig, struct k_sigaction *ka,
200 frame = get_sigframe(ka, regs, sizeof(sigframe)); 200 frame = get_sigframe(ka, regs, sizeof(sigframe));
201 201
202 if (frame == (void __user *) -1UL) 202 if (frame == (void __user *) -1UL)
203 goto give_sigsegv; 203 return -EFAULT;
204 204
205 if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE)) 205 if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE))
206 goto give_sigsegv; 206 return -EFAULT;
207 207
208 if (save_sigregs(regs, &frame->sregs)) 208 if (save_sigregs(regs, &frame->sregs))
209 goto give_sigsegv; 209 return -EFAULT;
210 if (__put_user(&frame->sregs, &frame->sc.sregs)) 210 if (__put_user(&frame->sregs, &frame->sc.sregs))
211 goto give_sigsegv; 211 return -EFAULT;
212 212
213 /* Set up to return from userspace. If provided, use a stub 213 /* Set up to return from userspace. If provided, use a stub
214 already in userspace. */ 214 already in userspace. */
@@ -220,12 +220,12 @@ static int setup_frame(int sig, struct k_sigaction *ka,
220 frame->retcode | PSW_ADDR_AMODE; 220 frame->retcode | PSW_ADDR_AMODE;
221 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 221 if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
222 (u16 __user *)(frame->retcode))) 222 (u16 __user *)(frame->retcode)))
223 goto give_sigsegv; 223 return -EFAULT;
224 } 224 }
225 225
226 /* Set up backchain. */ 226 /* Set up backchain. */
227 if (__put_user(regs->gprs[15], (addr_t __user *) frame)) 227 if (__put_user(regs->gprs[15], (addr_t __user *) frame))
228 goto give_sigsegv; 228 return -EFAULT;
229 229
230 /* Set up registers for signal handler */ 230 /* Set up registers for signal handler */
231 regs->gprs[15] = (unsigned long) frame; 231 regs->gprs[15] = (unsigned long) frame;
@@ -250,27 +250,23 @@ static int setup_frame(int sig, struct k_sigaction *ka,
250 250
251 /* Place signal number on stack to allow backtrace from handler. */ 251 /* Place signal number on stack to allow backtrace from handler. */
252 if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) 252 if (__put_user(regs->gprs[2], (int __user *) &frame->signo))
253 goto give_sigsegv; 253 return -EFAULT;
254 return 0; 254 return 0;
255
256give_sigsegv:
257 force_sigsegv(sig, current);
258 return -EFAULT;
259} 255}
260 256
261static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 257static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
262 sigset_t *set, struct pt_regs * regs) 258 struct pt_regs *regs)
263{ 259{
264 int err = 0; 260 int err = 0;
265 rt_sigframe __user *frame; 261 rt_sigframe __user *frame;
266 262
267 frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); 263 frame = get_sigframe(&ksig->ka, regs, sizeof(rt_sigframe));
268 264
269 if (frame == (void __user *) -1UL) 265 if (frame == (void __user *) -1UL)
270 goto give_sigsegv; 266 return -EFAULT;
271 267
272 if (copy_siginfo_to_user(&frame->info, info)) 268 if (copy_siginfo_to_user(&frame->info, &ksig->info))
273 goto give_sigsegv; 269 return -EFAULT;
274 270
275 /* Create the ucontext. */ 271 /* Create the ucontext. */
276 err |= __put_user(0, &frame->uc.uc_flags); 272 err |= __put_user(0, &frame->uc.uc_flags);
@@ -279,24 +275,24 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
279 err |= save_sigregs(regs, &frame->uc.uc_mcontext); 275 err |= save_sigregs(regs, &frame->uc.uc_mcontext);
280 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 276 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
281 if (err) 277 if (err)
282 goto give_sigsegv; 278 return -EFAULT;
283 279
284 /* Set up to return from userspace. If provided, use a stub 280 /* Set up to return from userspace. If provided, use a stub
285 already in userspace. */ 281 already in userspace. */
286 if (ka->sa.sa_flags & SA_RESTORER) { 282 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
287 regs->gprs[14] = (unsigned long) 283 regs->gprs[14] = (unsigned long)
288 ka->sa.sa_restorer | PSW_ADDR_AMODE; 284 ksig->ka.sa.sa_restorer | PSW_ADDR_AMODE;
289 } else { 285 } else {
290 regs->gprs[14] = (unsigned long) 286 regs->gprs[14] = (unsigned long)
291 frame->retcode | PSW_ADDR_AMODE; 287 frame->retcode | PSW_ADDR_AMODE;
292 if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 288 if (__put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
293 (u16 __user *)(frame->retcode))) 289 (u16 __user *)(frame->retcode)))
294 goto give_sigsegv; 290 return -EFAULT;
295 } 291 }
296 292
297 /* Set up backchain. */ 293 /* Set up backchain. */
298 if (__put_user(regs->gprs[15], (addr_t __user *) frame)) 294 if (__put_user(regs->gprs[15], (addr_t __user *) frame))
299 goto give_sigsegv; 295 return -EFAULT;
300 296
301 /* Set up registers for signal handler */ 297 /* Set up registers for signal handler */
302 regs->gprs[15] = (unsigned long) frame; 298 regs->gprs[15] = (unsigned long) frame;
@@ -304,34 +300,27 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
304 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA | 300 regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
305 (PSW_USER_BITS & PSW_MASK_ASC) | 301 (PSW_USER_BITS & PSW_MASK_ASC) |
306 (regs->psw.mask & ~PSW_MASK_ASC); 302 (regs->psw.mask & ~PSW_MASK_ASC);
307 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE; 303 regs->psw.addr = (unsigned long) ksig->ka.sa.sa_handler | PSW_ADDR_AMODE;
308 304
309 regs->gprs[2] = map_signal(sig); 305 regs->gprs[2] = map_signal(ksig->sig);
310 regs->gprs[3] = (unsigned long) &frame->info; 306 regs->gprs[3] = (unsigned long) &frame->info;
311 regs->gprs[4] = (unsigned long) &frame->uc; 307 regs->gprs[4] = (unsigned long) &frame->uc;
312 regs->gprs[5] = task_thread_info(current)->last_break; 308 regs->gprs[5] = task_thread_info(current)->last_break;
313 return 0; 309 return 0;
314
315give_sigsegv:
316 force_sigsegv(sig, current);
317 return -EFAULT;
318} 310}
319 311
320static void handle_signal(unsigned long sig, struct k_sigaction *ka, 312static void handle_signal(struct ksignal *ksig, sigset_t *oldset,
321 siginfo_t *info, sigset_t *oldset, 313 struct pt_regs *regs)
322 struct pt_regs *regs)
323{ 314{
324 int ret; 315 int ret;
325 316
326 /* Set up the stack frame */ 317 /* Set up the stack frame */
327 if (ka->sa.sa_flags & SA_SIGINFO) 318 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
328 ret = setup_rt_frame(sig, ka, info, oldset, regs); 319 ret = setup_rt_frame(ksig, oldset, regs);
329 else 320 else
330 ret = setup_frame(sig, ka, oldset, regs); 321 ret = setup_frame(ksig->sig, &ksig->ka, oldset, regs);
331 if (ret) 322
332 return; 323 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLE_STEP));
333 signal_delivered(sig, info, ka, regs,
334 test_thread_flag(TIF_SINGLE_STEP));
335} 324}
336 325
337/* 326/*
@@ -345,9 +334,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
345 */ 334 */
346void do_signal(struct pt_regs *regs) 335void do_signal(struct pt_regs *regs)
347{ 336{
348 siginfo_t info; 337 struct ksignal ksig;
349 int signr;
350 struct k_sigaction ka;
351 sigset_t *oldset = sigmask_to_save(); 338 sigset_t *oldset = sigmask_to_save();
352 339
353 /* 340 /*
@@ -357,9 +344,8 @@ void do_signal(struct pt_regs *regs)
357 */ 344 */
358 current_thread_info()->system_call = 345 current_thread_info()->system_call =
359 test_pt_regs_flag(regs, PIF_SYSCALL) ? regs->int_code : 0; 346 test_pt_regs_flag(regs, PIF_SYSCALL) ? regs->int_code : 0;
360 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
361 347
362 if (signr > 0) { 348 if (get_signal(&ksig)) {
363 /* Whee! Actually deliver the signal. */ 349 /* Whee! Actually deliver the signal. */
364 if (current_thread_info()->system_call) { 350 if (current_thread_info()->system_call) {
365 regs->int_code = current_thread_info()->system_call; 351 regs->int_code = current_thread_info()->system_call;
@@ -370,7 +356,7 @@ void do_signal(struct pt_regs *regs)
370 regs->gprs[2] = -EINTR; 356 regs->gprs[2] = -EINTR;
371 break; 357 break;
372 case -ERESTARTSYS: 358 case -ERESTARTSYS:
373 if (!(ka.sa.sa_flags & SA_RESTART)) { 359 if (!(ksig.ka.sa.sa_flags & SA_RESTART)) {
374 regs->gprs[2] = -EINTR; 360 regs->gprs[2] = -EINTR;
375 break; 361 break;
376 } 362 }
@@ -387,9 +373,9 @@ void do_signal(struct pt_regs *regs)
387 clear_pt_regs_flag(regs, PIF_SYSCALL); 373 clear_pt_regs_flag(regs, PIF_SYSCALL);
388 374
389 if (is_compat_task()) 375 if (is_compat_task())
390 handle_signal32(signr, &ka, &info, oldset, regs); 376 handle_signal32(&ksig, oldset, regs);
391 else 377 else
392 handle_signal(signr, &ka, &info, oldset, regs); 378 handle_signal(&ksig, oldset, regs);
393 return; 379 return;
394 } 380 }
395 381
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 0931b110c826..4cef607f3711 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -214,26 +214,26 @@ void update_vsyscall(struct timekeeper *tk)
214{ 214{
215 u64 nsecps; 215 u64 nsecps;
216 216
217 if (tk->clock != &clocksource_tod) 217 if (tk->tkr.clock != &clocksource_tod)
218 return; 218 return;
219 219
220 /* Make userspace gettimeofday spin until we're done. */ 220 /* Make userspace gettimeofday spin until we're done. */
221 ++vdso_data->tb_update_count; 221 ++vdso_data->tb_update_count;
222 smp_wmb(); 222 smp_wmb();
223 vdso_data->xtime_tod_stamp = tk->clock->cycle_last; 223 vdso_data->xtime_tod_stamp = tk->tkr.cycle_last;
224 vdso_data->xtime_clock_sec = tk->xtime_sec; 224 vdso_data->xtime_clock_sec = tk->xtime_sec;
225 vdso_data->xtime_clock_nsec = tk->xtime_nsec; 225 vdso_data->xtime_clock_nsec = tk->tkr.xtime_nsec;
226 vdso_data->wtom_clock_sec = 226 vdso_data->wtom_clock_sec =
227 tk->xtime_sec + tk->wall_to_monotonic.tv_sec; 227 tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
228 vdso_data->wtom_clock_nsec = tk->xtime_nsec + 228 vdso_data->wtom_clock_nsec = tk->tkr.xtime_nsec +
229 + ((u64) tk->wall_to_monotonic.tv_nsec << tk->shift); 229 + ((u64) tk->wall_to_monotonic.tv_nsec << tk->tkr.shift);
230 nsecps = (u64) NSEC_PER_SEC << tk->shift; 230 nsecps = (u64) NSEC_PER_SEC << tk->tkr.shift;
231 while (vdso_data->wtom_clock_nsec >= nsecps) { 231 while (vdso_data->wtom_clock_nsec >= nsecps) {
232 vdso_data->wtom_clock_nsec -= nsecps; 232 vdso_data->wtom_clock_nsec -= nsecps;
233 vdso_data->wtom_clock_sec++; 233 vdso_data->wtom_clock_sec++;
234 } 234 }
235 vdso_data->tk_mult = tk->mult; 235 vdso_data->tk_mult = tk->tkr.mult;
236 vdso_data->tk_shift = tk->shift; 236 vdso_data->tk_shift = tk->tkr.shift;
237 smp_wmb(); 237 smp_wmb();
238 ++vdso_data->tb_update_count; 238 ++vdso_data->tb_update_count;
239} 239}
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 613649096783..0bbb7e027c5a 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -316,18 +316,3 @@ static int __init vdso_init(void)
316 return 0; 316 return 0;
317} 317}
318early_initcall(vdso_init); 318early_initcall(vdso_init);
319
320int in_gate_area_no_mm(unsigned long addr)
321{
322 return 0;
323}
324
325int in_gate_area(struct mm_struct *mm, unsigned long addr)
326{
327 return 0;
328}
329
330struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
331{
332 return NULL;
333}
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index 10d529ac9821..646db9c467d1 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -26,6 +26,7 @@ config KVM
26 select KVM_ASYNC_PF 26 select KVM_ASYNC_PF
27 select KVM_ASYNC_PF_SYNC 27 select KVM_ASYNC_PF_SYNC
28 select HAVE_KVM_IRQCHIP 28 select HAVE_KVM_IRQCHIP
29 select HAVE_KVM_IRQFD
29 select HAVE_KVM_IRQ_ROUTING 30 select HAVE_KVM_IRQ_ROUTING
30 ---help--- 31 ---help---
31 Support hosting paravirtualized guest machines using the SIE 32 Support hosting paravirtualized guest machines using the SIE
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 92528a0bdda6..f4c819bfc193 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1556,8 +1556,7 @@ static int set_adapter_int(struct kvm_kernel_irq_routing_entry *e,
1556 return ret; 1556 return ret;
1557} 1557}
1558 1558
1559int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 1559int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
1560 struct kvm_kernel_irq_routing_entry *e,
1561 const struct kvm_irq_routing_entry *ue) 1560 const struct kvm_irq_routing_entry *ue)
1562{ 1561{
1563 int ret; 1562 int ret;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 339b34a02fb8..ce81eb2ab76a 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -146,7 +146,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
146 return -EINVAL; 146 return -EINVAL;
147} 147}
148 148
149int kvm_dev_ioctl_check_extension(long ext) 149int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
150{ 150{
151 int r; 151 int r;
152 152
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
index 0ff66a7e29bb..389bc17934b7 100644
--- a/arch/s390/mm/hugetlbpage.c
+++ b/arch/s390/mm/hugetlbpage.c
@@ -10,42 +10,33 @@
10 10
11static inline pmd_t __pte_to_pmd(pte_t pte) 11static inline pmd_t __pte_to_pmd(pte_t pte)
12{ 12{
13 int none, young, prot;
14 pmd_t pmd; 13 pmd_t pmd;
15 14
16 /* 15 /*
17 * Convert encoding pte bits pmd bits 16 * Convert encoding pte bits pmd bits
18 * .IR...wrdytp ..R...I...y. 17 * .IR...wrdytp dy..R...I...wr
19 * empty .10...000000 -> ..0...1...0. 18 * empty .10...000000 -> 00..0...1...00
20 * prot-none, clean, old .11...000001 -> ..0...1...1. 19 * prot-none, clean, old .11...000001 -> 00..1...1...00
21 * prot-none, clean, young .11...000101 -> ..1...1...1. 20 * prot-none, clean, young .11...000101 -> 01..1...1...00
22 * prot-none, dirty, old .10...001001 -> ..0...1...1. 21 * prot-none, dirty, old .10...001001 -> 10..1...1...00
23 * prot-none, dirty, young .10...001101 -> ..1...1...1. 22 * prot-none, dirty, young .10...001101 -> 11..1...1...00
24 * read-only, clean, old .11...010001 -> ..1...1...0. 23 * read-only, clean, old .11...010001 -> 00..1...1...01
25 * read-only, clean, young .01...010101 -> ..1...0...1. 24 * read-only, clean, young .01...010101 -> 01..1...0...01
26 * read-only, dirty, old .11...011001 -> ..1...1...0. 25 * read-only, dirty, old .11...011001 -> 10..1...1...01
27 * read-only, dirty, young .01...011101 -> ..1...0...1. 26 * read-only, dirty, young .01...011101 -> 11..1...0...01
28 * read-write, clean, old .11...110001 -> ..0...1...0. 27 * read-write, clean, old .11...110001 -> 00..0...1...11
29 * read-write, clean, young .01...110101 -> ..0...0...1. 28 * read-write, clean, young .01...110101 -> 01..0...0...11
30 * read-write, dirty, old .10...111001 -> ..0...1...0. 29 * read-write, dirty, old .10...111001 -> 10..0...1...11
31 * read-write, dirty, young .00...111101 -> ..0...0...1. 30 * read-write, dirty, young .00...111101 -> 11..0...0...11
32 * Huge ptes are dirty by definition, a clean pte is made dirty
33 * by the conversion.
34 */ 31 */
35 if (pte_present(pte)) { 32 if (pte_present(pte)) {
36 pmd_val(pmd) = pte_val(pte) & PAGE_MASK; 33 pmd_val(pmd) = pte_val(pte) & PAGE_MASK;
37 if (pte_val(pte) & _PAGE_INVALID) 34 pmd_val(pmd) |= (pte_val(pte) & _PAGE_READ) >> 4;
38 pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID; 35 pmd_val(pmd) |= (pte_val(pte) & _PAGE_WRITE) >> 4;
39 none = (pte_val(pte) & _PAGE_PRESENT) && 36 pmd_val(pmd) |= (pte_val(pte) & _PAGE_INVALID) >> 5;
40 !(pte_val(pte) & _PAGE_READ) && 37 pmd_val(pmd) |= (pte_val(pte) & _PAGE_PROTECT);
41 !(pte_val(pte) & _PAGE_WRITE); 38 pmd_val(pmd) |= (pte_val(pte) & _PAGE_DIRTY) << 10;
42 prot = (pte_val(pte) & _PAGE_PROTECT) && 39 pmd_val(pmd) |= (pte_val(pte) & _PAGE_YOUNG) << 10;
43 !(pte_val(pte) & _PAGE_WRITE);
44 young = pte_val(pte) & _PAGE_YOUNG;
45 if (none || young)
46 pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG;
47 if (prot || (none && young))
48 pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
49 } else 40 } else
50 pmd_val(pmd) = _SEGMENT_ENTRY_INVALID; 41 pmd_val(pmd) = _SEGMENT_ENTRY_INVALID;
51 return pmd; 42 return pmd;
@@ -56,34 +47,31 @@ static inline pte_t __pmd_to_pte(pmd_t pmd)
56 pte_t pte; 47 pte_t pte;
57 48
58 /* 49 /*
59 * Convert encoding pmd bits pte bits 50 * Convert encoding pmd bits pte bits
60 * ..R...I...y. .IR...wrdytp 51 * dy..R...I...wr .IR...wrdytp
61 * empty ..0...1...0. -> .10...000000 52 * empty 00..0...1...00 -> .10...001100
62 * prot-none, old ..0...1...1. -> .10...001001 53 * prot-none, clean, old 00..0...1...00 -> .10...000001
63 * prot-none, young ..1...1...1. -> .10...001101 54 * prot-none, clean, young 01..0...1...00 -> .10...000101
64 * read-only, old ..1...1...0. -> .11...011001 55 * prot-none, dirty, old 10..0...1...00 -> .10...001001
65 * read-only, young ..1...0...1. -> .01...011101 56 * prot-none, dirty, young 11..0...1...00 -> .10...001101
66 * read-write, old ..0...1...0. -> .10...111001 57 * read-only, clean, old 00..1...1...01 -> .11...010001
67 * read-write, young ..0...0...1. -> .00...111101 58 * read-only, clean, young 01..1...1...01 -> .11...010101
68 * Huge ptes are dirty by definition 59 * read-only, dirty, old 10..1...1...01 -> .11...011001
60 * read-only, dirty, young 11..1...1...01 -> .11...011101
61 * read-write, clean, old 00..0...1...11 -> .10...110001
62 * read-write, clean, young 01..0...1...11 -> .10...110101
63 * read-write, dirty, old 10..0...1...11 -> .10...111001
64 * read-write, dirty, young 11..0...1...11 -> .10...111101
69 */ 65 */
70 if (pmd_present(pmd)) { 66 if (pmd_present(pmd)) {
71 pte_val(pte) = _PAGE_PRESENT | _PAGE_LARGE | _PAGE_DIRTY | 67 pte_val(pte) = pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN_LARGE;
72 (pmd_val(pmd) & PAGE_MASK); 68 pte_val(pte) |= _PAGE_LARGE | _PAGE_PRESENT;
73 if (pmd_val(pmd) & _SEGMENT_ENTRY_INVALID) 69 pte_val(pte) |= (pmd_val(pmd) & _SEGMENT_ENTRY_READ) << 4;
74 pte_val(pte) |= _PAGE_INVALID; 70 pte_val(pte) |= (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) << 4;
75 if (pmd_prot_none(pmd)) { 71 pte_val(pte) |= (pmd_val(pmd) & _SEGMENT_ENTRY_INVALID) << 5;
76 if (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT) 72 pte_val(pte) |= (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT);
77 pte_val(pte) |= _PAGE_YOUNG; 73 pmd_val(pmd) |= (pte_val(pte) & _PAGE_DIRTY) << 10;
78 } else { 74 pmd_val(pmd) |= (pte_val(pte) & _PAGE_YOUNG) << 10;
79 pte_val(pte) |= _PAGE_READ;
80 if (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT)
81 pte_val(pte) |= _PAGE_PROTECT;
82 else
83 pte_val(pte) |= _PAGE_WRITE;
84 if (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG)
85 pte_val(pte) |= _PAGE_YOUNG;
86 }
87 } else 75 } else
88 pte_val(pte) = _PAGE_INVALID; 76 pte_val(pte) = _PAGE_INVALID;
89 return pte; 77 return pte;
@@ -96,6 +84,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
96 84
97 pmd = __pte_to_pmd(pte); 85 pmd = __pte_to_pmd(pte);
98 if (!MACHINE_HAS_HPAGE) { 86 if (!MACHINE_HAS_HPAGE) {
87 /* Emulated huge ptes loose the dirty and young bit */
99 pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN; 88 pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
100 pmd_val(pmd) |= pte_page(pte)[1].index; 89 pmd_val(pmd) |= pte_page(pte)[1].index;
101 } else 90 } else
@@ -113,6 +102,8 @@ pte_t huge_ptep_get(pte_t *ptep)
113 origin = pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN; 102 origin = pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN;
114 pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN; 103 pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
115 pmd_val(pmd) |= *(unsigned long *) origin; 104 pmd_val(pmd) |= *(unsigned long *) origin;
105 /* Emulated huge ptes are young and dirty by definition */
106 pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG | _SEGMENT_ENTRY_DIRTY;
116 } 107 }
117 return __pmd_to_pte(pmd); 108 return __pmd_to_pte(pmd);
118} 109}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 37b8241ec784..19daa53a3da4 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -1279,6 +1279,7 @@ static unsigned long page_table_realloc_pmd(struct mmu_gather *tlb,
1279{ 1279{
1280 unsigned long next, *table, *new; 1280 unsigned long next, *table, *new;
1281 struct page *page; 1281 struct page *page;
1282 spinlock_t *ptl;
1282 pmd_t *pmd; 1283 pmd_t *pmd;
1283 1284
1284 pmd = pmd_offset(pud, addr); 1285 pmd = pmd_offset(pud, addr);
@@ -1296,7 +1297,7 @@ again:
1296 if (!new) 1297 if (!new)
1297 return -ENOMEM; 1298 return -ENOMEM;
1298 1299
1299 spin_lock(&mm->page_table_lock); 1300 ptl = pmd_lock(mm, pmd);
1300 if (likely((unsigned long *) pmd_deref(*pmd) == table)) { 1301 if (likely((unsigned long *) pmd_deref(*pmd) == table)) {
1301 /* Nuke pmd entry pointing to the "short" page table */ 1302 /* Nuke pmd entry pointing to the "short" page table */
1302 pmdp_flush_lazy(mm, addr, pmd); 1303 pmdp_flush_lazy(mm, addr, pmd);
@@ -1310,7 +1311,7 @@ again:
1310 page_table_free_rcu(tlb, table); 1311 page_table_free_rcu(tlb, table);
1311 new = NULL; 1312 new = NULL;
1312 } 1313 }
1313 spin_unlock(&mm->page_table_lock); 1314 spin_unlock(ptl);
1314 if (new) { 1315 if (new) {
1315 page_table_free_pgste(new); 1316 page_table_free_pgste(new);
1316 goto again; 1317 goto again;
@@ -1432,6 +1433,9 @@ int pmdp_set_access_flags(struct vm_area_struct *vma,
1432{ 1433{
1433 VM_BUG_ON(address & ~HPAGE_PMD_MASK); 1434 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
1434 1435
1436 entry = pmd_mkyoung(entry);
1437 if (dirty)
1438 entry = pmd_mkdirty(entry);
1435 if (pmd_same(*pmdp, entry)) 1439 if (pmd_same(*pmdp, entry))
1436 return 0; 1440 return 0;
1437 pmdp_invalidate(vma, address, pmdp); 1441 pmdp_invalidate(vma, address, pmdp);
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index a2cbd875543a..61e45b7c04d7 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -812,7 +812,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
812 return header; 812 return header;
813} 813}
814 814
815void bpf_jit_compile(struct sk_filter *fp) 815void bpf_jit_compile(struct bpf_prog *fp)
816{ 816{
817 struct bpf_binary_header *header = NULL; 817 struct bpf_binary_header *header = NULL;
818 unsigned long size, prg_len, lit_len; 818 unsigned long size, prg_len, lit_len;
@@ -875,7 +875,7 @@ out:
875 kfree(addrs); 875 kfree(addrs);
876} 876}
877 877
878void bpf_jit_free(struct sk_filter *fp) 878void bpf_jit_free(struct bpf_prog *fp)
879{ 879{
880 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 880 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
881 struct bpf_binary_header *header = (void *)addr; 881 struct bpf_binary_header *header = (void *)addr;
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 30de42730b2f..2fa7b14b9c08 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -15,8 +15,8 @@
15 * Thomas Klein 15 * Thomas Klein
16 */ 16 */
17 17
18#define COMPONENT "zPCI" 18#define KMSG_COMPONENT "zpci"
19#define pr_fmt(fmt) COMPONENT ": " fmt 19#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 96545d7659fd..6e22a247de9b 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -5,8 +5,8 @@
5 * Jan Glauber <jang@linux.vnet.ibm.com> 5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */ 6 */
7 7
8#define COMPONENT "zPCI" 8#define KMSG_COMPONENT "zpci"
9#define pr_fmt(fmt) COMPONENT ": " fmt 9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index c5c66840ac00..eec598c5939f 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -5,8 +5,8 @@
5 * Jan Glauber <jang@linux.vnet.ibm.com> 5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */ 6 */
7 7
8#define COMPONENT "zPCI" 8#define KMSG_COMPONENT "zpci"
9#define pr_fmt(fmt) COMPONENT ": " fmt 9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/seq_file.h> 12#include <linux/seq_file.h>
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index f91c03119804..4cbb29a4d615 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -16,6 +16,13 @@
16 16
17static struct kmem_cache *dma_region_table_cache; 17static struct kmem_cache *dma_region_table_cache;
18static struct kmem_cache *dma_page_table_cache; 18static struct kmem_cache *dma_page_table_cache;
19static int s390_iommu_strict;
20
21static int zpci_refresh_global(struct zpci_dev *zdev)
22{
23 return zpci_refresh_trans((u64) zdev->fh << 32, zdev->start_dma,
24 zdev->iommu_pages * PAGE_SIZE);
25}
19 26
20static unsigned long *dma_alloc_cpu_table(void) 27static unsigned long *dma_alloc_cpu_table(void)
21{ 28{
@@ -155,18 +162,15 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa,
155 } 162 }
156 163
157 /* 164 /*
158 * rpcit is not required to establish new translations when previously 165 * With zdev->tlb_refresh == 0, rpcit is not required to establish new
159 * invalid translation-table entries are validated, however it is 166 * translations when previously invalid translation-table entries are
160 * required when altering previously valid entries. 167 * validated. With lazy unmap, it also is skipped for previously valid
168 * entries, but a global rpcit is then required before any address can
169 * be re-used, i.e. after each iommu bitmap wrap-around.
161 */ 170 */
162 if (!zdev->tlb_refresh && 171 if (!zdev->tlb_refresh &&
163 ((flags & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID)) 172 (!s390_iommu_strict ||
164 /* 173 ((flags & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID)))
165 * TODO: also need to check that the old entry is indeed INVALID
166 * and not only for one page but for the whole range...
167 * -> now we WARN_ON in that case but with lazy unmap that
168 * needs to be redone!
169 */
170 goto no_refresh; 174 goto no_refresh;
171 175
172 rc = zpci_refresh_trans((u64) zdev->fh << 32, start_dma_addr, 176 rc = zpci_refresh_trans((u64) zdev->fh << 32, start_dma_addr,
@@ -220,16 +224,21 @@ static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev,
220static unsigned long dma_alloc_iommu(struct zpci_dev *zdev, int size) 224static unsigned long dma_alloc_iommu(struct zpci_dev *zdev, int size)
221{ 225{
222 unsigned long offset, flags; 226 unsigned long offset, flags;
227 int wrap = 0;
223 228
224 spin_lock_irqsave(&zdev->iommu_bitmap_lock, flags); 229 spin_lock_irqsave(&zdev->iommu_bitmap_lock, flags);
225 offset = __dma_alloc_iommu(zdev, zdev->next_bit, size); 230 offset = __dma_alloc_iommu(zdev, zdev->next_bit, size);
226 if (offset == -1) 231 if (offset == -1) {
232 /* wrap-around */
227 offset = __dma_alloc_iommu(zdev, 0, size); 233 offset = __dma_alloc_iommu(zdev, 0, size);
234 wrap = 1;
235 }
228 236
229 if (offset != -1) { 237 if (offset != -1) {
230 zdev->next_bit = offset + size; 238 zdev->next_bit = offset + size;
231 if (zdev->next_bit >= zdev->iommu_pages) 239 if (!zdev->tlb_refresh && !s390_iommu_strict && wrap)
232 zdev->next_bit = 0; 240 /* global flush after wrap-around with lazy unmap */
241 zpci_refresh_global(zdev);
233 } 242 }
234 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags); 243 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
235 return offset; 244 return offset;
@@ -243,7 +252,11 @@ static void dma_free_iommu(struct zpci_dev *zdev, unsigned long offset, int size
243 if (!zdev->iommu_bitmap) 252 if (!zdev->iommu_bitmap)
244 goto out; 253 goto out;
245 bitmap_clear(zdev->iommu_bitmap, offset, size); 254 bitmap_clear(zdev->iommu_bitmap, offset, size);
246 if (offset >= zdev->next_bit) 255 /*
256 * Lazy flush for unmap: need to move next_bit to avoid address re-use
257 * until wrap-around.
258 */
259 if (!s390_iommu_strict && offset >= zdev->next_bit)
247 zdev->next_bit = offset + size; 260 zdev->next_bit = offset + size;
248out: 261out:
249 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags); 262 spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, flags);
@@ -504,3 +517,12 @@ struct dma_map_ops s390_dma_ops = {
504 /* dma_supported is unconditionally true without a callback */ 517 /* dma_supported is unconditionally true without a callback */
505}; 518};
506EXPORT_SYMBOL_GPL(s390_dma_ops); 519EXPORT_SYMBOL_GPL(s390_dma_ops);
520
521static int __init s390_iommu_setup(char *str)
522{
523 if (!strncmp(str, "strict", 6))
524 s390_iommu_strict = 1;
525 return 0;
526}
527
528__setup("s390_iommu=", s390_iommu_setup);
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
index 6d7f5a3016ca..460fdb21cf61 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -5,8 +5,8 @@
5 * Jan Glauber <jang@linux.vnet.ibm.com> 5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */ 6 */
7 7
8#define COMPONENT "zPCI" 8#define KMSG_COMPONENT "zpci"
9#define pr_fmt(fmt) COMPONENT ": " fmt 9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index 9190214b8702..fa3ce891e597 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -5,8 +5,8 @@
5 * Jan Glauber <jang@linux.vnet.ibm.com> 5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */ 6 */
7 7
8#define COMPONENT "zPCI" 8#define KMSG_COMPONENT "zpci"
9#define pr_fmt(fmt) COMPONENT ": " fmt 9#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/stat.h> 12#include <linux/stat.h>
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index 2f947aba4bd4..aad209199f7e 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -8,5 +8,6 @@ generic-y += cputime.h
8generic-y += hash.h 8generic-y += hash.h
9generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
10generic-y += preempt.h 10generic-y += preempt.h
11generic-y += scatterlist.h
11generic-y += trace_clock.h 12generic-y += trace_clock.h
12generic-y += xor.h 13generic-y += xor.h
diff --git a/arch/score/include/asm/scatterlist.h b/arch/score/include/asm/scatterlist.h
deleted file mode 100644
index 9f533b8362c7..000000000000
--- a/arch/score/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SCORE_SCATTERLIST_H
2#define _ASM_SCORE_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* _ASM_SCORE_SCATTERLIST_H */
diff --git a/arch/score/include/uapi/asm/ptrace.h b/arch/score/include/uapi/asm/ptrace.h
index f59771a3f127..5c5e794058be 100644
--- a/arch/score/include/uapi/asm/ptrace.h
+++ b/arch/score/include/uapi/asm/ptrace.h
@@ -4,17 +4,6 @@
4#define PTRACE_GETREGS 12 4#define PTRACE_GETREGS 12
5#define PTRACE_SETREGS 13 5#define PTRACE_SETREGS 13
6 6
7#define PC 32
8#define CONDITION 33
9#define ECR 34
10#define EMA 35
11#define CEH 36
12#define CEL 37
13#define COUNTER 38
14#define LDCR 39
15#define STCR 40
16#define PSR 41
17
18#define SINGLESTEP16_INSN 0x7006 7#define SINGLESTEP16_INSN 0x7006
19#define SINGLESTEP32_INSN 0x840C8000 8#define SINGLESTEP32_INSN 0x840C8000
20#define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ 9#define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index a00fba32b0eb..1651807774ad 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -173,15 +173,15 @@ badframe:
173 return 0; 173 return 0;
174} 174}
175 175
176static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, 176static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
177 int signr, sigset_t *set, siginfo_t *info) 177 sigset_t *set)
178{ 178{
179 struct rt_sigframe __user *frame; 179 struct rt_sigframe __user *frame;
180 int err = 0; 180 int err = 0;
181 181
182 frame = get_sigframe(ka, regs, sizeof(*frame)); 182 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 183 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
184 goto give_sigsegv; 184 return -EFAULT;
185 185
186 /* 186 /*
187 * Set up the return code ... 187 * Set up the return code ...
@@ -194,7 +194,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
194 err |= __put_user(0x80008002, frame->rs_code + 1); 194 err |= __put_user(0x80008002, frame->rs_code + 1);
195 flush_cache_sigtramp((unsigned long) frame->rs_code); 195 flush_cache_sigtramp((unsigned long) frame->rs_code);
196 196
197 err |= copy_siginfo_to_user(&frame->rs_info, info); 197 err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info);
198 err |= __put_user(0, &frame->rs_uc.uc_flags); 198 err |= __put_user(0, &frame->rs_uc.uc_flags);
199 err |= __put_user(NULL, &frame->rs_uc.uc_link); 199 err |= __put_user(NULL, &frame->rs_uc.uc_link);
200 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]); 200 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]);
@@ -202,26 +202,23 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
202 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 202 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
203 203
204 if (err) 204 if (err)
205 goto give_sigsegv; 205 return -EFAULT;
206 206
207 regs->regs[0] = (unsigned long) frame; 207 regs->regs[0] = (unsigned long) frame;
208 regs->regs[3] = (unsigned long) frame->rs_code; 208 regs->regs[3] = (unsigned long) frame->rs_code;
209 regs->regs[4] = signr; 209 regs->regs[4] = ksig->sig;
210 regs->regs[5] = (unsigned long) &frame->rs_info; 210 regs->regs[5] = (unsigned long) &frame->rs_info;
211 regs->regs[6] = (unsigned long) &frame->rs_uc; 211 regs->regs[6] = (unsigned long) &frame->rs_uc;
212 regs->regs[29] = (unsigned long) ka->sa.sa_handler; 212 regs->regs[29] = (unsigned long) ksig->ka.sa.sa_handler;
213 regs->cp0_epc = (unsigned long) ka->sa.sa_handler; 213 regs->cp0_epc = (unsigned long) ksig->ka.sa.sa_handler;
214 214
215 return 0; 215 return 0;
216
217give_sigsegv:
218 force_sigsegv(signr, current);
219 return -EFAULT;
220} 216}
221 217
222static void handle_signal(unsigned long sig, siginfo_t *info, 218static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
223 struct k_sigaction *ka, struct pt_regs *regs)
224{ 219{
220 int ret;
221
225 if (regs->is_syscall) { 222 if (regs->is_syscall) {
226 switch (regs->regs[4]) { 223 switch (regs->regs[4]) {
227 case ERESTART_RESTARTBLOCK: 224 case ERESTART_RESTARTBLOCK:
@@ -229,7 +226,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
229 regs->regs[4] = EINTR; 226 regs->regs[4] = EINTR;
230 break; 227 break;
231 case ERESTARTSYS: 228 case ERESTARTSYS:
232 if (!(ka->sa.sa_flags & SA_RESTART)) { 229 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
233 regs->regs[4] = EINTR; 230 regs->regs[4] = EINTR;
234 break; 231 break;
235 } 232 }
@@ -245,17 +242,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
245 /* 242 /*
246 * Set up the stack frame 243 * Set up the stack frame
247 */ 244 */
248 if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) 245 ret = setup_rt_frame(ksig, regs, sigmask_to_save());
249 return;
250 246
251 signal_delivered(sig, info, ka, regs, 0); 247 signal_setup_done(ret, ksig, 0);
252} 248}
253 249
254static void do_signal(struct pt_regs *regs) 250static void do_signal(struct pt_regs *regs)
255{ 251{
256 struct k_sigaction ka; 252 struct ksignal ksig;
257 siginfo_t info;
258 int signr;
259 253
260 /* 254 /*
261 * We want the common case to go fast, which is why we may in certain 255 * We want the common case to go fast, which is why we may in certain
@@ -265,10 +259,9 @@ static void do_signal(struct pt_regs *regs)
265 if (!user_mode(regs)) 259 if (!user_mode(regs))
266 return; 260 return;
267 261
268 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 262 if (get_signal(&ksig)) {
269 if (signr > 0) {
270 /* Actually deliver the signal. */ 263 /* Actually deliver the signal. */
271 handle_signal(signr, &info, &ka, regs); 264 handle_signal(&ksig, regs);
272 return; 265 return;
273 } 266 }
274 267
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index aa2df3eaeb29..453fa5c09550 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -595,6 +595,8 @@ source kernel/Kconfig.hz
595config KEXEC 595config KEXEC
596 bool "kexec system call (EXPERIMENTAL)" 596 bool "kexec system call (EXPERIMENTAL)"
597 depends on SUPERH32 && MMU 597 depends on SUPERH32 && MMU
598 select CRYPTO
599 select CRYPTO_SHA256
598 help 600 help
599 kexec is a system call that implements the ability to shutdown your 601 kexec is a system call that implements the ability to shutdown your
600 current kernel, and to start another kernel. It is like a reboot 602 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index e331e5373b8e..89963d13f930 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -371,7 +371,7 @@ if SH_MAGIC_PANEL_R2
371menu "Magic Panel R2 options" 371menu "Magic Panel R2 options"
372 372
373config SH_MAGIC_PANEL_R2_VERSION 373config SH_MAGIC_PANEL_R2_VERSION
374 int SH_MAGIC_PANEL_R2_VERSION 374 int "Magic Panel R2 Version"
375 default "3" 375 default "3"
376 help 376 help
377 Set the version of the Magic Panel R2 377 Set the version of the Magic Panel R2
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 85d5255d259f..0d3049244cd3 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
874 .name = "asoc-simple-card", 874 .name = "asoc-simple-card",
875 .dev = { 875 .dev = {
876 .platform_data = &fsi_da7210_info, 876 .platform_data = &fsi_da7210_info,
877 .coherent_dma_mask = DMA_BIT_MASK(32),
878 .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
877 }, 879 },
878}; 880};
879 881
diff --git a/arch/sh/configs/sh2007_defconfig b/arch/sh/configs/sh2007_defconfig
index 0c08d9244c97..e741b1e36acd 100644
--- a/arch/sh/configs/sh2007_defconfig
+++ b/arch/sh/configs/sh2007_defconfig
@@ -52,7 +52,6 @@ CONFIG_CDROM_PKTCDVD=y
52# CONFIG_MISC_DEVICES is not set 52# CONFIG_MISC_DEVICES is not set
53CONFIG_RAID_ATTRS=y 53CONFIG_RAID_ATTRS=y
54CONFIG_SCSI=y 54CONFIG_SCSI=y
55CONFIG_SCSI_TGT=y
56CONFIG_BLK_DEV_SD=y 55CONFIG_BLK_DEV_SD=y
57CONFIG_BLK_DEV_SR=y 56CONFIG_BLK_DEV_SR=y
58CONFIG_CHR_DEV_SG=y 57CONFIG_CHR_DEV_SG=y
diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig
index cfd5b90a8628..78bc97b1d027 100644
--- a/arch/sh/drivers/dma/Kconfig
+++ b/arch/sh/drivers/dma/Kconfig
@@ -12,9 +12,8 @@ config SH_DMA_IRQ_MULTI
12 default y if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7751 || \ 12 default y if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7751 || \
13 CPU_SUBTYPE_SH7750S || CPU_SUBTYPE_SH7750R || \ 13 CPU_SUBTYPE_SH7750S || CPU_SUBTYPE_SH7750R || \
14 CPU_SUBTYPE_SH7751R || CPU_SUBTYPE_SH7091 || \ 14 CPU_SUBTYPE_SH7751R || CPU_SUBTYPE_SH7091 || \
15 CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7764 || \ 15 CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7780 || \
16 CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 || \ 16 CPU_SUBTYPE_SH7785 || CPU_SUBTYPE_SH7760
17 CPU_SUBTYPE_SH7760
18 17
19config SH_DMA_API 18config SH_DMA_API
20 depends on SH_DMA 19 depends on SH_DMA
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index b22565623142..afde2a7d3eb3 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -25,7 +25,7 @@
25 * Define the default configuration for dual address memory-memory transfer. 25 * Define the default configuration for dual address memory-memory transfer.
26 * The 0x400 value represents auto-request, external->external. 26 * The 0x400 value represents auto-request, external->external.
27 */ 27 */
28#define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_INDEX2VAL(XMIT_SZ_32BIT)) 28#define RS_DUAL (DM_INC | SM_INC | RS_AUTO | TS_INDEX2VAL(XMIT_SZ_32BIT))
29 29
30static unsigned long dma_find_base(unsigned int chan) 30static unsigned long dma_find_base(unsigned int chan)
31{ 31{
diff --git a/arch/sh/include/asm/dma-register.h b/arch/sh/include/asm/dma-register.h
index 51cd78feacff..c757b47e6b64 100644
--- a/arch/sh/include/asm/dma-register.h
+++ b/arch/sh/include/asm/dma-register.h
@@ -13,17 +13,17 @@
13#ifndef DMA_REGISTER_H 13#ifndef DMA_REGISTER_H
14#define DMA_REGISTER_H 14#define DMA_REGISTER_H
15 15
16/* DMA register */ 16/* DMA registers */
17#define SAR 0x00 17#define SAR 0x00 /* Source Address Register */
18#define DAR 0x04 18#define DAR 0x04 /* Destination Address Register */
19#define TCR 0x08 19#define TCR 0x08 /* Transfer Count Register */
20#define CHCR 0x0C 20#define CHCR 0x0C /* Channel Control Register */
21#define DMAOR 0x40 21#define DMAOR 0x40 /* DMA Operation Register */
22 22
23/* DMAOR definitions */ 23/* DMAOR definitions */
24#define DMAOR_AE 0x00000004 24#define DMAOR_AE 0x00000004 /* Address Error Flag */
25#define DMAOR_NMIF 0x00000002 25#define DMAOR_NMIF 0x00000002
26#define DMAOR_DME 0x00000001 26#define DMAOR_DME 0x00000001 /* DMA Master Enable */
27 27
28/* Definitions for the SuperH DMAC */ 28/* Definitions for the SuperH DMAC */
29#define REQ_L 0x00000000 29#define REQ_L 0x00000000
@@ -34,18 +34,20 @@
34#define ACK_W 0x00020000 34#define ACK_W 0x00020000
35#define ACK_H 0x00000000 35#define ACK_H 0x00000000
36#define ACK_L 0x00010000 36#define ACK_L 0x00010000
37#define DM_INC 0x00004000 37#define DM_INC 0x00004000 /* Destination addresses are incremented */
38#define DM_DEC 0x00008000 38#define DM_DEC 0x00008000 /* Destination addresses are decremented */
39#define DM_FIX 0x0000c000 39#define DM_FIX 0x0000c000 /* Destination address is fixed */
40#define SM_INC 0x00001000 40#define SM_INC 0x00001000 /* Source addresses are incremented */
41#define SM_DEC 0x00002000 41#define SM_DEC 0x00002000 /* Source addresses are decremented */
42#define SM_FIX 0x00003000 42#define SM_FIX 0x00003000 /* Source address is fixed */
43#define RS_IN 0x00000200 43#define RS_IN 0x00000200
44#define RS_OUT 0x00000300 44#define RS_OUT 0x00000300
45#define RS_AUTO 0x00000400 /* Auto Request */
46#define RS_ERS 0x00000800 /* DMA extended resource selector */
45#define TS_BLK 0x00000040 47#define TS_BLK 0x00000040
46#define TM_BUR 0x00000020 48#define TM_BUR 0x00000020
47#define CHCR_DE 0x00000001 49#define CHCR_DE 0x00000001 /* DMA Enable */
48#define CHCR_TE 0x00000002 50#define CHCR_TE 0x00000002 /* Transfer End Flag */
49#define CHCR_IE 0x00000004 51#define CHCR_IE 0x00000004 /* Interrupt Enable */
50 52
51#endif 53#endif
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index 4d48f1436a63..c727e6ddf69e 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -34,6 +34,17 @@ static inline void outl(unsigned int x, unsigned long port)
34 BUG(); 34 BUG();
35} 35}
36 36
37static inline void __iomem *ioport_map(unsigned long port, unsigned int size)
38{
39 BUG();
40 return NULL;
41}
42
43static inline void ioport_unmap(void __iomem *addr)
44{
45 BUG();
46}
47
37#define inb_p(addr) inb(addr) 48#define inb_p(addr) inb(addr)
38#define inw_p(addr) inw(addr) 49#define inw_p(addr) inw(addr)
39#define inl_p(addr) inl(addr) 50#define inl_p(addr) inl(addr)
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 15d970328f71..fe20d14ae051 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -186,11 +186,6 @@ typedef struct page *pgtable_t;
186#include <asm-generic/memory_model.h> 186#include <asm-generic/memory_model.h>
187#include <asm-generic/getorder.h> 187#include <asm-generic/getorder.h>
188 188
189/* vDSO support */
190#ifdef CONFIG_VSYSCALL
191#define __HAVE_ARCH_GATE_AREA
192#endif
193
194/* 189/*
195 * Some drivers need to perform DMA into kmalloc'ed buffers 190 * Some drivers need to perform DMA into kmalloc'ed buffers
196 * and so we have to increase the kmalloc minalign for this. 191 * and so we have to increase the kmalloc minalign for this.
diff --git a/arch/sh/include/cpu-sh4/cpu/dma-register.h b/arch/sh/include/cpu-sh4/cpu/dma-register.h
index 02788b6a03b7..9cd81e54056a 100644
--- a/arch/sh/include/cpu-sh4/cpu/dma-register.h
+++ b/arch/sh/include/cpu-sh4/cpu/dma-register.h
@@ -32,7 +32,6 @@
32#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */ 32#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
33#elif defined(CONFIG_CPU_SUBTYPE_SH7757) || \ 33#elif defined(CONFIG_CPU_SUBTYPE_SH7757) || \
34 defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 34 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
35 defined(CONFIG_CPU_SUBTYPE_SH7764) || \
36 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 35 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
37 defined(CONFIG_CPU_SUBTYPE_SH7785) 36 defined(CONFIG_CPU_SUBTYPE_SH7785)
38#define CHCR_TS_LOW_MASK 0x00000018 37#define CHCR_TS_LOW_MASK 0x00000018
diff --git a/arch/sh/include/cpu-sh4a/cpu/dma.h b/arch/sh/include/cpu-sh4a/cpu/dma.h
index 89afb650ce25..8ceccceae844 100644
--- a/arch/sh/include/cpu-sh4a/cpu/dma.h
+++ b/arch/sh/include/cpu-sh4a/cpu/dma.h
@@ -14,8 +14,7 @@
14#define DMTE4_IRQ evt2irq(0xb80) 14#define DMTE4_IRQ evt2irq(0xb80)
15#define DMAE0_IRQ evt2irq(0xbc0) /* DMA Error IRQ*/ 15#define DMAE0_IRQ evt2irq(0xbc0) /* DMA Error IRQ*/
16#define SH_DMAC_BASE0 0xFE008020 16#define SH_DMAC_BASE0 0xFE008020
17#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 17#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
18 defined(CONFIG_CPU_SUBTYPE_SH7764)
19#define DMTE0_IRQ evt2irq(0x640) 18#define DMTE0_IRQ evt2irq(0x640)
20#define DMTE4_IRQ evt2irq(0x780) 19#define DMTE4_IRQ evt2irq(0x780)
21#define DMAE0_IRQ evt2irq(0x6c0) 20#define DMAE0_IRQ evt2irq(0x6c0)
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index f579dd528198..c187b9579c21 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -307,7 +307,7 @@ static struct clk_lookup lookups[] = {
307 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]), 307 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]),
308 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]), 308 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]),
309 309
310 CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[HWBLK_CMT]), 310 CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
311 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]), 311 CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
312 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]), 312 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
313 313
@@ -332,6 +332,8 @@ static struct clk_lookup lookups[] = {
332 CLKDEV_CON_ID("tsif0", &mstp_clks[HWBLK_TSIF]), 332 CLKDEV_CON_ID("tsif0", &mstp_clks[HWBLK_TSIF]),
333 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[HWBLK_USB1]), 333 CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[HWBLK_USB1]),
334 CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[HWBLK_USB0]), 334 CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[HWBLK_USB0]),
335 CLKDEV_CON_ID("usb1", &mstp_clks[HWBLK_USB1]),
336 CLKDEV_CON_ID("usb0", &mstp_clks[HWBLK_USB0]),
335 CLKDEV_CON_ID("2dg0", &mstp_clks[HWBLK_2DG]), 337 CLKDEV_CON_ID("2dg0", &mstp_clks[HWBLK_2DG]),
336 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[HWBLK_SDHI0]), 338 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[HWBLK_SDHI0]),
337 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[HWBLK_SDHI1]), 339 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[HWBLK_SDHI1]),
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 57f83a92a505..7aa733307afc 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -30,62 +30,62 @@ static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
30 { 30 {
31 .slave_id = SHDMA_SLAVE_SCIF0_TX, 31 .slave_id = SHDMA_SLAVE_SCIF0_TX,
32 .addr = 0xffe0000c, 32 .addr = 0xffe0000c,
33 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 33 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
34 .mid_rid = 0x21, 34 .mid_rid = 0x21,
35 }, { 35 }, {
36 .slave_id = SHDMA_SLAVE_SCIF0_RX, 36 .slave_id = SHDMA_SLAVE_SCIF0_RX,
37 .addr = 0xffe00014, 37 .addr = 0xffe00014,
38 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 38 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
39 .mid_rid = 0x22, 39 .mid_rid = 0x22,
40 }, { 40 }, {
41 .slave_id = SHDMA_SLAVE_SCIF1_TX, 41 .slave_id = SHDMA_SLAVE_SCIF1_TX,
42 .addr = 0xffe1000c, 42 .addr = 0xffe1000c,
43 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 43 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
44 .mid_rid = 0x25, 44 .mid_rid = 0x25,
45 }, { 45 }, {
46 .slave_id = SHDMA_SLAVE_SCIF1_RX, 46 .slave_id = SHDMA_SLAVE_SCIF1_RX,
47 .addr = 0xffe10014, 47 .addr = 0xffe10014,
48 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 48 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
49 .mid_rid = 0x26, 49 .mid_rid = 0x26,
50 }, { 50 }, {
51 .slave_id = SHDMA_SLAVE_SCIF2_TX, 51 .slave_id = SHDMA_SLAVE_SCIF2_TX,
52 .addr = 0xffe2000c, 52 .addr = 0xffe2000c,
53 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 53 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
54 .mid_rid = 0x29, 54 .mid_rid = 0x29,
55 }, { 55 }, {
56 .slave_id = SHDMA_SLAVE_SCIF2_RX, 56 .slave_id = SHDMA_SLAVE_SCIF2_RX,
57 .addr = 0xffe20014, 57 .addr = 0xffe20014,
58 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 58 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
59 .mid_rid = 0x2a, 59 .mid_rid = 0x2a,
60 }, { 60 }, {
61 .slave_id = SHDMA_SLAVE_SIUA_TX, 61 .slave_id = SHDMA_SLAVE_SIUA_TX,
62 .addr = 0xa454c098, 62 .addr = 0xa454c098,
63 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 63 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
64 .mid_rid = 0xb1, 64 .mid_rid = 0xb1,
65 }, { 65 }, {
66 .slave_id = SHDMA_SLAVE_SIUA_RX, 66 .slave_id = SHDMA_SLAVE_SIUA_RX,
67 .addr = 0xa454c090, 67 .addr = 0xa454c090,
68 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 68 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
69 .mid_rid = 0xb2, 69 .mid_rid = 0xb2,
70 }, { 70 }, {
71 .slave_id = SHDMA_SLAVE_SIUB_TX, 71 .slave_id = SHDMA_SLAVE_SIUB_TX,
72 .addr = 0xa454c09c, 72 .addr = 0xa454c09c,
73 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 73 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
74 .mid_rid = 0xb5, 74 .mid_rid = 0xb5,
75 }, { 75 }, {
76 .slave_id = SHDMA_SLAVE_SIUB_RX, 76 .slave_id = SHDMA_SLAVE_SIUB_RX,
77 .addr = 0xa454c094, 77 .addr = 0xa454c094,
78 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 78 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
79 .mid_rid = 0xb6, 79 .mid_rid = 0xb6,
80 }, { 80 }, {
81 .slave_id = SHDMA_SLAVE_SDHI0_TX, 81 .slave_id = SHDMA_SLAVE_SDHI0_TX,
82 .addr = 0x04ce0030, 82 .addr = 0x04ce0030,
83 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 83 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
84 .mid_rid = 0xc1, 84 .mid_rid = 0xc1,
85 }, { 85 }, {
86 .slave_id = SHDMA_SLAVE_SDHI0_RX, 86 .slave_id = SHDMA_SLAVE_SDHI0_RX,
87 .addr = 0x04ce0030, 87 .addr = 0x04ce0030,
88 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 88 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
89 .mid_rid = 0xc2, 89 .mid_rid = 0xc2,
90 }, 90 },
91}; 91};
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index b9e84b1d3aa7..ea5780b3c7f6 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -36,122 +36,122 @@ static const struct sh_dmae_slave_config sh7724_dmae_slaves[] = {
36 { 36 {
37 .slave_id = SHDMA_SLAVE_SCIF0_TX, 37 .slave_id = SHDMA_SLAVE_SCIF0_TX,
38 .addr = 0xffe0000c, 38 .addr = 0xffe0000c,
39 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 39 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
40 .mid_rid = 0x21, 40 .mid_rid = 0x21,
41 }, { 41 }, {
42 .slave_id = SHDMA_SLAVE_SCIF0_RX, 42 .slave_id = SHDMA_SLAVE_SCIF0_RX,
43 .addr = 0xffe00014, 43 .addr = 0xffe00014,
44 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 44 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
45 .mid_rid = 0x22, 45 .mid_rid = 0x22,
46 }, { 46 }, {
47 .slave_id = SHDMA_SLAVE_SCIF1_TX, 47 .slave_id = SHDMA_SLAVE_SCIF1_TX,
48 .addr = 0xffe1000c, 48 .addr = 0xffe1000c,
49 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 49 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
50 .mid_rid = 0x25, 50 .mid_rid = 0x25,
51 }, { 51 }, {
52 .slave_id = SHDMA_SLAVE_SCIF1_RX, 52 .slave_id = SHDMA_SLAVE_SCIF1_RX,
53 .addr = 0xffe10014, 53 .addr = 0xffe10014,
54 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 54 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
55 .mid_rid = 0x26, 55 .mid_rid = 0x26,
56 }, { 56 }, {
57 .slave_id = SHDMA_SLAVE_SCIF2_TX, 57 .slave_id = SHDMA_SLAVE_SCIF2_TX,
58 .addr = 0xffe2000c, 58 .addr = 0xffe2000c,
59 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 59 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
60 .mid_rid = 0x29, 60 .mid_rid = 0x29,
61 }, { 61 }, {
62 .slave_id = SHDMA_SLAVE_SCIF2_RX, 62 .slave_id = SHDMA_SLAVE_SCIF2_RX,
63 .addr = 0xffe20014, 63 .addr = 0xffe20014,
64 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 64 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
65 .mid_rid = 0x2a, 65 .mid_rid = 0x2a,
66 }, { 66 }, {
67 .slave_id = SHDMA_SLAVE_SCIF3_TX, 67 .slave_id = SHDMA_SLAVE_SCIF3_TX,
68 .addr = 0xa4e30020, 68 .addr = 0xa4e30020,
69 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 69 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
70 .mid_rid = 0x2d, 70 .mid_rid = 0x2d,
71 }, { 71 }, {
72 .slave_id = SHDMA_SLAVE_SCIF3_RX, 72 .slave_id = SHDMA_SLAVE_SCIF3_RX,
73 .addr = 0xa4e30024, 73 .addr = 0xa4e30024,
74 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 74 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
75 .mid_rid = 0x2e, 75 .mid_rid = 0x2e,
76 }, { 76 }, {
77 .slave_id = SHDMA_SLAVE_SCIF4_TX, 77 .slave_id = SHDMA_SLAVE_SCIF4_TX,
78 .addr = 0xa4e40020, 78 .addr = 0xa4e40020,
79 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 79 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
80 .mid_rid = 0x31, 80 .mid_rid = 0x31,
81 }, { 81 }, {
82 .slave_id = SHDMA_SLAVE_SCIF4_RX, 82 .slave_id = SHDMA_SLAVE_SCIF4_RX,
83 .addr = 0xa4e40024, 83 .addr = 0xa4e40024,
84 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 84 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
85 .mid_rid = 0x32, 85 .mid_rid = 0x32,
86 }, { 86 }, {
87 .slave_id = SHDMA_SLAVE_SCIF5_TX, 87 .slave_id = SHDMA_SLAVE_SCIF5_TX,
88 .addr = 0xa4e50020, 88 .addr = 0xa4e50020,
89 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 89 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
90 .mid_rid = 0x35, 90 .mid_rid = 0x35,
91 }, { 91 }, {
92 .slave_id = SHDMA_SLAVE_SCIF5_RX, 92 .slave_id = SHDMA_SLAVE_SCIF5_RX,
93 .addr = 0xa4e50024, 93 .addr = 0xa4e50024,
94 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT), 94 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
95 .mid_rid = 0x36, 95 .mid_rid = 0x36,
96 }, { 96 }, {
97 .slave_id = SHDMA_SLAVE_USB0D0_TX, 97 .slave_id = SHDMA_SLAVE_USB0D0_TX,
98 .addr = 0xA4D80100, 98 .addr = 0xA4D80100,
99 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 99 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
100 .mid_rid = 0x73, 100 .mid_rid = 0x73,
101 }, { 101 }, {
102 .slave_id = SHDMA_SLAVE_USB0D0_RX, 102 .slave_id = SHDMA_SLAVE_USB0D0_RX,
103 .addr = 0xA4D80100, 103 .addr = 0xA4D80100,
104 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 104 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
105 .mid_rid = 0x73, 105 .mid_rid = 0x73,
106 }, { 106 }, {
107 .slave_id = SHDMA_SLAVE_USB0D1_TX, 107 .slave_id = SHDMA_SLAVE_USB0D1_TX,
108 .addr = 0xA4D80120, 108 .addr = 0xA4D80120,
109 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 109 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
110 .mid_rid = 0x77, 110 .mid_rid = 0x77,
111 }, { 111 }, {
112 .slave_id = SHDMA_SLAVE_USB0D1_RX, 112 .slave_id = SHDMA_SLAVE_USB0D1_RX,
113 .addr = 0xA4D80120, 113 .addr = 0xA4D80120,
114 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 114 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
115 .mid_rid = 0x77, 115 .mid_rid = 0x77,
116 }, { 116 }, {
117 .slave_id = SHDMA_SLAVE_USB1D0_TX, 117 .slave_id = SHDMA_SLAVE_USB1D0_TX,
118 .addr = 0xA4D90100, 118 .addr = 0xA4D90100,
119 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 119 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
120 .mid_rid = 0xab, 120 .mid_rid = 0xab,
121 }, { 121 }, {
122 .slave_id = SHDMA_SLAVE_USB1D0_RX, 122 .slave_id = SHDMA_SLAVE_USB1D0_RX,
123 .addr = 0xA4D90100, 123 .addr = 0xA4D90100,
124 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 124 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
125 .mid_rid = 0xab, 125 .mid_rid = 0xab,
126 }, { 126 }, {
127 .slave_id = SHDMA_SLAVE_USB1D1_TX, 127 .slave_id = SHDMA_SLAVE_USB1D1_TX,
128 .addr = 0xA4D90120, 128 .addr = 0xA4D90120,
129 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 129 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
130 .mid_rid = 0xaf, 130 .mid_rid = 0xaf,
131 }, { 131 }, {
132 .slave_id = SHDMA_SLAVE_USB1D1_RX, 132 .slave_id = SHDMA_SLAVE_USB1D1_RX,
133 .addr = 0xA4D90120, 133 .addr = 0xA4D90120,
134 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 134 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
135 .mid_rid = 0xaf, 135 .mid_rid = 0xaf,
136 }, { 136 }, {
137 .slave_id = SHDMA_SLAVE_SDHI0_TX, 137 .slave_id = SHDMA_SLAVE_SDHI0_TX,
138 .addr = 0x04ce0030, 138 .addr = 0x04ce0030,
139 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 139 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
140 .mid_rid = 0xc1, 140 .mid_rid = 0xc1,
141 }, { 141 }, {
142 .slave_id = SHDMA_SLAVE_SDHI0_RX, 142 .slave_id = SHDMA_SLAVE_SDHI0_RX,
143 .addr = 0x04ce0030, 143 .addr = 0x04ce0030,
144 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 144 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
145 .mid_rid = 0xc2, 145 .mid_rid = 0xc2,
146 }, { 146 }, {
147 .slave_id = SHDMA_SLAVE_SDHI1_TX, 147 .slave_id = SHDMA_SLAVE_SDHI1_TX,
148 .addr = 0x04cf0030, 148 .addr = 0x04cf0030,
149 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 149 .chcr = DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
150 .mid_rid = 0xc9, 150 .mid_rid = 0xc9,
151 }, { 151 }, {
152 .slave_id = SHDMA_SLAVE_SDHI1_RX, 152 .slave_id = SHDMA_SLAVE_SDHI1_RX,
153 .addr = 0x04cf0030, 153 .addr = 0x04cf0030,
154 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 154 .chcr = DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
155 .mid_rid = 0xca, 155 .mid_rid = 0xca,
156 }, 156 },
157}; 157};
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 7b24ec4b409a..18bcd70cd813 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -123,28 +123,28 @@ static const struct sh_dmae_slave_config sh7757_dmae0_slaves[] = {
123 { 123 {
124 .slave_id = SHDMA_SLAVE_SDHI_TX, 124 .slave_id = SHDMA_SLAVE_SDHI_TX,
125 .addr = 0x1fe50030, 125 .addr = 0x1fe50030,
126 .chcr = SM_INC | 0x800 | 0x40000000 | 126 .chcr = SM_INC | RS_ERS | 0x40000000 |
127 TS_INDEX2VAL(XMIT_SZ_16BIT), 127 TS_INDEX2VAL(XMIT_SZ_16BIT),
128 .mid_rid = 0xc5, 128 .mid_rid = 0xc5,
129 }, 129 },
130 { 130 {
131 .slave_id = SHDMA_SLAVE_SDHI_RX, 131 .slave_id = SHDMA_SLAVE_SDHI_RX,
132 .addr = 0x1fe50030, 132 .addr = 0x1fe50030,
133 .chcr = DM_INC | 0x800 | 0x40000000 | 133 .chcr = DM_INC | RS_ERS | 0x40000000 |
134 TS_INDEX2VAL(XMIT_SZ_16BIT), 134 TS_INDEX2VAL(XMIT_SZ_16BIT),
135 .mid_rid = 0xc6, 135 .mid_rid = 0xc6,
136 }, 136 },
137 { 137 {
138 .slave_id = SHDMA_SLAVE_MMCIF_TX, 138 .slave_id = SHDMA_SLAVE_MMCIF_TX,
139 .addr = 0x1fcb0034, 139 .addr = 0x1fcb0034,
140 .chcr = SM_INC | 0x800 | 0x40000000 | 140 .chcr = SM_INC | RS_ERS | 0x40000000 |
141 TS_INDEX2VAL(XMIT_SZ_32BIT), 141 TS_INDEX2VAL(XMIT_SZ_32BIT),
142 .mid_rid = 0xd3, 142 .mid_rid = 0xd3,
143 }, 143 },
144 { 144 {
145 .slave_id = SHDMA_SLAVE_MMCIF_RX, 145 .slave_id = SHDMA_SLAVE_MMCIF_RX,
146 .addr = 0x1fcb0034, 146 .addr = 0x1fcb0034,
147 .chcr = DM_INC | 0x800 | 0x40000000 | 147 .chcr = DM_INC | RS_ERS | 0x40000000 |
148 TS_INDEX2VAL(XMIT_SZ_32BIT), 148 TS_INDEX2VAL(XMIT_SZ_32BIT),
149 .mid_rid = 0xd7, 149 .mid_rid = 0xd7,
150 }, 150 },
@@ -154,56 +154,56 @@ static const struct sh_dmae_slave_config sh7757_dmae1_slaves[] = {
154 { 154 {
155 .slave_id = SHDMA_SLAVE_SCIF2_TX, 155 .slave_id = SHDMA_SLAVE_SCIF2_TX,
156 .addr = 0x1f4b000c, 156 .addr = 0x1f4b000c,
157 .chcr = SM_INC | 0x800 | 0x40000000 | 157 .chcr = SM_INC | RS_ERS | 0x40000000 |
158 TS_INDEX2VAL(XMIT_SZ_8BIT), 158 TS_INDEX2VAL(XMIT_SZ_8BIT),
159 .mid_rid = 0x21, 159 .mid_rid = 0x21,
160 }, 160 },
161 { 161 {
162 .slave_id = SHDMA_SLAVE_SCIF2_RX, 162 .slave_id = SHDMA_SLAVE_SCIF2_RX,
163 .addr = 0x1f4b0014, 163 .addr = 0x1f4b0014,
164 .chcr = DM_INC | 0x800 | 0x40000000 | 164 .chcr = DM_INC | RS_ERS | 0x40000000 |
165 TS_INDEX2VAL(XMIT_SZ_8BIT), 165 TS_INDEX2VAL(XMIT_SZ_8BIT),
166 .mid_rid = 0x22, 166 .mid_rid = 0x22,
167 }, 167 },
168 { 168 {
169 .slave_id = SHDMA_SLAVE_SCIF3_TX, 169 .slave_id = SHDMA_SLAVE_SCIF3_TX,
170 .addr = 0x1f4c000c, 170 .addr = 0x1f4c000c,
171 .chcr = SM_INC | 0x800 | 0x40000000 | 171 .chcr = SM_INC | RS_ERS | 0x40000000 |
172 TS_INDEX2VAL(XMIT_SZ_8BIT), 172 TS_INDEX2VAL(XMIT_SZ_8BIT),
173 .mid_rid = 0x29, 173 .mid_rid = 0x29,
174 }, 174 },
175 { 175 {
176 .slave_id = SHDMA_SLAVE_SCIF3_RX, 176 .slave_id = SHDMA_SLAVE_SCIF3_RX,
177 .addr = 0x1f4c0014, 177 .addr = 0x1f4c0014,
178 .chcr = DM_INC | 0x800 | 0x40000000 | 178 .chcr = DM_INC | RS_ERS | 0x40000000 |
179 TS_INDEX2VAL(XMIT_SZ_8BIT), 179 TS_INDEX2VAL(XMIT_SZ_8BIT),
180 .mid_rid = 0x2a, 180 .mid_rid = 0x2a,
181 }, 181 },
182 { 182 {
183 .slave_id = SHDMA_SLAVE_SCIF4_TX, 183 .slave_id = SHDMA_SLAVE_SCIF4_TX,
184 .addr = 0x1f4d000c, 184 .addr = 0x1f4d000c,
185 .chcr = SM_INC | 0x800 | 0x40000000 | 185 .chcr = SM_INC | RS_ERS | 0x40000000 |
186 TS_INDEX2VAL(XMIT_SZ_8BIT), 186 TS_INDEX2VAL(XMIT_SZ_8BIT),
187 .mid_rid = 0x41, 187 .mid_rid = 0x41,
188 }, 188 },
189 { 189 {
190 .slave_id = SHDMA_SLAVE_SCIF4_RX, 190 .slave_id = SHDMA_SLAVE_SCIF4_RX,
191 .addr = 0x1f4d0014, 191 .addr = 0x1f4d0014,
192 .chcr = DM_INC | 0x800 | 0x40000000 | 192 .chcr = DM_INC | RS_ERS | 0x40000000 |
193 TS_INDEX2VAL(XMIT_SZ_8BIT), 193 TS_INDEX2VAL(XMIT_SZ_8BIT),
194 .mid_rid = 0x42, 194 .mid_rid = 0x42,
195 }, 195 },
196 { 196 {
197 .slave_id = SHDMA_SLAVE_RSPI_TX, 197 .slave_id = SHDMA_SLAVE_RSPI_TX,
198 .addr = 0xfe480004, 198 .addr = 0xfe480004,
199 .chcr = SM_INC | 0x800 | 0x40000000 | 199 .chcr = SM_INC | RS_ERS | 0x40000000 |
200 TS_INDEX2VAL(XMIT_SZ_16BIT), 200 TS_INDEX2VAL(XMIT_SZ_16BIT),
201 .mid_rid = 0xc1, 201 .mid_rid = 0xc1,
202 }, 202 },
203 { 203 {
204 .slave_id = SHDMA_SLAVE_RSPI_RX, 204 .slave_id = SHDMA_SLAVE_RSPI_RX,
205 .addr = 0xfe480004, 205 .addr = 0xfe480004,
206 .chcr = DM_INC | 0x800 | 0x40000000 | 206 .chcr = DM_INC | RS_ERS | 0x40000000 |
207 TS_INDEX2VAL(XMIT_SZ_16BIT), 207 TS_INDEX2VAL(XMIT_SZ_16BIT),
208 .mid_rid = 0xc2, 208 .mid_rid = 0xc2,
209 }, 209 },
@@ -213,70 +213,70 @@ static const struct sh_dmae_slave_config sh7757_dmae2_slaves[] = {
213 { 213 {
214 .slave_id = SHDMA_SLAVE_RIIC0_TX, 214 .slave_id = SHDMA_SLAVE_RIIC0_TX,
215 .addr = 0x1e500012, 215 .addr = 0x1e500012,
216 .chcr = SM_INC | 0x800 | 0x40000000 | 216 .chcr = SM_INC | RS_ERS | 0x40000000 |
217 TS_INDEX2VAL(XMIT_SZ_8BIT), 217 TS_INDEX2VAL(XMIT_SZ_8BIT),
218 .mid_rid = 0x21, 218 .mid_rid = 0x21,
219 }, 219 },
220 { 220 {
221 .slave_id = SHDMA_SLAVE_RIIC0_RX, 221 .slave_id = SHDMA_SLAVE_RIIC0_RX,
222 .addr = 0x1e500013, 222 .addr = 0x1e500013,
223 .chcr = DM_INC | 0x800 | 0x40000000 | 223 .chcr = DM_INC | RS_ERS | 0x40000000 |
224 TS_INDEX2VAL(XMIT_SZ_8BIT), 224 TS_INDEX2VAL(XMIT_SZ_8BIT),
225 .mid_rid = 0x22, 225 .mid_rid = 0x22,
226 }, 226 },
227 { 227 {
228 .slave_id = SHDMA_SLAVE_RIIC1_TX, 228 .slave_id = SHDMA_SLAVE_RIIC1_TX,
229 .addr = 0x1e510012, 229 .addr = 0x1e510012,
230 .chcr = SM_INC | 0x800 | 0x40000000 | 230 .chcr = SM_INC | RS_ERS | 0x40000000 |
231 TS_INDEX2VAL(XMIT_SZ_8BIT), 231 TS_INDEX2VAL(XMIT_SZ_8BIT),
232 .mid_rid = 0x29, 232 .mid_rid = 0x29,
233 }, 233 },
234 { 234 {
235 .slave_id = SHDMA_SLAVE_RIIC1_RX, 235 .slave_id = SHDMA_SLAVE_RIIC1_RX,
236 .addr = 0x1e510013, 236 .addr = 0x1e510013,
237 .chcr = DM_INC | 0x800 | 0x40000000 | 237 .chcr = DM_INC | RS_ERS | 0x40000000 |
238 TS_INDEX2VAL(XMIT_SZ_8BIT), 238 TS_INDEX2VAL(XMIT_SZ_8BIT),
239 .mid_rid = 0x2a, 239 .mid_rid = 0x2a,
240 }, 240 },
241 { 241 {
242 .slave_id = SHDMA_SLAVE_RIIC2_TX, 242 .slave_id = SHDMA_SLAVE_RIIC2_TX,
243 .addr = 0x1e520012, 243 .addr = 0x1e520012,
244 .chcr = SM_INC | 0x800 | 0x40000000 | 244 .chcr = SM_INC | RS_ERS | 0x40000000 |
245 TS_INDEX2VAL(XMIT_SZ_8BIT), 245 TS_INDEX2VAL(XMIT_SZ_8BIT),
246 .mid_rid = 0xa1, 246 .mid_rid = 0xa1,
247 }, 247 },
248 { 248 {
249 .slave_id = SHDMA_SLAVE_RIIC2_RX, 249 .slave_id = SHDMA_SLAVE_RIIC2_RX,
250 .addr = 0x1e520013, 250 .addr = 0x1e520013,
251 .chcr = DM_INC | 0x800 | 0x40000000 | 251 .chcr = DM_INC | RS_ERS | 0x40000000 |
252 TS_INDEX2VAL(XMIT_SZ_8BIT), 252 TS_INDEX2VAL(XMIT_SZ_8BIT),
253 .mid_rid = 0xa2, 253 .mid_rid = 0xa2,
254 }, 254 },
255 { 255 {
256 .slave_id = SHDMA_SLAVE_RIIC3_TX, 256 .slave_id = SHDMA_SLAVE_RIIC3_TX,
257 .addr = 0x1e530012, 257 .addr = 0x1e530012,
258 .chcr = SM_INC | 0x800 | 0x40000000 | 258 .chcr = SM_INC | RS_ERS | 0x40000000 |
259 TS_INDEX2VAL(XMIT_SZ_8BIT), 259 TS_INDEX2VAL(XMIT_SZ_8BIT),
260 .mid_rid = 0xa9, 260 .mid_rid = 0xa9,
261 }, 261 },
262 { 262 {
263 .slave_id = SHDMA_SLAVE_RIIC3_RX, 263 .slave_id = SHDMA_SLAVE_RIIC3_RX,
264 .addr = 0x1e530013, 264 .addr = 0x1e530013,
265 .chcr = DM_INC | 0x800 | 0x40000000 | 265 .chcr = DM_INC | RS_ERS | 0x40000000 |
266 TS_INDEX2VAL(XMIT_SZ_8BIT), 266 TS_INDEX2VAL(XMIT_SZ_8BIT),
267 .mid_rid = 0xaf, 267 .mid_rid = 0xaf,
268 }, 268 },
269 { 269 {
270 .slave_id = SHDMA_SLAVE_RIIC4_TX, 270 .slave_id = SHDMA_SLAVE_RIIC4_TX,
271 .addr = 0x1e540012, 271 .addr = 0x1e540012,
272 .chcr = SM_INC | 0x800 | 0x40000000 | 272 .chcr = SM_INC | RS_ERS | 0x40000000 |
273 TS_INDEX2VAL(XMIT_SZ_8BIT), 273 TS_INDEX2VAL(XMIT_SZ_8BIT),
274 .mid_rid = 0xc5, 274 .mid_rid = 0xc5,
275 }, 275 },
276 { 276 {
277 .slave_id = SHDMA_SLAVE_RIIC4_RX, 277 .slave_id = SHDMA_SLAVE_RIIC4_RX,
278 .addr = 0x1e540013, 278 .addr = 0x1e540013,
279 .chcr = DM_INC | 0x800 | 0x40000000 | 279 .chcr = DM_INC | RS_ERS | 0x40000000 |
280 TS_INDEX2VAL(XMIT_SZ_8BIT), 280 TS_INDEX2VAL(XMIT_SZ_8BIT),
281 .mid_rid = 0xc6, 281 .mid_rid = 0xc6,
282 }, 282 },
@@ -286,70 +286,70 @@ static const struct sh_dmae_slave_config sh7757_dmae3_slaves[] = {
286 { 286 {
287 .slave_id = SHDMA_SLAVE_RIIC5_TX, 287 .slave_id = SHDMA_SLAVE_RIIC5_TX,
288 .addr = 0x1e550012, 288 .addr = 0x1e550012,
289 .chcr = SM_INC | 0x800 | 0x40000000 | 289 .chcr = SM_INC | RS_ERS | 0x40000000 |
290 TS_INDEX2VAL(XMIT_SZ_8BIT), 290 TS_INDEX2VAL(XMIT_SZ_8BIT),
291 .mid_rid = 0x21, 291 .mid_rid = 0x21,
292 }, 292 },
293 { 293 {
294 .slave_id = SHDMA_SLAVE_RIIC5_RX, 294 .slave_id = SHDMA_SLAVE_RIIC5_RX,
295 .addr = 0x1e550013, 295 .addr = 0x1e550013,
296 .chcr = DM_INC | 0x800 | 0x40000000 | 296 .chcr = DM_INC | RS_ERS | 0x40000000 |
297 TS_INDEX2VAL(XMIT_SZ_8BIT), 297 TS_INDEX2VAL(XMIT_SZ_8BIT),
298 .mid_rid = 0x22, 298 .mid_rid = 0x22,
299 }, 299 },
300 { 300 {
301 .slave_id = SHDMA_SLAVE_RIIC6_TX, 301 .slave_id = SHDMA_SLAVE_RIIC6_TX,
302 .addr = 0x1e560012, 302 .addr = 0x1e560012,
303 .chcr = SM_INC | 0x800 | 0x40000000 | 303 .chcr = SM_INC | RS_ERS | 0x40000000 |
304 TS_INDEX2VAL(XMIT_SZ_8BIT), 304 TS_INDEX2VAL(XMIT_SZ_8BIT),
305 .mid_rid = 0x29, 305 .mid_rid = 0x29,
306 }, 306 },
307 { 307 {
308 .slave_id = SHDMA_SLAVE_RIIC6_RX, 308 .slave_id = SHDMA_SLAVE_RIIC6_RX,
309 .addr = 0x1e560013, 309 .addr = 0x1e560013,
310 .chcr = DM_INC | 0x800 | 0x40000000 | 310 .chcr = DM_INC | RS_ERS | 0x40000000 |
311 TS_INDEX2VAL(XMIT_SZ_8BIT), 311 TS_INDEX2VAL(XMIT_SZ_8BIT),
312 .mid_rid = 0x2a, 312 .mid_rid = 0x2a,
313 }, 313 },
314 { 314 {
315 .slave_id = SHDMA_SLAVE_RIIC7_TX, 315 .slave_id = SHDMA_SLAVE_RIIC7_TX,
316 .addr = 0x1e570012, 316 .addr = 0x1e570012,
317 .chcr = SM_INC | 0x800 | 0x40000000 | 317 .chcr = SM_INC | RS_ERS | 0x40000000 |
318 TS_INDEX2VAL(XMIT_SZ_8BIT), 318 TS_INDEX2VAL(XMIT_SZ_8BIT),
319 .mid_rid = 0x41, 319 .mid_rid = 0x41,
320 }, 320 },
321 { 321 {
322 .slave_id = SHDMA_SLAVE_RIIC7_RX, 322 .slave_id = SHDMA_SLAVE_RIIC7_RX,
323 .addr = 0x1e570013, 323 .addr = 0x1e570013,
324 .chcr = DM_INC | 0x800 | 0x40000000 | 324 .chcr = DM_INC | RS_ERS | 0x40000000 |
325 TS_INDEX2VAL(XMIT_SZ_8BIT), 325 TS_INDEX2VAL(XMIT_SZ_8BIT),
326 .mid_rid = 0x42, 326 .mid_rid = 0x42,
327 }, 327 },
328 { 328 {
329 .slave_id = SHDMA_SLAVE_RIIC8_TX, 329 .slave_id = SHDMA_SLAVE_RIIC8_TX,
330 .addr = 0x1e580012, 330 .addr = 0x1e580012,
331 .chcr = SM_INC | 0x800 | 0x40000000 | 331 .chcr = SM_INC | RS_ERS | 0x40000000 |
332 TS_INDEX2VAL(XMIT_SZ_8BIT), 332 TS_INDEX2VAL(XMIT_SZ_8BIT),
333 .mid_rid = 0x45, 333 .mid_rid = 0x45,
334 }, 334 },
335 { 335 {
336 .slave_id = SHDMA_SLAVE_RIIC8_RX, 336 .slave_id = SHDMA_SLAVE_RIIC8_RX,
337 .addr = 0x1e580013, 337 .addr = 0x1e580013,
338 .chcr = DM_INC | 0x800 | 0x40000000 | 338 .chcr = DM_INC | RS_ERS | 0x40000000 |
339 TS_INDEX2VAL(XMIT_SZ_8BIT), 339 TS_INDEX2VAL(XMIT_SZ_8BIT),
340 .mid_rid = 0x46, 340 .mid_rid = 0x46,
341 }, 341 },
342 { 342 {
343 .slave_id = SHDMA_SLAVE_RIIC9_TX, 343 .slave_id = SHDMA_SLAVE_RIIC9_TX,
344 .addr = 0x1e590012, 344 .addr = 0x1e590012,
345 .chcr = SM_INC | 0x800 | 0x40000000 | 345 .chcr = SM_INC | RS_ERS | 0x40000000 |
346 TS_INDEX2VAL(XMIT_SZ_8BIT), 346 TS_INDEX2VAL(XMIT_SZ_8BIT),
347 .mid_rid = 0x51, 347 .mid_rid = 0x51,
348 }, 348 },
349 { 349 {
350 .slave_id = SHDMA_SLAVE_RIIC9_RX, 350 .slave_id = SHDMA_SLAVE_RIIC9_RX,
351 .addr = 0x1e590013, 351 .addr = 0x1e590013,
352 .chcr = DM_INC | 0x800 | 0x40000000 | 352 .chcr = DM_INC | RS_ERS | 0x40000000 |
353 TS_INDEX2VAL(XMIT_SZ_8BIT), 353 TS_INDEX2VAL(XMIT_SZ_8BIT),
354 .mid_rid = 0x52, 354 .mid_rid = 0x52,
355 }, 355 },
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 594cd371aa28..2f002b24fb92 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -262,17 +262,17 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
262extern void __kernel_sigreturn(void); 262extern void __kernel_sigreturn(void);
263extern void __kernel_rt_sigreturn(void); 263extern void __kernel_rt_sigreturn(void);
264 264
265static int setup_frame(int sig, struct k_sigaction *ka, 265static int setup_frame(struct ksignal *ksig, sigset_t *set,
266 sigset_t *set, struct pt_regs *regs) 266 struct pt_regs *regs)
267{ 267{
268 struct sigframe __user *frame; 268 struct sigframe __user *frame;
269 int err = 0; 269 int err = 0, sig = ksig->sig;
270 int signal; 270 int signal;
271 271
272 frame = get_sigframe(ka, regs->regs[15], sizeof(*frame)); 272 frame = get_sigframe(&ksig->ka, regs->regs[15], sizeof(*frame));
273 273
274 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 274 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
275 goto give_sigsegv; 275 return -EFAULT;
276 276
277 signal = current_thread_info()->exec_domain 277 signal = current_thread_info()->exec_domain
278 && current_thread_info()->exec_domain->signal_invmap 278 && current_thread_info()->exec_domain->signal_invmap
@@ -288,8 +288,8 @@ static int setup_frame(int sig, struct k_sigaction *ka,
288 288
289 /* Set up to return from userspace. If provided, use a stub 289 /* Set up to return from userspace. If provided, use a stub
290 already in userspace. */ 290 already in userspace. */
291 if (ka->sa.sa_flags & SA_RESTORER) { 291 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
292 regs->pr = (unsigned long) ka->sa.sa_restorer; 292 regs->pr = (unsigned long) ksig->ka.sa.sa_restorer;
293#ifdef CONFIG_VSYSCALL 293#ifdef CONFIG_VSYSCALL
294 } else if (likely(current->mm->context.vdso)) { 294 } else if (likely(current->mm->context.vdso)) {
295 regs->pr = VDSO_SYM(&__kernel_sigreturn); 295 regs->pr = VDSO_SYM(&__kernel_sigreturn);
@@ -309,7 +309,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
309 } 309 }
310 310
311 if (err) 311 if (err)
312 goto give_sigsegv; 312 return -EFAULT;
313 313
314 /* Set up registers for signal handler */ 314 /* Set up registers for signal handler */
315 regs->regs[15] = (unsigned long) frame; 315 regs->regs[15] = (unsigned long) frame;
@@ -319,15 +319,15 @@ static int setup_frame(int sig, struct k_sigaction *ka,
319 319
320 if (current->personality & FDPIC_FUNCPTRS) { 320 if (current->personality & FDPIC_FUNCPTRS) {
321 struct fdpic_func_descriptor __user *funcptr = 321 struct fdpic_func_descriptor __user *funcptr =
322 (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; 322 (struct fdpic_func_descriptor __user *)ksig->ka.sa.sa_handler;
323 323
324 err |= __get_user(regs->pc, &funcptr->text); 324 err |= __get_user(regs->pc, &funcptr->text);
325 err |= __get_user(regs->regs[12], &funcptr->GOT); 325 err |= __get_user(regs->regs[12], &funcptr->GOT);
326 } else 326 } else
327 regs->pc = (unsigned long)ka->sa.sa_handler; 327 regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
328 328
329 if (err) 329 if (err)
330 goto give_sigsegv; 330 return -EFAULT;
331 331
332 set_fs(USER_DS); 332 set_fs(USER_DS);
333 333
@@ -335,23 +335,19 @@ static int setup_frame(int sig, struct k_sigaction *ka,
335 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); 335 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
336 336
337 return 0; 337 return 0;
338
339give_sigsegv:
340 force_sigsegv(sig, current);
341 return -EFAULT;
342} 338}
343 339
344static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 340static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
345 sigset_t *set, struct pt_regs *regs) 341 struct pt_regs *regs)
346{ 342{
347 struct rt_sigframe __user *frame; 343 struct rt_sigframe __user *frame;
348 int err = 0; 344 int err = 0, sig = ksig->sig;
349 int signal; 345 int signal;
350 346
351 frame = get_sigframe(ka, regs->regs[15], sizeof(*frame)); 347 frame = get_sigframe(&ksig->ka, regs->regs[15], sizeof(*frame));
352 348
353 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 349 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
354 goto give_sigsegv; 350 return -EFAULT;
355 351
356 signal = current_thread_info()->exec_domain 352 signal = current_thread_info()->exec_domain
357 && current_thread_info()->exec_domain->signal_invmap 353 && current_thread_info()->exec_domain->signal_invmap
@@ -359,7 +355,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
359 ? current_thread_info()->exec_domain->signal_invmap[sig] 355 ? current_thread_info()->exec_domain->signal_invmap[sig]
360 : sig; 356 : sig;
361 357
362 err |= copy_siginfo_to_user(&frame->info, info); 358 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
363 359
364 /* Create the ucontext. */ 360 /* Create the ucontext. */
365 err |= __put_user(0, &frame->uc.uc_flags); 361 err |= __put_user(0, &frame->uc.uc_flags);
@@ -371,8 +367,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
371 367
372 /* Set up to return from userspace. If provided, use a stub 368 /* Set up to return from userspace. If provided, use a stub
373 already in userspace. */ 369 already in userspace. */
374 if (ka->sa.sa_flags & SA_RESTORER) { 370 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
375 regs->pr = (unsigned long) ka->sa.sa_restorer; 371 regs->pr = (unsigned long) ksig->ka.sa.sa_restorer;
376#ifdef CONFIG_VSYSCALL 372#ifdef CONFIG_VSYSCALL
377 } else if (likely(current->mm->context.vdso)) { 373 } else if (likely(current->mm->context.vdso)) {
378 regs->pr = VDSO_SYM(&__kernel_rt_sigreturn); 374 regs->pr = VDSO_SYM(&__kernel_rt_sigreturn);
@@ -392,7 +388,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
392 } 388 }
393 389
394 if (err) 390 if (err)
395 goto give_sigsegv; 391 return -EFAULT;
396 392
397 /* Set up registers for signal handler */ 393 /* Set up registers for signal handler */
398 regs->regs[15] = (unsigned long) frame; 394 regs->regs[15] = (unsigned long) frame;
@@ -402,15 +398,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
402 398
403 if (current->personality & FDPIC_FUNCPTRS) { 399 if (current->personality & FDPIC_FUNCPTRS) {
404 struct fdpic_func_descriptor __user *funcptr = 400 struct fdpic_func_descriptor __user *funcptr =
405 (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; 401 (struct fdpic_func_descriptor __user *)ksig->ka.sa.sa_handler;
406 402
407 err |= __get_user(regs->pc, &funcptr->text); 403 err |= __get_user(regs->pc, &funcptr->text);
408 err |= __get_user(regs->regs[12], &funcptr->GOT); 404 err |= __get_user(regs->regs[12], &funcptr->GOT);
409 } else 405 } else
410 regs->pc = (unsigned long)ka->sa.sa_handler; 406 regs->pc = (unsigned long)ksig->ka.sa.sa_handler;
411 407
412 if (err) 408 if (err)
413 goto give_sigsegv; 409 return -EFAULT;
414 410
415 set_fs(USER_DS); 411 set_fs(USER_DS);
416 412
@@ -418,10 +414,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
418 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); 414 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
419 415
420 return 0; 416 return 0;
421
422give_sigsegv:
423 force_sigsegv(sig, current);
424 return -EFAULT;
425} 417}
426 418
427static inline void 419static inline void
@@ -455,22 +447,18 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
455 * OK, we're invoking a handler 447 * OK, we're invoking a handler
456 */ 448 */
457static void 449static void
458handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 450handle_signal(struct ksignal *ksig, struct pt_regs *regs, unsigned int save_r0)
459 struct pt_regs *regs, unsigned int save_r0)
460{ 451{
461 sigset_t *oldset = sigmask_to_save(); 452 sigset_t *oldset = sigmask_to_save();
462 int ret; 453 int ret;
463 454
464 /* Set up the stack frame */ 455 /* Set up the stack frame */
465 if (ka->sa.sa_flags & SA_SIGINFO) 456 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
466 ret = setup_rt_frame(sig, ka, info, oldset, regs); 457 ret = setup_rt_frame(ksig, oldset, regs);
467 else 458 else
468 ret = setup_frame(sig, ka, oldset, regs); 459 ret = setup_frame(ksig, oldset, regs);
469 460
470 if (ret) 461 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
471 return;
472 signal_delivered(sig, info, ka, regs,
473 test_thread_flag(TIF_SINGLESTEP));
474} 462}
475 463
476/* 464/*
@@ -484,9 +472,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
484 */ 472 */
485static void do_signal(struct pt_regs *regs, unsigned int save_r0) 473static void do_signal(struct pt_regs *regs, unsigned int save_r0)
486{ 474{
487 siginfo_t info; 475 struct ksignal ksig;
488 int signr;
489 struct k_sigaction ka;
490 476
491 /* 477 /*
492 * We want the common case to go fast, which 478 * We want the common case to go fast, which
@@ -497,12 +483,11 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
497 if (!user_mode(regs)) 483 if (!user_mode(regs))
498 return; 484 return;
499 485
500 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 486 if (get_signal(&ksig)) {
501 if (signr > 0) { 487 handle_syscall_restart(save_r0, regs, &ksig.ka.sa);
502 handle_syscall_restart(save_r0, regs, &ka.sa);
503 488
504 /* Whee! Actually deliver the signal. */ 489 /* Whee! Actually deliver the signal. */
505 handle_signal(signr, &ka, &info, regs, save_r0); 490 handle_signal(&ksig, regs, save_r0);
506 return; 491 return;
507 } 492 }
508 493
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 23d4c71c91af..897abe7b871e 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -41,8 +41,7 @@
41#define DEBUG_SIG 0 41#define DEBUG_SIG 0
42 42
43static void 43static void
44handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 44handle_signal(struct ksignal *ksig, struct pt_regs *regs);
45 struct pt_regs * regs);
46 45
47static inline void 46static inline void
48handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) 47handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
@@ -82,9 +81,7 @@ handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
82 */ 81 */
83static void do_signal(struct pt_regs *regs) 82static void do_signal(struct pt_regs *regs)
84{ 83{
85 siginfo_t info; 84 struct ksignal ksig;
86 int signr;
87 struct k_sigaction ka;
88 85
89 /* 86 /*
90 * We want the common case to go fast, which 87 * We want the common case to go fast, which
@@ -95,12 +92,11 @@ static void do_signal(struct pt_regs *regs)
95 if (!user_mode(regs)) 92 if (!user_mode(regs))
96 return; 93 return;
97 94
98 signr = get_signal_to_deliver(&info, &ka, regs, 0); 95 if (get_signal(&ksig)) {
99 if (signr > 0) { 96 handle_syscall_restart(regs, &ksig.ka.sa);
100 handle_syscall_restart(regs, &ka.sa);
101 97
102 /* Whee! Actually deliver the signal. */ 98 /* Whee! Actually deliver the signal. */
103 handle_signal(signr, &info, &ka, regs); 99 handle_signal(&ksig, regs);
104 return; 100 return;
105 } 101 }
106 102
@@ -378,17 +374,16 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
378void sa_default_restorer(void); /* See comments below */ 374void sa_default_restorer(void); /* See comments below */
379void sa_default_rt_restorer(void); /* See comments below */ 375void sa_default_rt_restorer(void); /* See comments below */
380 376
381static int setup_frame(int sig, struct k_sigaction *ka, 377static int setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
382 sigset_t *set, struct pt_regs *regs)
383{ 378{
384 struct sigframe __user *frame; 379 struct sigframe __user *frame;
385 int err = 0; 380 int err = 0, sig = ksig->sig;
386 int signal; 381 int signal;
387 382
388 frame = get_sigframe(ka, regs->regs[REG_SP], sizeof(*frame)); 383 frame = get_sigframe(&ksig->ka, regs->regs[REG_SP], sizeof(*frame));
389 384
390 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 385 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
391 goto give_sigsegv; 386 return -EFAULT;
392 387
393 signal = current_thread_info()->exec_domain 388 signal = current_thread_info()->exec_domain
394 && current_thread_info()->exec_domain->signal_invmap 389 && current_thread_info()->exec_domain->signal_invmap
@@ -400,7 +395,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
400 395
401 /* Give up earlier as i386, in case */ 396 /* Give up earlier as i386, in case */
402 if (err) 397 if (err)
403 goto give_sigsegv; 398 return -EFAULT;
404 399
405 if (_NSIG_WORDS > 1) { 400 if (_NSIG_WORDS > 1) {
406 err |= __copy_to_user(frame->extramask, &set->sig[1], 401 err |= __copy_to_user(frame->extramask, &set->sig[1],
@@ -408,16 +403,16 @@ static int setup_frame(int sig, struct k_sigaction *ka,
408 403
409 /* Give up earlier as i386, in case */ 404 /* Give up earlier as i386, in case */
410 if (err) 405 if (err)
411 goto give_sigsegv; 406 return -EFAULT;
412 407
413 /* Set up to return from userspace. If provided, use a stub 408 /* Set up to return from userspace. If provided, use a stub
414 already in userspace. */ 409 already in userspace. */
415 if (ka->sa.sa_flags & SA_RESTORER) { 410 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
416 /* 411 /*
417 * On SH5 all edited pointers are subject to NEFF 412 * On SH5 all edited pointers are subject to NEFF
418 */ 413 */
419 DEREF_REG_PR = neff_sign_extend((unsigned long) 414 DEREF_REG_PR = neff_sign_extend((unsigned long)
420 ka->sa.sa_restorer | 0x1); 415 ksig->ka->sa.sa_restorer | 0x1);
421 } else { 416 } else {
422 /* 417 /*
423 * Different approach on SH5. 418 * Different approach on SH5.
@@ -435,7 +430,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
435 430
436 if (__copy_to_user(frame->retcode, 431 if (__copy_to_user(frame->retcode,
437 (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0) 432 (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0)
438 goto give_sigsegv; 433 return -EFAULT;
439 434
440 /* Cohere the trampoline with the I-cache. */ 435 /* Cohere the trampoline with the I-cache. */
441 flush_cache_sigtramp(DEREF_REG_PR-1); 436 flush_cache_sigtramp(DEREF_REG_PR-1);
@@ -460,7 +455,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
460 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc; 455 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc;
461 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc; 456 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc;
462 457
463 regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler); 458 regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler);
464 459
465 set_fs(USER_DS); 460 set_fs(USER_DS);
466 461
@@ -471,23 +466,19 @@ static int setup_frame(int sig, struct k_sigaction *ka,
471 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); 466 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
472 467
473 return 0; 468 return 0;
474
475give_sigsegv:
476 force_sigsegv(sig, current);
477 return -EFAULT;
478} 469}
479 470
480static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 471static int setup_rt_frame(struct ksignal *kig, sigset_t *set,
481 sigset_t *set, struct pt_regs *regs) 472 struct pt_regs *regs)
482{ 473{
483 struct rt_sigframe __user *frame; 474 struct rt_sigframe __user *frame;
484 int err = 0; 475 int err = 0, sig = ksig->sig;
485 int signal; 476 int signal;
486 477
487 frame = get_sigframe(ka, regs->regs[REG_SP], sizeof(*frame)); 478 frame = get_sigframe(&ksig->ka, regs->regs[REG_SP], sizeof(*frame));
488 479
489 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 480 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
490 goto give_sigsegv; 481 return -EFAULT;
491 482
492 signal = current_thread_info()->exec_domain 483 signal = current_thread_info()->exec_domain
493 && current_thread_info()->exec_domain->signal_invmap 484 && current_thread_info()->exec_domain->signal_invmap
@@ -497,11 +488,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
497 488
498 err |= __put_user(&frame->info, &frame->pinfo); 489 err |= __put_user(&frame->info, &frame->pinfo);
499 err |= __put_user(&frame->uc, &frame->puc); 490 err |= __put_user(&frame->uc, &frame->puc);
500 err |= copy_siginfo_to_user(&frame->info, info); 491 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
501 492
502 /* Give up earlier as i386, in case */ 493 /* Give up earlier as i386, in case */
503 if (err) 494 if (err)
504 goto give_sigsegv; 495 return -EFAULT;
505 496
506 /* Create the ucontext. */ 497 /* Create the ucontext. */
507 err |= __put_user(0, &frame->uc.uc_flags); 498 err |= __put_user(0, &frame->uc.uc_flags);
@@ -513,16 +504,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
513 504
514 /* Give up earlier as i386, in case */ 505 /* Give up earlier as i386, in case */
515 if (err) 506 if (err)
516 goto give_sigsegv; 507 return -EFAULT;
517 508
518 /* Set up to return from userspace. If provided, use a stub 509 /* Set up to return from userspace. If provided, use a stub
519 already in userspace. */ 510 already in userspace. */
520 if (ka->sa.sa_flags & SA_RESTORER) { 511 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
521 /* 512 /*
522 * On SH5 all edited pointers are subject to NEFF 513 * On SH5 all edited pointers are subject to NEFF
523 */ 514 */
524 DEREF_REG_PR = neff_sign_extend((unsigned long) 515 DEREF_REG_PR = neff_sign_extend((unsigned long)
525 ka->sa.sa_restorer | 0x1); 516 ksig->ka.sa.sa_restorer | 0x1);
526 } else { 517 } else {
527 /* 518 /*
528 * Different approach on SH5. 519 * Different approach on SH5.
@@ -540,7 +531,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
540 531
541 if (__copy_to_user(frame->retcode, 532 if (__copy_to_user(frame->retcode,
542 (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0) 533 (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0)
543 goto give_sigsegv; 534 return -EFAULT;
544 535
545 /* Cohere the trampoline with the I-cache. */ 536 /* Cohere the trampoline with the I-cache. */
546 flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15); 537 flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15);
@@ -554,7 +545,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
554 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */ 545 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */
555 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info; 546 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info;
556 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext; 547 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext;
557 regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler); 548 regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler);
558 549
559 set_fs(USER_DS); 550 set_fs(USER_DS);
560 551
@@ -564,33 +555,24 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
564 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff); 555 DEREF_REG_PR >> 32, DEREF_REG_PR & 0xffffffff);
565 556
566 return 0; 557 return 0;
567
568give_sigsegv:
569 force_sigsegv(sig, current);
570 return -EFAULT;
571} 558}
572 559
573/* 560/*
574 * OK, we're invoking a handler 561 * OK, we're invoking a handler
575 */ 562 */
576static void 563static void
577handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 564handle_signal(struct ksignal *ksig, struct pt_regs *regs)
578 struct pt_regs * regs)
579{ 565{
580 sigset_t *oldset = sigmask_to_save(); 566 sigset_t *oldset = sigmask_to_save();
581 int ret; 567 int ret;
582 568
583 /* Set up the stack frame */ 569 /* Set up the stack frame */
584 if (ka->sa.sa_flags & SA_SIGINFO) 570 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
585 ret = setup_rt_frame(sig, ka, info, oldset, regs); 571 ret = setup_rt_frame(ksig, oldset, regs);
586 else 572 else
587 ret = setup_frame(sig, ka, oldset, regs); 573 ret = setup_frame(ksig, oldset, regs);
588
589 if (ret)
590 return;
591 574
592 signal_delivered(sig, info, ka, regs, 575 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
593 test_thread_flag(TIF_SINGLESTEP));
594} 576}
595 577
596asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 578asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 552c8fcf9416..d6d0a986c6e9 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -80,10 +80,8 @@ static int __init rtc_generic_init(void)
80 return -ENODEV; 80 return -ENODEV;
81 81
82 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 82 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
83 if (IS_ERR(pdev))
84 return PTR_ERR(pdev);
85 83
86 return 0; 84 return PTR_ERR_OR_ZERO(pdev);
87} 85}
88module_init(rtc_generic_init); 86module_init(rtc_generic_init);
89 87
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index 5ca579720a09..ea2aa1393b87 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -92,18 +92,3 @@ const char *arch_vma_name(struct vm_area_struct *vma)
92 92
93 return NULL; 93 return NULL;
94} 94}
95
96struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
97{
98 return NULL;
99}
100
101int in_gate_area(struct mm_struct *mm, unsigned long address)
102{
103 return 0;
104}
105
106int in_gate_area_no_mm(unsigned long address)
107{
108 return 0;
109}
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c
index 74c03ecc4871..ecfc6b0c1da1 100644
--- a/arch/sh/mm/asids-debugfs.c
+++ b/arch/sh/mm/asids-debugfs.c
@@ -67,10 +67,8 @@ static int __init asids_debugfs_init(void)
67 NULL, &asids_debugfs_fops); 67 NULL, &asids_debugfs_fops);
68 if (!asids_dentry) 68 if (!asids_dentry)
69 return -ENOMEM; 69 return -ENOMEM;
70 if (IS_ERR(asids_dentry))
71 return PTR_ERR(asids_dentry);
72 70
73 return 0; 71 return PTR_ERR_OR_ZERO(asids_dentry);
74} 72}
75module_init(asids_debugfs_init); 73module_init(asids_debugfs_init);
76 74
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 2d089fe2cba9..2790b6a64157 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -495,8 +495,9 @@ int arch_add_memory(int nid, u64 start, u64 size)
495 pgdat = NODE_DATA(nid); 495 pgdat = NODE_DATA(nid);
496 496
497 /* We only have ZONE_NORMAL, so this is easy.. */ 497 /* We only have ZONE_NORMAL, so this is easy.. */
498 ret = __add_pages(nid, pgdat->node_zones + ZONE_NORMAL, 498 ret = __add_pages(nid, pgdat->node_zones +
499 start_pfn, nr_pages); 499 zone_for_memory(nid, start, size, ZONE_NORMAL),
500 start_pfn, nr_pages);
500 if (unlikely(ret)) 501 if (unlikely(ret))
501 printk("%s: Failed, __add_pages() == %d\n", __func__, ret); 502 printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
502 503
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 4692c90936f1..a537816613f9 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -42,6 +42,7 @@ config SPARC
42 select MODULES_USE_ELF_RELA 42 select MODULES_USE_ELF_RELA
43 select ODD_RT_SIGACTION 43 select ODD_RT_SIGACTION
44 select OLD_SIGSUSPEND 44 select OLD_SIGSUSPEND
45 select ARCH_HAS_SG_CHAIN
45 46
46config SPARC32 47config SPARC32
47 def_bool !64BIT 48 def_bool !64BIT
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 9ff423678cbc..eaee14637d93 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -68,6 +68,9 @@ all: zImage
68image zImage uImage tftpboot.img vmlinux.aout: vmlinux 68image zImage uImage tftpboot.img vmlinux.aout: vmlinux
69 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 69 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
70 70
71install:
72 $(Q)$(MAKE) $(build)=$(boot) $@
73
71archclean: 74archclean:
72 $(Q)$(MAKE) $(clean)=$(boot) 75 $(Q)$(MAKE) $(clean)=$(boot)
73 76
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index 6e63afb128d9..6a4ceae5ec67 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -69,3 +69,7 @@ $(obj)/image: vmlinux FORCE
69$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE 69$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
70 $(call if_changed,elftoaout) 70 $(call if_changed,elftoaout)
71 $(call if_changed,piggy) 71 $(call if_changed,piggy)
72
73install:
74 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/zImage \
75 System.map "$(INSTALL_PATH)"
diff --git a/arch/sparc/boot/install.sh b/arch/sparc/boot/install.sh
new file mode 100644
index 000000000000..b32851eae693
--- /dev/null
+++ b/arch/sparc/boot/install.sh
@@ -0,0 +1,50 @@
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 SPARC 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
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index a45821818003..cdd1b447bb6c 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -15,6 +15,7 @@ generic-y += mcs_spinlock.h
15generic-y += module.h 15generic-y += module.h
16generic-y += mutex.h 16generic-y += mutex.h
17generic-y += preempt.h 17generic-y += preempt.h
18generic-y += scatterlist.h
18generic-y += serial.h 19generic-y += serial.h
19generic-y += trace_clock.h 20generic-y += trace_clock.h
20generic-y += types.h 21generic-y += types.h
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 05381c3a4228..80b54b326d49 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -9,125 +9,99 @@
9#include <asm/asi.h> 9#include <asm/asi.h>
10#include <asm-generic/pci_iomap.h> 10#include <asm-generic/pci_iomap.h>
11 11
12/* PC crapola... */
13#define __SLOW_DOWN_IO do { } while (0)
14#define SLOW_DOWN_IO do { } while (0)
15
16/* BIO layer definitions. */ 12/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 13extern unsigned long kern_base, kern_size;
18 14
19static inline u8 _inb(unsigned long addr) 15/* __raw_{read,write}{b,w,l,q} uses direct access.
16 * Access the memory as big endian bypassing the cache
17 * by using ASI_PHYS_BYPASS_EC_E
18 */
19#define __raw_readb __raw_readb
20static inline u8 __raw_readb(const volatile void __iomem *addr)
20{ 21{
21 u8 ret; 22 u8 ret;
22 23
23 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_inb */" 24 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_raw_readb */"
24 : "=r" (ret) 25 : "=r" (ret)
25 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L) 26 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
26 : "memory");
27 27
28 return ret; 28 return ret;
29} 29}
30 30
31static inline u16 _inw(unsigned long addr) 31#define __raw_readw __raw_readw
32static inline u16 __raw_readw(const volatile void __iomem *addr)
32{ 33{
33 u16 ret; 34 u16 ret;
34 35
35 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_inw */" 36 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_raw_readw */"
36 : "=r" (ret) 37 : "=r" (ret)
37 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L) 38 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
38 : "memory");
39 39
40 return ret; 40 return ret;
41} 41}
42 42
43static inline u32 _inl(unsigned long addr) 43#define __raw_readl __raw_readl
44static inline u32 __raw_readl(const volatile void __iomem *addr)
44{ 45{
45 u32 ret; 46 u32 ret;
46 47
47 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_inl */" 48 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_raw_readl */"
48 : "=r" (ret) 49 : "=r" (ret)
49 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L) 50 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
50 : "memory");
51 51
52 return ret; 52 return ret;
53} 53}
54 54
55static inline void _outb(u8 b, unsigned long addr) 55#define __raw_readq __raw_readq
56{ 56static inline u64 __raw_readq(const volatile void __iomem *addr)
57 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_outb */"
58 : /* no outputs */
59 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
60 : "memory");
61}
62
63static inline void _outw(u16 w, unsigned long addr)
64{ 57{
65 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_outw */" 58 u64 ret;
66 : /* no outputs */
67 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
68 : "memory");
69}
70
71static inline void _outl(u32 l, unsigned long addr)
72{
73 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_outl */"
74 : /* no outputs */
75 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L)
76 : "memory");
77}
78
79#define inb(__addr) (_inb((unsigned long)(__addr)))
80#define inw(__addr) (_inw((unsigned long)(__addr)))
81#define inl(__addr) (_inl((unsigned long)(__addr)))
82#define outb(__b, __addr) (_outb((u8)(__b), (unsigned long)(__addr)))
83#define outw(__w, __addr) (_outw((u16)(__w), (unsigned long)(__addr)))
84#define outl(__l, __addr) (_outl((u32)(__l), (unsigned long)(__addr)))
85
86#define inb_p(__addr) inb(__addr)
87#define outb_p(__b, __addr) outb(__b, __addr)
88#define inw_p(__addr) inw(__addr)
89#define outw_p(__w, __addr) outw(__w, __addr)
90#define inl_p(__addr) inl(__addr)
91#define outl_p(__l, __addr) outl(__l, __addr)
92 59
93void outsb(unsigned long, const void *, unsigned long); 60 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_raw_readq */"
94void outsw(unsigned long, const void *, unsigned long); 61 : "=r" (ret)
95void outsl(unsigned long, const void *, unsigned long); 62 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
96void insb(unsigned long, void *, unsigned long);
97void insw(unsigned long, void *, unsigned long);
98void insl(unsigned long, void *, unsigned long);
99 63
100static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) 64 return ret;
101{
102 insb((unsigned long __force)port, buf, count);
103}
104static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
105{
106 insw((unsigned long __force)port, buf, count);
107} 65}
108 66
109static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count) 67#define __raw_writeb __raw_writeb
68static inline void __raw_writeb(u8 b, const volatile void __iomem *addr)
110{ 69{
111 insl((unsigned long __force)port, buf, count); 70 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_raw_writeb */"
71 : /* no outputs */
72 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
112} 73}
113 74
114static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count) 75#define __raw_writew __raw_writew
76static inline void __raw_writew(u16 w, const volatile void __iomem *addr)
115{ 77{
116 outsb((unsigned long __force)port, buf, count); 78 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_raw_writew */"
79 : /* no outputs */
80 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
117} 81}
118 82
119static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count) 83#define __raw_writel __raw_writel
84static inline void __raw_writel(u32 l, const volatile void __iomem *addr)
120{ 85{
121 outsw((unsigned long __force)port, buf, count); 86 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_raw_writel */"
87 : /* no outputs */
88 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
122} 89}
123 90
124static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count) 91#define __raw_writeq __raw_writeq
92static inline void __raw_writeq(u64 q, const volatile void __iomem *addr)
125{ 93{
126 outsl((unsigned long __force)port, buf, count); 94 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_raw_writeq */"
95 : /* no outputs */
96 : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
127} 97}
128 98
129/* Memory functions, same as I/O accesses on Ultra. */ 99/* Memory functions, same as I/O accesses on Ultra.
130static inline u8 _readb(const volatile void __iomem *addr) 100 * Access memory as little endian bypassing
101 * the cache by using ASI_PHYS_BYPASS_EC_E_L
102 */
103#define readb readb
104static inline u8 readb(const volatile void __iomem *addr)
131{ u8 ret; 105{ u8 ret;
132 106
133 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */" 107 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_readb */"
@@ -137,7 +111,8 @@ static inline u8 _readb(const volatile void __iomem *addr)
137 return ret; 111 return ret;
138} 112}
139 113
140static inline u16 _readw(const volatile void __iomem *addr) 114#define readw readw
115static inline u16 readw(const volatile void __iomem *addr)
141{ u16 ret; 116{ u16 ret;
142 117
143 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */" 118 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_readw */"
@@ -148,7 +123,8 @@ static inline u16 _readw(const volatile void __iomem *addr)
148 return ret; 123 return ret;
149} 124}
150 125
151static inline u32 _readl(const volatile void __iomem *addr) 126#define readl readl
127static inline u32 readl(const volatile void __iomem *addr)
152{ u32 ret; 128{ u32 ret;
153 129
154 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */" 130 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_readl */"
@@ -159,7 +135,8 @@ static inline u32 _readl(const volatile void __iomem *addr)
159 return ret; 135 return ret;
160} 136}
161 137
162static inline u64 _readq(const volatile void __iomem *addr) 138#define readq readq
139static inline u64 readq(const volatile void __iomem *addr)
163{ u64 ret; 140{ u64 ret;
164 141
165 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */" 142 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_readq */"
@@ -170,7 +147,8 @@ static inline u64 _readq(const volatile void __iomem *addr)
170 return ret; 147 return ret;
171} 148}
172 149
173static inline void _writeb(u8 b, volatile void __iomem *addr) 150#define writeb writeb
151static inline void writeb(u8 b, volatile void __iomem *addr)
174{ 152{
175 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" 153 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */"
176 : /* no outputs */ 154 : /* no outputs */
@@ -178,7 +156,8 @@ static inline void _writeb(u8 b, volatile void __iomem *addr)
178 : "memory"); 156 : "memory");
179} 157}
180 158
181static inline void _writew(u16 w, volatile void __iomem *addr) 159#define writew writew
160static inline void writew(u16 w, volatile void __iomem *addr)
182{ 161{
183 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" 162 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */"
184 : /* no outputs */ 163 : /* no outputs */
@@ -186,7 +165,8 @@ static inline void _writew(u16 w, volatile void __iomem *addr)
186 : "memory"); 165 : "memory");
187} 166}
188 167
189static inline void _writel(u32 l, volatile void __iomem *addr) 168#define writel writel
169static inline void writel(u32 l, volatile void __iomem *addr)
190{ 170{
191 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" 171 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */"
192 : /* no outputs */ 172 : /* no outputs */
@@ -194,7 +174,8 @@ static inline void _writel(u32 l, volatile void __iomem *addr)
194 : "memory"); 174 : "memory");
195} 175}
196 176
197static inline void _writeq(u64 q, volatile void __iomem *addr) 177#define writeq writeq
178static inline void writeq(u64 q, volatile void __iomem *addr)
198{ 179{
199 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" 180 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */"
200 : /* no outputs */ 181 : /* no outputs */
@@ -202,100 +183,91 @@ static inline void _writeq(u64 q, volatile void __iomem *addr)
202 : "memory"); 183 : "memory");
203} 184}
204 185
205#define readb(__addr) _readb(__addr)
206#define readw(__addr) _readw(__addr)
207#define readl(__addr) _readl(__addr)
208#define readq(__addr) _readq(__addr)
209#define readb_relaxed(__addr) _readb(__addr)
210#define readw_relaxed(__addr) _readw(__addr)
211#define readl_relaxed(__addr) _readl(__addr)
212#define readq_relaxed(__addr) _readq(__addr)
213#define writeb(__b, __addr) _writeb(__b, __addr)
214#define writew(__w, __addr) _writew(__w, __addr)
215#define writel(__l, __addr) _writel(__l, __addr)
216#define writeq(__q, __addr) _writeq(__q, __addr)
217 186
218/* Now versions without byte-swapping. */ 187#define inb inb
219static inline u8 _raw_readb(unsigned long addr) 188static inline u8 inb(unsigned long addr)
220{ 189{
221 u8 ret; 190 return readb((volatile void __iomem *)addr);
222
223 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* pci_raw_readb */"
224 : "=r" (ret)
225 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
226
227 return ret;
228} 191}
229 192
230static inline u16 _raw_readw(unsigned long addr) 193#define inw inw
194static inline u16 inw(unsigned long addr)
231{ 195{
232 u16 ret; 196 return readw((volatile void __iomem *)addr);
233
234 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* pci_raw_readw */"
235 : "=r" (ret)
236 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
237
238 return ret;
239} 197}
240 198
241static inline u32 _raw_readl(unsigned long addr) 199#define inl inl
200static inline u32 inl(unsigned long addr)
242{ 201{
243 u32 ret; 202 return readl((volatile void __iomem *)addr);
203}
244 204
245 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* pci_raw_readl */" 205#define outb outb
246 : "=r" (ret) 206static inline void outb(u8 b, unsigned long addr)
247 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); 207{
208 writeb(b, (volatile void __iomem *)addr);
209}
248 210
249 return ret; 211#define outw outw
212static inline void outw(u16 w, unsigned long addr)
213{
214 writew(w, (volatile void __iomem *)addr);
250} 215}
251 216
252static inline u64 _raw_readq(unsigned long addr) 217#define outl outl
218static inline void outl(u32 l, unsigned long addr)
253{ 219{
254 u64 ret; 220 writel(l, (volatile void __iomem *)addr);
221}
255 222
256 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* pci_raw_readq */"
257 : "=r" (ret)
258 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
259 223
260 return ret; 224#define inb_p(__addr) inb(__addr)
225#define outb_p(__b, __addr) outb(__b, __addr)
226#define inw_p(__addr) inw(__addr)
227#define outw_p(__w, __addr) outw(__w, __addr)
228#define inl_p(__addr) inl(__addr)
229#define outl_p(__l, __addr) outl(__l, __addr)
230
231void outsb(unsigned long, const void *, unsigned long);
232void outsw(unsigned long, const void *, unsigned long);
233void outsl(unsigned long, const void *, unsigned long);
234void insb(unsigned long, void *, unsigned long);
235void insw(unsigned long, void *, unsigned long);
236void insl(unsigned long, void *, unsigned long);
237
238static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
239{
240 insb((unsigned long __force)port, buf, count);
241}
242static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
243{
244 insw((unsigned long __force)port, buf, count);
261} 245}
262 246
263static inline void _raw_writeb(u8 b, unsigned long addr) 247static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count)
264{ 248{
265 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_raw_writeb */" 249 insl((unsigned long __force)port, buf, count);
266 : /* no outputs */
267 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
268} 250}
269 251
270static inline void _raw_writew(u16 w, unsigned long addr) 252static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count)
271{ 253{
272 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_raw_writew */" 254 outsb((unsigned long __force)port, buf, count);
273 : /* no outputs */
274 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
275} 255}
276 256
277static inline void _raw_writel(u32 l, unsigned long addr) 257static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count)
278{ 258{
279 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_raw_writel */" 259 outsw((unsigned long __force)port, buf, count);
280 : /* no outputs */
281 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
282} 260}
283 261
284static inline void _raw_writeq(u64 q, unsigned long addr) 262static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count)
285{ 263{
286 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_raw_writeq */" 264 outsl((unsigned long __force)port, buf, count);
287 : /* no outputs */
288 : "Jr" (q), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
289} 265}
290 266
291#define __raw_readb(__addr) (_raw_readb((unsigned long)(__addr))) 267#define readb_relaxed(__addr) readb(__addr)
292#define __raw_readw(__addr) (_raw_readw((unsigned long)(__addr))) 268#define readw_relaxed(__addr) readw(__addr)
293#define __raw_readl(__addr) (_raw_readl((unsigned long)(__addr))) 269#define readl_relaxed(__addr) readl(__addr)
294#define __raw_readq(__addr) (_raw_readq((unsigned long)(__addr))) 270#define readq_relaxed(__addr) readq(__addr)
295#define __raw_writeb(__b, __addr) (_raw_writeb((u8)(__b), (unsigned long)(__addr)))
296#define __raw_writew(__w, __addr) (_raw_writew((u16)(__w), (unsigned long)(__addr)))
297#define __raw_writel(__l, __addr) (_raw_writel((u32)(__l), (unsigned long)(__addr)))
298#define __raw_writeq(__q, __addr) (_raw_writeq((u64)(__q), (unsigned long)(__addr)))
299 271
300/* Valid I/O Space regions are anywhere, because each PCI bus supported 272/* Valid I/O Space regions are anywhere, because each PCI bus supported
301 * can live in an arbitrary area of the physical address range. 273 * can live in an arbitrary area of the physical address range.
@@ -305,96 +277,47 @@ static inline void _raw_writeq(u64 q, unsigned long addr)
305/* Now, SBUS variants, only difference from PCI is that we do 277/* Now, SBUS variants, only difference from PCI is that we do
306 * not use little-endian ASIs. 278 * not use little-endian ASIs.
307 */ 279 */
308static inline u8 _sbus_readb(const volatile void __iomem *addr) 280static inline u8 sbus_readb(const volatile void __iomem *addr)
309{ 281{
310 u8 ret; 282 return __raw_readb(addr);
311
312 __asm__ __volatile__("lduba\t[%1] %2, %0\t/* sbus_readb */"
313 : "=r" (ret)
314 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
315 : "memory");
316
317 return ret;
318} 283}
319 284
320static inline u16 _sbus_readw(const volatile void __iomem *addr) 285static inline u16 sbus_readw(const volatile void __iomem *addr)
321{ 286{
322 u16 ret; 287 return __raw_readw(addr);
323
324 __asm__ __volatile__("lduha\t[%1] %2, %0\t/* sbus_readw */"
325 : "=r" (ret)
326 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
327 : "memory");
328
329 return ret;
330} 288}
331 289
332static inline u32 _sbus_readl(const volatile void __iomem *addr) 290static inline u32 sbus_readl(const volatile void __iomem *addr)
333{ 291{
334 u32 ret; 292 return __raw_readl(addr);
335
336 __asm__ __volatile__("lduwa\t[%1] %2, %0\t/* sbus_readl */"
337 : "=r" (ret)
338 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
339 : "memory");
340
341 return ret;
342} 293}
343 294
344static inline u64 _sbus_readq(const volatile void __iomem *addr) 295static inline u64 sbus_readq(const volatile void __iomem *addr)
345{ 296{
346 u64 ret; 297 return __raw_readq(addr);
347
348 __asm__ __volatile__("ldxa\t[%1] %2, %0\t/* sbus_readq */"
349 : "=r" (ret)
350 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
351 : "memory");
352
353 return ret;
354} 298}
355 299
356static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) 300static inline void sbus_writeb(u8 b, volatile void __iomem *addr)
357{ 301{
358 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* sbus_writeb */" 302 __raw_writeb(b, addr);
359 : /* no outputs */
360 : "Jr" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
361 : "memory");
362} 303}
363 304
364static inline void _sbus_writew(u16 w, volatile void __iomem *addr) 305static inline void sbus_writew(u16 w, volatile void __iomem *addr)
365{ 306{
366 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* sbus_writew */" 307 __raw_writew(w, addr);
367 : /* no outputs */
368 : "Jr" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
369 : "memory");
370} 308}
371 309
372static inline void _sbus_writel(u32 l, volatile void __iomem *addr) 310static inline void sbus_writel(u32 l, volatile void __iomem *addr)
373{ 311{
374 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* sbus_writel */" 312 __raw_writel(l, addr);
375 : /* no outputs */
376 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
377 : "memory");
378} 313}
379 314
380static inline void _sbus_writeq(u64 l, volatile void __iomem *addr) 315static inline void sbus_writeq(u64 q, volatile void __iomem *addr)
381{ 316{
382 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* sbus_writeq */" 317 __raw_writeq(q, addr);
383 : /* no outputs */
384 : "Jr" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
385 : "memory");
386} 318}
387 319
388#define sbus_readb(__addr) _sbus_readb(__addr) 320static inline void sbus_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
389#define sbus_readw(__addr) _sbus_readw(__addr)
390#define sbus_readl(__addr) _sbus_readl(__addr)
391#define sbus_readq(__addr) _sbus_readq(__addr)
392#define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr)
393#define sbus_writew(__w, __addr) _sbus_writew(__w, __addr)
394#define sbus_writel(__l, __addr) _sbus_writel(__l, __addr)
395#define sbus_writeq(__l, __addr) _sbus_writeq(__l, __addr)
396
397static inline void _sbus_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
398{ 321{
399 while(n--) { 322 while(n--) {
400 sbus_writeb(c, dst); 323 sbus_writeb(c, dst);
@@ -402,10 +325,7 @@ static inline void _sbus_memset_io(volatile void __iomem *dst, int c, __kernel_s
402 } 325 }
403} 326}
404 327
405#define sbus_memset_io(d,c,sz) _sbus_memset_io(d,c,sz) 328static inline void memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
406
407static inline void
408_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
409{ 329{
410 volatile void __iomem *d = dst; 330 volatile void __iomem *d = dst;
411 331
@@ -415,11 +335,8 @@ _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
415 } 335 }
416} 336}
417 337
418#define memset_io(d,c,sz) _memset_io(d,c,sz) 338static inline void sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
419 339 __kernel_size_t n)
420static inline void
421_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
422 __kernel_size_t n)
423{ 340{
424 char *d = dst; 341 char *d = dst;
425 342
@@ -430,10 +347,9 @@ _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
430 } 347 }
431} 348}
432 349
433#define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz)
434 350
435static inline void 351static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
436_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) 352 __kernel_size_t n)
437{ 353{
438 char *d = dst; 354 char *d = dst;
439 355
@@ -444,11 +360,8 @@ _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
444 } 360 }
445} 361}
446 362
447#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) 363static inline void sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
448 364 __kernel_size_t n)
449static inline void
450_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
451 __kernel_size_t n)
452{ 365{
453 const char *s = src; 366 const char *s = src;
454 volatile void __iomem *d = dst; 367 volatile void __iomem *d = dst;
@@ -460,10 +373,8 @@ _sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
460 } 373 }
461} 374}
462 375
463#define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz) 376static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
464 377 __kernel_size_t n)
465static inline void
466_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
467{ 378{
468 const char *s = src; 379 const char *s = src;
469 volatile void __iomem *d = dst; 380 volatile void __iomem *d = dst;
@@ -475,8 +386,6 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
475 } 386 }
476} 387}
477 388
478#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
479
480#define mmiowb() 389#define mmiowb()
481 390
482#ifdef __KERNEL__ 391#ifdef __KERNEL__
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
deleted file mode 100644
index 92bb638313f8..000000000000
--- a/arch/sparc/include/asm/scatterlist.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _SPARC_SCATTERLIST_H
2#define _SPARC_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#define ARCH_HAS_SG_CHAIN
7
8#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h
index 816d8202fa0a..dea1cfa2122b 100644
--- a/arch/sparc/include/asm/tlbflush_64.h
+++ b/arch/sparc/include/asm/tlbflush_64.h
@@ -34,6 +34,8 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
34{ 34{
35} 35}
36 36
37void flush_tlb_kernel_range(unsigned long start, unsigned long end);
38
37#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 39#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
38 40
39void flush_tlb_pending(void); 41void flush_tlb_pending(void);
@@ -48,11 +50,6 @@ void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
48 50
49#ifndef CONFIG_SMP 51#ifndef CONFIG_SMP
50 52
51#define flush_tlb_kernel_range(start,end) \
52do { flush_tsb_kernel_range(start,end); \
53 __flush_tlb_kernel_range(start,end); \
54} while (0)
55
56static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr) 53static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr)
57{ 54{
58 __flush_tlb_page(CTX_HWBITS(mm->context), vaddr); 55 __flush_tlb_page(CTX_HWBITS(mm->context), vaddr);
@@ -63,11 +60,6 @@ static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vad
63void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); 60void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
64void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); 61void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);
65 62
66#define flush_tlb_kernel_range(start, end) \
67do { flush_tsb_kernel_range(start,end); \
68 smp_flush_tlb_kernel_range(start, end); \
69} while (0)
70
71#define global_flush_tlb_page(mm, vaddr) \ 63#define global_flush_tlb_page(mm, vaddr) \
72 smp_flush_tlb_page(mm, vaddr) 64 smp_flush_tlb_page(mm, vaddr)
73 65
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index 42f2bca1d338..c842a89b1190 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -411,8 +411,11 @@
411#define __NR_sched_setattr 343 411#define __NR_sched_setattr 343
412#define __NR_sched_getattr 344 412#define __NR_sched_getattr 344
413#define __NR_renameat2 345 413#define __NR_renameat2 345
414#define __NR_seccomp 346
415#define __NR_getrandom 347
416#define __NR_memfd_create 348
414 417
415#define NR_syscalls 346 418#define NR_syscalls 349
416 419
417/* Bitmask values returned from kern_features system call. */ 420/* Bitmask values returned from kern_features system call. */
418#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 421#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index e01d75d40329..66dacd56bb10 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -1336,7 +1336,7 @@ int ldc_connect(struct ldc_channel *lp)
1336 if (!(lp->flags & LDC_FLAG_ALLOCED_QUEUES) || 1336 if (!(lp->flags & LDC_FLAG_ALLOCED_QUEUES) ||
1337 !(lp->flags & LDC_FLAG_REGISTERED_QUEUES) || 1337 !(lp->flags & LDC_FLAG_REGISTERED_QUEUES) ||
1338 lp->hs_state != LDC_HS_OPEN) 1338 lp->hs_state != LDC_HS_OPEN)
1339 err = -EINVAL; 1339 err = ((lp->hs_state > LDC_HS_OPEN) ? 0 : -EINVAL);
1340 else 1340 else
1341 err = start_handshake(lp); 1341 err = start_handshake(lp);
1342 1342
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index a1a4400d4025..99632a87e697 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -906,29 +906,85 @@ void mdesc_fill_in_cpu_data(cpumask_t *mask)
906 smp_fill_in_sib_core_maps(); 906 smp_fill_in_sib_core_maps();
907} 907}
908 908
909static ssize_t mdesc_read(struct file *file, char __user *buf, 909/* mdesc_open() - Grab a reference to mdesc_handle when /dev/mdesc is
910 size_t len, loff_t *offp) 910 * opened. Hold this reference until /dev/mdesc is closed to ensure
911 * mdesc data structure is not released underneath us. Store the
912 * pointer to mdesc structure in private_data for read and seek to use
913 */
914static int mdesc_open(struct inode *inode, struct file *file)
911{ 915{
912 struct mdesc_handle *hp = mdesc_grab(); 916 struct mdesc_handle *hp = mdesc_grab();
913 int err;
914 917
915 if (!hp) 918 if (!hp)
916 return -ENODEV; 919 return -ENODEV;
917 920
918 err = hp->handle_size; 921 file->private_data = hp;
919 if (len < hp->handle_size) 922
920 err = -EMSGSIZE; 923 return 0;
921 else if (copy_to_user(buf, &hp->mdesc, hp->handle_size)) 924}
922 err = -EFAULT; 925
923 mdesc_release(hp); 926static ssize_t mdesc_read(struct file *file, char __user *buf,
927 size_t len, loff_t *offp)
928{
929 struct mdesc_handle *hp = file->private_data;
930 unsigned char *mdesc;
931 int bytes_left, count = len;
932
933 if (*offp >= hp->handle_size)
934 return 0;
935
936 bytes_left = hp->handle_size - *offp;
937 if (count > bytes_left)
938 count = bytes_left;
939
940 mdesc = (unsigned char *)&hp->mdesc;
941 mdesc += *offp;
942 if (!copy_to_user(buf, mdesc, count)) {
943 *offp += count;
944 return count;
945 } else {
946 return -EFAULT;
947 }
948}
924 949
925 return err; 950static loff_t mdesc_llseek(struct file *file, loff_t offset, int whence)
951{
952 struct mdesc_handle *hp;
953
954 switch (whence) {
955 case SEEK_CUR:
956 offset += file->f_pos;
957 break;
958 case SEEK_SET:
959 break;
960 default:
961 return -EINVAL;
962 }
963
964 hp = file->private_data;
965 if (offset > hp->handle_size)
966 return -EINVAL;
967 else
968 file->f_pos = offset;
969
970 return offset;
971}
972
973/* mdesc_close() - /dev/mdesc is being closed, release the reference to
974 * mdesc structure.
975 */
976static int mdesc_close(struct inode *inode, struct file *file)
977{
978 mdesc_release(file->private_data);
979 return 0;
926} 980}
927 981
928static const struct file_operations mdesc_fops = { 982static const struct file_operations mdesc_fops = {
929 .read = mdesc_read, 983 .open = mdesc_open,
930 .owner = THIS_MODULE, 984 .read = mdesc_read,
931 .llseek = noop_llseek, 985 .llseek = mdesc_llseek,
986 .release = mdesc_close,
987 .owner = THIS_MODULE,
932}; 988};
933 989
934static struct miscdevice mdesc_misc = { 990static struct miscdevice mdesc_misc = {
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index 337094556916..5b1151dcba13 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -130,7 +130,6 @@ static inline unsigned int get_nmi_count(int cpu)
130 130
131static __init void nmi_cpu_busy(void *data) 131static __init void nmi_cpu_busy(void *data)
132{ 132{
133 local_irq_enable_in_hardirq();
134 while (endflag == 0) 133 while (endflag == 0)
135 mb(); 134 mb();
136} 135}
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 539babf00bb2..b36365f49478 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -432,6 +432,11 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
432 node->full_name); 432 node->full_name);
433 return; 433 return;
434 } 434 }
435
436 if (ofpci_verbose)
437 printk(" Bridge bus range [%u --> %u]\n",
438 busrange[0], busrange[1]);
439
435 ranges = of_get_property(node, "ranges", &len); 440 ranges = of_get_property(node, "ranges", &len);
436 simba = 0; 441 simba = 0;
437 if (ranges == NULL) { 442 if (ranges == NULL) {
@@ -451,6 +456,10 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
451 pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); 456 pci_bus_insert_busn_res(bus, busrange[0], busrange[1]);
452 bus->bridge_ctl = 0; 457 bus->bridge_ctl = 0;
453 458
459 if (ofpci_verbose)
460 printk(" Bridge ranges[%p] simba[%d]\n",
461 ranges, simba);
462
454 /* parse ranges property, or cook one up by hand for Simba */ 463 /* parse ranges property, or cook one up by hand for Simba */
455 /* PCI #address-cells == 3 and #size-cells == 2 always */ 464 /* PCI #address-cells == 3 and #size-cells == 2 always */
456 res = &dev->resource[PCI_BRIDGE_RESOURCES]; 465 res = &dev->resource[PCI_BRIDGE_RESOURCES];
@@ -468,10 +477,29 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
468 } 477 }
469 i = 1; 478 i = 1;
470 for (; len >= 32; len -= 32, ranges += 8) { 479 for (; len >= 32; len -= 32, ranges += 8) {
480 u64 start;
481
482 if (ofpci_verbose)
483 printk(" RAW Range[%08x:%08x:%08x:%08x:%08x:%08x:"
484 "%08x:%08x]\n",
485 ranges[0], ranges[1], ranges[2], ranges[3],
486 ranges[4], ranges[5], ranges[6], ranges[7]);
487
471 flags = pci_parse_of_flags(ranges[0]); 488 flags = pci_parse_of_flags(ranges[0]);
472 size = GET_64BIT(ranges, 6); 489 size = GET_64BIT(ranges, 6);
473 if (flags == 0 || size == 0) 490 if (flags == 0 || size == 0)
474 continue; 491 continue;
492
493 /* On PCI-Express systems, PCI bridges that have no devices downstream
494 * have a bogus size value where the first 32-bit cell is 0xffffffff.
495 * This results in a bogus range where start + size overflows.
496 *
497 * Just skip these otherwise the kernel will complain when the resource
498 * tries to be claimed.
499 */
500 if (size >> 32 == 0xffffffff)
501 continue;
502
475 if (flags & IORESOURCE_IO) { 503 if (flags & IORESOURCE_IO) {
476 res = bus->resource[0]; 504 res = bus->resource[0];
477 if (res->flags) { 505 if (res->flags) {
@@ -490,8 +518,13 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
490 } 518 }
491 519
492 res->flags = flags; 520 res->flags = flags;
493 region.start = GET_64BIT(ranges, 1); 521 region.start = start = GET_64BIT(ranges, 1);
494 region.end = region.start + size - 1; 522 region.end = region.start + size - 1;
523
524 if (ofpci_verbose)
525 printk(" Using flags[%08x] start[%016llx] size[%016llx]\n",
526 flags, start, size);
527
495 pcibios_bus_to_resource(dev->bus, res, &region); 528 pcibios_bus_to_resource(dev->bus, res, &region);
496 } 529 }
497after_ranges: 530after_ranges:
@@ -584,6 +617,36 @@ static void pci_bus_register_of_sysfs(struct pci_bus *bus)
584 pci_bus_register_of_sysfs(child_bus); 617 pci_bus_register_of_sysfs(child_bus);
585} 618}
586 619
620static void pci_claim_bus_resources(struct pci_bus *bus)
621{
622 struct pci_bus *child_bus;
623 struct pci_dev *dev;
624
625 list_for_each_entry(dev, &bus->devices, bus_list) {
626 int i;
627
628 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
629 struct resource *r = &dev->resource[i];
630
631 if (r->parent || !r->start || !r->flags)
632 continue;
633
634 if (ofpci_verbose)
635 printk("PCI: Claiming %s: "
636 "Resource %d: %016llx..%016llx [%x]\n",
637 pci_name(dev), i,
638 (unsigned long long)r->start,
639 (unsigned long long)r->end,
640 (unsigned int)r->flags);
641
642 pci_claim_resource(dev, i);
643 }
644 }
645
646 list_for_each_entry(child_bus, &bus->children, node)
647 pci_claim_bus_resources(child_bus);
648}
649
587struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, 650struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
588 struct device *parent) 651 struct device *parent)
589{ 652{
@@ -614,6 +677,8 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
614 pci_bus_add_devices(bus); 677 pci_bus_add_devices(bus);
615 pci_bus_register_of_sysfs(bus); 678 pci_bus_register_of_sysfs(bus);
616 679
680 pci_claim_bus_resources(bus);
681
617 return bus; 682 return bus;
618} 683}
619 684
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 8efd33753ad3..d35c490a91cb 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1671,9 +1671,12 @@ static bool __init supported_pmu(void)
1671 1671
1672static int __init init_hw_perf_events(void) 1672static int __init init_hw_perf_events(void)
1673{ 1673{
1674 int err;
1675
1674 pr_info("Performance events: "); 1676 pr_info("Performance events: ");
1675 1677
1676 if (!supported_pmu()) { 1678 err = pcr_arch_init();
1679 if (err || !supported_pmu()) {
1677 pr_cont("No support for PMU type '%s'\n", sparc_pmu_type); 1680 pr_cont("No support for PMU type '%s'\n", sparc_pmu_type);
1678 return 0; 1681 return 0;
1679 } 1682 }
@@ -1685,7 +1688,7 @@ static int __init init_hw_perf_events(void)
1685 1688
1686 return 0; 1689 return 0;
1687} 1690}
1688early_initcall(init_hw_perf_events); 1691pure_initcall(init_hw_perf_events);
1689 1692
1690void perf_callchain_kernel(struct perf_callchain_entry *entry, 1693void perf_callchain_kernel(struct perf_callchain_entry *entry,
1691 struct pt_regs *regs) 1694 struct pt_regs *regs)
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 027e09986194..0be7bf978cb1 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -312,6 +312,9 @@ static void __global_pmu_self(int this_cpu)
312 struct global_pmu_snapshot *pp; 312 struct global_pmu_snapshot *pp;
313 int i, num; 313 int i, num;
314 314
315 if (!pcr_ops)
316 return;
317
315 pp = &global_cpu_snapshot[this_cpu].pmu; 318 pp = &global_cpu_snapshot[this_cpu].pmu;
316 319
317 num = 1; 320 num = 1;
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index 7958242d63c5..b3a5d81b20f0 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -68,7 +68,7 @@ void smp_store_cpu_info(int id)
68 mid = cpu_get_hwmid(cpu_node); 68 mid = cpu_get_hwmid(cpu_node);
69 69
70 if (mid < 0) { 70 if (mid < 0) {
71 printk(KERN_NOTICE "No MID found for CPU%d at node 0x%08d", id, cpu_node); 71 printk(KERN_NOTICE "No MID found for CPU%d at node 0x%08x", id, cpu_node);
72 mid = 0; 72 mid = 0;
73 } 73 }
74 cpu_data(id).mid = mid; 74 cpu_data(id).mid = mid;
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 41aa2478f3ca..f7ba87543e5f 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1383,7 +1383,6 @@ void __cpu_die(unsigned int cpu)
1383 1383
1384void __init smp_cpus_done(unsigned int max_cpus) 1384void __init smp_cpus_done(unsigned int max_cpus)
1385{ 1385{
1386 pcr_arch_init();
1387} 1386}
1388 1387
1389void smp_send_reschedule(int cpu) 1388void smp_send_reschedule(int cpu)
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 85fe9b1087cd..6a873c344bc0 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -86,4 +86,4 @@ sys_call_table:
86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
89/*345*/ .long sys_renameat2 89/*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 33ecba2826ea..d9151b6490d8 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -87,7 +87,7 @@ sys_call_table32:
87/*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime 87/*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
90 .word sys32_renameat2 90 .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create
91 91
92#endif /* CONFIG_COMPAT */ 92#endif /* CONFIG_COMPAT */
93 93
@@ -166,4 +166,4 @@ sys_call_table:
166/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 166/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
167 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 167 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
168/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr 168/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
169 .word sys_renameat2 169 .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index c5c61b3c6b56..32b61d1b6379 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -166,7 +166,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,
166/* This is just to make gcc think panic does return... */ 166/* This is just to make gcc think panic does return... */
167static void unaligned_panic(char *str) 167static void unaligned_panic(char *str)
168{ 168{
169 panic(str); 169 panic("%s", str);
170} 170}
171 171
172/* una_asm.S */ 172/* una_asm.S */
diff --git a/arch/sparc/lib/PeeCeeI.c b/arch/sparc/lib/PeeCeeI.c
index 6529f8657597..e6d183675990 100644
--- a/arch/sparc/lib/PeeCeeI.c
+++ b/arch/sparc/lib/PeeCeeI.c
@@ -15,7 +15,7 @@ void outsb(unsigned long __addr, const void *src, unsigned long count)
15 const u8 *p = src; 15 const u8 *p = src;
16 16
17 while (count--) 17 while (count--)
18 outb(*p++, addr); 18 __raw_writeb(*p++, addr);
19} 19}
20EXPORT_SYMBOL(outsb); 20EXPORT_SYMBOL(outsb);
21 21
@@ -93,21 +93,21 @@ void insb(unsigned long __addr, void *dst, unsigned long count)
93 u8 *pb = dst; 93 u8 *pb = dst;
94 94
95 while ((((unsigned long)pb) & 0x3) && count--) 95 while ((((unsigned long)pb) & 0x3) && count--)
96 *pb++ = inb(addr); 96 *pb++ = __raw_readb(addr);
97 pi = (u32 *)pb; 97 pi = (u32 *)pb;
98 while (count >= 4) { 98 while (count >= 4) {
99 u32 w; 99 u32 w;
100 100
101 w = (inb(addr) << 24); 101 w = (__raw_readb(addr) << 24);
102 w |= (inb(addr) << 16); 102 w |= (__raw_readb(addr) << 16);
103 w |= (inb(addr) << 8); 103 w |= (__raw_readb(addr) << 8);
104 w |= (inb(addr) << 0); 104 w |= (__raw_readb(addr) << 0);
105 *pi++ = w; 105 *pi++ = w;
106 count -= 4; 106 count -= 4;
107 } 107 }
108 pb = (u8 *)pi; 108 pb = (u8 *)pi;
109 while (count--) 109 while (count--)
110 *pb++ = inb(addr); 110 *pb++ = __raw_readb(addr);
111 } 111 }
112} 112}
113EXPORT_SYMBOL(insb); 113EXPORT_SYMBOL(insb);
@@ -121,21 +121,21 @@ void insw(unsigned long __addr, void *dst, unsigned long count)
121 u32 *pi; 121 u32 *pi;
122 122
123 if (((unsigned long)ps) & 0x2) { 123 if (((unsigned long)ps) & 0x2) {
124 *ps++ = le16_to_cpu(inw(addr)); 124 *ps++ = __raw_readw(addr);
125 count--; 125 count--;
126 } 126 }
127 pi = (u32 *)ps; 127 pi = (u32 *)ps;
128 while (count >= 2) { 128 while (count >= 2) {
129 u32 w; 129 u32 w;
130 130
131 w = (le16_to_cpu(inw(addr)) << 16); 131 w = __raw_readw(addr) << 16;
132 w |= (le16_to_cpu(inw(addr)) << 0); 132 w |= __raw_readw(addr) << 0;
133 *pi++ = w; 133 *pi++ = w;
134 count -= 2; 134 count -= 2;
135 } 135 }
136 ps = (u16 *)pi; 136 ps = (u16 *)pi;
137 if (count) 137 if (count)
138 *ps = le16_to_cpu(inw(addr)); 138 *ps = __raw_readw(addr);
139 } 139 }
140} 140}
141EXPORT_SYMBOL(insw); 141EXPORT_SYMBOL(insw);
@@ -148,7 +148,7 @@ void insl(unsigned long __addr, void *dst, unsigned long count)
148 if ((((unsigned long)dst) & 0x3) == 0) { 148 if ((((unsigned long)dst) & 0x3) == 0) {
149 u32 *pi = dst; 149 u32 *pi = dst;
150 while (count--) 150 while (count--)
151 *pi++ = le32_to_cpu(inl(addr)); 151 *pi++ = __raw_readl(addr);
152 } else { 152 } else {
153 u32 l = 0, l2, *pi; 153 u32 l = 0, l2, *pi;
154 u16 *ps; 154 u16 *ps;
@@ -158,11 +158,11 @@ void insl(unsigned long __addr, void *dst, unsigned long count)
158 case 0x2: 158 case 0x2:
159 ps = dst; 159 ps = dst;
160 count -= 1; 160 count -= 1;
161 l = le32_to_cpu(inl(addr)); 161 l = __raw_readl(addr);
162 *ps++ = l; 162 *ps++ = l;
163 pi = (u32 *)ps; 163 pi = (u32 *)ps;
164 while (count--) { 164 while (count--) {
165 l2 = le32_to_cpu(inl(addr)); 165 l2 = __raw_readl(addr);
166 *pi++ = (l << 16) | (l2 >> 16); 166 *pi++ = (l << 16) | (l2 >> 16);
167 l = l2; 167 l = l2;
168 } 168 }
@@ -173,13 +173,13 @@ void insl(unsigned long __addr, void *dst, unsigned long count)
173 case 0x1: 173 case 0x1:
174 pb = dst; 174 pb = dst;
175 count -= 1; 175 count -= 1;
176 l = le32_to_cpu(inl(addr)); 176 l = __raw_readl(addr);
177 *pb++ = l >> 24; 177 *pb++ = l >> 24;
178 ps = (u16 *)pb; 178 ps = (u16 *)pb;
179 *ps++ = ((l >> 8) & 0xffff); 179 *ps++ = ((l >> 8) & 0xffff);
180 pi = (u32 *)ps; 180 pi = (u32 *)ps;
181 while (count--) { 181 while (count--) {
182 l2 = le32_to_cpu(inl(addr)); 182 l2 = __raw_readl(addr);
183 *pi++ = (l << 24) | (l2 >> 8); 183 *pi++ = (l << 24) | (l2 >> 8);
184 l = l2; 184 l = l2;
185 } 185 }
@@ -190,11 +190,11 @@ void insl(unsigned long __addr, void *dst, unsigned long count)
190 case 0x3: 190 case 0x3:
191 pb = (u8 *)dst; 191 pb = (u8 *)dst;
192 count -= 1; 192 count -= 1;
193 l = le32_to_cpu(inl(addr)); 193 l = __raw_readl(addr);
194 *pb++ = l >> 24; 194 *pb++ = l >> 24;
195 pi = (u32 *)pb; 195 pi = (u32 *)pb;
196 while (count--) { 196 while (count--) {
197 l2 = le32_to_cpu(inl(addr)); 197 l2 = __raw_readl(addr);
198 *pi++ = (l << 8) | (l2 >> 24); 198 *pi++ = (l << 8) | (l2 >> 24);
199 l = l2; 199 l = l2;
200 } 200 }
diff --git a/arch/sparc/math-emu/math_32.c b/arch/sparc/math-emu/math_32.c
index aa4d55b0bdf0..5ce8f2f64604 100644
--- a/arch/sparc/math-emu/math_32.c
+++ b/arch/sparc/math-emu/math_32.c
@@ -499,7 +499,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
499 case 0: fsr = *pfsr; 499 case 0: fsr = *pfsr;
500 if (IR == -1) IR = 2; 500 if (IR == -1) IR = 2;
501 /* fcc is always fcc0 */ 501 /* fcc is always fcc0 */
502 fsr &= ~0xc00; fsr |= (IR << 10); break; 502 fsr &= ~0xc00; fsr |= (IR << 10);
503 *pfsr = fsr; 503 *pfsr = fsr;
504 break; 504 break;
505 case 1: rd->s = IR; break; 505 case 1: rd->s = IR; break;
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 16b58ff11e65..98ac8e80adae 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -22,6 +22,7 @@
22#include <linux/kprobes.h> 22#include <linux/kprobes.h>
23#include <linux/cache.h> 23#include <linux/cache.h>
24#include <linux/sort.h> 24#include <linux/sort.h>
25#include <linux/ioport.h>
25#include <linux/percpu.h> 26#include <linux/percpu.h>
26#include <linux/memblock.h> 27#include <linux/memblock.h>
27#include <linux/mmzone.h> 28#include <linux/mmzone.h>
@@ -351,6 +352,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *
351 352
352 mm = vma->vm_mm; 353 mm = vma->vm_mm;
353 354
355 /* Don't insert a non-valid PTE into the TSB, we'll deadlock. */
356 if (!pte_accessible(mm, pte))
357 return;
358
354 spin_lock_irqsave(&mm->context.lock, flags); 359 spin_lock_irqsave(&mm->context.lock, flags);
355 360
356#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 361#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
@@ -2619,6 +2624,10 @@ void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
2619 2624
2620 pte = pmd_val(entry); 2625 pte = pmd_val(entry);
2621 2626
2627 /* Don't insert a non-valid PMD into the TSB, we'll deadlock. */
2628 if (!(pte & _PAGE_VALID))
2629 return;
2630
2622 /* We are fabricating 8MB pages using 4MB real hw pages. */ 2631 /* We are fabricating 8MB pages using 4MB real hw pages. */
2623 pte |= (addr & (1UL << REAL_HPAGE_SHIFT)); 2632 pte |= (addr & (1UL << REAL_HPAGE_SHIFT));
2624 2633
@@ -2699,3 +2708,90 @@ void hugetlb_setup(struct pt_regs *regs)
2699 } 2708 }
2700} 2709}
2701#endif 2710#endif
2711
2712static struct resource code_resource = {
2713 .name = "Kernel code",
2714 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
2715};
2716
2717static struct resource data_resource = {
2718 .name = "Kernel data",
2719 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
2720};
2721
2722static struct resource bss_resource = {
2723 .name = "Kernel bss",
2724 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
2725};
2726
2727static inline resource_size_t compute_kern_paddr(void *addr)
2728{
2729 return (resource_size_t) (addr - KERNBASE + kern_base);
2730}
2731
2732static void __init kernel_lds_init(void)
2733{
2734 code_resource.start = compute_kern_paddr(_text);
2735 code_resource.end = compute_kern_paddr(_etext - 1);
2736 data_resource.start = compute_kern_paddr(_etext);
2737 data_resource.end = compute_kern_paddr(_edata - 1);
2738 bss_resource.start = compute_kern_paddr(__bss_start);
2739 bss_resource.end = compute_kern_paddr(_end - 1);
2740}
2741
2742static int __init report_memory(void)
2743{
2744 int i;
2745 struct resource *res;
2746
2747 kernel_lds_init();
2748
2749 for (i = 0; i < pavail_ents; i++) {
2750 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
2751
2752 if (!res) {
2753 pr_warn("Failed to allocate source.\n");
2754 break;
2755 }
2756
2757 res->name = "System RAM";
2758 res->start = pavail[i].phys_addr;
2759 res->end = pavail[i].phys_addr + pavail[i].reg_size - 1;
2760 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
2761
2762 if (insert_resource(&iomem_resource, res) < 0) {
2763 pr_warn("Resource insertion failed.\n");
2764 break;
2765 }
2766
2767 insert_resource(res, &code_resource);
2768 insert_resource(res, &data_resource);
2769 insert_resource(res, &bss_resource);
2770 }
2771
2772 return 0;
2773}
2774device_initcall(report_memory);
2775
2776#ifdef CONFIG_SMP
2777#define do_flush_tlb_kernel_range smp_flush_tlb_kernel_range
2778#else
2779#define do_flush_tlb_kernel_range __flush_tlb_kernel_range
2780#endif
2781
2782void flush_tlb_kernel_range(unsigned long start, unsigned long end)
2783{
2784 if (start < HI_OBP_ADDRESS && end > LOW_OBP_ADDRESS) {
2785 if (start < LOW_OBP_ADDRESS) {
2786 flush_tsb_kernel_range(start, LOW_OBP_ADDRESS);
2787 do_flush_tlb_kernel_range(start, LOW_OBP_ADDRESS);
2788 }
2789 if (end > HI_OBP_ADDRESS) {
2790 flush_tsb_kernel_range(end, HI_OBP_ADDRESS);
2791 do_flush_tlb_kernel_range(end, HI_OBP_ADDRESS);
2792 }
2793 } else {
2794 flush_tsb_kernel_range(start, end);
2795 do_flush_tlb_kernel_range(start, end);
2796 }
2797}
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index 892a102671ad..1f76c22a6a75 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -354,7 +354,7 @@ do { *prog++ = BR_OPC | WDISP22(OFF); \
354 * emit_jump() calls with adjusted offsets. 354 * emit_jump() calls with adjusted offsets.
355 */ 355 */
356 356
357void bpf_jit_compile(struct sk_filter *fp) 357void bpf_jit_compile(struct bpf_prog *fp)
358{ 358{
359 unsigned int cleanup_addr, proglen, oldproglen = 0; 359 unsigned int cleanup_addr, proglen, oldproglen = 0;
360 u32 temp[8], *prog, *func, seen = 0, pass; 360 u32 temp[8], *prog, *func, seen = 0, pass;
@@ -808,7 +808,7 @@ out:
808 return; 808 return;
809} 809}
810 810
811void bpf_jit_free(struct sk_filter *fp) 811void bpf_jit_free(struct bpf_prog *fp)
812{ 812{
813 if (fp->jited) 813 if (fp->jited)
814 module_free(NULL, fp->bpf_func); 814 module_free(NULL, fp->bpf_func);
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 7fcd492adbfc..a3ffe2dd4832 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -191,6 +191,8 @@ source "kernel/Kconfig.hz"
191 191
192config KEXEC 192config KEXEC
193 bool "kexec system call" 193 bool "kexec system call"
194 select CRYPTO
195 select CRYPTO_SHA256
194 ---help--- 196 ---help---
195 kexec is a system call that implements the ability to shutdown your 197 kexec is a system call that implements the ability to shutdown your
196 current kernel, and to start another kernel. It is like a reboot 198 current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/tile/configs/tilegx_defconfig b/arch/tile/configs/tilegx_defconfig
index 730e40d9cf62..91de7dd7427f 100644
--- a/arch/tile/configs/tilegx_defconfig
+++ b/arch/tile/configs/tilegx_defconfig
@@ -170,7 +170,6 @@ CONFIG_BLK_DEV_RAM=y
170CONFIG_BLK_DEV_RAM_SIZE=16384 170CONFIG_BLK_DEV_RAM_SIZE=16384
171CONFIG_ATA_OVER_ETH=m 171CONFIG_ATA_OVER_ETH=m
172CONFIG_RAID_ATTRS=m 172CONFIG_RAID_ATTRS=m
173CONFIG_SCSI_TGT=m
174CONFIG_BLK_DEV_SD=y 173CONFIG_BLK_DEV_SD=y
175CONFIG_SCSI_CONSTANTS=y 174CONFIG_SCSI_CONSTANTS=y
176CONFIG_SCSI_LOGGING=y 175CONFIG_SCSI_LOGGING=y
diff --git a/arch/tile/configs/tilepro_defconfig b/arch/tile/configs/tilepro_defconfig
index 80fc32ed0491..c7702b7ab7a5 100644
--- a/arch/tile/configs/tilepro_defconfig
+++ b/arch/tile/configs/tilepro_defconfig
@@ -301,7 +301,6 @@ CONFIG_BLK_DEV_RAM=y
301CONFIG_BLK_DEV_RAM_SIZE=16384 301CONFIG_BLK_DEV_RAM_SIZE=16384
302CONFIG_ATA_OVER_ETH=m 302CONFIG_ATA_OVER_ETH=m
303CONFIG_RAID_ATTRS=m 303CONFIG_RAID_ATTRS=m
304CONFIG_SCSI_TGT=m
305CONFIG_BLK_DEV_SD=y 304CONFIG_BLK_DEV_SD=y
306CONFIG_SCSI_CONSTANTS=y 305CONFIG_SCSI_CONSTANTS=y
307CONFIG_SCSI_LOGGING=y 306CONFIG_SCSI_LOGGING=y
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index ffd4493efc78..c14e36f008c8 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -267,8 +267,7 @@ static inline int is_compat_task(void)
267 return current_thread_info()->status & TS_COMPAT; 267 return current_thread_info()->status & TS_COMPAT;
268} 268}
269 269
270extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka, 270extern int compat_setup_rt_frame(struct ksignal *ksig, sigset_t *set,
271 siginfo_t *info, sigset_t *set,
272 struct pt_regs *regs); 271 struct pt_regs *regs);
273 272
274/* Compat syscalls. */ 273/* Compat syscalls. */
diff --git a/arch/tile/include/asm/hardwall.h b/arch/tile/include/asm/hardwall.h
index 2f572b6b7bc2..44d2765bde2b 100644
--- a/arch/tile/include/asm/hardwall.h
+++ b/arch/tile/include/asm/hardwall.h
@@ -23,7 +23,7 @@
23struct proc_dir_entry; 23struct proc_dir_entry;
24#ifdef CONFIG_HARDWALL 24#ifdef CONFIG_HARDWALL
25void proc_tile_hardwall_init(struct proc_dir_entry *root); 25void proc_tile_hardwall_init(struct proc_dir_entry *root);
26int proc_pid_hardwall(struct task_struct *task, char *buffer); 26int proc_pid_hardwall(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task);
27#else 27#else
28static inline void proc_tile_hardwall_init(struct proc_dir_entry *root) {} 28static inline void proc_tile_hardwall_init(struct proc_dir_entry *root) {}
29#endif 29#endif
diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h
index 672768008618..a213a8d84a95 100644
--- a/arch/tile/include/asm/page.h
+++ b/arch/tile/include/asm/page.h
@@ -39,12 +39,6 @@
39#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 39#define HPAGE_MASK (~(HPAGE_SIZE - 1))
40 40
41/* 41/*
42 * We do define AT_SYSINFO_EHDR to support vDSO,
43 * but don't use the gate mechanism.
44 */
45#define __HAVE_ARCH_GATE_AREA 1
46
47/*
48 * If the Kconfig doesn't specify, set a maximum zone order that 42 * If the Kconfig doesn't specify, set a maximum zone order that
49 * is enough so that we can create huge pages from small pages given 43 * is enough so that we can create huge pages from small pages given
50 * the respective sizes of the two page types. See <linux/mmzone.h>. 44 * the respective sizes of the two page types. See <linux/mmzone.h>.
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 19c04b5ce408..8c5abf2e4794 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -190,18 +190,18 @@ static inline void __user *compat_get_sigframe(struct k_sigaction *ka,
190 return (void __user *) sp; 190 return (void __user *) sp;
191} 191}
192 192
193int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 193int compat_setup_rt_frame(struct ksignal *ksig, sigset_t *set,
194 sigset_t *set, struct pt_regs *regs) 194 struct pt_regs *regs)
195{ 195{
196 unsigned long restorer; 196 unsigned long restorer;
197 struct compat_rt_sigframe __user *frame; 197 struct compat_rt_sigframe __user *frame;
198 int err = 0; 198 int err = 0, sig = ksig->sig;
199 int usig; 199 int usig;
200 200
201 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 201 frame = compat_get_sigframe(&ksig->ka, regs, sizeof(*frame));
202 202
203 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 203 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
204 goto give_sigsegv; 204 goto err;
205 205
206 usig = current_thread_info()->exec_domain 206 usig = current_thread_info()->exec_domain
207 && current_thread_info()->exec_domain->signal_invmap 207 && current_thread_info()->exec_domain->signal_invmap
@@ -210,12 +210,12 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
210 : sig; 210 : sig;
211 211
212 /* Always write at least the signal number for the stack backtracer. */ 212 /* Always write at least the signal number for the stack backtracer. */
213 if (ka->sa.sa_flags & SA_SIGINFO) { 213 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
214 /* At sigreturn time, restore the callee-save registers too. */ 214 /* At sigreturn time, restore the callee-save registers too. */
215 err |= copy_siginfo_to_user32(&frame->info, info); 215 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
216 regs->flags |= PT_FLAGS_RESTORE_REGS; 216 regs->flags |= PT_FLAGS_RESTORE_REGS;
217 } else { 217 } else {
218 err |= __put_user(info->si_signo, &frame->info.si_signo); 218 err |= __put_user(ksig->info.si_signo, &frame->info.si_signo);
219 } 219 }
220 220
221 /* Create the ucontext. */ 221 /* Create the ucontext. */
@@ -226,11 +226,11 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
226 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); 226 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs);
227 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 227 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
228 if (err) 228 if (err)
229 goto give_sigsegv; 229 goto err;
230 230
231 restorer = VDSO_SYM(&__vdso_rt_sigreturn); 231 restorer = VDSO_SYM(&__vdso_rt_sigreturn);
232 if (ka->sa.sa_flags & SA_RESTORER) 232 if (ksig->ka.sa.sa_flags & SA_RESTORER)
233 restorer = ptr_to_compat_reg(ka->sa.sa_restorer); 233 restorer = ptr_to_compat_reg(ksig->ka.sa.sa_restorer);
234 234
235 /* 235 /*
236 * Set up registers for signal handler. 236 * Set up registers for signal handler.
@@ -239,7 +239,7 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
239 * We always pass siginfo and mcontext, regardless of SA_SIGINFO, 239 * We always pass siginfo and mcontext, regardless of SA_SIGINFO,
240 * since some things rely on this (e.g. glibc's debug/segfault.c). 240 * since some things rely on this (e.g. glibc's debug/segfault.c).
241 */ 241 */
242 regs->pc = ptr_to_compat_reg(ka->sa.sa_handler); 242 regs->pc = ptr_to_compat_reg(ksig->ka.sa.sa_handler);
243 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */ 243 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */
244 regs->sp = ptr_to_compat_reg(frame); 244 regs->sp = ptr_to_compat_reg(frame);
245 regs->lr = restorer; 245 regs->lr = restorer;
@@ -249,7 +249,8 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
249 regs->flags |= PT_FLAGS_CALLER_SAVES; 249 regs->flags |= PT_FLAGS_CALLER_SAVES;
250 return 0; 250 return 0;
251 251
252give_sigsegv: 252err:
253 signal_fault("bad setup frame", regs, frame, sig); 253 trace_unhandled_signal("bad sigreturn frame", regs,
254 (unsigned long)frame, SIGSEGV);
254 return -EFAULT; 255 return -EFAULT;
255} 256}
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index 531f4c365351..aca6000bca75 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -947,15 +947,15 @@ static void hardwall_remove_proc(struct hardwall_info *info)
947 remove_proc_entry(buf, info->type->proc_dir); 947 remove_proc_entry(buf, info->type->proc_dir);
948} 948}
949 949
950int proc_pid_hardwall(struct task_struct *task, char *buffer) 950int proc_pid_hardwall(struct seq_file *m, struct pid_namespace *ns,
951 struct pid *pid, struct task_struct *task)
951{ 952{
952 int i; 953 int i;
953 int n = 0; 954 int n = 0;
954 for (i = 0; i < HARDWALL_TYPES; ++i) { 955 for (i = 0; i < HARDWALL_TYPES; ++i) {
955 struct hardwall_info *info = task->thread.hardwall[i].info; 956 struct hardwall_info *info = task->thread.hardwall[i].info;
956 if (info) 957 if (info)
957 n += sprintf(&buffer[n], "%s: %d\n", 958 seq_printf(m, "%s: %d\n", info->type->name, info->id);
958 info->type->name, info->id);
959 } 959 }
960 return n; 960 return n;
961} 961}
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index 4918d91bc3a6..d19b13e3a59f 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -58,7 +58,7 @@ void *module_alloc(unsigned long size)
58 area->nr_pages = npages; 58 area->nr_pages = npages;
59 area->pages = pages; 59 area->pages = pages;
60 60
61 if (map_vm_area(area, prot_rwx, &pages)) { 61 if (map_vm_area(area, prot_rwx, pages)) {
62 vunmap(area->addr); 62 vunmap(area->addr);
63 goto error; 63 goto error;
64 } 64 }
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index d1d026f01267..7c2fecc52177 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -153,18 +153,18 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
153 return (void __user *) sp; 153 return (void __user *) sp;
154} 154}
155 155
156static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 156static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
157 sigset_t *set, struct pt_regs *regs) 157 struct pt_regs *regs)
158{ 158{
159 unsigned long restorer; 159 unsigned long restorer;
160 struct rt_sigframe __user *frame; 160 struct rt_sigframe __user *frame;
161 int err = 0; 161 int err = 0, sig = ksig->sig;
162 int usig; 162 int usig;
163 163
164 frame = get_sigframe(ka, regs, sizeof(*frame)); 164 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
165 165
166 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 166 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
167 goto give_sigsegv; 167 goto err;
168 168
169 usig = current_thread_info()->exec_domain 169 usig = current_thread_info()->exec_domain
170 && current_thread_info()->exec_domain->signal_invmap 170 && current_thread_info()->exec_domain->signal_invmap
@@ -173,12 +173,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
173 : sig; 173 : sig;
174 174
175 /* Always write at least the signal number for the stack backtracer. */ 175 /* Always write at least the signal number for the stack backtracer. */
176 if (ka->sa.sa_flags & SA_SIGINFO) { 176 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
177 /* At sigreturn time, restore the callee-save registers too. */ 177 /* At sigreturn time, restore the callee-save registers too. */
178 err |= copy_siginfo_to_user(&frame->info, info); 178 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
179 regs->flags |= PT_FLAGS_RESTORE_REGS; 179 regs->flags |= PT_FLAGS_RESTORE_REGS;
180 } else { 180 } else {
181 err |= __put_user(info->si_signo, &frame->info.si_signo); 181 err |= __put_user(ksig->info.si_signo, &frame->info.si_signo);
182 } 182 }
183 183
184 /* Create the ucontext. */ 184 /* Create the ucontext. */
@@ -189,11 +189,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
189 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); 189 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs);
190 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 190 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
191 if (err) 191 if (err)
192 goto give_sigsegv; 192 goto err;
193 193
194 restorer = VDSO_SYM(&__vdso_rt_sigreturn); 194 restorer = VDSO_SYM(&__vdso_rt_sigreturn);
195 if (ka->sa.sa_flags & SA_RESTORER) 195 if (ksig->ka.sa.sa_flags & SA_RESTORER)
196 restorer = (unsigned long) ka->sa.sa_restorer; 196 restorer = (unsigned long) ksig->ka.sa.sa_restorer;
197 197
198 /* 198 /*
199 * Set up registers for signal handler. 199 * Set up registers for signal handler.
@@ -202,7 +202,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
202 * We always pass siginfo and mcontext, regardless of SA_SIGINFO, 202 * We always pass siginfo and mcontext, regardless of SA_SIGINFO,
203 * since some things rely on this (e.g. glibc's debug/segfault.c). 203 * since some things rely on this (e.g. glibc's debug/segfault.c).
204 */ 204 */
205 regs->pc = (unsigned long) ka->sa.sa_handler; 205 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
206 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */ 206 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */
207 regs->sp = (unsigned long) frame; 207 regs->sp = (unsigned long) frame;
208 regs->lr = restorer; 208 regs->lr = restorer;
@@ -212,8 +212,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
212 regs->flags |= PT_FLAGS_CALLER_SAVES; 212 regs->flags |= PT_FLAGS_CALLER_SAVES;
213 return 0; 213 return 0;
214 214
215give_sigsegv: 215err:
216 signal_fault("bad setup frame", regs, frame, sig); 216 trace_unhandled_signal("bad sigreturn frame", regs,
217 (unsigned long)frame, SIGSEGV);
217 return -EFAULT; 218 return -EFAULT;
218} 219}
219 220
@@ -221,9 +222,7 @@ give_sigsegv:
221 * OK, we're invoking a handler 222 * OK, we're invoking a handler
222 */ 223 */
223 224
224static void handle_signal(unsigned long sig, siginfo_t *info, 225static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
225 struct k_sigaction *ka,
226 struct pt_regs *regs)
227{ 226{
228 sigset_t *oldset = sigmask_to_save(); 227 sigset_t *oldset = sigmask_to_save();
229 int ret; 228 int ret;
@@ -238,7 +237,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
238 break; 237 break;
239 238
240 case -ERESTARTSYS: 239 case -ERESTARTSYS:
241 if (!(ka->sa.sa_flags & SA_RESTART)) { 240 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
242 regs->regs[0] = -EINTR; 241 regs->regs[0] = -EINTR;
243 break; 242 break;
244 } 243 }
@@ -254,14 +253,12 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
254 /* Set up the stack frame */ 253 /* Set up the stack frame */
255#ifdef CONFIG_COMPAT 254#ifdef CONFIG_COMPAT
256 if (is_compat_task()) 255 if (is_compat_task())
257 ret = compat_setup_rt_frame(sig, ka, info, oldset, regs); 256 ret = compat_setup_rt_frame(ksig, oldset, regs);
258 else 257 else
259#endif 258#endif
260 ret = setup_rt_frame(sig, ka, info, oldset, regs); 259 ret = setup_rt_frame(ksig, oldset, regs);
261 if (ret) 260
262 return; 261 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
263 signal_delivered(sig, info, ka, regs,
264 test_thread_flag(TIF_SINGLESTEP));
265} 262}
266 263
267/* 264/*
@@ -271,9 +268,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
271 */ 268 */
272void do_signal(struct pt_regs *regs) 269void do_signal(struct pt_regs *regs)
273{ 270{
274 siginfo_t info; 271 struct ksignal ksig;
275 int signr;
276 struct k_sigaction ka;
277 272
278 /* 273 /*
279 * i386 will check if we're coming from kernel mode and bail out 274 * i386 will check if we're coming from kernel mode and bail out
@@ -282,10 +277,9 @@ void do_signal(struct pt_regs *regs)
282 * helpful, we can reinstate the check on "!user_mode(regs)". 277 * helpful, we can reinstate the check on "!user_mode(regs)".
283 */ 278 */
284 279
285 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 280 if (get_signal(&ksig)) {
286 if (signr > 0) {
287 /* Whee! Actually deliver the signal. */ 281 /* Whee! Actually deliver the signal. */
288 handle_signal(signr, &info, &ka, regs); 282 handle_signal(&ksig, regs);
289 goto done; 283 goto done;
290 } 284 }
291 285
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 462dcd0c1700..d8fbc289e680 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -260,9 +260,8 @@ void update_vsyscall_tz(void)
260 260
261void update_vsyscall(struct timekeeper *tk) 261void update_vsyscall(struct timekeeper *tk)
262{ 262{
263 struct timespec wall_time = tk_xtime(tk);
264 struct timespec *wtm = &tk->wall_to_monotonic; 263 struct timespec *wtm = &tk->wall_to_monotonic;
265 struct clocksource *clock = tk->clock; 264 struct clocksource *clock = tk->tkr.clock;
266 265
267 if (clock != &cycle_counter_cs) 266 if (clock != &cycle_counter_cs)
268 return; 267 return;
@@ -270,13 +269,13 @@ void update_vsyscall(struct timekeeper *tk)
270 /* Userspace gettimeofday will spin while this value is odd. */ 269 /* Userspace gettimeofday will spin while this value is odd. */
271 ++vdso_data->tb_update_count; 270 ++vdso_data->tb_update_count;
272 smp_wmb(); 271 smp_wmb();
273 vdso_data->xtime_tod_stamp = clock->cycle_last; 272 vdso_data->xtime_tod_stamp = tk->tkr.cycle_last;
274 vdso_data->xtime_clock_sec = wall_time.tv_sec; 273 vdso_data->xtime_clock_sec = tk->xtime_sec;
275 vdso_data->xtime_clock_nsec = wall_time.tv_nsec; 274 vdso_data->xtime_clock_nsec = tk->tkr.xtime_nsec;
276 vdso_data->wtom_clock_sec = wtm->tv_sec; 275 vdso_data->wtom_clock_sec = wtm->tv_sec;
277 vdso_data->wtom_clock_nsec = wtm->tv_nsec; 276 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
278 vdso_data->mult = clock->mult; 277 vdso_data->mult = tk->tkr.mult;
279 vdso_data->shift = clock->shift; 278 vdso_data->shift = tk->tkr.shift;
280 smp_wmb(); 279 smp_wmb();
281 ++vdso_data->tb_update_count; 280 ++vdso_data->tb_update_count;
282} 281}
diff --git a/arch/tile/kernel/vdso.c b/arch/tile/kernel/vdso.c
index 1533af24106e..5bc51d7dfdcb 100644
--- a/arch/tile/kernel/vdso.c
+++ b/arch/tile/kernel/vdso.c
@@ -121,21 +121,6 @@ const char *arch_vma_name(struct vm_area_struct *vma)
121 return NULL; 121 return NULL;
122} 122}
123 123
124struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
125{
126 return NULL;
127}
128
129int in_gate_area(struct mm_struct *mm, unsigned long address)
130{
131 return 0;
132}
133
134int in_gate_area_no_mm(unsigned long address)
135{
136 return 0;
137}
138
139int setup_vdso_pages(void) 124int setup_vdso_pages(void)
140{ 125{
141 struct page **pagelist; 126 struct page **pagelist;
diff --git a/arch/tile/kernel/vdso/vgettimeofday.c b/arch/tile/kernel/vdso/vgettimeofday.c
index 51ec8e46f5f9..e933fb9fbf5c 100644
--- a/arch/tile/kernel/vdso/vgettimeofday.c
+++ b/arch/tile/kernel/vdso/vgettimeofday.c
@@ -83,10 +83,11 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
83 if (count & 1) 83 if (count & 1)
84 continue; 84 continue;
85 85
86 cycles = (get_cycles() - vdso_data->xtime_tod_stamp);
87 ns = (cycles * vdso_data->mult) >> vdso_data->shift;
88 sec = vdso_data->xtime_clock_sec; 86 sec = vdso_data->xtime_clock_sec;
89 ns += vdso_data->xtime_clock_nsec; 87 cycles = get_cycles() - vdso_data->xtime_tod_stamp;
88 ns = (cycles * vdso_data->mult) + vdso_data->xtime_clock_nsec;
89 ns >>= vdso_data->shift;
90
90 if (ns >= NSEC_PER_SEC) { 91 if (ns >= NSEC_PER_SEC) {
91 ns -= NSEC_PER_SEC; 92 ns -= NSEC_PER_SEC;
92 sec += 1; 93 sec += 1;
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index a5e4b6068213..7bd64aa2e94a 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -21,6 +21,7 @@ generic-y += param.h
21generic-y += pci.h 21generic-y += pci.h
22generic-y += percpu.h 22generic-y += percpu.h
23generic-y += preempt.h 23generic-y += preempt.h
24generic-y += scatterlist.h
24generic-y += sections.h 25generic-y += sections.h
25generic-y += switch_to.h 26generic-y += switch_to.h
26generic-y += topology.h 27generic-y += topology.h
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
index 5ff53d9185f7..71c5d132062a 100644
--- a/arch/um/include/asm/page.h
+++ b/arch/um/include/asm/page.h
@@ -119,4 +119,9 @@ extern unsigned long uml_physmem;
119#include <asm-generic/getorder.h> 119#include <asm-generic/getorder.h>
120 120
121#endif /* __ASSEMBLY__ */ 121#endif /* __ASSEMBLY__ */
122
123#ifdef CONFIG_X86_32
124#define __HAVE_ARCH_GATE_AREA 1
125#endif
126
122#endif /* __UM_PAGE_H */ 127#endif /* __UM_PAGE_H */
diff --git a/arch/um/include/shared/frame_kern.h b/arch/um/include/shared/frame_kern.h
index f2ca5702a4e2..a5cde5c433b4 100644
--- a/arch/um/include/shared/frame_kern.h
+++ b/arch/um/include/shared/frame_kern.h
@@ -6,14 +6,10 @@
6#ifndef __FRAME_KERN_H_ 6#ifndef __FRAME_KERN_H_
7#define __FRAME_KERN_H_ 7#define __FRAME_KERN_H_
8 8
9extern int setup_signal_stack_sc(unsigned long stack_top, int sig, 9extern int setup_signal_stack_sc(unsigned long stack_top, struct ksignal *ksig,
10 struct k_sigaction *ka, 10 struct pt_regs *regs, sigset_t *mask);
11 struct pt_regs *regs, 11extern int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
12 sigset_t *mask); 12 struct pt_regs *regs, sigset_t *mask);
13extern int setup_signal_stack_si(unsigned long stack_top, int sig,
14 struct k_sigaction *ka,
15 struct pt_regs *regs, struct siginfo *info,
16 sigset_t *mask);
17 13
18#endif 14#endif
19 15
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index f57e02e7910f..4f60e4aad790 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -18,8 +18,7 @@ EXPORT_SYMBOL(unblock_signals);
18/* 18/*
19 * OK, we're invoking a handler 19 * OK, we're invoking a handler
20 */ 20 */
21static void handle_signal(struct pt_regs *regs, unsigned long signr, 21static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
22 struct k_sigaction *ka, struct siginfo *info)
23{ 22{
24 sigset_t *oldset = sigmask_to_save(); 23 sigset_t *oldset = sigmask_to_save();
25 int singlestep = 0; 24 int singlestep = 0;
@@ -39,7 +38,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr,
39 break; 38 break;
40 39
41 case -ERESTARTSYS: 40 case -ERESTARTSYS:
42 if (!(ka->sa.sa_flags & SA_RESTART)) { 41 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
43 PT_REGS_SYSCALL_RET(regs) = -EINTR; 42 PT_REGS_SYSCALL_RET(regs) = -EINTR;
44 break; 43 break;
45 } 44 }
@@ -52,32 +51,28 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr,
52 } 51 }
53 52
54 sp = PT_REGS_SP(regs); 53 sp = PT_REGS_SP(regs);
55 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) 54 if ((ksig->ka.sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
56 sp = current->sas_ss_sp + current->sas_ss_size; 55 sp = current->sas_ss_sp + current->sas_ss_size;
57 56
58#ifdef CONFIG_ARCH_HAS_SC_SIGNALS 57#ifdef CONFIG_ARCH_HAS_SC_SIGNALS
59 if (!(ka->sa.sa_flags & SA_SIGINFO)) 58 if (!(ksig->ka.sa.sa_flags & SA_SIGINFO))
60 err = setup_signal_stack_sc(sp, signr, ka, regs, oldset); 59 err = setup_signal_stack_sc(sp, ksig, regs, oldset);
61 else 60 else
62#endif 61#endif
63 err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); 62 err = setup_signal_stack_si(sp, ksig, regs, oldset);
64 63
65 if (err) 64 signal_setup_done(err, ksig, singlestep);
66 force_sigsegv(signr, current);
67 else
68 signal_delivered(signr, info, ka, regs, singlestep);
69} 65}
70 66
71static int kern_do_signal(struct pt_regs *regs) 67static int kern_do_signal(struct pt_regs *regs)
72{ 68{
73 struct k_sigaction ka_copy; 69 struct ksignal ksig;
74 struct siginfo info; 70 int handled_sig = 0;
75 int sig, handled_sig = 0;
76 71
77 while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { 72 while (get_signal(&ksig)) {
78 handled_sig = 1; 73 handled_sig = 1;
79 /* Whee! Actually deliver the signal. */ 74 /* Whee! Actually deliver the signal. */
80 handle_signal(regs, sig, &ka_copy, &info); 75 handle_signal(&ksig, regs);
81 } 76 }
82 77
83 /* Did we come from a system call? */ 78 /* Did we come from a system call? */
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c
index 254adeecc61a..438dd2edba4f 100644
--- a/arch/unicore32/kernel/puv3-core.c
+++ b/arch/unicore32/kernel/puv3-core.c
@@ -272,7 +272,7 @@ void __init puv3_core_init(void)
272 platform_device_register_simple("PKUnity-v3-UART", 1, 272 platform_device_register_simple("PKUnity-v3-UART", 1,
273 puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources)); 273 puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources));
274 platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0); 274 platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0);
275 platform_device_register_resndata(&platform_bus, "musb_hdrc", -1, 275 platform_device_register_resndata(NULL, "musb_hdrc", -1,
276 puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources), 276 puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources),
277 &puv3_usb_plat, sizeof(puv3_usb_plat)); 277 &puv3_usb_plat, sizeof(puv3_usb_plat));
278} 278}
diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c
index 0c6618e71897..46ebfdccbc31 100644
--- a/arch/unicore32/kernel/puv3-nb0916.c
+++ b/arch/unicore32/kernel/puv3-nb0916.c
@@ -112,13 +112,13 @@ int __init mach_nb0916_init(void)
112 platform_device_register_simple("PKUnity-v3-I2C", -1, 112 platform_device_register_simple("PKUnity-v3-I2C", -1,
113 puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources)); 113 puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources));
114 114
115 platform_device_register_data(&platform_bus, "pwm-backlight", -1, 115 platform_device_register_data(NULL, "pwm-backlight", -1,
116 &nb0916_backlight_data, sizeof(nb0916_backlight_data)); 116 &nb0916_backlight_data, sizeof(nb0916_backlight_data));
117 117
118 platform_device_register_data(&platform_bus, "gpio-keys", -1, 118 platform_device_register_data(NULL, "gpio-keys", -1,
119 &nb0916_gpio_button_data, sizeof(nb0916_gpio_button_data)); 119 &nb0916_gpio_button_data, sizeof(nb0916_gpio_button_data));
120 120
121 platform_device_register_resndata(&platform_bus, "physmap-flash", -1, 121 platform_device_register_resndata(NULL, "physmap-flash", -1,
122 &physmap_flash_resource, 1, 122 &physmap_flash_resource, 1,
123 &physmap_flash_data, sizeof(physmap_flash_data)); 123 &physmap_flash_data, sizeof(physmap_flash_data));
124 124
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c
index 6905f0ebdc77..780d77388dec 100644
--- a/arch/unicore32/kernel/signal.c
+++ b/arch/unicore32/kernel/signal.c
@@ -238,10 +238,10 @@ static int setup_return(struct pt_regs *regs, struct k_sigaction *ka,
238 return 0; 238 return 0;
239} 239}
240 240
241static int setup_frame(int usig, struct k_sigaction *ka, 241static int setup_frame(struct ksignal *ksig, sigset_t *set,
242 sigset_t *set, struct pt_regs *regs) 242 struct pt_regs *regs)
243{ 243{
244 struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); 244 struct sigframe __user *frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
245 int err = 0; 245 int err = 0;
246 246
247 if (!frame) 247 if (!frame)
@@ -254,29 +254,29 @@ static int setup_frame(int usig, struct k_sigaction *ka,
254 254
255 err |= setup_sigframe(frame, regs, set); 255 err |= setup_sigframe(frame, regs, set);
256 if (err == 0) 256 if (err == 0)
257 err |= setup_return(regs, ka, frame->retcode, frame, usig); 257 err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig);
258 258
259 return err; 259 return err;
260} 260}
261 261
262static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 262static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
263 sigset_t *set, struct pt_regs *regs) 263 struct pt_regs *regs)
264{ 264{
265 struct rt_sigframe __user *frame = 265 struct rt_sigframe __user *frame =
266 get_sigframe(ka, regs, sizeof(*frame)); 266 get_sigframe(&ksig->ka, regs, sizeof(*frame));
267 int err = 0; 267 int err = 0;
268 268
269 if (!frame) 269 if (!frame)
270 return 1; 270 return 1;
271 271
272 err |= copy_siginfo_to_user(&frame->info, info); 272 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
273 273
274 err |= __put_user(0, &frame->sig.uc.uc_flags); 274 err |= __put_user(0, &frame->sig.uc.uc_flags);
275 err |= __put_user(NULL, &frame->sig.uc.uc_link); 275 err |= __put_user(NULL, &frame->sig.uc.uc_link);
276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); 276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp);
277 err |= setup_sigframe(&frame->sig, regs, set); 277 err |= setup_sigframe(&frame->sig, regs, set);
278 if (err == 0) 278 if (err == 0)
279 err |= setup_return(regs, ka, frame->sig.retcode, frame, usig); 279 err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig);
280 280
281 if (err == 0) { 281 if (err == 0) {
282 /* 282 /*
@@ -299,13 +299,13 @@ static inline void setup_syscall_restart(struct pt_regs *regs)
299/* 299/*
300 * OK, we're invoking a handler 300 * OK, we're invoking a handler
301 */ 301 */
302static void handle_signal(unsigned long sig, struct k_sigaction *ka, 302static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
303 siginfo_t *info, struct pt_regs *regs, int syscall) 303 int syscall)
304{ 304{
305 struct thread_info *thread = current_thread_info(); 305 struct thread_info *thread = current_thread_info();
306 struct task_struct *tsk = current; 306 struct task_struct *tsk = current;
307 sigset_t *oldset = sigmask_to_save(); 307 sigset_t *oldset = sigmask_to_save();
308 int usig = sig; 308 int usig = ksig->sig;
309 int ret; 309 int ret;
310 310
311 /* 311 /*
@@ -318,7 +318,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
318 regs->UCreg_00 = -EINTR; 318 regs->UCreg_00 = -EINTR;
319 break; 319 break;
320 case -ERESTARTSYS: 320 case -ERESTARTSYS:
321 if (!(ka->sa.sa_flags & SA_RESTART)) { 321 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
322 regs->UCreg_00 = -EINTR; 322 regs->UCreg_00 = -EINTR;
323 break; 323 break;
324 } 324 }
@@ -338,22 +338,17 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
338 /* 338 /*
339 * Set up the stack frame 339 * Set up the stack frame
340 */ 340 */
341 if (ka->sa.sa_flags & SA_SIGINFO) 341 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
342 ret = setup_rt_frame(usig, ka, info, oldset, regs); 342 ret = setup_rt_frame(ksig, oldset, regs);
343 else 343 else
344 ret = setup_frame(usig, ka, oldset, regs); 344 ret = setup_frame(ksig, oldset, regs);
345 345
346 /* 346 /*
347 * Check that the resulting registers are actually sane. 347 * Check that the resulting registers are actually sane.
348 */ 348 */
349 ret |= !valid_user_regs(regs); 349 ret |= !valid_user_regs(regs);
350 350
351 if (ret != 0) { 351 signal_setup_done(ret, ksig, 0);
352 force_sigsegv(sig, tsk);
353 return;
354 }
355
356 signal_delivered(sig, info, ka, regs, 0);
357} 352}
358 353
359/* 354/*
@@ -367,9 +362,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka,
367 */ 362 */
368static void do_signal(struct pt_regs *regs, int syscall) 363static void do_signal(struct pt_regs *regs, int syscall)
369{ 364{
370 struct k_sigaction ka; 365 struct ksignal ksig;
371 siginfo_t info;
372 int signr;
373 366
374 /* 367 /*
375 * We want the common case to go fast, which 368 * We want the common case to go fast, which
@@ -380,9 +373,8 @@ static void do_signal(struct pt_regs *regs, int syscall)
380 if (!user_mode(regs)) 373 if (!user_mode(regs))
381 return; 374 return;
382 375
383 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 376 if (get_signsl(&ksig)) {
384 if (signr > 0) { 377 handle_signal(&ksig, regs, syscall);
385 handle_signal(signr, &ka, &info, regs, syscall);
386 return; 378 return;
387 } 379 }
388 380
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index e5287d8517aa..61b6d51866f8 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -16,3 +16,7 @@ obj-$(CONFIG_IA32_EMULATION) += ia32/
16 16
17obj-y += platform/ 17obj-y += platform/
18obj-y += net/ 18obj-y += net/
19
20ifeq ($(CONFIG_X86_64),y)
21obj-$(CONFIG_KEXEC) += purgatory/
22endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6b71f0417293..5d0bf1aa9dcb 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -21,6 +21,7 @@ config X86_64
21### Arch settings 21### Arch settings
22config X86 22config X86
23 def_bool y 23 def_bool y
24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
24 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
25 select ARCH_MIGHT_HAVE_PC_PARPORT 26 select ARCH_MIGHT_HAVE_PC_PARPORT
26 select ARCH_MIGHT_HAVE_PC_SERIO 27 select ARCH_MIGHT_HAVE_PC_SERIO
@@ -95,6 +96,7 @@ config X86
95 select IRQ_FORCED_THREADING 96 select IRQ_FORCED_THREADING
96 select HAVE_BPF_JIT if X86_64 97 select HAVE_BPF_JIT if X86_64
97 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 98 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
99 select ARCH_HAS_SG_CHAIN
98 select CLKEVT_I8253 100 select CLKEVT_I8253
99 select ARCH_HAVE_NMI_SAFE_CMPXCHG 101 select ARCH_HAVE_NMI_SAFE_CMPXCHG
100 select GENERIC_IOMAP 102 select GENERIC_IOMAP
@@ -108,9 +110,9 @@ config X86
108 select CLOCKSOURCE_WATCHDOG 110 select CLOCKSOURCE_WATCHDOG
109 select GENERIC_CLOCKEVENTS 111 select GENERIC_CLOCKEVENTS
110 select ARCH_CLOCKSOURCE_DATA 112 select ARCH_CLOCKSOURCE_DATA
113 select CLOCKSOURCE_VALIDATE_LAST_CYCLE
111 select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC) 114 select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC)
112 select GENERIC_TIME_VSYSCALL 115 select GENERIC_TIME_VSYSCALL
113 select KTIME_SCALAR if X86_32
114 select GENERIC_STRNCPY_FROM_USER 116 select GENERIC_STRNCPY_FROM_USER
115 select GENERIC_STRNLEN_USER 117 select GENERIC_STRNLEN_USER
116 select HAVE_CONTEXT_TRACKING if X86_64 118 select HAVE_CONTEXT_TRACKING if X86_64
@@ -133,6 +135,7 @@ config X86
133 select ARCH_SUPPORTS_ATOMIC_RMW 135 select ARCH_SUPPORTS_ATOMIC_RMW
134 select HAVE_ACPI_APEI if ACPI 136 select HAVE_ACPI_APEI if ACPI
135 select HAVE_ACPI_APEI_NMI if ACPI 137 select HAVE_ACPI_APEI_NMI if ACPI
138 select ACPI_LEGACY_TABLES_LOOKUP if ACPI
136 139
137config INSTRUCTION_DECODER 140config INSTRUCTION_DECODER
138 def_bool y 141 def_bool y
@@ -431,6 +434,7 @@ config X86_INTEL_CE
431 bool "CE4100 TV platform" 434 bool "CE4100 TV platform"
432 depends on PCI 435 depends on PCI
433 depends on PCI_GODIRECT 436 depends on PCI_GODIRECT
437 depends on X86_IO_APIC
434 depends on X86_32 438 depends on X86_32
435 depends on X86_EXTENDED_PLATFORM 439 depends on X86_EXTENDED_PLATFORM
436 select X86_REBOOTFIXUPS 440 select X86_REBOOTFIXUPS
@@ -837,6 +841,7 @@ config X86_IO_APIC
837 def_bool y 841 def_bool y
838 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI 842 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
839 select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ 843 select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
844 select IRQ_DOMAIN
840 845
841config X86_REROUTE_FOR_BROKEN_BOOT_IRQS 846config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
842 bool "Reroute for broken boot IRQs" 847 bool "Reroute for broken boot IRQs"
@@ -1538,7 +1543,8 @@ config EFI
1538 1543
1539config EFI_STUB 1544config EFI_STUB
1540 bool "EFI stub support" 1545 bool "EFI stub support"
1541 depends on EFI 1546 depends on EFI && !X86_USE_3DNOW
1547 select RELOCATABLE
1542 ---help--- 1548 ---help---
1543 This kernel feature allows a bzImage to be loaded directly 1549 This kernel feature allows a bzImage to be loaded directly
1544 by EFI firmware without the use of a bootloader. 1550 by EFI firmware without the use of a bootloader.
@@ -1579,6 +1585,9 @@ source kernel/Kconfig.hz
1579 1585
1580config KEXEC 1586config KEXEC
1581 bool "kexec system call" 1587 bool "kexec system call"
1588 select BUILD_BIN2C
1589 select CRYPTO
1590 select CRYPTO_SHA256
1582 ---help--- 1591 ---help---
1583 kexec is a system call that implements the ability to shutdown your 1592 kexec is a system call that implements the ability to shutdown your
1584 current kernel, and to start another kernel. It is like a reboot 1593 current kernel, and to start another kernel. It is like a reboot
@@ -1593,6 +1602,28 @@ config KEXEC
1593 interface is strongly in flux, so no good recommendation can be 1602 interface is strongly in flux, so no good recommendation can be
1594 made. 1603 made.
1595 1604
1605config KEXEC_VERIFY_SIG
1606 bool "Verify kernel signature during kexec_file_load() syscall"
1607 depends on KEXEC
1608 ---help---
1609 This option makes kernel signature verification mandatory for
1610 kexec_file_load() syscall. If kernel is signature can not be
1611 verified, kexec_file_load() will fail.
1612
1613 This option enforces signature verification at generic level.
1614 One needs to enable signature verification for type of kernel
1615 image being loaded to make sure it works. For example, enable
1616 bzImage signature verification option to be able to load and
1617 verify signatures of bzImage. Otherwise kernel loading will fail.
1618
1619config KEXEC_BZIMAGE_VERIFY_SIG
1620 bool "Enable bzImage signature verification support"
1621 depends on KEXEC_VERIFY_SIG
1622 depends on SIGNED_PE_FILE_VERIFICATION
1623 select SYSTEM_TRUSTED_KEYRING
1624 ---help---
1625 Enable bzImage signature verification support.
1626
1596config CRASH_DUMP 1627config CRASH_DUMP
1597 bool "kernel crash dumps" 1628 bool "kernel crash dumps"
1598 depends on X86_64 || (X86_32 && HIGHMEM) 1629 depends on X86_64 || (X86_32 && HIGHMEM)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index c65fd9650467..c1aa36887843 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -183,6 +183,14 @@ archscripts: scripts_basic
183archheaders: 183archheaders:
184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all 184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all
185 185
186archprepare:
187ifeq ($(CONFIG_KEXEC),y)
188# Build only for 64bit. No loaders for 32bit yet.
189 ifeq ($(CONFIG_X86_64),y)
190 $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c
191 endif
192endif
193
186### 194###
187# Kernel objects 195# Kernel objects
188 196
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 3ca9762e1649..3bf000fab0ae 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -5,6 +5,7 @@ genhdr-y += unistd_64.h
5genhdr-y += unistd_x32.h 5genhdr-y += unistd_x32.h
6 6
7generic-y += clkdev.h 7generic-y += clkdev.h
8generic-y += early_ioremap.h
9generic-y += cputime.h 8generic-y += cputime.h
9generic-y += early_ioremap.h
10generic-y += mcs_spinlock.h 10generic-y += mcs_spinlock.h
11generic-y += scatterlist.h
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 66873297e9f5..1b010a859b8b 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -18,8 +18,6 @@
18 18
19#define ACPI_FLUSH_CPU_CACHE() wbinvd() 19#define ACPI_FLUSH_CPU_CACHE() wbinvd()
20 20
21#ifdef CONFIG_ACPI
22
23int __acpi_acquire_global_lock(unsigned int *lock); 21int __acpi_acquire_global_lock(unsigned int *lock);
24int __acpi_release_global_lock(unsigned int *lock); 22int __acpi_release_global_lock(unsigned int *lock);
25 23
@@ -44,6 +42,4 @@ int __acpi_release_global_lock(unsigned int *lock);
44 : "=r"(n_hi), "=r"(n_lo) \ 42 : "=r"(n_hi), "=r"(n_lo) \
45 : "0"(n_hi), "1"(n_lo)) 43 : "0"(n_hi), "1"(n_lo))
46 44
47#endif
48
49#endif /* _ASM_X86_ACENV_H */ 45#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index e06225eda635..0ab4f9fd2687 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -121,6 +121,11 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf)
121 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH); 121 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
122} 122}
123 123
124static inline bool acpi_has_cpu_in_madt(void)
125{
126 return !!acpi_lapic;
127}
128
124#else /* !CONFIG_ACPI */ 129#else /* !CONFIG_ACPI */
125 130
126#define acpi_lapic 0 131#define acpi_lapic 0
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 0a3f9c9f98d5..473bdbee378a 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -161,6 +161,20 @@ static inline int alternatives_text_reserved(void *start, void *end)
161 asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ 161 asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
162 : : "i" (0), ## input) 162 : : "i" (0), ## input)
163 163
164/*
165 * This is similar to alternative_input. But it has two features and
166 * respective instructions.
167 *
168 * If CPU has feature2, newinstr2 is used.
169 * Otherwise, if CPU has feature1, newinstr1 is used.
170 * Otherwise, oldinstr is used.
171 */
172#define alternative_input_2(oldinstr, newinstr1, feature1, newinstr2, \
173 feature2, input...) \
174 asm volatile(ALTERNATIVE_2(oldinstr, newinstr1, feature1, \
175 newinstr2, feature2) \
176 : : "i" (0), ## input)
177
164/* Like alternative_input, but with a single output argument */ 178/* Like alternative_input, but with a single output argument */
165#define alternative_io(oldinstr, newinstr, feature, output, input...) \ 179#define alternative_io(oldinstr, newinstr, feature, output, input...) \
166 asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ 180 asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 79752f2bdec5..465b309af254 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -85,14 +85,6 @@ static inline bool apic_from_smp_config(void)
85#include <asm/paravirt.h> 85#include <asm/paravirt.h>
86#endif 86#endif
87 87
88#ifdef CONFIG_X86_64
89extern int is_vsmp_box(void);
90#else
91static inline int is_vsmp_box(void)
92{
93 return 0;
94}
95#endif
96extern int setup_profiling_timer(unsigned int); 88extern int setup_profiling_timer(unsigned int);
97 89
98static inline void native_apic_mem_write(u32 reg, u32 v) 90static inline void native_apic_mem_write(u32 reg, u32 v)
@@ -300,7 +292,6 @@ struct apic {
300 292
301 int dest_logical; 293 int dest_logical;
302 unsigned long (*check_apicid_used)(physid_mask_t *map, int apicid); 294 unsigned long (*check_apicid_used)(physid_mask_t *map, int apicid);
303 unsigned long (*check_apicid_present)(int apicid);
304 295
305 void (*vector_allocation_domain)(int cpu, struct cpumask *retmask, 296 void (*vector_allocation_domain)(int cpu, struct cpumask *retmask,
306 const struct cpumask *mask); 297 const struct cpumask *mask);
@@ -309,21 +300,11 @@ struct apic {
309 void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap); 300 void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap);
310 301
311 void (*setup_apic_routing)(void); 302 void (*setup_apic_routing)(void);
312 int (*multi_timer_check)(int apic, int irq);
313 int (*cpu_present_to_apicid)(int mps_cpu); 303 int (*cpu_present_to_apicid)(int mps_cpu);
314 void (*apicid_to_cpu_present)(int phys_apicid, physid_mask_t *retmap); 304 void (*apicid_to_cpu_present)(int phys_apicid, physid_mask_t *retmap);
315 void (*setup_portio_remap)(void);
316 int (*check_phys_apicid_present)(int phys_apicid); 305 int (*check_phys_apicid_present)(int phys_apicid);
317 void (*enable_apic_mode)(void);
318 int (*phys_pkg_id)(int cpuid_apic, int index_msb); 306 int (*phys_pkg_id)(int cpuid_apic, int index_msb);
319 307
320 /*
321 * When one of the next two hooks returns 1 the apic
322 * is switched to this. Essentially they are additional
323 * probe functions:
324 */
325 int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid);
326
327 unsigned int (*get_apic_id)(unsigned long x); 308 unsigned int (*get_apic_id)(unsigned long x);
328 unsigned long (*set_apic_id)(unsigned int id); 309 unsigned long (*set_apic_id)(unsigned int id);
329 unsigned long apic_id_mask; 310 unsigned long apic_id_mask;
@@ -343,11 +324,7 @@ struct apic {
343 /* wakeup_secondary_cpu */ 324 /* wakeup_secondary_cpu */
344 int (*wakeup_secondary_cpu)(int apicid, unsigned long start_eip); 325 int (*wakeup_secondary_cpu)(int apicid, unsigned long start_eip);
345 326
346 int trampoline_phys_low;
347 int trampoline_phys_high;
348
349 bool wait_for_init_deassert; 327 bool wait_for_init_deassert;
350 void (*smp_callin_clear_local_apic)(void);
351 void (*inquire_remote_apic)(int apicid); 328 void (*inquire_remote_apic)(int apicid);
352 329
353 /* apic ops */ 330 /* apic ops */
@@ -378,14 +355,6 @@ struct apic {
378 * won't be applied properly during early boot in this case. 355 * won't be applied properly during early boot in this case.
379 */ 356 */
380 int (*x86_32_early_logical_apicid)(int cpu); 357 int (*x86_32_early_logical_apicid)(int cpu);
381
382 /*
383 * Optional method called from setup_local_APIC() after logical
384 * apicid is guaranteed to be known to initialize apicid -> node
385 * mapping if NUMA initialization hasn't done so already. Don't
386 * add new users.
387 */
388 int (*x86_32_numa_cpu_node)(int cpu);
389#endif 358#endif
390}; 359};
391 360
@@ -496,14 +465,12 @@ static inline unsigned default_get_apic_id(unsigned long x)
496} 465}
497 466
498/* 467/*
499 * Warm reset vector default position: 468 * Warm reset vector position:
500 */ 469 */
501#define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467 470#define TRAMPOLINE_PHYS_LOW 0x467
502#define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 471#define TRAMPOLINE_PHYS_HIGH 0x469
503 472
504#ifdef CONFIG_X86_64 473#ifdef CONFIG_X86_64
505extern int default_acpi_madt_oem_check(char *, char *);
506
507extern void apic_send_IPI_self(int vector); 474extern void apic_send_IPI_self(int vector);
508 475
509DECLARE_PER_CPU(int, x2apic_extra_bits); 476DECLARE_PER_CPU(int, x2apic_extra_bits);
@@ -552,6 +519,8 @@ static inline int default_apic_id_valid(int apicid)
552 return (apicid < 255); 519 return (apicid < 255);
553} 520}
554 521
522extern int default_acpi_madt_oem_check(char *, char *);
523
555extern void default_setup_apic_routing(void); 524extern void default_setup_apic_routing(void);
556 525
557extern struct apic apic_noop; 526extern struct apic apic_noop;
@@ -635,11 +604,6 @@ static inline unsigned long default_check_apicid_used(physid_mask_t *map, int ap
635 return physid_isset(apicid, *map); 604 return physid_isset(apicid, *map);
636} 605}
637 606
638static inline unsigned long default_check_apicid_present(int bit)
639{
640 return physid_isset(bit, phys_cpu_present_map);
641}
642
643static inline void default_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap) 607static inline void default_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap)
644{ 608{
645 *retmap = *phys_map; 609 *retmap = *phys_map;
diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h
new file mode 100644
index 000000000000..f498411f2500
--- /dev/null
+++ b/arch/x86/include/asm/crash.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_X86_CRASH_H
2#define _ASM_X86_CRASH_H
3
4int crash_load_segments(struct kimage *image);
5int crash_copy_backup_region(struct kimage *image);
6int crash_setup_memmap_entries(struct kimage *image,
7 struct boot_params *params);
8
9#endif /* _ASM_X86_CRASH_H */
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index e3b85422cf12..412ececa00b9 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -508,9 +508,12 @@ static inline void user_fpu_begin(void)
508 508
509static inline void __save_fpu(struct task_struct *tsk) 509static inline void __save_fpu(struct task_struct *tsk)
510{ 510{
511 if (use_xsave()) 511 if (use_xsave()) {
512 xsave_state(&tsk->thread.fpu.state->xsave, -1); 512 if (unlikely(system_state == SYSTEM_BOOTING))
513 else 513 xsave_state_booting(&tsk->thread.fpu.state->xsave, -1);
514 else
515 xsave_state(&tsk->thread.fpu.state->xsave, -1);
516 } else
514 fpu_fxsave(&tsk->thread.fpu); 517 fpu_fxsave(&tsk->thread.fpu);
515} 518}
516 519
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 230853da4ec0..0f5fb6b6567e 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -40,9 +40,6 @@ typedef struct {
40 40
41DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); 41DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
42 42
43/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
44#define MAX_HARDIRQS_PER_CPU NR_VECTORS
45
46#define __ARCH_IRQ_STAT 43#define __ARCH_IRQ_STAT
47 44
48#define inc_irq_stat(member) this_cpu_inc(irq_stat.member) 45#define inc_irq_stat(member) this_cpu_inc(irq_stat.member)
diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
index a20365953bf8..ccffa53750a8 100644
--- a/arch/x86/include/asm/i8259.h
+++ b/arch/x86/include/asm/i8259.h
@@ -67,4 +67,9 @@ struct legacy_pic {
67extern struct legacy_pic *legacy_pic; 67extern struct legacy_pic *legacy_pic;
68extern struct legacy_pic null_legacy_pic; 68extern struct legacy_pic null_legacy_pic;
69 69
70static inline int nr_legacy_irqs(void)
71{
72 return legacy_pic->nr_legacy_irqs;
73}
74
70#endif /* _ASM_X86_I8259_H */ 75#endif /* _ASM_X86_I8259_H */
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 90f97b4b9347..0aeed5ca356e 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -98,6 +98,8 @@ struct IR_IO_APIC_route_entry {
98#define IOAPIC_AUTO -1 98#define IOAPIC_AUTO -1
99#define IOAPIC_EDGE 0 99#define IOAPIC_EDGE 0
100#define IOAPIC_LEVEL 1 100#define IOAPIC_LEVEL 1
101#define IOAPIC_MAP_ALLOC 0x1
102#define IOAPIC_MAP_CHECK 0x2
101 103
102#ifdef CONFIG_X86_IO_APIC 104#ifdef CONFIG_X86_IO_APIC
103 105
@@ -118,9 +120,6 @@ extern int mp_irq_entries;
118/* MP IRQ source entries */ 120/* MP IRQ source entries */
119extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; 121extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES];
120 122
121/* non-0 if default (table-less) MP configuration */
122extern int mpc_default_type;
123
124/* Older SiS APIC requires we rewrite the index register */ 123/* Older SiS APIC requires we rewrite the index register */
125extern int sis_apic_bug; 124extern int sis_apic_bug;
126 125
@@ -133,9 +132,6 @@ extern int noioapicquirk;
133/* -1 if "noapic" boot option passed */ 132/* -1 if "noapic" boot option passed */
134extern int noioapicreroute; 133extern int noioapicreroute;
135 134
136/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
137extern int timer_through_8259;
138
139/* 135/*
140 * If we use the IO-APIC for IRQ routing, disable automatic 136 * If we use the IO-APIC for IRQ routing, disable automatic
141 * assignment of PCI IRQ's. 137 * assignment of PCI IRQ's.
@@ -145,24 +141,17 @@ extern int timer_through_8259;
145 141
146struct io_apic_irq_attr; 142struct io_apic_irq_attr;
147struct irq_cfg; 143struct irq_cfg;
148extern int io_apic_set_pci_routing(struct device *dev, int irq,
149 struct io_apic_irq_attr *irq_attr);
150void setup_IO_APIC_irq_extra(u32 gsi);
151extern void ioapic_insert_resources(void); 144extern void ioapic_insert_resources(void);
152 145
153extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *, 146extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *,
154 unsigned int, int, 147 unsigned int, int,
155 struct io_apic_irq_attr *); 148 struct io_apic_irq_attr *);
156extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *,
157 unsigned int, int,
158 struct io_apic_irq_attr *);
159extern void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg); 149extern void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg);
160 150
161extern void native_compose_msi_msg(struct pci_dev *pdev, 151extern void native_compose_msi_msg(struct pci_dev *pdev,
162 unsigned int irq, unsigned int dest, 152 unsigned int irq, unsigned int dest,
163 struct msi_msg *msg, u8 hpet_id); 153 struct msi_msg *msg, u8 hpet_id);
164extern void native_eoi_ioapic_pin(int apic, int pin, int vector); 154extern void native_eoi_ioapic_pin(int apic, int pin, int vector);
165int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr);
166 155
167extern int save_ioapic_entries(void); 156extern int save_ioapic_entries(void);
168extern void mask_ioapic_entries(void); 157extern void mask_ioapic_entries(void);
@@ -171,15 +160,40 @@ extern int restore_ioapic_entries(void);
171extern void setup_ioapic_ids_from_mpc(void); 160extern void setup_ioapic_ids_from_mpc(void);
172extern void setup_ioapic_ids_from_mpc_nocheck(void); 161extern void setup_ioapic_ids_from_mpc_nocheck(void);
173 162
163enum ioapic_domain_type {
164 IOAPIC_DOMAIN_INVALID,
165 IOAPIC_DOMAIN_LEGACY,
166 IOAPIC_DOMAIN_STRICT,
167 IOAPIC_DOMAIN_DYNAMIC,
168};
169
170struct device_node;
171struct irq_domain;
172struct irq_domain_ops;
173
174struct ioapic_domain_cfg {
175 enum ioapic_domain_type type;
176 const struct irq_domain_ops *ops;
177 struct device_node *dev;
178};
179
174struct mp_ioapic_gsi{ 180struct mp_ioapic_gsi{
175 u32 gsi_base; 181 u32 gsi_base;
176 u32 gsi_end; 182 u32 gsi_end;
177}; 183};
178extern struct mp_ioapic_gsi mp_gsi_routing[];
179extern u32 gsi_top; 184extern u32 gsi_top;
180int mp_find_ioapic(u32 gsi); 185
181int mp_find_ioapic_pin(int ioapic, u32 gsi); 186extern int mp_find_ioapic(u32 gsi);
182void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); 187extern int mp_find_ioapic_pin(int ioapic, u32 gsi);
188extern u32 mp_pin_to_gsi(int ioapic, int pin);
189extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags);
190extern void mp_unmap_irq(int irq);
191extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base,
192 struct ioapic_domain_cfg *cfg);
193extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
194 irq_hw_number_t hwirq);
195extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq);
196extern int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node);
183extern void __init pre_init_apic_IRQ0(void); 197extern void __init pre_init_apic_IRQ0(void);
184 198
185extern void mp_save_irq(struct mpc_intsrc *m); 199extern void mp_save_irq(struct mpc_intsrc *m);
@@ -217,14 +231,12 @@ extern void io_apic_eoi(unsigned int apic, unsigned int vector);
217 231
218#define io_apic_assign_pci_irqs 0 232#define io_apic_assign_pci_irqs 0
219#define setup_ioapic_ids_from_mpc x86_init_noop 233#define setup_ioapic_ids_from_mpc x86_init_noop
220static const int timer_through_8259 = 0;
221static inline void ioapic_insert_resources(void) { } 234static inline void ioapic_insert_resources(void) { }
222#define gsi_top (NR_IRQS_LEGACY) 235#define gsi_top (NR_IRQS_LEGACY)
223static inline int mp_find_ioapic(u32 gsi) { return 0; } 236static inline int mp_find_ioapic(u32 gsi) { return 0; }
224 237static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; }
225struct io_apic_irq_attr; 238static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; }
226static inline int io_apic_set_pci_routing(struct device *dev, int irq, 239static inline void mp_unmap_irq(int irq) { }
227 struct io_apic_irq_attr *irq_attr) { return 0; }
228 240
229static inline int save_ioapic_entries(void) 241static inline int save_ioapic_entries(void)
230{ 242{
diff --git a/arch/x86/include/asm/kexec-bzimage64.h b/arch/x86/include/asm/kexec-bzimage64.h
new file mode 100644
index 000000000000..d1b5d194e31d
--- /dev/null
+++ b/arch/x86/include/asm/kexec-bzimage64.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_KEXEC_BZIMAGE64_H
2#define _ASM_KEXEC_BZIMAGE64_H
3
4extern struct kexec_file_ops kexec_bzImage64_ops;
5
6#endif /* _ASM_KEXE_BZIMAGE64_H */
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index 17483a492f18..d2434c1cad05 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -23,6 +23,9 @@
23 23
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/ptrace.h> 25#include <asm/ptrace.h>
26#include <asm/bootparam.h>
27
28struct kimage;
26 29
27/* 30/*
28 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. 31 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
@@ -61,6 +64,10 @@
61# define KEXEC_ARCH KEXEC_ARCH_X86_64 64# define KEXEC_ARCH KEXEC_ARCH_X86_64
62#endif 65#endif
63 66
67/* Memory to backup during crash kdump */
68#define KEXEC_BACKUP_SRC_START (0UL)
69#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */
70
64/* 71/*
65 * CPU does not save ss and sp on stack if execution is already 72 * CPU does not save ss and sp on stack if execution is already
66 * running in kernel mode at the time of NMI occurrence. This code 73 * running in kernel mode at the time of NMI occurrence. This code
@@ -160,6 +167,44 @@ struct kimage_arch {
160 pud_t *pud; 167 pud_t *pud;
161 pmd_t *pmd; 168 pmd_t *pmd;
162 pte_t *pte; 169 pte_t *pte;
170 /* Details of backup region */
171 unsigned long backup_src_start;
172 unsigned long backup_src_sz;
173
174 /* Physical address of backup segment */
175 unsigned long backup_load_addr;
176
177 /* Core ELF header buffer */
178 void *elf_headers;
179 unsigned long elf_headers_sz;
180 unsigned long elf_load_addr;
181};
182#endif /* CONFIG_X86_32 */
183
184#ifdef CONFIG_X86_64
185/*
186 * Number of elements and order of elements in this structure should match
187 * with the ones in arch/x86/purgatory/entry64.S. If you make a change here
188 * make an appropriate change in purgatory too.
189 */
190struct kexec_entry64_regs {
191 uint64_t rax;
192 uint64_t rcx;
193 uint64_t rdx;
194 uint64_t rbx;
195 uint64_t rsp;
196 uint64_t rbp;
197 uint64_t rsi;
198 uint64_t rdi;
199 uint64_t r8;
200 uint64_t r9;
201 uint64_t r10;
202 uint64_t r11;
203 uint64_t r12;
204 uint64_t r13;
205 uint64_t r14;
206 uint64_t r15;
207 uint64_t rip;
163}; 208};
164#endif 209#endif
165 210
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index f5a617956735..b07233b64578 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -40,8 +40,6 @@ extern int mp_bus_id_to_type[MAX_MP_BUSSES];
40extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); 40extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
41 41
42extern unsigned int boot_cpu_physical_apicid; 42extern unsigned int boot_cpu_physical_apicid;
43extern unsigned int max_physical_apicid;
44extern int mpc_default_type;
45extern unsigned long mp_lapic_addr; 43extern unsigned long mp_lapic_addr;
46 44
47#ifdef CONFIG_X86_LOCAL_APIC 45#ifdef CONFIG_X86_LOCAL_APIC
@@ -88,15 +86,6 @@ static inline void early_reserve_e820_mpc_new(void) { }
88#endif 86#endif
89 87
90int generic_processor_info(int apicid, int version); 88int generic_processor_info(int apicid, int version);
91#ifdef CONFIG_ACPI
92extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
93extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
94 u32 gsi);
95extern void mp_config_acpi_legacy_irqs(void);
96struct device;
97extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level,
98 int active_high_low);
99#endif /* CONFIG_ACPI */
100 89
101#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC) 90#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC)
102 91
@@ -161,8 +150,4 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
161 150
162extern physid_mask_t phys_cpu_present_map; 151extern physid_mask_t phys_cpu_present_map;
163 152
164extern int generic_mps_oem_check(struct mpc_table *, char *, char *);
165
166extern int default_acpi_madt_oem_check(char *, char *);
167
168#endif /* _ASM_X86_MPSPEC_H */ 153#endif /* _ASM_X86_MPSPEC_H */
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index 775873d3be55..802dde30c928 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -70,7 +70,6 @@ extern bool __virt_addr_valid(unsigned long kaddr);
70#include <asm-generic/memory_model.h> 70#include <asm-generic/memory_model.h>
71#include <asm-generic/getorder.h> 71#include <asm-generic/getorder.h>
72 72
73#define __HAVE_ARCH_GATE_AREA 1
74#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 73#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
75 74
76#endif /* __KERNEL__ */ 75#endif /* __KERNEL__ */
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
index 0f1ddee6a0ce..f408caf73430 100644
--- a/arch/x86/include/asm/page_64.h
+++ b/arch/x86/include/asm/page_64.h
@@ -39,4 +39,6 @@ void copy_page(void *to, void *from);
39 39
40#endif /* !__ASSEMBLY__ */ 40#endif /* !__ASSEMBLY__ */
41 41
42#define __HAVE_ARCH_GATE_AREA 1
43
42#endif /* _ASM_X86_PAGE_64_H */ 44#endif /* _ASM_X86_PAGE_64_H */
diff --git a/arch/x86/include/asm/platform_sst_audio.h b/arch/x86/include/asm/platform_sst_audio.h
new file mode 100644
index 000000000000..0a4e140315b6
--- /dev/null
+++ b/arch/x86/include/asm/platform_sst_audio.h
@@ -0,0 +1,78 @@
1/*
2 * platform_sst_audio.h: sst audio platform data header file
3 *
4 * Copyright (C) 2012-14 Intel Corporation
5 * Author: Jeeja KP <jeeja.kp@intel.com>
6 * Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
7 * Vinod Koul ,vinod.koul@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; version 2
12 * of the License.
13 */
14#ifndef _PLATFORM_SST_AUDIO_H_
15#define _PLATFORM_SST_AUDIO_H_
16
17#include <linux/sfi.h>
18
19enum sst_audio_task_id_mrfld {
20 SST_TASK_ID_NONE = 0,
21 SST_TASK_ID_SBA = 1,
22 SST_TASK_ID_MEDIA = 3,
23 SST_TASK_ID_MAX = SST_TASK_ID_MEDIA,
24};
25
26/* Device IDs for Merrifield are Pipe IDs,
27 * ref: DSP spec v0.75 */
28enum sst_audio_device_id_mrfld {
29 /* Output pipeline IDs */
30 PIPE_ID_OUT_START = 0x0,
31 PIPE_CODEC_OUT0 = 0x2,
32 PIPE_CODEC_OUT1 = 0x3,
33 PIPE_SPROT_LOOP_OUT = 0x4,
34 PIPE_MEDIA_LOOP1_OUT = 0x5,
35 PIPE_MEDIA_LOOP2_OUT = 0x6,
36 PIPE_VOIP_OUT = 0xC,
37 PIPE_PCM0_OUT = 0xD,
38 PIPE_PCM1_OUT = 0xE,
39 PIPE_PCM2_OUT = 0xF,
40 PIPE_MEDIA0_OUT = 0x12,
41 PIPE_MEDIA1_OUT = 0x13,
42/* Input Pipeline IDs */
43 PIPE_ID_IN_START = 0x80,
44 PIPE_CODEC_IN0 = 0x82,
45 PIPE_CODEC_IN1 = 0x83,
46 PIPE_SPROT_LOOP_IN = 0x84,
47 PIPE_MEDIA_LOOP1_IN = 0x85,
48 PIPE_MEDIA_LOOP2_IN = 0x86,
49 PIPE_VOIP_IN = 0x8C,
50 PIPE_PCM0_IN = 0x8D,
51 PIPE_PCM1_IN = 0x8E,
52 PIPE_MEDIA0_IN = 0x8F,
53 PIPE_MEDIA1_IN = 0x90,
54 PIPE_MEDIA2_IN = 0x91,
55 PIPE_RSVD = 0xFF,
56};
57
58/* The stream map for each platform consists of an array of the below
59 * stream map structure.
60 */
61struct sst_dev_stream_map {
62 u8 dev_num; /* device id */
63 u8 subdev_num; /* substream */
64 u8 direction;
65 u8 device_id; /* fw id */
66 u8 task_id; /* fw task */
67 u8 status;
68};
69
70struct sst_platform_data {
71 /* Intel software platform id*/
72 struct sst_dev_stream_map *pdev_strm_map;
73 unsigned int strm_map_size;
74};
75
76int add_sst_platform_device(void);
77#endif
78
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index ee30b9f0b91c..eb71ec794732 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -385,8 +385,8 @@ struct bndcsr_struct {
385 385
386struct xsave_hdr_struct { 386struct xsave_hdr_struct {
387 u64 xstate_bv; 387 u64 xstate_bv;
388 u64 reserved1[2]; 388 u64 xcomp_bv;
389 u64 reserved2[5]; 389 u64 reserved[6];
390} __attribute__((packed)); 390} __attribute__((packed));
391 391
392struct xsave_struct { 392struct xsave_struct {
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h
index fbeb06ed0eaa..1d081ac1cd69 100644
--- a/arch/x86/include/asm/prom.h
+++ b/arch/x86/include/asm/prom.h
@@ -26,12 +26,10 @@
26extern int of_ioapic; 26extern int of_ioapic;
27extern u64 initial_dtb; 27extern u64 initial_dtb;
28extern void add_dtb(u64 data); 28extern void add_dtb(u64 data);
29extern void x86_add_irq_domains(void);
30void x86_of_pci_init(void); 29void x86_of_pci_init(void);
31void x86_dtb_init(void); 30void x86_dtb_init(void);
32#else 31#else
33static inline void add_dtb(u64 data) { } 32static inline void add_dtb(u64 data) { }
34static inline void x86_add_irq_domains(void) { }
35static inline void x86_of_pci_init(void) { } 33static inline void x86_of_pci_init(void) { }
36static inline void x86_dtb_init(void) { } 34static inline void x86_dtb_init(void) { }
37#define of_ioapic 0 35#define of_ioapic 0
diff --git a/arch/x86/include/asm/scatterlist.h b/arch/x86/include/asm/scatterlist.h
deleted file mode 100644
index 4240878b9d76..000000000000
--- a/arch/x86/include/asm/scatterlist.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_X86_SCATTERLIST_H
2#define _ASM_X86_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#define ARCH_HAS_SG_CHAIN
7
8#endif /* _ASM_X86_SCATTERLIST_H */
diff --git a/arch/x86/include/asm/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h
index 49adfd7bb4a4..0da7409f0bec 100644
--- a/arch/x86/include/asm/smpboot_hooks.h
+++ b/arch/x86/include/asm/smpboot_hooks.h
@@ -17,11 +17,11 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
17 spin_unlock_irqrestore(&rtc_lock, flags); 17 spin_unlock_irqrestore(&rtc_lock, flags);
18 local_flush_tlb(); 18 local_flush_tlb();
19 pr_debug("1.\n"); 19 pr_debug("1.\n");
20 *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) = 20 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) =
21 start_eip >> 4; 21 start_eip >> 4;
22 pr_debug("2.\n"); 22 pr_debug("2.\n");
23 *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) = 23 *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) =
24 start_eip & 0xf; 24 start_eip & 0xf;
25 pr_debug("3.\n"); 25 pr_debug("3.\n");
26} 26}
27 27
@@ -42,7 +42,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
42 CMOS_WRITE(0, 0xf); 42 CMOS_WRITE(0, 0xf);
43 spin_unlock_irqrestore(&rtc_lock, flags); 43 spin_unlock_irqrestore(&rtc_lock, flags);
44 44
45 *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0; 45 *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
46} 46}
47 47
48static inline void __init smpboot_setup_io_apic(void) 48static inline void __init smpboot_setup_io_apic(void)
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h
index d949ef28c48b..7e7a79ada658 100644
--- a/arch/x86/include/asm/xsave.h
+++ b/arch/x86/include/asm/xsave.h
@@ -52,24 +52,170 @@ extern void xsave_init(void);
52extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask); 52extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
53extern int init_fpu(struct task_struct *child); 53extern int init_fpu(struct task_struct *child);
54 54
55static inline int fpu_xrstor_checking(struct xsave_struct *fx) 55/* These macros all use (%edi)/(%rdi) as the single memory argument. */
56#define XSAVE ".byte " REX_PREFIX "0x0f,0xae,0x27"
57#define XSAVEOPT ".byte " REX_PREFIX "0x0f,0xae,0x37"
58#define XSAVES ".byte " REX_PREFIX "0x0f,0xc7,0x2f"
59#define XRSTOR ".byte " REX_PREFIX "0x0f,0xae,0x2f"
60#define XRSTORS ".byte " REX_PREFIX "0x0f,0xc7,0x1f"
61
62#define xstate_fault ".section .fixup,\"ax\"\n" \
63 "3: movl $-1,%[err]\n" \
64 " jmp 2b\n" \
65 ".previous\n" \
66 _ASM_EXTABLE(1b, 3b) \
67 : [err] "=r" (err)
68
69/*
70 * This function is called only during boot time when x86 caps are not set
71 * up and alternative can not be used yet.
72 */
73static inline int xsave_state_booting(struct xsave_struct *fx, u64 mask)
56{ 74{
57 int err; 75 u32 lmask = mask;
76 u32 hmask = mask >> 32;
77 int err = 0;
78
79 WARN_ON(system_state != SYSTEM_BOOTING);
80
81 if (boot_cpu_has(X86_FEATURE_XSAVES))
82 asm volatile("1:"XSAVES"\n\t"
83 "2:\n\t"
84 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
85 : "memory");
86 else
87 asm volatile("1:"XSAVE"\n\t"
88 "2:\n\t"
89 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
90 : "memory");
91
92 asm volatile(xstate_fault
93 : "0" (0)
94 : "memory");
95
96 return err;
97}
98
99/*
100 * This function is called only during boot time when x86 caps are not set
101 * up and alternative can not be used yet.
102 */
103static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask)
104{
105 u32 lmask = mask;
106 u32 hmask = mask >> 32;
107 int err = 0;
108
109 WARN_ON(system_state != SYSTEM_BOOTING);
58 110
59 asm volatile("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n\t" 111 if (boot_cpu_has(X86_FEATURE_XSAVES))
60 "2:\n" 112 asm volatile("1:"XRSTORS"\n\t"
61 ".section .fixup,\"ax\"\n" 113 "2:\n\t"
62 "3: movl $-1,%[err]\n" 114 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
63 " jmp 2b\n" 115 : "memory");
64 ".previous\n" 116 else
65 _ASM_EXTABLE(1b, 3b) 117 asm volatile("1:"XRSTOR"\n\t"
66 : [err] "=r" (err) 118 "2:\n\t"
67 : "D" (fx), "m" (*fx), "a" (-1), "d" (-1), "0" (0) 119 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
120 : "memory");
121
122 asm volatile(xstate_fault
123 : "0" (0)
124 : "memory");
125
126 return err;
127}
128
129/*
130 * Save processor xstate to xsave area.
131 */
132static inline int xsave_state(struct xsave_struct *fx, u64 mask)
133{
134 u32 lmask = mask;
135 u32 hmask = mask >> 32;
136 int err = 0;
137
138 /*
139 * If xsaves is enabled, xsaves replaces xsaveopt because
140 * it supports compact format and supervisor states in addition to
141 * modified optimization in xsaveopt.
142 *
143 * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
144 * because xsaveopt supports modified optimization which is not
145 * supported by xsave.
146 *
147 * If none of xsaves and xsaveopt is enabled, use xsave.
148 */
149 alternative_input_2(
150 "1:"XSAVE,
151 "1:"XSAVEOPT,
152 X86_FEATURE_XSAVEOPT,
153 "1:"XSAVES,
154 X86_FEATURE_XSAVES,
155 [fx] "D" (fx), "a" (lmask), "d" (hmask) :
156 "memory");
157 asm volatile("2:\n\t"
158 xstate_fault
159 : "0" (0)
68 : "memory"); 160 : "memory");
69 161
70 return err; 162 return err;
71} 163}
72 164
165/*
166 * Restore processor xstate from xsave area.
167 */
168static inline int xrstor_state(struct xsave_struct *fx, u64 mask)
169{
170 int err = 0;
171 u32 lmask = mask;
172 u32 hmask = mask >> 32;
173
174 /*
175 * Use xrstors to restore context if it is enabled. xrstors supports
176 * compacted format of xsave area which is not supported by xrstor.
177 */
178 alternative_input(
179 "1: " XRSTOR,
180 "1: " XRSTORS,
181 X86_FEATURE_XSAVES,
182 "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
183 : "memory");
184
185 asm volatile("2:\n"
186 xstate_fault
187 : "0" (0)
188 : "memory");
189
190 return err;
191}
192
193/*
194 * Save xstate context for old process during context switch.
195 */
196static inline void fpu_xsave(struct fpu *fpu)
197{
198 xsave_state(&fpu->state->xsave, -1);
199}
200
201/*
202 * Restore xstate context for new process during context switch.
203 */
204static inline int fpu_xrstor_checking(struct xsave_struct *fx)
205{
206 return xrstor_state(fx, -1);
207}
208
209/*
210 * Save xstate to user space xsave area.
211 *
212 * We don't use modified optimization because xrstor/xrstors might track
213 * a different application.
214 *
215 * We don't use compacted format xsave area for
216 * backward compatibility for old applications which don't understand
217 * compacted format of xsave area.
218 */
73static inline int xsave_user(struct xsave_struct __user *buf) 219static inline int xsave_user(struct xsave_struct __user *buf)
74{ 220{
75 int err; 221 int err;
@@ -83,69 +229,34 @@ static inline int xsave_user(struct xsave_struct __user *buf)
83 return -EFAULT; 229 return -EFAULT;
84 230
85 __asm__ __volatile__(ASM_STAC "\n" 231 __asm__ __volatile__(ASM_STAC "\n"
86 "1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" 232 "1:"XSAVE"\n"
87 "2: " ASM_CLAC "\n" 233 "2: " ASM_CLAC "\n"
88 ".section .fixup,\"ax\"\n" 234 xstate_fault
89 "3: movl $-1,%[err]\n"
90 " jmp 2b\n"
91 ".previous\n"
92 _ASM_EXTABLE(1b,3b)
93 : [err] "=r" (err)
94 : "D" (buf), "a" (-1), "d" (-1), "0" (0) 235 : "D" (buf), "a" (-1), "d" (-1), "0" (0)
95 : "memory"); 236 : "memory");
96 return err; 237 return err;
97} 238}
98 239
240/*
241 * Restore xstate from user space xsave area.
242 */
99static inline int xrestore_user(struct xsave_struct __user *buf, u64 mask) 243static inline int xrestore_user(struct xsave_struct __user *buf, u64 mask)
100{ 244{
101 int err; 245 int err = 0;
102 struct xsave_struct *xstate = ((__force struct xsave_struct *)buf); 246 struct xsave_struct *xstate = ((__force struct xsave_struct *)buf);
103 u32 lmask = mask; 247 u32 lmask = mask;
104 u32 hmask = mask >> 32; 248 u32 hmask = mask >> 32;
105 249
106 __asm__ __volatile__(ASM_STAC "\n" 250 __asm__ __volatile__(ASM_STAC "\n"
107 "1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n" 251 "1:"XRSTOR"\n"
108 "2: " ASM_CLAC "\n" 252 "2: " ASM_CLAC "\n"
109 ".section .fixup,\"ax\"\n" 253 xstate_fault
110 "3: movl $-1,%[err]\n"
111 " jmp 2b\n"
112 ".previous\n"
113 _ASM_EXTABLE(1b,3b)
114 : [err] "=r" (err)
115 : "D" (xstate), "a" (lmask), "d" (hmask), "0" (0) 254 : "D" (xstate), "a" (lmask), "d" (hmask), "0" (0)
116 : "memory"); /* memory required? */ 255 : "memory"); /* memory required? */
117 return err; 256 return err;
118} 257}
119 258
120static inline void xrstor_state(struct xsave_struct *fx, u64 mask) 259void *get_xsave_addr(struct xsave_struct *xsave, int xstate);
121{ 260void setup_xstate_comp(void);
122 u32 lmask = mask;
123 u32 hmask = mask >> 32;
124
125 asm volatile(".byte " REX_PREFIX "0x0f,0xae,0x2f\n\t"
126 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
127 : "memory");
128}
129
130static inline void xsave_state(struct xsave_struct *fx, u64 mask)
131{
132 u32 lmask = mask;
133 u32 hmask = mask >> 32;
134 261
135 asm volatile(".byte " REX_PREFIX "0x0f,0xae,0x27\n\t"
136 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
137 : "memory");
138}
139
140static inline void fpu_xsave(struct fpu *fpu)
141{
142 /* This, however, we can work around by forcing the compiler to select
143 an addressing mode that doesn't require extended registers. */
144 alternative_input(
145 ".byte " REX_PREFIX "0x0f,0xae,0x27",
146 ".byte " REX_PREFIX "0x0f,0xae,0x37",
147 X86_FEATURE_XSAVEOPT,
148 [fx] "D" (&fpu->state->xsave), "a" (-1), "d" (-1) :
149 "memory");
150}
151#endif 262#endif
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index eac9e92fe181..e21331ce368f 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -149,6 +149,9 @@
149 149
150#define MSR_CORE_C1_RES 0x00000660 150#define MSR_CORE_C1_RES 0x00000660
151 151
152#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668
153#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669
154
152#define MSR_AMD64_MC0_MASK 0xc0010044 155#define MSR_AMD64_MC0_MASK 0xc0010044
153 156
154#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) 157#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x))
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index bde3993624f1..b5ea75c4a4b4 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -118,4 +118,5 @@ ifeq ($(CONFIG_X86_64),y)
118 118
119 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 119 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
120 obj-y += vsmp_64.o 120 obj-y += vsmp_64.o
121 obj-$(CONFIG_KEXEC) += kexec-bzimage64.o
121endif 122endif
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index a531f6564ed0..b436fc735aa4 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/dmi.h> 32#include <linux/dmi.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/irqdomain.h>
34#include <linux/slab.h> 35#include <linux/slab.h>
35#include <linux/bootmem.h> 36#include <linux/bootmem.h>
36#include <linux/ioport.h> 37#include <linux/ioport.h>
@@ -43,6 +44,7 @@
43#include <asm/io.h> 44#include <asm/io.h>
44#include <asm/mpspec.h> 45#include <asm/mpspec.h>
45#include <asm/smp.h> 46#include <asm/smp.h>
47#include <asm/i8259.h>
46 48
47#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */ 49#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
48static int __initdata acpi_force = 0; 50static int __initdata acpi_force = 0;
@@ -93,44 +95,7 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
93 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 95 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
94}; 96};
95 97
96static unsigned int gsi_to_irq(unsigned int gsi) 98#define ACPI_INVALID_GSI INT_MIN
97{
98 unsigned int irq = gsi + NR_IRQS_LEGACY;
99 unsigned int i;
100
101 for (i = 0; i < NR_IRQS_LEGACY; i++) {
102 if (isa_irq_to_gsi[i] == gsi) {
103 return i;
104 }
105 }
106
107 /* Provide an identity mapping of gsi == irq
108 * except on truly weird platforms that have
109 * non isa irqs in the first 16 gsis.
110 */
111 if (gsi >= NR_IRQS_LEGACY)
112 irq = gsi;
113 else
114 irq = gsi_top + gsi;
115
116 return irq;
117}
118
119static u32 irq_to_gsi(int irq)
120{
121 unsigned int gsi;
122
123 if (irq < NR_IRQS_LEGACY)
124 gsi = isa_irq_to_gsi[irq];
125 else if (irq < gsi_top)
126 gsi = irq;
127 else if (irq < (gsi_top + NR_IRQS_LEGACY))
128 gsi = irq - gsi_top;
129 else
130 gsi = 0xffffffff;
131
132 return gsi;
133}
134 99
135/* 100/*
136 * This is just a simple wrapper around early_ioremap(), 101 * This is just a simple wrapper around early_ioremap(),
@@ -341,11 +306,145 @@ acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long e
341#endif /*CONFIG_X86_LOCAL_APIC */ 306#endif /*CONFIG_X86_LOCAL_APIC */
342 307
343#ifdef CONFIG_X86_IO_APIC 308#ifdef CONFIG_X86_IO_APIC
309#define MP_ISA_BUS 0
310
311static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
312 u32 gsi)
313{
314 int ioapic;
315 int pin;
316 struct mpc_intsrc mp_irq;
317
318 /*
319 * Convert 'gsi' to 'ioapic.pin'.
320 */
321 ioapic = mp_find_ioapic(gsi);
322 if (ioapic < 0)
323 return;
324 pin = mp_find_ioapic_pin(ioapic, gsi);
325
326 /*
327 * TBD: This check is for faulty timer entries, where the override
328 * erroneously sets the trigger to level, resulting in a HUGE
329 * increase of timer interrupts!
330 */
331 if ((bus_irq == 0) && (trigger == 3))
332 trigger = 1;
333
334 mp_irq.type = MP_INTSRC;
335 mp_irq.irqtype = mp_INT;
336 mp_irq.irqflag = (trigger << 2) | polarity;
337 mp_irq.srcbus = MP_ISA_BUS;
338 mp_irq.srcbusirq = bus_irq; /* IRQ */
339 mp_irq.dstapic = mpc_ioapic_id(ioapic); /* APIC ID */
340 mp_irq.dstirq = pin; /* INTIN# */
341
342 mp_save_irq(&mp_irq);
343
344 /*
345 * Reset default identity mapping if gsi is also an legacy IRQ,
346 * otherwise there will be more than one entry with the same GSI
347 * and acpi_isa_irq_to_gsi() may give wrong result.
348 */
349 if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi)
350 isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI;
351 isa_irq_to_gsi[bus_irq] = gsi;
352}
353
354static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
355 int polarity)
356{
357#ifdef CONFIG_X86_MPPARSE
358 struct mpc_intsrc mp_irq;
359 struct pci_dev *pdev;
360 unsigned char number;
361 unsigned int devfn;
362 int ioapic;
363 u8 pin;
364
365 if (!acpi_ioapic)
366 return 0;
367 if (!dev || !dev_is_pci(dev))
368 return 0;
369
370 pdev = to_pci_dev(dev);
371 number = pdev->bus->number;
372 devfn = pdev->devfn;
373 pin = pdev->pin;
374 /* print the entry should happen on mptable identically */
375 mp_irq.type = MP_INTSRC;
376 mp_irq.irqtype = mp_INT;
377 mp_irq.irqflag = (trigger == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
378 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
379 mp_irq.srcbus = number;
380 mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
381 ioapic = mp_find_ioapic(gsi);
382 mp_irq.dstapic = mpc_ioapic_id(ioapic);
383 mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
384
385 mp_save_irq(&mp_irq);
386#endif
387 return 0;
388}
389
390static int mp_register_gsi(struct device *dev, u32 gsi, int trigger,
391 int polarity)
392{
393 int irq, node;
394
395 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
396 return gsi;
397
398 /* Don't set up the ACPI SCI because it's already set up */
399 if (acpi_gbl_FADT.sci_interrupt == gsi)
400 return gsi;
401
402 trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1;
403 polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1;
404 node = dev ? dev_to_node(dev) : NUMA_NO_NODE;
405 if (mp_set_gsi_attr(gsi, trigger, polarity, node)) {
406 pr_warn("Failed to set pin attr for GSI%d\n", gsi);
407 return -1;
408 }
409
410 irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC);
411 if (irq < 0)
412 return irq;
413
414 if (enable_update_mptable)
415 mp_config_acpi_gsi(dev, gsi, trigger, polarity);
416
417 return irq;
418}
419
420static void mp_unregister_gsi(u32 gsi)
421{
422 int irq;
423
424 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
425 return;
426
427 if (acpi_gbl_FADT.sci_interrupt == gsi)
428 return;
429
430 irq = mp_map_gsi_to_irq(gsi, 0);
431 if (irq > 0)
432 mp_unmap_irq(irq);
433}
434
435static struct irq_domain_ops acpi_irqdomain_ops = {
436 .map = mp_irqdomain_map,
437 .unmap = mp_irqdomain_unmap,
438};
344 439
345static int __init 440static int __init
346acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) 441acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
347{ 442{
348 struct acpi_madt_io_apic *ioapic = NULL; 443 struct acpi_madt_io_apic *ioapic = NULL;
444 struct ioapic_domain_cfg cfg = {
445 .type = IOAPIC_DOMAIN_DYNAMIC,
446 .ops = &acpi_irqdomain_ops,
447 };
349 448
350 ioapic = (struct acpi_madt_io_apic *)header; 449 ioapic = (struct acpi_madt_io_apic *)header;
351 450
@@ -354,8 +453,12 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
354 453
355 acpi_table_print_madt_entry(header); 454 acpi_table_print_madt_entry(header);
356 455
357 mp_register_ioapic(ioapic->id, 456 /* Statically assign IRQ numbers for IOAPICs hosting legacy IRQs */
358 ioapic->address, ioapic->global_irq_base); 457 if (ioapic->global_irq_base < nr_legacy_irqs())
458 cfg.type = IOAPIC_DOMAIN_LEGACY;
459
460 mp_register_ioapic(ioapic->id, ioapic->address, ioapic->global_irq_base,
461 &cfg);
359 462
360 return 0; 463 return 0;
361} 464}
@@ -378,11 +481,6 @@ static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger,
378 if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK) 481 if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK)
379 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK; 482 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
380 483
381 /*
382 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
383 * If GSI is < 16, this will update its flags,
384 * else it will create a new mp_irqs[] entry.
385 */
386 mp_override_legacy_irq(bus_irq, polarity, trigger, gsi); 484 mp_override_legacy_irq(bus_irq, polarity, trigger, gsi);
387 485
388 /* 486 /*
@@ -504,25 +602,28 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
504 outb(new >> 8, 0x4d1); 602 outb(new >> 8, 0x4d1);
505} 603}
506 604
507int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) 605int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
508{ 606{
509 *irq = gsi_to_irq(gsi); 607 int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
510 608
511#ifdef CONFIG_X86_IO_APIC 609 if (irq >= 0) {
512 if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) 610 *irqp = irq;
513 setup_IO_APIC_irq_extra(gsi); 611 return 0;
514#endif 612 }
515 613
516 return 0; 614 return -1;
517} 615}
518EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); 616EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
519 617
520int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) 618int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
521{ 619{
522 if (isa_irq >= 16) 620 if (isa_irq < nr_legacy_irqs() &&
523 return -1; 621 isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) {
524 *gsi = irq_to_gsi(isa_irq); 622 *gsi = isa_irq_to_gsi[isa_irq];
525 return 0; 623 return 0;
624 }
625
626 return -1;
526} 627}
527 628
528static int acpi_register_gsi_pic(struct device *dev, u32 gsi, 629static int acpi_register_gsi_pic(struct device *dev, u32 gsi,
@@ -542,15 +643,25 @@ static int acpi_register_gsi_pic(struct device *dev, u32 gsi,
542static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi, 643static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
543 int trigger, int polarity) 644 int trigger, int polarity)
544{ 645{
646 int irq = gsi;
647
545#ifdef CONFIG_X86_IO_APIC 648#ifdef CONFIG_X86_IO_APIC
546 gsi = mp_register_gsi(dev, gsi, trigger, polarity); 649 irq = mp_register_gsi(dev, gsi, trigger, polarity);
547#endif 650#endif
548 651
549 return gsi; 652 return irq;
653}
654
655static void acpi_unregister_gsi_ioapic(u32 gsi)
656{
657#ifdef CONFIG_X86_IO_APIC
658 mp_unregister_gsi(gsi);
659#endif
550} 660}
551 661
552int (*__acpi_register_gsi)(struct device *dev, u32 gsi, 662int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
553 int trigger, int polarity) = acpi_register_gsi_pic; 663 int trigger, int polarity) = acpi_register_gsi_pic;
664void (*__acpi_unregister_gsi)(u32 gsi) = NULL;
554 665
555#ifdef CONFIG_ACPI_SLEEP 666#ifdef CONFIG_ACPI_SLEEP
556int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel; 667int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel;
@@ -564,32 +675,22 @@ int (*acpi_suspend_lowlevel)(void);
564 */ 675 */
565int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) 676int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
566{ 677{
567 unsigned int irq; 678 return __acpi_register_gsi(dev, gsi, trigger, polarity);
568 unsigned int plat_gsi = gsi;
569
570 plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity);
571 irq = gsi_to_irq(plat_gsi);
572
573 return irq;
574} 679}
575EXPORT_SYMBOL_GPL(acpi_register_gsi); 680EXPORT_SYMBOL_GPL(acpi_register_gsi);
576 681
577void acpi_unregister_gsi(u32 gsi) 682void acpi_unregister_gsi(u32 gsi)
578{ 683{
684 if (__acpi_unregister_gsi)
685 __acpi_unregister_gsi(gsi);
579} 686}
580EXPORT_SYMBOL_GPL(acpi_unregister_gsi); 687EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
581 688
582void __init acpi_set_irq_model_pic(void) 689static void __init acpi_set_irq_model_ioapic(void)
583{
584 acpi_irq_model = ACPI_IRQ_MODEL_PIC;
585 __acpi_register_gsi = acpi_register_gsi_pic;
586 acpi_ioapic = 0;
587}
588
589void __init acpi_set_irq_model_ioapic(void)
590{ 690{
591 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; 691 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
592 __acpi_register_gsi = acpi_register_gsi_ioapic; 692 __acpi_register_gsi = acpi_register_gsi_ioapic;
693 __acpi_unregister_gsi = acpi_unregister_gsi_ioapic;
593 acpi_ioapic = 1; 694 acpi_ioapic = 1;
594} 695}
595 696
@@ -825,9 +926,8 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
825 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 926 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
826 */ 927 */
827 928
828 count = 929 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
829 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, 930 acpi_parse_lapic_addr_ovr, 0);
830 acpi_parse_lapic_addr_ovr, 0);
831 if (count < 0) { 931 if (count < 0) {
832 printk(KERN_ERR PREFIX 932 printk(KERN_ERR PREFIX
833 "Error parsing LAPIC address override entry\n"); 933 "Error parsing LAPIC address override entry\n");
@@ -852,9 +952,8 @@ static int __init acpi_parse_madt_lapic_entries(void)
852 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 952 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
853 */ 953 */
854 954
855 count = 955 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
856 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, 956 acpi_parse_lapic_addr_ovr, 0);
857 acpi_parse_lapic_addr_ovr, 0);
858 if (count < 0) { 957 if (count < 0) {
859 printk(KERN_ERR PREFIX 958 printk(KERN_ERR PREFIX
860 "Error parsing LAPIC address override entry\n"); 959 "Error parsing LAPIC address override entry\n");
@@ -882,11 +981,10 @@ static int __init acpi_parse_madt_lapic_entries(void)
882 return count; 981 return count;
883 } 982 }
884 983
885 x2count = 984 x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI,
886 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI, 985 acpi_parse_x2apic_nmi, 0);
887 acpi_parse_x2apic_nmi, 0); 986 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI,
888 count = 987 acpi_parse_lapic_nmi, 0);
889 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
890 if (count < 0 || x2count < 0) { 988 if (count < 0 || x2count < 0) {
891 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 989 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
892 /* TBD: Cleanup to allow fallback to MPS */ 990 /* TBD: Cleanup to allow fallback to MPS */
@@ -897,44 +995,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
897#endif /* CONFIG_X86_LOCAL_APIC */ 995#endif /* CONFIG_X86_LOCAL_APIC */
898 996
899#ifdef CONFIG_X86_IO_APIC 997#ifdef CONFIG_X86_IO_APIC
900#define MP_ISA_BUS 0 998static void __init mp_config_acpi_legacy_irqs(void)
901
902void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
903{
904 int ioapic;
905 int pin;
906 struct mpc_intsrc mp_irq;
907
908 /*
909 * Convert 'gsi' to 'ioapic.pin'.
910 */
911 ioapic = mp_find_ioapic(gsi);
912 if (ioapic < 0)
913 return;
914 pin = mp_find_ioapic_pin(ioapic, gsi);
915
916 /*
917 * TBD: This check is for faulty timer entries, where the override
918 * erroneously sets the trigger to level, resulting in a HUGE
919 * increase of timer interrupts!
920 */
921 if ((bus_irq == 0) && (trigger == 3))
922 trigger = 1;
923
924 mp_irq.type = MP_INTSRC;
925 mp_irq.irqtype = mp_INT;
926 mp_irq.irqflag = (trigger << 2) | polarity;
927 mp_irq.srcbus = MP_ISA_BUS;
928 mp_irq.srcbusirq = bus_irq; /* IRQ */
929 mp_irq.dstapic = mpc_ioapic_id(ioapic); /* APIC ID */
930 mp_irq.dstirq = pin; /* INTIN# */
931
932 mp_save_irq(&mp_irq);
933
934 isa_irq_to_gsi[bus_irq] = gsi;
935}
936
937void __init mp_config_acpi_legacy_irqs(void)
938{ 999{
939 int i; 1000 int i;
940 struct mpc_intsrc mp_irq; 1001 struct mpc_intsrc mp_irq;
@@ -952,7 +1013,7 @@ void __init mp_config_acpi_legacy_irqs(void)
952 * Use the default configuration for the IRQs 0-15. Unless 1013 * Use the default configuration for the IRQs 0-15. Unless
953 * overridden by (MADT) interrupt source override entries. 1014 * overridden by (MADT) interrupt source override entries.
954 */ 1015 */
955 for (i = 0; i < 16; i++) { 1016 for (i = 0; i < nr_legacy_irqs(); i++) {
956 int ioapic, pin; 1017 int ioapic, pin;
957 unsigned int dstapic; 1018 unsigned int dstapic;
958 int idx; 1019 int idx;
@@ -1000,84 +1061,6 @@ void __init mp_config_acpi_legacy_irqs(void)
1000 } 1061 }
1001} 1062}
1002 1063
1003static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
1004 int polarity)
1005{
1006#ifdef CONFIG_X86_MPPARSE
1007 struct mpc_intsrc mp_irq;
1008 struct pci_dev *pdev;
1009 unsigned char number;
1010 unsigned int devfn;
1011 int ioapic;
1012 u8 pin;
1013
1014 if (!acpi_ioapic)
1015 return 0;
1016 if (!dev || !dev_is_pci(dev))
1017 return 0;
1018
1019 pdev = to_pci_dev(dev);
1020 number = pdev->bus->number;
1021 devfn = pdev->devfn;
1022 pin = pdev->pin;
1023 /* print the entry should happen on mptable identically */
1024 mp_irq.type = MP_INTSRC;
1025 mp_irq.irqtype = mp_INT;
1026 mp_irq.irqflag = (trigger == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
1027 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
1028 mp_irq.srcbus = number;
1029 mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
1030 ioapic = mp_find_ioapic(gsi);
1031 mp_irq.dstapic = mpc_ioapic_id(ioapic);
1032 mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
1033
1034 mp_save_irq(&mp_irq);
1035#endif
1036 return 0;
1037}
1038
1039int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
1040{
1041 int ioapic;
1042 int ioapic_pin;
1043 struct io_apic_irq_attr irq_attr;
1044 int ret;
1045
1046 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
1047 return gsi;
1048
1049 /* Don't set up the ACPI SCI because it's already set up */
1050 if (acpi_gbl_FADT.sci_interrupt == gsi)
1051 return gsi;
1052
1053 ioapic = mp_find_ioapic(gsi);
1054 if (ioapic < 0) {
1055 printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
1056 return gsi;
1057 }
1058
1059 ioapic_pin = mp_find_ioapic_pin(ioapic, gsi);
1060
1061 if (ioapic_pin > MP_MAX_IOAPIC_PIN) {
1062 printk(KERN_ERR "Invalid reference to IOAPIC pin "
1063 "%d-%d\n", mpc_ioapic_id(ioapic),
1064 ioapic_pin);
1065 return gsi;
1066 }
1067
1068 if (enable_update_mptable)
1069 mp_config_acpi_gsi(dev, gsi, trigger, polarity);
1070
1071 set_io_apic_irq_attr(&irq_attr, ioapic, ioapic_pin,
1072 trigger == ACPI_EDGE_SENSITIVE ? 0 : 1,
1073 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
1074 ret = io_apic_set_pci_routing(dev, gsi_to_irq(gsi), &irq_attr);
1075 if (ret < 0)
1076 gsi = INT_MIN;
1077
1078 return gsi;
1079}
1080
1081/* 1064/*
1082 * Parse IOAPIC related entries in MADT 1065 * Parse IOAPIC related entries in MADT
1083 * returns 0 on success, < 0 on error 1066 * returns 0 on success, < 0 on error
@@ -1107,9 +1090,8 @@ static int __init acpi_parse_madt_ioapic_entries(void)
1107 return -ENODEV; 1090 return -ENODEV;
1108 } 1091 }
1109 1092
1110 count = 1093 count = acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
1111 acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic, 1094 MAX_IO_APICS);
1112 MAX_IO_APICS);
1113 if (!count) { 1095 if (!count) {
1114 printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); 1096 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
1115 return -ENODEV; 1097 return -ENODEV;
@@ -1118,9 +1100,8 @@ static int __init acpi_parse_madt_ioapic_entries(void)
1118 return count; 1100 return count;
1119 } 1101 }
1120 1102
1121 count = 1103 count = acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
1122 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 1104 acpi_parse_int_src_ovr, nr_irqs);
1123 nr_irqs);
1124 if (count < 0) { 1105 if (count < 0) {
1125 printk(KERN_ERR PREFIX 1106 printk(KERN_ERR PREFIX
1126 "Error parsing interrupt source overrides entry\n"); 1107 "Error parsing interrupt source overrides entry\n");
@@ -1139,9 +1120,8 @@ static int __init acpi_parse_madt_ioapic_entries(void)
1139 /* Fill in identity legacy mappings where no override */ 1120 /* Fill in identity legacy mappings where no override */
1140 mp_config_acpi_legacy_irqs(); 1121 mp_config_acpi_legacy_irqs();
1141 1122
1142 count = 1123 count = acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE,
1143 acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src, 1124 acpi_parse_nmi_src, nr_irqs);
1144 nr_irqs);
1145 if (count < 0) { 1125 if (count < 0) {
1146 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 1126 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
1147 /* TBD: Cleanup to allow fallback to MPS */ 1127 /* TBD: Cleanup to allow fallback to MPS */
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index ad28db7e6bde..67760275544b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -67,7 +67,7 @@ EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid);
67/* 67/*
68 * The highest APIC ID seen during enumeration. 68 * The highest APIC ID seen during enumeration.
69 */ 69 */
70unsigned int max_physical_apicid; 70static unsigned int max_physical_apicid;
71 71
72/* 72/*
73 * Bitmask of physically existing CPUs: 73 * Bitmask of physically existing CPUs:
@@ -1342,17 +1342,6 @@ void setup_local_APIC(void)
1342 /* always use the value from LDR */ 1342 /* always use the value from LDR */
1343 early_per_cpu(x86_cpu_to_logical_apicid, cpu) = 1343 early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
1344 logical_smp_processor_id(); 1344 logical_smp_processor_id();
1345
1346 /*
1347 * Some NUMA implementations (NUMAQ) don't initialize apicid to
1348 * node mapping during NUMA init. Now that logical apicid is
1349 * guaranteed to be known, give it another chance. This is already
1350 * a bit too late - percpu allocation has already happened without
1351 * proper NUMA affinity.
1352 */
1353 if (apic->x86_32_numa_cpu_node)
1354 set_apicid_to_node(early_per_cpu(x86_cpu_to_apicid, cpu),
1355 apic->x86_32_numa_cpu_node(cpu));
1356#endif 1345#endif
1357 1346
1358 /* 1347 /*
@@ -2053,8 +2042,6 @@ void __init connect_bsp_APIC(void)
2053 imcr_pic_to_apic(); 2042 imcr_pic_to_apic();
2054 } 2043 }
2055#endif 2044#endif
2056 if (apic->enable_apic_mode)
2057 apic->enable_apic_mode();
2058} 2045}
2059 2046
2060/** 2047/**
@@ -2451,51 +2438,6 @@ static void apic_pm_activate(void) { }
2451 2438
2452#ifdef CONFIG_X86_64 2439#ifdef CONFIG_X86_64
2453 2440
2454static int apic_cluster_num(void)
2455{
2456 int i, clusters, zeros;
2457 unsigned id;
2458 u16 *bios_cpu_apicid;
2459 DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS);
2460
2461 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
2462 bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
2463
2464 for (i = 0; i < nr_cpu_ids; i++) {
2465 /* are we being called early in kernel startup? */
2466 if (bios_cpu_apicid) {
2467 id = bios_cpu_apicid[i];
2468 } else if (i < nr_cpu_ids) {
2469 if (cpu_present(i))
2470 id = per_cpu(x86_bios_cpu_apicid, i);
2471 else
2472 continue;
2473 } else
2474 break;
2475
2476 if (id != BAD_APICID)
2477 __set_bit(APIC_CLUSTERID(id), clustermap);
2478 }
2479
2480 /* Problem: Partially populated chassis may not have CPUs in some of
2481 * the APIC clusters they have been allocated. Only present CPUs have
2482 * x86_bios_cpu_apicid entries, thus causing zeroes in the bitmap.
2483 * Since clusters are allocated sequentially, count zeros only if
2484 * they are bounded by ones.
2485 */
2486 clusters = 0;
2487 zeros = 0;
2488 for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
2489 if (test_bit(i, clustermap)) {
2490 clusters += 1 + zeros;
2491 zeros = 0;
2492 } else
2493 ++zeros;
2494 }
2495
2496 return clusters;
2497}
2498
2499static int multi_checked; 2441static int multi_checked;
2500static int multi; 2442static int multi;
2501 2443
@@ -2540,20 +2482,7 @@ static void dmi_check_multi(void)
2540int apic_is_clustered_box(void) 2482int apic_is_clustered_box(void)
2541{ 2483{
2542 dmi_check_multi(); 2484 dmi_check_multi();
2543 if (multi) 2485 return multi;
2544 return 1;
2545
2546 if (!is_vsmp_box())
2547 return 0;
2548
2549 /*
2550 * ScaleMP vSMPowered boxes have one cluster per board and TSCs are
2551 * not guaranteed to be synced between boards
2552 */
2553 if (apic_cluster_num() > 1)
2554 return 1;
2555
2556 return 0;
2557} 2486}
2558#endif 2487#endif
2559 2488
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 7c1b29479513..de918c410eae 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -168,21 +168,16 @@ static struct apic apic_flat = {
168 .disable_esr = 0, 168 .disable_esr = 0,
169 .dest_logical = APIC_DEST_LOGICAL, 169 .dest_logical = APIC_DEST_LOGICAL,
170 .check_apicid_used = NULL, 170 .check_apicid_used = NULL,
171 .check_apicid_present = NULL,
172 171
173 .vector_allocation_domain = flat_vector_allocation_domain, 172 .vector_allocation_domain = flat_vector_allocation_domain,
174 .init_apic_ldr = flat_init_apic_ldr, 173 .init_apic_ldr = flat_init_apic_ldr,
175 174
176 .ioapic_phys_id_map = NULL, 175 .ioapic_phys_id_map = NULL,
177 .setup_apic_routing = NULL, 176 .setup_apic_routing = NULL,
178 .multi_timer_check = NULL,
179 .cpu_present_to_apicid = default_cpu_present_to_apicid, 177 .cpu_present_to_apicid = default_cpu_present_to_apicid,
180 .apicid_to_cpu_present = NULL, 178 .apicid_to_cpu_present = NULL,
181 .setup_portio_remap = NULL,
182 .check_phys_apicid_present = default_check_phys_apicid_present, 179 .check_phys_apicid_present = default_check_phys_apicid_present,
183 .enable_apic_mode = NULL,
184 .phys_pkg_id = flat_phys_pkg_id, 180 .phys_pkg_id = flat_phys_pkg_id,
185 .mps_oem_check = NULL,
186 181
187 .get_apic_id = flat_get_apic_id, 182 .get_apic_id = flat_get_apic_id,
188 .set_apic_id = set_apic_id, 183 .set_apic_id = set_apic_id,
@@ -196,10 +191,7 @@ static struct apic apic_flat = {
196 .send_IPI_all = flat_send_IPI_all, 191 .send_IPI_all = flat_send_IPI_all,
197 .send_IPI_self = apic_send_IPI_self, 192 .send_IPI_self = apic_send_IPI_self,
198 193
199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
201 .wait_for_init_deassert = false, 194 .wait_for_init_deassert = false,
202 .smp_callin_clear_local_apic = NULL,
203 .inquire_remote_apic = default_inquire_remote_apic, 195 .inquire_remote_apic = default_inquire_remote_apic,
204 196
205 .read = native_apic_mem_read, 197 .read = native_apic_mem_read,
@@ -283,7 +275,6 @@ static struct apic apic_physflat = {
283 .disable_esr = 0, 275 .disable_esr = 0,
284 .dest_logical = 0, 276 .dest_logical = 0,
285 .check_apicid_used = NULL, 277 .check_apicid_used = NULL,
286 .check_apicid_present = NULL,
287 278
288 .vector_allocation_domain = default_vector_allocation_domain, 279 .vector_allocation_domain = default_vector_allocation_domain,
289 /* not needed, but shouldn't hurt: */ 280 /* not needed, but shouldn't hurt: */
@@ -291,14 +282,10 @@ static struct apic apic_physflat = {
291 282
292 .ioapic_phys_id_map = NULL, 283 .ioapic_phys_id_map = NULL,
293 .setup_apic_routing = NULL, 284 .setup_apic_routing = NULL,
294 .multi_timer_check = NULL,
295 .cpu_present_to_apicid = default_cpu_present_to_apicid, 285 .cpu_present_to_apicid = default_cpu_present_to_apicid,
296 .apicid_to_cpu_present = NULL, 286 .apicid_to_cpu_present = NULL,
297 .setup_portio_remap = NULL,
298 .check_phys_apicid_present = default_check_phys_apicid_present, 287 .check_phys_apicid_present = default_check_phys_apicid_present,
299 .enable_apic_mode = NULL,
300 .phys_pkg_id = flat_phys_pkg_id, 288 .phys_pkg_id = flat_phys_pkg_id,
301 .mps_oem_check = NULL,
302 289
303 .get_apic_id = flat_get_apic_id, 290 .get_apic_id = flat_get_apic_id,
304 .set_apic_id = set_apic_id, 291 .set_apic_id = set_apic_id,
@@ -312,10 +299,7 @@ static struct apic apic_physflat = {
312 .send_IPI_all = physflat_send_IPI_all, 299 .send_IPI_all = physflat_send_IPI_all,
313 .send_IPI_self = apic_send_IPI_self, 300 .send_IPI_self = apic_send_IPI_self,
314 301
315 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
316 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
317 .wait_for_init_deassert = false, 302 .wait_for_init_deassert = false,
318 .smp_callin_clear_local_apic = NULL,
319 .inquire_remote_apic = default_inquire_remote_apic, 303 .inquire_remote_apic = default_inquire_remote_apic,
320 304
321 .read = native_apic_mem_read, 305 .read = native_apic_mem_read,
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 8c7c98249c20..b205cdbdbe6a 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -89,16 +89,6 @@ static const struct cpumask *noop_target_cpus(void)
89 return cpumask_of(0); 89 return cpumask_of(0);
90} 90}
91 91
92static unsigned long noop_check_apicid_used(physid_mask_t *map, int apicid)
93{
94 return physid_isset(apicid, *map);
95}
96
97static unsigned long noop_check_apicid_present(int bit)
98{
99 return physid_isset(bit, phys_cpu_present_map);
100}
101
102static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask, 92static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask,
103 const struct cpumask *mask) 93 const struct cpumask *mask)
104{ 94{
@@ -133,27 +123,21 @@ struct apic apic_noop = {
133 .target_cpus = noop_target_cpus, 123 .target_cpus = noop_target_cpus,
134 .disable_esr = 0, 124 .disable_esr = 0,
135 .dest_logical = APIC_DEST_LOGICAL, 125 .dest_logical = APIC_DEST_LOGICAL,
136 .check_apicid_used = noop_check_apicid_used, 126 .check_apicid_used = default_check_apicid_used,
137 .check_apicid_present = noop_check_apicid_present,
138 127
139 .vector_allocation_domain = noop_vector_allocation_domain, 128 .vector_allocation_domain = noop_vector_allocation_domain,
140 .init_apic_ldr = noop_init_apic_ldr, 129 .init_apic_ldr = noop_init_apic_ldr,
141 130
142 .ioapic_phys_id_map = default_ioapic_phys_id_map, 131 .ioapic_phys_id_map = default_ioapic_phys_id_map,
143 .setup_apic_routing = NULL, 132 .setup_apic_routing = NULL,
144 .multi_timer_check = NULL,
145 133
146 .cpu_present_to_apicid = default_cpu_present_to_apicid, 134 .cpu_present_to_apicid = default_cpu_present_to_apicid,
147 .apicid_to_cpu_present = physid_set_mask_of_physid, 135 .apicid_to_cpu_present = physid_set_mask_of_physid,
148 136
149 .setup_portio_remap = NULL,
150 .check_phys_apicid_present = default_check_phys_apicid_present, 137 .check_phys_apicid_present = default_check_phys_apicid_present,
151 .enable_apic_mode = NULL,
152 138
153 .phys_pkg_id = noop_phys_pkg_id, 139 .phys_pkg_id = noop_phys_pkg_id,
154 140
155 .mps_oem_check = NULL,
156
157 .get_apic_id = noop_get_apic_id, 141 .get_apic_id = noop_get_apic_id,
158 .set_apic_id = NULL, 142 .set_apic_id = NULL,
159 .apic_id_mask = 0x0F << 24, 143 .apic_id_mask = 0x0F << 24,
@@ -168,12 +152,7 @@ struct apic apic_noop = {
168 152
169 .wakeup_secondary_cpu = noop_wakeup_secondary_cpu, 153 .wakeup_secondary_cpu = noop_wakeup_secondary_cpu,
170 154
171 /* should be safe */
172 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
173 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
174
175 .wait_for_init_deassert = false, 155 .wait_for_init_deassert = false,
176 .smp_callin_clear_local_apic = NULL,
177 .inquire_remote_apic = NULL, 156 .inquire_remote_apic = NULL,
178 157
179 .read = noop_apic_read, 158 .read = noop_apic_read,
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index a5b45df8bc88..ae915391ebec 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -217,21 +217,16 @@ static const struct apic apic_numachip __refconst = {
217 .disable_esr = 0, 217 .disable_esr = 0,
218 .dest_logical = 0, 218 .dest_logical = 0,
219 .check_apicid_used = NULL, 219 .check_apicid_used = NULL,
220 .check_apicid_present = NULL,
221 220
222 .vector_allocation_domain = default_vector_allocation_domain, 221 .vector_allocation_domain = default_vector_allocation_domain,
223 .init_apic_ldr = flat_init_apic_ldr, 222 .init_apic_ldr = flat_init_apic_ldr,
224 223
225 .ioapic_phys_id_map = NULL, 224 .ioapic_phys_id_map = NULL,
226 .setup_apic_routing = NULL, 225 .setup_apic_routing = NULL,
227 .multi_timer_check = NULL,
228 .cpu_present_to_apicid = default_cpu_present_to_apicid, 226 .cpu_present_to_apicid = default_cpu_present_to_apicid,
229 .apicid_to_cpu_present = NULL, 227 .apicid_to_cpu_present = NULL,
230 .setup_portio_remap = NULL,
231 .check_phys_apicid_present = default_check_phys_apicid_present, 228 .check_phys_apicid_present = default_check_phys_apicid_present,
232 .enable_apic_mode = NULL,
233 .phys_pkg_id = numachip_phys_pkg_id, 229 .phys_pkg_id = numachip_phys_pkg_id,
234 .mps_oem_check = NULL,
235 230
236 .get_apic_id = get_apic_id, 231 .get_apic_id = get_apic_id,
237 .set_apic_id = set_apic_id, 232 .set_apic_id = set_apic_id,
@@ -246,10 +241,7 @@ static const struct apic apic_numachip __refconst = {
246 .send_IPI_self = numachip_send_IPI_self, 241 .send_IPI_self = numachip_send_IPI_self,
247 242
248 .wakeup_secondary_cpu = numachip_wakeup_secondary, 243 .wakeup_secondary_cpu = numachip_wakeup_secondary,
249 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
250 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
251 .wait_for_init_deassert = false, 244 .wait_for_init_deassert = false,
252 .smp_callin_clear_local_apic = NULL,
253 .inquire_remote_apic = NULL, /* REMRD not supported */ 245 .inquire_remote_apic = NULL, /* REMRD not supported */
254 246
255 .read = native_apic_mem_read, 247 .read = native_apic_mem_read,
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index e4840aa7a255..c4a8d63f8220 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -31,11 +31,6 @@ static unsigned long bigsmp_check_apicid_used(physid_mask_t *map, int apicid)
31 return 0; 31 return 0;
32} 32}
33 33
34static unsigned long bigsmp_check_apicid_present(int bit)
35{
36 return 1;
37}
38
39static int bigsmp_early_logical_apicid(int cpu) 34static int bigsmp_early_logical_apicid(int cpu)
40{ 35{
41 /* on bigsmp, logical apicid is the same as physical */ 36 /* on bigsmp, logical apicid is the same as physical */
@@ -168,21 +163,16 @@ static struct apic apic_bigsmp = {
168 .disable_esr = 1, 163 .disable_esr = 1,
169 .dest_logical = 0, 164 .dest_logical = 0,
170 .check_apicid_used = bigsmp_check_apicid_used, 165 .check_apicid_used = bigsmp_check_apicid_used,
171 .check_apicid_present = bigsmp_check_apicid_present,
172 166
173 .vector_allocation_domain = default_vector_allocation_domain, 167 .vector_allocation_domain = default_vector_allocation_domain,
174 .init_apic_ldr = bigsmp_init_apic_ldr, 168 .init_apic_ldr = bigsmp_init_apic_ldr,
175 169
176 .ioapic_phys_id_map = bigsmp_ioapic_phys_id_map, 170 .ioapic_phys_id_map = bigsmp_ioapic_phys_id_map,
177 .setup_apic_routing = bigsmp_setup_apic_routing, 171 .setup_apic_routing = bigsmp_setup_apic_routing,
178 .multi_timer_check = NULL,
179 .cpu_present_to_apicid = bigsmp_cpu_present_to_apicid, 172 .cpu_present_to_apicid = bigsmp_cpu_present_to_apicid,
180 .apicid_to_cpu_present = physid_set_mask_of_physid, 173 .apicid_to_cpu_present = physid_set_mask_of_physid,
181 .setup_portio_remap = NULL,
182 .check_phys_apicid_present = bigsmp_check_phys_apicid_present, 174 .check_phys_apicid_present = bigsmp_check_phys_apicid_present,
183 .enable_apic_mode = NULL,
184 .phys_pkg_id = bigsmp_phys_pkg_id, 175 .phys_pkg_id = bigsmp_phys_pkg_id,
185 .mps_oem_check = NULL,
186 176
187 .get_apic_id = bigsmp_get_apic_id, 177 .get_apic_id = bigsmp_get_apic_id,
188 .set_apic_id = NULL, 178 .set_apic_id = NULL,
@@ -196,11 +186,7 @@ static struct apic apic_bigsmp = {
196 .send_IPI_all = bigsmp_send_IPI_all, 186 .send_IPI_all = bigsmp_send_IPI_all,
197 .send_IPI_self = default_send_IPI_self, 187 .send_IPI_self = default_send_IPI_self,
198 188
199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
201
202 .wait_for_init_deassert = true, 189 .wait_for_init_deassert = true,
203 .smp_callin_clear_local_apic = NULL,
204 .inquire_remote_apic = default_inquire_remote_apic, 190 .inquire_remote_apic = default_inquire_remote_apic,
205 191
206 .read = native_apic_mem_read, 192 .read = native_apic_mem_read,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 81e08eff05ee..29290f554e79 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -31,6 +31,7 @@
31#include <linux/acpi.h> 31#include <linux/acpi.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/syscore_ops.h> 33#include <linux/syscore_ops.h>
34#include <linux/irqdomain.h>
34#include <linux/msi.h> 35#include <linux/msi.h>
35#include <linux/htirq.h> 36#include <linux/htirq.h>
36#include <linux/freezer.h> 37#include <linux/freezer.h>
@@ -62,6 +63,16 @@
62 63
63#define __apicdebuginit(type) static type __init 64#define __apicdebuginit(type) static type __init
64 65
66#define for_each_ioapic(idx) \
67 for ((idx) = 0; (idx) < nr_ioapics; (idx)++)
68#define for_each_ioapic_reverse(idx) \
69 for ((idx) = nr_ioapics - 1; (idx) >= 0; (idx)--)
70#define for_each_pin(idx, pin) \
71 for ((pin) = 0; (pin) < ioapics[(idx)].nr_registers; (pin)++)
72#define for_each_ioapic_pin(idx, pin) \
73 for_each_ioapic((idx)) \
74 for_each_pin((idx), (pin))
75
65#define for_each_irq_pin(entry, head) \ 76#define for_each_irq_pin(entry, head) \
66 for (entry = head; entry; entry = entry->next) 77 for (entry = head; entry; entry = entry->next)
67 78
@@ -73,6 +84,17 @@ int sis_apic_bug = -1;
73 84
74static DEFINE_RAW_SPINLOCK(ioapic_lock); 85static DEFINE_RAW_SPINLOCK(ioapic_lock);
75static DEFINE_RAW_SPINLOCK(vector_lock); 86static DEFINE_RAW_SPINLOCK(vector_lock);
87static DEFINE_MUTEX(ioapic_mutex);
88static unsigned int ioapic_dynirq_base;
89static int ioapic_initialized;
90
91struct mp_pin_info {
92 int trigger;
93 int polarity;
94 int node;
95 int set;
96 u32 count;
97};
76 98
77static struct ioapic { 99static struct ioapic {
78 /* 100 /*
@@ -87,7 +109,9 @@ static struct ioapic {
87 struct mpc_ioapic mp_config; 109 struct mpc_ioapic mp_config;
88 /* IO APIC gsi routing info */ 110 /* IO APIC gsi routing info */
89 struct mp_ioapic_gsi gsi_config; 111 struct mp_ioapic_gsi gsi_config;
90 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); 112 struct ioapic_domain_cfg irqdomain_cfg;
113 struct irq_domain *irqdomain;
114 struct mp_pin_info *pin_info;
91} ioapics[MAX_IO_APICS]; 115} ioapics[MAX_IO_APICS];
92 116
93#define mpc_ioapic_ver(ioapic_idx) ioapics[ioapic_idx].mp_config.apicver 117#define mpc_ioapic_ver(ioapic_idx) ioapics[ioapic_idx].mp_config.apicver
@@ -107,6 +131,41 @@ struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic_idx)
107 return &ioapics[ioapic_idx].gsi_config; 131 return &ioapics[ioapic_idx].gsi_config;
108} 132}
109 133
134static inline int mp_ioapic_pin_count(int ioapic)
135{
136 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic);
137
138 return gsi_cfg->gsi_end - gsi_cfg->gsi_base + 1;
139}
140
141u32 mp_pin_to_gsi(int ioapic, int pin)
142{
143 return mp_ioapic_gsi_routing(ioapic)->gsi_base + pin;
144}
145
146/*
147 * Initialize all legacy IRQs and all pins on the first IOAPIC
148 * if we have legacy interrupt controller. Kernel boot option "pirq="
149 * may rely on non-legacy pins on the first IOAPIC.
150 */
151static inline int mp_init_irq_at_boot(int ioapic, int irq)
152{
153 if (!nr_legacy_irqs())
154 return 0;
155
156 return ioapic == 0 || (irq >= 0 && irq < nr_legacy_irqs());
157}
158
159static inline struct mp_pin_info *mp_pin_info(int ioapic_idx, int pin)
160{
161 return ioapics[ioapic_idx].pin_info + pin;
162}
163
164static inline struct irq_domain *mp_ioapic_irqdomain(int ioapic)
165{
166 return ioapics[ioapic].irqdomain;
167}
168
110int nr_ioapics; 169int nr_ioapics;
111 170
112/* The one past the highest gsi number used */ 171/* The one past the highest gsi number used */
@@ -118,9 +177,6 @@ struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES];
118/* # of MP IRQ source entries */ 177/* # of MP IRQ source entries */
119int mp_irq_entries; 178int mp_irq_entries;
120 179
121/* GSI interrupts */
122static int nr_irqs_gsi = NR_IRQS_LEGACY;
123
124#ifdef CONFIG_EISA 180#ifdef CONFIG_EISA
125int mp_bus_id_to_type[MAX_MP_BUSSES]; 181int mp_bus_id_to_type[MAX_MP_BUSSES];
126#endif 182#endif
@@ -149,8 +205,7 @@ static int __init parse_noapic(char *str)
149} 205}
150early_param("noapic", parse_noapic); 206early_param("noapic", parse_noapic);
151 207
152static int io_apic_setup_irq_pin(unsigned int irq, int node, 208static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node);
153 struct io_apic_irq_attr *attr);
154 209
155/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ 210/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */
156void mp_save_irq(struct mpc_intsrc *m) 211void mp_save_irq(struct mpc_intsrc *m)
@@ -182,19 +237,15 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
182 return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node); 237 return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node);
183} 238}
184 239
185
186/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
187static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
188
189int __init arch_early_irq_init(void) 240int __init arch_early_irq_init(void)
190{ 241{
191 struct irq_cfg *cfg; 242 struct irq_cfg *cfg;
192 int count, node, i; 243 int i, node = cpu_to_node(0);
193 244
194 if (!legacy_pic->nr_legacy_irqs) 245 if (!nr_legacy_irqs())
195 io_apic_irqs = ~0UL; 246 io_apic_irqs = ~0UL;
196 247
197 for (i = 0; i < nr_ioapics; i++) { 248 for_each_ioapic(i) {
198 ioapics[i].saved_registers = 249 ioapics[i].saved_registers =
199 kzalloc(sizeof(struct IO_APIC_route_entry) * 250 kzalloc(sizeof(struct IO_APIC_route_entry) *
200 ioapics[i].nr_registers, GFP_KERNEL); 251 ioapics[i].nr_registers, GFP_KERNEL);
@@ -202,28 +253,20 @@ int __init arch_early_irq_init(void)
202 pr_err("IOAPIC %d: suspend/resume impossible!\n", i); 253 pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
203 } 254 }
204 255
205 cfg = irq_cfgx; 256 /*
206 count = ARRAY_SIZE(irq_cfgx); 257 * For legacy IRQ's, start with assigning irq0 to irq15 to
207 node = cpu_to_node(0); 258 * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
208 259 */
209 for (i = 0; i < count; i++) { 260 for (i = 0; i < nr_legacy_irqs(); i++) {
210 irq_set_chip_data(i, &cfg[i]); 261 cfg = alloc_irq_and_cfg_at(i, node);
211 zalloc_cpumask_var_node(&cfg[i].domain, GFP_KERNEL, node); 262 cfg->vector = IRQ0_VECTOR + i;
212 zalloc_cpumask_var_node(&cfg[i].old_domain, GFP_KERNEL, node); 263 cpumask_setall(cfg->domain);
213 /*
214 * For legacy IRQ's, start with assigning irq0 to irq15 to
215 * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
216 */
217 if (i < legacy_pic->nr_legacy_irqs) {
218 cfg[i].vector = IRQ0_VECTOR + i;
219 cpumask_setall(cfg[i].domain);
220 }
221 } 264 }
222 265
223 return 0; 266 return 0;
224} 267}
225 268
226static struct irq_cfg *irq_cfg(unsigned int irq) 269static inline struct irq_cfg *irq_cfg(unsigned int irq)
227{ 270{
228 return irq_get_chip_data(irq); 271 return irq_get_chip_data(irq);
229} 272}
@@ -265,7 +308,7 @@ static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node)
265 if (res < 0) { 308 if (res < 0) {
266 if (res != -EEXIST) 309 if (res != -EEXIST)
267 return NULL; 310 return NULL;
268 cfg = irq_get_chip_data(at); 311 cfg = irq_cfg(at);
269 if (cfg) 312 if (cfg)
270 return cfg; 313 return cfg;
271 } 314 }
@@ -425,6 +468,21 @@ static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pi
425 return 0; 468 return 0;
426} 469}
427 470
471static void __remove_pin_from_irq(struct irq_cfg *cfg, int apic, int pin)
472{
473 struct irq_pin_list **last, *entry;
474
475 last = &cfg->irq_2_pin;
476 for_each_irq_pin(entry, cfg->irq_2_pin)
477 if (entry->apic == apic && entry->pin == pin) {
478 *last = entry->next;
479 kfree(entry);
480 return;
481 } else {
482 last = &entry->next;
483 }
484}
485
428static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) 486static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin)
429{ 487{
430 if (__add_pin_to_irq_node(cfg, node, apic, pin)) 488 if (__add_pin_to_irq_node(cfg, node, apic, pin))
@@ -627,9 +685,8 @@ static void clear_IO_APIC (void)
627{ 685{
628 int apic, pin; 686 int apic, pin;
629 687
630 for (apic = 0; apic < nr_ioapics; apic++) 688 for_each_ioapic_pin(apic, pin)
631 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) 689 clear_IO_APIC_pin(apic, pin);
632 clear_IO_APIC_pin(apic, pin);
633} 690}
634 691
635#ifdef CONFIG_X86_32 692#ifdef CONFIG_X86_32
@@ -678,13 +735,13 @@ int save_ioapic_entries(void)
678 int apic, pin; 735 int apic, pin;
679 int err = 0; 736 int err = 0;
680 737
681 for (apic = 0; apic < nr_ioapics; apic++) { 738 for_each_ioapic(apic) {
682 if (!ioapics[apic].saved_registers) { 739 if (!ioapics[apic].saved_registers) {
683 err = -ENOMEM; 740 err = -ENOMEM;
684 continue; 741 continue;
685 } 742 }
686 743
687 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) 744 for_each_pin(apic, pin)
688 ioapics[apic].saved_registers[pin] = 745 ioapics[apic].saved_registers[pin] =
689 ioapic_read_entry(apic, pin); 746 ioapic_read_entry(apic, pin);
690 } 747 }
@@ -699,11 +756,11 @@ void mask_ioapic_entries(void)
699{ 756{
700 int apic, pin; 757 int apic, pin;
701 758
702 for (apic = 0; apic < nr_ioapics; apic++) { 759 for_each_ioapic(apic) {
703 if (!ioapics[apic].saved_registers) 760 if (!ioapics[apic].saved_registers)
704 continue; 761 continue;
705 762
706 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) { 763 for_each_pin(apic, pin) {
707 struct IO_APIC_route_entry entry; 764 struct IO_APIC_route_entry entry;
708 765
709 entry = ioapics[apic].saved_registers[pin]; 766 entry = ioapics[apic].saved_registers[pin];
@@ -722,11 +779,11 @@ int restore_ioapic_entries(void)
722{ 779{
723 int apic, pin; 780 int apic, pin;
724 781
725 for (apic = 0; apic < nr_ioapics; apic++) { 782 for_each_ioapic(apic) {
726 if (!ioapics[apic].saved_registers) 783 if (!ioapics[apic].saved_registers)
727 continue; 784 continue;
728 785
729 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) 786 for_each_pin(apic, pin)
730 ioapic_write_entry(apic, pin, 787 ioapic_write_entry(apic, pin,
731 ioapics[apic].saved_registers[pin]); 788 ioapics[apic].saved_registers[pin]);
732 } 789 }
@@ -785,7 +842,7 @@ static int __init find_isa_irq_apic(int irq, int type)
785 if (i < mp_irq_entries) { 842 if (i < mp_irq_entries) {
786 int ioapic_idx; 843 int ioapic_idx;
787 844
788 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 845 for_each_ioapic(ioapic_idx)
789 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic) 846 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic)
790 return ioapic_idx; 847 return ioapic_idx;
791 } 848 }
@@ -799,7 +856,7 @@ static int __init find_isa_irq_apic(int irq, int type)
799 */ 856 */
800static int EISA_ELCR(unsigned int irq) 857static int EISA_ELCR(unsigned int irq)
801{ 858{
802 if (irq < legacy_pic->nr_legacy_irqs) { 859 if (irq < nr_legacy_irqs()) {
803 unsigned int port = 0x4d0 + (irq >> 3); 860 unsigned int port = 0x4d0 + (irq >> 3);
804 return (inb(port) >> (irq & 7)) & 1; 861 return (inb(port) >> (irq & 7)) & 1;
805 } 862 }
@@ -939,29 +996,101 @@ static int irq_trigger(int idx)
939 return trigger; 996 return trigger;
940} 997}
941 998
942static int pin_2_irq(int idx, int apic, int pin) 999static int alloc_irq_from_domain(struct irq_domain *domain, u32 gsi, int pin)
1000{
1001 int irq = -1;
1002 int ioapic = (int)(long)domain->host_data;
1003 int type = ioapics[ioapic].irqdomain_cfg.type;
1004
1005 switch (type) {
1006 case IOAPIC_DOMAIN_LEGACY:
1007 /*
1008 * Dynamically allocate IRQ number for non-ISA IRQs in the first 16
1009 * GSIs on some weird platforms.
1010 */
1011 if (gsi < nr_legacy_irqs())
1012 irq = irq_create_mapping(domain, pin);
1013 else if (irq_create_strict_mappings(domain, gsi, pin, 1) == 0)
1014 irq = gsi;
1015 break;
1016 case IOAPIC_DOMAIN_STRICT:
1017 if (irq_create_strict_mappings(domain, gsi, pin, 1) == 0)
1018 irq = gsi;
1019 break;
1020 case IOAPIC_DOMAIN_DYNAMIC:
1021 irq = irq_create_mapping(domain, pin);
1022 break;
1023 default:
1024 WARN(1, "ioapic: unknown irqdomain type %d\n", type);
1025 break;
1026 }
1027
1028 return irq > 0 ? irq : -1;
1029}
1030
1031static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin,
1032 unsigned int flags)
943{ 1033{
944 int irq; 1034 int irq;
945 int bus = mp_irqs[idx].srcbus; 1035 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic);
946 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(apic); 1036 struct mp_pin_info *info = mp_pin_info(ioapic, pin);
1037
1038 if (!domain)
1039 return -1;
1040
1041 mutex_lock(&ioapic_mutex);
947 1042
948 /* 1043 /*
949 * Debugging check, we are in big trouble if this message pops up! 1044 * Don't use irqdomain to manage ISA IRQs because there may be
1045 * multiple IOAPIC pins sharing the same ISA IRQ number and
1046 * irqdomain only supports 1:1 mapping between IOAPIC pin and
1047 * IRQ number. A typical IOAPIC has 24 pins, pin 0-15 are used
1048 * for legacy IRQs and pin 16-23 are used for PCI IRQs (PIRQ A-H).
1049 * When ACPI is disabled, only legacy IRQ numbers (IRQ0-15) are
1050 * available, and some BIOSes may use MP Interrupt Source records
1051 * to override IRQ numbers for PIRQs instead of reprogramming
1052 * the interrupt routing logic. Thus there may be multiple pins
1053 * sharing the same legacy IRQ number when ACPI is disabled.
950 */ 1054 */
951 if (mp_irqs[idx].dstirq != pin) 1055 if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
952 pr_err("broken BIOS or MPTABLE parser, ayiee!!\n");
953
954 if (test_bit(bus, mp_bus_not_pci)) {
955 irq = mp_irqs[idx].srcbusirq; 1056 irq = mp_irqs[idx].srcbusirq;
1057 if (flags & IOAPIC_MAP_ALLOC) {
1058 if (info->count == 0 &&
1059 mp_irqdomain_map(domain, irq, pin) != 0)
1060 irq = -1;
1061
1062 /* special handling for timer IRQ0 */
1063 if (irq == 0)
1064 info->count++;
1065 }
956 } else { 1066 } else {
957 u32 gsi = gsi_cfg->gsi_base + pin; 1067 irq = irq_find_mapping(domain, pin);
1068 if (irq <= 0 && (flags & IOAPIC_MAP_ALLOC))
1069 irq = alloc_irq_from_domain(domain, gsi, pin);
1070 }
958 1071
959 if (gsi >= NR_IRQS_LEGACY) 1072 if (flags & IOAPIC_MAP_ALLOC) {
960 irq = gsi; 1073 if (irq > 0)
961 else 1074 info->count++;
962 irq = gsi_top + gsi; 1075 else if (info->count == 0)
1076 info->set = 0;
963 } 1077 }
964 1078
1079 mutex_unlock(&ioapic_mutex);
1080
1081 return irq > 0 ? irq : -1;
1082}
1083
1084static int pin_2_irq(int idx, int ioapic, int pin, unsigned int flags)
1085{
1086 u32 gsi = mp_pin_to_gsi(ioapic, pin);
1087
1088 /*
1089 * Debugging check, we are in big trouble if this message pops up!
1090 */
1091 if (mp_irqs[idx].dstirq != pin)
1092 pr_err("broken BIOS or MPTABLE parser, ayiee!!\n");
1093
965#ifdef CONFIG_X86_32 1094#ifdef CONFIG_X86_32
966 /* 1095 /*
967 * PCI IRQ command line redirection. Yes, limits are hardcoded. 1096 * PCI IRQ command line redirection. Yes, limits are hardcoded.
@@ -972,16 +1101,58 @@ static int pin_2_irq(int idx, int apic, int pin)
972 apic_printk(APIC_VERBOSE, KERN_DEBUG 1101 apic_printk(APIC_VERBOSE, KERN_DEBUG
973 "disabling PIRQ%d\n", pin-16); 1102 "disabling PIRQ%d\n", pin-16);
974 } else { 1103 } else {
975 irq = pirq_entries[pin-16]; 1104 int irq = pirq_entries[pin-16];
976 apic_printk(APIC_VERBOSE, KERN_DEBUG 1105 apic_printk(APIC_VERBOSE, KERN_DEBUG
977 "using PIRQ%d -> IRQ %d\n", 1106 "using PIRQ%d -> IRQ %d\n",
978 pin-16, irq); 1107 pin-16, irq);
1108 return irq;
979 } 1109 }
980 } 1110 }
981 } 1111 }
982#endif 1112#endif
983 1113
984 return irq; 1114 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags);
1115}
1116
1117int mp_map_gsi_to_irq(u32 gsi, unsigned int flags)
1118{
1119 int ioapic, pin, idx;
1120
1121 ioapic = mp_find_ioapic(gsi);
1122 if (ioapic < 0)
1123 return -1;
1124
1125 pin = mp_find_ioapic_pin(ioapic, gsi);
1126 idx = find_irq_entry(ioapic, pin, mp_INT);
1127 if ((flags & IOAPIC_MAP_CHECK) && idx < 0)
1128 return -1;
1129
1130 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags);
1131}
1132
1133void mp_unmap_irq(int irq)
1134{
1135 struct irq_data *data = irq_get_irq_data(irq);
1136 struct mp_pin_info *info;
1137 int ioapic, pin;
1138
1139 if (!data || !data->domain)
1140 return;
1141
1142 ioapic = (int)(long)data->domain->host_data;
1143 pin = (int)data->hwirq;
1144 info = mp_pin_info(ioapic, pin);
1145
1146 mutex_lock(&ioapic_mutex);
1147 if (--info->count == 0) {
1148 info->set = 0;
1149 if (irq < nr_legacy_irqs() &&
1150 ioapics[ioapic].irqdomain_cfg.type == IOAPIC_DOMAIN_LEGACY)
1151 mp_irqdomain_unmap(data->domain, irq);
1152 else
1153 irq_dispose_mapping(irq);
1154 }
1155 mutex_unlock(&ioapic_mutex);
985} 1156}
986 1157
987/* 1158/*
@@ -991,7 +1162,7 @@ static int pin_2_irq(int idx, int apic, int pin)
991int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, 1162int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
992 struct io_apic_irq_attr *irq_attr) 1163 struct io_apic_irq_attr *irq_attr)
993{ 1164{
994 int ioapic_idx, i, best_guess = -1; 1165 int irq, i, best_ioapic = -1, best_idx = -1;
995 1166
996 apic_printk(APIC_DEBUG, 1167 apic_printk(APIC_DEBUG,
997 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", 1168 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
@@ -1001,44 +1172,56 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
1001 "PCI BIOS passed nonexistent PCI bus %d!\n", bus); 1172 "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
1002 return -1; 1173 return -1;
1003 } 1174 }
1175
1004 for (i = 0; i < mp_irq_entries; i++) { 1176 for (i = 0; i < mp_irq_entries; i++) {
1005 int lbus = mp_irqs[i].srcbus; 1177 int lbus = mp_irqs[i].srcbus;
1178 int ioapic_idx, found = 0;
1006 1179
1007 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1180 if (bus != lbus || mp_irqs[i].irqtype != mp_INT ||
1181 slot != ((mp_irqs[i].srcbusirq >> 2) & 0x1f))
1182 continue;
1183
1184 for_each_ioapic(ioapic_idx)
1008 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || 1185 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic ||
1009 mp_irqs[i].dstapic == MP_APIC_ALL) 1186 mp_irqs[i].dstapic == MP_APIC_ALL) {
1187 found = 1;
1010 break; 1188 break;
1189 }
1190 if (!found)
1191 continue;
1011 1192
1012 if (!test_bit(lbus, mp_bus_not_pci) && 1193 /* Skip ISA IRQs */
1013 !mp_irqs[i].irqtype && 1194 irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq, 0);
1014 (bus == lbus) && 1195 if (irq > 0 && !IO_APIC_IRQ(irq))
1015 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { 1196 continue;
1016 int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1017 1197
1018 if (!(ioapic_idx || IO_APIC_IRQ(irq))) 1198 if (pin == (mp_irqs[i].srcbusirq & 3)) {
1019 continue; 1199 best_idx = i;
1200 best_ioapic = ioapic_idx;
1201 goto out;
1202 }
1020 1203
1021 if (pin == (mp_irqs[i].srcbusirq & 3)) { 1204 /*
1022 set_io_apic_irq_attr(irq_attr, ioapic_idx, 1205 * Use the first all-but-pin matching entry as a
1023 mp_irqs[i].dstirq, 1206 * best-guess fuzzy result for broken mptables.
1024 irq_trigger(i), 1207 */
1025 irq_polarity(i)); 1208 if (best_idx < 0) {
1026 return irq; 1209 best_idx = i;
1027 } 1210 best_ioapic = ioapic_idx;
1028 /*
1029 * Use the first all-but-pin matching entry as a
1030 * best-guess fuzzy result for broken mptables.
1031 */
1032 if (best_guess < 0) {
1033 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1034 mp_irqs[i].dstirq,
1035 irq_trigger(i),
1036 irq_polarity(i));
1037 best_guess = irq;
1038 }
1039 } 1211 }
1040 } 1212 }
1041 return best_guess; 1213 if (best_idx < 0)
1214 return -1;
1215
1216out:
1217 irq = pin_2_irq(best_idx, best_ioapic, mp_irqs[best_idx].dstirq,
1218 IOAPIC_MAP_ALLOC);
1219 if (irq > 0)
1220 set_io_apic_irq_attr(irq_attr, best_ioapic,
1221 mp_irqs[best_idx].dstirq,
1222 irq_trigger(best_idx),
1223 irq_polarity(best_idx));
1224 return irq;
1042} 1225}
1043EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector); 1226EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
1044 1227
@@ -1198,7 +1381,7 @@ void __setup_vector_irq(int cpu)
1198 raw_spin_lock(&vector_lock); 1381 raw_spin_lock(&vector_lock);
1199 /* Mark the inuse vectors */ 1382 /* Mark the inuse vectors */
1200 for_each_active_irq(irq) { 1383 for_each_active_irq(irq) {
1201 cfg = irq_get_chip_data(irq); 1384 cfg = irq_cfg(irq);
1202 if (!cfg) 1385 if (!cfg)
1203 continue; 1386 continue;
1204 1387
@@ -1227,12 +1410,10 @@ static inline int IO_APIC_irq_trigger(int irq)
1227{ 1410{
1228 int apic, idx, pin; 1411 int apic, idx, pin;
1229 1412
1230 for (apic = 0; apic < nr_ioapics; apic++) { 1413 for_each_ioapic_pin(apic, pin) {
1231 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) { 1414 idx = find_irq_entry(apic, pin, mp_INT);
1232 idx = find_irq_entry(apic, pin, mp_INT); 1415 if ((idx != -1) && (irq == pin_2_irq(idx, apic, pin, 0)))
1233 if ((idx != -1) && (irq == pin_2_irq(idx, apic, pin))) 1416 return irq_trigger(idx);
1234 return irq_trigger(idx);
1235 }
1236 } 1417 }
1237 /* 1418 /*
1238 * nonexistent IRQs are edge default 1419 * nonexistent IRQs are edge default
@@ -1330,95 +1511,29 @@ static void setup_ioapic_irq(unsigned int irq, struct irq_cfg *cfg,
1330 } 1511 }
1331 1512
1332 ioapic_register_intr(irq, cfg, attr->trigger); 1513 ioapic_register_intr(irq, cfg, attr->trigger);
1333 if (irq < legacy_pic->nr_legacy_irqs) 1514 if (irq < nr_legacy_irqs())
1334 legacy_pic->mask(irq); 1515 legacy_pic->mask(irq);
1335 1516
1336 ioapic_write_entry(attr->ioapic, attr->ioapic_pin, entry); 1517 ioapic_write_entry(attr->ioapic, attr->ioapic_pin, entry);
1337} 1518}
1338 1519
1339static bool __init io_apic_pin_not_connected(int idx, int ioapic_idx, int pin)
1340{
1341 if (idx != -1)
1342 return false;
1343
1344 apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n",
1345 mpc_ioapic_id(ioapic_idx), pin);
1346 return true;
1347}
1348
1349static void __init __io_apic_setup_irqs(unsigned int ioapic_idx)
1350{
1351 int idx, node = cpu_to_node(0);
1352 struct io_apic_irq_attr attr;
1353 unsigned int pin, irq;
1354
1355 for (pin = 0; pin < ioapics[ioapic_idx].nr_registers; pin++) {
1356 idx = find_irq_entry(ioapic_idx, pin, mp_INT);
1357 if (io_apic_pin_not_connected(idx, ioapic_idx, pin))
1358 continue;
1359
1360 irq = pin_2_irq(idx, ioapic_idx, pin);
1361
1362 if ((ioapic_idx > 0) && (irq > 16))
1363 continue;
1364
1365 /*
1366 * Skip the timer IRQ if there's a quirk handler
1367 * installed and if it returns 1:
1368 */
1369 if (apic->multi_timer_check &&
1370 apic->multi_timer_check(ioapic_idx, irq))
1371 continue;
1372
1373 set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx),
1374 irq_polarity(idx));
1375
1376 io_apic_setup_irq_pin(irq, node, &attr);
1377 }
1378}
1379
1380static void __init setup_IO_APIC_irqs(void) 1520static void __init setup_IO_APIC_irqs(void)
1381{ 1521{
1382 unsigned int ioapic_idx; 1522 unsigned int ioapic, pin;
1523 int idx;
1383 1524
1384 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); 1525 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
1385 1526
1386 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1527 for_each_ioapic_pin(ioapic, pin) {
1387 __io_apic_setup_irqs(ioapic_idx); 1528 idx = find_irq_entry(ioapic, pin, mp_INT);
1388} 1529 if (idx < 0)
1389 1530 apic_printk(APIC_VERBOSE,
1390/* 1531 KERN_DEBUG " apic %d pin %d not connected\n",
1391 * for the gsit that is not in first ioapic 1532 mpc_ioapic_id(ioapic), pin);
1392 * but could not use acpi_register_gsi() 1533 else
1393 * like some special sci in IBM x3330 1534 pin_2_irq(idx, ioapic, pin,
1394 */ 1535 ioapic ? 0 : IOAPIC_MAP_ALLOC);
1395void setup_IO_APIC_irq_extra(u32 gsi) 1536 }
1396{
1397 int ioapic_idx = 0, pin, idx, irq, node = cpu_to_node(0);
1398 struct io_apic_irq_attr attr;
1399
1400 /*
1401 * Convert 'gsi' to 'ioapic.pin'.
1402 */
1403 ioapic_idx = mp_find_ioapic(gsi);
1404 if (ioapic_idx < 0)
1405 return;
1406
1407 pin = mp_find_ioapic_pin(ioapic_idx, gsi);
1408 idx = find_irq_entry(ioapic_idx, pin, mp_INT);
1409 if (idx == -1)
1410 return;
1411
1412 irq = pin_2_irq(idx, ioapic_idx, pin);
1413
1414 /* Only handle the non legacy irqs on secondary ioapics */
1415 if (ioapic_idx == 0 || irq < NR_IRQS_LEGACY)
1416 return;
1417
1418 set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx),
1419 irq_polarity(idx));
1420
1421 io_apic_setup_irq_pin_once(irq, node, &attr);
1422} 1537}
1423 1538
1424/* 1539/*
@@ -1586,7 +1701,7 @@ __apicdebuginit(void) print_IO_APICs(void)
1586 struct irq_chip *chip; 1701 struct irq_chip *chip;
1587 1702
1588 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); 1703 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
1589 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1704 for_each_ioapic(ioapic_idx)
1590 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", 1705 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
1591 mpc_ioapic_id(ioapic_idx), 1706 mpc_ioapic_id(ioapic_idx),
1592 ioapics[ioapic_idx].nr_registers); 1707 ioapics[ioapic_idx].nr_registers);
@@ -1597,7 +1712,7 @@ __apicdebuginit(void) print_IO_APICs(void)
1597 */ 1712 */
1598 printk(KERN_INFO "testing the IO APIC.......................\n"); 1713 printk(KERN_INFO "testing the IO APIC.......................\n");
1599 1714
1600 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) 1715 for_each_ioapic(ioapic_idx)
1601 print_IO_APIC(ioapic_idx); 1716 print_IO_APIC(ioapic_idx);
1602 1717
1603 printk(KERN_DEBUG "IRQ to pin mappings:\n"); 1718 printk(KERN_DEBUG "IRQ to pin mappings:\n");
@@ -1608,7 +1723,7 @@ __apicdebuginit(void) print_IO_APICs(void)
1608 if (chip != &ioapic_chip) 1723 if (chip != &ioapic_chip)
1609 continue; 1724 continue;
1610 1725
1611 cfg = irq_get_chip_data(irq); 1726 cfg = irq_cfg(irq);
1612 if (!cfg) 1727 if (!cfg)
1613 continue; 1728 continue;
1614 entry = cfg->irq_2_pin; 1729 entry = cfg->irq_2_pin;
@@ -1758,7 +1873,7 @@ __apicdebuginit(void) print_PIC(void)
1758 unsigned int v; 1873 unsigned int v;
1759 unsigned long flags; 1874 unsigned long flags;
1760 1875
1761 if (!legacy_pic->nr_legacy_irqs) 1876 if (!nr_legacy_irqs())
1762 return; 1877 return;
1763 1878
1764 printk(KERN_DEBUG "\nprinting PIC contents\n"); 1879 printk(KERN_DEBUG "\nprinting PIC contents\n");
@@ -1828,26 +1943,22 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
1828void __init enable_IO_APIC(void) 1943void __init enable_IO_APIC(void)
1829{ 1944{
1830 int i8259_apic, i8259_pin; 1945 int i8259_apic, i8259_pin;
1831 int apic; 1946 int apic, pin;
1832 1947
1833 if (!legacy_pic->nr_legacy_irqs) 1948 if (!nr_legacy_irqs())
1834 return; 1949 return;
1835 1950
1836 for(apic = 0; apic < nr_ioapics; apic++) { 1951 for_each_ioapic_pin(apic, pin) {
1837 int pin;
1838 /* See if any of the pins is in ExtINT mode */ 1952 /* See if any of the pins is in ExtINT mode */
1839 for (pin = 0; pin < ioapics[apic].nr_registers; pin++) { 1953 struct IO_APIC_route_entry entry = ioapic_read_entry(apic, pin);
1840 struct IO_APIC_route_entry entry;
1841 entry = ioapic_read_entry(apic, pin);
1842 1954
1843 /* If the interrupt line is enabled and in ExtInt mode 1955 /* If the interrupt line is enabled and in ExtInt mode
1844 * I have found the pin where the i8259 is connected. 1956 * I have found the pin where the i8259 is connected.
1845 */ 1957 */
1846 if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) { 1958 if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
1847 ioapic_i8259.apic = apic; 1959 ioapic_i8259.apic = apic;
1848 ioapic_i8259.pin = pin; 1960 ioapic_i8259.pin = pin;
1849 goto found_i8259; 1961 goto found_i8259;
1850 }
1851 } 1962 }
1852 } 1963 }
1853 found_i8259: 1964 found_i8259:
@@ -1919,7 +2030,7 @@ void disable_IO_APIC(void)
1919 */ 2030 */
1920 clear_IO_APIC(); 2031 clear_IO_APIC();
1921 2032
1922 if (!legacy_pic->nr_legacy_irqs) 2033 if (!nr_legacy_irqs())
1923 return; 2034 return;
1924 2035
1925 x86_io_apic_ops.disable(); 2036 x86_io_apic_ops.disable();
@@ -1950,7 +2061,7 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
1950 /* 2061 /*
1951 * Set the IOAPIC ID to the value stored in the MPC table. 2062 * Set the IOAPIC ID to the value stored in the MPC table.
1952 */ 2063 */
1953 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) { 2064 for_each_ioapic(ioapic_idx) {
1954 /* Read the register 0 value */ 2065 /* Read the register 0 value */
1955 raw_spin_lock_irqsave(&ioapic_lock, flags); 2066 raw_spin_lock_irqsave(&ioapic_lock, flags);
1956 reg_00.raw = io_apic_read(ioapic_idx, 0); 2067 reg_00.raw = io_apic_read(ioapic_idx, 0);
@@ -2123,7 +2234,7 @@ static unsigned int startup_ioapic_irq(struct irq_data *data)
2123 unsigned long flags; 2234 unsigned long flags;
2124 2235
2125 raw_spin_lock_irqsave(&ioapic_lock, flags); 2236 raw_spin_lock_irqsave(&ioapic_lock, flags);
2126 if (irq < legacy_pic->nr_legacy_irqs) { 2237 if (irq < nr_legacy_irqs()) {
2127 legacy_pic->mask(irq); 2238 legacy_pic->mask(irq);
2128 if (legacy_pic->irq_pending(irq)) 2239 if (legacy_pic->irq_pending(irq))
2129 was_pending = 1; 2240 was_pending = 1;
@@ -2225,7 +2336,7 @@ asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
2225 apic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR); 2336 apic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
2226 goto unlock; 2337 goto unlock;
2227 } 2338 }
2228 __this_cpu_write(vector_irq[vector], -1); 2339 __this_cpu_write(vector_irq[vector], VECTOR_UNDEFINED);
2229unlock: 2340unlock:
2230 raw_spin_unlock(&desc->lock); 2341 raw_spin_unlock(&desc->lock);
2231 } 2342 }
@@ -2253,7 +2364,7 @@ static void irq_complete_move(struct irq_cfg *cfg)
2253 2364
2254void irq_force_complete_move(int irq) 2365void irq_force_complete_move(int irq)
2255{ 2366{
2256 struct irq_cfg *cfg = irq_get_chip_data(irq); 2367 struct irq_cfg *cfg = irq_cfg(irq);
2257 2368
2258 if (!cfg) 2369 if (!cfg)
2259 return; 2370 return;
@@ -2514,26 +2625,15 @@ static inline void init_IO_APIC_traps(void)
2514 struct irq_cfg *cfg; 2625 struct irq_cfg *cfg;
2515 unsigned int irq; 2626 unsigned int irq;
2516 2627
2517 /*
2518 * NOTE! The local APIC isn't very good at handling
2519 * multiple interrupts at the same interrupt level.
2520 * As the interrupt level is determined by taking the
2521 * vector number and shifting that right by 4, we
2522 * want to spread these out a bit so that they don't
2523 * all fall in the same interrupt level.
2524 *
2525 * Also, we've got to be careful not to trash gate
2526 * 0x80, because int 0x80 is hm, kind of importantish. ;)
2527 */
2528 for_each_active_irq(irq) { 2628 for_each_active_irq(irq) {
2529 cfg = irq_get_chip_data(irq); 2629 cfg = irq_cfg(irq);
2530 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) { 2630 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
2531 /* 2631 /*
2532 * Hmm.. We don't have an entry for this, 2632 * Hmm.. We don't have an entry for this,
2533 * so default to an old-fashioned 8259 2633 * so default to an old-fashioned 8259
2534 * interrupt if we can.. 2634 * interrupt if we can..
2535 */ 2635 */
2536 if (irq < legacy_pic->nr_legacy_irqs) 2636 if (irq < nr_legacy_irqs())
2537 legacy_pic->make_irq(irq); 2637 legacy_pic->make_irq(irq);
2538 else 2638 else
2539 /* Strange. Oh, well.. */ 2639 /* Strange. Oh, well.. */
@@ -2649,8 +2749,6 @@ static int __init disable_timer_pin_setup(char *arg)
2649} 2749}
2650early_param("disable_timer_pin_1", disable_timer_pin_setup); 2750early_param("disable_timer_pin_1", disable_timer_pin_setup);
2651 2751
2652int timer_through_8259 __initdata;
2653
2654/* 2752/*
2655 * This code may look a bit paranoid, but it's supposed to cooperate with 2753 * This code may look a bit paranoid, but it's supposed to cooperate with
2656 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 2754 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -2661,7 +2759,7 @@ int timer_through_8259 __initdata;
2661 */ 2759 */
2662static inline void __init check_timer(void) 2760static inline void __init check_timer(void)
2663{ 2761{
2664 struct irq_cfg *cfg = irq_get_chip_data(0); 2762 struct irq_cfg *cfg = irq_cfg(0);
2665 int node = cpu_to_node(0); 2763 int node = cpu_to_node(0);
2666 int apic1, pin1, apic2, pin2; 2764 int apic1, pin1, apic2, pin2;
2667 unsigned long flags; 2765 unsigned long flags;
@@ -2755,7 +2853,6 @@ static inline void __init check_timer(void)
2755 legacy_pic->unmask(0); 2853 legacy_pic->unmask(0);
2756 if (timer_irq_works()) { 2854 if (timer_irq_works()) {
2757 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n"); 2855 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
2758 timer_through_8259 = 1;
2759 goto out; 2856 goto out;
2760 } 2857 }
2761 /* 2858 /*
@@ -2827,15 +2924,54 @@ out:
2827 */ 2924 */
2828#define PIC_IRQS (1UL << PIC_CASCADE_IR) 2925#define PIC_IRQS (1UL << PIC_CASCADE_IR)
2829 2926
2927static int mp_irqdomain_create(int ioapic)
2928{
2929 size_t size;
2930 int hwirqs = mp_ioapic_pin_count(ioapic);
2931 struct ioapic *ip = &ioapics[ioapic];
2932 struct ioapic_domain_cfg *cfg = &ip->irqdomain_cfg;
2933 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic);
2934
2935 size = sizeof(struct mp_pin_info) * mp_ioapic_pin_count(ioapic);
2936 ip->pin_info = kzalloc(size, GFP_KERNEL);
2937 if (!ip->pin_info)
2938 return -ENOMEM;
2939
2940 if (cfg->type == IOAPIC_DOMAIN_INVALID)
2941 return 0;
2942
2943 ip->irqdomain = irq_domain_add_linear(cfg->dev, hwirqs, cfg->ops,
2944 (void *)(long)ioapic);
2945 if(!ip->irqdomain) {
2946 kfree(ip->pin_info);
2947 ip->pin_info = NULL;
2948 return -ENOMEM;
2949 }
2950
2951 if (cfg->type == IOAPIC_DOMAIN_LEGACY ||
2952 cfg->type == IOAPIC_DOMAIN_STRICT)
2953 ioapic_dynirq_base = max(ioapic_dynirq_base,
2954 gsi_cfg->gsi_end + 1);
2955
2956 if (gsi_cfg->gsi_base == 0)
2957 irq_set_default_host(ip->irqdomain);
2958
2959 return 0;
2960}
2961
2830void __init setup_IO_APIC(void) 2962void __init setup_IO_APIC(void)
2831{ 2963{
2964 int ioapic;
2832 2965
2833 /* 2966 /*
2834 * calling enable_IO_APIC() is moved to setup_local_APIC for BP 2967 * calling enable_IO_APIC() is moved to setup_local_APIC for BP
2835 */ 2968 */
2836 io_apic_irqs = legacy_pic->nr_legacy_irqs ? ~PIC_IRQS : ~0UL; 2969 io_apic_irqs = nr_legacy_irqs() ? ~PIC_IRQS : ~0UL;
2837 2970
2838 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); 2971 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
2972 for_each_ioapic(ioapic)
2973 BUG_ON(mp_irqdomain_create(ioapic));
2974
2839 /* 2975 /*
2840 * Set up IO-APIC IRQ routing. 2976 * Set up IO-APIC IRQ routing.
2841 */ 2977 */
@@ -2844,8 +2980,10 @@ void __init setup_IO_APIC(void)
2844 sync_Arb_IDs(); 2980 sync_Arb_IDs();
2845 setup_IO_APIC_irqs(); 2981 setup_IO_APIC_irqs();
2846 init_IO_APIC_traps(); 2982 init_IO_APIC_traps();
2847 if (legacy_pic->nr_legacy_irqs) 2983 if (nr_legacy_irqs())
2848 check_timer(); 2984 check_timer();
2985
2986 ioapic_initialized = 1;
2849} 2987}
2850 2988
2851/* 2989/*
@@ -2880,7 +3018,7 @@ static void ioapic_resume(void)
2880{ 3018{
2881 int ioapic_idx; 3019 int ioapic_idx;
2882 3020
2883 for (ioapic_idx = nr_ioapics - 1; ioapic_idx >= 0; ioapic_idx--) 3021 for_each_ioapic_reverse(ioapic_idx)
2884 resume_ioapic_id(ioapic_idx); 3022 resume_ioapic_id(ioapic_idx);
2885 3023
2886 restore_ioapic_entries(); 3024 restore_ioapic_entries();
@@ -2926,7 +3064,7 @@ int arch_setup_hwirq(unsigned int irq, int node)
2926 3064
2927void arch_teardown_hwirq(unsigned int irq) 3065void arch_teardown_hwirq(unsigned int irq)
2928{ 3066{
2929 struct irq_cfg *cfg = irq_get_chip_data(irq); 3067 struct irq_cfg *cfg = irq_cfg(irq);
2930 unsigned long flags; 3068 unsigned long flags;
2931 3069
2932 free_remapped_irq(irq); 3070 free_remapped_irq(irq);
@@ -3053,7 +3191,7 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
3053 if (!irq_offset) 3191 if (!irq_offset)
3054 write_msi_msg(irq, &msg); 3192 write_msi_msg(irq, &msg);
3055 3193
3056 setup_remapped_irq(irq, irq_get_chip_data(irq), chip); 3194 setup_remapped_irq(irq, irq_cfg(irq), chip);
3057 3195
3058 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3196 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
3059 3197
@@ -3192,7 +3330,7 @@ int default_setup_hpet_msi(unsigned int irq, unsigned int id)
3192 3330
3193 hpet_msi_write(irq_get_handler_data(irq), &msg); 3331 hpet_msi_write(irq_get_handler_data(irq), &msg);
3194 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3332 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3195 setup_remapped_irq(irq, irq_get_chip_data(irq), chip); 3333 setup_remapped_irq(irq, irq_cfg(irq), chip);
3196 3334
3197 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3335 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
3198 return 0; 3336 return 0;
@@ -3303,27 +3441,6 @@ io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr)
3303 return ret; 3441 return ret;
3304} 3442}
3305 3443
3306int io_apic_setup_irq_pin_once(unsigned int irq, int node,
3307 struct io_apic_irq_attr *attr)
3308{
3309 unsigned int ioapic_idx = attr->ioapic, pin = attr->ioapic_pin;
3310 int ret;
3311 struct IO_APIC_route_entry orig_entry;
3312
3313 /* Avoid redundant programming */
3314 if (test_bit(pin, ioapics[ioapic_idx].pin_programmed)) {
3315 pr_debug("Pin %d-%d already programmed\n", mpc_ioapic_id(ioapic_idx), pin);
3316 orig_entry = ioapic_read_entry(attr->ioapic, pin);
3317 if (attr->trigger == orig_entry.trigger && attr->polarity == orig_entry.polarity)
3318 return 0;
3319 return -EBUSY;
3320 }
3321 ret = io_apic_setup_irq_pin(irq, node, attr);
3322 if (!ret)
3323 set_bit(pin, ioapics[ioapic_idx].pin_programmed);
3324 return ret;
3325}
3326
3327static int __init io_apic_get_redir_entries(int ioapic) 3444static int __init io_apic_get_redir_entries(int ioapic)
3328{ 3445{
3329 union IO_APIC_reg_01 reg_01; 3446 union IO_APIC_reg_01 reg_01;
@@ -3340,20 +3457,13 @@ static int __init io_apic_get_redir_entries(int ioapic)
3340 return reg_01.bits.entries + 1; 3457 return reg_01.bits.entries + 1;
3341} 3458}
3342 3459
3343static void __init probe_nr_irqs_gsi(void)
3344{
3345 int nr;
3346
3347 nr = gsi_top + NR_IRQS_LEGACY;
3348 if (nr > nr_irqs_gsi)
3349 nr_irqs_gsi = nr;
3350
3351 printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
3352}
3353
3354unsigned int arch_dynirq_lower_bound(unsigned int from) 3460unsigned int arch_dynirq_lower_bound(unsigned int from)
3355{ 3461{
3356 return from < nr_irqs_gsi ? nr_irqs_gsi : from; 3462 /*
3463 * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
3464 * gsi_top if ioapic_dynirq_base hasn't been initialized yet.
3465 */
3466 return ioapic_initialized ? ioapic_dynirq_base : gsi_top;
3357} 3467}
3358 3468
3359int __init arch_probe_nr_irqs(void) 3469int __init arch_probe_nr_irqs(void)
@@ -3363,33 +3473,17 @@ int __init arch_probe_nr_irqs(void)
3363 if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) 3473 if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
3364 nr_irqs = NR_VECTORS * nr_cpu_ids; 3474 nr_irqs = NR_VECTORS * nr_cpu_ids;
3365 3475
3366 nr = nr_irqs_gsi + 8 * nr_cpu_ids; 3476 nr = (gsi_top + nr_legacy_irqs()) + 8 * nr_cpu_ids;
3367#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ) 3477#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
3368 /* 3478 /*
3369 * for MSI and HT dyn irq 3479 * for MSI and HT dyn irq
3370 */ 3480 */
3371 nr += nr_irqs_gsi * 16; 3481 nr += gsi_top * 16;
3372#endif 3482#endif
3373 if (nr < nr_irqs) 3483 if (nr < nr_irqs)
3374 nr_irqs = nr; 3484 nr_irqs = nr;
3375 3485
3376 return NR_IRQS_LEGACY; 3486 return 0;
3377}
3378
3379int io_apic_set_pci_routing(struct device *dev, int irq,
3380 struct io_apic_irq_attr *irq_attr)
3381{
3382 int node;
3383
3384 if (!IO_APIC_IRQ(irq)) {
3385 apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
3386 irq_attr->ioapic);
3387 return -EINVAL;
3388 }
3389
3390 node = dev ? dev_to_node(dev) : cpu_to_node(0);
3391
3392 return io_apic_setup_irq_pin_once(irq, node, irq_attr);
3393} 3487}
3394 3488
3395#ifdef CONFIG_X86_32 3489#ifdef CONFIG_X86_32
@@ -3483,9 +3577,8 @@ static u8 __init io_apic_unique_id(u8 id)
3483 DECLARE_BITMAP(used, 256); 3577 DECLARE_BITMAP(used, 256);
3484 3578
3485 bitmap_zero(used, 256); 3579 bitmap_zero(used, 256);
3486 for (i = 0; i < nr_ioapics; i++) { 3580 for_each_ioapic(i)
3487 __set_bit(mpc_ioapic_id(i), used); 3581 __set_bit(mpc_ioapic_id(i), used);
3488 }
3489 if (!test_bit(id, used)) 3582 if (!test_bit(id, used))
3490 return id; 3583 return id;
3491 return find_first_zero_bit(used, 256); 3584 return find_first_zero_bit(used, 256);
@@ -3543,14 +3636,13 @@ void __init setup_ioapic_dest(void)
3543 if (skip_ioapic_setup == 1) 3636 if (skip_ioapic_setup == 1)
3544 return; 3637 return;
3545 3638
3546 for (ioapic = 0; ioapic < nr_ioapics; ioapic++) 3639 for_each_ioapic_pin(ioapic, pin) {
3547 for (pin = 0; pin < ioapics[ioapic].nr_registers; pin++) {
3548 irq_entry = find_irq_entry(ioapic, pin, mp_INT); 3640 irq_entry = find_irq_entry(ioapic, pin, mp_INT);
3549 if (irq_entry == -1) 3641 if (irq_entry == -1)
3550 continue; 3642 continue;
3551 irq = pin_2_irq(irq_entry, ioapic, pin);
3552 3643
3553 if ((ioapic > 0) && (irq > 16)) 3644 irq = pin_2_irq(irq_entry, ioapic, pin, 0);
3645 if (irq < 0 || !mp_init_irq_at_boot(ioapic, irq))
3554 continue; 3646 continue;
3555 3647
3556 idata = irq_get_irq_data(irq); 3648 idata = irq_get_irq_data(irq);
@@ -3573,29 +3665,33 @@ void __init setup_ioapic_dest(void)
3573 3665
3574static struct resource *ioapic_resources; 3666static struct resource *ioapic_resources;
3575 3667
3576static struct resource * __init ioapic_setup_resources(int nr_ioapics) 3668static struct resource * __init ioapic_setup_resources(void)
3577{ 3669{
3578 unsigned long n; 3670 unsigned long n;
3579 struct resource *res; 3671 struct resource *res;
3580 char *mem; 3672 char *mem;
3581 int i; 3673 int i, num = 0;
3582 3674
3583 if (nr_ioapics <= 0) 3675 for_each_ioapic(i)
3676 num++;
3677 if (num == 0)
3584 return NULL; 3678 return NULL;
3585 3679
3586 n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource); 3680 n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource);
3587 n *= nr_ioapics; 3681 n *= num;
3588 3682
3589 mem = alloc_bootmem(n); 3683 mem = alloc_bootmem(n);
3590 res = (void *)mem; 3684 res = (void *)mem;
3591 3685
3592 mem += sizeof(struct resource) * nr_ioapics; 3686 mem += sizeof(struct resource) * num;
3593 3687
3594 for (i = 0; i < nr_ioapics; i++) { 3688 num = 0;
3595 res[i].name = mem; 3689 for_each_ioapic(i) {
3596 res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY; 3690 res[num].name = mem;
3691 res[num].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
3597 snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i); 3692 snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
3598 mem += IOAPIC_RESOURCE_NAME_SIZE; 3693 mem += IOAPIC_RESOURCE_NAME_SIZE;
3694 num++;
3599 } 3695 }
3600 3696
3601 ioapic_resources = res; 3697 ioapic_resources = res;
@@ -3609,8 +3705,8 @@ void __init native_io_apic_init_mappings(void)
3609 struct resource *ioapic_res; 3705 struct resource *ioapic_res;
3610 int i; 3706 int i;
3611 3707
3612 ioapic_res = ioapic_setup_resources(nr_ioapics); 3708 ioapic_res = ioapic_setup_resources();
3613 for (i = 0; i < nr_ioapics; i++) { 3709 for_each_ioapic(i) {
3614 if (smp_found_config) { 3710 if (smp_found_config) {
3615 ioapic_phys = mpc_ioapic_addr(i); 3711 ioapic_phys = mpc_ioapic_addr(i);
3616#ifdef CONFIG_X86_32 3712#ifdef CONFIG_X86_32
@@ -3641,8 +3737,6 @@ fake_ioapic_page:
3641 ioapic_res->end = ioapic_phys + IO_APIC_SLOT_SIZE - 1; 3737 ioapic_res->end = ioapic_phys + IO_APIC_SLOT_SIZE - 1;
3642 ioapic_res++; 3738 ioapic_res++;
3643 } 3739 }
3644
3645 probe_nr_irqs_gsi();
3646} 3740}
3647 3741
3648void __init ioapic_insert_resources(void) 3742void __init ioapic_insert_resources(void)
@@ -3657,7 +3751,7 @@ void __init ioapic_insert_resources(void)
3657 return; 3751 return;
3658 } 3752 }
3659 3753
3660 for (i = 0; i < nr_ioapics; i++) { 3754 for_each_ioapic(i) {
3661 insert_resource(&iomem_resource, r); 3755 insert_resource(&iomem_resource, r);
3662 r++; 3756 r++;
3663 } 3757 }
@@ -3665,16 +3759,15 @@ void __init ioapic_insert_resources(void)
3665 3759
3666int mp_find_ioapic(u32 gsi) 3760int mp_find_ioapic(u32 gsi)
3667{ 3761{
3668 int i = 0; 3762 int i;
3669 3763
3670 if (nr_ioapics == 0) 3764 if (nr_ioapics == 0)
3671 return -1; 3765 return -1;
3672 3766
3673 /* Find the IOAPIC that manages this GSI. */ 3767 /* Find the IOAPIC that manages this GSI. */
3674 for (i = 0; i < nr_ioapics; i++) { 3768 for_each_ioapic(i) {
3675 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(i); 3769 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(i);
3676 if ((gsi >= gsi_cfg->gsi_base) 3770 if (gsi >= gsi_cfg->gsi_base && gsi <= gsi_cfg->gsi_end)
3677 && (gsi <= gsi_cfg->gsi_end))
3678 return i; 3771 return i;
3679 } 3772 }
3680 3773
@@ -3686,7 +3779,7 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi)
3686{ 3779{
3687 struct mp_ioapic_gsi *gsi_cfg; 3780 struct mp_ioapic_gsi *gsi_cfg;
3688 3781
3689 if (WARN_ON(ioapic == -1)) 3782 if (WARN_ON(ioapic < 0))
3690 return -1; 3783 return -1;
3691 3784
3692 gsi_cfg = mp_ioapic_gsi_routing(ioapic); 3785 gsi_cfg = mp_ioapic_gsi_routing(ioapic);
@@ -3729,7 +3822,8 @@ static __init int bad_ioapic_register(int idx)
3729 return 0; 3822 return 0;
3730} 3823}
3731 3824
3732void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) 3825void __init mp_register_ioapic(int id, u32 address, u32 gsi_base,
3826 struct ioapic_domain_cfg *cfg)
3733{ 3827{
3734 int idx = 0; 3828 int idx = 0;
3735 int entries; 3829 int entries;
@@ -3743,6 +3837,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3743 ioapics[idx].mp_config.type = MP_IOAPIC; 3837 ioapics[idx].mp_config.type = MP_IOAPIC;
3744 ioapics[idx].mp_config.flags = MPC_APIC_USABLE; 3838 ioapics[idx].mp_config.flags = MPC_APIC_USABLE;
3745 ioapics[idx].mp_config.apicaddr = address; 3839 ioapics[idx].mp_config.apicaddr = address;
3840 ioapics[idx].irqdomain = NULL;
3841 ioapics[idx].irqdomain_cfg = *cfg;
3746 3842
3747 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 3843 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
3748 3844
@@ -3779,6 +3875,77 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3779 nr_ioapics++; 3875 nr_ioapics++;
3780} 3876}
3781 3877
3878int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
3879 irq_hw_number_t hwirq)
3880{
3881 int ioapic = (int)(long)domain->host_data;
3882 struct mp_pin_info *info = mp_pin_info(ioapic, hwirq);
3883 struct io_apic_irq_attr attr;
3884
3885 /* Get default attribute if not set by caller yet */
3886 if (!info->set) {
3887 u32 gsi = mp_pin_to_gsi(ioapic, hwirq);
3888
3889 if (acpi_get_override_irq(gsi, &info->trigger,
3890 &info->polarity) < 0) {
3891 /*
3892 * PCI interrupts are always polarity one level
3893 * triggered.
3894 */
3895 info->trigger = 1;
3896 info->polarity = 1;
3897 }
3898 info->node = NUMA_NO_NODE;
3899 info->set = 1;
3900 }
3901 set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger,
3902 info->polarity);
3903
3904 return io_apic_setup_irq_pin(virq, info->node, &attr);
3905}
3906
3907void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq)
3908{
3909 struct irq_data *data = irq_get_irq_data(virq);
3910 struct irq_cfg *cfg = irq_cfg(virq);
3911 int ioapic = (int)(long)domain->host_data;
3912 int pin = (int)data->hwirq;
3913
3914 ioapic_mask_entry(ioapic, pin);
3915 __remove_pin_from_irq(cfg, ioapic, pin);
3916 WARN_ON(cfg->irq_2_pin != NULL);
3917 arch_teardown_hwirq(virq);
3918}
3919
3920int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node)
3921{
3922 int ret = 0;
3923 int ioapic, pin;
3924 struct mp_pin_info *info;
3925
3926 ioapic = mp_find_ioapic(gsi);
3927 if (ioapic < 0)
3928 return -ENODEV;
3929
3930 pin = mp_find_ioapic_pin(ioapic, gsi);
3931 info = mp_pin_info(ioapic, pin);
3932 trigger = trigger ? 1 : 0;
3933 polarity = polarity ? 1 : 0;
3934
3935 mutex_lock(&ioapic_mutex);
3936 if (!info->set) {
3937 info->trigger = trigger;
3938 info->polarity = polarity;
3939 info->node = node;
3940 info->set = 1;
3941 } else if (info->trigger != trigger || info->polarity != polarity) {
3942 ret = -EBUSY;
3943 }
3944 mutex_unlock(&ioapic_mutex);
3945
3946 return ret;
3947}
3948
3782/* Enable IOAPIC early just for system timer */ 3949/* Enable IOAPIC early just for system timer */
3783void __init pre_init_apic_IRQ0(void) 3950void __init pre_init_apic_IRQ0(void)
3784{ 3951{
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index cceb352c968c..bda488680dbc 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -88,21 +88,16 @@ static struct apic apic_default = {
88 .disable_esr = 0, 88 .disable_esr = 0,
89 .dest_logical = APIC_DEST_LOGICAL, 89 .dest_logical = APIC_DEST_LOGICAL,
90 .check_apicid_used = default_check_apicid_used, 90 .check_apicid_used = default_check_apicid_used,
91 .check_apicid_present = default_check_apicid_present,
92 91
93 .vector_allocation_domain = flat_vector_allocation_domain, 92 .vector_allocation_domain = flat_vector_allocation_domain,
94 .init_apic_ldr = default_init_apic_ldr, 93 .init_apic_ldr = default_init_apic_ldr,
95 94
96 .ioapic_phys_id_map = default_ioapic_phys_id_map, 95 .ioapic_phys_id_map = default_ioapic_phys_id_map,
97 .setup_apic_routing = setup_apic_flat_routing, 96 .setup_apic_routing = setup_apic_flat_routing,
98 .multi_timer_check = NULL,
99 .cpu_present_to_apicid = default_cpu_present_to_apicid, 97 .cpu_present_to_apicid = default_cpu_present_to_apicid,
100 .apicid_to_cpu_present = physid_set_mask_of_physid, 98 .apicid_to_cpu_present = physid_set_mask_of_physid,
101 .setup_portio_remap = NULL,
102 .check_phys_apicid_present = default_check_phys_apicid_present, 99 .check_phys_apicid_present = default_check_phys_apicid_present,
103 .enable_apic_mode = NULL,
104 .phys_pkg_id = default_phys_pkg_id, 100 .phys_pkg_id = default_phys_pkg_id,
105 .mps_oem_check = NULL,
106 101
107 .get_apic_id = default_get_apic_id, 102 .get_apic_id = default_get_apic_id,
108 .set_apic_id = NULL, 103 .set_apic_id = NULL,
@@ -116,11 +111,7 @@ static struct apic apic_default = {
116 .send_IPI_all = default_send_IPI_all, 111 .send_IPI_all = default_send_IPI_all,
117 .send_IPI_self = default_send_IPI_self, 112 .send_IPI_self = default_send_IPI_self,
118 113
119 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
120 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
121
122 .wait_for_init_deassert = true, 114 .wait_for_init_deassert = true,
123 .smp_callin_clear_local_apic = NULL,
124 .inquire_remote_apic = default_inquire_remote_apic, 115 .inquire_remote_apic = default_inquire_remote_apic,
125 116
126 .read = native_apic_mem_read, 117 .read = native_apic_mem_read,
@@ -214,29 +205,7 @@ void __init generic_apic_probe(void)
214 printk(KERN_INFO "Using APIC driver %s\n", apic->name); 205 printk(KERN_INFO "Using APIC driver %s\n", apic->name);
215} 206}
216 207
217/* These functions can switch the APIC even after the initial ->probe() */ 208/* This function can switch the APIC even after the initial ->probe() */
218
219int __init
220generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
221{
222 struct apic **drv;
223
224 for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
225 if (!((*drv)->mps_oem_check))
226 continue;
227 if (!(*drv)->mps_oem_check(mpc, oem, productid))
228 continue;
229
230 if (!cmdline_apic) {
231 apic = *drv;
232 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
233 apic->name);
234 }
235 return 1;
236 }
237 return 0;
238}
239
240int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 209int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
241{ 210{
242 struct apic **drv; 211 struct apic **drv;
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index e66766bf1641..6ce600f9bc78 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -249,21 +249,16 @@ static struct apic apic_x2apic_cluster = {
249 .disable_esr = 0, 249 .disable_esr = 0,
250 .dest_logical = APIC_DEST_LOGICAL, 250 .dest_logical = APIC_DEST_LOGICAL,
251 .check_apicid_used = NULL, 251 .check_apicid_used = NULL,
252 .check_apicid_present = NULL,
253 252
254 .vector_allocation_domain = cluster_vector_allocation_domain, 253 .vector_allocation_domain = cluster_vector_allocation_domain,
255 .init_apic_ldr = init_x2apic_ldr, 254 .init_apic_ldr = init_x2apic_ldr,
256 255
257 .ioapic_phys_id_map = NULL, 256 .ioapic_phys_id_map = NULL,
258 .setup_apic_routing = NULL, 257 .setup_apic_routing = NULL,
259 .multi_timer_check = NULL,
260 .cpu_present_to_apicid = default_cpu_present_to_apicid, 258 .cpu_present_to_apicid = default_cpu_present_to_apicid,
261 .apicid_to_cpu_present = NULL, 259 .apicid_to_cpu_present = NULL,
262 .setup_portio_remap = NULL,
263 .check_phys_apicid_present = default_check_phys_apicid_present, 260 .check_phys_apicid_present = default_check_phys_apicid_present,
264 .enable_apic_mode = NULL,
265 .phys_pkg_id = x2apic_phys_pkg_id, 261 .phys_pkg_id = x2apic_phys_pkg_id,
266 .mps_oem_check = NULL,
267 262
268 .get_apic_id = x2apic_get_apic_id, 263 .get_apic_id = x2apic_get_apic_id,
269 .set_apic_id = x2apic_set_apic_id, 264 .set_apic_id = x2apic_set_apic_id,
@@ -277,10 +272,7 @@ static struct apic apic_x2apic_cluster = {
277 .send_IPI_all = x2apic_send_IPI_all, 272 .send_IPI_all = x2apic_send_IPI_all,
278 .send_IPI_self = x2apic_send_IPI_self, 273 .send_IPI_self = x2apic_send_IPI_self,
279 274
280 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
281 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
282 .wait_for_init_deassert = false, 275 .wait_for_init_deassert = false,
283 .smp_callin_clear_local_apic = NULL,
284 .inquire_remote_apic = NULL, 276 .inquire_remote_apic = NULL,
285 277
286 .read = native_apic_msr_read, 278 .read = native_apic_msr_read,
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index 6d600ebf6c12..6fae733e9194 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -103,21 +103,16 @@ static struct apic apic_x2apic_phys = {
103 .disable_esr = 0, 103 .disable_esr = 0,
104 .dest_logical = 0, 104 .dest_logical = 0,
105 .check_apicid_used = NULL, 105 .check_apicid_used = NULL,
106 .check_apicid_present = NULL,
107 106
108 .vector_allocation_domain = default_vector_allocation_domain, 107 .vector_allocation_domain = default_vector_allocation_domain,
109 .init_apic_ldr = init_x2apic_ldr, 108 .init_apic_ldr = init_x2apic_ldr,
110 109
111 .ioapic_phys_id_map = NULL, 110 .ioapic_phys_id_map = NULL,
112 .setup_apic_routing = NULL, 111 .setup_apic_routing = NULL,
113 .multi_timer_check = NULL,
114 .cpu_present_to_apicid = default_cpu_present_to_apicid, 112 .cpu_present_to_apicid = default_cpu_present_to_apicid,
115 .apicid_to_cpu_present = NULL, 113 .apicid_to_cpu_present = NULL,
116 .setup_portio_remap = NULL,
117 .check_phys_apicid_present = default_check_phys_apicid_present, 114 .check_phys_apicid_present = default_check_phys_apicid_present,
118 .enable_apic_mode = NULL,
119 .phys_pkg_id = x2apic_phys_pkg_id, 115 .phys_pkg_id = x2apic_phys_pkg_id,
120 .mps_oem_check = NULL,
121 116
122 .get_apic_id = x2apic_get_apic_id, 117 .get_apic_id = x2apic_get_apic_id,
123 .set_apic_id = x2apic_set_apic_id, 118 .set_apic_id = x2apic_set_apic_id,
@@ -131,10 +126,7 @@ static struct apic apic_x2apic_phys = {
131 .send_IPI_all = x2apic_send_IPI_all, 126 .send_IPI_all = x2apic_send_IPI_all,
132 .send_IPI_self = x2apic_send_IPI_self, 127 .send_IPI_self = x2apic_send_IPI_self,
133 128
134 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
135 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
136 .wait_for_init_deassert = false, 129 .wait_for_init_deassert = false,
137 .smp_callin_clear_local_apic = NULL,
138 .inquire_remote_apic = NULL, 130 .inquire_remote_apic = NULL,
139 131
140 .read = native_apic_msr_read, 132 .read = native_apic_msr_read,
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 293b41df54ef..004f017aa7b9 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -365,21 +365,16 @@ static struct apic __refdata apic_x2apic_uv_x = {
365 .disable_esr = 0, 365 .disable_esr = 0,
366 .dest_logical = APIC_DEST_LOGICAL, 366 .dest_logical = APIC_DEST_LOGICAL,
367 .check_apicid_used = NULL, 367 .check_apicid_used = NULL,
368 .check_apicid_present = NULL,
369 368
370 .vector_allocation_domain = default_vector_allocation_domain, 369 .vector_allocation_domain = default_vector_allocation_domain,
371 .init_apic_ldr = uv_init_apic_ldr, 370 .init_apic_ldr = uv_init_apic_ldr,
372 371
373 .ioapic_phys_id_map = NULL, 372 .ioapic_phys_id_map = NULL,
374 .setup_apic_routing = NULL, 373 .setup_apic_routing = NULL,
375 .multi_timer_check = NULL,
376 .cpu_present_to_apicid = default_cpu_present_to_apicid, 374 .cpu_present_to_apicid = default_cpu_present_to_apicid,
377 .apicid_to_cpu_present = NULL, 375 .apicid_to_cpu_present = NULL,
378 .setup_portio_remap = NULL,
379 .check_phys_apicid_present = default_check_phys_apicid_present, 376 .check_phys_apicid_present = default_check_phys_apicid_present,
380 .enable_apic_mode = NULL,
381 .phys_pkg_id = uv_phys_pkg_id, 377 .phys_pkg_id = uv_phys_pkg_id,
382 .mps_oem_check = NULL,
383 378
384 .get_apic_id = x2apic_get_apic_id, 379 .get_apic_id = x2apic_get_apic_id,
385 .set_apic_id = set_apic_id, 380 .set_apic_id = set_apic_id,
@@ -394,10 +389,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
394 .send_IPI_self = uv_send_IPI_self, 389 .send_IPI_self = uv_send_IPI_self,
395 390
396 .wakeup_secondary_cpu = uv_wakeup_secondary, 391 .wakeup_secondary_cpu = uv_wakeup_secondary,
397 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
398 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
399 .wait_for_init_deassert = false, 392 .wait_for_init_deassert = false,
400 .smp_callin_clear_local_apic = NULL,
401 .inquire_remote_apic = NULL, 393 .inquire_remote_apic = NULL,
402 394
403 .read = native_apic_msr_read, 395 .read = native_apic_msr_read,
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 333fd5209336..e4ab2b42bd6f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -148,6 +148,7 @@ static int __init x86_xsave_setup(char *s)
148{ 148{
149 setup_clear_cpu_cap(X86_FEATURE_XSAVE); 149 setup_clear_cpu_cap(X86_FEATURE_XSAVE);
150 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); 150 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
151 setup_clear_cpu_cap(X86_FEATURE_XSAVES);
151 setup_clear_cpu_cap(X86_FEATURE_AVX); 152 setup_clear_cpu_cap(X86_FEATURE_AVX);
152 setup_clear_cpu_cap(X86_FEATURE_AVX2); 153 setup_clear_cpu_cap(X86_FEATURE_AVX2);
153 return 1; 154 return 1;
@@ -161,6 +162,13 @@ static int __init x86_xsaveopt_setup(char *s)
161} 162}
162__setup("noxsaveopt", x86_xsaveopt_setup); 163__setup("noxsaveopt", x86_xsaveopt_setup);
163 164
165static int __init x86_xsaves_setup(char *s)
166{
167 setup_clear_cpu_cap(X86_FEATURE_XSAVES);
168 return 1;
169}
170__setup("noxsaves", x86_xsaves_setup);
171
164#ifdef CONFIG_X86_32 172#ifdef CONFIG_X86_32
165static int cachesize_override = -1; 173static int cachesize_override = -1;
166static int disable_x86_serial_nr = 1; 174static int disable_x86_serial_nr = 1;
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 9c8f7394c612..c7035073dfc1 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -461,7 +461,7 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
461 461
462 cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); 462 cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
463 463
464 if (strict_strtoul(buf, 10, &val) < 0) 464 if (kstrtoul(buf, 10, &val) < 0)
465 return -EINVAL; 465 return -EINVAL;
466 466
467 err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val); 467 err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
@@ -511,7 +511,7 @@ store_subcaches(struct _cpuid4_info *this_leaf, const char *buf, size_t count,
511 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING)) 511 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
512 return -EINVAL; 512 return -EINVAL;
513 513
514 if (strict_strtoul(buf, 16, &val) < 0) 514 if (kstrtoul(buf, 16, &val) < 0)
515 return -EINVAL; 515 return -EINVAL;
516 516
517 if (amd_set_subcaches(cpu, val)) 517 if (amd_set_subcaches(cpu, val))
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 4fc57975acc1..bd9ccda8087f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2136,7 +2136,7 @@ static ssize_t set_bank(struct device *s, struct device_attribute *attr,
2136{ 2136{
2137 u64 new; 2137 u64 new;
2138 2138
2139 if (strict_strtoull(buf, 0, &new) < 0) 2139 if (kstrtou64(buf, 0, &new) < 0)
2140 return -EINVAL; 2140 return -EINVAL;
2141 2141
2142 attr_to_bank(attr)->ctl = new; 2142 attr_to_bank(attr)->ctl = new;
@@ -2174,7 +2174,7 @@ static ssize_t set_ignore_ce(struct device *s,
2174{ 2174{
2175 u64 new; 2175 u64 new;
2176 2176
2177 if (strict_strtoull(buf, 0, &new) < 0) 2177 if (kstrtou64(buf, 0, &new) < 0)
2178 return -EINVAL; 2178 return -EINVAL;
2179 2179
2180 if (mca_cfg.ignore_ce ^ !!new) { 2180 if (mca_cfg.ignore_ce ^ !!new) {
@@ -2198,7 +2198,7 @@ static ssize_t set_cmci_disabled(struct device *s,
2198{ 2198{
2199 u64 new; 2199 u64 new;
2200 2200
2201 if (strict_strtoull(buf, 0, &new) < 0) 2201 if (kstrtou64(buf, 0, &new) < 0)
2202 return -EINVAL; 2202 return -EINVAL;
2203 2203
2204 if (mca_cfg.cmci_disabled ^ !!new) { 2204 if (mca_cfg.cmci_disabled ^ !!new) {
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 603df4f74640..1e49f8f41276 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -353,7 +353,7 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size)
353 if (!b->interrupt_capable) 353 if (!b->interrupt_capable)
354 return -EINVAL; 354 return -EINVAL;
355 355
356 if (strict_strtoul(buf, 0, &new) < 0) 356 if (kstrtoul(buf, 0, &new) < 0)
357 return -EINVAL; 357 return -EINVAL;
358 358
359 b->interrupt_enable = !!new; 359 b->interrupt_enable = !!new;
@@ -372,7 +372,7 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
372 struct thresh_restart tr; 372 struct thresh_restart tr;
373 unsigned long new; 373 unsigned long new;
374 374
375 if (strict_strtoul(buf, 0, &new) < 0) 375 if (kstrtoul(buf, 0, &new) < 0)
376 return -EINVAL; 376 return -EINVAL;
377 377
378 if (new > THRESHOLD_MAX) 378 if (new > THRESHOLD_MAX)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 9a316b21df8b..3bdb95ae8c43 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -42,7 +42,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned);
42 * cmci_discover_lock protects against parallel discovery attempts 42 * cmci_discover_lock protects against parallel discovery attempts
43 * which could race against each other. 43 * which could race against each other.
44 */ 44 */
45static DEFINE_SPINLOCK(cmci_discover_lock); 45static DEFINE_RAW_SPINLOCK(cmci_discover_lock);
46 46
47#define CMCI_THRESHOLD 1 47#define CMCI_THRESHOLD 1
48#define CMCI_POLL_INTERVAL (30 * HZ) 48#define CMCI_POLL_INTERVAL (30 * HZ)
@@ -144,14 +144,14 @@ static void cmci_storm_disable_banks(void)
144 int bank; 144 int bank;
145 u64 val; 145 u64 val;
146 146
147 spin_lock_irqsave(&cmci_discover_lock, flags); 147 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
148 owned = __get_cpu_var(mce_banks_owned); 148 owned = __get_cpu_var(mce_banks_owned);
149 for_each_set_bit(bank, owned, MAX_NR_BANKS) { 149 for_each_set_bit(bank, owned, MAX_NR_BANKS) {
150 rdmsrl(MSR_IA32_MCx_CTL2(bank), val); 150 rdmsrl(MSR_IA32_MCx_CTL2(bank), val);
151 val &= ~MCI_CTL2_CMCI_EN; 151 val &= ~MCI_CTL2_CMCI_EN;
152 wrmsrl(MSR_IA32_MCx_CTL2(bank), val); 152 wrmsrl(MSR_IA32_MCx_CTL2(bank), val);
153 } 153 }
154 spin_unlock_irqrestore(&cmci_discover_lock, flags); 154 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
155} 155}
156 156
157static bool cmci_storm_detect(void) 157static bool cmci_storm_detect(void)
@@ -211,7 +211,7 @@ static void cmci_discover(int banks)
211 int i; 211 int i;
212 int bios_wrong_thresh = 0; 212 int bios_wrong_thresh = 0;
213 213
214 spin_lock_irqsave(&cmci_discover_lock, flags); 214 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
215 for (i = 0; i < banks; i++) { 215 for (i = 0; i < banks; i++) {
216 u64 val; 216 u64 val;
217 int bios_zero_thresh = 0; 217 int bios_zero_thresh = 0;
@@ -266,7 +266,7 @@ static void cmci_discover(int banks)
266 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); 266 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
267 } 267 }
268 } 268 }
269 spin_unlock_irqrestore(&cmci_discover_lock, flags); 269 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
270 if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) { 270 if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) {
271 pr_info_once( 271 pr_info_once(
272 "bios_cmci_threshold: Some banks do not have valid thresholds set\n"); 272 "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
@@ -316,10 +316,10 @@ void cmci_clear(void)
316 316
317 if (!cmci_supported(&banks)) 317 if (!cmci_supported(&banks))
318 return; 318 return;
319 spin_lock_irqsave(&cmci_discover_lock, flags); 319 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
320 for (i = 0; i < banks; i++) 320 for (i = 0; i < banks; i++)
321 __cmci_disable_bank(i); 321 __cmci_disable_bank(i);
322 spin_unlock_irqrestore(&cmci_discover_lock, flags); 322 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
323} 323}
324 324
325static void cmci_rediscover_work_func(void *arg) 325static void cmci_rediscover_work_func(void *arg)
@@ -360,9 +360,9 @@ void cmci_disable_bank(int bank)
360 if (!cmci_supported(&banks)) 360 if (!cmci_supported(&banks))
361 return; 361 return;
362 362
363 spin_lock_irqsave(&cmci_discover_lock, flags); 363 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
364 __cmci_disable_bank(bank); 364 __cmci_disable_bank(bank);
365 spin_unlock_irqrestore(&cmci_discover_lock, flags); 365 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
366} 366}
367 367
368static void intel_init_cmci(void) 368static void intel_init_cmci(void)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index cfc6f9dfcd90..0939f86f543d 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -945,7 +945,7 @@ static struct intel_uncore_type *snbep_pci_uncores[] = {
945 NULL, 945 NULL,
946}; 946};
947 947
948static DEFINE_PCI_DEVICE_TABLE(snbep_uncore_pci_ids) = { 948static const struct pci_device_id snbep_uncore_pci_ids[] = {
949 { /* Home Agent */ 949 { /* Home Agent */
950 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_HA), 950 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_HA),
951 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_HA, 0), 951 .driver_data = UNCORE_PCI_DEV_DATA(SNBEP_PCI_UNCORE_HA, 0),
@@ -1510,7 +1510,7 @@ static struct intel_uncore_type *ivt_pci_uncores[] = {
1510 NULL, 1510 NULL,
1511}; 1511};
1512 1512
1513static DEFINE_PCI_DEVICE_TABLE(ivt_uncore_pci_ids) = { 1513static const struct pci_device_id ivt_uncore_pci_ids[] = {
1514 { /* Home Agent 0 */ 1514 { /* Home Agent 0 */
1515 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe30), 1515 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe30),
1516 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_HA, 0), 1516 .driver_data = UNCORE_PCI_DEV_DATA(IVT_PCI_UNCORE_HA, 0),
@@ -1985,7 +1985,7 @@ static struct intel_uncore_type *snb_pci_uncores[] = {
1985 NULL, 1985 NULL,
1986}; 1986};
1987 1987
1988static DEFINE_PCI_DEVICE_TABLE(snb_uncore_pci_ids) = { 1988static const struct pci_device_id snb_uncore_pci_ids[] = {
1989 { /* IMC */ 1989 { /* IMC */
1990 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SNB_IMC), 1990 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SNB_IMC),
1991 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), 1991 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
@@ -1993,7 +1993,7 @@ static DEFINE_PCI_DEVICE_TABLE(snb_uncore_pci_ids) = {
1993 { /* end: all zeroes */ }, 1993 { /* end: all zeroes */ },
1994}; 1994};
1995 1995
1996static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = { 1996static const struct pci_device_id ivb_uncore_pci_ids[] = {
1997 { /* IMC */ 1997 { /* IMC */
1998 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC), 1998 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC),
1999 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), 1999 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
@@ -2001,7 +2001,7 @@ static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
2001 { /* end: all zeroes */ }, 2001 { /* end: all zeroes */ },
2002}; 2002};
2003 2003
2004static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = { 2004static const struct pci_device_id hsw_uncore_pci_ids[] = {
2005 { /* IMC */ 2005 { /* IMC */
2006 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HSW_IMC), 2006 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HSW_IMC),
2007 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), 2007 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 507de8066594..0553a34fa0df 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -4,9 +4,14 @@
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) 4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * 5 *
6 * Copyright (C) IBM Corporation, 2004. All rights reserved. 6 * Copyright (C) IBM Corporation, 2004. All rights reserved.
7 * Copyright (C) Red Hat Inc., 2014. All rights reserved.
8 * Authors:
9 * Vivek Goyal <vgoyal@redhat.com>
7 * 10 *
8 */ 11 */
9 12
13#define pr_fmt(fmt) "kexec: " fmt
14
10#include <linux/types.h> 15#include <linux/types.h>
11#include <linux/kernel.h> 16#include <linux/kernel.h>
12#include <linux/smp.h> 17#include <linux/smp.h>
@@ -16,6 +21,7 @@
16#include <linux/elf.h> 21#include <linux/elf.h>
17#include <linux/elfcore.h> 22#include <linux/elfcore.h>
18#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/slab.h>
19 25
20#include <asm/processor.h> 26#include <asm/processor.h>
21#include <asm/hardirq.h> 27#include <asm/hardirq.h>
@@ -28,6 +34,45 @@
28#include <asm/reboot.h> 34#include <asm/reboot.h>
29#include <asm/virtext.h> 35#include <asm/virtext.h>
30 36
37/* Alignment required for elf header segment */
38#define ELF_CORE_HEADER_ALIGN 4096
39
40/* This primarily represents number of split ranges due to exclusion */
41#define CRASH_MAX_RANGES 16
42
43struct crash_mem_range {
44 u64 start, end;
45};
46
47struct crash_mem {
48 unsigned int nr_ranges;
49 struct crash_mem_range ranges[CRASH_MAX_RANGES];
50};
51
52/* Misc data about ram ranges needed to prepare elf headers */
53struct crash_elf_data {
54 struct kimage *image;
55 /*
56 * Total number of ram ranges we have after various adjustments for
57 * GART, crash reserved region etc.
58 */
59 unsigned int max_nr_ranges;
60 unsigned long gart_start, gart_end;
61
62 /* Pointer to elf header */
63 void *ehdr;
64 /* Pointer to next phdr */
65 void *bufp;
66 struct crash_mem mem;
67};
68
69/* Used while preparing memory map entries for second kernel */
70struct crash_memmap_data {
71 struct boot_params *params;
72 /* Type of memory */
73 unsigned int type;
74};
75
31int in_crash_kexec; 76int in_crash_kexec;
32 77
33/* 78/*
@@ -39,6 +84,7 @@ int in_crash_kexec;
39 */ 84 */
40crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL; 85crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL;
41EXPORT_SYMBOL_GPL(crash_vmclear_loaded_vmcss); 86EXPORT_SYMBOL_GPL(crash_vmclear_loaded_vmcss);
87unsigned long crash_zero_bytes;
42 88
43static inline void cpu_crash_vmclear_loaded_vmcss(void) 89static inline void cpu_crash_vmclear_loaded_vmcss(void)
44{ 90{
@@ -135,3 +181,520 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
135#endif 181#endif
136 crash_save_cpu(regs, safe_smp_processor_id()); 182 crash_save_cpu(regs, safe_smp_processor_id());
137} 183}
184
185#ifdef CONFIG_X86_64
186
187static int get_nr_ram_ranges_callback(unsigned long start_pfn,
188 unsigned long nr_pfn, void *arg)
189{
190 int *nr_ranges = arg;
191
192 (*nr_ranges)++;
193 return 0;
194}
195
196static int get_gart_ranges_callback(u64 start, u64 end, void *arg)
197{
198 struct crash_elf_data *ced = arg;
199
200 ced->gart_start = start;
201 ced->gart_end = end;
202
203 /* Not expecting more than 1 gart aperture */
204 return 1;
205}
206
207
208/* Gather all the required information to prepare elf headers for ram regions */
209static void fill_up_crash_elf_data(struct crash_elf_data *ced,
210 struct kimage *image)
211{
212 unsigned int nr_ranges = 0;
213
214 ced->image = image;
215
216 walk_system_ram_range(0, -1, &nr_ranges,
217 get_nr_ram_ranges_callback);
218
219 ced->max_nr_ranges = nr_ranges;
220
221 /*
222 * We don't create ELF headers for GART aperture as an attempt
223 * to dump this memory in second kernel leads to hang/crash.
224 * If gart aperture is present, one needs to exclude that region
225 * and that could lead to need of extra phdr.
226 */
227 walk_iomem_res("GART", IORESOURCE_MEM, 0, -1,
228 ced, get_gart_ranges_callback);
229
230 /*
231 * If we have gart region, excluding that could potentially split
232 * a memory range, resulting in extra header. Account for that.
233 */
234 if (ced->gart_end)
235 ced->max_nr_ranges++;
236
237 /* Exclusion of crash region could split memory ranges */
238 ced->max_nr_ranges++;
239
240 /* If crashk_low_res is not 0, another range split possible */
241 if (crashk_low_res.end != 0)
242 ced->max_nr_ranges++;
243}
244
245static int exclude_mem_range(struct crash_mem *mem,
246 unsigned long long mstart, unsigned long long mend)
247{
248 int i, j;
249 unsigned long long start, end;
250 struct crash_mem_range temp_range = {0, 0};
251
252 for (i = 0; i < mem->nr_ranges; i++) {
253 start = mem->ranges[i].start;
254 end = mem->ranges[i].end;
255
256 if (mstart > end || mend < start)
257 continue;
258
259 /* Truncate any area outside of range */
260 if (mstart < start)
261 mstart = start;
262 if (mend > end)
263 mend = end;
264
265 /* Found completely overlapping range */
266 if (mstart == start && mend == end) {
267 mem->ranges[i].start = 0;
268 mem->ranges[i].end = 0;
269 if (i < mem->nr_ranges - 1) {
270 /* Shift rest of the ranges to left */
271 for (j = i; j < mem->nr_ranges - 1; j++) {
272 mem->ranges[j].start =
273 mem->ranges[j+1].start;
274 mem->ranges[j].end =
275 mem->ranges[j+1].end;
276 }
277 }
278 mem->nr_ranges--;
279 return 0;
280 }
281
282 if (mstart > start && mend < end) {
283 /* Split original range */
284 mem->ranges[i].end = mstart - 1;
285 temp_range.start = mend + 1;
286 temp_range.end = end;
287 } else if (mstart != start)
288 mem->ranges[i].end = mstart - 1;
289 else
290 mem->ranges[i].start = mend + 1;
291 break;
292 }
293
294 /* If a split happend, add the split to array */
295 if (!temp_range.end)
296 return 0;
297
298 /* Split happened */
299 if (i == CRASH_MAX_RANGES - 1) {
300 pr_err("Too many crash ranges after split\n");
301 return -ENOMEM;
302 }
303
304 /* Location where new range should go */
305 j = i + 1;
306 if (j < mem->nr_ranges) {
307 /* Move over all ranges one slot towards the end */
308 for (i = mem->nr_ranges - 1; i >= j; i--)
309 mem->ranges[i + 1] = mem->ranges[i];
310 }
311
312 mem->ranges[j].start = temp_range.start;
313 mem->ranges[j].end = temp_range.end;
314 mem->nr_ranges++;
315 return 0;
316}
317
318/*
319 * Look for any unwanted ranges between mstart, mend and remove them. This
320 * might lead to split and split ranges are put in ced->mem.ranges[] array
321 */
322static int elf_header_exclude_ranges(struct crash_elf_data *ced,
323 unsigned long long mstart, unsigned long long mend)
324{
325 struct crash_mem *cmem = &ced->mem;
326 int ret = 0;
327
328 memset(cmem->ranges, 0, sizeof(cmem->ranges));
329
330 cmem->ranges[0].start = mstart;
331 cmem->ranges[0].end = mend;
332 cmem->nr_ranges = 1;
333
334 /* Exclude crashkernel region */
335 ret = exclude_mem_range(cmem, crashk_res.start, crashk_res.end);
336 if (ret)
337 return ret;
338
339 ret = exclude_mem_range(cmem, crashk_low_res.start, crashk_low_res.end);
340 if (ret)
341 return ret;
342
343 /* Exclude GART region */
344 if (ced->gart_end) {
345 ret = exclude_mem_range(cmem, ced->gart_start, ced->gart_end);
346 if (ret)
347 return ret;
348 }
349
350 return ret;
351}
352
353static int prepare_elf64_ram_headers_callback(u64 start, u64 end, void *arg)
354{
355 struct crash_elf_data *ced = arg;
356 Elf64_Ehdr *ehdr;
357 Elf64_Phdr *phdr;
358 unsigned long mstart, mend;
359 struct kimage *image = ced->image;
360 struct crash_mem *cmem;
361 int ret, i;
362
363 ehdr = ced->ehdr;
364
365 /* Exclude unwanted mem ranges */
366 ret = elf_header_exclude_ranges(ced, start, end);
367 if (ret)
368 return ret;
369
370 /* Go through all the ranges in ced->mem.ranges[] and prepare phdr */
371 cmem = &ced->mem;
372
373 for (i = 0; i < cmem->nr_ranges; i++) {
374 mstart = cmem->ranges[i].start;
375 mend = cmem->ranges[i].end;
376
377 phdr = ced->bufp;
378 ced->bufp += sizeof(Elf64_Phdr);
379
380 phdr->p_type = PT_LOAD;
381 phdr->p_flags = PF_R|PF_W|PF_X;
382 phdr->p_offset = mstart;
383
384 /*
385 * If a range matches backup region, adjust offset to backup
386 * segment.
387 */
388 if (mstart == image->arch.backup_src_start &&
389 (mend - mstart + 1) == image->arch.backup_src_sz)
390 phdr->p_offset = image->arch.backup_load_addr;
391
392 phdr->p_paddr = mstart;
393 phdr->p_vaddr = (unsigned long long) __va(mstart);
394 phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
395 phdr->p_align = 0;
396 ehdr->e_phnum++;
397 pr_debug("Crash PT_LOAD elf header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n",
398 phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz,
399 ehdr->e_phnum, phdr->p_offset);
400 }
401
402 return ret;
403}
404
405static int prepare_elf64_headers(struct crash_elf_data *ced,
406 void **addr, unsigned long *sz)
407{
408 Elf64_Ehdr *ehdr;
409 Elf64_Phdr *phdr;
410 unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
411 unsigned char *buf, *bufp;
412 unsigned int cpu;
413 unsigned long long notes_addr;
414 int ret;
415
416 /* extra phdr for vmcoreinfo elf note */
417 nr_phdr = nr_cpus + 1;
418 nr_phdr += ced->max_nr_ranges;
419
420 /*
421 * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
422 * area on x86_64 (ffffffff80000000 - ffffffffa0000000).
423 * I think this is required by tools like gdb. So same physical
424 * memory will be mapped in two elf headers. One will contain kernel
425 * text virtual addresses and other will have __va(physical) addresses.
426 */
427
428 nr_phdr++;
429 elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
430 elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
431
432 buf = vzalloc(elf_sz);
433 if (!buf)
434 return -ENOMEM;
435
436 bufp = buf;
437 ehdr = (Elf64_Ehdr *)bufp;
438 bufp += sizeof(Elf64_Ehdr);
439 memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
440 ehdr->e_ident[EI_CLASS] = ELFCLASS64;
441 ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
442 ehdr->e_ident[EI_VERSION] = EV_CURRENT;
443 ehdr->e_ident[EI_OSABI] = ELF_OSABI;
444 memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD);
445 ehdr->e_type = ET_CORE;
446 ehdr->e_machine = ELF_ARCH;
447 ehdr->e_version = EV_CURRENT;
448 ehdr->e_phoff = sizeof(Elf64_Ehdr);
449 ehdr->e_ehsize = sizeof(Elf64_Ehdr);
450 ehdr->e_phentsize = sizeof(Elf64_Phdr);
451
452 /* Prepare one phdr of type PT_NOTE for each present cpu */
453 for_each_present_cpu(cpu) {
454 phdr = (Elf64_Phdr *)bufp;
455 bufp += sizeof(Elf64_Phdr);
456 phdr->p_type = PT_NOTE;
457 notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
458 phdr->p_offset = phdr->p_paddr = notes_addr;
459 phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t);
460 (ehdr->e_phnum)++;
461 }
462
463 /* Prepare one PT_NOTE header for vmcoreinfo */
464 phdr = (Elf64_Phdr *)bufp;
465 bufp += sizeof(Elf64_Phdr);
466 phdr->p_type = PT_NOTE;
467 phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note();
468 phdr->p_filesz = phdr->p_memsz = sizeof(vmcoreinfo_note);
469 (ehdr->e_phnum)++;
470
471#ifdef CONFIG_X86_64
472 /* Prepare PT_LOAD type program header for kernel text region */
473 phdr = (Elf64_Phdr *)bufp;
474 bufp += sizeof(Elf64_Phdr);
475 phdr->p_type = PT_LOAD;
476 phdr->p_flags = PF_R|PF_W|PF_X;
477 phdr->p_vaddr = (Elf64_Addr)_text;
478 phdr->p_filesz = phdr->p_memsz = _end - _text;
479 phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
480 (ehdr->e_phnum)++;
481#endif
482
483 /* Prepare PT_LOAD headers for system ram chunks. */
484 ced->ehdr = ehdr;
485 ced->bufp = bufp;
486 ret = walk_system_ram_res(0, -1, ced,
487 prepare_elf64_ram_headers_callback);
488 if (ret < 0)
489 return ret;
490
491 *addr = buf;
492 *sz = elf_sz;
493 return 0;
494}
495
496/* Prepare elf headers. Return addr and size */
497static int prepare_elf_headers(struct kimage *image, void **addr,
498 unsigned long *sz)
499{
500 struct crash_elf_data *ced;
501 int ret;
502
503 ced = kzalloc(sizeof(*ced), GFP_KERNEL);
504 if (!ced)
505 return -ENOMEM;
506
507 fill_up_crash_elf_data(ced, image);
508
509 /* By default prepare 64bit headers */
510 ret = prepare_elf64_headers(ced, addr, sz);
511 kfree(ced);
512 return ret;
513}
514
515static int add_e820_entry(struct boot_params *params, struct e820entry *entry)
516{
517 unsigned int nr_e820_entries;
518
519 nr_e820_entries = params->e820_entries;
520 if (nr_e820_entries >= E820MAX)
521 return 1;
522
523 memcpy(&params->e820_map[nr_e820_entries], entry,
524 sizeof(struct e820entry));
525 params->e820_entries++;
526 return 0;
527}
528
529static int memmap_entry_callback(u64 start, u64 end, void *arg)
530{
531 struct crash_memmap_data *cmd = arg;
532 struct boot_params *params = cmd->params;
533 struct e820entry ei;
534
535 ei.addr = start;
536 ei.size = end - start + 1;
537 ei.type = cmd->type;
538 add_e820_entry(params, &ei);
539
540 return 0;
541}
542
543static int memmap_exclude_ranges(struct kimage *image, struct crash_mem *cmem,
544 unsigned long long mstart,
545 unsigned long long mend)
546{
547 unsigned long start, end;
548 int ret = 0;
549
550 cmem->ranges[0].start = mstart;
551 cmem->ranges[0].end = mend;
552 cmem->nr_ranges = 1;
553
554 /* Exclude Backup region */
555 start = image->arch.backup_load_addr;
556 end = start + image->arch.backup_src_sz - 1;
557 ret = exclude_mem_range(cmem, start, end);
558 if (ret)
559 return ret;
560
561 /* Exclude elf header region */
562 start = image->arch.elf_load_addr;
563 end = start + image->arch.elf_headers_sz - 1;
564 return exclude_mem_range(cmem, start, end);
565}
566
567/* Prepare memory map for crash dump kernel */
568int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
569{
570 int i, ret = 0;
571 unsigned long flags;
572 struct e820entry ei;
573 struct crash_memmap_data cmd;
574 struct crash_mem *cmem;
575
576 cmem = vzalloc(sizeof(struct crash_mem));
577 if (!cmem)
578 return -ENOMEM;
579
580 memset(&cmd, 0, sizeof(struct crash_memmap_data));
581 cmd.params = params;
582
583 /* Add first 640K segment */
584 ei.addr = image->arch.backup_src_start;
585 ei.size = image->arch.backup_src_sz;
586 ei.type = E820_RAM;
587 add_e820_entry(params, &ei);
588
589 /* Add ACPI tables */
590 cmd.type = E820_ACPI;
591 flags = IORESOURCE_MEM | IORESOURCE_BUSY;
592 walk_iomem_res("ACPI Tables", flags, 0, -1, &cmd,
593 memmap_entry_callback);
594
595 /* Add ACPI Non-volatile Storage */
596 cmd.type = E820_NVS;
597 walk_iomem_res("ACPI Non-volatile Storage", flags, 0, -1, &cmd,
598 memmap_entry_callback);
599
600 /* Add crashk_low_res region */
601 if (crashk_low_res.end) {
602 ei.addr = crashk_low_res.start;
603 ei.size = crashk_low_res.end - crashk_low_res.start + 1;
604 ei.type = E820_RAM;
605 add_e820_entry(params, &ei);
606 }
607
608 /* Exclude some ranges from crashk_res and add rest to memmap */
609 ret = memmap_exclude_ranges(image, cmem, crashk_res.start,
610 crashk_res.end);
611 if (ret)
612 goto out;
613
614 for (i = 0; i < cmem->nr_ranges; i++) {
615 ei.size = cmem->ranges[i].end - cmem->ranges[i].start + 1;
616
617 /* If entry is less than a page, skip it */
618 if (ei.size < PAGE_SIZE)
619 continue;
620 ei.addr = cmem->ranges[i].start;
621 ei.type = E820_RAM;
622 add_e820_entry(params, &ei);
623 }
624
625out:
626 vfree(cmem);
627 return ret;
628}
629
630static int determine_backup_region(u64 start, u64 end, void *arg)
631{
632 struct kimage *image = arg;
633
634 image->arch.backup_src_start = start;
635 image->arch.backup_src_sz = end - start + 1;
636
637 /* Expecting only one range for backup region */
638 return 1;
639}
640
641int crash_load_segments(struct kimage *image)
642{
643 unsigned long src_start, src_sz, elf_sz;
644 void *elf_addr;
645 int ret;
646
647 /*
648 * Determine and load a segment for backup area. First 640K RAM
649 * region is backup source
650 */
651
652 ret = walk_system_ram_res(KEXEC_BACKUP_SRC_START, KEXEC_BACKUP_SRC_END,
653 image, determine_backup_region);
654
655 /* Zero or postive return values are ok */
656 if (ret < 0)
657 return ret;
658
659 src_start = image->arch.backup_src_start;
660 src_sz = image->arch.backup_src_sz;
661
662 /* Add backup segment. */
663 if (src_sz) {
664 /*
665 * Ideally there is no source for backup segment. This is
666 * copied in purgatory after crash. Just add a zero filled
667 * segment for now to make sure checksum logic works fine.
668 */
669 ret = kexec_add_buffer(image, (char *)&crash_zero_bytes,
670 sizeof(crash_zero_bytes), src_sz,
671 PAGE_SIZE, 0, -1, 0,
672 &image->arch.backup_load_addr);
673 if (ret)
674 return ret;
675 pr_debug("Loaded backup region at 0x%lx backup_start=0x%lx memsz=0x%lx\n",
676 image->arch.backup_load_addr, src_start, src_sz);
677 }
678
679 /* Prepare elf headers and add a segment */
680 ret = prepare_elf_headers(image, &elf_addr, &elf_sz);
681 if (ret)
682 return ret;
683
684 image->arch.elf_headers = elf_addr;
685 image->arch.elf_headers_sz = elf_sz;
686
687 ret = kexec_add_buffer(image, (char *)elf_addr, elf_sz, elf_sz,
688 ELF_CORE_HEADER_ALIGN, 0, -1, 0,
689 &image->arch.elf_load_addr);
690 if (ret) {
691 vfree((void *)image->arch.elf_headers);
692 return ret;
693 }
694 pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
695 image->arch.elf_load_addr, elf_sz, elf_sz);
696
697 return ret;
698}
699
700#endif /* CONFIG_X86_64 */
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 7db54b5d5f86..3d3503351242 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -21,6 +21,7 @@
21#include <asm/apic.h> 21#include <asm/apic.h>
22#include <asm/pci_x86.h> 22#include <asm/pci_x86.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/i8259.h>
24 25
25__initdata u64 initial_dtb; 26__initdata u64 initial_dtb;
26char __initdata cmd_line[COMMAND_LINE_SIZE]; 27char __initdata cmd_line[COMMAND_LINE_SIZE];
@@ -165,82 +166,6 @@ static void __init dtb_lapic_setup(void)
165#ifdef CONFIG_X86_IO_APIC 166#ifdef CONFIG_X86_IO_APIC
166static unsigned int ioapic_id; 167static unsigned int ioapic_id;
167 168
168static void __init dtb_add_ioapic(struct device_node *dn)
169{
170 struct resource r;
171 int ret;
172
173 ret = of_address_to_resource(dn, 0, &r);
174 if (ret) {
175 printk(KERN_ERR "Can't obtain address from node %s.\n",
176 dn->full_name);
177 return;
178 }
179 mp_register_ioapic(++ioapic_id, r.start, gsi_top);
180}
181
182static void __init dtb_ioapic_setup(void)
183{
184 struct device_node *dn;
185
186 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
187 dtb_add_ioapic(dn);
188
189 if (nr_ioapics) {
190 of_ioapic = 1;
191 return;
192 }
193 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n");
194}
195#else
196static void __init dtb_ioapic_setup(void) {}
197#endif
198
199static void __init dtb_apic_setup(void)
200{
201 dtb_lapic_setup();
202 dtb_ioapic_setup();
203}
204
205#ifdef CONFIG_OF_FLATTREE
206static void __init x86_flattree_get_config(void)
207{
208 u32 size, map_len;
209 void *dt;
210
211 if (!initial_dtb)
212 return;
213
214 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
215
216 initial_boot_params = dt = early_memremap(initial_dtb, map_len);
217 size = of_get_flat_dt_size();
218 if (map_len < size) {
219 early_iounmap(dt, map_len);
220 initial_boot_params = dt = early_memremap(initial_dtb, size);
221 map_len = size;
222 }
223
224 unflatten_and_copy_device_tree();
225 early_iounmap(dt, map_len);
226}
227#else
228static inline void x86_flattree_get_config(void) { }
229#endif
230
231void __init x86_dtb_init(void)
232{
233 x86_flattree_get_config();
234
235 if (!of_have_populated_dt())
236 return;
237
238 dtb_setup_hpet();
239 dtb_apic_setup();
240}
241
242#ifdef CONFIG_X86_IO_APIC
243
244struct of_ioapic_type { 169struct of_ioapic_type {
245 u32 out_type; 170 u32 out_type;
246 u32 trigger; 171 u32 trigger;
@@ -276,10 +201,8 @@ static int ioapic_xlate(struct irq_domain *domain,
276 const u32 *intspec, u32 intsize, 201 const u32 *intspec, u32 intsize,
277 irq_hw_number_t *out_hwirq, u32 *out_type) 202 irq_hw_number_t *out_hwirq, u32 *out_type)
278{ 203{
279 struct io_apic_irq_attr attr;
280 struct of_ioapic_type *it; 204 struct of_ioapic_type *it;
281 u32 line, idx; 205 u32 line, idx, gsi;
282 int rc;
283 206
284 if (WARN_ON(intsize < 2)) 207 if (WARN_ON(intsize < 2))
285 return -EINVAL; 208 return -EINVAL;
@@ -291,13 +214,10 @@ static int ioapic_xlate(struct irq_domain *domain,
291 214
292 it = &of_ioapic_type[intspec[1]]; 215 it = &of_ioapic_type[intspec[1]];
293 216
294 idx = (u32) domain->host_data; 217 idx = (u32)(long)domain->host_data;
295 set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); 218 gsi = mp_pin_to_gsi(idx, line);
296 219 if (mp_set_gsi_attr(gsi, it->trigger, it->polarity, cpu_to_node(0)))
297 rc = io_apic_setup_irq_pin_once(irq_find_mapping(domain, line), 220 return -EBUSY;
298 cpu_to_node(0), &attr);
299 if (rc)
300 return rc;
301 221
302 *out_hwirq = line; 222 *out_hwirq = line;
303 *out_type = it->out_type; 223 *out_type = it->out_type;
@@ -305,81 +225,86 @@ static int ioapic_xlate(struct irq_domain *domain,
305} 225}
306 226
307const struct irq_domain_ops ioapic_irq_domain_ops = { 227const struct irq_domain_ops ioapic_irq_domain_ops = {
228 .map = mp_irqdomain_map,
229 .unmap = mp_irqdomain_unmap,
308 .xlate = ioapic_xlate, 230 .xlate = ioapic_xlate,
309}; 231};
310 232
311static void dt_add_ioapic_domain(unsigned int ioapic_num, 233static void __init dtb_add_ioapic(struct device_node *dn)
312 struct device_node *np)
313{ 234{
314 struct irq_domain *id; 235 struct resource r;
315 struct mp_ioapic_gsi *gsi_cfg;
316 int ret; 236 int ret;
317 int num; 237 struct ioapic_domain_cfg cfg = {
318 238 .type = IOAPIC_DOMAIN_DYNAMIC,
319 gsi_cfg = mp_ioapic_gsi_routing(ioapic_num); 239 .ops = &ioapic_irq_domain_ops,
320 num = gsi_cfg->gsi_end - gsi_cfg->gsi_base + 1; 240 .dev = dn,
321 241 };
322 id = irq_domain_add_linear(np, num, &ioapic_irq_domain_ops, 242
323 (void *)ioapic_num); 243 ret = of_address_to_resource(dn, 0, &r);
324 BUG_ON(!id); 244 if (ret) {
325 if (gsi_cfg->gsi_base == 0) { 245 printk(KERN_ERR "Can't obtain address from node %s.\n",
326 /* 246 dn->full_name);
327 * The first NR_IRQS_LEGACY irq descs are allocated in 247 return;
328 * early_irq_init() and need just a mapping. The
329 * remaining irqs need both. All of them are preallocated
330 * and assigned so we can keep the 1:1 mapping which the ioapic
331 * is having.
332 */
333 irq_domain_associate_many(id, 0, 0, NR_IRQS_LEGACY);
334
335 if (num > NR_IRQS_LEGACY) {
336 ret = irq_create_strict_mappings(id, NR_IRQS_LEGACY,
337 NR_IRQS_LEGACY, num - NR_IRQS_LEGACY);
338 if (ret)
339 pr_err("Error creating mapping for the "
340 "remaining IRQs: %d\n", ret);
341 }
342 irq_set_default_host(id);
343 } else {
344 ret = irq_create_strict_mappings(id, gsi_cfg->gsi_base, 0, num);
345 if (ret)
346 pr_err("Error creating IRQ mapping: %d\n", ret);
347 } 248 }
249 mp_register_ioapic(++ioapic_id, r.start, gsi_top, &cfg);
348} 250}
349 251
350static void __init ioapic_add_ofnode(struct device_node *np) 252static void __init dtb_ioapic_setup(void)
351{ 253{
352 struct resource r; 254 struct device_node *dn;
353 int i, ret;
354 255
355 ret = of_address_to_resource(np, 0, &r); 256 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
356 if (ret) { 257 dtb_add_ioapic(dn);
357 printk(KERN_ERR "Failed to obtain address for %s\n", 258
358 np->full_name); 259 if (nr_ioapics) {
260 of_ioapic = 1;
359 return; 261 return;
360 } 262 }
263 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n");
264}
265#else
266static void __init dtb_ioapic_setup(void) {}
267#endif
361 268
362 for (i = 0; i < nr_ioapics; i++) { 269static void __init dtb_apic_setup(void)
363 if (r.start == mpc_ioapic_addr(i)) { 270{
364 dt_add_ioapic_domain(i, np); 271 dtb_lapic_setup();
365 return; 272 dtb_ioapic_setup();
366 }
367 }
368 printk(KERN_ERR "IOxAPIC at %s is not registered.\n", np->full_name);
369} 273}
370 274
371void __init x86_add_irq_domains(void) 275#ifdef CONFIG_OF_FLATTREE
276static void __init x86_flattree_get_config(void)
372{ 277{
373 struct device_node *dp; 278 u32 size, map_len;
279 void *dt;
374 280
375 if (!of_have_populated_dt()) 281 if (!initial_dtb)
376 return; 282 return;
377 283
378 for_each_node_with_property(dp, "interrupt-controller") { 284 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
379 if (of_device_is_compatible(dp, "intel,ce4100-ioapic")) 285
380 ioapic_add_ofnode(dp); 286 initial_boot_params = dt = early_memremap(initial_dtb, map_len);
287 size = of_get_flat_dt_size();
288 if (map_len < size) {
289 early_iounmap(dt, map_len);
290 initial_boot_params = dt = early_memremap(initial_dtb, size);
291 map_len = size;
381 } 292 }
293
294 unflatten_and_copy_device_tree();
295 early_iounmap(dt, map_len);
382} 296}
383#else 297#else
384void __init x86_add_irq_domains(void) { } 298static inline void x86_flattree_get_config(void) { }
385#endif 299#endif
300
301void __init x86_dtb_init(void)
302{
303 x86_flattree_get_config();
304
305 if (!of_have_populated_dt())
306 return;
307
308 dtb_setup_hpet();
309 dtb_apic_setup();
310}
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index d5dd80814419..a9a4229f6161 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -375,7 +375,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
375 /* 375 /*
376 * These bits must be zero. 376 * These bits must be zero.
377 */ 377 */
378 xsave_hdr->reserved1[0] = xsave_hdr->reserved1[1] = 0; 378 memset(xsave_hdr->reserved, 0, 48);
379 379
380 return ret; 380 return ret;
381} 381}
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/kernel/iosf_mbi.c
index d30acdc1229d..9030e83db6ee 100644
--- a/arch/x86/kernel/iosf_mbi.c
+++ b/arch/x86/kernel/iosf_mbi.c
@@ -202,7 +202,7 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
202 return 0; 202 return 0;
203} 203}
204 204
205static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = { 205static const struct pci_device_id iosf_mbi_pci_ids[] = {
206 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) }, 206 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
207 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) }, 207 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
208 { 0, }, 208 { 0, },
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 7f50156542fb..1e6cff5814fa 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -78,7 +78,7 @@ void __init init_ISA_irqs(void)
78#endif 78#endif
79 legacy_pic->init(0); 79 legacy_pic->init(0);
80 80
81 for (i = 0; i < legacy_pic->nr_legacy_irqs; i++) 81 for (i = 0; i < nr_legacy_irqs(); i++)
82 irq_set_chip_and_handler_name(i, chip, handle_level_irq, name); 82 irq_set_chip_and_handler_name(i, chip, handle_level_irq, name);
83} 83}
84 84
@@ -87,12 +87,6 @@ void __init init_IRQ(void)
87 int i; 87 int i;
88 88
89 /* 89 /*
90 * We probably need a better place for this, but it works for
91 * now ...
92 */
93 x86_add_irq_domains();
94
95 /*
96 * On cpu 0, Assign IRQ0_VECTOR..IRQ15_VECTOR's to IRQ 0..15. 90 * On cpu 0, Assign IRQ0_VECTOR..IRQ15_VECTOR's to IRQ 0..15.
97 * If these IRQ's are handled by legacy interrupt-controllers like PIC, 91 * If these IRQ's are handled by legacy interrupt-controllers like PIC,
98 * then this configuration will likely be static after the boot. If 92 * then this configuration will likely be static after the boot. If
@@ -100,7 +94,7 @@ void __init init_IRQ(void)
100 * then this vector space can be freed and re-used dynamically as the 94 * then this vector space can be freed and re-used dynamically as the
101 * irq's migrate etc. 95 * irq's migrate etc.
102 */ 96 */
103 for (i = 0; i < legacy_pic->nr_legacy_irqs; i++) 97 for (i = 0; i < nr_legacy_irqs(); i++)
104 per_cpu(vector_irq, 0)[IRQ0_VECTOR + i] = i; 98 per_cpu(vector_irq, 0)[IRQ0_VECTOR + i] = i;
105 99
106 x86_init.irqs.intr_init(); 100 x86_init.irqs.intr_init();
@@ -121,7 +115,7 @@ void setup_vector_irq(int cpu)
121 * legacy PIC, for the new cpu that is coming online, setup the static 115 * legacy PIC, for the new cpu that is coming online, setup the static
122 * legacy vector to irq mapping: 116 * legacy vector to irq mapping:
123 */ 117 */
124 for (irq = 0; irq < legacy_pic->nr_legacy_irqs; irq++) 118 for (irq = 0; irq < nr_legacy_irqs(); irq++)
125 per_cpu(vector_irq, cpu)[IRQ0_VECTOR + irq] = irq; 119 per_cpu(vector_irq, cpu)[IRQ0_VECTOR + irq] = irq;
126#endif 120#endif
127 121
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
new file mode 100644
index 000000000000..9642b9b33655
--- /dev/null
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -0,0 +1,553 @@
1/*
2 * Kexec bzImage loader
3 *
4 * Copyright (C) 2014 Red Hat Inc.
5 * Authors:
6 * Vivek Goyal <vgoyal@redhat.com>
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 */
11
12#define pr_fmt(fmt) "kexec-bzImage64: " fmt
13
14#include <linux/string.h>
15#include <linux/printk.h>
16#include <linux/errno.h>
17#include <linux/slab.h>
18#include <linux/kexec.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/efi.h>
22#include <linux/verify_pefile.h>
23#include <keys/system_keyring.h>
24
25#include <asm/bootparam.h>
26#include <asm/setup.h>
27#include <asm/crash.h>
28#include <asm/efi.h>
29
30#define MAX_ELFCOREHDR_STR_LEN 30 /* elfcorehdr=0x<64bit-value> */
31
32/*
33 * Defines lowest physical address for various segments. Not sure where
34 * exactly these limits came from. Current bzimage64 loader in kexec-tools
35 * uses these so I am retaining it. It can be changed over time as we gain
36 * more insight.
37 */
38#define MIN_PURGATORY_ADDR 0x3000
39#define MIN_BOOTPARAM_ADDR 0x3000
40#define MIN_KERNEL_LOAD_ADDR 0x100000
41#define MIN_INITRD_LOAD_ADDR 0x1000000
42
43/*
44 * This is a place holder for all boot loader specific data structure which
45 * gets allocated in one call but gets freed much later during cleanup
46 * time. Right now there is only one field but it can grow as need be.
47 */
48struct bzimage64_data {
49 /*
50 * Temporary buffer to hold bootparams buffer. This should be
51 * freed once the bootparam segment has been loaded.
52 */
53 void *bootparams_buf;
54};
55
56static int setup_initrd(struct boot_params *params,
57 unsigned long initrd_load_addr, unsigned long initrd_len)
58{
59 params->hdr.ramdisk_image = initrd_load_addr & 0xffffffffUL;
60 params->hdr.ramdisk_size = initrd_len & 0xffffffffUL;
61
62 params->ext_ramdisk_image = initrd_load_addr >> 32;
63 params->ext_ramdisk_size = initrd_len >> 32;
64
65 return 0;
66}
67
68static int setup_cmdline(struct kimage *image, struct boot_params *params,
69 unsigned long bootparams_load_addr,
70 unsigned long cmdline_offset, char *cmdline,
71 unsigned long cmdline_len)
72{
73 char *cmdline_ptr = ((char *)params) + cmdline_offset;
74 unsigned long cmdline_ptr_phys, len;
75 uint32_t cmdline_low_32, cmdline_ext_32;
76
77 memcpy(cmdline_ptr, cmdline, cmdline_len);
78 if (image->type == KEXEC_TYPE_CRASH) {
79 len = sprintf(cmdline_ptr + cmdline_len - 1,
80 " elfcorehdr=0x%lx", image->arch.elf_load_addr);
81 cmdline_len += len;
82 }
83 cmdline_ptr[cmdline_len - 1] = '\0';
84
85 pr_debug("Final command line is: %s\n", cmdline_ptr);
86 cmdline_ptr_phys = bootparams_load_addr + cmdline_offset;
87 cmdline_low_32 = cmdline_ptr_phys & 0xffffffffUL;
88 cmdline_ext_32 = cmdline_ptr_phys >> 32;
89
90 params->hdr.cmd_line_ptr = cmdline_low_32;
91 if (cmdline_ext_32)
92 params->ext_cmd_line_ptr = cmdline_ext_32;
93
94 return 0;
95}
96
97static int setup_e820_entries(struct boot_params *params)
98{
99 unsigned int nr_e820_entries;
100
101 nr_e820_entries = e820_saved.nr_map;
102
103 /* TODO: Pass entries more than E820MAX in bootparams setup data */
104 if (nr_e820_entries > E820MAX)
105 nr_e820_entries = E820MAX;
106
107 params->e820_entries = nr_e820_entries;
108 memcpy(&params->e820_map, &e820_saved.map,
109 nr_e820_entries * sizeof(struct e820entry));
110
111 return 0;
112}
113
114#ifdef CONFIG_EFI
115static int setup_efi_info_memmap(struct boot_params *params,
116 unsigned long params_load_addr,
117 unsigned int efi_map_offset,
118 unsigned int efi_map_sz)
119{
120 void *efi_map = (void *)params + efi_map_offset;
121 unsigned long efi_map_phys_addr = params_load_addr + efi_map_offset;
122 struct efi_info *ei = &params->efi_info;
123
124 if (!efi_map_sz)
125 return 0;
126
127 efi_runtime_map_copy(efi_map, efi_map_sz);
128
129 ei->efi_memmap = efi_map_phys_addr & 0xffffffff;
130 ei->efi_memmap_hi = efi_map_phys_addr >> 32;
131 ei->efi_memmap_size = efi_map_sz;
132
133 return 0;
134}
135
136static int
137prepare_add_efi_setup_data(struct boot_params *params,
138 unsigned long params_load_addr,
139 unsigned int efi_setup_data_offset)
140{
141 unsigned long setup_data_phys;
142 struct setup_data *sd = (void *)params + efi_setup_data_offset;
143 struct efi_setup_data *esd = (void *)sd + sizeof(struct setup_data);
144
145 esd->fw_vendor = efi.fw_vendor;
146 esd->runtime = efi.runtime;
147 esd->tables = efi.config_table;
148 esd->smbios = efi.smbios;
149
150 sd->type = SETUP_EFI;
151 sd->len = sizeof(struct efi_setup_data);
152
153 /* Add setup data */
154 setup_data_phys = params_load_addr + efi_setup_data_offset;
155 sd->next = params->hdr.setup_data;
156 params->hdr.setup_data = setup_data_phys;
157
158 return 0;
159}
160
161static int
162setup_efi_state(struct boot_params *params, unsigned long params_load_addr,
163 unsigned int efi_map_offset, unsigned int efi_map_sz,
164 unsigned int efi_setup_data_offset)
165{
166 struct efi_info *current_ei = &boot_params.efi_info;
167 struct efi_info *ei = &params->efi_info;
168
169 if (!current_ei->efi_memmap_size)
170 return 0;
171
172 /*
173 * If 1:1 mapping is not enabled, second kernel can not setup EFI
174 * and use EFI run time services. User space will have to pass
175 * acpi_rsdp=<addr> on kernel command line to make second kernel boot
176 * without efi.
177 */
178 if (efi_enabled(EFI_OLD_MEMMAP))
179 return 0;
180
181 ei->efi_loader_signature = current_ei->efi_loader_signature;
182 ei->efi_systab = current_ei->efi_systab;
183 ei->efi_systab_hi = current_ei->efi_systab_hi;
184
185 ei->efi_memdesc_version = current_ei->efi_memdesc_version;
186 ei->efi_memdesc_size = efi_get_runtime_map_desc_size();
187
188 setup_efi_info_memmap(params, params_load_addr, efi_map_offset,
189 efi_map_sz);
190 prepare_add_efi_setup_data(params, params_load_addr,
191 efi_setup_data_offset);
192 return 0;
193}
194#endif /* CONFIG_EFI */
195
196static int
197setup_boot_parameters(struct kimage *image, struct boot_params *params,
198 unsigned long params_load_addr,
199 unsigned int efi_map_offset, unsigned int efi_map_sz,
200 unsigned int efi_setup_data_offset)
201{
202 unsigned int nr_e820_entries;
203 unsigned long long mem_k, start, end;
204 int i, ret = 0;
205
206 /* Get subarch from existing bootparams */
207 params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;
208
209 /* Copying screen_info will do? */
210 memcpy(&params->screen_info, &boot_params.screen_info,
211 sizeof(struct screen_info));
212
213 /* Fill in memsize later */
214 params->screen_info.ext_mem_k = 0;
215 params->alt_mem_k = 0;
216
217 /* Default APM info */
218 memset(&params->apm_bios_info, 0, sizeof(params->apm_bios_info));
219
220 /* Default drive info */
221 memset(&params->hd0_info, 0, sizeof(params->hd0_info));
222 memset(&params->hd1_info, 0, sizeof(params->hd1_info));
223
224 /* Default sysdesc table */
225 params->sys_desc_table.length = 0;
226
227 if (image->type == KEXEC_TYPE_CRASH) {
228 ret = crash_setup_memmap_entries(image, params);
229 if (ret)
230 return ret;
231 } else
232 setup_e820_entries(params);
233
234 nr_e820_entries = params->e820_entries;
235
236 for (i = 0; i < nr_e820_entries; i++) {
237 if (params->e820_map[i].type != E820_RAM)
238 continue;
239 start = params->e820_map[i].addr;
240 end = params->e820_map[i].addr + params->e820_map[i].size - 1;
241
242 if ((start <= 0x100000) && end > 0x100000) {
243 mem_k = (end >> 10) - (0x100000 >> 10);
244 params->screen_info.ext_mem_k = mem_k;
245 params->alt_mem_k = mem_k;
246 if (mem_k > 0xfc00)
247 params->screen_info.ext_mem_k = 0xfc00; /* 64M*/
248 if (mem_k > 0xffffffff)
249 params->alt_mem_k = 0xffffffff;
250 }
251 }
252
253#ifdef CONFIG_EFI
254 /* Setup EFI state */
255 setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
256 efi_setup_data_offset);
257#endif
258
259 /* Setup EDD info */
260 memcpy(params->eddbuf, boot_params.eddbuf,
261 EDDMAXNR * sizeof(struct edd_info));
262 params->eddbuf_entries = boot_params.eddbuf_entries;
263
264 memcpy(params->edd_mbr_sig_buffer, boot_params.edd_mbr_sig_buffer,
265 EDD_MBR_SIG_MAX * sizeof(unsigned int));
266
267 return ret;
268}
269
270int bzImage64_probe(const char *buf, unsigned long len)
271{
272 int ret = -ENOEXEC;
273 struct setup_header *header;
274
275 /* kernel should be atleast two sectors long */
276 if (len < 2 * 512) {
277 pr_err("File is too short to be a bzImage\n");
278 return ret;
279 }
280
281 header = (struct setup_header *)(buf + offsetof(struct boot_params, hdr));
282 if (memcmp((char *)&header->header, "HdrS", 4) != 0) {
283 pr_err("Not a bzImage\n");
284 return ret;
285 }
286
287 if (header->boot_flag != 0xAA55) {
288 pr_err("No x86 boot sector present\n");
289 return ret;
290 }
291
292 if (header->version < 0x020C) {
293 pr_err("Must be at least protocol version 2.12\n");
294 return ret;
295 }
296
297 if (!(header->loadflags & LOADED_HIGH)) {
298 pr_err("zImage not a bzImage\n");
299 return ret;
300 }
301
302 if (!(header->xloadflags & XLF_KERNEL_64)) {
303 pr_err("Not a bzImage64. XLF_KERNEL_64 is not set.\n");
304 return ret;
305 }
306
307 if (!(header->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)) {
308 pr_err("XLF_CAN_BE_LOADED_ABOVE_4G is not set.\n");
309 return ret;
310 }
311
312 /*
313 * Can't handle 32bit EFI as it does not allow loading kernel
314 * above 4G. This should be handled by 32bit bzImage loader
315 */
316 if (efi_enabled(EFI_RUNTIME_SERVICES) && !efi_enabled(EFI_64BIT)) {
317 pr_debug("EFI is 32 bit. Can't load kernel above 4G.\n");
318 return ret;
319 }
320
321 /* I've got a bzImage */
322 pr_debug("It's a relocatable bzImage64\n");
323 ret = 0;
324
325 return ret;
326}
327
328void *bzImage64_load(struct kimage *image, char *kernel,
329 unsigned long kernel_len, char *initrd,
330 unsigned long initrd_len, char *cmdline,
331 unsigned long cmdline_len)
332{
333
334 struct setup_header *header;
335 int setup_sects, kern16_size, ret = 0;
336 unsigned long setup_header_size, params_cmdline_sz, params_misc_sz;
337 struct boot_params *params;
338 unsigned long bootparam_load_addr, kernel_load_addr, initrd_load_addr;
339 unsigned long purgatory_load_addr;
340 unsigned long kernel_bufsz, kernel_memsz, kernel_align;
341 char *kernel_buf;
342 struct bzimage64_data *ldata;
343 struct kexec_entry64_regs regs64;
344 void *stack;
345 unsigned int setup_hdr_offset = offsetof(struct boot_params, hdr);
346 unsigned int efi_map_offset, efi_map_sz, efi_setup_data_offset;
347
348 header = (struct setup_header *)(kernel + setup_hdr_offset);
349 setup_sects = header->setup_sects;
350 if (setup_sects == 0)
351 setup_sects = 4;
352
353 kern16_size = (setup_sects + 1) * 512;
354 if (kernel_len < kern16_size) {
355 pr_err("bzImage truncated\n");
356 return ERR_PTR(-ENOEXEC);
357 }
358
359 if (cmdline_len > header->cmdline_size) {
360 pr_err("Kernel command line too long\n");
361 return ERR_PTR(-EINVAL);
362 }
363
364 /*
365 * In case of crash dump, we will append elfcorehdr=<addr> to
366 * command line. Make sure it does not overflow
367 */
368 if (cmdline_len + MAX_ELFCOREHDR_STR_LEN > header->cmdline_size) {
369 pr_debug("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n");
370 return ERR_PTR(-EINVAL);
371 }
372
373 /* Allocate and load backup region */
374 if (image->type == KEXEC_TYPE_CRASH) {
375 ret = crash_load_segments(image);
376 if (ret)
377 return ERR_PTR(ret);
378 }
379
380 /*
381 * Load purgatory. For 64bit entry point, purgatory code can be
382 * anywhere.
383 */
384 ret = kexec_load_purgatory(image, MIN_PURGATORY_ADDR, ULONG_MAX, 1,
385 &purgatory_load_addr);
386 if (ret) {
387 pr_err("Loading purgatory failed\n");
388 return ERR_PTR(ret);
389 }
390
391 pr_debug("Loaded purgatory at 0x%lx\n", purgatory_load_addr);
392
393
394 /*
395 * Load Bootparams and cmdline and space for efi stuff.
396 *
397 * Allocate memory together for multiple data structures so
398 * that they all can go in single area/segment and we don't
399 * have to create separate segment for each. Keeps things
400 * little bit simple
401 */
402 efi_map_sz = efi_get_runtime_map_size();
403 efi_map_sz = ALIGN(efi_map_sz, 16);
404 params_cmdline_sz = sizeof(struct boot_params) + cmdline_len +
405 MAX_ELFCOREHDR_STR_LEN;
406 params_cmdline_sz = ALIGN(params_cmdline_sz, 16);
407 params_misc_sz = params_cmdline_sz + efi_map_sz +
408 sizeof(struct setup_data) +
409 sizeof(struct efi_setup_data);
410
411 params = kzalloc(params_misc_sz, GFP_KERNEL);
412 if (!params)
413 return ERR_PTR(-ENOMEM);
414 efi_map_offset = params_cmdline_sz;
415 efi_setup_data_offset = efi_map_offset + efi_map_sz;
416
417 /* Copy setup header onto bootparams. Documentation/x86/boot.txt */
418 setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset;
419
420 /* Is there a limit on setup header size? */
421 memcpy(&params->hdr, (kernel + setup_hdr_offset), setup_header_size);
422
423 ret = kexec_add_buffer(image, (char *)params, params_misc_sz,
424 params_misc_sz, 16, MIN_BOOTPARAM_ADDR,
425 ULONG_MAX, 1, &bootparam_load_addr);
426 if (ret)
427 goto out_free_params;
428 pr_debug("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
429 bootparam_load_addr, params_misc_sz, params_misc_sz);
430
431 /* Load kernel */
432 kernel_buf = kernel + kern16_size;
433 kernel_bufsz = kernel_len - kern16_size;
434 kernel_memsz = PAGE_ALIGN(header->init_size);
435 kernel_align = header->kernel_alignment;
436
437 ret = kexec_add_buffer(image, kernel_buf,
438 kernel_bufsz, kernel_memsz, kernel_align,
439 MIN_KERNEL_LOAD_ADDR, ULONG_MAX, 1,
440 &kernel_load_addr);
441 if (ret)
442 goto out_free_params;
443
444 pr_debug("Loaded 64bit kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
445 kernel_load_addr, kernel_memsz, kernel_memsz);
446
447 /* Load initrd high */
448 if (initrd) {
449 ret = kexec_add_buffer(image, initrd, initrd_len, initrd_len,
450 PAGE_SIZE, MIN_INITRD_LOAD_ADDR,
451 ULONG_MAX, 1, &initrd_load_addr);
452 if (ret)
453 goto out_free_params;
454
455 pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
456 initrd_load_addr, initrd_len, initrd_len);
457
458 setup_initrd(params, initrd_load_addr, initrd_len);
459 }
460
461 setup_cmdline(image, params, bootparam_load_addr,
462 sizeof(struct boot_params), cmdline, cmdline_len);
463
464 /* bootloader info. Do we need a separate ID for kexec kernel loader? */
465 params->hdr.type_of_loader = 0x0D << 4;
466 params->hdr.loadflags = 0;
467
468 /* Setup purgatory regs for entry */
469 ret = kexec_purgatory_get_set_symbol(image, "entry64_regs", &regs64,
470 sizeof(regs64), 1);
471 if (ret)
472 goto out_free_params;
473
474 regs64.rbx = 0; /* Bootstrap Processor */
475 regs64.rsi = bootparam_load_addr;
476 regs64.rip = kernel_load_addr + 0x200;
477 stack = kexec_purgatory_get_symbol_addr(image, "stack_end");
478 if (IS_ERR(stack)) {
479 pr_err("Could not find address of symbol stack_end\n");
480 ret = -EINVAL;
481 goto out_free_params;
482 }
483
484 regs64.rsp = (unsigned long)stack;
485 ret = kexec_purgatory_get_set_symbol(image, "entry64_regs", &regs64,
486 sizeof(regs64), 0);
487 if (ret)
488 goto out_free_params;
489
490 ret = setup_boot_parameters(image, params, bootparam_load_addr,
491 efi_map_offset, efi_map_sz,
492 efi_setup_data_offset);
493 if (ret)
494 goto out_free_params;
495
496 /* Allocate loader specific data */
497 ldata = kzalloc(sizeof(struct bzimage64_data), GFP_KERNEL);
498 if (!ldata) {
499 ret = -ENOMEM;
500 goto out_free_params;
501 }
502
503 /*
504 * Store pointer to params so that it could be freed after loading
505 * params segment has been loaded and contents have been copied
506 * somewhere else.
507 */
508 ldata->bootparams_buf = params;
509 return ldata;
510
511out_free_params:
512 kfree(params);
513 return ERR_PTR(ret);
514}
515
516/* This cleanup function is called after various segments have been loaded */
517int bzImage64_cleanup(void *loader_data)
518{
519 struct bzimage64_data *ldata = loader_data;
520
521 if (!ldata)
522 return 0;
523
524 kfree(ldata->bootparams_buf);
525 ldata->bootparams_buf = NULL;
526
527 return 0;
528}
529
530#ifdef CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
531int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len)
532{
533 bool trusted;
534 int ret;
535
536 ret = verify_pefile_signature(kernel, kernel_len,
537 system_trusted_keyring, &trusted);
538 if (ret < 0)
539 return ret;
540 if (!trusted)
541 return -EKEYREJECTED;
542 return 0;
543}
544#endif
545
546struct kexec_file_ops kexec_bzImage64_ops = {
547 .probe = bzImage64_probe,
548 .load = bzImage64_load,
549 .cleanup = bzImage64_cleanup,
550#ifdef CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
551 .verify_sig = bzImage64_verify_sig,
552#endif
553};
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 679cef0791cd..8b04018e5d1f 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -6,6 +6,8 @@
6 * Version 2. See the file COPYING for more details. 6 * Version 2. See the file COPYING for more details.
7 */ 7 */
8 8
9#define pr_fmt(fmt) "kexec: " fmt
10
9#include <linux/mm.h> 11#include <linux/mm.h>
10#include <linux/kexec.h> 12#include <linux/kexec.h>
11#include <linux/string.h> 13#include <linux/string.h>
@@ -21,6 +23,11 @@
21#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
22#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
23#include <asm/debugreg.h> 25#include <asm/debugreg.h>
26#include <asm/kexec-bzimage64.h>
27
28static struct kexec_file_ops *kexec_file_loaders[] = {
29 &kexec_bzImage64_ops,
30};
24 31
25static void free_transition_pgtable(struct kimage *image) 32static void free_transition_pgtable(struct kimage *image)
26{ 33{
@@ -171,6 +178,38 @@ static void load_segments(void)
171 ); 178 );
172} 179}
173 180
181/* Update purgatory as needed after various image segments have been prepared */
182static int arch_update_purgatory(struct kimage *image)
183{
184 int ret = 0;
185
186 if (!image->file_mode)
187 return 0;
188
189 /* Setup copying of backup region */
190 if (image->type == KEXEC_TYPE_CRASH) {
191 ret = kexec_purgatory_get_set_symbol(image, "backup_dest",
192 &image->arch.backup_load_addr,
193 sizeof(image->arch.backup_load_addr), 0);
194 if (ret)
195 return ret;
196
197 ret = kexec_purgatory_get_set_symbol(image, "backup_src",
198 &image->arch.backup_src_start,
199 sizeof(image->arch.backup_src_start), 0);
200 if (ret)
201 return ret;
202
203 ret = kexec_purgatory_get_set_symbol(image, "backup_sz",
204 &image->arch.backup_src_sz,
205 sizeof(image->arch.backup_src_sz), 0);
206 if (ret)
207 return ret;
208 }
209
210 return ret;
211}
212
174int machine_kexec_prepare(struct kimage *image) 213int machine_kexec_prepare(struct kimage *image)
175{ 214{
176 unsigned long start_pgtable; 215 unsigned long start_pgtable;
@@ -184,6 +223,11 @@ int machine_kexec_prepare(struct kimage *image)
184 if (result) 223 if (result)
185 return result; 224 return result;
186 225
226 /* update purgatory as needed */
227 result = arch_update_purgatory(image);
228 if (result)
229 return result;
230
187 return 0; 231 return 0;
188} 232}
189 233
@@ -283,3 +327,198 @@ void arch_crash_save_vmcoreinfo(void)
283 (unsigned long)&_text - __START_KERNEL); 327 (unsigned long)&_text - __START_KERNEL);
284} 328}
285 329
330/* arch-dependent functionality related to kexec file-based syscall */
331
332int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
333 unsigned long buf_len)
334{
335 int i, ret = -ENOEXEC;
336 struct kexec_file_ops *fops;
337
338 for (i = 0; i < ARRAY_SIZE(kexec_file_loaders); i++) {
339 fops = kexec_file_loaders[i];
340 if (!fops || !fops->probe)
341 continue;
342
343 ret = fops->probe(buf, buf_len);
344 if (!ret) {
345 image->fops = fops;
346 return ret;
347 }
348 }
349
350 return ret;
351}
352
353void *arch_kexec_kernel_image_load(struct kimage *image)
354{
355 vfree(image->arch.elf_headers);
356 image->arch.elf_headers = NULL;
357
358 if (!image->fops || !image->fops->load)
359 return ERR_PTR(-ENOEXEC);
360
361 return image->fops->load(image, image->kernel_buf,
362 image->kernel_buf_len, image->initrd_buf,
363 image->initrd_buf_len, image->cmdline_buf,
364 image->cmdline_buf_len);
365}
366
367int arch_kimage_file_post_load_cleanup(struct kimage *image)
368{
369 if (!image->fops || !image->fops->cleanup)
370 return 0;
371
372 return image->fops->cleanup(image->image_loader_data);
373}
374
375int arch_kexec_kernel_verify_sig(struct kimage *image, void *kernel,
376 unsigned long kernel_len)
377{
378 if (!image->fops || !image->fops->verify_sig) {
379 pr_debug("kernel loader does not support signature verification.");
380 return -EKEYREJECTED;
381 }
382
383 return image->fops->verify_sig(kernel, kernel_len);
384}
385
386/*
387 * Apply purgatory relocations.
388 *
389 * ehdr: Pointer to elf headers
390 * sechdrs: Pointer to section headers.
391 * relsec: section index of SHT_RELA section.
392 *
393 * TODO: Some of the code belongs to generic code. Move that in kexec.c.
394 */
395int arch_kexec_apply_relocations_add(const Elf64_Ehdr *ehdr,
396 Elf64_Shdr *sechdrs, unsigned int relsec)
397{
398 unsigned int i;
399 Elf64_Rela *rel;
400 Elf64_Sym *sym;
401 void *location;
402 Elf64_Shdr *section, *symtabsec;
403 unsigned long address, sec_base, value;
404 const char *strtab, *name, *shstrtab;
405
406 /*
407 * ->sh_offset has been modified to keep the pointer to section
408 * contents in memory
409 */
410 rel = (void *)sechdrs[relsec].sh_offset;
411
412 /* Section to which relocations apply */
413 section = &sechdrs[sechdrs[relsec].sh_info];
414
415 pr_debug("Applying relocate section %u to %u\n", relsec,
416 sechdrs[relsec].sh_info);
417
418 /* Associated symbol table */
419 symtabsec = &sechdrs[sechdrs[relsec].sh_link];
420
421 /* String table */
422 if (symtabsec->sh_link >= ehdr->e_shnum) {
423 /* Invalid strtab section number */
424 pr_err("Invalid string table section index %d\n",
425 symtabsec->sh_link);
426 return -ENOEXEC;
427 }
428
429 strtab = (char *)sechdrs[symtabsec->sh_link].sh_offset;
430
431 /* section header string table */
432 shstrtab = (char *)sechdrs[ehdr->e_shstrndx].sh_offset;
433
434 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
435
436 /*
437 * rel[i].r_offset contains byte offset from beginning
438 * of section to the storage unit affected.
439 *
440 * This is location to update (->sh_offset). This is temporary
441 * buffer where section is currently loaded. This will finally
442 * be loaded to a different address later, pointed to by
443 * ->sh_addr. kexec takes care of moving it
444 * (kexec_load_segment()).
445 */
446 location = (void *)(section->sh_offset + rel[i].r_offset);
447
448 /* Final address of the location */
449 address = section->sh_addr + rel[i].r_offset;
450
451 /*
452 * rel[i].r_info contains information about symbol table index
453 * w.r.t which relocation must be made and type of relocation
454 * to apply. ELF64_R_SYM() and ELF64_R_TYPE() macros get
455 * these respectively.
456 */
457 sym = (Elf64_Sym *)symtabsec->sh_offset +
458 ELF64_R_SYM(rel[i].r_info);
459
460 if (sym->st_name)
461 name = strtab + sym->st_name;
462 else
463 name = shstrtab + sechdrs[sym->st_shndx].sh_name;
464
465 pr_debug("Symbol: %s info: %02x shndx: %02x value=%llx size: %llx\n",
466 name, sym->st_info, sym->st_shndx, sym->st_value,
467 sym->st_size);
468
469 if (sym->st_shndx == SHN_UNDEF) {
470 pr_err("Undefined symbol: %s\n", name);
471 return -ENOEXEC;
472 }
473
474 if (sym->st_shndx == SHN_COMMON) {
475 pr_err("symbol '%s' in common section\n", name);
476 return -ENOEXEC;
477 }
478
479 if (sym->st_shndx == SHN_ABS)
480 sec_base = 0;
481 else if (sym->st_shndx >= ehdr->e_shnum) {
482 pr_err("Invalid section %d for symbol %s\n",
483 sym->st_shndx, name);
484 return -ENOEXEC;
485 } else
486 sec_base = sechdrs[sym->st_shndx].sh_addr;
487
488 value = sym->st_value;
489 value += sec_base;
490 value += rel[i].r_addend;
491
492 switch (ELF64_R_TYPE(rel[i].r_info)) {
493 case R_X86_64_NONE:
494 break;
495 case R_X86_64_64:
496 *(u64 *)location = value;
497 break;
498 case R_X86_64_32:
499 *(u32 *)location = value;
500 if (value != *(u32 *)location)
501 goto overflow;
502 break;
503 case R_X86_64_32S:
504 *(s32 *)location = value;
505 if ((s64)value != *(s32 *)location)
506 goto overflow;
507 break;
508 case R_X86_64_PC32:
509 value -= (u64)address;
510 *(u32 *)location = value;
511 break;
512 default:
513 pr_err("Unknown rela relocation: %llu\n",
514 ELF64_R_TYPE(rel[i].r_info));
515 return -ENOEXEC;
516 }
517 }
518 return 0;
519
520overflow:
521 pr_err("Overflow in relocation type %d value 0x%lx\n",
522 (int)ELF64_R_TYPE(rel[i].r_info), value);
523 return -ENOEXEC;
524}
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index d2b56489d70f..2d2a237f2c73 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -19,6 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/irqdomain.h>
22 23
23#include <asm/mtrr.h> 24#include <asm/mtrr.h>
24#include <asm/mpspec.h> 25#include <asm/mpspec.h>
@@ -67,7 +68,7 @@ static void __init MP_processor_info(struct mpc_cpu *m)
67 boot_cpu_physical_apicid = m->apicid; 68 boot_cpu_physical_apicid = m->apicid;
68 } 69 }
69 70
70 printk(KERN_INFO "Processor #%d%s\n", m->apicid, bootup_cpu); 71 pr_info("Processor #%d%s\n", m->apicid, bootup_cpu);
71 generic_processor_info(apicid, m->apicver); 72 generic_processor_info(apicid, m->apicver);
72} 73}
73 74
@@ -87,9 +88,8 @@ static void __init MP_bus_info(struct mpc_bus *m)
87 88
88#if MAX_MP_BUSSES < 256 89#if MAX_MP_BUSSES < 256
89 if (m->busid >= MAX_MP_BUSSES) { 90 if (m->busid >= MAX_MP_BUSSES) {
90 printk(KERN_WARNING "MP table busid value (%d) for bustype %s " 91 pr_warn("MP table busid value (%d) for bustype %s is too large, max. supported is %d\n",
91 " is too large, max. supported is %d\n", 92 m->busid, str, MAX_MP_BUSSES - 1);
92 m->busid, str, MAX_MP_BUSSES - 1);
93 return; 93 return;
94 } 94 }
95#endif 95#endif
@@ -110,19 +110,29 @@ static void __init MP_bus_info(struct mpc_bus *m)
110 mp_bus_id_to_type[m->busid] = MP_BUS_EISA; 110 mp_bus_id_to_type[m->busid] = MP_BUS_EISA;
111#endif 111#endif
112 } else 112 } else
113 printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); 113 pr_warn("Unknown bustype %s - ignoring\n", str);
114} 114}
115 115
116static struct irq_domain_ops mp_ioapic_irqdomain_ops = {
117 .map = mp_irqdomain_map,
118 .unmap = mp_irqdomain_unmap,
119};
120
116static void __init MP_ioapic_info(struct mpc_ioapic *m) 121static void __init MP_ioapic_info(struct mpc_ioapic *m)
117{ 122{
123 struct ioapic_domain_cfg cfg = {
124 .type = IOAPIC_DOMAIN_LEGACY,
125 .ops = &mp_ioapic_irqdomain_ops,
126 };
127
118 if (m->flags & MPC_APIC_USABLE) 128 if (m->flags & MPC_APIC_USABLE)
119 mp_register_ioapic(m->apicid, m->apicaddr, gsi_top); 129 mp_register_ioapic(m->apicid, m->apicaddr, gsi_top, &cfg);
120} 130}
121 131
122static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) 132static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq)
123{ 133{
124 apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," 134 apic_printk(APIC_VERBOSE,
125 " IRQ %02x, APIC ID %x, APIC INT %02x\n", 135 "Int: type %d, pol %d, trig %d, bus %02x, IRQ %02x, APIC ID %x, APIC INT %02x\n",
126 mp_irq->irqtype, mp_irq->irqflag & 3, 136 mp_irq->irqtype, mp_irq->irqflag & 3,
127 (mp_irq->irqflag >> 2) & 3, mp_irq->srcbus, 137 (mp_irq->irqflag >> 2) & 3, mp_irq->srcbus,
128 mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq); 138 mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq);
@@ -135,8 +145,8 @@ static inline void __init MP_ioapic_info(struct mpc_ioapic *m) {}
135 145
136static void __init MP_lintsrc_info(struct mpc_lintsrc *m) 146static void __init MP_lintsrc_info(struct mpc_lintsrc *m)
137{ 147{
138 apic_printk(APIC_VERBOSE, "Lint: type %d, pol %d, trig %d, bus %02x," 148 apic_printk(APIC_VERBOSE,
139 " IRQ %02x, APIC ID %x, APIC LINT %02x\n", 149 "Lint: type %d, pol %d, trig %d, bus %02x, IRQ %02x, APIC ID %x, APIC LINT %02x\n",
140 m->irqtype, m->irqflag & 3, (m->irqflag >> 2) & 3, m->srcbusid, 150 m->irqtype, m->irqflag & 3, (m->irqflag >> 2) & 3, m->srcbusid,
141 m->srcbusirq, m->destapic, m->destapiclint); 151 m->srcbusirq, m->destapic, m->destapiclint);
142} 152}
@@ -148,34 +158,33 @@ static int __init smp_check_mpc(struct mpc_table *mpc, char *oem, char *str)
148{ 158{
149 159
150 if (memcmp(mpc->signature, MPC_SIGNATURE, 4)) { 160 if (memcmp(mpc->signature, MPC_SIGNATURE, 4)) {
151 printk(KERN_ERR "MPTABLE: bad signature [%c%c%c%c]!\n", 161 pr_err("MPTABLE: bad signature [%c%c%c%c]!\n",
152 mpc->signature[0], mpc->signature[1], 162 mpc->signature[0], mpc->signature[1],
153 mpc->signature[2], mpc->signature[3]); 163 mpc->signature[2], mpc->signature[3]);
154 return 0; 164 return 0;
155 } 165 }
156 if (mpf_checksum((unsigned char *)mpc, mpc->length)) { 166 if (mpf_checksum((unsigned char *)mpc, mpc->length)) {
157 printk(KERN_ERR "MPTABLE: checksum error!\n"); 167 pr_err("MPTABLE: checksum error!\n");
158 return 0; 168 return 0;
159 } 169 }
160 if (mpc->spec != 0x01 && mpc->spec != 0x04) { 170 if (mpc->spec != 0x01 && mpc->spec != 0x04) {
161 printk(KERN_ERR "MPTABLE: bad table version (%d)!!\n", 171 pr_err("MPTABLE: bad table version (%d)!!\n", mpc->spec);
162 mpc->spec);
163 return 0; 172 return 0;
164 } 173 }
165 if (!mpc->lapic) { 174 if (!mpc->lapic) {
166 printk(KERN_ERR "MPTABLE: null local APIC address!\n"); 175 pr_err("MPTABLE: null local APIC address!\n");
167 return 0; 176 return 0;
168 } 177 }
169 memcpy(oem, mpc->oem, 8); 178 memcpy(oem, mpc->oem, 8);
170 oem[8] = 0; 179 oem[8] = 0;
171 printk(KERN_INFO "MPTABLE: OEM ID: %s\n", oem); 180 pr_info("MPTABLE: OEM ID: %s\n", oem);
172 181
173 memcpy(str, mpc->productid, 12); 182 memcpy(str, mpc->productid, 12);
174 str[12] = 0; 183 str[12] = 0;
175 184
176 printk(KERN_INFO "MPTABLE: Product ID: %s\n", str); 185 pr_info("MPTABLE: Product ID: %s\n", str);
177 186
178 printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->lapic); 187 pr_info("MPTABLE: APIC at: 0x%X\n", mpc->lapic);
179 188
180 return 1; 189 return 1;
181} 190}
@@ -188,8 +197,8 @@ static void skip_entry(unsigned char **ptr, int *count, int size)
188 197
189static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt) 198static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)
190{ 199{
191 printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n" 200 pr_err("Your mptable is wrong, contact your HW vendor!\n");
192 "type %x\n", *mpt); 201 pr_cont("type %x\n", *mpt);
193 print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_ADDRESS, 16, 202 print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_ADDRESS, 16,
194 1, mpc, mpc->length, 1); 203 1, mpc, mpc->length, 1);
195} 204}
@@ -207,9 +216,6 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
207 if (!smp_check_mpc(mpc, oem, str)) 216 if (!smp_check_mpc(mpc, oem, str))
208 return 0; 217 return 0;
209 218
210#ifdef CONFIG_X86_32
211 generic_mps_oem_check(mpc, oem, str);
212#endif
213 /* Initialize the lapic mapping */ 219 /* Initialize the lapic mapping */
214 if (!acpi_lapic) 220 if (!acpi_lapic)
215 register_lapic_address(mpc->lapic); 221 register_lapic_address(mpc->lapic);
@@ -259,7 +265,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
259 } 265 }
260 266
261 if (!num_processors) 267 if (!num_processors)
262 printk(KERN_ERR "MPTABLE: no processors registered!\n"); 268 pr_err("MPTABLE: no processors registered!\n");
263 return num_processors; 269 return num_processors;
264} 270}
265 271
@@ -295,16 +301,13 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
295 * If it does, we assume it's valid. 301 * If it does, we assume it's valid.
296 */ 302 */
297 if (mpc_default_type == 5) { 303 if (mpc_default_type == 5) {
298 printk(KERN_INFO "ISA/PCI bus type with no IRQ information... " 304 pr_info("ISA/PCI bus type with no IRQ information... falling back to ELCR\n");
299 "falling back to ELCR\n");
300 305
301 if (ELCR_trigger(0) || ELCR_trigger(1) || ELCR_trigger(2) || 306 if (ELCR_trigger(0) || ELCR_trigger(1) || ELCR_trigger(2) ||
302 ELCR_trigger(13)) 307 ELCR_trigger(13))
303 printk(KERN_ERR "ELCR contains invalid data... " 308 pr_err("ELCR contains invalid data... not using ELCR\n");
304 "not using ELCR\n");
305 else { 309 else {
306 printk(KERN_INFO 310 pr_info("Using ELCR to identify PCI interrupts\n");
307 "Using ELCR to identify PCI interrupts\n");
308 ELCR_fallback = 1; 311 ELCR_fallback = 1;
309 } 312 }
310 } 313 }
@@ -353,7 +356,7 @@ static void __init construct_ioapic_table(int mpc_default_type)
353 bus.busid = 0; 356 bus.busid = 0;
354 switch (mpc_default_type) { 357 switch (mpc_default_type) {
355 default: 358 default:
356 printk(KERN_ERR "???\nUnknown standard configuration %d\n", 359 pr_err("???\nUnknown standard configuration %d\n",
357 mpc_default_type); 360 mpc_default_type);
358 /* fall through */ 361 /* fall through */
359 case 1: 362 case 1:
@@ -462,8 +465,8 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early)
462#ifdef CONFIG_X86_LOCAL_APIC 465#ifdef CONFIG_X86_LOCAL_APIC
463 smp_found_config = 0; 466 smp_found_config = 0;
464#endif 467#endif
465 printk(KERN_ERR "BIOS bug, MP table errors detected!...\n" 468 pr_err("BIOS bug, MP table errors detected!...\n");
466 "... disabling SMP support. (tell your hw vendor)\n"); 469 pr_cont("... disabling SMP support. (tell your hw vendor)\n");
467 early_iounmap(mpc, size); 470 early_iounmap(mpc, size);
468 return -1; 471 return -1;
469 } 472 }
@@ -481,8 +484,7 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early)
481 if (!mp_irq_entries) { 484 if (!mp_irq_entries) {
482 struct mpc_bus bus; 485 struct mpc_bus bus;
483 486
484 printk(KERN_ERR "BIOS bug, no explicit IRQ entries, " 487 pr_err("BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor)\n");
485 "using default mptable. (tell your hw vendor)\n");
486 488
487 bus.type = MP_BUS; 489 bus.type = MP_BUS;
488 bus.busid = 0; 490 bus.busid = 0;
@@ -516,14 +518,14 @@ void __init default_get_smp_config(unsigned int early)
516 if (acpi_lapic && acpi_ioapic) 518 if (acpi_lapic && acpi_ioapic)
517 return; 519 return;
518 520
519 printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", 521 pr_info("Intel MultiProcessor Specification v1.%d\n",
520 mpf->specification); 522 mpf->specification);
521#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) 523#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
522 if (mpf->feature2 & (1 << 7)) { 524 if (mpf->feature2 & (1 << 7)) {
523 printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); 525 pr_info(" IMCR and PIC compatibility mode.\n");
524 pic_mode = 1; 526 pic_mode = 1;
525 } else { 527 } else {
526 printk(KERN_INFO " Virtual Wire compatibility mode.\n"); 528 pr_info(" Virtual Wire compatibility mode.\n");
527 pic_mode = 0; 529 pic_mode = 0;
528 } 530 }
529#endif 531#endif
@@ -539,8 +541,7 @@ void __init default_get_smp_config(unsigned int early)
539 return; 541 return;
540 } 542 }
541 543
542 printk(KERN_INFO "Default MP configuration #%d\n", 544 pr_info("Default MP configuration #%d\n", mpf->feature1);
543 mpf->feature1);
544 construct_default_ISA_mptable(mpf->feature1); 545 construct_default_ISA_mptable(mpf->feature1);
545 546
546 } else if (mpf->physptr) { 547 } else if (mpf->physptr) {
@@ -550,7 +551,7 @@ void __init default_get_smp_config(unsigned int early)
550 BUG(); 551 BUG();
551 552
552 if (!early) 553 if (!early)
553 printk(KERN_INFO "Processors: %d\n", num_processors); 554 pr_info("Processors: %d\n", num_processors);
554 /* 555 /*
555 * Only use the first configuration found. 556 * Only use the first configuration found.
556 */ 557 */
@@ -583,10 +584,10 @@ static int __init smp_scan_config(unsigned long base, unsigned long length)
583#endif 584#endif
584 mpf_found = mpf; 585 mpf_found = mpf;
585 586
586 printk(KERN_INFO "found SMP MP-table at [mem %#010llx-%#010llx] mapped at [%p]\n", 587 pr_info("found SMP MP-table at [mem %#010llx-%#010llx] mapped at [%p]\n",
587 (unsigned long long) virt_to_phys(mpf), 588 (unsigned long long) virt_to_phys(mpf),
588 (unsigned long long) virt_to_phys(mpf) + 589 (unsigned long long) virt_to_phys(mpf) +
589 sizeof(*mpf) - 1, mpf); 590 sizeof(*mpf) - 1, mpf);
590 591
591 mem = virt_to_phys(mpf); 592 mem = virt_to_phys(mpf);
592 memblock_reserve(mem, sizeof(*mpf)); 593 memblock_reserve(mem, sizeof(*mpf));
@@ -735,7 +736,7 @@ static int __init replace_intsrc_all(struct mpc_table *mpc,
735 int nr_m_spare = 0; 736 int nr_m_spare = 0;
736 unsigned char *mpt = ((unsigned char *)mpc) + count; 737 unsigned char *mpt = ((unsigned char *)mpc) + count;
737 738
738 printk(KERN_INFO "mpc_length %x\n", mpc->length); 739 pr_info("mpc_length %x\n", mpc->length);
739 while (count < mpc->length) { 740 while (count < mpc->length) {
740 switch (*mpt) { 741 switch (*mpt) {
741 case MP_PROCESSOR: 742 case MP_PROCESSOR:
@@ -862,13 +863,13 @@ static int __init update_mp_table(void)
862 if (!smp_check_mpc(mpc, oem, str)) 863 if (!smp_check_mpc(mpc, oem, str))
863 return 0; 864 return 0;
864 865
865 printk(KERN_INFO "mpf: %llx\n", (u64)virt_to_phys(mpf)); 866 pr_info("mpf: %llx\n", (u64)virt_to_phys(mpf));
866 printk(KERN_INFO "physptr: %x\n", mpf->physptr); 867 pr_info("physptr: %x\n", mpf->physptr);
867 868
868 if (mpc_new_phys && mpc->length > mpc_new_length) { 869 if (mpc_new_phys && mpc->length > mpc_new_length) {
869 mpc_new_phys = 0; 870 mpc_new_phys = 0;
870 printk(KERN_INFO "mpc_new_length is %ld, please use alloc_mptable=8k\n", 871 pr_info("mpc_new_length is %ld, please use alloc_mptable=8k\n",
871 mpc_new_length); 872 mpc_new_length);
872 } 873 }
873 874
874 if (!mpc_new_phys) { 875 if (!mpc_new_phys) {
@@ -879,10 +880,10 @@ static int __init update_mp_table(void)
879 mpc->checksum = 0xff; 880 mpc->checksum = 0xff;
880 new = mpf_checksum((unsigned char *)mpc, mpc->length); 881 new = mpf_checksum((unsigned char *)mpc, mpc->length);
881 if (old == new) { 882 if (old == new) {
882 printk(KERN_INFO "mpc is readonly, please try alloc_mptable instead\n"); 883 pr_info("mpc is readonly, please try alloc_mptable instead\n");
883 return 0; 884 return 0;
884 } 885 }
885 printk(KERN_INFO "use in-position replacing\n"); 886 pr_info("use in-position replacing\n");
886 } else { 887 } else {
887 mpf->physptr = mpc_new_phys; 888 mpf->physptr = mpc_new_phys;
888 mpc_new = phys_to_virt(mpc_new_phys); 889 mpc_new = phys_to_virt(mpc_new_phys);
@@ -892,7 +893,7 @@ static int __init update_mp_table(void)
892 if (mpc_new_phys - mpf->physptr) { 893 if (mpc_new_phys - mpf->physptr) {
893 struct mpf_intel *mpf_new; 894 struct mpf_intel *mpf_new;
894 /* steal 16 bytes from [0, 1k) */ 895 /* steal 16 bytes from [0, 1k) */
895 printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); 896 pr_info("mpf new: %x\n", 0x400 - 16);
896 mpf_new = phys_to_virt(0x400 - 16); 897 mpf_new = phys_to_virt(0x400 - 16);
897 memcpy(mpf_new, mpf, 16); 898 memcpy(mpf_new, mpf, 16);
898 mpf = mpf_new; 899 mpf = mpf_new;
@@ -900,7 +901,7 @@ static int __init update_mp_table(void)
900 } 901 }
901 mpf->checksum = 0; 902 mpf->checksum = 0;
902 mpf->checksum -= mpf_checksum((unsigned char *)mpf, 16); 903 mpf->checksum -= mpf_checksum((unsigned char *)mpf, 16);
903 printk(KERN_INFO "physptr new: %x\n", mpf->physptr); 904 pr_info("physptr new: %x\n", mpf->physptr);
904 } 905 }
905 906
906 /* 907 /*
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4505e2a950d8..f804dc935d2a 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -93,6 +93,7 @@ void arch_task_cache_init(void)
93 kmem_cache_create("task_xstate", xstate_size, 93 kmem_cache_create("task_xstate", xstate_size,
94 __alignof__(union thread_xstate), 94 __alignof__(union thread_xstate),
95 SLAB_PANIC | SLAB_NOTRACK, NULL); 95 SLAB_PANIC | SLAB_NOTRACK, NULL);
96 setup_xstate_comp();
96} 97}
97 98
98/* 99/*
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 5492798930ef..2d872e08fab9 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -168,10 +168,6 @@ static void smp_callin(void)
168 * CPU, first the APIC. (this is probably redundant on most 168 * CPU, first the APIC. (this is probably redundant on most
169 * boards) 169 * boards)
170 */ 170 */
171
172 pr_debug("CALLIN, before setup_local_APIC()\n");
173 if (apic->smp_callin_clear_local_apic)
174 apic->smp_callin_clear_local_apic();
175 setup_local_APIC(); 171 setup_local_APIC();
176 end_local_APIC_setup(); 172 end_local_APIC_setup();
177 173
@@ -1143,10 +1139,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1143 enable_IO_APIC(); 1139 enable_IO_APIC();
1144 1140
1145 bsp_end_local_APIC_setup(); 1141 bsp_end_local_APIC_setup();
1146
1147 if (apic->setup_portio_remap)
1148 apic->setup_portio_remap();
1149
1150 smpboot_setup_io_apic(); 1142 smpboot_setup_io_apic();
1151 /* 1143 /*
1152 * Set up local APIC timer on boot CPU. 1144 * Set up local APIC timer on boot CPU.
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 56b0c338061e..b6025f9e36c6 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -950,7 +950,7 @@ core_initcall(cpufreq_tsc);
950static struct clocksource clocksource_tsc; 950static struct clocksource clocksource_tsc;
951 951
952/* 952/*
953 * We compare the TSC to the cycle_last value in the clocksource 953 * We used to compare the TSC to the cycle_last value in the clocksource
954 * structure to avoid a nasty time-warp. This can be observed in a 954 * structure to avoid a nasty time-warp. This can be observed in a
955 * very small window right after one CPU updated cycle_last under 955 * very small window right after one CPU updated cycle_last under
956 * xtime/vsyscall_gtod lock and the other CPU reads a TSC value which 956 * xtime/vsyscall_gtod lock and the other CPU reads a TSC value which
@@ -960,26 +960,23 @@ static struct clocksource clocksource_tsc;
960 * due to the unsigned delta calculation of the time keeping core 960 * due to the unsigned delta calculation of the time keeping core
961 * code, which is necessary to support wrapping clocksources like pm 961 * code, which is necessary to support wrapping clocksources like pm
962 * timer. 962 * timer.
963 *
964 * This sanity check is now done in the core timekeeping code.
965 * checking the result of read_tsc() - cycle_last for being negative.
966 * That works because CLOCKSOURCE_MASK(64) does not mask out any bit.
963 */ 967 */
964static cycle_t read_tsc(struct clocksource *cs) 968static cycle_t read_tsc(struct clocksource *cs)
965{ 969{
966 cycle_t ret = (cycle_t)get_cycles(); 970 return (cycle_t)get_cycles();
967
968 return ret >= clocksource_tsc.cycle_last ?
969 ret : clocksource_tsc.cycle_last;
970}
971
972static void resume_tsc(struct clocksource *cs)
973{
974 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))
975 clocksource_tsc.cycle_last = 0;
976} 971}
977 972
973/*
974 * .mask MUST be CLOCKSOURCE_MASK(64). See comment above read_tsc()
975 */
978static struct clocksource clocksource_tsc = { 976static struct clocksource clocksource_tsc = {
979 .name = "tsc", 977 .name = "tsc",
980 .rating = 300, 978 .rating = 300,
981 .read = read_tsc, 979 .read = read_tsc,
982 .resume = resume_tsc,
983 .mask = CLOCKSOURCE_MASK(64), 980 .mask = CLOCKSOURCE_MASK(64),
984 .flags = CLOCK_SOURCE_IS_CONTINUOUS | 981 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
985 CLOCK_SOURCE_MUST_VERIFY, 982 CLOCK_SOURCE_MUST_VERIFY,
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index b99b9ad8540c..ee22c1d93ae5 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -152,7 +152,7 @@ static void __init detect_vsmp_box(void)
152 is_vsmp = 1; 152 is_vsmp = 1;
153} 153}
154 154
155int is_vsmp_box(void) 155static int is_vsmp_box(void)
156{ 156{
157 if (is_vsmp != -1) 157 if (is_vsmp != -1)
158 return is_vsmp; 158 return is_vsmp;
@@ -166,7 +166,7 @@ int is_vsmp_box(void)
166static void __init detect_vsmp_box(void) 166static void __init detect_vsmp_box(void)
167{ 167{
168} 168}
169int is_vsmp_box(void) 169static int is_vsmp_box(void)
170{ 170{
171 return 0; 171 return 0;
172} 172}
diff --git a/arch/x86/kernel/vsyscall_gtod.c b/arch/x86/kernel/vsyscall_gtod.c
index 9531fbb123ba..c7d791f32b98 100644
--- a/arch/x86/kernel/vsyscall_gtod.c
+++ b/arch/x86/kernel/vsyscall_gtod.c
@@ -31,29 +31,30 @@ void update_vsyscall(struct timekeeper *tk)
31 gtod_write_begin(vdata); 31 gtod_write_begin(vdata);
32 32
33 /* copy vsyscall data */ 33 /* copy vsyscall data */
34 vdata->vclock_mode = tk->clock->archdata.vclock_mode; 34 vdata->vclock_mode = tk->tkr.clock->archdata.vclock_mode;
35 vdata->cycle_last = tk->clock->cycle_last; 35 vdata->cycle_last = tk->tkr.cycle_last;
36 vdata->mask = tk->clock->mask; 36 vdata->mask = tk->tkr.mask;
37 vdata->mult = tk->mult; 37 vdata->mult = tk->tkr.mult;
38 vdata->shift = tk->shift; 38 vdata->shift = tk->tkr.shift;
39 39
40 vdata->wall_time_sec = tk->xtime_sec; 40 vdata->wall_time_sec = tk->xtime_sec;
41 vdata->wall_time_snsec = tk->xtime_nsec; 41 vdata->wall_time_snsec = tk->tkr.xtime_nsec;
42 42
43 vdata->monotonic_time_sec = tk->xtime_sec 43 vdata->monotonic_time_sec = tk->xtime_sec
44 + tk->wall_to_monotonic.tv_sec; 44 + tk->wall_to_monotonic.tv_sec;
45 vdata->monotonic_time_snsec = tk->xtime_nsec 45 vdata->monotonic_time_snsec = tk->tkr.xtime_nsec
46 + ((u64)tk->wall_to_monotonic.tv_nsec 46 + ((u64)tk->wall_to_monotonic.tv_nsec
47 << tk->shift); 47 << tk->tkr.shift);
48 while (vdata->monotonic_time_snsec >= 48 while (vdata->monotonic_time_snsec >=
49 (((u64)NSEC_PER_SEC) << tk->shift)) { 49 (((u64)NSEC_PER_SEC) << tk->tkr.shift)) {
50 vdata->monotonic_time_snsec -= 50 vdata->monotonic_time_snsec -=
51 ((u64)NSEC_PER_SEC) << tk->shift; 51 ((u64)NSEC_PER_SEC) << tk->tkr.shift;
52 vdata->monotonic_time_sec++; 52 vdata->monotonic_time_sec++;
53 } 53 }
54 54
55 vdata->wall_time_coarse_sec = tk->xtime_sec; 55 vdata->wall_time_coarse_sec = tk->xtime_sec;
56 vdata->wall_time_coarse_nsec = (long)(tk->xtime_nsec >> tk->shift); 56 vdata->wall_time_coarse_nsec = (long)(tk->tkr.xtime_nsec >>
57 tk->tkr.shift);
57 58
58 vdata->monotonic_time_coarse_sec = 59 vdata->monotonic_time_coarse_sec =
59 vdata->wall_time_coarse_sec + tk->wall_to_monotonic.tv_sec; 60 vdata->wall_time_coarse_sec + tk->wall_to_monotonic.tv_sec;
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index a4b451c6addf..940b142cc11f 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/compat.h> 10#include <linux/compat.h>
11#include <linux/cpu.h>
11#include <asm/i387.h> 12#include <asm/i387.h>
12#include <asm/fpu-internal.h> 13#include <asm/fpu-internal.h>
13#include <asm/sigframe.h> 14#include <asm/sigframe.h>
@@ -24,7 +25,9 @@ u64 pcntxt_mask;
24struct xsave_struct *init_xstate_buf; 25struct xsave_struct *init_xstate_buf;
25 26
26static struct _fpx_sw_bytes fx_sw_reserved, fx_sw_reserved_ia32; 27static struct _fpx_sw_bytes fx_sw_reserved, fx_sw_reserved_ia32;
27static unsigned int *xstate_offsets, *xstate_sizes, xstate_features; 28static unsigned int *xstate_offsets, *xstate_sizes;
29static unsigned int xstate_comp_offsets[sizeof(pcntxt_mask)*8];
30static unsigned int xstate_features;
28 31
29/* 32/*
30 * If a processor implementation discern that a processor state component is 33 * If a processor implementation discern that a processor state component is
@@ -283,7 +286,7 @@ sanitize_restored_xstate(struct task_struct *tsk,
283 286
284 if (use_xsave()) { 287 if (use_xsave()) {
285 /* These bits must be zero. */ 288 /* These bits must be zero. */
286 xsave_hdr->reserved1[0] = xsave_hdr->reserved1[1] = 0; 289 memset(xsave_hdr->reserved, 0, 48);
287 290
288 /* 291 /*
289 * Init the state that is not present in the memory 292 * Init the state that is not present in the memory
@@ -479,6 +482,52 @@ static void __init setup_xstate_features(void)
479} 482}
480 483
481/* 484/*
485 * This function sets up offsets and sizes of all extended states in
486 * xsave area. This supports both standard format and compacted format
487 * of the xsave aread.
488 *
489 * Input: void
490 * Output: void
491 */
492void setup_xstate_comp(void)
493{
494 unsigned int xstate_comp_sizes[sizeof(pcntxt_mask)*8];
495 int i;
496
497 /*
498 * The FP xstates and SSE xstates are legacy states. They are always
499 * in the fixed offsets in the xsave area in either compacted form
500 * or standard form.
501 */
502 xstate_comp_offsets[0] = 0;
503 xstate_comp_offsets[1] = offsetof(struct i387_fxsave_struct, xmm_space);
504
505 if (!cpu_has_xsaves) {
506 for (i = 2; i < xstate_features; i++) {
507 if (test_bit(i, (unsigned long *)&pcntxt_mask)) {
508 xstate_comp_offsets[i] = xstate_offsets[i];
509 xstate_comp_sizes[i] = xstate_sizes[i];
510 }
511 }
512 return;
513 }
514
515 xstate_comp_offsets[2] = FXSAVE_SIZE + XSAVE_HDR_SIZE;
516
517 for (i = 2; i < xstate_features; i++) {
518 if (test_bit(i, (unsigned long *)&pcntxt_mask))
519 xstate_comp_sizes[i] = xstate_sizes[i];
520 else
521 xstate_comp_sizes[i] = 0;
522
523 if (i > 2)
524 xstate_comp_offsets[i] = xstate_comp_offsets[i-1]
525 + xstate_comp_sizes[i-1];
526
527 }
528}
529
530/*
482 * setup the xstate image representing the init state 531 * setup the xstate image representing the init state
483 */ 532 */
484static void __init setup_init_fpu_buf(void) 533static void __init setup_init_fpu_buf(void)
@@ -496,15 +545,21 @@ static void __init setup_init_fpu_buf(void)
496 545
497 setup_xstate_features(); 546 setup_xstate_features();
498 547
548 if (cpu_has_xsaves) {
549 init_xstate_buf->xsave_hdr.xcomp_bv =
550 (u64)1 << 63 | pcntxt_mask;
551 init_xstate_buf->xsave_hdr.xstate_bv = pcntxt_mask;
552 }
553
499 /* 554 /*
500 * Init all the features state with header_bv being 0x0 555 * Init all the features state with header_bv being 0x0
501 */ 556 */
502 xrstor_state(init_xstate_buf, -1); 557 xrstor_state_booting(init_xstate_buf, -1);
503 /* 558 /*
504 * Dump the init state again. This is to identify the init state 559 * Dump the init state again. This is to identify the init state
505 * of any feature which is not represented by all zero's. 560 * of any feature which is not represented by all zero's.
506 */ 561 */
507 xsave_state(init_xstate_buf, -1); 562 xsave_state_booting(init_xstate_buf, -1);
508} 563}
509 564
510static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO; 565static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO;
@@ -520,6 +575,30 @@ static int __init eager_fpu_setup(char *s)
520} 575}
521__setup("eagerfpu=", eager_fpu_setup); 576__setup("eagerfpu=", eager_fpu_setup);
522 577
578
579/*
580 * Calculate total size of enabled xstates in XCR0/pcntxt_mask.
581 */
582static void __init init_xstate_size(void)
583{
584 unsigned int eax, ebx, ecx, edx;
585 int i;
586
587 if (!cpu_has_xsaves) {
588 cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
589 xstate_size = ebx;
590 return;
591 }
592
593 xstate_size = FXSAVE_SIZE + XSAVE_HDR_SIZE;
594 for (i = 2; i < 64; i++) {
595 if (test_bit(i, (unsigned long *)&pcntxt_mask)) {
596 cpuid_count(XSTATE_CPUID, i, &eax, &ebx, &ecx, &edx);
597 xstate_size += eax;
598 }
599 }
600}
601
523/* 602/*
524 * Enable and initialize the xsave feature. 603 * Enable and initialize the xsave feature.
525 */ 604 */
@@ -551,8 +630,7 @@ static void __init xstate_enable_boot_cpu(void)
551 /* 630 /*
552 * Recompute the context size for enabled features 631 * Recompute the context size for enabled features
553 */ 632 */
554 cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx); 633 init_xstate_size();
555 xstate_size = ebx;
556 634
557 update_regset_xstate_info(xstate_size, pcntxt_mask); 635 update_regset_xstate_info(xstate_size, pcntxt_mask);
558 prepare_fx_sw_frame(); 636 prepare_fx_sw_frame();
@@ -572,8 +650,9 @@ static void __init xstate_enable_boot_cpu(void)
572 } 650 }
573 } 651 }
574 652
575 pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x\n", 653 pr_info("enabled xstate_bv 0x%llx, cntxt size 0x%x using %s\n",
576 pcntxt_mask, xstate_size); 654 pcntxt_mask, xstate_size,
655 cpu_has_xsaves ? "compacted form" : "standard form");
577} 656}
578 657
579/* 658/*
@@ -635,3 +714,26 @@ void eager_fpu_init(void)
635 else 714 else
636 fxrstor_checking(&init_xstate_buf->i387); 715 fxrstor_checking(&init_xstate_buf->i387);
637} 716}
717
718/*
719 * Given the xsave area and a state inside, this function returns the
720 * address of the state.
721 *
722 * This is the API that is called to get xstate address in either
723 * standard format or compacted format of xsave area.
724 *
725 * Inputs:
726 * xsave: base address of the xsave area;
727 * xstate: state which is defined in xsave.h (e.g. XSTATE_FP, XSTATE_SSE,
728 * etc.)
729 * Output:
730 * address of the state in the xsave area.
731 */
732void *get_xsave_addr(struct xsave_struct *xsave, int xstate)
733{
734 int feature = fls64(xstate) - 1;
735 if (!test_bit(feature, (unsigned long *)&pcntxt_mask))
736 return NULL;
737
738 return (void *)xsave + xstate_comp_offsets[feature];
739}
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 287e4c85fff9..f9d16ff56c6b 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -27,6 +27,7 @@ config KVM
27 select MMU_NOTIFIER 27 select MMU_NOTIFIER
28 select ANON_INODES 28 select ANON_INODES
29 select HAVE_KVM_IRQCHIP 29 select HAVE_KVM_IRQCHIP
30 select HAVE_KVM_IRQFD
30 select HAVE_KVM_IRQ_ROUTING 31 select HAVE_KVM_IRQ_ROUTING
31 select HAVE_KVM_EVENTFD 32 select HAVE_KVM_EVENTFD
32 select KVM_APIC_ARCHITECTURE 33 select KVM_APIC_ARCHITECTURE
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index bd0da433e6d7..a1ec6a50a05a 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -108,7 +108,7 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v)
108 108
109 vector = kvm_cpu_get_extint(v); 109 vector = kvm_cpu_get_extint(v);
110 110
111 if (kvm_apic_vid_enabled(v->kvm) || vector != -1) 111 if (vector != -1)
112 return vector; /* PIC */ 112 return vector; /* PIC */
113 113
114 return kvm_get_apic_interrupt(v); /* APIC */ 114 return kvm_get_apic_interrupt(v); /* APIC */
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 3855103f71fd..08e8a899e005 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -352,25 +352,46 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic)
352 352
353static inline void apic_clear_irr(int vec, struct kvm_lapic *apic) 353static inline void apic_clear_irr(int vec, struct kvm_lapic *apic)
354{ 354{
355 apic->irr_pending = false; 355 struct kvm_vcpu *vcpu;
356
357 vcpu = apic->vcpu;
358
356 apic_clear_vector(vec, apic->regs + APIC_IRR); 359 apic_clear_vector(vec, apic->regs + APIC_IRR);
357 if (apic_search_irr(apic) != -1) 360 if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
358 apic->irr_pending = true; 361 /* try to update RVI */
362 kvm_make_request(KVM_REQ_EVENT, vcpu);
363 else {
364 vec = apic_search_irr(apic);
365 apic->irr_pending = (vec != -1);
366 }
359} 367}
360 368
361static inline void apic_set_isr(int vec, struct kvm_lapic *apic) 369static inline void apic_set_isr(int vec, struct kvm_lapic *apic)
362{ 370{
363 /* Note that we never get here with APIC virtualization enabled. */ 371 struct kvm_vcpu *vcpu;
372
373 if (__apic_test_and_set_vector(vec, apic->regs + APIC_ISR))
374 return;
375
376 vcpu = apic->vcpu;
364 377
365 if (!__apic_test_and_set_vector(vec, apic->regs + APIC_ISR))
366 ++apic->isr_count;
367 BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
368 /* 378 /*
369 * ISR (in service register) bit is set when injecting an interrupt. 379 * With APIC virtualization enabled, all caching is disabled
370 * The highest vector is injected. Thus the latest bit set matches 380 * because the processor can modify ISR under the hood. Instead
371 * the highest bit in ISR. 381 * just set SVI.
372 */ 382 */
373 apic->highest_isr_cache = vec; 383 if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
384 kvm_x86_ops->hwapic_isr_update(vcpu->kvm, vec);
385 else {
386 ++apic->isr_count;
387 BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
388 /*
389 * ISR (in service register) bit is set when injecting an interrupt.
390 * The highest vector is injected. Thus the latest bit set matches
391 * the highest bit in ISR.
392 */
393 apic->highest_isr_cache = vec;
394 }
374} 395}
375 396
376static inline int apic_find_highest_isr(struct kvm_lapic *apic) 397static inline int apic_find_highest_isr(struct kvm_lapic *apic)
@@ -1627,11 +1648,16 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
1627 int vector = kvm_apic_has_interrupt(vcpu); 1648 int vector = kvm_apic_has_interrupt(vcpu);
1628 struct kvm_lapic *apic = vcpu->arch.apic; 1649 struct kvm_lapic *apic = vcpu->arch.apic;
1629 1650
1630 /* Note that we never get here with APIC virtualization enabled. */
1631
1632 if (vector == -1) 1651 if (vector == -1)
1633 return -1; 1652 return -1;
1634 1653
1654 /*
1655 * We get here even with APIC virtualization enabled, if doing
1656 * nested virtualization and L1 runs with the "acknowledge interrupt
1657 * on exit" mode. Then we cannot inject the interrupt via RVI,
1658 * because the process would deliver it through the IDT.
1659 */
1660
1635 apic_set_isr(vector, apic); 1661 apic_set_isr(vector, apic);
1636 apic_update_ppr(apic); 1662 apic_update_ppr(apic);
1637 apic_clear_irr(vector, apic); 1663 apic_clear_irr(vector, apic);
diff --git a/arch/x86/kvm/mmu_audit.c b/arch/x86/kvm/mmu_audit.c
index 1185fe7a7f47..9ade5cfb5a4c 100644
--- a/arch/x86/kvm/mmu_audit.c
+++ b/arch/x86/kvm/mmu_audit.c
@@ -273,7 +273,7 @@ static int mmu_audit_set(const char *val, const struct kernel_param *kp)
273 int ret; 273 int ret;
274 unsigned long enable; 274 unsigned long enable;
275 275
276 ret = strict_strtoul(val, 10, &enable); 276 ret = kstrtoul(val, 10, &enable);
277 if (ret < 0) 277 if (ret < 0)
278 return -EINVAL; 278 return -EINVAL;
279 279
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e618f34bde2d..bfe11cf124a1 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8754,6 +8754,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8754 prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info, 8754 prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
8755 exit_qualification); 8755 exit_qualification);
8756 8756
8757 vmx_load_vmcs01(vcpu);
8758
8757 if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT) 8759 if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
8758 && nested_exit_intr_ack_set(vcpu)) { 8760 && nested_exit_intr_ack_set(vcpu)) {
8759 int irq = kvm_cpu_get_interrupt(vcpu); 8761 int irq = kvm_cpu_get_interrupt(vcpu);
@@ -8769,8 +8771,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8769 vmcs12->vm_exit_intr_error_code, 8771 vmcs12->vm_exit_intr_error_code,
8770 KVM_ISA_VMX); 8772 KVM_ISA_VMX);
8771 8773
8772 vmx_load_vmcs01(vcpu);
8773
8774 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS)); 8774 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS));
8775 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS)); 8775 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS));
8776 vmx_segment_cache_clear(vmx); 8776 vmx_segment_cache_clear(vmx);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b86d329b953a..8f1e22d3b286 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1020,9 +1020,8 @@ struct pvclock_gtod_data {
1020 u32 shift; 1020 u32 shift;
1021 } clock; 1021 } clock;
1022 1022
1023 /* open coded 'struct timespec' */ 1023 u64 boot_ns;
1024 u64 monotonic_time_snsec; 1024 u64 nsec_base;
1025 time_t monotonic_time_sec;
1026}; 1025};
1027 1026
1028static struct pvclock_gtod_data pvclock_gtod_data; 1027static struct pvclock_gtod_data pvclock_gtod_data;
@@ -1030,27 +1029,21 @@ static struct pvclock_gtod_data pvclock_gtod_data;
1030static void update_pvclock_gtod(struct timekeeper *tk) 1029static void update_pvclock_gtod(struct timekeeper *tk)
1031{ 1030{
1032 struct pvclock_gtod_data *vdata = &pvclock_gtod_data; 1031 struct pvclock_gtod_data *vdata = &pvclock_gtod_data;
1032 u64 boot_ns;
1033
1034 boot_ns = ktime_to_ns(ktime_add(tk->tkr.base_mono, tk->offs_boot));
1033 1035
1034 write_seqcount_begin(&vdata->seq); 1036 write_seqcount_begin(&vdata->seq);
1035 1037
1036 /* copy pvclock gtod data */ 1038 /* copy pvclock gtod data */
1037 vdata->clock.vclock_mode = tk->clock->archdata.vclock_mode; 1039 vdata->clock.vclock_mode = tk->tkr.clock->archdata.vclock_mode;
1038 vdata->clock.cycle_last = tk->clock->cycle_last; 1040 vdata->clock.cycle_last = tk->tkr.cycle_last;
1039 vdata->clock.mask = tk->clock->mask; 1041 vdata->clock.mask = tk->tkr.mask;
1040 vdata->clock.mult = tk->mult; 1042 vdata->clock.mult = tk->tkr.mult;
1041 vdata->clock.shift = tk->shift; 1043 vdata->clock.shift = tk->tkr.shift;
1042 1044
1043 vdata->monotonic_time_sec = tk->xtime_sec 1045 vdata->boot_ns = boot_ns;
1044 + tk->wall_to_monotonic.tv_sec; 1046 vdata->nsec_base = tk->tkr.xtime_nsec;
1045 vdata->monotonic_time_snsec = tk->xtime_nsec
1046 + (tk->wall_to_monotonic.tv_nsec
1047 << tk->shift);
1048 while (vdata->monotonic_time_snsec >=
1049 (((u64)NSEC_PER_SEC) << tk->shift)) {
1050 vdata->monotonic_time_snsec -=
1051 ((u64)NSEC_PER_SEC) << tk->shift;
1052 vdata->monotonic_time_sec++;
1053 }
1054 1047
1055 write_seqcount_end(&vdata->seq); 1048 write_seqcount_end(&vdata->seq);
1056} 1049}
@@ -1145,11 +1138,7 @@ static void kvm_get_time_scale(uint32_t scaled_khz, uint32_t base_khz,
1145 1138
1146static inline u64 get_kernel_ns(void) 1139static inline u64 get_kernel_ns(void)
1147{ 1140{
1148 struct timespec ts; 1141 return ktime_get_boot_ns();
1149
1150 ktime_get_ts(&ts);
1151 monotonic_to_bootbased(&ts);
1152 return timespec_to_ns(&ts);
1153} 1142}
1154 1143
1155#ifdef CONFIG_X86_64 1144#ifdef CONFIG_X86_64
@@ -1414,23 +1403,22 @@ static inline u64 vgettsc(cycle_t *cycle_now)
1414 return v * gtod->clock.mult; 1403 return v * gtod->clock.mult;
1415} 1404}
1416 1405
1417static int do_monotonic(struct timespec *ts, cycle_t *cycle_now) 1406static int do_monotonic_boot(s64 *t, cycle_t *cycle_now)
1418{ 1407{
1408 struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
1419 unsigned long seq; 1409 unsigned long seq;
1420 u64 ns;
1421 int mode; 1410 int mode;
1422 struct pvclock_gtod_data *gtod = &pvclock_gtod_data; 1411 u64 ns;
1423 1412
1424 ts->tv_nsec = 0;
1425 do { 1413 do {
1426 seq = read_seqcount_begin(&gtod->seq); 1414 seq = read_seqcount_begin(&gtod->seq);
1427 mode = gtod->clock.vclock_mode; 1415 mode = gtod->clock.vclock_mode;
1428 ts->tv_sec = gtod->monotonic_time_sec; 1416 ns = gtod->nsec_base;
1429 ns = gtod->monotonic_time_snsec;
1430 ns += vgettsc(cycle_now); 1417 ns += vgettsc(cycle_now);
1431 ns >>= gtod->clock.shift; 1418 ns >>= gtod->clock.shift;
1419 ns += gtod->boot_ns;
1432 } while (unlikely(read_seqcount_retry(&gtod->seq, seq))); 1420 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
1433 timespec_add_ns(ts, ns); 1421 *t = ns;
1434 1422
1435 return mode; 1423 return mode;
1436} 1424}
@@ -1438,19 +1426,11 @@ static int do_monotonic(struct timespec *ts, cycle_t *cycle_now)
1438/* returns true if host is using tsc clocksource */ 1426/* returns true if host is using tsc clocksource */
1439static bool kvm_get_time_and_clockread(s64 *kernel_ns, cycle_t *cycle_now) 1427static bool kvm_get_time_and_clockread(s64 *kernel_ns, cycle_t *cycle_now)
1440{ 1428{
1441 struct timespec ts;
1442
1443 /* checked again under seqlock below */ 1429 /* checked again under seqlock below */
1444 if (pvclock_gtod_data.clock.vclock_mode != VCLOCK_TSC) 1430 if (pvclock_gtod_data.clock.vclock_mode != VCLOCK_TSC)
1445 return false; 1431 return false;
1446 1432
1447 if (do_monotonic(&ts, cycle_now) != VCLOCK_TSC) 1433 return do_monotonic_boot(kernel_ns, cycle_now) == VCLOCK_TSC;
1448 return false;
1449
1450 monotonic_to_bootbased(&ts);
1451 *kernel_ns = timespec_to_ns(&ts);
1452
1453 return true;
1454} 1434}
1455#endif 1435#endif
1456 1436
@@ -2656,7 +2636,7 @@ out:
2656 return r; 2636 return r;
2657} 2637}
2658 2638
2659int kvm_dev_ioctl_check_extension(long ext) 2639int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
2660{ 2640{
2661 int r; 2641 int r;
2662 2642
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 1dbade870f90..a24194681513 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1218,7 +1218,8 @@ good_area:
1218 /* 1218 /*
1219 * If for any reason at all we couldn't handle the fault, 1219 * If for any reason at all we couldn't handle the fault,
1220 * make sure we exit gracefully rather than endlessly redo 1220 * make sure we exit gracefully rather than endlessly redo
1221 * the fault: 1221 * the fault. Since we never set FAULT_FLAG_RETRY_NOWAIT, if
1222 * we get VM_FAULT_RETRY back, the mmap_sem has been unlocked.
1222 */ 1223 */
1223 fault = handle_mm_fault(mm, vma, address, flags); 1224 fault = handle_mm_fault(mm, vma, address, flags);
1224 1225
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index e39504878aec..7d05565ba781 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -825,7 +825,8 @@ void __init mem_init(void)
825int arch_add_memory(int nid, u64 start, u64 size) 825int arch_add_memory(int nid, u64 start, u64 size)
826{ 826{
827 struct pglist_data *pgdata = NODE_DATA(nid); 827 struct pglist_data *pgdata = NODE_DATA(nid);
828 struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; 828 struct zone *zone = pgdata->node_zones +
829 zone_for_memory(nid, start, size, ZONE_HIGHMEM);
829 unsigned long start_pfn = start >> PAGE_SHIFT; 830 unsigned long start_pfn = start >> PAGE_SHIFT;
830 unsigned long nr_pages = size >> PAGE_SHIFT; 831 unsigned long nr_pages = size >> PAGE_SHIFT;
831 832
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index df1a9927ad29..5621c47d7a1a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -691,7 +691,8 @@ static void update_end_of_memory_vars(u64 start, u64 size)
691int arch_add_memory(int nid, u64 start, u64 size) 691int arch_add_memory(int nid, u64 start, u64 size)
692{ 692{
693 struct pglist_data *pgdat = NODE_DATA(nid); 693 struct pglist_data *pgdat = NODE_DATA(nid);
694 struct zone *zone = pgdat->node_zones + ZONE_NORMAL; 694 struct zone *zone = pgdat->node_zones +
695 zone_for_memory(nid, start, size, ZONE_NORMAL);
695 unsigned long start_pfn = start >> PAGE_SHIFT; 696 unsigned long start_pfn = start >> PAGE_SHIFT;
696 unsigned long nr_pages = size >> PAGE_SHIFT; 697 unsigned long nr_pages = size >> PAGE_SHIFT;
697 int ret; 698 int ret;
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 99bef86ed6df..5c8cb8043c5a 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -211,10 +211,10 @@ struct jit_context {
211 bool seen_ld_abs; 211 bool seen_ld_abs;
212}; 212};
213 213
214static int do_jit(struct sk_filter *bpf_prog, int *addrs, u8 *image, 214static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
215 int oldproglen, struct jit_context *ctx) 215 int oldproglen, struct jit_context *ctx)
216{ 216{
217 struct sock_filter_int *insn = bpf_prog->insnsi; 217 struct bpf_insn *insn = bpf_prog->insnsi;
218 int insn_cnt = bpf_prog->len; 218 int insn_cnt = bpf_prog->len;
219 u8 temp[64]; 219 u8 temp[64];
220 int i; 220 int i;
@@ -235,7 +235,7 @@ static int do_jit(struct sk_filter *bpf_prog, int *addrs, u8 *image,
235 /* mov qword ptr [rbp-X],rbx */ 235 /* mov qword ptr [rbp-X],rbx */
236 EMIT3_off32(0x48, 0x89, 0x9D, -stacksize); 236 EMIT3_off32(0x48, 0x89, 0x9D, -stacksize);
237 237
238 /* sk_convert_filter() maps classic BPF register X to R7 and uses R8 238 /* bpf_convert_filter() maps classic BPF register X to R7 and uses R8
239 * as temporary, so all tcpdump filters need to spill/fill R7(r13) and 239 * as temporary, so all tcpdump filters need to spill/fill R7(r13) and
240 * R8(r14). R9(r15) spill could be made conditional, but there is only 240 * R8(r14). R9(r15) spill could be made conditional, but there is only
241 * one 'bpf_error' return path out of helper functions inside bpf_jit.S 241 * one 'bpf_error' return path out of helper functions inside bpf_jit.S
@@ -841,7 +841,7 @@ common_load: ctx->seen_ld_abs = true;
841 /* By design x64 JIT should support all BPF instructions 841 /* By design x64 JIT should support all BPF instructions
842 * This error will be seen if new instruction was added 842 * This error will be seen if new instruction was added
843 * to interpreter, but not to JIT 843 * to interpreter, but not to JIT
844 * or if there is junk in sk_filter 844 * or if there is junk in bpf_prog
845 */ 845 */
846 pr_err("bpf_jit: unknown opcode %02x\n", insn->code); 846 pr_err("bpf_jit: unknown opcode %02x\n", insn->code);
847 return -EINVAL; 847 return -EINVAL;
@@ -862,11 +862,11 @@ common_load: ctx->seen_ld_abs = true;
862 return proglen; 862 return proglen;
863} 863}
864 864
865void bpf_jit_compile(struct sk_filter *prog) 865void bpf_jit_compile(struct bpf_prog *prog)
866{ 866{
867} 867}
868 868
869void bpf_int_jit_compile(struct sk_filter *prog) 869void bpf_int_jit_compile(struct bpf_prog *prog)
870{ 870{
871 struct bpf_binary_header *header = NULL; 871 struct bpf_binary_header *header = NULL;
872 int proglen, oldproglen = 0; 872 int proglen, oldproglen = 0;
@@ -932,7 +932,7 @@ out:
932 932
933static void bpf_jit_free_deferred(struct work_struct *work) 933static void bpf_jit_free_deferred(struct work_struct *work)
934{ 934{
935 struct sk_filter *fp = container_of(work, struct sk_filter, work); 935 struct bpf_prog *fp = container_of(work, struct bpf_prog, work);
936 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; 936 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
937 struct bpf_binary_header *header = (void *)addr; 937 struct bpf_binary_header *header = (void *)addr;
938 938
@@ -941,7 +941,7 @@ static void bpf_jit_free_deferred(struct work_struct *work)
941 kfree(fp); 941 kfree(fp);
942} 942}
943 943
944void bpf_jit_free(struct sk_filter *fp) 944void bpf_jit_free(struct bpf_prog *fp)
945{ 945{
946 if (fp->jited) { 946 if (fp->jited) {
947 INIT_WORK(&fp->work, bpf_jit_free_deferred); 947 INIT_WORK(&fp->work, bpf_jit_free_deferred);
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 5075371ab593..cfd1b132b8e3 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -448,7 +448,7 @@ static void probe_pci_root_info(struct pci_root_info *info,
448 return; 448 return;
449 449
450 size = sizeof(*info->res) * info->res_num; 450 size = sizeof(*info->res) * info->res_num;
451 info->res = kzalloc(size, GFP_KERNEL); 451 info->res = kzalloc_node(size, GFP_KERNEL, info->sd.node);
452 if (!info->res) { 452 if (!info->res) {
453 info->res_num = 0; 453 info->res_num = 0;
454 return; 454 return;
@@ -456,7 +456,7 @@ static void probe_pci_root_info(struct pci_root_info *info,
456 456
457 size = sizeof(*info->res_offset) * info->res_num; 457 size = sizeof(*info->res_offset) * info->res_num;
458 info->res_num = 0; 458 info->res_num = 0;
459 info->res_offset = kzalloc(size, GFP_KERNEL); 459 info->res_offset = kzalloc_node(size, GFP_KERNEL, info->sd.node);
460 if (!info->res_offset) { 460 if (!info->res_offset) {
461 kfree(info->res); 461 kfree(info->res);
462 info->res = NULL; 462 info->res = NULL;
@@ -499,7 +499,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
499 if (node != NUMA_NO_NODE && !node_online(node)) 499 if (node != NUMA_NO_NODE && !node_online(node))
500 node = NUMA_NO_NODE; 500 node = NUMA_NO_NODE;
501 501
502 info = kzalloc(sizeof(*info), GFP_KERNEL); 502 info = kzalloc_node(sizeof(*info), GFP_KERNEL, node);
503 if (!info) { 503 if (!info) {
504 printk(KERN_WARNING "pci_bus %04x:%02x: " 504 printk(KERN_WARNING "pci_bus %04x:%02x: "
505 "ignored (out of memory)\n", domain, busnum); 505 "ignored (out of memory)\n", domain, busnum);
diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c
index 84b9d672843d..3865116c51fb 100644
--- a/arch/x86/pci/intel_mid_pci.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -208,27 +208,31 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
208 208
209static int intel_mid_pci_irq_enable(struct pci_dev *dev) 209static int intel_mid_pci_irq_enable(struct pci_dev *dev)
210{ 210{
211 u8 pin; 211 int polarity;
212 struct io_apic_irq_attr irq_attr;
213 212
214 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 213 if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER)
214 polarity = 0; /* active high */
215 else
216 polarity = 1; /* active low */
215 217
216 /* 218 /*
217 * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to 219 * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to
218 * IOAPIC RTE entries, so we just enable RTE for the device. 220 * IOAPIC RTE entries, so we just enable RTE for the device.
219 */ 221 */
220 irq_attr.ioapic = mp_find_ioapic(dev->irq); 222 if (mp_set_gsi_attr(dev->irq, 1, polarity, dev_to_node(&dev->dev)))
221 irq_attr.ioapic_pin = dev->irq; 223 return -EBUSY;
222 irq_attr.trigger = 1; /* level */ 224 if (mp_map_gsi_to_irq(dev->irq, IOAPIC_MAP_ALLOC) < 0)
223 if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) 225 return -EBUSY;
224 irq_attr.polarity = 0; /* active high */
225 else
226 irq_attr.polarity = 1; /* active low */
227 io_apic_set_pci_routing(&dev->dev, dev->irq, &irq_attr);
228 226
229 return 0; 227 return 0;
230} 228}
231 229
230static void intel_mid_pci_irq_disable(struct pci_dev *dev)
231{
232 if (!dev->dev.power.is_prepared && dev->irq > 0)
233 mp_unmap_irq(dev->irq);
234}
235
232struct pci_ops intel_mid_pci_ops = { 236struct pci_ops intel_mid_pci_ops = {
233 .read = pci_read, 237 .read = pci_read,
234 .write = pci_write, 238 .write = pci_write,
@@ -245,6 +249,7 @@ int __init intel_mid_pci_init(void)
245 pr_info("Intel MID platform detected, using MID PCI ops\n"); 249 pr_info("Intel MID platform detected, using MID PCI ops\n");
246 pci_mmcfg_late_init(); 250 pci_mmcfg_late_init();
247 pcibios_enable_irq = intel_mid_pci_irq_enable; 251 pcibios_enable_irq = intel_mid_pci_irq_enable;
252 pcibios_disable_irq = intel_mid_pci_irq_disable;
248 pci_root_ops = intel_mid_pci_ops; 253 pci_root_ops = intel_mid_pci_ops;
249 pci_soc_mode = 1; 254 pci_soc_mode = 1;
250 /* Continue with standard init */ 255 /* Continue with standard init */
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 84112f55dd7a..bc1a2c341891 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -26,6 +26,7 @@ static int acer_tm360_irqrouting;
26static struct irq_routing_table *pirq_table; 26static struct irq_routing_table *pirq_table;
27 27
28static int pirq_enable_irq(struct pci_dev *dev); 28static int pirq_enable_irq(struct pci_dev *dev);
29static void pirq_disable_irq(struct pci_dev *dev);
29 30
30/* 31/*
31 * Never use: 0, 1, 2 (timer, keyboard, and cascade) 32 * Never use: 0, 1, 2 (timer, keyboard, and cascade)
@@ -53,7 +54,7 @@ struct irq_router_handler {
53}; 54};
54 55
55int (*pcibios_enable_irq)(struct pci_dev *dev) = pirq_enable_irq; 56int (*pcibios_enable_irq)(struct pci_dev *dev) = pirq_enable_irq;
56void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL; 57void (*pcibios_disable_irq)(struct pci_dev *dev) = pirq_disable_irq;
57 58
58/* 59/*
59 * Check passed address for the PCI IRQ Routing Table signature 60 * Check passed address for the PCI IRQ Routing Table signature
@@ -1186,7 +1187,7 @@ void pcibios_penalize_isa_irq(int irq, int active)
1186 1187
1187static int pirq_enable_irq(struct pci_dev *dev) 1188static int pirq_enable_irq(struct pci_dev *dev)
1188{ 1189{
1189 u8 pin; 1190 u8 pin = 0;
1190 1191
1191 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 1192 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
1192 if (pin && !pcibios_lookup_irq(dev, 1)) { 1193 if (pin && !pcibios_lookup_irq(dev, 1)) {
@@ -1227,8 +1228,6 @@ static int pirq_enable_irq(struct pci_dev *dev)
1227 } 1228 }
1228 dev = temp_dev; 1229 dev = temp_dev;
1229 if (irq >= 0) { 1230 if (irq >= 0) {
1230 io_apic_set_pci_routing(&dev->dev, irq,
1231 &irq_attr);
1232 dev->irq = irq; 1231 dev->irq = irq;
1233 dev_info(&dev->dev, "PCI->APIC IRQ transform: " 1232 dev_info(&dev->dev, "PCI->APIC IRQ transform: "
1234 "INT %c -> IRQ %d\n", 'A' + pin - 1, irq); 1233 "INT %c -> IRQ %d\n", 'A' + pin - 1, irq);
@@ -1254,3 +1253,12 @@ static int pirq_enable_irq(struct pci_dev *dev)
1254 } 1253 }
1255 return 0; 1254 return 0;
1256} 1255}
1256
1257static void pirq_disable_irq(struct pci_dev *dev)
1258{
1259 if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared &&
1260 dev->irq) {
1261 mp_unmap_irq(dev->irq);
1262 dev->irq = 0;
1263 }
1264}
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 905956f16465..093f5f4272d3 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -23,6 +23,7 @@
23#include <xen/features.h> 23#include <xen/features.h>
24#include <xen/events.h> 24#include <xen/events.h>
25#include <asm/xen/pci.h> 25#include <asm/xen/pci.h>
26#include <asm/i8259.h>
26 27
27static int xen_pcifront_enable_irq(struct pci_dev *dev) 28static int xen_pcifront_enable_irq(struct pci_dev *dev)
28{ 29{
@@ -40,7 +41,7 @@ static int xen_pcifront_enable_irq(struct pci_dev *dev)
40 /* In PV DomU the Xen PCI backend puts the PIRQ in the interrupt line.*/ 41 /* In PV DomU the Xen PCI backend puts the PIRQ in the interrupt line.*/
41 pirq = gsi; 42 pirq = gsi;
42 43
43 if (gsi < NR_IRQS_LEGACY) 44 if (gsi < nr_legacy_irqs())
44 share = 0; 45 share = 0;
45 46
46 rc = xen_bind_pirq_gsi_to_irq(gsi, pirq, share, "pcifront"); 47 rc = xen_bind_pirq_gsi_to_irq(gsi, pirq, share, "pcifront");
@@ -511,7 +512,7 @@ int __init pci_xen_initial_domain(void)
511 xen_setup_acpi_sci(); 512 xen_setup_acpi_sci();
512 __acpi_register_gsi = acpi_register_gsi_xen; 513 __acpi_register_gsi = acpi_register_gsi_xen;
513 /* Pre-allocate legacy irqs */ 514 /* Pre-allocate legacy irqs */
514 for (irq = 0; irq < NR_IRQS_LEGACY; irq++) { 515 for (irq = 0; irq < nr_legacy_irqs(); irq++) {
515 int trigger, polarity; 516 int trigger, polarity;
516 517
517 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1) 518 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1)
@@ -522,7 +523,7 @@ int __init pci_xen_initial_domain(void)
522 true /* Map GSI to PIRQ */); 523 true /* Map GSI to PIRQ */);
523 } 524 }
524 if (0 == nr_ioapics) { 525 if (0 == nr_ioapics) {
525 for (irq = 0; irq < NR_IRQS_LEGACY; irq++) 526 for (irq = 0; irq < nr_legacy_irqs(); irq++)
526 xen_bind_pirq_gsi_to_irq(irq, irq, 0, "xt-pic"); 527 xen_bind_pirq_gsi_to_irq(irq, irq, 0, "xt-pic");
527 } 528 }
528 return 0; 529 return 0;
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index 8244f5ec2f4c..701fd5843c87 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -135,14 +135,10 @@ static void __init sdv_arch_setup(void)
135 sdv_serial_fixup(); 135 sdv_serial_fixup();
136} 136}
137 137
138#ifdef CONFIG_X86_IO_APIC
139static void sdv_pci_init(void) 138static void sdv_pci_init(void)
140{ 139{
141 x86_of_pci_init(); 140 x86_of_pci_init();
142 /* We can't set this earlier, because we need to calibrate the timer */
143 legacy_pic = &null_legacy_pic;
144} 141}
145#endif
146 142
147/* 143/*
148 * CE4100 specific x86_init function overrides and early setup 144 * CE4100 specific x86_init function overrides and early setup
@@ -155,7 +151,9 @@ void __init x86_ce4100_early_setup(void)
155 x86_init.resources.probe_roms = x86_init_noop; 151 x86_init.resources.probe_roms = x86_init_noop;
156 x86_init.mpparse.get_smp_config = x86_init_uint_noop; 152 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
157 x86_init.mpparse.find_smp_config = x86_init_noop; 153 x86_init.mpparse.find_smp_config = x86_init_noop;
154 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;
158 x86_init.pci.init = ce4100_pci_init; 155 x86_init.pci.init = ce4100_pci_init;
156 x86_init.pci.init_irq = sdv_pci_init;
159 157
160 /* 158 /*
161 * By default, the reboot method is ACPI which is supported by the 159 * By default, the reboot method is ACPI which is supported by the
@@ -166,10 +164,5 @@ void __init x86_ce4100_early_setup(void)
166 */ 164 */
167 reboot_type = BOOT_KBD; 165 reboot_type = BOOT_KBD;
168 166
169#ifdef CONFIG_X86_IO_APIC
170 x86_init.pci.init_irq = sdv_pci_init;
171 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;
172#endif
173
174 pm_power_off = ce4100_power_off; 167 pm_power_off = ce4100_power_off;
175} 168}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
index 973cf3bfa9fd..0b283d4d0ad7 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
@@ -26,28 +26,18 @@ static struct platform_device wdt_dev = {
26 26
27static int tangier_probe(struct platform_device *pdev) 27static int tangier_probe(struct platform_device *pdev)
28{ 28{
29 int ioapic; 29 int gsi;
30 int irq;
31 struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data; 30 struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
32 struct io_apic_irq_attr irq_attr = { 0 };
33 31
34 if (!pdata) 32 if (!pdata)
35 return -EINVAL; 33 return -EINVAL;
36 34
37 irq = pdata->irq; 35 /* IOAPIC builds identity mapping between GSI and IRQ on MID */
38 ioapic = mp_find_ioapic(irq); 36 gsi = pdata->irq;
39 if (ioapic >= 0) { 37 if (mp_set_gsi_attr(gsi, 1, 0, cpu_to_node(0)) ||
40 int ret; 38 mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC) <= 0) {
41 irq_attr.ioapic = ioapic;
42 irq_attr.ioapic_pin = irq;
43 irq_attr.trigger = 1;
44 /* irq_attr.polarity = 0; -> Active high */
45 ret = io_apic_set_pci_routing(NULL, irq, &irq_attr);
46 if (ret)
47 return ret;
48 } else {
49 dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n", 39 dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
50 irq); 40 gsi);
51 return -EINVAL; 41 return -EINVAL;
52 } 42 }
53 43
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 994c40bd7cb7..3c53a90fdb18 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -432,9 +432,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
432 struct sfi_table_simple *sb; 432 struct sfi_table_simple *sb;
433 struct sfi_device_table_entry *pentry; 433 struct sfi_device_table_entry *pentry;
434 struct devs_id *dev = NULL; 434 struct devs_id *dev = NULL;
435 int num, i; 435 int num, i, ret;
436 int ioapic; 436 int polarity;
437 struct io_apic_irq_attr irq_attr;
438 437
439 sb = (struct sfi_table_simple *)table; 438 sb = (struct sfi_table_simple *)table;
440 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry); 439 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry);
@@ -448,35 +447,30 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
448 * devices, but they have separate RTE entry in IOAPIC 447 * devices, but they have separate RTE entry in IOAPIC
449 * so we have to enable them one by one here 448 * so we have to enable them one by one here
450 */ 449 */
451 ioapic = mp_find_ioapic(irq); 450 if (intel_mid_identify_cpu() ==
452 if (ioapic >= 0) { 451 INTEL_MID_CPU_CHIP_TANGIER) {
453 irq_attr.ioapic = ioapic; 452 if (!strncmp(pentry->name, "r69001-ts-i2c", 13))
454 irq_attr.ioapic_pin = irq; 453 /* active low */
455 irq_attr.trigger = 1; 454 polarity = 1;
456 if (intel_mid_identify_cpu() == 455 else if (!strncmp(pentry->name,
457 INTEL_MID_CPU_CHIP_TANGIER) { 456 "synaptics_3202", 14))
458 if (!strncmp(pentry->name, 457 /* active low */
459 "r69001-ts-i2c", 13)) 458 polarity = 1;
460 /* active low */ 459 else if (irq == 41)
461 irq_attr.polarity = 1; 460 /* fast_int_1 */
462 else if (!strncmp(pentry->name, 461 polarity = 1;
463 "synaptics_3202", 14)) 462 else
464 /* active low */ 463 /* active high */
465 irq_attr.polarity = 1; 464 polarity = 0;
466 else if (irq == 41) 465 } else {
467 /* fast_int_1 */ 466 /* PNW and CLV go with active low */
468 irq_attr.polarity = 1; 467 polarity = 1;
469 else
470 /* active high */
471 irq_attr.polarity = 0;
472 } else {
473 /* PNW and CLV go with active low */
474 irq_attr.polarity = 1;
475 }
476 io_apic_set_pci_routing(NULL, irq, &irq_attr);
477 } 468 }
478 } else { 469
479 irq = 0; /* No irq */ 470 ret = mp_set_gsi_attr(irq, 1, polarity, NUMA_NO_NODE);
471 if (ret == 0)
472 ret = mp_map_gsi_to_irq(irq, IOAPIC_MAP_ALLOC);
473 WARN_ON(ret < 0);
480 } 474 }
481 475
482 dev = get_device_id(pentry->type, pentry->name); 476 dev = get_device_id(pentry->type, pentry->name);
diff --git a/arch/x86/platform/sfi/sfi.c b/arch/x86/platform/sfi/sfi.c
index bcd1a703e3e6..2a8a74f3bd76 100644
--- a/arch/x86/platform/sfi/sfi.c
+++ b/arch/x86/platform/sfi/sfi.c
@@ -25,6 +25,7 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sfi.h> 26#include <linux/sfi.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/irqdomain.h>
28 29
29#include <asm/io_apic.h> 30#include <asm/io_apic.h>
30#include <asm/mpspec.h> 31#include <asm/mpspec.h>
@@ -70,19 +71,26 @@ static int __init sfi_parse_cpus(struct sfi_table_header *table)
70#endif /* CONFIG_X86_LOCAL_APIC */ 71#endif /* CONFIG_X86_LOCAL_APIC */
71 72
72#ifdef CONFIG_X86_IO_APIC 73#ifdef CONFIG_X86_IO_APIC
74static struct irq_domain_ops sfi_ioapic_irqdomain_ops = {
75 .map = mp_irqdomain_map,
76};
73 77
74static int __init sfi_parse_ioapic(struct sfi_table_header *table) 78static int __init sfi_parse_ioapic(struct sfi_table_header *table)
75{ 79{
76 struct sfi_table_simple *sb; 80 struct sfi_table_simple *sb;
77 struct sfi_apic_table_entry *pentry; 81 struct sfi_apic_table_entry *pentry;
78 int i, num; 82 int i, num;
83 struct ioapic_domain_cfg cfg = {
84 .type = IOAPIC_DOMAIN_STRICT,
85 .ops = &sfi_ioapic_irqdomain_ops,
86 };
79 87
80 sb = (struct sfi_table_simple *)table; 88 sb = (struct sfi_table_simple *)table;
81 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); 89 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
82 pentry = (struct sfi_apic_table_entry *)sb->pentry; 90 pentry = (struct sfi_apic_table_entry *)sb->pentry;
83 91
84 for (i = 0; i < num; i++) { 92 for (i = 0; i < num; i++) {
85 mp_register_ioapic(i, pentry->phys_addr, gsi_top); 93 mp_register_ioapic(i, pentry->phys_addr, gsi_top, &cfg);
86 pentry++; 94 pentry++;
87 } 95 }
88 96
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index ed161c6e278b..3968d67d366b 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1479,7 +1479,7 @@ static ssize_t ptc_proc_write(struct file *file, const char __user *user,
1479 return count; 1479 return count;
1480 } 1480 }
1481 1481
1482 if (strict_strtol(optstr, 10, &input_arg) < 0) { 1482 if (kstrtol(optstr, 10, &input_arg) < 0) {
1483 printk(KERN_DEBUG "%s is invalid\n", optstr); 1483 printk(KERN_DEBUG "%s is invalid\n", optstr);
1484 return -EINVAL; 1484 return -EINVAL;
1485 } 1485 }
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
new file mode 100644
index 000000000000..7fde9ee438a4
--- /dev/null
+++ b/arch/x86/purgatory/Makefile
@@ -0,0 +1,30 @@
1purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
2
3targets += $(purgatory-y)
4PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
5
6LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
7targets += purgatory.ro
8
9# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
10# in turn leaves some undefined symbols like __fentry__ in purgatory and not
11# sure how to relocate those. Like kexec-tools, use custom flags.
12
13KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
14
15$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
16 $(call if_changed,ld)
17
18targets += kexec-purgatory.c
19
20quiet_cmd_bin2c = BIN2C $@
21 cmd_bin2c = cat $(obj)/purgatory.ro | $(objtree)/scripts/basic/bin2c kexec_purgatory > $(obj)/kexec-purgatory.c
22
23$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
24 $(call if_changed,bin2c)
25
26
27# No loaders for 32bits yet.
28ifeq ($(CONFIG_X86_64),y)
29 obj-$(CONFIG_KEXEC) += kexec-purgatory.o
30endif
diff --git a/arch/x86/purgatory/entry64.S b/arch/x86/purgatory/entry64.S
new file mode 100644
index 000000000000..d1a4291d3568
--- /dev/null
+++ b/arch/x86/purgatory/entry64.S
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2003,2004 Eric Biederman (ebiederm@xmission.com)
3 * Copyright (C) 2014 Red Hat Inc.
4
5 * Author(s): Vivek Goyal <vgoyal@redhat.com>
6 *
7 * This code has been taken from kexec-tools.
8 *
9 * This source code is licensed under the GNU General Public License,
10 * Version 2. See the file COPYING for more details.
11 */
12
13 .text
14 .balign 16
15 .code64
16 .globl entry64, entry64_regs
17
18
19entry64:
20 /* Setup a gdt that should be preserved */
21 lgdt gdt(%rip)
22
23 /* load the data segments */
24 movl $0x18, %eax /* data segment */
25 movl %eax, %ds
26 movl %eax, %es
27 movl %eax, %ss
28 movl %eax, %fs
29 movl %eax, %gs
30
31 /* Setup new stack */
32 leaq stack_init(%rip), %rsp
33 pushq $0x10 /* CS */
34 leaq new_cs_exit(%rip), %rax
35 pushq %rax
36 lretq
37new_cs_exit:
38
39 /* Load the registers */
40 movq rax(%rip), %rax
41 movq rbx(%rip), %rbx
42 movq rcx(%rip), %rcx
43 movq rdx(%rip), %rdx
44 movq rsi(%rip), %rsi
45 movq rdi(%rip), %rdi
46 movq rsp(%rip), %rsp
47 movq rbp(%rip), %rbp
48 movq r8(%rip), %r8
49 movq r9(%rip), %r9
50 movq r10(%rip), %r10
51 movq r11(%rip), %r11
52 movq r12(%rip), %r12
53 movq r13(%rip), %r13
54 movq r14(%rip), %r14
55 movq r15(%rip), %r15
56
57 /* Jump to the new code... */
58 jmpq *rip(%rip)
59
60 .section ".rodata"
61 .balign 4
62entry64_regs:
63rax: .quad 0x0
64rcx: .quad 0x0
65rdx: .quad 0x0
66rbx: .quad 0x0
67rsp: .quad 0x0
68rbp: .quad 0x0
69rsi: .quad 0x0
70rdi: .quad 0x0
71r8: .quad 0x0
72r9: .quad 0x0
73r10: .quad 0x0
74r11: .quad 0x0
75r12: .quad 0x0
76r13: .quad 0x0
77r14: .quad 0x0
78r15: .quad 0x0
79rip: .quad 0x0
80 .size entry64_regs, . - entry64_regs
81
82 /* GDT */
83 .section ".rodata"
84 .balign 16
85gdt:
86 /* 0x00 unusable segment
87 * 0x08 unused
88 * so use them as gdt ptr
89 */
90 .word gdt_end - gdt - 1
91 .quad gdt
92 .word 0, 0, 0
93
94 /* 0x10 4GB flat code segment */
95 .word 0xFFFF, 0x0000, 0x9A00, 0x00AF
96
97 /* 0x18 4GB flat data segment */
98 .word 0xFFFF, 0x0000, 0x9200, 0x00CF
99gdt_end:
100stack: .quad 0, 0
101stack_init:
diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
new file mode 100644
index 000000000000..25e068ba3382
--- /dev/null
+++ b/arch/x86/purgatory/purgatory.c
@@ -0,0 +1,72 @@
1/*
2 * purgatory: Runs between two kernels
3 *
4 * Copyright (C) 2014 Red Hat Inc.
5 *
6 * Author:
7 * Vivek Goyal <vgoyal@redhat.com>
8 *
9 * This source code is licensed under the GNU General Public License,
10 * Version 2. See the file COPYING for more details.
11 */
12
13#include "sha256.h"
14#include "../boot/string.h"
15
16struct sha_region {
17 unsigned long start;
18 unsigned long len;
19};
20
21unsigned long backup_dest = 0;
22unsigned long backup_src = 0;
23unsigned long backup_sz = 0;
24
25u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
26
27struct sha_region sha_regions[16] = {};
28
29/*
30 * On x86, second kernel requries first 640K of memory to boot. Copy
31 * first 640K to a backup region in reserved memory range so that second
32 * kernel can use first 640K.
33 */
34static int copy_backup_region(void)
35{
36 if (backup_dest)
37 memcpy((void *)backup_dest, (void *)backup_src, backup_sz);
38
39 return 0;
40}
41
42int verify_sha256_digest(void)
43{
44 struct sha_region *ptr, *end;
45 u8 digest[SHA256_DIGEST_SIZE];
46 struct sha256_state sctx;
47
48 sha256_init(&sctx);
49 end = &sha_regions[sizeof(sha_regions)/sizeof(sha_regions[0])];
50 for (ptr = sha_regions; ptr < end; ptr++)
51 sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
52
53 sha256_final(&sctx, digest);
54
55 if (memcmp(digest, sha256_digest, sizeof(digest)))
56 return 1;
57
58 return 0;
59}
60
61void purgatory(void)
62{
63 int ret;
64
65 ret = verify_sha256_digest();
66 if (ret) {
67 /* loop forever */
68 for (;;)
69 ;
70 }
71 copy_backup_region();
72}
diff --git a/arch/x86/purgatory/setup-x86_64.S b/arch/x86/purgatory/setup-x86_64.S
new file mode 100644
index 000000000000..fe3c91ba1bd0
--- /dev/null
+++ b/arch/x86/purgatory/setup-x86_64.S
@@ -0,0 +1,58 @@
1/*
2 * purgatory: setup code
3 *
4 * Copyright (C) 2003,2004 Eric Biederman (ebiederm@xmission.com)
5 * Copyright (C) 2014 Red Hat Inc.
6 *
7 * This code has been taken from kexec-tools.
8 *
9 * This source code is licensed under the GNU General Public License,
10 * Version 2. See the file COPYING for more details.
11 */
12
13 .text
14 .globl purgatory_start
15 .balign 16
16purgatory_start:
17 .code64
18
19 /* Load a gdt so I know what the segment registers are */
20 lgdt gdt(%rip)
21
22 /* load the data segments */
23 movl $0x18, %eax /* data segment */
24 movl %eax, %ds
25 movl %eax, %es
26 movl %eax, %ss
27 movl %eax, %fs
28 movl %eax, %gs
29
30 /* Setup a stack */
31 leaq lstack_end(%rip), %rsp
32
33 /* Call the C code */
34 call purgatory
35 jmp entry64
36
37 .section ".rodata"
38 .balign 16
39gdt: /* 0x00 unusable segment
40 * 0x08 unused
41 * so use them as the gdt ptr
42 */
43 .word gdt_end - gdt - 1
44 .quad gdt
45 .word 0, 0, 0
46
47 /* 0x10 4GB flat code segment */
48 .word 0xFFFF, 0x0000, 0x9A00, 0x00AF
49
50 /* 0x18 4GB flat data segment */
51 .word 0xFFFF, 0x0000, 0x9200, 0x00CF
52gdt_end:
53
54 .bss
55 .balign 4096
56lstack:
57 .skip 4096
58lstack_end:
diff --git a/arch/x86/purgatory/sha256.c b/arch/x86/purgatory/sha256.c
new file mode 100644
index 000000000000..548ca675a14a
--- /dev/null
+++ b/arch/x86/purgatory/sha256.c
@@ -0,0 +1,283 @@
1/*
2 * SHA-256, as specified in
3 * http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf
4 *
5 * SHA-256 code by Jean-Luc Cooke <jlcooke@certainkey.com>.
6 *
7 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
8 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
9 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
10 * Copyright (c) 2014 Red Hat Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 */
17
18#include <linux/bitops.h>
19#include <asm/byteorder.h>
20#include "sha256.h"
21#include "../boot/string.h"
22
23static inline u32 Ch(u32 x, u32 y, u32 z)
24{
25 return z ^ (x & (y ^ z));
26}
27
28static inline u32 Maj(u32 x, u32 y, u32 z)
29{
30 return (x & y) | (z & (x | y));
31}
32
33#define e0(x) (ror32(x, 2) ^ ror32(x, 13) ^ ror32(x, 22))
34#define e1(x) (ror32(x, 6) ^ ror32(x, 11) ^ ror32(x, 25))
35#define s0(x) (ror32(x, 7) ^ ror32(x, 18) ^ (x >> 3))
36#define s1(x) (ror32(x, 17) ^ ror32(x, 19) ^ (x >> 10))
37
38static inline void LOAD_OP(int I, u32 *W, const u8 *input)
39{
40 W[I] = __be32_to_cpu(((__be32 *)(input))[I]);
41}
42
43static inline void BLEND_OP(int I, u32 *W)
44{
45 W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
46}
47
48static void sha256_transform(u32 *state, const u8 *input)
49{
50 u32 a, b, c, d, e, f, g, h, t1, t2;
51 u32 W[64];
52 int i;
53
54 /* load the input */
55 for (i = 0; i < 16; i++)
56 LOAD_OP(i, W, input);
57
58 /* now blend */
59 for (i = 16; i < 64; i++)
60 BLEND_OP(i, W);
61
62 /* load the state into our registers */
63 a = state[0]; b = state[1]; c = state[2]; d = state[3];
64 e = state[4]; f = state[5]; g = state[6]; h = state[7];
65
66 /* now iterate */
67 t1 = h + e1(e) + Ch(e, f, g) + 0x428a2f98 + W[0];
68 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2;
69 t1 = g + e1(d) + Ch(d, e, f) + 0x71374491 + W[1];
70 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2;
71 t1 = f + e1(c) + Ch(c, d, e) + 0xb5c0fbcf + W[2];
72 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2;
73 t1 = e + e1(b) + Ch(b, c, d) + 0xe9b5dba5 + W[3];
74 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2;
75 t1 = d + e1(a) + Ch(a, b, c) + 0x3956c25b + W[4];
76 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2;
77 t1 = c + e1(h) + Ch(h, a, b) + 0x59f111f1 + W[5];
78 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1 + t2;
79 t1 = b + e1(g) + Ch(g, h, a) + 0x923f82a4 + W[6];
80 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1 + t2;
81 t1 = a + e1(f) + Ch(f, g, h) + 0xab1c5ed5 + W[7];
82 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2;
83
84 t1 = h + e1(e) + Ch(e, f, g) + 0xd807aa98 + W[8];
85 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2;
86 t1 = g + e1(d) + Ch(d, e, f) + 0x12835b01 + W[9];
87 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2;
88 t1 = f + e1(c) + Ch(c, d, e) + 0x243185be + W[10];
89 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2;
90 t1 = e + e1(b) + Ch(b, c, d) + 0x550c7dc3 + W[11];
91 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2;
92 t1 = d + e1(a) + Ch(a, b, c) + 0x72be5d74 + W[12];
93 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2;
94 t1 = c + e1(h) + Ch(h, a, b) + 0x80deb1fe + W[13];
95 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1 + t2;
96 t1 = b + e1(g) + Ch(g, h, a) + 0x9bdc06a7 + W[14];
97 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1 + t2;
98 t1 = a + e1(f) + Ch(f, g, h) + 0xc19bf174 + W[15];
99 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
100
101 t1 = h + e1(e) + Ch(e, f, g) + 0xe49b69c1 + W[16];
102 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
103 t1 = g + e1(d) + Ch(d, e, f) + 0xefbe4786 + W[17];
104 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
105 t1 = f + e1(c) + Ch(c, d, e) + 0x0fc19dc6 + W[18];
106 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
107 t1 = e + e1(b) + Ch(b, c, d) + 0x240ca1cc + W[19];
108 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
109 t1 = d + e1(a) + Ch(a, b, c) + 0x2de92c6f + W[20];
110 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
111 t1 = c + e1(h) + Ch(h, a, b) + 0x4a7484aa + W[21];
112 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
113 t1 = b + e1(g) + Ch(g, h, a) + 0x5cb0a9dc + W[22];
114 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
115 t1 = a + e1(f) + Ch(f, g, h) + 0x76f988da + W[23];
116 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
117
118 t1 = h + e1(e) + Ch(e, f, g) + 0x983e5152 + W[24];
119 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
120 t1 = g + e1(d) + Ch(d, e, f) + 0xa831c66d + W[25];
121 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
122 t1 = f + e1(c) + Ch(c, d, e) + 0xb00327c8 + W[26];
123 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
124 t1 = e + e1(b) + Ch(b, c, d) + 0xbf597fc7 + W[27];
125 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
126 t1 = d + e1(a) + Ch(a, b, c) + 0xc6e00bf3 + W[28];
127 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
128 t1 = c + e1(h) + Ch(h, a, b) + 0xd5a79147 + W[29];
129 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
130 t1 = b + e1(g) + Ch(g, h, a) + 0x06ca6351 + W[30];
131 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
132 t1 = a + e1(f) + Ch(f, g, h) + 0x14292967 + W[31];
133 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
134
135 t1 = h + e1(e) + Ch(e, f, g) + 0x27b70a85 + W[32];
136 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
137 t1 = g + e1(d) + Ch(d, e, f) + 0x2e1b2138 + W[33];
138 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
139 t1 = f + e1(c) + Ch(c, d, e) + 0x4d2c6dfc + W[34];
140 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
141 t1 = e + e1(b) + Ch(b, c, d) + 0x53380d13 + W[35];
142 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
143 t1 = d + e1(a) + Ch(a, b, c) + 0x650a7354 + W[36];
144 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
145 t1 = c + e1(h) + Ch(h, a, b) + 0x766a0abb + W[37];
146 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
147 t1 = b + e1(g) + Ch(g, h, a) + 0x81c2c92e + W[38];
148 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
149 t1 = a + e1(f) + Ch(f, g, h) + 0x92722c85 + W[39];
150 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
151
152 t1 = h + e1(e) + Ch(e, f, g) + 0xa2bfe8a1 + W[40];
153 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
154 t1 = g + e1(d) + Ch(d, e, f) + 0xa81a664b + W[41];
155 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
156 t1 = f + e1(c) + Ch(c, d, e) + 0xc24b8b70 + W[42];
157 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
158 t1 = e + e1(b) + Ch(b, c, d) + 0xc76c51a3 + W[43];
159 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
160 t1 = d + e1(a) + Ch(a, b, c) + 0xd192e819 + W[44];
161 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
162 t1 = c + e1(h) + Ch(h, a, b) + 0xd6990624 + W[45];
163 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
164 t1 = b + e1(g) + Ch(g, h, a) + 0xf40e3585 + W[46];
165 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
166 t1 = a + e1(f) + Ch(f, g, h) + 0x106aa070 + W[47];
167 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
168
169 t1 = h + e1(e) + Ch(e, f, g) + 0x19a4c116 + W[48];
170 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
171 t1 = g + e1(d) + Ch(d, e, f) + 0x1e376c08 + W[49];
172 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
173 t1 = f + e1(c) + Ch(c, d, e) + 0x2748774c + W[50];
174 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
175 t1 = e + e1(b) + Ch(b, c, d) + 0x34b0bcb5 + W[51];
176 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
177 t1 = d + e1(a) + Ch(a, b, c) + 0x391c0cb3 + W[52];
178 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
179 t1 = c + e1(h) + Ch(h, a, b) + 0x4ed8aa4a + W[53];
180 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
181 t1 = b + e1(g) + Ch(g, h, a) + 0x5b9cca4f + W[54];
182 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
183 t1 = a + e1(f) + Ch(f, g, h) + 0x682e6ff3 + W[55];
184 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
185
186 t1 = h + e1(e) + Ch(e, f, g) + 0x748f82ee + W[56];
187 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1+t2;
188 t1 = g + e1(d) + Ch(d, e, f) + 0x78a5636f + W[57];
189 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1+t2;
190 t1 = f + e1(c) + Ch(c, d, e) + 0x84c87814 + W[58];
191 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1+t2;
192 t1 = e + e1(b) + Ch(b, c, d) + 0x8cc70208 + W[59];
193 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1+t2;
194 t1 = d + e1(a) + Ch(a, b, c) + 0x90befffa + W[60];
195 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1+t2;
196 t1 = c + e1(h) + Ch(h, a, b) + 0xa4506ceb + W[61];
197 t2 = e0(d) + Maj(d, e, f); g += t1; c = t1+t2;
198 t1 = b + e1(g) + Ch(g, h, a) + 0xbef9a3f7 + W[62];
199 t2 = e0(c) + Maj(c, d, e); f += t1; b = t1+t2;
200 t1 = a + e1(f) + Ch(f, g, h) + 0xc67178f2 + W[63];
201 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1+t2;
202
203 state[0] += a; state[1] += b; state[2] += c; state[3] += d;
204 state[4] += e; state[5] += f; state[6] += g; state[7] += h;
205
206 /* clear any sensitive info... */
207 a = b = c = d = e = f = g = h = t1 = t2 = 0;
208 memset(W, 0, 64 * sizeof(u32));
209}
210
211int sha256_init(struct sha256_state *sctx)
212{
213 sctx->state[0] = SHA256_H0;
214 sctx->state[1] = SHA256_H1;
215 sctx->state[2] = SHA256_H2;
216 sctx->state[3] = SHA256_H3;
217 sctx->state[4] = SHA256_H4;
218 sctx->state[5] = SHA256_H5;
219 sctx->state[6] = SHA256_H6;
220 sctx->state[7] = SHA256_H7;
221 sctx->count = 0;
222
223 return 0;
224}
225
226int sha256_update(struct sha256_state *sctx, const u8 *data, unsigned int len)
227{
228 unsigned int partial, done;
229 const u8 *src;
230
231 partial = sctx->count & 0x3f;
232 sctx->count += len;
233 done = 0;
234 src = data;
235
236 if ((partial + len) > 63) {
237 if (partial) {
238 done = -partial;
239 memcpy(sctx->buf + partial, data, done + 64);
240 src = sctx->buf;
241 }
242
243 do {
244 sha256_transform(sctx->state, src);
245 done += 64;
246 src = data + done;
247 } while (done + 63 < len);
248
249 partial = 0;
250 }
251 memcpy(sctx->buf + partial, src, len - done);
252
253 return 0;
254}
255
256int sha256_final(struct sha256_state *sctx, u8 *out)
257{
258 __be32 *dst = (__be32 *)out;
259 __be64 bits;
260 unsigned int index, pad_len;
261 int i;
262 static const u8 padding[64] = { 0x80, };
263
264 /* Save number of bits */
265 bits = cpu_to_be64(sctx->count << 3);
266
267 /* Pad out to 56 mod 64. */
268 index = sctx->count & 0x3f;
269 pad_len = (index < 56) ? (56 - index) : ((64+56) - index);
270 sha256_update(sctx, padding, pad_len);
271
272 /* Append length (before padding) */
273 sha256_update(sctx, (const u8 *)&bits, sizeof(bits));
274
275 /* Store state in digest */
276 for (i = 0; i < 8; i++)
277 dst[i] = cpu_to_be32(sctx->state[i]);
278
279 /* Zeroize sensitive information. */
280 memset(sctx, 0, sizeof(*sctx));
281
282 return 0;
283}
diff --git a/arch/x86/purgatory/sha256.h b/arch/x86/purgatory/sha256.h
new file mode 100644
index 000000000000..bd15a4127735
--- /dev/null
+++ b/arch/x86/purgatory/sha256.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Red Hat Inc.
3 *
4 * Author: Vivek Goyal <vgoyal@redhat.com>
5 *
6 * This source code is licensed under the GNU General Public License,
7 * Version 2. See the file COPYING for more details.
8 */
9
10#ifndef SHA256_H
11#define SHA256_H
12
13
14#include <linux/types.h>
15#include <crypto/sha.h>
16
17extern int sha256_init(struct sha256_state *sctx);
18extern int sha256_update(struct sha256_state *sctx, const u8 *input,
19 unsigned int length);
20extern int sha256_final(struct sha256_state *sctx, u8 *hash);
21
22#endif /* SHA256_H */
diff --git a/arch/x86/purgatory/stack.S b/arch/x86/purgatory/stack.S
new file mode 100644
index 000000000000..3cefba1fefc8
--- /dev/null
+++ b/arch/x86/purgatory/stack.S
@@ -0,0 +1,19 @@
1/*
2 * purgatory: stack
3 *
4 * Copyright (C) 2014 Red Hat Inc.
5 *
6 * This source code is licensed under the GNU General Public License,
7 * Version 2. See the file COPYING for more details.
8 */
9
10 /* A stack for the loaded kernel.
11 * Seperate and in the data section so it can be prepopulated.
12 */
13 .data
14 .balign 4096
15 .globl stack, stack_end
16
17stack:
18 .skip 4096
19stack_end:
diff --git a/arch/x86/purgatory/string.c b/arch/x86/purgatory/string.c
new file mode 100644
index 000000000000..d886b1fa36f0
--- /dev/null
+++ b/arch/x86/purgatory/string.c
@@ -0,0 +1,13 @@
1/*
2 * Simple string functions.
3 *
4 * Copyright (C) 2014 Red Hat Inc.
5 *
6 * Author:
7 * Vivek Goyal <vgoyal@redhat.com>
8 *
9 * This source code is licensed under the GNU General Public License,
10 * Version 2. See the file COPYING for more details.
11 */
12
13#include "../boot/string.c"
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index d6b867921612..028b78168d85 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -360,3 +360,6 @@
360351 i386 sched_setattr sys_sched_setattr 360351 i386 sched_setattr sys_sched_setattr
361352 i386 sched_getattr sys_sched_getattr 361352 i386 sched_getattr sys_sched_getattr
362353 i386 renameat2 sys_renameat2 362353 i386 renameat2 sys_renameat2
363354 i386 seccomp sys_seccomp
364355 i386 getrandom sys_getrandom
365356 i386 memfd_create sys_memfd_create
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index ec255a1646d2..35dd922727b9 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -323,6 +323,10 @@
323314 common sched_setattr sys_sched_setattr 323314 common sched_setattr sys_sched_setattr
324315 common sched_getattr sys_sched_getattr 324315 common sched_getattr sys_sched_getattr
325316 common renameat2 sys_renameat2 325316 common renameat2 sys_renameat2
326317 common seccomp sys_seccomp
327318 common getrandom sys_getrandom
328319 common memfd_create sys_memfd_create
329320 common kexec_file_load sys_kexec_file_load
326 330
327# 331#
328# x32-specific system call numbers start at 512 to avoid cache impact 332# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h
index 0feee2fd5077..25a1022dd793 100644
--- a/arch/x86/um/asm/elf.h
+++ b/arch/x86/um/asm/elf.h
@@ -216,6 +216,5 @@ extern long elf_aux_hwcap;
216#define ELF_HWCAP (elf_aux_hwcap) 216#define ELF_HWCAP (elf_aux_hwcap)
217 217
218#define SET_PERSONALITY(ex) do ; while(0) 218#define SET_PERSONALITY(ex) do ; while(0)
219#define __HAVE_ARCH_GATE_AREA 1
220 219
221#endif 220#endif
diff --git a/arch/x86/um/mem_64.c b/arch/x86/um/mem_64.c
index c6492e75797b..f8fecaddcc0d 100644
--- a/arch/x86/um/mem_64.c
+++ b/arch/x86/um/mem_64.c
@@ -9,18 +9,3 @@ const char *arch_vma_name(struct vm_area_struct *vma)
9 9
10 return NULL; 10 return NULL;
11} 11}
12
13struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
14{
15 return NULL;
16}
17
18int in_gate_area(struct mm_struct *mm, unsigned long addr)
19{
20 return 0;
21}
22
23int in_gate_area_no_mm(unsigned long addr)
24{
25 return 0;
26}
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index 5e04a1c899fa..79d824551c1a 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -370,13 +370,12 @@ struct rt_sigframe
370 char retcode[8]; 370 char retcode[8];
371}; 371};
372 372
373int setup_signal_stack_sc(unsigned long stack_top, int sig, 373int setup_signal_stack_sc(unsigned long stack_top, struct ksignal *ksig,
374 struct k_sigaction *ka, struct pt_regs *regs, 374 struct pt_regs *regs, sigset_t *mask)
375 sigset_t *mask)
376{ 375{
377 struct sigframe __user *frame; 376 struct sigframe __user *frame;
378 void __user *restorer; 377 void __user *restorer;
379 int err = 0; 378 int err = 0, sig = ksig->sig;
380 379
381 /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */ 380 /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */
382 stack_top = ((stack_top + 4) & -16UL) - 4; 381 stack_top = ((stack_top + 4) & -16UL) - 4;
@@ -385,8 +384,8 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
385 return 1; 384 return 1;
386 385
387 restorer = frame->retcode; 386 restorer = frame->retcode;
388 if (ka->sa.sa_flags & SA_RESTORER) 387 if (ksig->ka.sa.sa_flags & SA_RESTORER)
389 restorer = ka->sa.sa_restorer; 388 restorer = ksig->ka.sa.sa_restorer;
390 389
391 err |= __put_user(restorer, &frame->pretcode); 390 err |= __put_user(restorer, &frame->pretcode);
392 err |= __put_user(sig, &frame->sig); 391 err |= __put_user(sig, &frame->sig);
@@ -410,20 +409,19 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
410 return err; 409 return err;
411 410
412 PT_REGS_SP(regs) = (unsigned long) frame; 411 PT_REGS_SP(regs) = (unsigned long) frame;
413 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 412 PT_REGS_IP(regs) = (unsigned long) ksig->ka.sa.sa_handler;
414 PT_REGS_AX(regs) = (unsigned long) sig; 413 PT_REGS_AX(regs) = (unsigned long) sig;
415 PT_REGS_DX(regs) = (unsigned long) 0; 414 PT_REGS_DX(regs) = (unsigned long) 0;
416 PT_REGS_CX(regs) = (unsigned long) 0; 415 PT_REGS_CX(regs) = (unsigned long) 0;
417 return 0; 416 return 0;
418} 417}
419 418
420int setup_signal_stack_si(unsigned long stack_top, int sig, 419int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
421 struct k_sigaction *ka, struct pt_regs *regs, 420 struct pt_regs *regs, sigset_t *mask)
422 siginfo_t *info, sigset_t *mask)
423{ 421{
424 struct rt_sigframe __user *frame; 422 struct rt_sigframe __user *frame;
425 void __user *restorer; 423 void __user *restorer;
426 int err = 0; 424 int err = 0, sig = ksig->sig;
427 425
428 stack_top &= -8UL; 426 stack_top &= -8UL;
429 frame = (struct rt_sigframe __user *) stack_top - 1; 427 frame = (struct rt_sigframe __user *) stack_top - 1;
@@ -431,14 +429,14 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
431 return 1; 429 return 1;
432 430
433 restorer = frame->retcode; 431 restorer = frame->retcode;
434 if (ka->sa.sa_flags & SA_RESTORER) 432 if (ksig->ka.sa.sa_flags & SA_RESTORER)
435 restorer = ka->sa.sa_restorer; 433 restorer = ksig->ka.sa.sa_restorer;
436 434
437 err |= __put_user(restorer, &frame->pretcode); 435 err |= __put_user(restorer, &frame->pretcode);
438 err |= __put_user(sig, &frame->sig); 436 err |= __put_user(sig, &frame->sig);
439 err |= __put_user(&frame->info, &frame->pinfo); 437 err |= __put_user(&frame->info, &frame->pinfo);
440 err |= __put_user(&frame->uc, &frame->puc); 438 err |= __put_user(&frame->uc, &frame->puc);
441 err |= copy_siginfo_to_user(&frame->info, info); 439 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
442 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask, 440 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask,
443 PT_REGS_SP(regs)); 441 PT_REGS_SP(regs));
444 442
@@ -457,7 +455,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
457 return err; 455 return err;
458 456
459 PT_REGS_SP(regs) = (unsigned long) frame; 457 PT_REGS_SP(regs) = (unsigned long) frame;
460 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 458 PT_REGS_IP(regs) = (unsigned long) ksig->ka.sa.sa_handler;
461 PT_REGS_AX(regs) = (unsigned long) sig; 459 PT_REGS_AX(regs) = (unsigned long) sig;
462 PT_REGS_DX(regs) = (unsigned long) &frame->info; 460 PT_REGS_DX(regs) = (unsigned long) &frame->info;
463 PT_REGS_CX(regs) = (unsigned long) &frame->uc; 461 PT_REGS_CX(regs) = (unsigned long) &frame->uc;
@@ -502,12 +500,11 @@ struct rt_sigframe
502 struct _fpstate fpstate; 500 struct _fpstate fpstate;
503}; 501};
504 502
505int setup_signal_stack_si(unsigned long stack_top, int sig, 503int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
506 struct k_sigaction *ka, struct pt_regs * regs, 504 struct pt_regs *regs, sigset_t *set)
507 siginfo_t *info, sigset_t *set)
508{ 505{
509 struct rt_sigframe __user *frame; 506 struct rt_sigframe __user *frame;
510 int err = 0; 507 int err = 0, sig = ksig->sig;
511 508
512 frame = (struct rt_sigframe __user *) 509 frame = (struct rt_sigframe __user *)
513 round_down(stack_top - sizeof(struct rt_sigframe), 16); 510 round_down(stack_top - sizeof(struct rt_sigframe), 16);
@@ -517,8 +514,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
517 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 514 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
518 goto out; 515 goto out;
519 516
520 if (ka->sa.sa_flags & SA_SIGINFO) { 517 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
521 err |= copy_siginfo_to_user(&frame->info, info); 518 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
522 if (err) 519 if (err)
523 goto out; 520 goto out;
524 } 521 }
@@ -543,8 +540,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
543 * already in userspace. 540 * already in userspace.
544 */ 541 */
545 /* x86-64 should always use SA_RESTORER. */ 542 /* x86-64 should always use SA_RESTORER. */
546 if (ka->sa.sa_flags & SA_RESTORER) 543 if (ksig->ka.sa.sa_flags & SA_RESTORER)
547 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 544 err |= __put_user(ksig->ka.sa.sa_restorer, &frame->pretcode);
548 else 545 else
549 /* could use a vstub here */ 546 /* could use a vstub here */
550 return err; 547 return err;
@@ -570,7 +567,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
570 */ 567 */
571 PT_REGS_SI(regs) = (unsigned long) &frame->info; 568 PT_REGS_SI(regs) = (unsigned long) &frame->info;
572 PT_REGS_DX(regs) = (unsigned long) &frame->uc; 569 PT_REGS_DX(regs) = (unsigned long) &frame->uc;
573 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 570 PT_REGS_IP(regs) = (unsigned long) ksig->ka.sa.sa_handler;
574 out: 571 out:
575 return err; 572 return err;
576} 573}
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index e4f7781ee162..e904c270573b 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -115,23 +115,6 @@ static __init int ia32_binfmt_init(void)
115 return 0; 115 return 0;
116} 116}
117__initcall(ia32_binfmt_init); 117__initcall(ia32_binfmt_init);
118#endif 118#endif /* CONFIG_SYSCTL */
119
120#else /* CONFIG_X86_32 */
121
122struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
123{
124 return NULL;
125}
126
127int in_gate_area(struct mm_struct *mm, unsigned long addr)
128{
129 return 0;
130}
131
132int in_gate_area_no_mm(unsigned long addr)
133{
134 return 0;
135}
136 119
137#endif /* CONFIG_X86_64 */ 120#endif /* CONFIG_X86_64 */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 94813515fdd6..c0cb11fb5008 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1828,8 +1828,19 @@ static void __init xen_hvm_guest_init(void)
1828 xen_hvm_init_mmu_ops(); 1828 xen_hvm_init_mmu_ops();
1829} 1829}
1830 1830
1831static bool xen_nopv = false;
1832static __init int xen_parse_nopv(char *arg)
1833{
1834 xen_nopv = true;
1835 return 0;
1836}
1837early_param("xen_nopv", xen_parse_nopv);
1838
1831static uint32_t __init xen_hvm_platform(void) 1839static uint32_t __init xen_hvm_platform(void)
1832{ 1840{
1841 if (xen_nopv)
1842 return 0;
1843
1833 if (xen_pv_domain()) 1844 if (xen_pv_domain())
1834 return 0; 1845 return 0;
1835 1846
@@ -1838,6 +1849,8 @@ static uint32_t __init xen_hvm_platform(void)
1838 1849
1839bool xen_hvm_need_lapic(void) 1850bool xen_hvm_need_lapic(void)
1840{ 1851{
1852 if (xen_nopv)
1853 return false;
1841 if (xen_pv_domain()) 1854 if (xen_pv_domain())
1842 return false; 1855 return false;
1843 if (!xen_hvm_domain()) 1856 if (!xen_hvm_domain())
diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c
index ebfa9b2c871d..1580e7a5a4cf 100644
--- a/arch/x86/xen/grant-table.c
+++ b/arch/x86/xen/grant-table.c
@@ -49,7 +49,7 @@
49static struct gnttab_vm_area { 49static struct gnttab_vm_area {
50 struct vm_struct *area; 50 struct vm_struct *area;
51 pte_t **ptes; 51 pte_t **ptes;
52} gnttab_shared_vm_area, gnttab_status_vm_area; 52} gnttab_shared_vm_area;
53 53
54int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 54int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
55 unsigned long max_nr_gframes, 55 unsigned long max_nr_gframes,
@@ -73,43 +73,16 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
73 return 0; 73 return 0;
74} 74}
75 75
76int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
77 unsigned long max_nr_gframes,
78 grant_status_t **__shared)
79{
80 grant_status_t *shared = *__shared;
81 unsigned long addr;
82 unsigned long i;
83
84 if (shared == NULL)
85 *__shared = shared = gnttab_status_vm_area.area->addr;
86
87 addr = (unsigned long)shared;
88
89 for (i = 0; i < nr_gframes; i++) {
90 set_pte_at(&init_mm, addr, gnttab_status_vm_area.ptes[i],
91 mfn_pte(frames[i], PAGE_KERNEL));
92 addr += PAGE_SIZE;
93 }
94
95 return 0;
96}
97
98void arch_gnttab_unmap(void *shared, unsigned long nr_gframes) 76void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
99{ 77{
100 pte_t **ptes;
101 unsigned long addr; 78 unsigned long addr;
102 unsigned long i; 79 unsigned long i;
103 80
104 if (shared == gnttab_status_vm_area.area->addr)
105 ptes = gnttab_status_vm_area.ptes;
106 else
107 ptes = gnttab_shared_vm_area.ptes;
108
109 addr = (unsigned long)shared; 81 addr = (unsigned long)shared;
110 82
111 for (i = 0; i < nr_gframes; i++) { 83 for (i = 0; i < nr_gframes; i++) {
112 set_pte_at(&init_mm, addr, ptes[i], __pte(0)); 84 set_pte_at(&init_mm, addr, gnttab_shared_vm_area.ptes[i],
85 __pte(0));
113 addr += PAGE_SIZE; 86 addr += PAGE_SIZE;
114 } 87 }
115} 88}
@@ -129,35 +102,12 @@ static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames)
129 return 0; 102 return 0;
130} 103}
131 104
132static void arch_gnttab_vfree(struct gnttab_vm_area *area) 105int arch_gnttab_init(unsigned long nr_shared)
133{ 106{
134 free_vm_area(area->area);
135 kfree(area->ptes);
136}
137
138int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status)
139{
140 int ret;
141
142 if (!xen_pv_domain()) 107 if (!xen_pv_domain())
143 return 0; 108 return 0;
144 109
145 ret = arch_gnttab_valloc(&gnttab_shared_vm_area, nr_shared); 110 return arch_gnttab_valloc(&gnttab_shared_vm_area, nr_shared);
146 if (ret < 0)
147 return ret;
148
149 /*
150 * Always allocate the space for the status frames in case
151 * we're migrated to a host with V2 support.
152 */
153 ret = arch_gnttab_valloc(&gnttab_status_vm_area, nr_status);
154 if (ret < 0)
155 goto err;
156
157 return 0;
158 err:
159 arch_gnttab_vfree(&gnttab_shared_vm_area);
160 return -ENOMEM;
161} 111}
162 112
163#ifdef CONFIG_XEN_PVH 113#ifdef CONFIG_XEN_PVH
@@ -168,6 +118,7 @@ static int __init xlated_setup_gnttab_pages(void)
168{ 118{
169 struct page **pages; 119 struct page **pages;
170 xen_pfn_t *pfns; 120 xen_pfn_t *pfns;
121 void *vaddr;
171 int rc; 122 int rc;
172 unsigned int i; 123 unsigned int i;
173 unsigned long nr_grant_frames = gnttab_max_grant_frames(); 124 unsigned long nr_grant_frames = gnttab_max_grant_frames();
@@ -193,21 +144,20 @@ static int __init xlated_setup_gnttab_pages(void)
193 for (i = 0; i < nr_grant_frames; i++) 144 for (i = 0; i < nr_grant_frames; i++)
194 pfns[i] = page_to_pfn(pages[i]); 145 pfns[i] = page_to_pfn(pages[i]);
195 146
196 rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames, 147 vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL);
197 &xen_auto_xlat_grant_frames.vaddr); 148 if (!vaddr) {
198
199 if (rc) {
200 pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__, 149 pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
201 nr_grant_frames, rc); 150 nr_grant_frames, rc);
202 free_xenballooned_pages(nr_grant_frames, pages); 151 free_xenballooned_pages(nr_grant_frames, pages);
203 kfree(pages); 152 kfree(pages);
204 kfree(pfns); 153 kfree(pfns);
205 return rc; 154 return -ENOMEM;
206 } 155 }
207 kfree(pages); 156 kfree(pages);
208 157
209 xen_auto_xlat_grant_frames.pfn = pfns; 158 xen_auto_xlat_grant_frames.pfn = pfns;
210 xen_auto_xlat_grant_frames.count = nr_grant_frames; 159 xen_auto_xlat_grant_frames.count = nr_grant_frames;
160 xen_auto_xlat_grant_frames.vaddr = vaddr;
211 161
212 return 0; 162 return 0;
213} 163}
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 9bb3d82ffec8..3172692381ae 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -841,10 +841,9 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
841 pfn = ALIGN(pfn, P2M_PER_PAGE); 841 pfn = ALIGN(pfn, P2M_PER_PAGE);
842 } 842 }
843 843
844 if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s), 844 WARN((pfn - pfn_s) != (pfn_e - pfn_s),
845 "Identity mapping failed. We are %ld short of 1-1 mappings!\n", 845 "Identity mapping failed. We are %ld short of 1-1 mappings!\n",
846 (pfn_e - pfn_s) - (pfn - pfn_s))) 846 (pfn_e - pfn_s) - (pfn - pfn_s));
847 printk(KERN_DEBUG "1-1 mapping on %lx->%lx\n", pfn_s, pfn);
848 847
849 return pfn - pfn_s; 848 return pfn - pfn_s;
850} 849}
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 7b78f88c1707..5718b0b58b60 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -444,7 +444,7 @@ void xen_setup_timer(int cpu)
444 444
445 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, 445 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| 446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
447 IRQF_FORCE_RESUME, 447 IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
448 name, NULL); 448 name, NULL);
449 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX); 449 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
450 450
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index 98b67d5f1514..4612321c73cc 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -331,17 +331,17 @@ gen_return_code(unsigned char *codemem)
331} 331}
332 332
333 333
334static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 334static int setup_frame(struct ksignal *ksig, sigset_t *set,
335 sigset_t *set, struct pt_regs *regs) 335 struct pt_regs *regs)
336{ 336{
337 struct rt_sigframe *frame; 337 struct rt_sigframe *frame;
338 int err = 0; 338 int err = 0, sig = ksig->sig;
339 int signal; 339 int signal;
340 unsigned long sp, ra, tp; 340 unsigned long sp, ra, tp;
341 341
342 sp = regs->areg[1]; 342 sp = regs->areg[1];
343 343
344 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) { 344 if ((ksig->ka.sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) {
345 sp = current->sas_ss_sp + current->sas_ss_size; 345 sp = current->sas_ss_sp + current->sas_ss_size;
346 } 346 }
347 347
@@ -351,7 +351,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
351 panic ("Double exception sys_sigreturn\n"); 351 panic ("Double exception sys_sigreturn\n");
352 352
353 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) { 353 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) {
354 goto give_sigsegv; 354 return -EFAULT;
355 } 355 }
356 356
357 signal = current_thread_info()->exec_domain 357 signal = current_thread_info()->exec_domain
@@ -360,8 +360,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
360 ? current_thread_info()->exec_domain->signal_invmap[sig] 360 ? current_thread_info()->exec_domain->signal_invmap[sig]
361 : sig; 361 : sig;
362 362
363 if (ka->sa.sa_flags & SA_SIGINFO) { 363 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
364 err |= copy_siginfo_to_user(&frame->info, info); 364 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
365 } 365 }
366 366
367 /* Create the user context. */ 367 /* Create the user context. */
@@ -372,8 +372,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
372 err |= setup_sigcontext(frame, regs); 372 err |= setup_sigcontext(frame, regs);
373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
374 374
375 if (ka->sa.sa_flags & SA_RESTORER) { 375 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
376 ra = (unsigned long)ka->sa.sa_restorer; 376 ra = (unsigned long)ksig->ka.sa.sa_restorer;
377 } else { 377 } else {
378 378
379 /* Create sys_rt_sigreturn syscall in stack frame */ 379 /* Create sys_rt_sigreturn syscall in stack frame */
@@ -381,7 +381,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
381 err |= gen_return_code(frame->retcode); 381 err |= gen_return_code(frame->retcode);
382 382
383 if (err) { 383 if (err) {
384 goto give_sigsegv; 384 return -EFAULT;
385 } 385 }
386 ra = (unsigned long) frame->retcode; 386 ra = (unsigned long) frame->retcode;
387 } 387 }
@@ -393,7 +393,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
393 393
394 /* Set up registers for signal handler; preserve the threadptr */ 394 /* Set up registers for signal handler; preserve the threadptr */
395 tp = regs->threadptr; 395 tp = regs->threadptr;
396 start_thread(regs, (unsigned long) ka->sa.sa_handler, 396 start_thread(regs, (unsigned long) ksig->ka.sa.sa_handler,
397 (unsigned long) frame); 397 (unsigned long) frame);
398 398
399 /* Set up a stack frame for a call4 399 /* Set up a stack frame for a call4
@@ -416,10 +416,6 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
416#endif 416#endif
417 417
418 return 0; 418 return 0;
419
420give_sigsegv:
421 force_sigsegv(sig, current);
422 return -EFAULT;
423} 419}
424 420
425/* 421/*
@@ -433,15 +429,11 @@ give_sigsegv:
433 */ 429 */
434static void do_signal(struct pt_regs *regs) 430static void do_signal(struct pt_regs *regs)
435{ 431{
436 siginfo_t info; 432 struct ksignal ksig;
437 int signr;
438 struct k_sigaction ka;
439 433
440 task_pt_regs(current)->icountlevel = 0; 434 task_pt_regs(current)->icountlevel = 0;
441 435
442 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 436 if (get_signal(&ksig)) {
443
444 if (signr > 0) {
445 int ret; 437 int ret;
446 438
447 /* Are we from a system call? */ 439 /* Are we from a system call? */
@@ -457,7 +449,7 @@ static void do_signal(struct pt_regs *regs)
457 break; 449 break;
458 450
459 case -ERESTARTSYS: 451 case -ERESTARTSYS:
460 if (!(ka.sa.sa_flags & SA_RESTART)) { 452 if (!(ksig.ka.sa.sa_flags & SA_RESTART)) {
461 regs->areg[2] = -EINTR; 453 regs->areg[2] = -EINTR;
462 break; 454 break;
463 } 455 }
@@ -476,11 +468,8 @@ static void do_signal(struct pt_regs *regs)
476 468
477 /* Whee! Actually deliver the signal. */ 469 /* Whee! Actually deliver the signal. */
478 /* Set up the stack frame */ 470 /* Set up the stack frame */
479 ret = setup_frame(signr, &ka, &info, sigmask_to_save(), regs); 471 ret = setup_frame(&ksig, sigmask_to_save(), regs);
480 if (ret) 472 signal_setup_done(ret, &ksig, 0);
481 return;
482
483 signal_delivered(signr, &info, &ka, regs, 0);
484 if (current->ptrace & PT_SINGLESTEP) 473 if (current->ptrace & PT_SINGLESTEP)
485 task_pt_regs(current)->icountlevel = 1; 474 task_pt_regs(current)->icountlevel = 1;
486 475